Skip to content

Commit

Permalink
getPokemonAffix to getPokemonNameWithAffix + remove space + replace
Browse files Browse the repository at this point in the history
  • Loading branch information
laeticiapierre committed May 27, 2024
1 parent 7796643 commit 44adc71
Show file tree
Hide file tree
Showing 20 changed files with 55 additions and 54 deletions.
6 changes: 3 additions & 3 deletions src/data/ability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Type } from "./type";
import * as Utils from "../utils";
import { BattleStat, getBattleStatName } from "./battle-stat";
import { MovePhase, PokemonHealPhase, ShowAbilityPhase, StatChangePhase } from "../phases";
import { getPokemonMessage, getPokemonAffix } from "../messages";
import { getPokemonMessage, getPokemonNameWithAffix } from "../messages";
import { Weather, WeatherType } from "./weather";
import { BattlerTag } from "./battler-tags";
import { BattlerTagType } from "./enums/battler-tag-type";
Expand Down Expand Up @@ -146,7 +146,7 @@ export class BlockRecoilDamageAttr extends AbAttr {
}

getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]) {
return i18next.t("abilityTriggers:blockRecoilDamage", {pokemonName: `${getPokemonAffix(pokemon)}${pokemon.name}`, abilityName: abilityName});
return i18next.t("abilityTriggers:blockRecoilDamage", {pokemonName: getPokemonNameWithAffix(pokemon), abilityName: abilityName});
}
}

