fix: 多朝向怪物

This commit is contained in:
unanmed 2024-03-02 15:51:58 +08:00
parent 5831b18724
commit 828e061fdd
3 changed files with 17 additions and 4 deletions

View File

@ -56,6 +56,14 @@ function init() {
callback?.(); callback?.();
}; };
const getFacedId = (enemy: DamageEnemy) => {
const e = enemy.enemy;
if (e.displayIdInBook) return e.displayIdInBook;
if (e.faceIds) return e.faceIds.down;
return e.id;
};
core.enemys.getCurrentEnemys = function getCurrentEnemys( core.enemys.getCurrentEnemys = function getCurrentEnemys(
floorId = core.status.floorId floorId = core.status.floorId
) { ) {
@ -65,7 +73,8 @@ function init() {
Damage.ensureFloorDamage(floorId); Damage.ensureFloorDamage(floorId);
const floor = core.status.maps[floorId]; const floor = core.status.maps[floorId];
floor.enemy.list.forEach(v => { floor.enemy.list.forEach(v => {
if (!(v.id in used)) { const id = getFacedId(v);
if (!(id in used)) {
const e = new DamageEnemy(v.enemy); const e = new DamageEnemy(v.enemy);
e.calAttribute(); e.calAttribute();
e.getRealInfo(); e.getRealInfo();
@ -75,9 +84,9 @@ function init() {
onMapEnemy: [v] onMapEnemy: [v]
}; };
enemys.push(curr); enemys.push(curr);
used[v.id] = curr.onMapEnemy; used[id] = curr.onMapEnemy;
} else { } else {
used[v.id].push(v); used[id].push(v);
} }
}); });

View File

@ -31,7 +31,6 @@ export function getDetailedEnemy(
const special: [string, string, string][] = enemy.info.special.map(vv => { const special: [string, string, string][] = enemy.info.special.map(vv => {
const s = Mota.require('var', 'enemySpecials')[vv]; const s = Mota.require('var', 'enemySpecials')[vv];
const info = { ...enemy.enemy, ...enemy.info }; const info = { ...enemy.enemy, ...enemy.info };
console.log(info);
return [ return [
fromFunc(s.name, info), fromFunc(s.name, info),

View File

@ -58,6 +58,11 @@ type Enemy<I extends EnemyIds = EnemyIds> = {
*/ */
displayIdInBook: EnemyIds; displayIdInBook: EnemyIds;
/**
*
*/
faceIds: Record<Dir, EnemyIds>;
/** /**
* *
*/ */