You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AdLike2048/assets/script/battle/debug/AtkDebugLog.ts

33 lines
1.1 KiB

3 weeks ago
import type { DamageCalcDebugInfo } from 'db://assets/mx/module/battle/combat/DamagePipeline';
import { setDamageCalcDebug } from 'db://assets/mx/module/battle/combat/DamagePipeline';
import { getTowerLoadoutService } from '../combat/TowerLoadoutService';
import { isAtkDebugWeapon } from './AtkDebugConstants';
import { isDesignDebugEnabled } from './DesignDebug';
export { ATK_DEBUG_WEAPON1_ID, isAtkDebugWeapon } from './AtkDebugConstants';
export {
dumpKnifeFinalAttack,
logKnifeBaseAttack,
logKnifeEntryAttack,
} from './AtkDebugLogCore';
let _installed = false;
/** 战斗初始化时挂上伤害结算钩子(DesignDebug 开启时) */
export function installAtkDebugHooks(): void {
if (!isDesignDebugEnabled()) return;
if (_installed) return;
_installed = true;
setDamageCalcDebug((info) => onDamageCalc(info));
}
export function uninstallAtkDebugHooks(): void {
setDamageCalcDebug(null);
_installed = false;
}
function onDamageCalc(info: DamageCalcDebugInfo): void {
const loadout = getTowerLoadoutService().getLoadout(info.caster);
if (!isAtkDebugWeapon(loadout?.weapon1Id)) return;
}