临界绘制修正

This commit is contained in:
unanmed 2023-07-13 16:49:58 +08:00
parent 3aea023562
commit faf5a5c0c3

View File

@ -232,7 +232,19 @@ export class EnemyCollection implements RangeCollection<DamageEnemy> {
color: '#fff' color: '#fff'
}); });
} else { } else {
const [min, max] = boundary(v.damage, 'damage'); let min = v.damage[0].damage;
let max = min;
let minI = 0;
for (let i = 1; i < v.damage.length; i++) {
const dam = v.damage[i].damage;
if (dam < min) {
min = dam;
minI = i;
}
if (dam > max) {
max = dam;
}
}
const delta = max - min; const delta = max - min;
const { damage, color } = formatDamage(min); const { damage, color } = formatDamage(min);
// 在怪物位置绘制最低的伤害 // 在怪物位置绘制最低的伤害
@ -242,6 +254,14 @@ export class EnemyCollection implements RangeCollection<DamageEnemy> {
py: 32 * (v.y! + 1) - 1, py: 32 * (v.y! + 1) - 1,
color: color color: color
}); });
// 绘制临界
const critical = v.calCritical(1, v.damage[minI].dir)[0]?.[0];
core.status.damage.data.push({
text: critical?.atkDelta.toString() ?? '?',
px: 32 * v.x! + 1,
py: 32 * (v.y! + 1) - 11,
color: '#fff'
});
// 然后根据位置依次绘制对应位置的伤害 // 然后根据位置依次绘制对应位置的伤害
for (const dam of v.damage) { for (const dam of v.damage) {
if (dam.dir === 'none') continue; if (dam.dir === 'none') continue;