added mimicry activation message

This commit is contained in:
frutescens 2024-10-20 14:58:57 -07:00 committed by NightKev
parent 6f6b46f56f
commit ad44d70494

View File

@ -4679,20 +4679,21 @@ export class PreventBypassSpeedChanceAbAttr extends AbAttr {
} }
} }
/**
* This applies a terrain-based type change to the Pokemon.
*/
export class TerrainEventTypeChangeAbAttr extends PostSummonAbAttr { export class TerrainEventTypeChangeAbAttr extends PostSummonAbAttr {
constructor() { constructor() {
super(true); 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 { apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean {
if (pokemon.isTerastallized()) { if (pokemon.isTerastallized()) {
return false; return false;
} }
const currentTerrain = pokemon.scene.arena.getTerrainType(); const currentTerrain = pokemon.scene.arena.getTerrainType();
const typeChange: Type[] = []; const typeChange: Type[] = [];
let isRevert: boolean = false;
if (currentTerrain !== TerrainType.NONE) { if (currentTerrain !== TerrainType.NONE) {
switch (currentTerrain) { switch (currentTerrain) {
case TerrainType.ELECTRIC: case TerrainType.ELECTRIC:
@ -4711,6 +4712,7 @@ export class TerrainEventTypeChangeAbAttr extends PostSummonAbAttr {
pokemon.getTypes(false, false, true).forEach(t => { pokemon.getTypes(false, false, true).forEach(t => {
typeChange.push(t); typeChange.push(t);
}); });
isRevert = true;
break; break;
} }
} }
@ -4721,6 +4723,15 @@ export class TerrainEventTypeChangeAbAttr extends PostSummonAbAttr {
pokemon.summonData.types = typeChange; pokemon.summonData.types = typeChange;
pokemon.updateInfo(); 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; return true;
} }
} }