From 1bd3ec2fd662d966c70526d067bc7dc4acf42005 Mon Sep 17 00:00:00 2001 From: Charlie Giang <146129103+charliegiang@users.noreply.github.com> Date: Thu, 16 May 2024 22:09:40 -0500 Subject: [PATCH] Fix ingrain for Phantump and Trevenant (#856) (#998) --- src/data/battler-tags.ts | 7 ++++++- src/phases.ts | 11 ++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index 3dca2a3cadf..6ab249864cd 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -15,6 +15,7 @@ import { TerrainType } from "./terrain"; import { WeatherType } from "./weather"; import { BattleStat } from "./battle-stat"; import { allAbilities } from "./ability"; +import { Species } from "./enums/species"; export enum BattlerTagLapseType { FAINT, @@ -117,7 +118,11 @@ export class TrappedTag extends BattlerTag { } canAdd(pokemon: Pokemon): boolean { - return !pokemon.isOfType(Type.GHOST) && !pokemon.getTag(BattlerTagType.TRAPPED); + const isGhost = pokemon.isOfType(Type.GHOST); + const isTrapped = pokemon.getTag(BattlerTagType.TRAPPED); + const isAllowedGhostType = pokemon.species.speciesId === Species.PHANTUMP || pokemon.species.speciesId === Species.TREVENANT; + + return !isTrapped && (!isGhost || isAllowedGhostType); } onAdd(pokemon: Pokemon): void { diff --git a/src/phases.ts b/src/phases.ts index 89b4974b853..90d9a54d288 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -60,6 +60,8 @@ import i18next from './plugins/i18n'; import { Abilities } from "./data/enums/abilities"; import * as Overrides from './overrides'; import { TextStyle, addTextObject } from "./ui/text"; +import { Type } from "./data/type"; + export class LoginPhase extends Phase { private showText: boolean; @@ -1816,7 +1818,14 @@ export class CommandPhase extends FieldPhase { if (!isSwitch && this.fieldIndex) this.scene.currentBattle.turnCommands[this.fieldIndex - 1].skip = true; } else if (trapTag) { - if (!isSwitch) { + if(trapTag.sourceMove === Moves.INGRAIN && this.scene.getPokemonById(trapTag.sourceId).isOfType(Type.GHOST)) { + success = true; + this.scene.currentBattle.turnCommands[this.fieldIndex] = isSwitch + ? { command: Command.POKEMON, cursor: cursor, args: args } + : { command: Command.RUN }; + break; + } + if (!isSwitch) { this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex); this.scene.ui.setMode(Mode.MESSAGE); }