fix: 전투 이펙트와 차등 하네스 호환성을 복원한다
Ref 기준의 판정 순서, 난수 소비, 아이템·특기 이펙트와 로그 형식을 맞춘다. 전체 전투 결과와 이벤트·상태·난수 trace를 엄격 비교하고 fixture 및 출병 예약 회귀를 보강한다.
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import type { RandUtil } from '@sammo-ts/common';
|
||||
import { JosaUtil, type RandUtil } from '@sammo-ts/common';
|
||||
|
||||
import type { General } from '@sammo-ts/logic/domain/entities.js';
|
||||
import { getLegacyBattleItemIdentity, removeEquippedItem } from '@sammo-ts/logic/items/inventory.js';
|
||||
import { LogFormat } from '@sammo-ts/logic/logging/types.js';
|
||||
import { TriggerCaller, type Trigger } from '@sammo-ts/logic/triggers/core.js';
|
||||
import type { WarUnit } from './units.js';
|
||||
import { removeEquippedItem } from '@sammo-ts/logic/items/inventory.js';
|
||||
|
||||
export interface WarTriggerContext {
|
||||
rng: RandUtil;
|
||||
@@ -97,12 +98,6 @@ export abstract class BaseWarUnitTrigger implements WarTrigger {
|
||||
return false;
|
||||
}
|
||||
this.unit.activateSkill('아이템사용');
|
||||
if (this.raiseType !== BaseWarUnitTrigger.TYPE_CONSUMABLE_ITEM) {
|
||||
return false;
|
||||
}
|
||||
if (this.unit.hasActivatedSkill('아이템소모')) {
|
||||
return false;
|
||||
}
|
||||
const unit = this.unit as WarUnit & {
|
||||
getGeneral?: () => General;
|
||||
};
|
||||
@@ -110,7 +105,18 @@ export abstract class BaseWarUnitTrigger implements WarTrigger {
|
||||
if (!general) {
|
||||
return false;
|
||||
}
|
||||
const item = getLegacyBattleItemIdentity(general);
|
||||
this.unit.activateSkill(item.name);
|
||||
if (this.raiseType !== BaseWarUnitTrigger.TYPE_CONSUMABLE_ITEM) {
|
||||
return false;
|
||||
}
|
||||
if (this.unit.hasActivatedSkill('아이템소모')) {
|
||||
return false;
|
||||
}
|
||||
this.unit.activateSkill('아이템소모');
|
||||
return removeEquippedItem(general, 'item') !== null;
|
||||
const josaUl = JosaUtil.pick(item.rawName, '을');
|
||||
this.unit.getLogger().pushGeneralActionLog(`<C>${item.name}</>${josaUl} 사용!`, LogFormat.PLAIN);
|
||||
removeEquippedItem(general, 'item');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user