Fix misc bugs in text-parser

- Magic Room
- Wide Guard
- Perish Song
- Leppa Berry
- Gen 1 Special boosting
This commit is contained in:
Guangcong Luo 2018-11-22 06:03:58 -05:00
parent 44d669f74d
commit e01c181307
3 changed files with 12 additions and 9 deletions

View File

@ -286,7 +286,7 @@ exports.BattleText = {
activate: "[POKEMON] couldn't stay airborne because of gravity!",
},
magicroom: {
start: " It created a bizarre area in which Pokémon's held items lose their effects!",
start: " It created a bizarre area in which Pok\u00E9mon's held items lose their effects!",
end: " Magic Room wore off, and held items' effects returned to normal!",
},
mudsport: {
@ -628,7 +628,7 @@ exports.BattleText = {
activate: " Coins were scattered everywhere!",
},
perishsong: {
start: " All Pokémon that heard the song will faint in three turns!",
start: " All Pok\u00E9mon that heard the song will faint in three turns!",
activate: " [POKEMON]'s perish count fell to [NUMBER].",
},
phantomforce: {
@ -640,7 +640,7 @@ exports.BattleText = {
},
powder: {
start: " [POKEMON] is covered in powder!",
activate: " When the flame touched the powder on the Pokémon, it exploded!",
activate: " When the flame touched the powder on the Pok\u00E9mon, it exploded!",
},
powersplit: {
activate: " [POKEMON] shared its power with the target!",
@ -870,7 +870,7 @@ exports.BattleText = {
block: " [TARGET] is protected by an aromatic veil!",
},
aurabreak: {
start: " [POKEMON] reversed all other Pokémon's auras!",
start: " [POKEMON] reversed all other Pok\u00E9mon's auras!",
},
baddreams: {
damage: " [POKEMON] is tormented!",

View File

@ -510,7 +510,7 @@ class BattleTextParser {
}
let template = this.template('start', effect, 'NODEFAULT');
if (!template) template = this.template('start').replace('[EFFECT]', this.effect(effect));
return line1 + template.replace('[POKEMON]', this.pokemon(pokemon)).replace('[SOURCE]', this.pokemon(kwArgs.of));
return line1 + template.replace('[POKEMON]', this.pokemon(pokemon)).replace('[SOURCE]', this.pokemon(kwArgs.of)).replace('[TEAM]', this.team(pokemon.slice(0, 2)));
}
case '-sidestart': {
@ -546,7 +546,8 @@ class BattleTextParser {
case '-fieldstart': case '-fieldactivate': {
const [, effect] = args;
const line1 = this.maybeAbility(kwArgs.from, kwArgs.of);
const templateId = cmd.slice(6);
let templateId = cmd.slice(6);
if (this.effectId(effect) === 'perishsong') templateId = 'start';
let template = this.template(templateId, effect, 'NODEFAULT');
if (!template) template = this.template('startFieldEffect').replace('[EFFECT]', this.effect(effect));
return line1 + template.replace('[POKEMON]', this.pokemon(kwArgs.of));
@ -583,7 +584,7 @@ class BattleTextParser {
if (!arg5 && (id === 'spite' || id === 'skillswap')) {
[target, arg4, arg5] = [pokemon, target, arg4];
} else if (!arg4 && [
'grudge', 'forewarn', 'magnitude', 'sketch', 'persistent', 'symbiosis', 'safetygoggles', 'matblock', 'safetygoggles',
'grudge', 'forewarn', 'magnitude', 'sketch', 'persistent', 'symbiosis', 'safetygoggles', 'matblock', 'safetygoggles', 'leppaberry',
].includes(id)) {
[target, arg4] = [pokemon, target];
} else if (!target && ['hyperspacefury', 'hyperspacehole', 'phantomforce', 'shadowforce', 'feint'].includes(id)) {
@ -650,6 +651,7 @@ class BattleTextParser {
line1 += this.ability("Mummy", target);
template = this.template('changeAbility', "Mummy");
}
if (id === 'leppaberry') template = template.replace('[MOVE]', arg4);
return line1 + template.replace('[POKEMON]', this.pokemon(pokemon)).replace('[TARGET]', this.pokemon(target)).replace('[SOURCE]', this.pokemon(kwArgs.of));
}
@ -706,7 +708,8 @@ class BattleTextParser {
}
case '-boost': case '-unboost': {
const [, pokemon, stat, num] = args;
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);

View File

@ -2171,7 +2171,7 @@ class Battle {
this.scene.resultAnim(poke, 'Perish in 2', 'bad');
break;
case 'perish3':
this.scene.resultAnim(poke, 'Perish in 3', 'bad');
if (!kwArgs.silent) this.scene.resultAnim(poke, 'Perish in 3', 'bad');
break;
case 'encore':
this.scene.resultAnim(poke, 'Encored', 'bad');