add berry, battle-stat CN translate

add berry, battle-stat CN translate
change src/data/ :
berry.ts
battle-stat.ts

to translate berrys
This commit is contained in:
Rei1mu 2024-05-17 00:39:26 +08:00
parent ff086ca492
commit 9d4b3e85fe
10 changed files with 101 additions and 36 deletions

View File

@ -18,7 +18,7 @@ import { Moves } from "./enums/moves";
import { TerrainType } from "./terrain"; import { TerrainType } from "./terrain";
import { SpeciesFormChangeManualTrigger } from "./pokemon-forms"; import { SpeciesFormChangeManualTrigger } from "./pokemon-forms";
import { Abilities } from "./enums/abilities"; import { Abilities } from "./enums/abilities";
import i18next, { Localizable } from "#app/plugins/i18n.js"; import i18next, { Localizable } from "#app/plugins/i18n";
import { Command } from "../ui/command-ui-handler"; import { Command } from "../ui/command-ui-handler";
import Battle from "#app/battle.js"; import Battle from "#app/battle.js";
import { ability } from "#app/locales/en/ability.js"; import { ability } from "#app/locales/en/ability.js";

View File

@ -8,23 +8,23 @@ export enum BattleStat {
EVA, EVA,
RAND RAND
} }
import i18next from "#app/plugins/i18n";
export function getBattleStatName(stat: BattleStat) { export function getBattleStatName(stat: BattleStat) {
switch (stat) { switch (stat) {
case BattleStat.ATK: case BattleStat.ATK:
return 'Attack'; return i18next.t('battle:Attack');
case BattleStat.DEF: case BattleStat.DEF:
return 'Defense'; return i18next.t('battle:Defense');
case BattleStat.SPATK: case BattleStat.SPATK:
return 'Sp. Atk'; return i18next.t('battle:Sp_Atk');
case BattleStat.SPDEF: case BattleStat.SPDEF:
return 'Sp. Def'; return i18next.t('battle:Sp_Def');
case BattleStat.SPD: case BattleStat.SPD:
return 'Speed'; return i18next.t('battle:Speed');
case BattleStat.ACC: case BattleStat.ACC:
return 'Accuracy'; return i18next.t('battle:Accuracy');
case BattleStat.EVA: case BattleStat.EVA:
return 'Evasiveness'; return i18next.t('battle:Evasiveness');
default: default:
return '???'; return '???';
} }
@ -34,30 +34,30 @@ export function getBattleStatLevelChangeDescription(levels: integer, up: boolean
if (up) { if (up) {
switch (levels) { switch (levels) {
case 1: case 1:
return 'rose'; return i18next.t('battle:rose');
case 2: case 2:
return 'sharply rose'; return i18next.t('battle:sharply_rose');
case 3: case 3:
case 4: case 4:
case 5: case 5:
case 6: case 6:
return 'rose drastically'; return i18next.t('battle:rose_drastically');
default: default:
return 'won\'t go any higher'; return i18next.t('battle:won_t_go_any_higher');
} }
} else { } else {
switch (levels) { switch (levels) {
case 1: case 1:
return 'fell'; return i18next.t('battle:fell');
case 2: case 2:
return 'harshly fell'; return i18next.t('battle:harshly_fell');
case 3: case 3:
case 4: case 4:
case 5: case 5:
case 6: case 6:
return 'severely fell'; return i18next.t('battle:severely_fell');
default: default:
return 'won\'t go any lower'; return i18next.t('battle:won_t_go_any_lower');
} }
} }
} }

View File

@ -7,7 +7,7 @@ import { BattlerTagType } from "./enums/battler-tag-type";
import { getStatusEffectHealText } from "./status-effect"; import { getStatusEffectHealText } from "./status-effect";
import * as Utils from "../utils"; import * as Utils from "../utils";
import { DoubleBerryEffectAbAttr, ReduceBerryUseThresholdAbAttr, applyAbAttrs } from "./ability"; import { DoubleBerryEffectAbAttr, ReduceBerryUseThresholdAbAttr, applyAbAttrs } from "./ability";
import i18next from '../plugins/i18n';
export enum BerryType { export enum BerryType {
SITRUS, SITRUS,
LUM, LUM,
@ -23,30 +23,30 @@ export enum BerryType {
} }
export function getBerryName(berryType: BerryType) { export function getBerryName(berryType: BerryType) {
return `${Utils.toReadableString(BerryType[berryType])} Berry`; return `${Utils.toReadableString(BerryType[berryType])} `+i18next.t('berry:Berry');
} }
export function getBerryEffectDescription(berryType: BerryType) { export function getBerryEffectDescription(berryType: BerryType) {
switch (berryType) { switch (berryType) {
case BerryType.SITRUS: case BerryType.SITRUS:
return 'Restores 25% HP if HP is below 50%'; return i18next.t('berry:Restores_25%_HP_if_HP_is_below_50%');
case BerryType.LUM: case BerryType.LUM:
return 'Cures any non-volatile status condition and confusion'; return i18next.t('berry:Cures_any_non-volatile_status_condition_and_confusion');
case BerryType.ENIGMA: case BerryType.ENIGMA:
return 'Restores 25% HP if hit by a super effective move'; return i18next.t('berry:Restores_25%_HP_if_hit_by_a_super_effective_move');
case BerryType.LIECHI: case BerryType.LIECHI:
case BerryType.GANLON: case BerryType.GANLON:
case BerryType.PETAYA: case BerryType.PETAYA:
case BerryType.APICOT: case BerryType.APICOT:
case BerryType.SALAC: case BerryType.SALAC:
const stat = (berryType - BerryType.LIECHI) as BattleStat; const stat = (berryType - BerryType.LIECHI) as BattleStat;
return `Raises ${getBattleStatName(stat)} if HP is below 25%`; return `${i18next.t('berry:Raises')} ${getBattleStatName(stat)} `+i18next.t('berry:if_HP_is_below_25%');
case BerryType.LANSAT: case BerryType.LANSAT:
return 'Raises critical hit ratio if HP is below 25%'; return +i18next.t('berry:Raises_critical_hit_ratio_if_HP_is_below_25%');
case BerryType.STARF: case BerryType.STARF:
return 'Sharply raises a random stat if HP is below 25%'; return +i18next.t('berry:Sharply_raises_a_random_stat_if_HP_is_below_25%');
case BerryType.LEPPA: case BerryType.LEPPA:
return 'Restores 10 PP to a move if its PP reaches 0'; return +i18next.t('berry:Restores_10_PP_to_a_move_if_its_PP_reaches_0');
} }
} }
@ -104,7 +104,7 @@ export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc {
const hpHealed = new Utils.NumberHolder(Math.floor(pokemon.getMaxHp() / 4)); const hpHealed = new Utils.NumberHolder(Math.floor(pokemon.getMaxHp() / 4));
applyAbAttrs(DoubleBerryEffectAbAttr, pokemon, null, hpHealed); applyAbAttrs(DoubleBerryEffectAbAttr, pokemon, null, hpHealed);
pokemon.scene.unshiftPhase(new PokemonHealPhase(pokemon.scene, pokemon.getBattlerIndex(), pokemon.scene.unshiftPhase(new PokemonHealPhase(pokemon.scene, pokemon.getBattlerIndex(),
hpHealed.value, getPokemonMessage(pokemon, `'s ${getBerryName(berryType)}\nrestored its HP!`), true)); hpHealed.value, getPokemonMessage(pokemon, `'s ${getBerryName(berryType)}\n`+i18next.t('berry:restored_its_HP')), true));
}; };
case BerryType.LUM: case BerryType.LUM:
return (pokemon: Pokemon) => { return (pokemon: Pokemon) => {
@ -151,7 +151,7 @@ export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc {
pokemon.battleData.berriesEaten.push(berryType); pokemon.battleData.berriesEaten.push(berryType);
const ppRestoreMove = pokemon.getMoveset().find(m => !m.getPpRatio()); const ppRestoreMove = pokemon.getMoveset().find(m => !m.getPpRatio());
ppRestoreMove.ppUsed = Math.max(ppRestoreMove.ppUsed - 10, 0); ppRestoreMove.ppUsed = Math.max(ppRestoreMove.ppUsed - 10, 0);
pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` restored PP to its move ${ppRestoreMove.getName()}\nusing its ${getBerryName(berryType)}!`)); pokemon.scene.queueMessage(getPokemonMessage(pokemon, `${i18next.t('berry:restored_PP_to_its_move')} ${ppRestoreMove.getName()}\n${i18next.t('berry:using_its')} ${getBerryName(berryType)}!`));
}; };
} }
} }

