feat(combat): expand skill copying and fix drain animation signature

- Updated `SkillProcessor` to allow copying of `preBattle` and `on_attack` triggered skills in addition to `preAttack`, broadening the scope of the `hack` skill.
- Fixed the `_animateDrainFire` call in `BattleScene` to pass the `fire.source` (attacker) as the first argument, ensuring the animation has access to the correct source entity.
This commit is contained in:
Brian Fertig 2026-03-21 20:29:38 -06:00
parent 440662df72
commit 1c99dc233d
2 changed files with 6 additions and 5 deletions

View File

@ -582,12 +582,13 @@ export class SkillProcessor {
hack(skill, attacker, defender, allies, enemies, context) {
if (!defender || defender.currentHP <= 0) return;
const preAttackSkills = defender.skills.filter(s =>
s.trigger === 'preAttack' && s.name !== 'hack'
const copiableSkills = defender.skills.filter(s =>
(s.trigger === 'preAttack' || s.trigger === 'preBattle' || s.trigger === 'on_attack') &&
s.name !== 'hack'
);
if (preAttackSkills.length === 0) return;
if (copiableSkills.length === 0) return;
const copiedSkills = [];
for (const s of preAttackSkills) {
for (const s of copiableSkills) {
copiedSkills.push({ name: s.name, value: skill.value, trigger: s.trigger, all: s.all });
}
if (context) context.hackCopiedSkills = copiedSkills;

View File

@ -4340,7 +4340,7 @@ export class BattleScene extends Phaser.Scene {
else if (fire.skill === 'mortar') this._animateMortarFire(attacker, fire, cb);
else if (fire.skill === 'pierce') this._animatePierceFire(attacker, fire, cb);
else if (fire.skill === 'swipe') this._animateSwipeSequence(attacker, [fire], cb);
else if (fire.skill === 'drain') this._animateDrainFire(fire, cb);
else if (fire.skill === 'drain') this._animateDrainFire(fire.source, fire, cb);
else if (fire.skill === 'jam') this._animateJamFire(fire, cb);
else if (fire.skill === 'venom') this._animateVenomApply(fire, cb);
else if (fire.skill === 'venomAll') this._animateVenomApplyAll(fire, cb);