From a4f10302e996364d1cc3463c00566ff91c2ad38c Mon Sep 17 00:00:00 2001 From: AgustinSRG Date: Sat, 26 Aug 2023 13:22:15 +0200 Subject: [PATCH] Battle: Fix interaction with Shed Tail --- src/bot-modules/battle/battle-ai/battle-data.js | 1 + src/bot-modules/battle/battle-ai/battle-majors.js | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/bot-modules/battle/battle-ai/battle-data.js b/src/bot-modules/battle/battle-ai/battle-data.js index 79f9bbf..ba8a01a 100644 --- a/src/bot-modules/battle/battle-ai/battle-data.js +++ b/src/bot-modules/battle/battle-ai/battle-data.js @@ -360,6 +360,7 @@ exports.setup = function (App) { this.boosts = Object.create(null); this.passing = false; + this.passingSubstitute = false; this.prepared = null; this.helpers = Object.create(null); diff --git a/src/bot-modules/battle/battle-ai/battle-majors.js b/src/bot-modules/battle/battle-ai/battle-majors.js index 45087c4..db0e4c3 100644 --- a/src/bot-modules/battle/battle-ai/battle-majors.js +++ b/src/bot-modules/battle/battle-ai/battle-majors.js @@ -263,6 +263,11 @@ exports.setup = function (App, BattleData) { for (let vol in active.volatiles) poke.addVolatile(vol); for (let b in active.boosts) poke.boosts[b] = active.boosts[b]; active.passing = false; + active.passingSubstitute = false; + } else if (active.passingSubstitute && active.passingSubstitute === this.turn) { + poke.addVolatile('substitute'); + active.passing = false; + active.passingSubstitute = false; } active.removeAllVolatiles(); active.removeAllBoosts(); @@ -281,6 +286,7 @@ exports.setup = function (App, BattleData) { poke.fainted = true; poke.active = false; poke.passing = false; + poke.passingSubstitute = false; poke.hp = 0; poke.tera = ''; if (!isIntro) this.message("faint", det.side, poke.name); @@ -340,6 +346,8 @@ exports.setup = function (App, BattleData) { } if (move.id === 'batonpass') { poke.passing = this.turn; + } else if (move.id === 'shedtail') { + poke.passingSubstitute = this.turn; } if (!noDeductPP && kwargs.from !== 'lockedmove') { if (args[1] !== args[3] && poke2 && poke2.ability && poke2.ability.id === "pressure") {