From 33aa56e205fd6f58dd0df2729c6f861dcc62e752 Mon Sep 17 00:00:00 2001 From: buck20two Date: Wed, 20 Feb 2019 00:13:52 -0500 Subject: [PATCH 01/26] White Herb fix for doubles --- data/items.js | 6 +++++- server/ladders.js | 4 ++-- sim/pokemon.js | 1 + test/simulator/items/whiteherb.js | 26 ++++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 test/simulator/items/whiteherb.js diff --git a/data/items.js b/data/items.js index 6d94cce75f29..73f73d447a2e 100644 --- a/data/items.js +++ b/data/items.js @@ -5978,6 +5978,10 @@ let BattleItems = { let activate = false; /**@type {{[k: string]: number}} */ let boosts = {}; + //doubles + if (pokemon.side.foe.pokemon.length > 1 && pokemon.side.foe.battle.abilityOrder !== 4) { + return; + } for (let i in pokemon.boosts) { // @ts-ignore if (pokemon.boosts[i] < 0) { @@ -5985,7 +5989,7 @@ let BattleItems = { boosts[i] = 0; } } - if (activate && pokemon.useItem()) { + if (!pokemon.duringMove && activate && pokemon.useItem()) { pokemon.setBoost(boosts); this.add('-clearnegativeboost', pokemon, '[silent]'); } diff --git a/server/ladders.js b/server/ladders.js index a438f1f7e342..6083303c8079 100644 --- a/server/ladders.js +++ b/server/ladders.js @@ -524,10 +524,10 @@ class Ladder extends LadderStore { } // users must have different IPs - if (user1.latestIp === user2.latestIp) return false; + //if (user1.latestIp === user2.latestIp) return false; // users must not have been matched immediately previously - if (user1.lastMatch === user2.userid || user2.lastMatch === user1.userid) return false; + //if (user1.lastMatch === user2.userid || user2.lastMatch === user1.userid) return false; // search must be within range let searchRange = 100; diff --git a/sim/pokemon.js b/sim/pokemon.js index eec6ec972fe5..02268c138f0c 100644 --- a/sim/pokemon.js +++ b/sim/pokemon.js @@ -1353,6 +1353,7 @@ class Pokemon { * @param {Effect} [sourceEffect] */ useItem(source, sourceEffect) { + //console.log("useItem"); if ((!this.hp && !this.getItem().isGem) || !this.isActive) return false; if (!this.item) return false; diff --git a/test/simulator/items/whiteherb.js b/test/simulator/items/whiteherb.js new file mode 100644 index 000000000000..e6a07b4382d1 --- /dev/null +++ b/test/simulator/items/whiteherb.js @@ -0,0 +1,26 @@ +'use strict'; + +const assert = require('./../../assert'); +const common = require('./../../common'); + +let battle; + +describe('White Herb', function () { + afterEach(function () { + battle.destroy(); + }); + + it('it should use white herb after both intimidate', function () { + battle = common.createBattle({gameType: 'doubles'}); + + battle.join('p1', 'Guest 1', 1, [{species: "Arcanine", ability: 'intimidate', moves: ['bodyslam']}, + {species: "Incineroar", ability: 'intimidate', moves: ['agility']}]); + battle.join('p2', 'Guest 2', 1, [{species: "aegislash", ability: 'stancechange', item: 'whiteherb', moves: ['gyroball']}, + {species: "pelipper", ability: 'sandveil', item: 'lifeorb', moves: ['airslash']}]); + + const holder = battle.p2.active[0]; + + assert.false.holdsItem(holder); + assert.statStage(holder, 'atk', 0); + }); +}); From e90329174b5292471392cbc699ac83942db9546c Mon Sep 17 00:00:00 2001 From: buck20two Date: Wed, 20 Feb 2019 00:30:04 -0500 Subject: [PATCH 02/26] White Herb fix for doubles --- server/ladders.js | 4 ++-- sim/pokemon.js | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/server/ladders.js b/server/ladders.js index 6083303c8079..a438f1f7e342 100644 --- a/server/ladders.js +++ b/server/ladders.js @@ -524,10 +524,10 @@ class Ladder extends LadderStore { } // users must have different IPs - //if (user1.latestIp === user2.latestIp) return false; + if (user1.latestIp === user2.latestIp) return false; // users must not have been matched immediately previously - //if (user1.lastMatch === user2.userid || user2.lastMatch === user1.userid) return false; + if (user1.lastMatch === user2.userid || user2.lastMatch === user1.userid) return false; // search must be within range let searchRange = 100; diff --git a/sim/pokemon.js b/sim/pokemon.js index 02268c138f0c..eec6ec972fe5 100644 --- a/sim/pokemon.js +++ b/sim/pokemon.js @@ -1353,7 +1353,6 @@ class Pokemon { * @param {Effect} [sourceEffect] */ useItem(source, sourceEffect) { - //console.log("useItem"); if ((!this.hp && !this.getItem().isGem) || !this.isActive) return false; if (!this.item) return false; From 64ed5eb184ce5b48086f6bf89785ecfcd0716e41 Mon Sep 17 00:00:00 2001 From: buck20two Date: Wed, 20 Feb 2019 01:00:23 -0500 Subject: [PATCH 03/26] White Herb fix for doubles --- server/ladders.js | 4 ++-- test/simulator/items/whiteherb.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/ladders.js b/server/ladders.js index a438f1f7e342..6083303c8079 100644 --- a/server/ladders.js +++ b/server/ladders.js @@ -524,10 +524,10 @@ class Ladder extends LadderStore { } // users must have different IPs - if (user1.latestIp === user2.latestIp) return false; + //if (user1.latestIp === user2.latestIp) return false; // users must not have been matched immediately previously - if (user1.lastMatch === user2.userid || user2.lastMatch === user1.userid) return false; + //if (user1.lastMatch === user2.userid || user2.lastMatch === user1.userid) return false; // search must be within range let searchRange = 100; diff --git a/test/simulator/items/whiteherb.js b/test/simulator/items/whiteherb.js index e6a07b4382d1..f1574e847f5e 100644 --- a/test/simulator/items/whiteherb.js +++ b/test/simulator/items/whiteherb.js @@ -10,7 +10,7 @@ describe('White Herb', function () { battle.destroy(); }); - it('it should use white herb after both intimidate', function () { + it('should use white herb after both intimidate', function () { battle = common.createBattle({gameType: 'doubles'}); battle.join('p1', 'Guest 1', 1, [{species: "Arcanine", ability: 'intimidate', moves: ['bodyslam']}, From 9afb9b1b9d40a92ff9fb7e0e18651d26b8415349 Mon Sep 17 00:00:00 2001 From: buck20two Date: Wed, 20 Feb 2019 01:00:35 -0500 Subject: [PATCH 04/26] White Herb fix for doubles --- server/ladders.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/ladders.js b/server/ladders.js index 6083303c8079..a438f1f7e342 100644 --- a/server/ladders.js +++ b/server/ladders.js @@ -524,10 +524,10 @@ class Ladder extends LadderStore { } // users must have different IPs - //if (user1.latestIp === user2.latestIp) return false; + if (user1.latestIp === user2.latestIp) return false; // users must not have been matched immediately previously - //if (user1.lastMatch === user2.userid || user2.lastMatch === user1.userid) return false; + if (user1.lastMatch === user2.userid || user2.lastMatch === user1.userid) return false; // search must be within range let searchRange = 100; From 6a011e8694648c28edcca8d0b89b6b7b724fc30b Mon Sep 17 00:00:00 2001 From: buck20two Date: Sun, 24 Feb 2019 23:32:50 -0500 Subject: [PATCH 05/26] white herb fix for doubles --- data/items.js | 11 ++++++----- test/simulator/items/whiteherb.js | 27 ++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/data/items.js b/data/items.js index 73f73d447a2e..35f481cbf8ba 100644 --- a/data/items.js +++ b/data/items.js @@ -5975,13 +5975,14 @@ let BattleItems = { }, }, onUpdate: function (pokemon) { + //run after switchin + if ((this.gameType === "doubles") && !(this.queue.length === 0)) { + return; + } let activate = false; /**@type {{[k: string]: number}} */ let boosts = {}; - //doubles - if (pokemon.side.foe.pokemon.length > 1 && pokemon.side.foe.battle.abilityOrder !== 4) { - return; - } + /**@type {{[k: string]: number}} */ for (let i in pokemon.boosts) { // @ts-ignore if (pokemon.boosts[i] < 0) { @@ -5989,7 +5990,7 @@ let BattleItems = { boosts[i] = 0; } } - if (!pokemon.duringMove && activate && pokemon.useItem()) { + if (activate && pokemon.useItem()) { pokemon.setBoost(boosts); this.add('-clearnegativeboost', pokemon, '[silent]'); } diff --git a/test/simulator/items/whiteherb.js b/test/simulator/items/whiteherb.js index f1574e847f5e..4993d5cdc2e8 100644 --- a/test/simulator/items/whiteherb.js +++ b/test/simulator/items/whiteherb.js @@ -9,7 +9,6 @@ describe('White Herb', function () { afterEach(function () { battle.destroy(); }); - it('should use white herb after both intimidate', function () { battle = common.createBattle({gameType: 'doubles'}); @@ -18,6 +17,32 @@ describe('White Herb', function () { battle.join('p2', 'Guest 2', 1, [{species: "aegislash", ability: 'stancechange', item: 'whiteherb', moves: ['gyroball']}, {species: "pelipper", ability: 'sandveil', item: 'lifeorb', moves: ['airslash']}]); + + battle.makeChoices('move bodyslam, move agility', 'move gyroball, move airslash'); + + const holder = battle.p2.active[0]; + + assert.false.holdsItem(holder); + assert.statStage(holder, 'atk', 0); + }); + it('should use white herb after intimidate switch in', function () { + battle = common.createBattle({gameType: 'doubles'}); + + battle.join('p1', 'Guest 1', 1, [ + {species: "Aerodactyl", ability: 'shellarmor', item: 'ironball', moves: ['stealthrock']}, + {species: "Rotom", ability: 'levitate', item: 'ironball', moves: ['rest']}, + {species: "Arcanine", ability: 'intimidate', moves: ['bodyslam']}, + {species: "Incineroar", ability: 'intimidate', moves: ['agility']}]); + battle.join('p2', 'Guest 2', 2, [ + {species: "aegislash", ability: 'stancechange', item: 'whiteherb', moves: ['autotomize']}, + {species: "pelipper", ability: 'sandveil', item: 'lifeorb', moves: ['airslash']}, + {species: "Thundurus", ability: 'prankster', item: 'ironball', moves: ['electricterrain']}, + {species: 'Klefki', ability: 'prankster', moves: ['confuseray']}]); + + battle.makeChoices('move stealthrock, move rest', 'move gyroball, move airslash'); + + battle.makeChoices('switch Arcanine, switch Incineroar', 'move gyroball, move airslash'); + const holder = battle.p2.active[0]; assert.false.holdsItem(holder); From 0326489862e1cd088621638b01630ba9309d4456 Mon Sep 17 00:00:00 2001 From: buck20two Date: Sun, 24 Feb 2019 23:45:43 -0500 Subject: [PATCH 06/26] white herb fix for doubles --- test/simulator/items/whiteherb.js | 44 ++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/test/simulator/items/whiteherb.js b/test/simulator/items/whiteherb.js index 4993d5cdc2e8..ef62109ba9f1 100644 --- a/test/simulator/items/whiteherb.js +++ b/test/simulator/items/whiteherb.js @@ -25,7 +25,25 @@ describe('White Herb', function () { assert.false.holdsItem(holder); assert.statStage(holder, 'atk', 0); }); - it('should use white herb after intimidate switch in', function () { + + it('should use white herb after one intimidate', function () { + battle = common.createBattle({gameType: 'doubles'}); + + battle.join('p1', 'Guest 1', 1, [{species: "Arcanine", ability: 'flashfire', moves: ['bodyslam']}, + {species: "Incineroar", ability: 'intimidate', moves: ['agility']}]); + battle.join('p2', 'Guest 2', 1, [{species: "aegislash", ability: 'stancechange', item: 'whiteherb', moves: ['gyroball']}, + {species: "pelipper", ability: 'sandveil', item: 'lifeorb', moves: ['airslash']}]); + + + battle.makeChoices('move bodyslam, move agility', 'move gyroball, move airslash'); + + const holder = battle.p2.active[0]; + + assert.false.holdsItem(holder); + assert.statStage(holder, 'atk', 0); + }); + + it('should use white herb after two intimidate switch in', function () { battle = common.createBattle({gameType: 'doubles'}); battle.join('p1', 'Guest 1', 1, [ @@ -48,4 +66,28 @@ describe('White Herb', function () { assert.false.holdsItem(holder); assert.statStage(holder, 'atk', 0); }); + + it('should use white herb after one intimidate switch in', function () { + battle = common.createBattle({gameType: 'doubles'}); + + battle.join('p1', 'Guest 1', 1, [ + {species: "Aerodactyl", ability: 'shellarmor', item: 'ironball', moves: ['stealthrock']}, + {species: "Rotom", ability: 'levitate', item: 'ironball', moves: ['rest']}, + {species: "Arcanine", ability: 'intimidate', moves: ['bodyslam']}, + {species: "Incineroar", ability: 'intimidate', moves: ['agility']}]); + battle.join('p2', 'Guest 2', 2, [ + {species: "aegislash", ability: 'stancechange', item: 'whiteherb', moves: ['autotomize']}, + {species: "pelipper", ability: 'sandveil', item: 'lifeorb', moves: ['airslash']}, + {species: "Thundurus", ability: 'prankster', item: 'ironball', moves: ['electricterrain']}, + {species: 'Klefki', ability: 'prankster', moves: ['confuseray']}]); + + battle.makeChoices('move stealthrock, move rest', 'move gyroball, move airslash'); + + battle.makeChoices('switch Arcanine, move rest', 'move gyroball, move airslash'); + + const holder = battle.p2.active[0]; + + assert.false.holdsItem(holder); + assert.statStage(holder, 'atk', 0); + }); }); From 78907058d1d2c32021741085070cb62ecd11a8d4 Mon Sep 17 00:00:00 2001 From: buck20two Date: Sun, 3 Mar 2019 20:01:37 -0500 Subject: [PATCH 07/26] white herb fix --- data/items.js | 30 ++++++++++++++++++++++++++++-- test/simulator/items/whiteherb.js | 29 +++++++++++++++++++++++++---- 2 files changed, 53 insertions(+), 6 deletions(-) diff --git a/data/items.js b/data/items.js index 3b3ac8fe4e16..6d8fe90a6d60 100644 --- a/data/items.js +++ b/data/items.js @@ -6008,9 +6008,35 @@ let BattleItems = { } }, }, + onResidual(pokemon) { + if (!(this.gameType === "doubles")) { + return; + } + let activate = false; + /**@type {{[k: string]: number}} */ + let boosts = {}; + /**@type {{[k: string]: number}} */ + for (let i in pokemon.boosts) { + // @ts-ignore + if (pokemon.boosts[i] < 0) { + activate = true; + boosts[i] = 0; + } + } + if (activate && pokemon.useItem()) { + pokemon.setBoost(boosts); + this.add('-clearnegativeboost', pokemon, '[silent]'); + } + }, onUpdate(pokemon) { - //run after switchin - if ((this.gameType === "doubles") && !(this.queue.length === 0)) { + let lastMoveAttackDown = false; + if (this.lastMove && + (this.lastMove.id === 'memento' || + this.lastMove.id === 'growl' || + this.lastMove.id === 'partingshot')) { + lastMoveAttackDown = true; + } + if ((this.gameType === "doubles") && !lastMoveAttackDown) { return; } let activate = false; diff --git a/test/simulator/items/whiteherb.js b/test/simulator/items/whiteherb.js index ef62109ba9f1..a26549f81c04 100644 --- a/test/simulator/items/whiteherb.js +++ b/test/simulator/items/whiteherb.js @@ -5,11 +5,32 @@ const common = require('./../../common'); let battle; -describe('White Herb', function () { +describe('White Herb 5678765567', function () { afterEach(function () { battle.destroy(); }); + it('should use white herb during active turn', function () { + battle = common.createBattle({gameType: 'doubles'}); + + battle.join('p1', 'Guest 1', 1, [ + {species: "chansey", ability: 'shellarmor', item: 'ironball', moves: ['memento']}, + {species: "clefable", ability: 'levitate', item: 'ironball', moves: ['memento']}, + {species: "aerodactyl", ability: 'shellarmor', item: 'ironball', moves: ['stealthrock']}, + {species: "rotom", ability: 'levitate', item: 'ironball', moves: ['rest']}]); + battle.join('p2', 'Guest 2', 2, [ + {species: "aegislash", ability: 'stancechange', item: 'whiteherb', moves: ['autotomize']}, + {species: "pelipper", ability: 'sandveil', item: 'lifeorb', moves: ['protect']}]); + + battle.makeChoices('move memento 0, move memento 0', 'move autotomize, move protect'); + battle.makeChoices('switch aerodactyl, switch rotom', 'move autotomize, move protect'); + + const holder = battle.p2.active[0]; + + assert.false.holdsItem(holder); + assert.statStage(holder, 'atk', -2); + }); it('should use white herb after both intimidate', function () { + let battle; battle = common.createBattle({gameType: 'doubles'}); battle.join('p1', 'Guest 1', 1, [{species: "Arcanine", ability: 'intimidate', moves: ['bodyslam']}, @@ -25,8 +46,8 @@ describe('White Herb', function () { assert.false.holdsItem(holder); assert.statStage(holder, 'atk', 0); }); - it('should use white herb after one intimidate', function () { + let battle; battle = common.createBattle({gameType: 'doubles'}); battle.join('p1', 'Guest 1', 1, [{species: "Arcanine", ability: 'flashfire', moves: ['bodyslam']}, @@ -42,8 +63,8 @@ describe('White Herb', function () { assert.false.holdsItem(holder); assert.statStage(holder, 'atk', 0); }); - it('should use white herb after two intimidate switch in', function () { + let battle; battle = common.createBattle({gameType: 'doubles'}); battle.join('p1', 'Guest 1', 1, [ @@ -66,8 +87,8 @@ describe('White Herb', function () { assert.false.holdsItem(holder); assert.statStage(holder, 'atk', 0); }); - it('should use white herb after one intimidate switch in', function () { + let battle; battle = common.createBattle({gameType: 'doubles'}); battle.join('p1', 'Guest 1', 1, [ From d005949c509cc52587aadce5fd3dd23b42a11fcf Mon Sep 17 00:00:00 2001 From: buck20two Date: Sun, 3 Mar 2019 20:19:13 -0500 Subject: [PATCH 08/26] white herb fix --- test/simulator/items/whiteherb.js | 40 +++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/test/simulator/items/whiteherb.js b/test/simulator/items/whiteherb.js index a26549f81c04..5f0e634a261c 100644 --- a/test/simulator/items/whiteherb.js +++ b/test/simulator/items/whiteherb.js @@ -9,7 +9,7 @@ describe('White Herb 5678765567', function () { afterEach(function () { battle.destroy(); }); - it('should use white herb during active turn', function () { + it('should use white herb after memento during active turn', function () { battle = common.createBattle({gameType: 'doubles'}); battle.join('p1', 'Guest 1', 1, [ @@ -25,10 +25,46 @@ describe('White Herb 5678765567', function () { battle.makeChoices('switch aerodactyl, switch rotom', 'move autotomize, move protect'); const holder = battle.p2.active[0]; - assert.false.holdsItem(holder); assert.statStage(holder, 'atk', -2); }); + it('should use white herb after growl during active turn', function () { + battle = common.createBattle({gameType: 'doubles'}); + + battle.join('p1', 'Guest 1', 1, [ + {species: "chansey", ability: 'shellarmor', item: 'ironball', moves: ['growl']}, + {species: "clefable", ability: 'levitate', item: 'ironball', moves: ['growl']}, + {species: "aerodactyl", ability: 'shellarmor', item: 'ironball', moves: ['stealthrock']}, + {species: "rotom", ability: 'levitate', item: 'ironball', moves: ['rest']}]); + battle.join('p2', 'Guest 2', 2, [ + {species: "aegislash", ability: 'stancechange', item: 'whiteherb', moves: ['autotomize']}, + {species: "pelipper", ability: 'sandveil', item: 'lifeorb', moves: ['protect']}]); + + battle.makeChoices('move growl 0, move growl 0', 'move autotomize, move protect'); + + const holder = battle.p2.active[0]; + assert.false.holdsItem(holder); + assert.statStage(holder, 'atk', -1); + }); + it('should use white herb after partingshot during active turn', function () { + battle = common.createBattle({gameType: 'doubles'}); + + battle.join('p1', 'Guest 1', 1, [ + {species: "chansey", ability: 'shellarmor', item: 'ironball', moves: ['partingshot']}, + {species: "clefable", ability: 'levitate', item: 'ironball', moves: ['partingshot']}, + {species: "aerodactyl", ability: 'shellarmor', item: 'ironball', moves: ['stealthrock']}, + {species: "rotom", ability: 'levitate', item: 'ironball', moves: ['rest']}]); + battle.join('p2', 'Guest 2', 2, [ + {species: "aegislash", ability: 'stancechange', item: 'whiteherb', moves: ['autotomize']}, + {species: "pelipper", ability: 'sandveil', item: 'lifeorb', moves: ['protect']}]); + + battle.makeChoices('move partingshot 0, move partingshot 0', 'move autotomize, move protect'); + battle.makeChoices('switch aerodactyl, switch rotom', 'move autotomize, move protect'); + + const holder = battle.p2.active[0]; + assert.false.holdsItem(holder); + assert.statStage(holder, 'atk', -1); + }); it('should use white herb after both intimidate', function () { let battle; battle = common.createBattle({gameType: 'doubles'}); From b086cf5a9ebb4c08ff641e9e397a7c2694bd02b2 Mon Sep 17 00:00:00 2001 From: e088764 Date: Mon, 4 Mar 2019 10:28:00 -0500 Subject: [PATCH 09/26] whiteherb fixtest/simulator/items/whiteherb.js --- data/items.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/data/items.js b/data/items.js index 6d8fe90a6d60..6914cede1c38 100644 --- a/data/items.js +++ b/data/items.js @@ -6030,11 +6030,14 @@ let BattleItems = { }, onUpdate(pokemon) { let lastMoveAttackDown = false; - if (this.lastMove && - (this.lastMove.id === 'memento' || - this.lastMove.id === 'growl' || - this.lastMove.id === 'partingshot')) { - lastMoveAttackDown = true; + if (this.lastMove && this.lastMove.boosts) { + for (let i in this.lastMove.boosts) { + // @ts-ignore + if (this.lastMove.boosts[i] < 0) { + lastMoveAttackDown = true; + break; + } + } } if ((this.gameType === "doubles") && !lastMoveAttackDown) { return; From edcabe06f64edd2837c6ff8288d878da9adac600 Mon Sep 17 00:00:00 2001 From: e088764 Date: Mon, 4 Mar 2019 10:28:07 -0500 Subject: [PATCH 10/26] whiteherb fix --- test/simulator/items/whiteherb.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/simulator/items/whiteherb.js b/test/simulator/items/whiteherb.js index 5f0e634a261c..72370249d48e 100644 --- a/test/simulator/items/whiteherb.js +++ b/test/simulator/items/whiteherb.js @@ -5,7 +5,7 @@ const common = require('./../../common'); let battle; -describe('White Herb 5678765567', function () { +describe('White Herb', function () { afterEach(function () { battle.destroy(); }); From 29837aa10a04e3b3a0089661da6456142f9b7f39 Mon Sep 17 00:00:00 2001 From: e088764 Date: Mon, 4 Mar 2019 11:12:50 -0500 Subject: [PATCH 11/26] whiteherb fix --- data/items.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data/items.js b/data/items.js index 6914cede1c38..af7cc33b990e 100644 --- a/data/items.js +++ b/data/items.js @@ -6029,17 +6029,17 @@ let BattleItems = { } }, onUpdate(pokemon) { - let lastMoveAttackDown = false; + let lastMoveBoostDown = false; if (this.lastMove && this.lastMove.boosts) { for (let i in this.lastMove.boosts) { // @ts-ignore if (this.lastMove.boosts[i] < 0) { - lastMoveAttackDown = true; + lastMoveBoostDown = true; break; } } } - if ((this.gameType === "doubles") && !lastMoveAttackDown) { + if ((this.gameType === "doubles") && !lastMoveBoostDown) { return; } let activate = false; From f4e9bb2a6d67d4c7059e4b778229397d432a4d9e Mon Sep 17 00:00:00 2001 From: e088764 Date: Wed, 6 Mar 2019 17:07:54 -0500 Subject: [PATCH 12/26] white herb fix --- data/items.js | 34 ++++--------------------------- test/simulator/items/whiteherb.js | 32 ++++++++++++++++++++++++----- 2 files changed, 31 insertions(+), 35 deletions(-) diff --git a/data/items.js b/data/items.js index af7cc33b990e..5df2a37cec1d 100644 --- a/data/items.js +++ b/data/items.js @@ -6008,40 +6008,14 @@ let BattleItems = { } }, }, - onResidual(pokemon) { - if (!(this.gameType === "doubles")) { - return; - } - let activate = false; - /**@type {{[k: string]: number}} */ - let boosts = {}; - /**@type {{[k: string]: number}} */ - for (let i in pokemon.boosts) { - // @ts-ignore - if (pokemon.boosts[i] < 0) { - activate = true; - boosts[i] = 0; - } - } - if (activate && pokemon.useItem()) { - pokemon.setBoost(boosts); - this.add('-clearnegativeboost', pokemon, '[silent]'); - } - }, onUpdate(pokemon) { - let lastMoveBoostDown = false; - if (this.lastMove && this.lastMove.boosts) { - for (let i in this.lastMove.boosts) { - // @ts-ignore - if (this.lastMove.boosts[i] < 0) { - lastMoveBoostDown = true; - break; + if ((this.gameType === "doubles")) { + for (const action of this.queue) { + if (action.choice === 'runSwitch') { + return; } } } - if ((this.gameType === "doubles") && !lastMoveBoostDown) { - return; - } let activate = false; /**@type {{[k: string]: number}} */ let boosts = {}; diff --git a/test/simulator/items/whiteherb.js b/test/simulator/items/whiteherb.js index 72370249d48e..5fa61755c147 100644 --- a/test/simulator/items/whiteherb.js +++ b/test/simulator/items/whiteherb.js @@ -66,7 +66,6 @@ describe('White Herb', function () { assert.statStage(holder, 'atk', -1); }); it('should use white herb after both intimidate', function () { - let battle; battle = common.createBattle({gameType: 'doubles'}); battle.join('p1', 'Guest 1', 1, [{species: "Arcanine", ability: 'intimidate', moves: ['bodyslam']}, @@ -83,7 +82,6 @@ describe('White Herb', function () { assert.statStage(holder, 'atk', 0); }); it('should use white herb after one intimidate', function () { - let battle; battle = common.createBattle({gameType: 'doubles'}); battle.join('p1', 'Guest 1', 1, [{species: "Arcanine", ability: 'flashfire', moves: ['bodyslam']}, @@ -100,7 +98,6 @@ describe('White Herb', function () { assert.statStage(holder, 'atk', 0); }); it('should use white herb after two intimidate switch in', function () { - let battle; battle = common.createBattle({gameType: 'doubles'}); battle.join('p1', 'Guest 1', 1, [ @@ -121,10 +118,35 @@ describe('White Herb', function () { const holder = battle.p2.active[0]; assert.false.holdsItem(holder); - assert.statStage(holder, 'atk', 0); + assert.statStage(holder, 'atk', -1); + }); + it('should use white herb after two intimidate switch in after faint 5678765567', function () { + battle = common.createBattle({gameType: 'doubles'}); + + battle.join('p1', 'Guest 1', 1, [ + {species: "aegislash", ability: 'stancechange', item: 'ironball', moves: ['storedpower']}, + {species: "aegislash", ability: 'stancechange', item: 'ironball', moves: ['storedpower']}, + {species: "Arcanine", ability: 'intimidate', moves: ['bodyslam']}, + {species: "Incineroar", ability: 'intimidate', moves: ['agility']}]); + battle.join('p2', 'Guest 2', 2, [ + {species: "Rotom", ability: 'levitate', item: 'whiteherb', moves: ['overheat']}, + {species: "Rotom", ability: 'levitate', item: 'whiteherb', moves: ['overheat']}, + {species: "Thundurus", ability: 'prankster', item: 'ironball', moves: ['electricterrain']}, + {species: 'Klefki', ability: 'prankster', moves: ['confuseray']}]); + + battle.makeChoices('move stringshot, move stringshot', 'move overheat, move overheat'); + + battle.makeChoices('switch Arcanine, switch Incineroar', 'move overheat, move overheat'); + battle.makeChoices('move stringshot, move stringshot', 'move overheat, move overheat'); + + const holder = battle.p2.active[0]; + + console.log(battle.log); + + assert.false.holdsItem(holder); + assert.statStage(holder, 'atk', -2); }); it('should use white herb after one intimidate switch in', function () { - let battle; battle = common.createBattle({gameType: 'doubles'}); battle.join('p1', 'Guest 1', 1, [ From a5d8ad99232d23d7cf7bb4a3d4d3c5f78239bb67 Mon Sep 17 00:00:00 2001 From: e088764 Date: Thu, 7 Mar 2019 17:39:07 -0500 Subject: [PATCH 13/26] white herb --- data/items.js | 2 +- test/mocha.opts | 3 ++- test/simulator/items/whiteherb.js | 30 ++++++++++++++++++++++++++++-- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/data/items.js b/data/items.js index 5df2a37cec1d..ece5abf1392d 100644 --- a/data/items.js +++ b/data/items.js @@ -6011,7 +6011,7 @@ let BattleItems = { onUpdate(pokemon) { if ((this.gameType === "doubles")) { for (const action of this.queue) { - if (action.choice === 'runSwitch') { + if (action.choice === 'runSwitch' || action.choice === 'switch') { return; } } diff --git a/test/mocha.opts b/test/mocha.opts index 5a2c19eb7177..aa2a41053a1b 100644 --- a/test/mocha.opts +++ b/test/mocha.opts @@ -1,4 +1,5 @@ -test/main.js test/simulator/**/*.js test/application/*.js test/chat-plugins/*.js +test/simulator/items/whiteherb.js +-g 5678765567 -R dot -u bdd --exit diff --git a/test/simulator/items/whiteherb.js b/test/simulator/items/whiteherb.js index 5fa61755c147..65aaea9076a3 100644 --- a/test/simulator/items/whiteherb.js +++ b/test/simulator/items/whiteherb.js @@ -120,7 +120,7 @@ describe('White Herb', function () { assert.false.holdsItem(holder); assert.statStage(holder, 'atk', -1); }); - it('should use white herb after two intimidate switch in after faint 5678765567', function () { + it('should use white herb after two intimidate switch in after faint', function () { battle = common.createBattle({gameType: 'doubles'}); battle.join('p1', 'Guest 1', 1, [ @@ -144,7 +144,33 @@ describe('White Herb', function () { console.log(battle.log); assert.false.holdsItem(holder); - assert.statStage(holder, 'atk', -2); + assert.statStage(holder, 'atk', -1); + }); + it('should use white herb after all pokemon switch in after faint 5678765567', function () { + battle = common.createBattle({gameType: 'doubles'}); + + battle.join('p1', 'Guest 1', 1, [ + {species: "oddish", ability: 'stancechange', item: 'ironball', moves: ['storedpower']}, + {species: "oddish", ability: 'stancechange', item: 'ironball', moves: ['storedpower']}, + {species: "Arcanine", ability: 'intimidate', moves: ['bodyslam']}, + {species: "Incineroar", ability: 'intimidate', moves: ['agility']}]); + battle.join('p2', 'Guest 2', 2, [ + {species: "Rotom", ability: 'levitate', item: 'firiumz', moves: ['searingshot']}, + {species: "Rotom", ability: 'levitate', item: 'firiumz', moves: ['searingshot']}, + {species: "Thundurus", ability: 'prankster', item: 'whiteherb', moves: ['electricterrain']}, + {species: 'Klefki', ability: 'prankster', moves: ['confuseray']}]); + + battle.makeChoices('move storedpower, move storedpower', 'move infernooverdrive, move infernooverdrive'); + + battle.makeChoices('switch Arcanine, switch Incineroar', 'switch Thundurus, switch Klefki'); + battle.makeChoices('move stringshot, move stringshot', 'move overheat, move overheat'); + + const holder = battle.p2.active[0]; + + console.log(battle.log); + + assert.false.holdsItem(holder); + assert.statStage(holder, 'atk', -1); }); it('should use white herb after one intimidate switch in', function () { battle = common.createBattle({gameType: 'doubles'}); From 0f26d0c9878409f9005e269f726edf70b91ec4c2 Mon Sep 17 00:00:00 2001 From: e088764 Date: Fri, 8 Mar 2019 16:32:52 -0500 Subject: [PATCH 14/26] white herb fix --- .vscode/launch.json | 4 ++-- data/items.js | 2 +- test/simulator/items/whiteherb.js | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index ade2b11e17ce..fb90b0394048 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,9 +6,9 @@ "configurations": [ { "type": "node", - "request": "launch", + "request": "attach", "name": "Start Server", - "program": "${workspaceFolder}\\app.js" + "port": 9229 }, { "type": "node", diff --git a/data/items.js b/data/items.js index ece5abf1392d..5df2a37cec1d 100644 --- a/data/items.js +++ b/data/items.js @@ -6011,7 +6011,7 @@ let BattleItems = { onUpdate(pokemon) { if ((this.gameType === "doubles")) { for (const action of this.queue) { - if (action.choice === 'runSwitch' || action.choice === 'switch') { + if (action.choice === 'runSwitch') { return; } } diff --git a/test/simulator/items/whiteherb.js b/test/simulator/items/whiteherb.js index 65aaea9076a3..a443429a6818 100644 --- a/test/simulator/items/whiteherb.js +++ b/test/simulator/items/whiteherb.js @@ -5,7 +5,7 @@ const common = require('./../../common'); let battle; -describe('White Herb', function () { +describe('White Herb 5678765567', function () { afterEach(function () { battle.destroy(); }); @@ -146,7 +146,7 @@ describe('White Herb', function () { assert.false.holdsItem(holder); assert.statStage(holder, 'atk', -1); }); - it('should use white herb after all pokemon switch in after faint 5678765567', function () { + it('should use white herb after all pokemon switch in after faint', function () { battle = common.createBattle({gameType: 'doubles'}); battle.join('p1', 'Guest 1', 1, [ @@ -155,22 +155,22 @@ describe('White Herb', function () { {species: "Arcanine", ability: 'intimidate', moves: ['bodyslam']}, {species: "Incineroar", ability: 'intimidate', moves: ['agility']}]); battle.join('p2', 'Guest 2', 2, [ - {species: "Rotom", ability: 'levitate', item: 'firiumz', moves: ['searingshot']}, - {species: "Rotom", ability: 'levitate', item: 'firiumz', moves: ['searingshot']}, + {species: "Rotom", ability: 'levitate', item: 'whiteherb', moves: ['searingshot']}, + {species: "Rotom", ability: 'levitate', item: 'whiteherb', moves: ['searingshot']}, {species: "Thundurus", ability: 'prankster', item: 'whiteherb', moves: ['electricterrain']}, {species: 'Klefki', ability: 'prankster', moves: ['confuseray']}]); - battle.makeChoices('move storedpower, move storedpower', 'move infernooverdrive, move infernooverdrive'); + battle.makeChoices('move storedpower, move storedpower', 'move searingshot, move searingshot'); battle.makeChoices('switch Arcanine, switch Incineroar', 'switch Thundurus, switch Klefki'); battle.makeChoices('move stringshot, move stringshot', 'move overheat, move overheat'); const holder = battle.p2.active[0]; - - console.log(battle.log); + const util = require('util'); + console.log(util.inspect(battle.log, {maxArrayLength: null})); assert.false.holdsItem(holder); - assert.statStage(holder, 'atk', -1); + assert.statStage(holder, 'atk', 0); }); it('should use white herb after one intimidate switch in', function () { battle = common.createBattle({gameType: 'doubles'}); From d8ff96242128a99dc82163d2f1d976725f6d6744 Mon Sep 17 00:00:00 2001 From: e088764 Date: Fri, 8 Mar 2019 16:37:31 -0500 Subject: [PATCH 15/26] white herb fix --- .vscode/launch.json | 31 ------------------------------- test/mocha.opts | 3 +-- 2 files changed, 1 insertion(+), 33 deletions(-) delete mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index fb90b0394048..000000000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "node", - "request": "attach", - "name": "Start Server", - "port": 9229 - }, - { - "type": "node", - "request": "launch", - "name": "Run Mocha Tests", - "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", - "args": [ - "-u", - "tdd", - "--timeout", - "999999", - "--colors", - "-f", - // Make this string non-empty to run only tests whose names match it - "" - ], - "internalConsoleOptions": "openOnSessionStart" - }, - ] -} diff --git a/test/mocha.opts b/test/mocha.opts index aa2a41053a1b..5a2c19eb7177 100644 --- a/test/mocha.opts +++ b/test/mocha.opts @@ -1,5 +1,4 @@ -test/simulator/items/whiteherb.js --g 5678765567 +test/main.js test/simulator/**/*.js test/application/*.js test/chat-plugins/*.js -R dot -u bdd --exit From 5255e5c8296b401bc841ecbdfd3c5ea3999491ac Mon Sep 17 00:00:00 2001 From: e088764 Date: Fri, 8 Mar 2019 16:38:11 -0500 Subject: [PATCH 16/26] white herb fix --- .vscode/launch.json | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000000..ade2b11e17ce --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,31 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Start Server", + "program": "${workspaceFolder}\\app.js" + }, + { + "type": "node", + "request": "launch", + "name": "Run Mocha Tests", + "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", + "args": [ + "-u", + "tdd", + "--timeout", + "999999", + "--colors", + "-f", + // Make this string non-empty to run only tests whose names match it + "" + ], + "internalConsoleOptions": "openOnSessionStart" + }, + ] +} From ccad5b6fbf490b91293961423e871e73bbeaca52 Mon Sep 17 00:00:00 2001 From: e088764 Date: Fri, 8 Mar 2019 16:39:08 -0500 Subject: [PATCH 17/26] white herb fix --- test/simulator/items/whiteherb.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/simulator/items/whiteherb.js b/test/simulator/items/whiteherb.js index a443429a6818..5f8eb465b375 100644 --- a/test/simulator/items/whiteherb.js +++ b/test/simulator/items/whiteherb.js @@ -5,7 +5,7 @@ const common = require('./../../common'); let battle; -describe('White Herb 5678765567', function () { +describe('White Herb', function () { afterEach(function () { battle.destroy(); }); From 5fd9855e32b054780b7b30e1bf54776b827d7e01 Mon Sep 17 00:00:00 2001 From: e088764 Date: Fri, 8 Mar 2019 17:15:13 -0500 Subject: [PATCH 18/26] white herb fix --- test/simulator/items/whiteherb.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/simulator/items/whiteherb.js b/test/simulator/items/whiteherb.js index 5f8eb465b375..8d5a13eaa7a1 100644 --- a/test/simulator/items/whiteherb.js +++ b/test/simulator/items/whiteherb.js @@ -141,8 +141,6 @@ describe('White Herb', function () { const holder = battle.p2.active[0]; - console.log(battle.log); - assert.false.holdsItem(holder); assert.statStage(holder, 'atk', -1); }); From 0c50303af03124c853945ae7365bce97942d0d85 Mon Sep 17 00:00:00 2001 From: e088764 Date: Fri, 8 Mar 2019 17:15:48 -0500 Subject: [PATCH 19/26] white herb fix --- test/simulator/items/whiteherb.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/simulator/items/whiteherb.js b/test/simulator/items/whiteherb.js index 8d5a13eaa7a1..3eceb0c4f33a 100644 --- a/test/simulator/items/whiteherb.js +++ b/test/simulator/items/whiteherb.js @@ -165,7 +165,6 @@ describe('White Herb', function () { const holder = battle.p2.active[0]; const util = require('util'); - console.log(util.inspect(battle.log, {maxArrayLength: null})); assert.false.holdsItem(holder); assert.statStage(holder, 'atk', 0); From 3f305e4d43dcc04eaa8d831b2caceb2a8215eb3a Mon Sep 17 00:00:00 2001 From: e088764 Date: Fri, 8 Mar 2019 17:16:07 -0500 Subject: [PATCH 20/26] white herb fix --- test/simulator/items/whiteherb.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/simulator/items/whiteherb.js b/test/simulator/items/whiteherb.js index 3eceb0c4f33a..9d525b710603 100644 --- a/test/simulator/items/whiteherb.js +++ b/test/simulator/items/whiteherb.js @@ -164,7 +164,6 @@ describe('White Herb', function () { battle.makeChoices('move stringshot, move stringshot', 'move overheat, move overheat'); const holder = battle.p2.active[0]; - const util = require('util'); assert.false.holdsItem(holder); assert.statStage(holder, 'atk', 0); From 976dbd9858bf8a3d15c82b829a59fdae2b3dfc98 Mon Sep 17 00:00:00 2001 From: buck20two Date: Sat, 9 Mar 2019 15:12:00 -0500 Subject: [PATCH 21/26] spelling --- test/simulator/items/whiteherb.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/simulator/items/whiteherb.js b/test/simulator/items/whiteherb.js index 9d525b710603..1284938c274b 100644 --- a/test/simulator/items/whiteherb.js +++ b/test/simulator/items/whiteherb.js @@ -65,7 +65,7 @@ describe('White Herb', function () { assert.false.holdsItem(holder); assert.statStage(holder, 'atk', -1); }); - it('should use white herb after both intimidate', function () { + it('should use white herb after both Intimidate', function () { battle = common.createBattle({gameType: 'doubles'}); battle.join('p1', 'Guest 1', 1, [{species: "Arcanine", ability: 'intimidate', moves: ['bodyslam']}, @@ -81,7 +81,7 @@ describe('White Herb', function () { assert.false.holdsItem(holder); assert.statStage(holder, 'atk', 0); }); - it('should use white herb after one intimidate', function () { + it('should use white herb after one Intimidate', function () { battle = common.createBattle({gameType: 'doubles'}); battle.join('p1', 'Guest 1', 1, [{species: "Arcanine", ability: 'flashfire', moves: ['bodyslam']}, @@ -97,7 +97,7 @@ describe('White Herb', function () { assert.false.holdsItem(holder); assert.statStage(holder, 'atk', 0); }); - it('should use white herb after two intimidate switch in', function () { + it('should use white herb after two Intimidate switch in', function () { battle = common.createBattle({gameType: 'doubles'}); battle.join('p1', 'Guest 1', 1, [ @@ -120,7 +120,7 @@ describe('White Herb', function () { assert.false.holdsItem(holder); assert.statStage(holder, 'atk', -1); }); - it('should use white herb after two intimidate switch in after faint', function () { + it('should use white herb after two Intimidate switch in after faint', function () { battle = common.createBattle({gameType: 'doubles'}); battle.join('p1', 'Guest 1', 1, [ @@ -168,7 +168,7 @@ describe('White Herb', function () { assert.false.holdsItem(holder); assert.statStage(holder, 'atk', 0); }); - it('should use white herb after one intimidate switch in', function () { + it('should use white herb after one Intimidate switch in', function () { battle = common.createBattle({gameType: 'doubles'}); battle.join('p1', 'Guest 1', 1, [ From 488ca68b4a9d603de79796a72df3e7e383feae1f Mon Sep 17 00:00:00 2001 From: e088764 Date: Mon, 11 Mar 2019 16:10:28 -0400 Subject: [PATCH 22/26] add singles test remove doubles check --- test/simulator/items/whiteherb.js | 68 ++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/test/simulator/items/whiteherb.js b/test/simulator/items/whiteherb.js index 9d525b710603..94268b684a7d 100644 --- a/test/simulator/items/whiteherb.js +++ b/test/simulator/items/whiteherb.js @@ -120,7 +120,7 @@ describe('White Herb', function () { assert.false.holdsItem(holder); assert.statStage(holder, 'atk', -1); }); - it('should use white herb after two intimidate switch in after faint', function () { + it('should use white herb after two intimidate switch in', function () { battle = common.createBattle({gameType: 'doubles'}); battle.join('p1', 'Guest 1', 1, [ @@ -191,4 +191,70 @@ describe('White Herb', function () { assert.false.holdsItem(holder); assert.statStage(holder, 'atk', 0); }); + + it('should use white herb after one intimidate switch in [singles]', function () { + battle = common.createBattle(); + + battle.join('p1', 'Guest 1', 1, [ + {species: "Rotom", ability: 'levitate', item: 'ironball', moves: ['rest']}, + {species: "Arcanine", ability: 'intimidate', moves: ['bodyslam']}, + {species: "Incineroar", ability: 'intimidate', moves: ['agility']}]); + battle.join('p2', 'Guest 2', 2, [ + {species: "aegislash", ability: 'stancechange', item: 'whiteherb', moves: ['autotomize']}, + {species: "pelipper", ability: 'sandveil', item: 'lifeorb', moves: ['airslash']}, + {species: "Thundurus", ability: 'prankster', item: 'ironball', moves: ['electricterrain']}, + {species: 'Klefki', ability: 'prankster', moves: ['confuseray']}]); + + battle.makeChoices('move rest', 'move autotomize'); + + battle.makeChoices('switch Arcanine', 'move autotomize'); + + const holder = battle.p2.active[0]; + + assert.false.holdsItem(holder); + assert.statStage(holder, 'atk', 0); + }); + it('should use white herb after one intimidate [singles]', function () { + battle = common.createBattle(); + + battle.join('p1', 'Guest 1', 1, [ + {species: "Arcanine", ability: 'intimidate', moves: ['bodyslam']}, + {species: "Incineroar", ability: 'intimidate', moves: ['agility']}]); + battle.join('p2', 'Guest 2', 2, [ + {species: "aegislash", ability: 'stancechange', item: 'whiteherb', moves: ['autotomize']}, + {species: "pelipper", ability: 'sandveil', item: 'lifeorb', moves: ['airslash']}, + {species: 'Klefki', ability: 'prankster', moves: ['confuseray']}]); + + battle.makeChoices('move rest', 'move autotomize'); + + battle.makeChoices('switch Arcanine', 'move autotomize'); + + const holder = battle.p2.active[0]; + + assert.false.holdsItem(holder); + assert.statStage(holder, 'atk', 0); + }); + it('should use white herb after pokemon switch in after faint [singles]', function () { + battle = common.createBattle(); + + battle.join('p1', 'Guest 1', 1, [ + {species: "oddish", ability: 'stancechange', item: 'ironball', moves: ['storedpower']}, + {species: "oddish", ability: 'stancechange', item: 'ironball', moves: ['storedpower']}, + {species: "Arcanine", ability: 'intimidate', moves: ['bodyslam']}, + {species: "Incineroar", ability: 'intimidate', moves: ['agility']}]); + battle.join('p2', 'Guest 2', 2, [ + {species: "Rotom", ability: 'levitate', item: 'whiteherb', moves: ['searingshot']}, + {species: "Rotom", ability: 'levitate', item: 'whiteherb', moves: ['searingshot']}, + {species: "Thundurus", ability: 'prankster', item: 'whiteherb', moves: ['electricterrain']}, + {species: 'Klefki', ability: 'prankster', moves: ['confuseray']}]); + + battle.makeChoices('move storedpower', 'move searingshot'); + + battle.makeChoices('switch Arcanine', 'switch searingshot'); + + const holder = battle.p2.active[0]; + + assert.false.holdsItem(holder); + assert.statStage(holder, 'atk', 0); + }); }); From c615ae7f653309d380bd4e1f59afc0378553f326 Mon Sep 17 00:00:00 2001 From: e088764 Date: Mon, 11 Mar 2019 16:10:40 -0400 Subject: [PATCH 23/26] add singles test remove doubles check --- data/items.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/data/items.js b/data/items.js index 5df2a37cec1d..61794a088d6b 100644 --- a/data/items.js +++ b/data/items.js @@ -6009,11 +6009,9 @@ let BattleItems = { }, }, onUpdate(pokemon) { - if ((this.gameType === "doubles")) { - for (const action of this.queue) { - if (action.choice === 'runSwitch') { - return; - } + for (const action of this.queue) { + if (action.choice === 'runSwitch') { + return; } } let activate = false; From 0f13b9529d76edea84aef7a59cd545ea2241abda Mon Sep 17 00:00:00 2001 From: e088764 Date: Mon, 11 Mar 2019 16:12:54 -0400 Subject: [PATCH 24/26] merge --- test/mocha.opts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/mocha.opts b/test/mocha.opts index a3f8c7bc9718..5a2c19eb7177 100644 --- a/test/mocha.opts +++ b/test/mocha.opts @@ -1,5 +1,4 @@ -test/simulator/items/whiteherb.js --g 6789987678 +test/main.js test/simulator/**/*.js test/application/*.js test/chat-plugins/*.js -R dot -u bdd --exit From 3cc1a30e32ee2ab8b208f60621e9d7d3c794ea97 Mon Sep 17 00:00:00 2001 From: e088764 Date: Mon, 18 Mar 2019 11:08:41 -0400 Subject: [PATCH 25/26] mislabeled test --- test/simulator/items/whiteherb.js | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/test/simulator/items/whiteherb.js b/test/simulator/items/whiteherb.js index 6cfbd2a81dfe..08d9e3504e9b 100644 --- a/test/simulator/items/whiteherb.js +++ b/test/simulator/items/whiteherb.js @@ -5,7 +5,7 @@ const common = require('./../../common'); let battle; -describe('White Herb', function () { +describe('White Herb 678909876789', function () { afterEach(function () { battle.destroy(); }); @@ -120,30 +120,6 @@ describe('White Herb', function () { assert.false.holdsItem(holder); assert.statStage(holder, 'atk', -1); }); - it('should use white herb after two Intimidate switch in after faint', function () { - battle = common.createBattle({gameType: 'doubles'}); - - battle.join('p1', 'Guest 1', 1, [ - {species: "aegislash", ability: 'stancechange', item: 'ironball', moves: ['storedpower']}, - {species: "aegislash", ability: 'stancechange', item: 'ironball', moves: ['storedpower']}, - {species: "Arcanine", ability: 'intimidate', moves: ['bodyslam']}, - {species: "Incineroar", ability: 'intimidate', moves: ['agility']}]); - battle.join('p2', 'Guest 2', 2, [ - {species: "Rotom", ability: 'levitate', item: 'whiteherb', moves: ['overheat']}, - {species: "Rotom", ability: 'levitate', item: 'whiteherb', moves: ['overheat']}, - {species: "Thundurus", ability: 'prankster', item: 'ironball', moves: ['electricterrain']}, - {species: 'Klefki', ability: 'prankster', moves: ['confuseray']}]); - - battle.makeChoices('move stringshot, move stringshot', 'move overheat, move overheat'); - - battle.makeChoices('switch Arcanine, switch Incineroar', 'move overheat, move overheat'); - battle.makeChoices('move stringshot, move stringshot', 'move overheat, move overheat'); - - const holder = battle.p2.active[0]; - - assert.false.holdsItem(holder); - assert.statStage(holder, 'atk', -1); - }); it('should use white herb after all pokemon switch in after faint', function () { battle = common.createBattle({gameType: 'doubles'}); From a230288221afb4ee809b14e133d52cfaa67a58a8 Mon Sep 17 00:00:00 2001 From: e088764 Date: Mon, 18 Mar 2019 11:09:56 -0400 Subject: [PATCH 26/26] mislabeled test --- test/simulator/items/whiteherb.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/simulator/items/whiteherb.js b/test/simulator/items/whiteherb.js index 08d9e3504e9b..f0cc4288aa0d 100644 --- a/test/simulator/items/whiteherb.js +++ b/test/simulator/items/whiteherb.js @@ -5,7 +5,7 @@ const common = require('./../../common'); let battle; -describe('White Herb 678909876789', function () { +describe('White Herb', function () { afterEach(function () { battle.destroy(); });