mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-04-25 07:57:01 -05:00
Use data/text.js for stats in text parser
We previously used BattleStats, but using `data/text.js` allows stat names to be translated.
This commit is contained in:
parent
0a0035fbf8
commit
a05f23fd37
32
data/text.js
32
data/text.js
|
|
@ -120,6 +120,38 @@ exports.BattleText = {
|
|||
hitCountSingular: " Hit 1 time!",
|
||||
},
|
||||
|
||||
// stats
|
||||
hp: {
|
||||
statName: "HP",
|
||||
},
|
||||
atk: {
|
||||
statName: "Attack",
|
||||
},
|
||||
def: {
|
||||
statName: "Defense",
|
||||
},
|
||||
spa: {
|
||||
statName: "Special Attack",
|
||||
},
|
||||
spd: {
|
||||
statName: "Special Defense",
|
||||
},
|
||||
spe: {
|
||||
statName: "Speed",
|
||||
},
|
||||
accuracy: {
|
||||
statName: "accuracy",
|
||||
},
|
||||
evasion: {
|
||||
statName: "evasiveness",
|
||||
},
|
||||
spc: {
|
||||
statName: "Special",
|
||||
},
|
||||
stats: {
|
||||
statName: "stats",
|
||||
},
|
||||
|
||||
// statuses
|
||||
brn: {
|
||||
start: " [POKEMON] was burned!",
|
||||
|
|
|
|||
|
|
@ -147,6 +147,12 @@ class BattleTextParser {
|
|||
return BattleText.default.abilityActivation.replace('[POKEMON]', this.pokemon(holder)).replace('[ABILITY]', this.effect(name)) + '\n';
|
||||
}
|
||||
|
||||
stat(stat: string) {
|
||||
const entry = BattleText[stat || "stats"];
|
||||
if (!entry || !entry.statName) return `???stat:${stat}???`;
|
||||
return entry.statName;
|
||||
}
|
||||
|
||||
lineSection(args: Args, kwArgs: KWArgs) {
|
||||
const cmd = args[0];
|
||||
switch (cmd) {
|
||||
|
|
@ -721,7 +727,6 @@ class BattleTextParser {
|
|||
case '-boost': case '-unboost': {
|
||||
let [, pokemon, stat, num] = args;
|
||||
if (stat === 'spa' && this.gen === 1) stat = 'spc';
|
||||
const statName = BattleStats[stat as StatName] || "stats";
|
||||
const amount = parseInt(num, 10);
|
||||
const line1 = this.maybeAbility(kwArgs.from, kwArgs.of || pokemon);
|
||||
let templateId = cmd.slice(1);
|
||||
|
|
@ -734,7 +739,7 @@ class BattleTextParser {
|
|||
templateId += 'FromItem';
|
||||
}
|
||||
const template = this.template(templateId, kwArgs.from);
|
||||
return line1 + template.replace('[POKEMON]', this.pokemon(pokemon)).replace('[STAT]', statName);
|
||||
return line1 + template.replace('[POKEMON]', this.pokemon(pokemon)).replace('[STAT]', this.stat(stat));
|
||||
}
|
||||
|
||||
case '-setboost': {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user