mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-13 03:42:18 +02:00
Fixes #5085: Updated my proposed fix
Changed the move.ts file: In the StatusEffectAttr class updated the "apply()" function so that when a status isn't inflicted to the opposing pokemon it checks if the cause of that failure is Type immunity or immunity provided by an ability.
This commit is contained in:
parent
83f79fb63b
commit
8b8caad5de
@ -323,7 +323,7 @@ export default class Move implements Localizable {
|
|||||||
* @param {PokemonType} type the type of the move's target
|
* @param {PokemonType} type the type of the move's target
|
||||||
* @returns boolean
|
* @returns boolean
|
||||||
*/
|
*/
|
||||||
isTypeImmune(user: Pokemon, target: Pokemon, type: PokemonType, move: Move): boolean {
|
isTypeImmune(user: Pokemon, target: Pokemon, type: PokemonType): boolean {
|
||||||
if (this.moveTarget === MoveTarget.USER) {
|
if (this.moveTarget === MoveTarget.USER) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -339,26 +339,6 @@ export default class Move implements Localizable {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2457,8 +2437,23 @@ export class StatusEffectAttr extends MoveEffectAttr {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((!pokemon.status || (pokemon.status.effect === this.effect && moveChance < 0))
|
if (!pokemon.status || (pokemon.status.effect === this.effect && moveChance < 0)){
|
||||||
&& pokemon.trySetStatus(this.effect, true, user, this.turnsRemaining)) {
|
const statusApplied = pokemon.trySetStatus(this.effect, true, user, this.turnsRemaining);
|
||||||
|
if (!statusApplied) {
|
||||||
|
const isImmune =
|
||||||
|
(this.effect === StatusEffect.POISON || this.effect === StatusEffect.TOXIC)
|
||||||
|
&& (pokemon.isOfType(PokemonType.POISON) || pokemon.isOfType(PokemonType.STEEL) || pokemon.hasAbility(Abilities.IMMUNITY))
|
||||||
|
|| (this.effect === StatusEffect.PARALYSIS
|
||||||
|
&& (pokemon.isOfType(PokemonType.ELECTRIC) || pokemon.hasAbility(Abilities.LIMBER)))
|
||||||
|
|| (this.effect === StatusEffect.BURN
|
||||||
|
&& (pokemon.isOfType(PokemonType.FIRE) || pokemon.hasAbility(Abilities.WATER_VEIL)))
|
||||||
|
|| (this.effect === StatusEffect.FREEZE
|
||||||
|
&& (pokemon.isOfType(PokemonType.ICE) || pokemon.hasAbility(Abilities.MAGMA_ARMOR)));
|
||||||
|
if (isImmune) {
|
||||||
|
globalScene.queueMessage(i18next.t("abilityTriggers:moveImmunity", { pokemonNameWithAffix: getPokemonNameWithAffix(target) }));
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
applyPostAttackAbAttrs(ConfusionOnStatusEffectAbAttr, user, target, move, null, false, this.effect);
|
applyPostAttackAbAttrs(ConfusionOnStatusEffectAbAttr, user, target, move, null, false, this.effect);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2459,7 +2459,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
typeMultiplier,
|
typeMultiplier,
|
||||||
);
|
);
|
||||||
if (
|
if (
|
||||||
this.getTypes(true, true).find(t => move.isTypeImmune(source, this, t, move))
|
this.getTypes(true, true).find(t => move.isTypeImmune(source, this, t))
|
||||||
) {
|
) {
|
||||||
typeMultiplier.value = 0;
|
typeMultiplier.value = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user