Merge e7c3532405
into 2778eb2651
commit
b2abe8da48
|
@ -2270,12 +2270,8 @@ export class MovePhase extends BattlePhase {
|
|||
}
|
||||
|
||||
const targets = this.scene.getField(true).filter(p => {
|
||||
if (this.targets.indexOf(p.getBattlerIndex()) > -1) {
|
||||
const hiddenTag = p.getTag(HiddenTag);
|
||||
if (hiddenTag && !this.move.getMove().getAttrs(HitsTagAttr).filter(hta => (hta as HitsTagAttr).tagType === hiddenTag.tagType).length && !p.hasAbilityWithAttr(AlwaysHitAbAttr) && !this.pokemon.hasAbilityWithAttr(AlwaysHitAbAttr))
|
||||
return false;
|
||||
if (this.targets.indexOf(p.getBattlerIndex()) > -1)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
|
@ -2316,10 +2312,17 @@ export class MovePhase extends BattlePhase {
|
|||
if (this.move.moveId)
|
||||
this.showMoveText();
|
||||
|
||||
if ((moveQueue.length && moveQueue[0].move === Moves.NONE) || (!targets.length && !this.move.getMove().getAttrs(SacrificialAttr).length)) {
|
||||
moveQueue.shift();
|
||||
// This should only happen when there are no valid targets left on the field
|
||||
if ((moveQueue.length && moveQueue[0].move === Moves.NONE) || !targets.length) {
|
||||
this.showFailedText();
|
||||
this.cancel();
|
||||
|
||||
// Record a failed move so Abilities like Truant don't trigger next turn and soft-lock
|
||||
this.pokemon.pushMoveHistory({ move: Moves.NONE, result: MoveResult.FAIL });
|
||||
|
||||
this.pokemon.lapseTags(BattlerTagLapseType.MOVE_EFFECT); // Remove any tags from moves like Fly/Dive/etc.
|
||||
|
||||
moveQueue.shift();
|
||||
return this.end();
|
||||
}
|
||||
|
||||
|
@ -2590,13 +2593,14 @@ export class MoveEffectPhase extends PokemonPhase {
|
|||
if (user.hasAbilityWithAttr(AlwaysHitAbAttr) || target.hasAbilityWithAttr(AlwaysHitAbAttr))
|
||||
return true;
|
||||
|
||||
// If the user should ignore accuracy on a target, check who the user targeted last turn and see if they match
|
||||
if (user.getTag(BattlerTagType.IGNORE_ACCURACY) && (user.getLastXMoves().slice(1).find(() => true)?.targets || []).indexOf(target.getBattlerIndex()) !== -1)
|
||||
return true;
|
||||
|
||||
const hiddenTag = target.getTag(HiddenTag);
|
||||
if (hiddenTag && !this.move.getMove().getAttrs(HitsTagAttr).filter(hta => (hta as HitsTagAttr).tagType === hiddenTag.tagType).length)
|
||||
return false;
|
||||
|
||||
if (user.getTag(BattlerTagType.IGNORE_ACCURACY) && (user.getLastXMoves().find(() => true)?.targets || []).indexOf(target.getBattlerIndex()) > -1)
|
||||
return true;
|
||||
|
||||
const moveAccuracy = new Utils.NumberHolder(this.move.getMove().accuracy);
|
||||
|
||||
applyMoveAttrs(VariableAccuracyAttr, user, target, this.move.getMove(), moveAccuracy);
|
||||
|
|
Loading…
Reference in New Issue