feat: 新建最后一区

This commit is contained in:
AncTe committed 2024-10-01 10:35:27 +08:00
1 parent 42f611b357
commit ac3b0c0fc2
21 files changed
+331 -56

No files matched your search

+5 -45
View File
@@ -77,7 +77,7 @@ const hook = Mota.require('var', 'hook');
hook.once('reset', () => {
Shadow.init();
addLightFromBlock(
core.floorIds.slice(61, 70).concat(core.floorIds.slice(72, 81)).concat(core.floorIds.slice(85, 103)),
core.floorIds.slice(61, 70).concat(core.floorIds.slice(72, 81)).concat(core.floorIds.slice(85, 107)),
103,
{ decay: 50, r: 300, color: [0.9333, 0.6, 0.333, 0.3] },
{ background: [0, 0, 0, 0.2] },
@@ -89,48 +89,12 @@ hook.once('reset', () => {
{ decay: 20, r: 150, color: [0.9333, 0.6, 0.333, 0.3], noShelter: true },
{ background: [0, 0, 0, 0.3] }
);
// Shadow.mount();
// 勇士身上的光源
// Mota.rewrite(core.control, 'drawHero', 'add', () => {
// if (core.getFlag('__heroOpacity__') !== 0) {
// const shadow = Shadow.now();
// if (shadow) {
// shadow.followHero.forEach(v => {
// shadow.modifyLight(v, {
// x: core.status.heroCenter.px,
// y: core.status.heroCenter.py + 8
// });
// });
// if (shadow.followHero.size > 0) shadow.requestRefresh();
// }
// }
// });
// 更新地形数据
// Mota.rewrite(core.maps, 'removeBlock', 'add', success => {
// if (success && !main.replayChecking) {
// Shadow.update(true);
// }
// return success;
// });
// Mota.rewrite(core.maps, 'setBlock', 'add', () => {
// if (!main.replayChecking) {
// Shadow.update(true);
// }
// });
Mota.rewrite(core.control, 'loadData', 'add', () => {
if (!main.replayChecking) {
Shadow.update(true);
LayerShadowExtends.shadowList.forEach(v => v.update());
}
});
// Mota.require('var', 'hook').on('changingFloor', (floorId) => {
// if (!main.replayChecking) {
// Shadow.clearBuffer();
// Shadow.update();
// setCanvasFilterByFloorId(floorId);
// }
// })
});
hook.on('reset', () => {
Shadow.update(true);
@@ -1015,7 +979,6 @@ export class Shadow {
*/
static clearBuffer() {
const gl = this.gl;
const canvas = this.canvas;
gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer.depth.position);
gl.bufferData(gl.ARRAY_BUFFER, 0, gl.STATIC_DRAW);
@@ -1037,11 +1000,6 @@ export class Shadow {
static update(nocache: boolean = false) {
const floor = core.status.floorId;
this.map[floor]?.requestRefresh(nocache);
if (!this.map[floor]) {
this.canvas.style.display = 'none';
} else {
this.canvas.style.display = 'block';
}
}
static now() {
@@ -1348,8 +1306,10 @@ export class LayerShadowExtends implements ILayerRenderExtends {
this.sprite = new Sprite('static', false);
this.sprite.setHD(true);
this.sprite.size(layer.width, layer.height);
this.sprite.setRenderFn((canvas, transform) => {
canvas.ctx.drawImage(Shadow.canvas, 0, 0, layer.width, layer.height);
this.sprite.setRenderFn((canvas, transform) => {
if (Shadow.map[core.status.floorId]) {
canvas.ctx.drawImage(Shadow.canvas, 0, 0, layer.width, layer.height);
}
});
layer.appendChild(this.sprite);
+12
View File
@@ -365,6 +365,18 @@ export class Damage extends Sprite<EDamageEvent> {
};
block.add(dam4);
}
if (enemy.col && real.special.has(33)) {
const dam5: DamageRenderable = {
align: 'right',
baseline: 'top',
text: enemy.col.list.size.toString(),
color: '#fff866',
x: x * this.cellSize + this.cellSize - 1,
y: y * this.cellSize + 2,
strokeWidth: 3
};
block.add(dam5);
}
}
/**
+11 -2
View File
@@ -74,7 +74,7 @@ export const haloSpecials: Set<number> = new Set([
]);
/** 不可被同化的属性 */
export const unassimilatable: Set<number> = new Set(haloSpecials);
unassimilatable.add(8).add(30);
unassimilatable.add(8).add(30).add(33);
/** 特殊属性对应 */
export const specialValue: Map<number, SelectKey<Enemy, number | undefined>[]> =
new Map();
@@ -95,7 +95,8 @@ specialValue
.set(26, ['iceCore'])
.set(27, ['fireCore'])
.set(28, ['paleShield'])
.set(31, ['hpHalo']);
.set(31, ['hpHalo'])
.set(32, ['assimilateRange']);
interface EnemyCollectionEvent {
extract: [];
@@ -365,6 +366,14 @@ export class DamageEnemy<T extends EnemyIds = EnemyIds> {
// 此时已经inject光环,因此直接计算真实属性
const info = this.info;
if (info.special.has(33)) {
const count = this.col?.list.size ?? 0;
const [hp, atk, def] = this.enemy.horn ?? [0, 0, 0];
info.hpBuff_ += hp * count;
info.atkBuff_ += atk * count;
info.defBuff_ += def * count;
}
info.atk = Math.floor(info.atk * (info.atkBuff_ / 100 + 1));
info.def = Math.floor(info.def * (info.defBuff_ / 100 + 1));
info.hp = Math.floor(info.hp * (info.hpBuff_ / 100 + 1));
+14
View File
@@ -262,5 +262,19 @@ export const specials: SpecialDeclaration[] = [
`怪物会获得自身周围方形${enemy.assimilateRange}格范围内怪物的特殊属性(光环类属性除外),` +
`特殊属性数值间为${enemy.specialMultiply ? '乘算' : '加算'}关系`,
color: '#ffd366'
},
{
code: 33,
name: '战争号角',
desc: enemy => {
const [hp, atk, def] = enemy.horn ?? [];
let str = '地图上每存在一个怪物(包括自身),自身';
if (hp) str += `生命值增加${hp}%,`;
if (atk) str += `攻击增加${atk}%,`;
if (def) str += `防御增加${def}%,`;
str += '线性叠加';
return str;
},
color: '#fff866'
}
];
+2 -2
View File
@@ -13,9 +13,9 @@ function getCanvasFilterByFloorId(floorId: FloorIds = core.status.floorId) {
Mota.require('var', 'loading').once('coreInit', () => {
filterMap.push(
[['MT50', 'MT60', 'MT61'], 'brightness(80%)contrast(120%)'], // 童心佬的滤镜(
[['MT50', 'MT60', 'MT61'], 'contrast(120%)'], // 童心佬的滤镜(
[
core.floorIds.slice(61, 70).concat(core.floorIds.slice(72)),
core.floorIds.slice(61, 70).concat(core.floorIds.slice(72, 107)),
'contrast(120%)'
] // 童心佬的滤镜(
);
+8
View File
@@ -625,6 +625,14 @@ interface IdToCls {
I695: 'items';
I696: 'items';
I697: 'items';
E698: 'enemys';
E699: 'enemys';
E700: 'enemys';
E701: 'enemys';
E702: 'enemys';
E703: 'enemys';
E704: 'enemys';
E705: 'enemys';
X20032: 'tileset';
X20033: 'tileset';
X20034: 'tileset';
+4
View File
@@ -103,6 +103,10 @@ type FloorIds =
| 'MT91'
| 'MT92'
| 'MT93'
| 'MT94'
| 'MT95'
| 'MT96'
| 'MT97'
type ImageIds =
| 'IQ.png'
+16
View File
@@ -625,6 +625,14 @@ interface IdToNumber {
I695: 695;
I696: 696;
I697: 697;
E698: 698;
E699: 699;
E700: 700;
E701: 701;
E702: 702;
E703: 703;
E704: 704;
E705: 705;
X20032: 20032;
X20033: 20033;
X20034: 20034;
@@ -1335,6 +1343,14 @@ interface NumberToId {
695: 'I695';
696: 'I696';
697: 'I697';
698: 'E698';
699: 'E699';
700: 'E700';
701: 'E701';
702: 'E702';
703: 'E703';
704: 'E704';
705: 'E705';
20032: 'X20032';
20033: 'X20033';
20034: 'X20034';
+2
View File
@@ -91,6 +91,8 @@ type Enemy<I extends EnemyIds = EnemyIds> = {
specialHalo?: number[];
translation?: [number, number];
/** 战争号角 */
horn?: [number, number, number];
/** 大怪物绑定贴图 */
bigImage?: ImageIds;