localize missed move-trigger message and remove redundant getPokemonMessage

This commit is contained in:
EnochG1 2024-08-01 12:24:26 +09:00
parent e30b9607c5
commit 22e2eb6002
11 changed files with 91 additions and 30 deletions

View File

@ -2,7 +2,7 @@ import { ChargeAnim, MoveChargeAnim, initMoveAnim, loadMoveAnimAssets } from "./
import { BattleEndPhase, MoveEndPhase, MovePhase, NewBattlePhase, PartyStatusCurePhase, PokemonHealPhase, StatChangePhase, SwitchSummonPhase } from "../phases"; import { BattleEndPhase, MoveEndPhase, MovePhase, NewBattlePhase, PartyStatusCurePhase, PokemonHealPhase, StatChangePhase, SwitchSummonPhase } from "../phases";
import { BattleStat, getBattleStatName } from "./battle-stat"; import { BattleStat, getBattleStatName } from "./battle-stat";
import { EncoreTag, HelpingHandTag, SemiInvulnerableTag, StockpilingTag, TypeBoostTag } from "./battler-tags"; import { EncoreTag, HelpingHandTag, SemiInvulnerableTag, StockpilingTag, TypeBoostTag } from "./battler-tags";
import { getPokemonMessage, getPokemonNameWithAffix } from "../messages"; import { getPokemonNameWithAffix } from "../messages";
import Pokemon, { AttackMoveResult, EnemyPokemon, HitResult, MoveResult, PlayerPokemon, PokemonMove, TurnMove } from "../field/pokemon"; import Pokemon, { AttackMoveResult, EnemyPokemon, HitResult, MoveResult, PlayerPokemon, PokemonMove, TurnMove } from "../field/pokemon";
import { StatusEffect, getStatusEffectHealText, isNonVolatileStatusEffect, getNonVolatileStatusEffects} from "./status-effect"; import { StatusEffect, getStatusEffectHealText, isNonVolatileStatusEffect, getNonVolatileStatusEffects} from "./status-effect";
import { getTypeResistances, Type } from "./type"; import { getTypeResistances, Type } from "./type";
@ -1388,7 +1388,7 @@ export class HealAttr extends MoveEffectAttr {
*/ */
addHealPhase(target: Pokemon, healRatio: number) { addHealPhase(target: Pokemon, healRatio: number) {
target.scene.unshiftPhase(new PokemonHealPhase(target.scene, target.getBattlerIndex(), target.scene.unshiftPhase(new PokemonHealPhase(target.scene, target.getBattlerIndex(),
Math.max(Math.floor(target.getMaxHp() * healRatio), 1), getPokemonMessage(target, " \nhad its HP restored."), true, !this.showAnim)); Math.max(Math.floor(target.getMaxHp() * healRatio), 1), i18next.t("moveTriggers:healHp", {pokemonName: getPokemonNameWithAffix(target)}), true, !this.showAnim));
} }
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer { getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
@ -1482,7 +1482,7 @@ export class SacrificialFullRestoreAttr extends SacrificialAttr {
const maxPartyMemberHp = user.scene.getParty().map(p => p.getMaxHp()).reduce((maxHp: integer, hp: integer) => Math.max(hp, maxHp), 0); const maxPartyMemberHp = user.scene.getParty().map(p => p.getMaxHp()).reduce((maxHp: integer, hp: integer) => Math.max(hp, maxHp), 0);
user.scene.pushPhase(new PokemonHealPhase(user.scene, user.getBattlerIndex(), user.scene.pushPhase(new PokemonHealPhase(user.scene, user.getBattlerIndex(),
maxPartyMemberHp, getPokemonMessage(user, "'s Healing Wish\nwas granted!"), true, false, false, true), true); maxPartyMemberHp, i18next.t("moveTriggers:sacrificialFullRestore", {pokemonName: getPokemonNameWithAffix(user)}), true, false, false, true), true);
return true; return true;
} }
@ -2712,7 +2712,7 @@ export class InvertStatsAttr extends MoveEffectAttr {
target.updateInfo(); target.updateInfo();
user.updateInfo(); user.updateInfo();
target.scene.queueMessage(getPokemonMessage(target, "'s stat changes\nwere all reversed!")); target.scene.queueMessage(i18next.t("moveTriggers:invertStats", {pokemonName: getPokemonNameWithAffix(target)}));
return true; return true;
} }
@ -2730,7 +2730,7 @@ export class ResetStatsAttr extends MoveEffectAttr {
target.updateInfo(); target.updateInfo();
user.updateInfo(); user.updateInfo();
target.scene.queueMessage(getPokemonMessage(target, "'s stat changes\nwere eliminated!")); target.scene.queueMessage(i18next.t("moveTriggers:resetStats", {pokemonName: getPokemonNameWithAffix(target)}));
return true; return true;
} }
@ -4138,7 +4138,7 @@ export class DisableMoveAttr extends MoveEffectAttr {
target.summonData.disabledMove = disabledMove.moveId; target.summonData.disabledMove = disabledMove.moveId;
target.summonData.disabledTurns = 4; target.summonData.disabledTurns = 4;
user.scene.queueMessage(getPokemonMessage(target, `'s ${disabledMove.getName()}\nwas disabled!`)); user.scene.queueMessage(i18next.t("abilityTriggers:postDefendMoveDisable", { pokemonNameWithAffix: getPokemonNameWithAffix(target), moveName: disabledMove.getName()}));
return true; return true;
} }
@ -4445,7 +4445,7 @@ export class FaintCountdownAttr extends AddBattlerTagAttr {
return false; return false;
} }
user.scene.queueMessage(getPokemonMessage(target, `\nwill faint in ${this.turnCountMin - 1} turns.`)); user.scene.queueMessage(i18next.t("moveTriggers:faintCountdown", {pokemonName: getPokemonNameWithAffix(target), turnCount: this.turnCountMin - 1}));
return true; return true;
} }
@ -4685,7 +4685,7 @@ export class SwapArenaTagsAttr extends MoveEffectAttr {
} }
user.scene.queueMessage( `${getPokemonNameWithAffix(user)} swapped the battle effects affecting each side of the field!`); user.scene.queueMessage( i18next.t("moveTriggers:swapArenaTags", {pokemonName: getPokemonNameWithAffix(user)}));
return true; return true;
} }
} }
@ -4917,7 +4917,7 @@ export class CopyTypeAttr extends MoveEffectAttr {
user.summonData.types = target.getTypes(true); user.summonData.types = target.getTypes(true);
user.updateInfo(); user.updateInfo();
user.scene.queueMessage(getPokemonMessage(user, `'s type\nchanged to match ${getPokemonNameWithAffix(target)}'s!`)); user.scene.queueMessage(i18next.t("moveTriggers:copyType", {pokemonName: getPokemonNameWithAffix(user), targetPokemonName: getPokemonNameWithAffix(target)}));
return true; return true;
} }
@ -5598,7 +5598,7 @@ export class SuppressAbilitiesAttr extends MoveEffectAttr {
target.summonData.abilitySuppressed = true; target.summonData.abilitySuppressed = true;
target.scene.queueMessage(getPokemonMessage(target, "'s ability\nwas suppressed!")); target.scene.queueMessage(i18next.t("moveTriggers:suppressAbilities", {pokemonName: getPokemonNameWithAffix(target)}));
return true; return true;
} }

