Implements Magnet Pull and lets Levitate/Flying Pokemon ignore Arena Trap

This commit is contained in:
td76099 2024-05-21 01:23:57 -04:00
parent 6952fe065b
commit a91e63ba52

View File

@ -2425,6 +2425,9 @@ export class CheckTrappedAbAttr extends AbAttr {
export class ArenaTrapAbAttr extends CheckTrappedAbAttr { export class ArenaTrapAbAttr extends CheckTrappedAbAttr {
/** /**
* Checks if enemy Pokemon is trapped by an Arena Trap-esque ability * Checks if enemy Pokemon is trapped by an Arena Trap-esque ability
* If the enemy is a Ghost type, it is not trapped
* If the user has Magnet Pull and the enemy is not a Steel type, it is not trapped.
* If the user has Arena Trap and the enemy is a Flying type OR has Levitate, it is not trapped.
* @param pokemon The {@link Pokemon} with this {@link AbAttr} * @param pokemon The {@link Pokemon} with this {@link AbAttr}
* @param passive N/A * @param passive N/A
* @param trapped {@link Utils.BooleanHolder} indicating whether the other Pokemon is trapped or not * @param trapped {@link Utils.BooleanHolder} indicating whether the other Pokemon is trapped or not
@ -2433,7 +2436,9 @@ export class ArenaTrapAbAttr extends CheckTrappedAbAttr {
* @returns if enemy Pokemon is trapped or not * @returns if enemy Pokemon is trapped or not
*/ */
applyCheckTrapped(pokemon: Pokemon, passive: boolean, trapped: Utils.BooleanHolder, otherPokemon: Pokemon, args: any[]): boolean { applyCheckTrapped(pokemon: Pokemon, passive: boolean, trapped: Utils.BooleanHolder, otherPokemon: Pokemon, args: any[]): boolean {
if (otherPokemon.getTypes().includes(Type.GHOST)){ if ((otherPokemon.getTypes(true).includes(Type.GHOST)) ||
(pokemon.hasAbility(Abilities.MAGNET_PULL) && !otherPokemon.getTypes(true).includes(Type.STEEL)) ||
(pokemon.hasAbility(Abilities.ARENA_TRAP) && (otherPokemon.hasAbility(Abilities.LEVITATE) || otherPokemon.getTypes(true).includes(Type.FLYING)))){
trapped.value = false; trapped.value = false;
return false; return false;
} }
@ -3097,9 +3102,7 @@ export function initAbilities() {
.attr(StatusEffectImmunityAbAttr, StatusEffect.BURN) .attr(StatusEffectImmunityAbAttr, StatusEffect.BURN)
.ignorable(), .ignorable(),
new Ability(Abilities.MAGNET_PULL, 3) new Ability(Abilities.MAGNET_PULL, 3)
/*.attr(ArenaTrapAbAttr) .attr(ArenaTrapAbAttr),
.condition((pokemon: Pokemon) => pokemon.getOpponent()?.isOfType(Type.STEEL))*/
.unimplemented(),
new Ability(Abilities.SOUNDPROOF, 3) new Ability(Abilities.SOUNDPROOF, 3)
.attr(MoveImmunityAbAttr, (pokemon, attacker, move) => pokemon !== attacker && move.getMove().hasFlag(MoveFlags.SOUND_BASED)) .attr(MoveImmunityAbAttr, (pokemon, attacker, move) => pokemon !== attacker && move.getMove().hasFlag(MoveFlags.SOUND_BASED))
.ignorable(), .ignorable(),