-
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
Fix crash with Psych Up, Focus Energy, and Dragon Cheer #10573
Merged
DaWoblefet
merged 3 commits into
smogon:master
from
Eric-w-H:bugfix_focus_energy_dragon_cheer_crash
Oct 1, 2024
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
'use strict'; | ||
|
||
const assert = require('./../../assert'); | ||
const common = require('./../../common'); | ||
|
||
let battle; | ||
|
||
describe('Costar', function () { | ||
afterEach(function () { | ||
battle.destroy(); | ||
}); | ||
|
||
it('should copy the teammate\'s crit ratio on activation', function () { | ||
battle = common.createBattle({gameType: 'doubles'}); | ||
battle.setPlayer('p1', {team: [ | ||
{species: 'Smeargle', level: 1, moves: ['sleeptalk', 'focusenergy']}, | ||
{species: 'Suicune', level: 1, moves: ['sleeptalk']}, | ||
{species: 'Flamigo', level: 1, ability: 'costar', moves: ['sleeptalk']}, | ||
]}); | ||
battle.setPlayer('p2', {team: [ | ||
{species: 'Suicune', level: 1, moves: ['sleeptalk']}, | ||
{species: 'pikachu', level: 1, moves: ['sleeptalk']}, | ||
{species: 'weezinggalar', level: 1, ability: 'neutralizinggas', moves: ['sleeptalk']}, | ||
]}); | ||
|
||
battle.makeChoices('move focusenergy, move sleeptalk', 'move sleeptalk, move sleeptalk'); | ||
battle.makeChoices('move sleeptalk, switch flamigo', 'move sleeptalk, move sleeptalk'); | ||
|
||
const flamigo = battle.p1.active[1]; | ||
assert(flamigo.volatiles['focusenergy'], "Costar should copy volatile crit modifiers."); | ||
|
||
battle.makeChoices('switch suicune, move sleeptalk', 'switch weezinggalar, move sleeptalk'); | ||
battle.makeChoices('move sleeptalk, move sleeptalk', 'switch suicune, move sleeptalk'); | ||
assert(!flamigo.volatiles['focusenergy'], "Costar should copy having no volatile crit modifiers when re-activated."); | ||
}); | ||
|
||
it('should copy both positive and negative stat changes', function () { | ||
battle = common.createBattle({gameType: 'doubles'}); | ||
battle.setPlayer('p1', {team: [ | ||
{species: 'Suicune', level: 1, moves: ['sleeptalk']}, | ||
{species: 'Smeargle', level: 1, moves: ['sleeptalk', 'shellsmash']}, | ||
{species: 'Flamigo', level: 1, ability: 'costar', moves: ['sleeptalk']}, | ||
]}); | ||
battle.setPlayer('p2', {team: [ | ||
{species: 'Suicune', level: 1, moves: ['sleeptalk']}, | ||
{species: 'Suicune', level: 1, moves: ['sleeptalk']}, | ||
]}); | ||
|
||
|
||
battle.makeChoices('move sleeptalk, move shellsmash', 'move sleeptalk, move sleeptalk'); | ||
battle.makeChoices('switch flamigo, move sleeptalk', 'move sleeptalk, move sleeptalk'); | ||
|
||
const flamigo = battle.p1.active[0]; | ||
assert.statStage(flamigo, 'atk', 2, "A pokemon should copy the target's positive stat changes (atk) when switching in with Costar."); | ||
assert.statStage(flamigo, 'spa', 2, "A pokemon should copy the target's positive stat changes (spa) when switching in with Costar."); | ||
assert.statStage(flamigo, 'spe', 2, "A pokemon should copy the target's positive stat changes (spe) when switching in with Costar."); | ||
assert.statStage(flamigo, 'def', -1, "A pokemon should copy the target's negative stat changes (def) when switching in with Costar."); | ||
assert.statStage(flamigo, 'spd', -1, "A pokemon should copy the target's negative stat changes (spd) when switching in with Costar."); | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
wouldn't this functionally do the same thing with one less iteration?
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.
Also, is this a concern for Costar?
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.
The point is that you need to remove the Focus Energy volatile in order to be able to properly copy the Dragon Cheer volatile and vice versa. Costar can presumably activate after having volatiles though use of Neutralising Gas or other methods.
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.
(I guess the other approach would be to avoid having codependent volatiles altogether by putting all of the logic in the Psych Up volatile which would have to work out whether it had been set by Dragon Cheer on a non-Dragon type in which case it would only add 1 to the crit ratio.)
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.
We can't move the
removeVolatile
call inside the same loop that tries to add volatiles since that would not removefocusenergy
beforedragoncheer
is added; in this case fusing the loop changes the behavior. We could re-order thevolatilesToCopy
list, but I'm not sure (or tbh willing to exhaustively test) that would be robust, and it definitely wouldn't be robust against possible future additions or list re-orderings.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.
What is the cartridge behavior of Costar after neutralizing gas?
e.g. roaring moon has 2 dd's and dragoncheer effect, flamigo switches in and copies all three boosts (+2 atk, +2 spe, +2 crit).
opponent switches weezing-galar (neutralizing gas) in
roaring moon switches out to hydreigon
weezing galar switches out
should flamigo after costar re-ups have no boosts? volatiles only?
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 have attempted to copy Hydreigon's stats, which in this case would be +0 Atk and +0 Spe. It also would copy Hydreigon's lack of crit volatile, so it should have a +0 crit rate again after Costar activates. It's identical to how Psych Up behaves.
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.
Great, that's the current behavior I have tested, then.