View File

@ -50,5 +50,13 @@ export const moveTriggers: SimpleTranslationEntries = {
"transformedIntoTarget": "{{pokemonName}} verwandelt sich in {{targetName}}!", "transformedIntoTarget": "{{pokemonName}} verwandelt sich in {{targetName}}!",
"tryingToTakeFoeDown": "{{pokemonName}} versucht, den Angreifer mit sich zu nehmen!", "tryingToTakeFoeDown": "{{pokemonName}} versucht, den Angreifer mit sich zu nehmen!",
"addType": "{{pokemonName}} nimmt zusätzlich den Typ {{typeName}} an!", "addType": "{{pokemonName}} nimmt zusätzlich den Typ {{typeName}} an!",
"cannotUseMove": "{{pokemonName}} kann {{moveName}} nicht einsetzen!" "cannotUseMove": "{{pokemonName}} kann {{moveName}} nicht einsetzen!",
"healHp": "{{pokemonName}} had its HP restored.",
"sacrificialFullRestore": "{{pokemonName}}'s Healing Wish\nwas granted!",
"invertStats": "{{pokemonName}}'s stat changes\nwere all reversed!",
"resetStats": "{{pokemonName}}'s stat changes\nwere eliminated!",
"faintCountdown": "{{pokemonName}}\nwill faint in {{turnCount}} turns.",
"copyType": "{{pokemonName}}'s type\nchanged to match {{targetPokemonName}}'s!",
"suppressAbilities": "{{pokemonName}}'s ability\nwas suppressed!",
"swapArenaTags": "{{pokemonName}} swapped the battle effects affecting each side of the field!",
} as const; } as const;

