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: Removed the else condition in the apply() function in StatusEffectAttr class. In pokemon.ts: Added the function "messageIsImmune(quiet: boolean, effect: StatusEffect)" which displays the message "It doesn't affect XXXX" or the " XXXX is already affected by YYY" message, depending if the effect trying to be set is already affecting the pokemon or if the pokemon is immune to the status. Updated the "canSetStatus()" function so that when it returns false (meaning the status couldn't be applied) it calls the "messageIsImmune()" function to display the message correctly.
This commit is contained in:
parent
f4d0d56cfd
commit
b1f183199e
|
@ -2426,8 +2426,6 @@ export class StatusEffectAttr extends MoveEffectAttr {
|
|||
if (pokemon.status) {
|
||||
if (this.overrideStatus) {
|
||||
pokemon.resetStatus();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -251,6 +251,7 @@ import { PLAYER_PARTY_MAX_SIZE } from "#app/constants";
|
|||
import { CustomPokemonData } from "#app/data/custom-pokemon-data";
|
||||
import { SwitchType } from "#enums/switch-type";
|
||||
import { SpeciesFormKey } from "#enums/species-form-key";
|
||||
import {getStatusEffectOverlapText } from "#app/data/status-effect";
|
||||
import {
|
||||
BASE_HIDDEN_ABILITY_CHANCE,
|
||||
BASE_SHINY_CHANCE,
|
||||
|
@ -5300,13 +5301,16 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
);
|
||||
}
|
||||
|
||||
messageIsImmune(quiet: boolean): boolean {
|
||||
if(!quiet){
|
||||
globalScene.queueMessage(
|
||||
i18next.t("abilityTriggers:moveImmunity", {pokemonNameWithAffix: getPokemonNameWithAffix(this),})
|
||||
);
|
||||
messageIsImmune(quiet: boolean, effect?: StatusEffect): void {
|
||||
if (!effect || quiet) {
|
||||
return;
|
||||
}
|
||||
return false;
|
||||
const message = effect && this.status?.effect === effect
|
||||
? getStatusEffectOverlapText(effect ?? StatusEffect.NONE, getPokemonNameWithAffix(this))
|
||||
: i18next.t("abilityTriggers:moveImmunity", {
|
||||
pokemonNameWithAffix: getPokemonNameWithAffix(this),
|
||||
});
|
||||
globalScene.queueMessage(message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5327,18 +5331,19 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
): boolean {
|
||||
if (effect !== StatusEffect.FAINT) {
|
||||
if (overrideStatus ? this.status?.effect === effect : this.status) {
|
||||
return this.messageIsImmune(quiet);
|
||||
this.messageIsImmune(quiet, effect);
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
this.isGrounded() &&
|
||||
!ignoreField &&
|
||||
globalScene.arena.terrain?.terrainType === TerrainType.MISTY
|
||||
) {
|
||||
return this.messageIsImmune(quiet);
|
||||
this.messageIsImmune(quiet, effect);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const types = this.getTypes(true, true);
|
||||
|
||||
switch (effect) {
|
||||
|
@ -5363,7 +5368,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
defType,
|
||||
);
|
||||
if (cancelImmunity.value) {
|
||||
return this.messageIsImmune(quiet);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5372,13 +5377,15 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
|
||||
if (this.isOfType(PokemonType.POISON) || this.isOfType(PokemonType.STEEL)) {
|
||||
if (poisonImmunity.includes(true)) {
|
||||
return this.messageIsImmune(quiet);
|
||||
this.messageIsImmune(quiet, effect);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case StatusEffect.PARALYSIS:
|
||||
if (this.isOfType(PokemonType.ELECTRIC)) {
|
||||
return this.messageIsImmune(quiet);
|
||||
this.messageIsImmune(quiet, effect);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case StatusEffect.SLEEP:
|
||||
|
@ -5386,7 +5393,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
this.isGrounded() &&
|
||||
globalScene.arena.terrain?.terrainType === TerrainType.ELECTRIC
|
||||
) {
|
||||
return this.messageIsImmune(quiet);
|
||||
this.messageIsImmune(quiet, effect);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case StatusEffect.FREEZE:
|
||||
|
@ -5398,12 +5406,14 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
globalScene.arena.weather.weatherType,
|
||||
))
|
||||
) {
|
||||
return this.messageIsImmune(quiet);
|
||||
this.messageIsImmune(quiet, effect);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case StatusEffect.BURN:
|
||||
if (this.isOfType(PokemonType.FIRE)) {
|
||||
return this.messageIsImmune(quiet);
|
||||
this.messageIsImmune(quiet, effect);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -5429,7 +5439,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
);
|
||||
|
||||
if (cancelled.value) {
|
||||
return this.messageIsImmune(quiet);
|
||||
this.messageIsImmune(quiet, effect);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
|
@ -5438,7 +5449,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
this.isSafeguarded(sourcePokemon)
|
||||
) {
|
||||
if(!quiet){
|
||||
globalScene.queueMessage(i18next.t("moveTriggers:safeguard", { targetName: getPokemonNameWithAffix(this) }));}
|
||||
globalScene.queueMessage(
|
||||
i18next.t("moveTriggers:safeguard", { targetName: getPokemonNameWithAffix(this)
|
||||
}));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue