Fix some trap tag messages

This commit is contained in:
Flashfyre 2024-04-09 12:42:18 -04:00
parent 1301eeb0b9
commit b48dd1c7fc
2 changed files with 8 additions and 4 deletions

View File

@ -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}!`);
}
}

View File

@ -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;
}