View File

@ -50,5 +50,13 @@ export const moveTriggers: SimpleTranslationEntries = {
"transformedIntoTarget": "{{pokemonName}} transformed\ninto {{targetName}}!", "transformedIntoTarget": "{{pokemonName}} transformed\ninto {{targetName}}!",
"tryingToTakeFoeDown": "{{pokemonName}} is hoping to take its attacker down with it!", "tryingToTakeFoeDown": "{{pokemonName}} is hoping to take its attacker down with it!",
"addType": "{{typeName}} was added to\n{{pokemonName}}!", "addType": "{{typeName}} was added to\n{{pokemonName}}!",
"cannotUseMove": "{{pokemonName}} cannot use {{moveName}}!" "cannotUseMove": "{{pokemonName}} cannot use {{moveName}}!",
"healHp": "{{pokemonName}} had its HP restored.",
"sacrificialFullRestore": "{{pokemonName}}'s Healing Wish\nwas granted!",
"invertStats": "{{pokemonName}}'s stat changes\nwere all reversed!",
"resetStats": "{{pokemonName}}'s stat changes\nwere eliminated!",
"faintCountdown": "{{pokemonName}}\nwill faint in {{turnCount}} turns.",
"copyType": "{{pokemonName}}'s type became the same as\n{{targetPokemonName}}'s type!",
"suppressAbilities": "{{pokemonName}}'s ability\nwas suppressed!",
"swapArenaTags": "{{pokemonName}} swapped the battle effects affecting each side of the field!",
} as const; } as const;

View File

@ -50,5 +50,13 @@ export const moveTriggers: SimpleTranslationEntries = {
"transformedIntoTarget": "{{pokemonName}} transformed\ninto {{targetName}}!", "transformedIntoTarget": "{{pokemonName}} transformed\ninto {{targetName}}!",
"tryingToTakeFoeDown": "{{pokemonName}} is hoping to take its attacker down with it!", "tryingToTakeFoeDown": "{{pokemonName}} is hoping to take its attacker down with it!",
"addType": "{{typeName}} was added to\n{{pokemonName}}!", "addType": "{{typeName}} was added to\n{{pokemonName}}!",
"cannotUseMove": "{{pokemonName}} cannot use {{moveName}}!" "cannotUseMove": "{{pokemonName}} cannot use {{moveName}}!",
"healHp": "{{pokemonName}} had its HP restored.",
"sacrificialFullRestore": "{{pokemonName}}'s Healing Wish\nwas granted!",
"invertStats": "{{pokemonName}}'s stat changes\nwere all reversed!",
"resetStats": "{{pokemonName}}'s stat changes\nwere eliminated!",
"faintCountdown": "{{pokemonName}}\nwill faint in {{turnCount}} turns.",
"copyType": "{{pokemonName}}'s type\nchanged to match {{targetPokemonName}}'s!",
"suppressAbilities": "{{pokemonName}}'s ability\nwas suppressed!",
"swapArenaTags": "{{pokemonName}} swapped the battle effects affecting each side of the field!",
} as const; } as const;

