Fix #5085: Moves dont play a No Effect Message Against Immune Type

When using non-volatile status move like: Will-O-Wisp, Thunder
Wave, Toxic, or Poison Gas against a Pokémon whose type is immune
to that Status condition, no "It doesn't affect" message plays.

My proposed fixes:
In move.ts:
Updated isTypeImmune() function to receive another parameter
"move: Move" and to include the cases in which the status moves listed
in the bug are being used against the corresponding immune type
pokemon.
In pokemon.ts:
Updated the function call of "isTypeImmune()" to correspond with
the newly added parameter.
This commit is contained in:
Inês Simões 2025-03-15 21:59:37 +00:00
parent 7aa5649aa8
commit 83f79fb63b
2 changed files with 22 additions and 2 deletions

View File

@ -323,7 +323,7 @@ export default class Move implements Localizable {
* @param {PokemonType} type the type of the move's target
* @returns boolean
*/
isTypeImmune(user: Pokemon, target: Pokemon, type: PokemonType): boolean {
isTypeImmune(user: Pokemon, target: Pokemon, type: PokemonType, move: Move): boolean {
if (this.moveTarget === MoveTarget.USER) {
return false;
}
@ -339,6 +339,26 @@ export default class Move implements Localizable {
return true;
}
break;
case PokemonType.FIRE:
if (move.id === Moves.WILL_O_WISP) {
return true;
}
break;
case PokemonType.ELECTRIC:
if (move.id === Moves.THUNDER_WAVE) {
return true;
}
break;
case PokemonType.POISON:
if (move.id === Moves.TOXIC) {
return true;
}
break;
case PokemonType.STEEL:
if (move.id === Moves.POISON_GAS) {
return true;
}
break;
}
return false;
}

View File

@ -2459,7 +2459,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
typeMultiplier,
);
if (
this.getTypes(true, true).find(t => move.isTypeImmune(source, this, t))
this.getTypes(true, true).find(t => move.isTypeImmune(source, this, t, move))
) {
typeMultiplier.value = 0;
}