Expand Down Expand Up @@ -2451,7 +2451,7 @@ export class PostTurnHurtIfSleepingAbAttr extends PostTurnAbAttr {
for (const opp of pokemon.getOpponents()) {
if (opp.status?.effect === StatusEffect.SLEEP || opp.hasAbility(Abilities.COMATOSE)) {
opp.damageAndUpdate(Math.floor(Math.max(1, opp.getMaxHp() / 8)), HitResult.OTHER);
pokemon.scene.queueMessage(i18next.t("abilityTriggers:badDreams", {pokemonName: `${getPokemonAffix(opp)}${opp.name}`}));
pokemon.scene.queueMessage(i18next.t("abilityTriggers:badDreams", {pokemonName: getPokemonNameWithAffix(opp)}));
hadEffect = true;
}

Expand Down
6 changes: 3 additions & 3 deletions src/data/weather.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Biome } from "./enums/biome";
import { getPokemonMessage, getPokemonAffix } from "../messages";
import { getPokemonMessage, getPokemonNameWithAffix } from "../messages";
import Pokemon from "../field/pokemon";
import { Type } from "./type";
import Move, { AttackMove } from "./move";
Expand Down Expand Up @@ -180,9 +180,9 @@ export function getWeatherLapseMessage(weatherType: WeatherType): string {
export function getWeatherDamageMessage(weatherType: WeatherType, pokemon: Pokemon): string {
switch (weatherType) {
case WeatherType.SANDSTORM:
return i18next.t("weather:sandstormDamageMessage", {pokemonPrefix: getPokemonAffix(pokemon), pokemonName: pokemon.name});
return i18next.t("weather:sandstormDamageMessage", {pokemonNameWithAffix: getPokemonNameWithAffix(pokemon)});
case WeatherType.HAIL:
return i18next.t("weather:hailDamageMessage", {pokemonPrefix: getPokemonAffix(pokemon), pokemonName: pokemon.name});
return i18next.t("weather:hailDamageMessage", {pokemonNameWithAffix: getPokemonNameWithAffix(pokemon)});
}

return null;
Expand Down
6 changes: 3 additions & 3 deletions src/locales/de/battle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const battle: SimpleTranslationEntries = {
"notDisabled": "{{pokemonName}}'s {{moveName}} ist\nnicht mehr deaktiviert!",
"eggHatching": "Oh?",
"ivScannerUseQuestion": "IV-Scanner auf {{pokemonName}} benutzen?",
"wildPokemonAffix": "Wild",
"foePokemonAffix": "Foe",
"useMove": "{{pokemonPrefix}}{{pokemonName}} used {{moveName}}!"
"wildPokemonWithAffix": "{{pokemonName}} (wild)",
"foePokemonWithAffix": "{{pokemonName}} (Gegner)",
"useMove": "{{pokemonNameWithAffix}} setzt {{moveName}} ein!"
} as const;
4 changes: 2 additions & 2 deletions src/locales/de/weather.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ export const weather: SimpleTranslationEntries = {
"sandstormStartMessage": "Ein Sandsturm kommt auf!",
"sandstormLapseMessage": "Der Sandsturm tobt.",
"sandstormClearMessage": "Der Sandsturm legt sich.",
"sandstormDamageMessage": " Der Sandsturm fügt {{pokemonPrefix}}{{pokemonName}} Schaden zu!",
"sandstormDamageMessage": " Der Sandsturm fügt {{pokemonNameWithAffix}} Schaden zu!",

"hailStartMessage": "Es fängt an zu hageln!",
"hailLapseMessage": "Der Hagelsturm tobt.",
"hailClearMessage": "Der Hagelsturm legt sich.",
"hailDamageMessage": "{{pokemonPrefix}}{{pokemonName}} wird von Hagelkörnern getroffen!",
"hailDamageMessage": "{{pokemonNameWithAffix}} wird von Hagelkörnern getroffen!",

"snowStartMessage": "Es fängt an zu schneien!",
"snowLapseMessage": "Der Schneesturm tobt.",
Expand Down
6 changes: 3 additions & 3 deletions src/locales/en/battle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const battle: SimpleTranslationEntries = {
"skipItemQuestion": "Are you sure you want to skip taking an item?",
"eggHatching": "Oh?",
"ivScannerUseQuestion": "Use IV Scanner on {{pokemonName}}?",
"wildPokemonAffix": "Wild",
"foePokemonAffix": "Foe",
"useMove": "{{pokemonPrefix}}{{pokemonName}} used {{moveName}}!"
"wildPokemonWithAffix": "Wild {{pokemonName}}",
"foePokemonWithAffix": "Foe {{pokemonName}}",
"useMove": "{{pokemonNameWithAffix}} used {{moveName}}!"
} as const;
4 changes: 2 additions & 2 deletions src/locales/en/weather.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ export const weather: SimpleTranslationEntries = {
"sandstormStartMessage": "A sandstorm brewed!",
"sandstormLapseMessage": "The sandstorm rages.",
"sandstormClearMessage": "The sandstorm subsided.",
"sandstormDamageMessage": "{{pokemonPrefix}}{{pokemonName}} is buffeted\nby the sandstorm!",
"sandstormDamageMessage": "{{pokemonNameWithAffix}} is buffeted\nby the sandstorm!",

"hailStartMessage": "It started to hail!",
"hailLapseMessage": "Hail continues to fall.",
"hailClearMessage": "The hail stopped.",
"hailDamageMessage": "{{pokemonPrefix}}{{pokemonName}} is pelted\nby the hail!",
"hailDamageMessage": "{{pokemonNameWithAffix}} is pelted\nby the hail!",

"snowStartMessage": "It started to snow!",
"snowLapseMessage": "The snow is falling down.",
Expand Down
2 changes: 1 addition & 1 deletion src/locales/es/battle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ export const battle: SimpleTranslationEntries = {
"ivScannerUseQuestion": "¿Quieres usar el Escáner de IVs en {{pokemonName}}?",
"wildPokemonAffix": "Wild",
"foePokemonAffix": "Foe",
"useMove": "{{pokemonPrefix}}{{pokemonName}} used {{moveName}}!"
"useMove": "{{pokemonNameWithAffix}} used {{moveName}}!"
} as const;
4 changes: 2 additions & 2 deletions src/locales/es/weather.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ export const weather: SimpleTranslationEntries = {
"sandstormStartMessage": "A sandstorm brewed!",
"sandstormLapseMessage": "The sandstorm rages.",
"sandstormClearMessage": "The sandstorm subsided.",
"sandstormDamageMessage": "{{pokemonPrefix}}{{pokemonName}} is buffeted\nby the sandstorm!",
"sandstormDamageMessage": "{{pokemonNameWithAffix}} is buffeted\nby the sandstorm!",

"hailStartMessage": "It started to hail!",
"hailLapseMessage": "Hail continues to fall.",
"hailClearMessage": "The hail stopped.",
"hailDamageMessage": "{{pokemonPrefix}}{{pokemonName}} is pelted\nby the hail!",
"hailDamageMessage": "{{pokemonNameWithAffix}} is pelted\nby the hail!",

"snowStartMessage": "It started to snow!",
"snowLapseMessage": "The snow is falling down.",
Expand Down
6 changes: 3 additions & 3 deletions src/locales/fr/battle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const battle: SimpleTranslationEntries = {
"skipItemQuestion": "Êtes-vous sûr·e de ne pas vouloir prendre d’objet ?",
"eggHatching": "Oh ?",
"ivScannerUseQuestion": "Utiliser le Scanner d’IV sur {{pokemonName}} ?",
"wildPokemonAffix": "Sauvage",
"foePokemonAffix": "Ennemi",
"useMove": "{{pokemonName}} {{pokemonPrefix}}utilise\n {{moveName}} !"
"wildPokemonWithAffix": "{{pokemonName}} sauvage",
"foePokemonWithAffix": "{{pokemonName}} ennemi",
"useMove": "{{pokemonNameWithAffix}} utilise\n{{moveName}} !"
} as const;
4 changes: 2 additions & 2 deletions src/locales/fr/weather.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ export const weather: SimpleTranslationEntries = {
"sandstormStartMessage": "Une tempête de sable se prépare !",
"sandstormLapseMessage": "La tempête de sable fait rage !",
"sandstormClearMessage": "La tempête de sable se calme !",
"sandstormDamageMessage": "La tempête de sable inflige des dégâts\nà {{pokemonPrefix}}{{pokemonName}} !",
"sandstormDamageMessage": "La tempête de sable inflige des dégâts\nà {{pokemonNameWithAffix}} !",

"hailStartMessage": "Il commence à grêler !",
"hailLapseMessage": "La grêle continue de tomber !",
"hailClearMessage": "La grêle s’est arrêtée !",
"hailDamageMessage": "La grêle inflige des dégâts\nà {{pokemonPrefix}}{{pokemonName}} !",
"hailDamageMessage": "La grêle inflige des dégâts\nà {{pokemonNameWithAffix}} !",

"snowStartMessage": "Il commence à neiger !",
"snowLapseMessage": "Il y a une tempête de neige !",
Expand Down
6 changes: 3 additions & 3 deletions src/locales/it/battle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const battle: SimpleTranslationEntries = {
"skipItemQuestion": "Sei sicuro di non voler prendere nessun oggetto?",
"eggHatching": "Oh!",
"ivScannerUseQuestion": "Vuoi usare lo scanner di IV su {{pokemonName}}?",
"wildPokemonAffix": "Wild",
"foePokemonAffix": "Foe",
"useMove": "{{pokemonPrefix}}{{pokemonName}} used {{moveName}}!"
"wildPokemonWithAffix": "Wild {{pokemonName}}",
"foePokemonWithAffix": "Foe {{pokemonName}}",
"useMove": "{{pokemonNameWithAffix}} used {{moveName}}!"
} as const;
4 changes: 2 additions & 2 deletions src/locales/it/weather.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ export const weather: SimpleTranslationEntries = {
"sandstormStartMessage": "Si è scatenata una tempesta di sabbia!",
"sandstormLapseMessage": "La tempesta di sabbia infuria.",
"sandstormClearMessage": "La tempesta di sabbia si è placata.",
"sandstormDamageMessage": "{{pokemonPrefix}}{{pokemonName}} è stato colpito\ndalla tempesta di sabbia!",
"sandstormDamageMessage": "{{pokemonNameWithAffix}} è stato colpito\ndalla tempesta di sabbia!",

"hailStartMessage": "Ha iniziato a grandinare!",
"hailLapseMessage": "La grandine continua a cadere.",
"hailClearMessage": "Ha smesso di grandinare.",
"hailDamageMessage": "{{pokemonPrefix}}{{pokemonName}} è stato colpito\ndalla grandine!",
"hailDamageMessage": "{{pokemonNameWithAffix}} è stato colpito\ndalla grandine!",

"snowStartMessage": "Ha iniziato a nevicare!",
"snowLapseMessage": "La neve sta continuando a cadere.",
Expand Down
6 changes: 3 additions & 3 deletions src/locales/pt_BR/battle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const battle: SimpleTranslationEntries = {
"skipItemQuestion": "Tem certeza de que não quer escolher um item?",
"eggHatching": "Opa?",
"ivScannerUseQuestion": "Quer usar o Scanner de IVs em {{pokemonName}}?",
"wildPokemonAffix": "Wild",
"foePokemonAffix": "Foe",
"useMove": "{{pokemonPrefix}}{{pokemonName}} used {{moveName}}!"
"wildPokemonWithAffix": "Wild {{pokemonName}}",
"foePokemonWithAffix": "Foe {{pokemonName}}",
"useMove": "{{pokemonNameWithAffix}} used {{moveName}}!"
} as const;
4 changes: 2 additions & 2 deletions src/locales/pt_BR/weather.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ export const weather: SimpleTranslationEntries = {
"sandstormStartMessage": "Uma tempestade de areia se formou!",
"sandstormLapseMessage": "A tempestade de areia é violenta.",
"sandstormClearMessage": "A tempestade de areia diminuiu.",
"sandstormDamageMessage": "{{pokemonPrefix}}{{pokemonName}} é atingido\npela tempestade de areia!",
"sandstormDamageMessage": "{{pokemonNameWithAffix}} é atingido\npela tempestade de areia!",

"hailStartMessage": "Começou a chover granizo!",
"hailLapseMessage": "Granizo cai do céu.",
"hailClearMessage": "O granizo parou.",
"hailDamageMessage": "{{pokemonPrefix}}{{pokemonName}} é atingido\npelo granizo!",
"hailDamageMessage": "{{pokemonNameWithAffix}} é atingido\npelo granizo!",

"snowStartMessage": "Começou a nevar!",
"snowLapseMessage": "A neve continua caindo.",
Expand Down
6 changes: 3 additions & 3 deletions src/locales/zh_CN/battle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const battle: SimpleTranslationEntries = {
"skipItemQuestion": "你确定要跳过拾取道具吗?",
"eggHatching": "咦?",
"ivScannerUseQuestion": "对 {{pokemonName}} 使用个体值扫描仪?",
"wildPokemonAffix": "Wild",
"foePokemonAffix": "Foe",
"useMove": "{{pokemonPrefix}}{{pokemonName}} used {{moveName}}!"
"wildPokemonWithAffix": "Wild {{pokemonName}}",
"foePokemonWithAffix": "Foe {{pokemonName}}",
"useMove": "{{pokemonNameWithAffix}} used {{moveName}}!"
} as const;
4 changes: 2 additions & 2 deletions src/locales/zh_CN/weather.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ export const weather: SimpleTranslationEntries = {
"sandstormStartMessage": "开始刮沙暴了!",
"sandstormLapseMessage": "沙暴肆虐。",
"sandstormClearMessage": "沙暴停止了!",
"sandstormDamageMessage": "沙暴袭击了{{pokemonPrefix}}{{pokemonName}}!",
"sandstormDamageMessage": "沙暴袭击了{{pokemonNameWithAffix}}!",

"hailStartMessage": "开始下冰雹了!",
"hailLapseMessage": "冰雹继续肆虐。",
"hailClearMessage": "冰雹不再下了。",
"hailDamageMessage": "冰雹袭击了{{pokemonPrefix}}{{pokemonName}}!",
"hailDamageMessage": "冰雹袭击了{{pokemonNameWithAffix}}!",

"snowStartMessage": "开始下雪了!",
"snowLapseMessage": "雪继续下。",
Expand Down
5 changes: 4 additions & 1 deletion src/locales/zh_TW/battle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,8 @@ export const battle: SimpleTranslationEntries = {
"notDisabled": "{{moveName}} 不再被禁用!",
"skipItemQuestion": "你要跳過拾取道具嗎?",
"eggHatching": "咦?",
"ivScannerUseQuestion": "對 {{pokemonName}} 使用個體值掃描?"
"ivScannerUseQuestion": "對 {{pokemonName}} 使用個體值掃描?",
"wildPokemonWithAffix": "Wild {{pokemonName}}",
"foePokemonWithAffix": "Foe {{pokemonName}}",
"useMove": "{{pokemonNameWithAffix}} used {{moveName}}!"
} as const;
4 changes: 2 additions & 2 deletions src/locales/zh_TW/weather.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ export const weather: SimpleTranslationEntries = {
"sandstormStartMessage": "開始刮沙暴了!",
"sandstormLapseMessage": "沙暴肆虐。",
"sandstormClearMessage": "沙暴停止了。",
"sandstormDamageMessage": "沙暴襲擊了{{pokemonPrefix}}{{pokemonName}}!",
"sandstormDamageMessage": "沙暴襲擊了{{pokemonNameWithAffix}}!",

"hailStartMessage": "開始下冰雹了!",
"hailLapseMessage": "冰雹繼續肆虐。",
"hailClearMessage": "冰雹不再下了。",
"hailDamageMessage": "冰雹襲擊了{{pokemonPrefix}}{{pokemonName}}!",
"hailDamageMessage": "冰雹襲擊了{{pokemonNameWithAffix}}!",

"snowStartMessage": "開始下雪了!",
"snowLapseMessage": "雪繼續下。",
Expand Down
12 changes: 6 additions & 6 deletions src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ import Pokemon from "./field/pokemon";
import i18next from "./plugins/i18n";

export function getPokemonMessage(pokemon: Pokemon, content: string): string {
return `${getPokemonAffix(pokemon)}${pokemon.name}${content}`;
return `${getPokemonNameWithAffix(pokemon)} ${content}`;
}

export function getPokemonAffix(pokemon: Pokemon): string {
export function getPokemonNameWithAffix(pokemon: Pokemon): string {
let prefix: string;
switch (pokemon.scene.currentBattle.battleSpec) {
case BattleSpec.DEFAULT:
prefix = !pokemon.isPlayer()
? pokemon.hasTrainer()
? `${i18next.t("battle:foePokemonAffix")} `
: `${i18next.t("battle:wildPokemonAffix")} `
: "";
? i18next.t("battle:foePokemonWithAffix", { pokemonName: pokemon.name })
: i18next.t("battle:wildPokemonWithAffix", { pokemonName: pokemon.name })
: pokemon.name;
break;
case BattleSpec.FINAL_BOSS:
prefix = !pokemon.isPlayer() ? `${i18next.t("battle:foePokemonAffix")} ` : "";
prefix = !pokemon.isPlayer() ? i18next.t("battle:foePokemonWithAffix", { pokemonName: pokemon.name }) : pokemon.name;
break;
}
return prefix;
Expand Down
10 changes: 4 additions & 6 deletions src/phases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { FusePokemonModifierType, ModifierPoolType, ModifierType, ModifierTypeFu
import SoundFade from "phaser3-rex-plugins/plugins/soundfade";
import { BattlerTagLapseType, EncoreTag, HideSpriteTag as HiddenTag, ProtectedTag, TrappedTag } from "./data/battler-tags";
import { BattlerTagType } from "./data/enums/battler-tag-type";
import { getPokemonMessage, getPokemonAffix } from "./messages";
import { getPokemonMessage, getPokemonNameWithAffix } from "./messages";
import { Starter } from "./ui/starter-select-ui-handler";
import { Gender } from "./data/gender";
import { Weather, WeatherType, getRandomWeatherType, getTerrainBlockMessage, getWeatherDamageMessage, getWeatherLapseMessage } from "./data/weather";
Expand Down Expand Up @@ -2262,7 +2262,7 @@ export class TurnEndPhase extends FieldPhase {
pokemon.lapseTags(BattlerTagLapseType.TURN_END);

if (pokemon.summonData.disabledMove && !--pokemon.summonData.disabledTurns) {
this.scene.pushPhase(new MessagePhase(this.scene, i18next.t("battle:notDisabled", { pokemonName: `${getPokemonAffix(pokemon)}${pokemon.name}`, moveName: allMoves[pokemon.summonData.disabledMove].name })));
this.scene.pushPhase(new MessagePhase(this.scene, i18next.t("battle:notDisabled", { pokemonName: getPokemonNameWithAffix(pokemon), moveName: allMoves[pokemon.summonData.disabledMove].name })));
pokemon.summonData.disabledMove = Moves.NONE;
}

Expand Down Expand Up @@ -2618,8 +2618,7 @@ export class MovePhase extends BattlePhase {
const lastMove = this.pokemon.getLastXMoves() as TurnMove[];
if (!lastMove.length || lastMove[0].move !== this.move.getMove().id || lastMove[0].result !== MoveResult.OTHER) {
this.scene.queueMessage(i18next.t("battle:useMove", {
pokemonPrefix: getPokemonAffix(this.pokemon),
pokemonName: this.pokemon.name,
pokemonNameWithAffix: getPokemonNameWithAffix(this.pokemon),
moveName: this.move.getName()
}), 500);
return;
Expand All @@ -2631,8 +2630,7 @@ export class MovePhase extends BattlePhase {
}

this.scene.queueMessage(i18next.t("battle:useMove", {
pokemonPrefix: getPokemonAffix(this.pokemon),
pokemonName: this.pokemon.name,
pokemonNameWithAffix: getPokemonNameWithAffix(this.pokemon),
moveName: this.move.getName()
}), 500);
applyMoveAttrs(PreMoveMessageAttr, this.pokemon, this.pokemon.getOpponents().find(() => true), this.move.getMove());
Expand Down

0 comments on commit 44adc71

Please sign in to comment.