[Beta] Fix hit check so Poison-types do not brick semi-invuln. (#4567)

This commit is contained in:
Lneacx 2024-10-03 20:45:53 -07:00 committed by GitHub
parent 9c56c15a6c
commit 74ea358f18
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View File

@ -407,7 +407,7 @@ export class MoveEffectPhase extends PokemonPhase {
const semiInvulnerableTag = target.getTag(SemiInvulnerableTag);
if (semiInvulnerableTag
&& !this.move.getMove().getAttrs(HitsTagAttr).some(hta => hta.tagType === semiInvulnerableTag.tagType)
&& !(this.move.getMove().getAttrs(ToxicAccuracyAttr) && user.isOfType(Type.POISON))
&& !(this.move.getMove().hasAttr(ToxicAccuracyAttr) && user.isOfType(Type.POISON))
) {
return false;
}

View File

@ -73,4 +73,17 @@ describe("Moves - Toxic", () => {
expect(game.scene.getEnemyPokemon()!.status).toBeUndefined();
});
it("moves other than Toxic should not hit semi-invulnerable targets even if user is Poison-type", async () => {
game.override.moveset(Moves.SWIFT);
game.override.enemyMoveset(Moves.FLY);
await game.classicMode.startBattle([Species.TOXAPEX]);
game.move.select(Moves.SWIFT);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
await game.phaseInterceptor.to("BerryPhase", false);
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp());
});
});