View File

@ -52,5 +52,20 @@ export const battle: SimpleTranslationEntries = {
"notDisabled": "{{pokemonName}}'s {{moveName}} is disabled\nno more!", "notDisabled": "{{pokemonName}}'s {{moveName}} is disabled\nno more!",
"skipItemQuestion": "Are you sure you want to skip taking an item?", "skipItemQuestion": "Are you sure you want to skip taking an item?",
"eggHatching": "Oh?", "eggHatching": "Oh?",
"ivScannerUseQuestion": "Use IV Scanner on {{pokemonName}}?" "ivScannerUseQuestion": "Use IV Scanner on {{pokemonName}}?",
"Attack": "Attack",
"Defense": "Defense",
"Sp_Atk": "Sp. Atk",
"Sp_Def": "Sp. Def",
"Speed": "Speed",
"Accuracy": "Accuracy",
"Evasiveness": "Evasiveness",
"rose": "rose",
"sharply_rose": "sharply_rose",
"rose_drastically": "rose drastically",
"fell": "fell",
"harshly_fell": "harshly fell",
"severly_fell": "severly fell",
"won_t_go_any_higher": "won\'t go any higher",
"won_t_go_any_lower": "won\'t go any lower"
} as const; } as const;

16
src/locales/en/berry.ts Normal file
View File

