Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

White Herb doubles fix #5185

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion data/items.js
Original file line number Diff line number Diff line change
Expand Up @@ -5978,14 +5978,18 @@ 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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (pokemon.side.foe.pokemon.length > 1 && pokemon.side.foe.battle.abilityOrder !== 4) {
if (pokemon.side.active.length > 1 && this.abilityOrder !== 4) {

return;
}
for (let i in pokemon.boosts) {
// @ts-ignore
if (pokemon.boosts[i] < 0) {
activate = true;
boosts[i] = 0;
}
}
if (activate && pokemon.useItem()) {
if (!pokemon.duringMove && activate && pokemon.useItem()) {
pokemon.setBoost(boosts);
this.add('-clearnegativeboost', pokemon, '[silent]');
}
Expand Down
26 changes: 26 additions & 0 deletions test/simulator/items/whiteherb.js
Original file line number Diff line number Diff line change
@@ -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('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);
});
});