Fix ingrain for Phantump and Trevenant (#856) (#998)

This commit is contained in:
Charlie Giang 2024-05-16 22:09:40 -05:00 committed by GitHub
parent dd3d38b5d8
commit 1bd3ec2fd6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 2 deletions

View File

@ -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 {

View File

@ -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,6 +1818,13 @@ export class CommandPhase extends FieldPhase {
if (!isSwitch && this.fieldIndex)
this.scene.currentBattle.turnCommands[this.fieldIndex - 1].skip = true;
} else if (trapTag) {
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);