Fix multi target attacks missing when a target is fainted

pull/20/head
Flashfyre 2024-03-28 21:18:07 -04:00
parent 0be4b5dcde
commit 20799f5a4c
2 changed files with 17 additions and 1 deletions

View File

@ -145,6 +145,22 @@ export default class Move {
return !!(this.flags & flag); return !!(this.flags & flag);
} }
isMultiTarget(): boolean {
switch (this.moveTarget) {
case MoveTarget.ALL_OTHERS:
case MoveTarget.ALL_NEAR_OTHERS:
case MoveTarget.ALL_NEAR_ENEMIES:
case MoveTarget.ALL_ENEMIES:
case MoveTarget.USER_AND_ALLIES:
case MoveTarget.ALL:
case MoveTarget.USER_SIDE:
case MoveTarget.ENEMY_SIDE:
case MoveTarget.BOTH_SIDES:
return true;
}
return false;
}
condition(condition: MoveCondition | MoveConditionFunc): this { condition(condition: MoveCondition | MoveConditionFunc): this {
if (typeof condition === 'function') if (typeof condition === 'function')
condition = new MoveCondition(condition as MoveConditionFunc); condition = new MoveCondition(condition as MoveConditionFunc);

View File

@ -2202,7 +2202,7 @@ export class MoveEffectPhase extends PokemonPhase {
const targetHitChecks = Object.fromEntries(targets.map(p => [ p.getBattlerIndex(), this.hitCheck(p) ])); const targetHitChecks = Object.fromEntries(targets.map(p => [ p.getBattlerIndex(), this.hitCheck(p) ]));
const activeTargets = targets.map(t => t.isActive(true)); const activeTargets = targets.map(t => t.isActive(true));
if (targets.length === 1 && !targetHitChecks[this.targets[0]] || !activeTargets.length) { if (!activeTargets.length || (!this.move.getMove().isMultiTarget() && !targetHitChecks[this.targets[0]])) {
user.turnData.hitCount = 1; user.turnData.hitCount = 1;
user.turnData.hitsLeft = 1; user.turnData.hitsLeft = 1;
if (activeTargets.length) { if (activeTargets.length) {