feat: added support for localisation on battle scene sentences

pull/392/head
TeKrop 2024-05-01 22:48:58 +02:00 committed by Samuel H
parent 89e2642d91
commit e34b204664
6 changed files with 37 additions and 11 deletions

View File

@ -45,6 +45,7 @@ import { TerrainType } from '../data/terrain';
import { TrainerSlot } from '../data/trainer-config';
import { BerryType } from '../data/berry';
import { ABILITY_OVERRIDE, MOVE_OVERRIDE, OPP_ABILITY_OVERRIDE, OPP_MOVE_OVERRIDE, OPP_SHINY_OVERRIDE, OPP_VARIANT_OVERRIDE } from '../overrides';
import i18next from '../plugins/i18n';
export enum FieldPosition {
CENTER,
@ -1417,7 +1418,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
damage.value = this.damageAndUpdate(damage.value, result as DamageResult, isCritical, oneHitKo, oneHitKo);
this.turnData.damageTaken += damage.value;
if (isCritical)
this.scene.queueMessage('A critical hit!');
this.scene.queueMessage(i18next.t('menu:hitResultCriticalHit'));
this.scene.setPhaseQueueSplice();
if (source.isPlayer()) {
this.scene.validateAchvs(DamageAchv, damage);
@ -1435,16 +1436,16 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
if (source.turnData.hitsLeft === 1) {
switch (result) {
case HitResult.SUPER_EFFECTIVE:
this.scene.queueMessage('It\'s super effective!');
this.scene.queueMessage(i18next.t('menu:hitResultSuperEffective'));
break;
case HitResult.NOT_VERY_EFFECTIVE:
this.scene.queueMessage('It\'s not very effective…');
this.scene.queueMessage(i18next.t('menu:hitResultNotVeryEffective'));
break;
case HitResult.NO_EFFECT:
this.scene.queueMessage(`It doesn\'t affect ${this.name}!`);
this.scene.queueMessage(i18next.t('menu:hitResultNoEffect', { pokemonName: this.name }));
break;
case HitResult.ONE_HIT_KO:
this.scene.queueMessage('It\'s a one-hit KO!');
this.scene.queueMessage(i18next.t('menu:hitResultOneHitKO'));
break;
}
}
@ -1461,7 +1462,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
defendingSidePlayField.forEach((p) => applyPreDefendAbAttrs(FieldPriorityMoveImmunityAbAttr, p, source, battlerMove, cancelled, typeMultiplier));
}
if (!typeMultiplier.value)
this.scene.queueMessage(`It doesn\'t affect ${this.name}!`);
this.scene.queueMessage(i18next.t('menu:hitResultNoEffect', { pokemonName: this.name }));
result = cancelled.value || !typeMultiplier.value ? HitResult.NO_EFFECT : HitResult.STATUS;
break;
}

View File

@ -63,5 +63,10 @@ export const menu: SimpleTranslationEntries = {
"weeklyRankings": "Weekly Rankings",
"noRankings": "No Rankings",
"loading": "Loading…",
"playersOnline": "Players Online"
"playersOnline": "Players Online",
"hitResultCriticalHit": "A critical hit!",
"hitResultSuperEffective": "It's super effective!",
"hitResultNotVeryEffective": "It's not very effective…",
"hitResultNoEffect": "It doesn't affect {{pokemonName}}!",
"hitResultOneHitKO": "It's a one-hit KO!"
} as const;

View File

@ -82,5 +82,10 @@ export const menu: SimpleTranslationEntries = {
"weeklyRankings": "Weekly Rankings",
"noRankings": "No Rankings",
"loading": "Loading…",
"playersOnline": "Players Online"
"playersOnline": "Players Online",
"hitResultCriticalHit": "A critical hit!",
"hitResultSuperEffective": "It's super effective!",
"hitResultNotVeryEffective": "It's not very effective…",
"hitResultNoEffect": "It doesn't affect {{pokemonName}}!",
"hitResultOneHitKO": "It's a one-hit KO!"
} as const;

View File

@ -66,5 +66,10 @@ export const menu: SimpleTranslationEntries = {
"weeklyRankings": "Weekly Rankings",
"noRankings": "No Rankings",
"loading": "Loading…",
"playersOnline": "Players Online"
"playersOnline": "Players Online",
"hitResultCriticalHit": "A critical hit!",
"hitResultSuperEffective": "It's super effective!",
"hitResultNotVeryEffective": "It's not very effective…",
"hitResultNoEffect": "It doesn't affect {{pokemonName}}!",
"hitResultOneHitKO": "It's a one-hit KO!"
} as const;

View File

@ -77,5 +77,10 @@ export const menu: SimpleTranslationEntries = {
"weeklyRankings": "Classement de la Semaine",
"noRankings": "Pas de Classement",
"loading": "Chargement…",
"playersOnline": "Joueurs Connectés"
"playersOnline": "Joueurs Connectés",
"hitResultCriticalHit": "Coup critique!",
"hitResultSuperEffective": "C'est super efficace!",
"hitResultNotVeryEffective": "Ce n'est pas très efficace…",
"hitResultNoEffect": "Ça n'affecte pas {{pokemonName}}…",
"hitResultOneHitKO": "K.O. en un coup!"
} as const;

View File

@ -11,5 +11,10 @@ export const menu: SimpleTranslationEntries = {
"weeklyRankings": "Weekly Rankings",
"noRankings": "No Rankings",
"loading": "Loading…",
"playersOnline": "Players Online"
"playersOnline": "Players Online",
"hitResultCriticalHit": "A critical hit!",
"hitResultSuperEffective": "It's super effective!",
"hitResultNotVeryEffective": "It's not very effective…",
"hitResultNoEffect": "It doesn't affect {{pokemonName}}!",
"hitResultOneHitKO": "It's a one-hit KO!"
} as const;