mirror of
https://github.com/unanmed/HumanBreak.git
synced 2026-11-17 12:44:31 +08:00
chore: 怪物伤害计算与特殊属性调整为样板
This commit is contained in:
1 parent
fe46a7b397
commit
7c9847aa40
24 files changed
+578
-751
No files matched your search
@@ -1,12 +1,18 @@
|
||||
import { DamageEnemy } from '@user/data-state';
|
||||
import { findDir, ofDir } from '@user/data-utils';
|
||||
|
||||
export function createCheckBlock() {
|
||||
// 伤害弹出
|
||||
// 复写阻激夹域检测
|
||||
// 地图伤害在这实现。2.C 会修改实现方式
|
||||
control.prototype.checkBlock = function () {
|
||||
const x = core.getHeroLoc('x'),
|
||||
y = core.getHeroLoc('y'),
|
||||
loc = x + ',' + y;
|
||||
const info = core.status.thisMap.enemy.mapDamage[loc];
|
||||
const damage = info?.damage;
|
||||
const heroLoc = core.status.hero.loc;
|
||||
const { x, y } = heroLoc;
|
||||
const loc = `${x},${y}`;
|
||||
const col = core.status.thisMap.enemy;
|
||||
const info = col.mapDamage[loc];
|
||||
if (!info) return;
|
||||
const damage = info.damage;
|
||||
|
||||
// 阻击夹域伤害
|
||||
if (damage) {
|
||||
core.status.hero.hp -= damage;
|
||||
const type = [...info.type];
|
||||
@@ -24,5 +30,62 @@ export function createCheckBlock() {
|
||||
core.updateStatusBar();
|
||||
}
|
||||
}
|
||||
|
||||
const actions: MotaAction[] = [];
|
||||
|
||||
// 阻击效果
|
||||
if (info.repulse) {
|
||||
for (const [x, y] of info.repulse) {
|
||||
const loc2 = { x, y };
|
||||
const dir = findDir(heroLoc, loc2);
|
||||
if (dir === 'none') continue;
|
||||
const [nx, ny] = ofDir(x, y, dir);
|
||||
if (core.noPass(nx, ny) || !core.canMoveHero(x, y, dir)) {
|
||||
continue;
|
||||
}
|
||||
actions.push({
|
||||
type: 'move',
|
||||
time: 250,
|
||||
keep: true,
|
||||
loc: [x, y],
|
||||
steps: [`${dir}:1`],
|
||||
async: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** 存储要和哪些捕捉怪战斗 */
|
||||
const ambushEnemies: DamageEnemy[] = [];
|
||||
|
||||
// 捕捉效果
|
||||
if (info.ambush) {
|
||||
for (const [x, y] of info.ambush) {
|
||||
const loc2 = { x, y };
|
||||
const dir = findDir(loc2, heroLoc);
|
||||
if (dir === 'none') continue;
|
||||
actions.push({
|
||||
type: 'move',
|
||||
time: 250,
|
||||
keep: false,
|
||||
loc: [x, y],
|
||||
steps: [`${dir}:1`],
|
||||
async: true
|
||||
});
|
||||
const enemy = col.get(x, y);
|
||||
if (enemy) {
|
||||
ambushEnemies.push(enemy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (actions.length > 0) {
|
||||
actions.push({ type: 'waitAsync' });
|
||||
// 与捕捉怪战斗
|
||||
core.insertAction(actions, void 0, void 0, () => {
|
||||
ambushEnemies.forEach(v => {
|
||||
core.battle(v, v.y, true);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -514,10 +514,19 @@ export function initFallback() {
|
||||
mover.insertMove(...[start, ...resolved]);
|
||||
const controller = mover.startMove();
|
||||
|
||||
const id = fallbackIds++;
|
||||
core.animateFrame.asyncId[id] = () => {
|
||||
if (!keep) {
|
||||
core.removeBlock(mover.x, mover.y);
|
||||
}
|
||||
};
|
||||
|
||||
if (controller) {
|
||||
await controller.onEnd;
|
||||
}
|
||||
|
||||
delete core.animateFrame.asyncId[id];
|
||||
|
||||
if (!keep) {
|
||||
core.removeBlock(mover.x, mover.y);
|
||||
}
|
||||
@@ -566,7 +575,18 @@ export function initFallback() {
|
||||
|
||||
core.updateStatusBar();
|
||||
core.removeBlock(sx, sy);
|
||||
|
||||
const id = fallbackIds++;
|
||||
core.animateFrame.asyncId[id] = () => {
|
||||
if (keep) {
|
||||
core.setBlock(block.id, ex, ey);
|
||||
}
|
||||
};
|
||||
|
||||
await promise;
|
||||
|
||||
delete core.animateFrame.asyncId[id];
|
||||
|
||||
if (keep) {
|
||||
core.setBlock(block.id, ex, ey);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user