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

View File

@ -63,5 +63,10 @@ export const menu: SimpleTranslationEntries = {
"weeklyRankings": "Weekly Rankings", "weeklyRankings": "Weekly Rankings",
"noRankings": "No Rankings", "noRankings": "No Rankings",
"loading": "Loading…", "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; } as const;

View File

@ -82,5 +82,10 @@ export const menu: SimpleTranslationEntries = {
"weeklyRankings": "Weekly Rankings", "weeklyRankings": "Weekly Rankings",
"noRankings": "No Rankings", "noRankings": "No Rankings",
"loading": "Loading…", "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; } as const;

View File

@ -66,5 +66,10 @@ export const menu: SimpleTranslationEntries = {
"weeklyRankings": "Weekly Rankings", "weeklyRankings": "Weekly Rankings",
"noRankings": "No Rankings", "noRankings": "No Rankings",
"loading": "Loading…", "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; } as const;

View File

@ -77,5 +77,10 @@ export const menu: SimpleTranslationEntries = {
"weeklyRankings": "Classement de la Semaine", "weeklyRankings": "Classement de la Semaine",
"noRankings": "Pas de Classement", "noRankings": "Pas de Classement",
"loading": "Chargement…", "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; } as const;

View File

@ -11,5 +11,10 @@ export const menu: SimpleTranslationEntries = {
"weeklyRankings": "Weekly Rankings", "weeklyRankings": "Weekly Rankings",
"noRankings": "No Rankings", "noRankings": "No Rankings",
"loading": "Loading…", "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; } as const;