chore: 怪物伤害计算与特殊属性调整为样板

This commit is contained in:
AncTe committed 2025-10-14 13:38:39 +08:00
1 parent fe46a7b397
commit 7c9847aa40
24 files changed
+578 -751

No files matched your search

+34 -15
View File
@@ -94,6 +94,8 @@ export function patchBattle() {
});
});
patch2.add('battle', battle);
patch2.add('_sys_battle', function (data: Block, callback?: () => void) {
// 检查战前事件
const floor = core.floors[core.status.floorId];
@@ -156,8 +158,9 @@ export function patchBattle() {
core.playSound('attack.opus');
// 战斗伤害
const info = enemy.calDamage(core.status.hero);
const damage = info.damage;
const info = enemy.getRealInfo();
const damageInfo = enemy.calDamage(core.status.hero);
const damage = damageInfo.damage;
// 判定是否致死
if (damage >= core.status.hero.hp) {
core.status.hero.hp = 0;
@@ -171,25 +174,41 @@ export function patchBattle() {
core.status.hero.statistics.battleDamage += damage;
core.status.hero.statistics.battle++;
// 获得金币
const money = enemy.info.money!;
// 获得金币经验
const money = core.hasFlag('curse') ? 0 : enemy.info.money!;
const exp = core.hasFlag('curse') ? 0 : enemy.info.exp!;
core.status.hero.money += money;
core.status.hero.statistics.money += money;
// 获得经验
const exp = enemy.info.exp!;
core.status.hero.exp += exp;
core.status.hero.statistics.exp += exp;
const hint =
'打败 ' +
enemy.enemy.name +
',金币+' +
money +
',经验+' +
exp;
const hint = `打败 ${enemy.enemy.name},金币+${money},经验+${exp}`;
core.drawTip(hint, enemy.id);
// 毒衰咒
if (info.special.has(12)) core.setFlag('poison', true);
if (info.special.has(13)) core.setFlag('weak', true);
if (info.special.has(14)) core.setFlag('curse', true);
// 仇恨
if (info.special.has(17)) {
core.setFlag('hatred', core.getFlag('hatred', 0) / 2);
} else {
core.addFlag('hatred', core.values.hatred);
}
// 自爆
if (info.special.has(19)) {
core.status.hero.hp = 1;
}
// 退化
if (info.special.has(21)) {
core.status.hero.atk -= info.atkValue ?? 0;
core.status.hero.def -= info.defValue ?? 0;
}
// 事件的处理
const todo: MotaEvent = [];
@@ -231,7 +250,7 @@ declare global {
interface Events {
battle(
enemy: DamageEnemy,
_?: number,
y?: number,
force?: boolean,
callback?: () => void
): void;
+2 -18
View File
@@ -108,26 +108,10 @@ function renderThumbnailDamage(col: EnemyCollection) {
});
}
// 电摇嘲讽
if (dam.mockery) {
dam.mockery.sort((a, b) =>
a[0] === b[0] ? a[1] - b[1] : a[0] - b[0]
);
const [tx, ty] = dam.mockery[0];
const dir = x > tx ? '←' : x < tx ? '→' : y > ty ? '↑' : '↓';
core.status.damage.extraData.push({
text: '嘲' + dir,
px: 32 * x + 16,
py: 32 * (y + 1) - 14,
color: '#fd4',
alpha: 1
});
}
// 追猎
if (dam.hunt) {
if (dam.ambush) {
core.status.damage.extraData.push({
text: '猎',
text: '!',
px: 32 * x + 16,
py: 32 * (y + 1) - 14,
color: '#fd4',