Skip to content

Commit

Permalink
Replays: Restore support for -restoreboost
Browse files Browse the repository at this point in the history
I was watching an old replay and noticed it no longer worked.

Turn 7 of https://replay.pokemonshowdown.com/randombattle-247965078

Apparently when I did this rename, I didn't bother to make it
backwards compatible with old replays?

9aba6a3
  • Loading branch information
Zarel committed Nov 5, 2023
1 parent 7a2b323 commit 51a285c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/battle-text-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ class BattleTextParser {
return {group, name, away, status};
}

/**
* Old replays may use syntax we no longer use, so this function upgrades
* them to modern versions. Used to keep battle.ts itself cleaner. Not
* guaranteed to mutate or not mutate its inputs.
*/
static upgradeArgs({args, kwArgs}: {args: Args, kwArgs: KWArgs}): {args: Args, kwArgs: KWArgs} {
switch (args[0]) {
case '-activate': {
Expand Down Expand Up @@ -189,6 +194,11 @@ class BattleTextParser {
break;
}

case '-restoreboost': {
args[0] = '-clearnegativeboost';
break;
}

case '-nothing':
// OLD: |-nothing
// NEW: |-activate||move:Splash
Expand Down

0 comments on commit 51a285c

Please sign in to comment.