Skip to content

Commit

Permalink
Fix Future Sight slot targeting in doubles (#10760)
Browse files Browse the repository at this point in the history
  • Loading branch information
Karthik99999 authored Dec 17, 2024
1 parent 413b2dc commit d59e57b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
5 changes: 3 additions & 2 deletions data/conditions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`);
Expand All @@ -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;
Expand Down
29 changes: 29 additions & 0 deletions test/sim/moves/futuresight.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
});
});

0 comments on commit d59e57b

Please sign in to comment.