View File

@ -50,5 +50,13 @@ export const moveTriggers: SimpleTranslationEntries = {
"transformedIntoTarget": "{{pokemonName}} prend\nlapparence de {{targetName}} !", "transformedIntoTarget": "{{pokemonName}} prend\nlapparence de {{targetName}} !",
"tryingToTakeFoeDown": "{{pokemonName}} veut entrainer\nson assaillant dans sa chute !", "tryingToTakeFoeDown": "{{pokemonName}} veut entrainer\nson assaillant dans sa chute !",
"addType": "{{pokemonName}} gagne\nle type {{typeName}}.", "addType": "{{pokemonName}} gagne\nle type {{typeName}}.",
"cannotUseMove": "{{pokemonName}} ne peut pas\nutiliser la capacité {{moveName}} !" "cannotUseMove": "{{pokemonName}} ne peut pas\nutiliser la capacité {{moveName}} !",
"healHp": "{{pokemonName}} had its HP restored.",
"sacrificialFullRestore": "{{pokemonName}}'s Healing Wish\nwas granted!",
"invertStats": "{{pokemonName}}'s stat changes\nwere all reversed!",
"resetStats": "{{pokemonName}}'s stat changes\nwere eliminated!",
"faintCountdown": "{{pokemonName}}\nwill faint in {{turnCount}} turns.",
"copyType": "{{pokemonName}}'s type\nchanged to match {{targetPokemonName}}'s!",
"suppressAbilities": "{{pokemonName}}'s ability\nwas suppressed!",
"swapArenaTags": "{{pokemonName}} swapped the battle effects affecting each side of the field!",
} as const; } as const;

View File

@ -50,5 +50,13 @@ export const moveTriggers: SimpleTranslationEntries = {
"transformedIntoTarget": "{{pokemonName}} assume le sembianze\ndi {{targetName}}!", "transformedIntoTarget": "{{pokemonName}} assume le sembianze\ndi {{targetName}}!",
"tryingToTakeFoeDown": "{{pokemonName}} tenta di far subire a chi lo manda KO la sua stessa sorte!", "tryingToTakeFoeDown": "{{pokemonName}} tenta di far subire a chi lo manda KO la sua stessa sorte!",
"addType": "Adesso {{pokemonName}} è anche\ndi tipo {{typeName}}!", "addType": "Adesso {{pokemonName}} è anche\ndi tipo {{typeName}}!",
"cannotUseMove": "{{pokemonName}} non può usare {{moveName}}!" "cannotUseMove": "{{pokemonName}} non può usare {{moveName}}!",
"healHp": "{{pokemonName}} had its HP restored.",
"sacrificialFullRestore": "{{pokemonName}}'s Healing Wish\nwas granted!",
"invertStats": "{{pokemonName}}'s stat changes\nwere all reversed!",
"resetStats": "{{pokemonName}}'s stat changes\nwere eliminated!",
"faintCountdown": "{{pokemonName}}\nwill faint in {{turnCount}} turns.",
"copyType": "{{pokemonName}}'s type\nchanged to match {{targetPokemonName}}'s!",
"suppressAbilities": "{{pokemonName}}'s ability\nwas suppressed!",
"swapArenaTags": "{{pokemonName}} swapped the battle effects affecting each side of the field!",
} as const; } as const;

View File

