From 1f9834d1f6892a6fb2fa7bc99144e8da1e88aec6 Mon Sep 17 00:00:00 2001 From: Ishan Patel <77687928+IshanP02@users.noreply.github.com> Date: Tue, 16 Apr 2024 14:31:30 -0400 Subject: [PATCH] Fixed when roost removes flying type (#148) * Initial push with roost fix * Roost fix * Added GROUNDED to Levitate * Cleaned up GROUNDED code --- package-lock.json | 4 ++-- src/data/ability.ts | 2 +- src/data/battler-tags.ts | 3 +++ src/data/enums/battler-tag-type.ts | 1 + src/data/move.ts | 4 ++-- src/field/pokemon.ts | 6 +++--- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index b93e2b2c6a3..5521dcc86a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pokemon-rogue-battle", - "version": "1.0.0", + "version": "1.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "pokemon-rogue-battle", - "version": "1.0.0", + "version": "1.0.1", "dependencies": { "@material/material-color-utilities": "^0.2.7", "crypto-js": "^4.2.0", diff --git a/src/data/ability.ts b/src/data/ability.ts index 301d0fecdc2..e130af716a4 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -2222,7 +2222,7 @@ export function initAbilities() { .attr(UnswappableAbilityAbAttr) .ignorable(), new Ability(Abilities.LEVITATE, "Levitate", "By floating in the air, the Pokémon receives full immunity to all Ground-type moves.", 3) - .attr(TypeImmunityAbAttr, Type.GROUND, (pokemon: Pokemon) => !pokemon.getTag(BattlerTagType.IGNORE_FLYING) && !pokemon.scene.arena.getTag(ArenaTagType.GRAVITY)) + .attr(TypeImmunityAbAttr, Type.GROUND, (pokemon: Pokemon) => !pokemon.getTag(BattlerTagType.IGNORE_FLYING) && !pokemon.scene.arena.getTag(ArenaTagType.GRAVITY) && !pokemon.getTag(BattlerTagType.GROUNDED)) .ignorable(), new Ability(Abilities.EFFECT_SPORE, "Effect Spore", "Contact with the Pokémon may inflict poison, sleep, or paralysis on its attacker.", 3) .attr(PostDefendContactApplyStatusEffectAbAttr, 10, StatusEffect.POISON, StatusEffect.PARALYSIS, StatusEffect.SLEEP), diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index a95527e6ae4..15dc357a4c3 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -1094,6 +1094,8 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc return new BattlerTag(BattlerTagType.BYPASS_SLEEP, BattlerTagLapseType.TURN_END, turnCount, sourceMove); case BattlerTagType.IGNORE_FLYING: return new BattlerTag(tagType, BattlerTagLapseType.TURN_END, turnCount, sourceMove); + case BattlerTagType.GROUNDED: + return new BattlerTag(tagType, BattlerTagLapseType.TURN_END, turnCount - 1, sourceMove); case BattlerTagType.SALT_CURED: return new SaltCuredTag(sourceId); case BattlerTagType.NONE: @@ -1101,3 +1103,4 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId); } } + \ No newline at end of file diff --git a/src/data/enums/battler-tag-type.ts b/src/data/enums/battler-tag-type.ts index 2dcb12ea231..b5cae5b8459 100644 --- a/src/data/enums/battler-tag-type.ts +++ b/src/data/enums/battler-tag-type.ts @@ -47,5 +47,6 @@ export enum BattlerTagType { IGNORE_ACCURACY = "IGNORE_ACCURACY", BYPASS_SLEEP = "BYPASS_SLEEP", IGNORE_FLYING = "IGNORE_FLYING", + GROUNDED = "GROUNDED", SALT_CURED = "SALT_CURED" } diff --git a/src/data/move.ts b/src/data/move.ts index 5e2c148bf05..d3c4db5b94c 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -4415,7 +4415,7 @@ export function initMoves() { .attr(StatChangeAttr, BattleStat.SPATK, -2, true), new SelfStatusMove(Moves.ROOST, Type.FLYING, -1, 5, -1, 0, 4) .attr(HealAttr, 0.5) - .attr(AddBattlerTagAttr, BattlerTagType.IGNORE_FLYING, true, false, 1) + .attr(AddBattlerTagAttr, BattlerTagType.GROUNDED, true, false, 1) .triageMove(), new StatusMove(Moves.GRAVITY, Type.PSYCHIC, -1, 5, -1, 0, 4) .attr(AddArenaTagAttr, ArenaTagType.GRAVITY, 5) @@ -6043,4 +6043,4 @@ export function initMoves() { new AttackMove(Moves.MALIGNANT_CHAIN, Type.POISON, MoveCategory.SPECIAL, 100, 100, 5, 50, 0, 9) .attr(StatusEffectAttr, StatusEffect.TOXIC) ); -} +} diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 2452a978789..61f1db67243 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -28,7 +28,7 @@ import { Biome } from "../data/enums/biome"; import { Ability, AbAttr, BattleStatMultiplierAbAttr, BlockCritAbAttr, BonusCritAbAttr, BypassBurnDamageReductionAbAttr, FieldPriorityMoveImmunityAbAttr, FieldVariableMovePowerAbAttr, IgnoreOpponentStatChangesAbAttr, MoveImmunityAbAttr, MoveTypeChangeAttr, NonSuperEffectiveImmunityAbAttr, PreApplyBattlerTagAbAttr, PreDefendFullHpEndureAbAttr, ReceivedMoveDamageMultiplierAbAttr, ReduceStatusEffectDurationAbAttr, StabBoostAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, VariableMovePowerAbAttr, VariableMoveTypeAbAttr, WeightMultiplierAbAttr, allAbilities, applyAbAttrs, applyBattleStatMultiplierAbAttrs, applyPostDefendAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs } from '../data/ability'; import { Abilities } from "#app/data/enums/abilities"; import PokemonData from '../system/pokemon-data'; -import { BattlerIndex } from '../battle'; +import Battle, { BattlerIndex } from '../battle'; import { BattleSpec } from "../enums/battle-spec"; import { Mode } from '../ui/ui'; import PartyUiHandler, { PartyOption, PartyUiMode } from '../ui/party-ui-handler'; @@ -694,7 +694,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { } } - if (forDefend && (this.getTag(BattlerTagType.IGNORE_FLYING) || this.scene.arena.getTag(ArenaTagType.GRAVITY))) { + if (forDefend && (this.getTag(BattlerTagType.IGNORE_FLYING) || this.scene.arena.getTag(ArenaTagType.GRAVITY) || this.getTag(BattlerTagType.GROUNDED))) { const flyingIndex = types.indexOf(Type.FLYING); if (flyingIndex > -1) types.splice(flyingIndex, 1); @@ -730,7 +730,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { while (pokemonPrevolutions.hasOwnProperty(starterSpeciesId)) starterSpeciesId = pokemonPrevolutions[starterSpeciesId]; return allAbilities[starterPassiveAbilities[starterSpeciesId]]; - } + } hasPassive(): boolean { return this.passive || this.isBoss();