@ -0,0 +1,16 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const berry: SimpleTranslationEntries = {
"Restores_25%_HP_if_HP_is_below_50%": "Restores 25% HP if HP is below 50%",
"Cures_any_non-volatile_status_condition_and_confusion": "Cures any non-volatile status condition and confusion",
"Restores_25%_HP_if_hit_by_a_super_effective_move": "Restores 25% HP if hit by a super effective move",
"Raises": "Raises",
"if_HP_is_below_25%": "if HP is below 25%",
"Raises_critical_hit_ratio_if_HP_is_below_25%": "Raises critical hit ratio if HP is below 25%",
"Sharply_raises_a_random_stat_if_HP_is_below_25%": "Sharply raises a random stat if HP is below 25%",
"Restores_10_PP_to_a_move_if_its_PP_reaches_0": "Restores 10 PP to a move if its PP reaches 0",
"restored_PP_to_its_move": "restored PP to its move",
"using_its": "using its",
"restored_its_HP":"restored its HP!",
"Berry": "Berry"
} as const;

View File

@ -18,7 +18,7 @@ import { tutorial } from "./tutorial";
import { titles,trainerClasses,trainerNames } from "./trainers"; import { titles,trainerClasses,trainerNames } from "./trainers";
import { splashMessages } from "./splash-messages" import { splashMessages } from "./splash-messages"
import { weather } from "./weather"; import { weather } from "./weather";
import { berry } from "./berry";
export const enConfig = { export const enConfig = {
ability: ability, ability: ability,
@ -43,4 +43,5 @@ export const enConfig = {
growth: growth, growth: growth,
weather: weather, weather: weather,
modifierType: modifierType, modifierType: modifierType,
berry:berry,
} }

View File

@ -52,5 +52,20 @@ export const battle: SimpleTranslationEntries = {
"notDisabled": "{{moveName}} 不再被禁用!", "notDisabled": "{{moveName}} 不再被禁用!",
"skipItemQuestion": "你确定要跳过拾取道具吗?", "skipItemQuestion": "你确定要跳过拾取道具吗?",
"eggHatching": "咦?", "eggHatching": "咦?",
"ivScannerUseQuestion": "对 {{pokemonName}} 使用个体值扫描仪?" "ivScannerUseQuestion": "对 {{pokemonName}} 使用个体值扫描仪?",
"Attack": "攻击(ATK)",
"Defense": "防御(DEF)",
"Sp_Atk": "特殊攻击(SP ATK)",
"Sp_Def": "特殊防御(SP DEF)",
"Speed": "速度(SPD)",
"Accuracy": "准度(ACC)",
"Evasiveness": "闪避(EVA)",
"rose": "小幅上升",
"sharply_rose": "大幅上升",
"rose_drastically": "显著上升",
"fell": "小幅降低",
"harshly_fell": "大幅降低",
"severly_fell": "显著降低",
"won_t_go_any_higher": "不能再增加",
"won_t_go_any_lower": "不能再减少"
} as const; } as const;

View File

@ -0,0 +1,17 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const berry: SimpleTranslationEntries = {
"Restores_25%_HP_if_HP_is_below_50%": "如果HP低于50%恢复25%的HP",
"Cures_any_non-volatile_status_condition_and_confusion": "治愈任何非易失性状态异常和混乱状态",
"Restores_25%_HP_if_hit_by_a_super_effective_move": "如果受到超有效的攻击恢复25%的HP",
"Raises": "提升",
"if_HP_is_below_25%": ",在HP低于25%的情况下",
"Raises_critical_hit_ratio_if_HP_is_below_25%": "如果HP低于25%,提升击中要害的概率",
"Sharply_raises_a_random_stat_if_HP_is_below_25%": "如果HP低于25%,大幅提升一项随机能力值",
"Restores_10_PP_to_a_move_if_its_PP_reaches_0": "如果技能的PP降至0恢复10点PP",
"restored_PP_to_its_move": "恢复了招式的PP",
"using_its": "使用",
"restored_its_HP":"恢复了HP",
"Berry": "浆果"
} as const;

View File

@ -16,7 +16,7 @@ import { nature } from "./nature";
import { weather } from "./weather"; import { weather } from "./weather";
import { modifierType } from "./modifier-type"; import { modifierType } from "./modifier-type";
import { growth } from "./growth"; import { growth } from "./growth";
import { berry } from "./berry";
export const zhCnConfig = { export const zhCnConfig = {
ability: ability, ability: ability,
@ -36,8 +36,8 @@ export const zhCnConfig = {
trainerClasses: trainerClasses, trainerClasses: trainerClasses,
trainerNames: trainerNames, trainerNames: trainerNames,
tutorial: tutorial, tutorial: tutorial,
nature: nature,
growth: growth, growth: growth,
weather: weather, weather: weather,
modifierType: modifierType, modifierType: modifierType,
berry: berry
} }

View File

@ -139,6 +139,7 @@ declare module 'i18next' {
egg: SimpleTranslationEntries; egg: SimpleTranslationEntries;
weather: SimpleTranslationEntries; weather: SimpleTranslationEntries;
modifierType: ModifierTypeTranslationEntries; modifierType: ModifierTypeTranslationEntries;
berry: SimpleTranslationEntries;
}; };
} }
} }