@ -50,5 +50,13 @@ export const moveTriggers: SimpleTranslationEntries = {
"transformedIntoTarget": "{{pokemonName}}[[는]]\n{{targetName}}[[로]] 변신했다!", "transformedIntoTarget": "{{pokemonName}}[[는]]\n{{targetName}}[[로]] 변신했다!",
"tryingToTakeFoeDown": "{{pokemonName}}[[는]] 상대를\n길동무로 삼으려 하고 있다!", "tryingToTakeFoeDown": "{{pokemonName}}[[는]] 상대를\n길동무로 삼으려 하고 있다!",
"addType": "{{pokemonName}}에게\n{{typeName}}타입이 추가되었다!", "addType": "{{pokemonName}}에게\n{{typeName}}타입이 추가되었다!",
"cannotUseMove": "{{pokemonName}}[[는]]\n{{moveName}}[[를]] 쓸 수 없다!" "cannotUseMove": "{{pokemonName}}[[는]]\n{{moveName}}[[를]] 쓸 수 없다!",
"healHp": "{{pokemonName}}의\n체력이 회복되었다!",
"sacrificialFullRestore": "{{pokemonName}}의\n치유소원이 이루어졌다!",
"invertStats": "{{pokemonName}}[[는]]\n능력 변화가 뒤집혔다!",
"resetStats": "{{pokemonName}}의 모든 상태가\n원래대로 되돌아왔다!",
"faintCountdown": "{{pokemonName}}[[는]]\n{{turnCount}}턴 후에 쓰러져 버린다!",
"copyType": "{{pokemonName}}[[는]]\n{{targetPokemonName}}[[와]] 같은 타입이 되었다!",
"suppressAbilities": "{{pokemonName}}의\n특성이 효과를 발휘하지 못하게 되었다!",
"swapArenaTags": "{{pokemonName}}[[는]]\n서로의 필드 효과를 교체했다!",
} as const; } as const;

View File

@ -50,5 +50,13 @@ export const moveTriggers: SimpleTranslationEntries = {
"transformedIntoTarget": "{{pokemonName}} se transformou\nem um(a) {{targetName}}!", "transformedIntoTarget": "{{pokemonName}} se transformou\nem um(a) {{targetName}}!",
"tryingToTakeFoeDown": "{{pokemonName}} está tentando derrubar o atacante com ele!", "tryingToTakeFoeDown": "{{pokemonName}} está tentando derrubar o atacante com ele!",
"addType": "{{pokemonName}} recebeu\no tipo {{typeName}}!", "addType": "{{pokemonName}} recebeu\no tipo {{typeName}}!",
"cannotUseMove": "{{pokemonName}} não pode usar {{moveName}}!" "cannotUseMove": "{{pokemonName}} não pode usar {{moveName}}!",
"healHp": "{{pokemonName}} had its HP restored.",
"sacrificialFullRestore": "{{pokemonName}}'s Healing Wish\nwas granted!",
"invertStats": "{{pokemonName}}'s stat changes\nwere all reversed!",
"resetStats": "{{pokemonName}}'s stat changes\nwere eliminated!",
"faintCountdown": "{{pokemonName}}\nwill faint in {{turnCount}} turns.",
"copyType": "{{pokemonName}}'s type\nchanged to match {{targetPokemonName}}'s!",
"suppressAbilities": "{{pokemonName}}'s ability\nwas suppressed!",
"swapArenaTags": "{{pokemonName}} swapped the battle effects affecting each side of the field!",
} as const; } as const;

View File

