mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 09:02:47 +02:00
[Bug] [UI/UX] Status moves now play a No Effect Message Against Immune Type Pokemon (#5533)
* 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 a redudant if statement in StatusEffectAttr class In pokemon.ts: Renamed the "messageIsImmune" function to "queueImmuneMessage"
This commit is contained in:
parent
5de567a3db
commit
75400a39ed
@ -2459,14 +2459,7 @@ export class StatusEffectAttr extends MoveEffectAttr {
|
|||||||
const statusCheck = moveChance < 0 || moveChance === 100 || user.randSeedInt(100) < moveChance;
|
const statusCheck = moveChance < 0 || moveChance === 100 || user.randSeedInt(100) < moveChance;
|
||||||
if (statusCheck) {
|
if (statusCheck) {
|
||||||
const pokemon = this.selfTarget ? user : target;
|
const pokemon = this.selfTarget ? user : target;
|
||||||
if (pokemon.status && !this.overrideStatus) {
|
if (user !== target && move.category === MoveCategory.STATUS && !target.canSetStatus(this.effect, false, false, user, true)) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (user !== target && target.isSafeguarded(user)) {
|
|
||||||
if (move.category === MoveCategory.STATUS) {
|
|
||||||
globalScene.queueMessage(i18next.t("moveTriggers:safeguard", { targetName: getPokemonNameWithAffix(target) }));
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (((!pokemon.status || this.overrideStatus) || (pokemon.status.effect === this.effect && moveChance < 0))
|
if (((!pokemon.status || this.overrideStatus) || (pokemon.status.effect === this.effect && moveChance < 0))
|
||||||
|
@ -248,6 +248,7 @@ import { PLAYER_PARTY_MAX_SIZE } from "#app/constants";
|
|||||||
import { CustomPokemonData } from "#app/data/custom-pokemon-data";
|
import { CustomPokemonData } from "#app/data/custom-pokemon-data";
|
||||||
import { SwitchType } from "#enums/switch-type";
|
import { SwitchType } from "#enums/switch-type";
|
||||||
import { SpeciesFormKey } from "#enums/species-form-key";
|
import { SpeciesFormKey } from "#enums/species-form-key";
|
||||||
|
import {getStatusEffectOverlapText } from "#app/data/status-effect";
|
||||||
import {
|
import {
|
||||||
BASE_HIDDEN_ABILITY_CHANCE,
|
BASE_HIDDEN_ABILITY_CHANCE,
|
||||||
BASE_SHINY_CHANCE,
|
BASE_SHINY_CHANCE,
|
||||||
@ -5364,6 +5365,18 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
queueImmuneMessage(quiet: boolean, effect?: StatusEffect): void {
|
||||||
|
if (!effect || quiet) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const message = effect && this.status?.effect === effect
|
||||||
|
? getStatusEffectOverlapText(effect ?? StatusEffect.NONE, getPokemonNameWithAffix(this))
|
||||||
|
: i18next.t("abilityTriggers:moveImmunity", {
|
||||||
|
pokemonNameWithAffix: getPokemonNameWithAffix(this),
|
||||||
|
});
|
||||||
|
globalScene.queueMessage(message);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a status effect can be applied to the Pokemon.
|
* Checks if a status effect can be applied to the Pokemon.
|
||||||
*
|
*
|
||||||
@ -5382,6 +5395,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
): boolean {
|
): boolean {
|
||||||
if (effect !== StatusEffect.FAINT) {
|
if (effect !== StatusEffect.FAINT) {
|
||||||
if (overrideStatus ? this.status?.effect === effect : this.status) {
|
if (overrideStatus ? this.status?.effect === effect : this.status) {
|
||||||
|
this.queueImmuneMessage(quiet, effect);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
@ -5389,18 +5403,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
!ignoreField &&
|
!ignoreField &&
|
||||||
globalScene.arena.terrain?.terrainType === TerrainType.MISTY
|
globalScene.arena.terrain?.terrainType === TerrainType.MISTY
|
||||||
) {
|
) {
|
||||||
|
this.queueImmuneMessage(quiet, effect);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
|
||||||
sourcePokemon &&
|
|
||||||
sourcePokemon !== this &&
|
|
||||||
this.isSafeguarded(sourcePokemon)
|
|
||||||
) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const types = this.getTypes(true, true);
|
const types = this.getTypes(true, true);
|
||||||
|
|
||||||
switch (effect) {
|
switch (effect) {
|
||||||
@ -5429,17 +5436,19 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.isOfType(PokemonType.POISON) || this.isOfType(PokemonType.STEEL)) {
|
if (this.isOfType(PokemonType.POISON) || this.isOfType(PokemonType.STEEL)) {
|
||||||
if (poisonImmunity.includes(true)) {
|
if (poisonImmunity.includes(true)) {
|
||||||
|
this.queueImmuneMessage(quiet, effect);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case StatusEffect.PARALYSIS:
|
case StatusEffect.PARALYSIS:
|
||||||
if (this.isOfType(PokemonType.ELECTRIC)) {
|
if (this.isOfType(PokemonType.ELECTRIC)) {
|
||||||
|
this.queueImmuneMessage(quiet, effect);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -5448,6 +5457,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
this.isGrounded() &&
|
this.isGrounded() &&
|
||||||
globalScene.arena.terrain?.terrainType === TerrainType.ELECTRIC
|
globalScene.arena.terrain?.terrainType === TerrainType.ELECTRIC
|
||||||
) {
|
) {
|
||||||
|
this.queueImmuneMessage(quiet, effect);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -5460,11 +5470,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
globalScene.arena.weather.weatherType,
|
globalScene.arena.weather.weatherType,
|
||||||
))
|
))
|
||||||
) {
|
) {
|
||||||
|
this.queueImmuneMessage(quiet, effect);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case StatusEffect.BURN:
|
case StatusEffect.BURN:
|
||||||
if (this.isOfType(PokemonType.FIRE)) {
|
if (this.isOfType(PokemonType.FIRE)) {
|
||||||
|
this.queueImmuneMessage(quiet, effect);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -5499,6 +5511,19 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
sourcePokemon &&
|
||||||
|
sourcePokemon !== this &&
|
||||||
|
this.isSafeguarded(sourcePokemon)
|
||||||
|
) {
|
||||||
|
if(!quiet){
|
||||||
|
globalScene.queueMessage(
|
||||||
|
i18next.t("moveTriggers:safeguard", { targetName: getPokemonNameWithAffix(this)
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5510,7 +5535,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
sourceText: string | null = null,
|
sourceText: string | null = null,
|
||||||
overrideStatus?: boolean
|
overrideStatus?: boolean
|
||||||
): boolean {
|
): boolean {
|
||||||
if (!this.canSetStatus(effect, asPhase, overrideStatus, sourcePokemon)) {
|
if (!this.canSetStatus(effect, false, overrideStatus, sourcePokemon)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.isFainted() && effect !== StatusEffect.FAINT) {
|
if (this.isFainted() && effect !== StatusEffect.FAINT) {
|
||||||
|
Loading…
Reference in New Issue
Block a user