Add carapace animation and handle hive_link ATK buff restoration
- Implement `_animateCarapace` handler in the event switch to support the new carapace effect. - Update `_restoreBuffsForDisplay` to temporarily undo `hive_link` ATK gains, ensuring pre-battle animations display the correct pre-buff values. - Update `_reapplyBuffs` to re-apply `hive_link` ATK gains after state rendering, ensuring the data model is correct for subsequent animations like `animateBerserkGain`. - Update comments to reflect that `hive_link` is now included in the list of buffs temporarily undone for display purposes.
This commit is contained in:
parent
776eb9c4bd
commit
7237d23363
|
|
@ -516,6 +516,7 @@ export class BattleScene extends Phaser.Scene {
|
|||
else if (event.type === 'venomApply') this._animateVenomApply(event, cb);
|
||||
else if (event.type === 'venomApplyAll') this._animateVenomApplyAll(event, cb);
|
||||
else if (event.type === 'hive_link') this._animateHiveLink(event, cb);
|
||||
else if (event.type === 'carapace') this._animateCarapace(event, cb);
|
||||
else cb();
|
||||
};
|
||||
next(0);
|
||||
|
|
@ -3293,8 +3294,8 @@ export class BattleScene extends Phaser.Scene {
|
|||
}
|
||||
}
|
||||
|
||||
// Temporarily undo ATK/ARM buffs (rally, protect, legion, bloodrage) so _renderState()
|
||||
// shows pre-buff values. The preBattle animations will show the gains visually.
|
||||
// Temporarily undo ATK/ARM buffs (rally, protect, legion, bloodrage, hive_link) so
|
||||
// _renderState() shows pre-buff values. The preBattle animations show the gains visually.
|
||||
_restoreBuffsForDisplay(preBattleEvents) {
|
||||
for (const event of preBattleEvents) {
|
||||
for (const buff of event.buffs || []) {
|
||||
|
|
@ -3304,6 +3305,12 @@ export class BattleScene extends Phaser.Scene {
|
|||
buff.target.currentArmor -= buff.amount;
|
||||
}
|
||||
}
|
||||
// Undo hive_link ATK gains so buffed cards display pre-buff ATK until the animation fires.
|
||||
if (event.type === 'hive_link') {
|
||||
for (const t of event.targets || []) {
|
||||
t.target.currentAttack -= t.gain;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3317,6 +3324,13 @@ export class BattleScene extends Phaser.Scene {
|
|||
buff.target.currentArmor += buff.amount;
|
||||
}
|
||||
}
|
||||
// Re-apply hive_link ATK gains after _renderState() so the data model is correct
|
||||
// for the animation (animateBerserkGain reads cardData.currentAttack for the final value).
|
||||
if (event.type === 'hive_link') {
|
||||
for (const t of event.targets || []) {
|
||||
t.target.currentAttack += t.gain;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue