From ad44d70494cffc5b14f4a0a17f71c864354ee976 Mon Sep 17 00:00:00 2001 From: frutescens Date: Sun, 20 Oct 2024 14:58:57 -0700 Subject: [PATCH] added mimicry activation message --- src/data/ability.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index ba4cd5413b6..c0b412a0249 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -4679,20 +4679,21 @@ export class PreventBypassSpeedChanceAbAttr extends AbAttr { } } +/** + * This applies a terrain-based type change to the Pokemon. + */ export class TerrainEventTypeChangeAbAttr extends PostSummonAbAttr { constructor() { super(true); } - /** - * This applies a terrain-based type change to the Pokemon. - */ apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean { if (pokemon.isTerastallized()) { return false; } const currentTerrain = pokemon.scene.arena.getTerrainType(); const typeChange: Type[] = []; + let isRevert: boolean = false; if (currentTerrain !== TerrainType.NONE) { switch (currentTerrain) { case TerrainType.ELECTRIC: @@ -4711,6 +4712,7 @@ export class TerrainEventTypeChangeAbAttr extends PostSummonAbAttr { pokemon.getTypes(false, false, true).forEach(t => { typeChange.push(t); }); + isRevert = true; break; } } @@ -4721,6 +4723,15 @@ export class TerrainEventTypeChangeAbAttr extends PostSummonAbAttr { pokemon.summonData.types = typeChange; pokemon.updateInfo(); } + let message: string = ""; + const pokemonName = getPokemonNameWithAffix(pokemon); + if (isRevert) { + message = i18next.t("abilityTriggers:pokemonTypeChangeRevert", { pokemonNameWithAffix: pokemonName }); + } else { + const typeName = i18next.t(`pokemonInfo:Type.${Type[typeChange[0]]})`); + message = i18next.t("abilityTriggers:pokemonTypeChange", { pokemonNameWithAffix: pokemonName, typeName: typeName }); + } + pokemon.scene.queueMessage(message); return true; } }