From b48dd1c7fc8c9abc2e3ad0c2b8eba07aea6f61ab Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Tue, 9 Apr 2024 12:42:18 -0400 Subject: [PATCH] Fix some trap tag messages --- src/data/battler-tags.ts | 6 +++--- src/messages.ts | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index 6c3c12dc263..f50ad87d61b 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -1,6 +1,6 @@ import { CommonAnim, CommonBattleAnim } from "./battle-anims"; import { CommonAnimPhase, MoveEffectPhase, MovePhase, PokemonHealPhase, ShowAbilityPhase, StatChangePhase } from "../phases"; -import { getPokemonMessage } from "../messages"; +import { getPokemonMessage, getPokemonPrefix } from "../messages"; import Pokemon, { MoveResult, HitResult } from "../field/pokemon"; import { Stat, getStatName } from "./pokemon-stat"; import { StatusEffect } from "./status-effect"; @@ -587,7 +587,7 @@ export class SandTombTag extends DamagingTrapTag { } getTrapMessage(pokemon: Pokemon): string { - return getPokemonMessage(pokemon.scene.getPokemonById(this.sourceId), ` became trapped\nby ${this.getMoveName()}!`); + return getPokemonMessage(pokemon, ` became trapped\nby ${this.getMoveName()}!`); } } @@ -607,7 +607,7 @@ export class ThunderCageTag extends DamagingTrapTag { } getTrapMessage(pokemon: Pokemon): string { - return getPokemonMessage(pokemon.scene.getPokemonById(this.sourceId), ` trapped the ${pokemon.name}!`); + return getPokemonMessage(pokemon.scene.getPokemonById(this.sourceId), ` trapped\n${getPokemonPrefix(pokemon).toLowerCase()}${pokemon.name}!`); } } diff --git a/src/messages.ts b/src/messages.ts index aeffd361002..ffd9aa6efea 100644 --- a/src/messages.ts +++ b/src/messages.ts @@ -2,6 +2,10 @@ import { BattleSpec } from "./enums/battle-spec"; import Pokemon from "./field/pokemon"; export function getPokemonMessage(pokemon: Pokemon, content: string): string { + return `${getPokemonPrefix(pokemon)}${pokemon.name}${content}`; +} + +export function getPokemonPrefix(pokemon: Pokemon): string { let prefix: string; switch (pokemon.scene.currentBattle.battleSpec) { case BattleSpec.DEFAULT: @@ -11,5 +15,5 @@ export function getPokemonMessage(pokemon: Pokemon, content: string): string { prefix = !pokemon.isPlayer() ? 'Foe ' : ''; break; } - return `${prefix}${pokemon.name}${content}`; + return prefix; } \ No newline at end of file