diff --git a/data/conditions.ts b/data/conditions.ts index da9c0687c8d6..5c0f040ac391 100644 --- a/data/conditions.ts +++ b/data/conditions.ts @@ -374,7 +374,8 @@ export const Conditions: import('../sim/dex-conditions').ConditionDataTable = { futuremove: { // this is a slot condition name: 'futuremove', - onStart() { + onStart(target) { + this.effectState.targetSlot = target.getSlot(); this.effectState.endingTurn = (this.turn - 1) + 2; if (this.effectState.endingTurn >= 254) { this.hint(`In Gen 8+, Future attacks will never resolve when used on the 255th turn or later.`); @@ -383,7 +384,7 @@ export const Conditions: import('../sim/dex-conditions').ConditionDataTable = { onResidualOrder: 3, onResidual(side: any) { if (this.getOverflowedTurnCount() < this.effectState.endingTurn) return; - side.removeSlotCondition(this.getAtSlot(this.effectState.sourceSlot), 'futuremove'); + side.removeSlotCondition(this.getAtSlot(this.effectState.targetSlot), 'futuremove'); }, onEnd(target) { const data = this.effectState; diff --git a/test/sim/moves/futuresight.js b/test/sim/moves/futuresight.js index 8bb530216703..163dd1f1f73c 100644 --- a/test/sim/moves/futuresight.js +++ b/test/sim/moves/futuresight.js @@ -372,4 +372,33 @@ describe('Future Sight', function () { const stak = battle.p2.active[0]; assert.fullHP(stak, `Future Sight should have never resolved.`); }); + + it(`should target particular slots in Doubles`, function () { + battle = common.createBattle({gameType: 'doubles'}, [[ + {species: 'Wynaut', moves: ['sleeptalk', 'futuresight']}, + {species: 'Steelix', moves: ['sleeptalk']}, + ], [ + {species: 'Girafarig', moves: ['sleeptalk', 'recover']}, + {species: 'Farigiraf', moves: ['sleeptalk', 'recover']}, + ]]); + + battle.makeChoices('move futuresight 2, auto', 'auto'); + battle.makeChoices(); + battle.makeChoices(); + const giraf = battle.p2.active[0]; + const farig = battle.p2.active[1]; + assert.false.fullHP(farig, `Farigiraf should have been damaged by the 1st Future Sight.`); + + battle.makeChoices('move futuresight 1, auto', 'move recover, move recover'); + battle.makeChoices(); + battle.makeChoices(); + assert.false.fullHP(giraf, `Girafarig should have been damaged by the 2nd Future Sight.`); + + battle.makeChoices('move futuresight -2, auto', 'auto'); + battle.makeChoices(); + battle.makeChoices(); + + const steelix = battle.p1.active[1]; + assert.false.fullHP(steelix, `Steelix should have been damaged by the 3rd Future Sight`); + }); });