[BUG] Pokemon with the Levitate ability - Sand Attack Interaction Fix (#3442)

* Included a check for move category in TypeImmunityAbAttr

* Failure 1

* Created new attribute for Levitate - blame Game Freak

* renamed abattr to more descriptive attacktypeimmunityabattr

* need caffeine

* the documentation

---------

Co-authored-by: Frutescens <info@laptop>
This commit is contained in:
Mumble 2024-08-12 09:19:58 -07:00 committed by GitHub
parent c32f195fe0
commit 897f0279ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 19 additions and 3 deletions

View File

@ -343,12 +343,10 @@ export class TypeImmunityAbAttr extends PreDefendAbAttr {
if ([ MoveTarget.BOTH_SIDES, MoveTarget.ENEMY_SIDE, MoveTarget.USER_SIDE ].includes(move.moveTarget)) {
return false;
}
if (attacker !== pokemon && move.type === this.immuneType) {
(args[0] as Utils.NumberHolder).value = 0;
return true;
}
return false;
}
@ -357,6 +355,24 @@ export class TypeImmunityAbAttr extends PreDefendAbAttr {
}
}
export class AttackTypeImmunityAbAttr extends TypeImmunityAbAttr {
constructor(immuneType: Type, condition?: AbAttrCondition) {
super(immuneType, condition);
}
/**
* Applies immunity if the move used is not a status move.
* Type immunity abilities that do not give additional benefits (HP recovery, stat boosts, etc) are not immune to status moves of the type
* Example: Levitate
*/
applyPreDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: Move, cancelled: Utils.BooleanHolder, args: any[]): boolean {
if (move.category !== MoveCategory.STATUS) {
return super.applyPreDefend(pokemon, passive, attacker, move, cancelled, args);
}
return false;
}
}
export class TypeImmunityHealAbAttr extends TypeImmunityAbAttr {
constructor(immuneType: Type) {
super(immuneType);
@ -4375,7 +4391,7 @@ export function initAbilities() {
.attr(UnswappableAbilityAbAttr)
.ignorable(),
new Ability(Abilities.LEVITATE, 3)
.attr(TypeImmunityAbAttr, Type.GROUND, (pokemon: Pokemon) => !pokemon.getTag(GroundedTag) && !pokemon.scene.arena.getTag(ArenaTagType.GRAVITY))
.attr(AttackTypeImmunityAbAttr, Type.GROUND, (pokemon: Pokemon) => !pokemon.getTag(GroundedTag) && !pokemon.scene.arena.getTag(ArenaTagType.GRAVITY))
.ignorable(),
new Ability(Abilities.EFFECT_SPORE, 3)
.attr(EffectSporeAbAttr),