@ -50,5 +50,13 @@ export const moveTriggers: SimpleTranslationEntries = {
"transformedIntoTarget": "{{pokemonName}}\n变身成了{{targetName}}", "transformedIntoTarget": "{{pokemonName}}\n变身成了{{targetName}}",
"tryingToTakeFoeDown": "{{pokemonName}}\n想和对手同归于尽", "tryingToTakeFoeDown": "{{pokemonName}}\n想和对手同归于尽",
"addType": "{{pokemonName}}\n增加了{{typeName}}属性!", "addType": "{{pokemonName}}\n增加了{{typeName}}属性!",
"cannotUseMove": "{{pokemonName}}\n无法使用{{moveName}}" "cannotUseMove": "{{pokemonName}}\n无法使用{{moveName}}",
"healHp": "{{pokemonName}} had its HP restored.",
"sacrificialFullRestore": "{{pokemonName}}'s Healing Wish\nwas granted!",
"invertStats": "{{pokemonName}}'s stat changes\nwere all reversed!",
"resetStats": "{{pokemonName}}'s stat changes\nwere eliminated!",
"faintCountdown": "{{pokemonName}}\nwill faint in {{turnCount}} turns.",
"copyType": "{{pokemonName}}'s type\nchanged to match {{targetPokemonName}}'s!",
"suppressAbilities": "{{pokemonName}}'s ability\nwas suppressed!",
"swapArenaTags": "{{pokemonName}} swapped the battle effects affecting each side of the field!",
} as const; } as const;

View File

@ -50,5 +50,13 @@ export const moveTriggers: SimpleTranslationEntries = {
"transformedIntoTarget": "{{pokemonName}}\n變身成了{{targetName}}", "transformedIntoTarget": "{{pokemonName}}\n變身成了{{targetName}}",
"tryingToTakeFoeDown": "{{pokemonName}}\n想和對手同歸於盡", "tryingToTakeFoeDown": "{{pokemonName}}\n想和對手同歸於盡",
"addType": "{{pokemonName}}\n增加了{{typeName}}屬性!", "addType": "{{pokemonName}}\n增加了{{typeName}}屬性!",
"cannotUseMove": "{{pokemonName}}\n無法使用{{moveName}}" "cannotUseMove": "{{pokemonName}}\n無法使用{{moveName}}",
"healHp": "{{pokemonName}} had its HP restored.",
"sacrificialFullRestore": "{{pokemonName}}'s Healing Wish\nwas granted!",
"invertStats": "{{pokemonName}}'s stat changes\nwere all reversed!",
"resetStats": "{{pokemonName}}'s stat changes\nwere eliminated!",
"faintCountdown": "{{pokemonName}}\nwill faint in {{turnCount}} turns.",
"copyType": "{{pokemonName}}'s type\nchanged to match {{targetPokemonName}}'s!",
"suppressAbilities": "{{pokemonName}}'s ability\nwas suppressed!",
"swapArenaTags": "{{pokemonName}} swapped the battle effects affecting each side of the field!",
} as const; } as const;

View File

@ -2,17 +2,6 @@ import { BattleSpec } from "#enums/battle-spec";
import Pokemon from "./field/pokemon"; import Pokemon from "./field/pokemon";
import i18next from "i18next"; import i18next from "i18next";
/**
* Builds a message by concatenating the Pokemon name with its potential affix and the given text
* @param pokemon {@linkcode Pokemon} name and battle context will be retrieved from this instance for {@linkcode getPokemonNameWithAffix}
* @param {string} content any text
* @returns {string} ex: "Wild Gengar fainted!", "Ectoplasma sauvage est K.O!"
* @see {@linkcode getPokemonNameWithAffix} for the Pokemon's name and potentiel affix
*/
export function getPokemonMessage(pokemon: Pokemon, content: string): string {
return `${getPokemonNameWithAffix(pokemon)}${content}`;
}
/** /**
* Retrieves the Pokemon's name, potentially with an affix indicating its role (wild or foe) in the current battle context, translated * Retrieves the Pokemon's name, potentially with an affix indicating its role (wild or foe) in the current battle context, translated
* @param pokemon {@linkcode Pokemon} name and battle context will be retrieved from this instance * @param pokemon {@linkcode Pokemon} name and battle context will be retrieved from this instance