diff --git a/sim/battle.js b/sim/battle.js index 846fead727b03..47aa54b462d5c 100644 --- a/sim/battle.js +++ b/sim/battle.js @@ -135,8 +135,6 @@ class Battle extends Dex.ModdedDex { this.abilityOrder = 0; /** @type {''} */ this.NOT_FAILURE = ''; - /** @type {boolean} */ - this.LEGACY_API_DO_NOT_USE = false; /** @type {PRNG} */ this.prng = options.prng || new PRNG(options.seed || undefined); @@ -3183,13 +3181,10 @@ class Battle extends Dex.ModdedDex { * @param {string[]} inputs */ makeChoices(...inputs) { - const oldFlag = this.LEGACY_API_DO_NOT_USE; - this.LEGACY_API_DO_NOT_USE = false; for (const [i, input] of inputs.entries()) { this.sides[i].choose(input); } this.commitDecisions(); - this.LEGACY_API_DO_NOT_USE = oldFlag; } commitDecisions() { @@ -3197,12 +3192,9 @@ class Battle extends Dex.ModdedDex { let oldQueue = this.queue; this.queue = []; - let oldFlag = this.LEGACY_API_DO_NOT_USE; - this.LEGACY_API_DO_NOT_USE = false; for (const side of this.sides) { side.autoChoose(); } - this.LEGACY_API_DO_NOT_USE = oldFlag; let p1choice = this.p1.getChoice(); if (p1choice) this.inputLog.push(`>p1 ${p1choice}`); let p2choice = this.p2.getChoice(); diff --git a/sim/side.js b/sim/side.js index 5e61706913e3d..891d5db01f022 100644 --- a/sim/side.js +++ b/sim/side.js @@ -467,7 +467,6 @@ class Side { if (ultra) this.choice.ultra = true; if (zMove) this.choice.zMove = true; - if (this.battle.LEGACY_API_DO_NOT_USE && !this.battle.checkActions()) return this; return true; } @@ -548,7 +547,6 @@ class Side { target: targetPokemon, }); - if (this.battle.LEGACY_API_DO_NOT_USE && !this.battle.checkActions()) return this; return true; } @@ -602,7 +600,6 @@ class Side { }); } - if (this.battle.LEGACY_API_DO_NOT_USE && !this.battle.checkActions()) return this; return true; } @@ -628,7 +625,6 @@ class Side { pokemon: pokemon, }); - if (this.battle.LEGACY_API_DO_NOT_USE && !this.battle.checkActions()) return this; return true; } @@ -787,28 +783,9 @@ class Side { this.choice.actions.push({ choice: 'pass', }); - if (this.battle.LEGACY_API_DO_NOT_USE && !this.battle.checkActions()) return this; return true; } - /** - * @return {boolean | Side} - */ - chooseDefault() { - if (!this.battle.LEGACY_API_DO_NOT_USE) throw new Error(`This is a legacy API, it's called autoChoose now`); - if (this.isChoiceDone()) { - throw new Error(`You've already chosen actions for ${this.id}.`); - } - if (this.currentRequest === 'teampreview') { - this.chooseTeam(); - } else if (this.currentRequest === 'switch') { - while (this.chooseSwitch() !== true && !this.isChoiceDone()); - } else if (this.currentRequest === 'move') { - while (this.chooseMove() !== true && !this.isChoiceDone()); - } - return this; - } - /** * Automatically finish a choice if not currently complete */ diff --git a/test/common.js b/test/common.js index bdfdb837a3284..8735fb829bc67 100644 --- a/test/common.js +++ b/test/common.js @@ -112,7 +112,6 @@ class TestTools { // will be used. seed: options.seed || DEFAULT_SEED, }); - battle.LEGACY_API_DO_NOT_USE = true; if (teams) { for (let i = 0; i < teams.length; i++) { assert(Array.isArray(teams[i]), "Team provided is not an array"); diff --git a/test/simulator/misc/decisions.js b/test/simulator/misc/decisions.js index 0b21724450fe2..3c28e9982ceaf 100644 --- a/test/simulator/misc/decisions.js +++ b/test/simulator/misc/decisions.js @@ -1164,17 +1164,19 @@ describe('Choice internals', function () { ]); assert.strictEqual(battle.turn, 1); - p1.chooseMove(1).chooseSwitch(4); - assert(!p2.chooseSwitch(3)); - p2.chooseMove(1).chooseMove(1); + p1.choose('move recover, switch 4'); + assert(!p2.choose('switch 3')); + p2.choose('move recover, move recover'); + battle.checkActions(); assert.strictEqual(battle.turn, 2); assert.strictEqual(p1.active[0].name, 'Mew'); assert.strictEqual(p1.active[1].name, 'Ekans'); - p1.chooseSwitch(4).chooseMove(1); - assert(!p2.chooseSwitch(3)); - p2.chooseMove(1).chooseMove(1); + p1.choose('switch 4, move leer'); + assert(!p2.choose('switch 3')); + p2.choose('move recover, move recover'); + battle.checkActions(); assert.strictEqual(battle.turn, 3); assert.strictEqual(p1.active[0].name, 'Bulbasaur');