-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
White Herb doubles fix #5185
Conversation
test/simulator/items/whiteherb.js
Outdated
battle.destroy(); | ||
}); | ||
|
||
it('it should use white herb after both intimidate', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can leave off the extra “it” here; that’s what the function name is for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks !! Removed
data/items.js
Outdated
@@ -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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (pokemon.side.foe.pokemon.length > 1 && pokemon.side.foe.battle.abilityOrder !== 4) { | |
if (pokemon.side.active.length > 1 && this.abilityOrder !== 4) { |
There are a few problems here; this kind of fix only works before Turn 1 and not when multiple Pokemon are replacing fainted ones at the end of a turn, but more importantly White Herb itself would only work while those four lead Pokemon are on the field and won't ever activate again for anything in Doubles. |
Thank you for the feed back!! I had a feeling I didn't fully understand the variables I was using, I will do more testing and work on this bug some more |
What if we made the |
If multiple Talonflames holding Sitrus Berries switch into Stealth Rock, do the berries wait until all Pokémon have switched in? |
Nope, Berries activate as soon as each one takes the hazard damage, like switch-in Abilities. That's actually why Unnerve activates before hazards, so it can stop faster Pokemon from healing in those situations. Edit: Wow, I misread your question completely. Yes they wait until all Pokemon have switched in (but so does hazard damage). |
Hi @Marty-D, updated the PR with a new solution and tests based on your feedback. |
This new approach also doesn't work because the queue isn't empty during a turn, for example:
White Herb should activate before Chansey moves here. |
got it, will do more testing and work on it, appreciate you taking a look! |
@Marty-D I updated the PR, would something like this work? onResidual runs after both intimidates activate for doubles and we can keep the update to run only after moves that decrees stats like tailwhip/growl/stringshot etc ? EDITupdated the PR to include this code to just check if last move had a negative boost instead of hardcoding the moves in the conditional: let lastMoveAttackDown = false;
if (this.lastMove && this.lastMove.boosts) {
for (let i in this.lastMove.boosts) {
// @ts-ignore
if (this.lastMove.boosts[i] < 0) {
lastMoveAttackDown = true;
break;
}
}
} |
test/simulator/items/whiteherb.js
Outdated
|
||
let battle; | ||
|
||
describe('White Herb 5678765567', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debugging artifact, I presume?
describe('White Herb 5678765567', function () { | |
describe('White Herb', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup :D will remove
test/simulator/items/whiteherb.js
Outdated
assert.false.holdsItem(holder); | ||
assert.statStage(holder, 'atk', 0); | ||
}); | ||
it('should use white herb after two intimidate switch in', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching in during a turn (one at a time) is fundamentally different from switching in at the beginning of a battle or to replace fainted Pokemon (all at once). This test you're doing here should activate White Herb before the second Pokemon even switches out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah ok makes sense, will update the PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching in during a turn (one at a time) is fundamentally different from switching in at the beginning of a battle or to replace fainted Pokemon (all at once). This test you're doing here should activate White Herb before the second Pokemon even switches out.
It seems runSwitch remains in queue when Pokemon are switching in at start or after feint. Checking for this before the update leads to White Herb being called after all Pokemon switch in after start or after feint and calls it right away after a player switches during a turn. Is this correct behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('should use white herb after two intimidate switch in', function () { | |
it('should use white herb after two Intimidate switch in', function () { |
data/items.js
Outdated
@@ -6009,9 +6009,17 @@ let BattleItems = { | |||
}, | |||
}, | |||
onUpdate(pokemon) { | |||
if ((this.gameType === "doubles")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look like a good idea to me, since it's too specific, but do you even need it any more?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably not I was going to add some tests for singles and test without the check
I wonder if it'd work to run the |
@MacChaeger not sure I understand what your proposing, would this be to check if more Pokemon are about to be switched in ? |
c7b57c2
to
1d09dd1
Compare
e75cc47
to
381bd75
Compare
Old PR from someone who's no longer contributing. |
#2367
White Herb doesn't work with doubles.
Not sure if I have the right approach here...please comment if not,
Thanks!!