Fix multi target attacks missing when a target is fainted
parent
0be4b5dcde
commit
20799f5a4c
|
@ -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);
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue