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

Fix Gen 4 interaction between U-turn/Substitute/Intimidate #5222

Merged
merged 9 commits into from
Mar 6, 2019

Conversation

scheibo
Copy link
Contributor

@scheibo scheibo commented Mar 1, 2019

Gen IV

Originally posted by @Marty-D in #2367 (comment)

Alright, it seems like my options here are to edit U-turn, Substitute or Intimidate. Some thoughts:

  • I don't think U-turn + sub interaction should be special cased (whether its a U-turn move listener checking for the substitute or the sub checking to see if it was broken by U-turn). It seems too niche. The behavior seems like it should be innate to Substitute and midturn, not to U-turn? Maybe the question is: what happens in a double battle on a turn like:

    p1a sub, p2a attack sub, p2b attack && break sub, p1b roar p2b, p2b replaced by an Intimidate user

    Would p1a's attack be reduced in Gen 4 in this scenario where the Intimidate user was dragged in on the middle of the turn where p1a's sub broke? (though the ordering differences of dragged in vs. uturn might be an important distinction that im glossing over)

  • leave the substitute volatile around until end of turn after it is broken (just with 0 HP) so that it still blocks the Intimidate. I'd need to add logic to make sure the sub faded animation still occurs, as well as make sure Intimidate checks to target's sub HP to know whether it should display a -hint instead of the -immune message. However, I'm not sure whether Intimidate even activates in this case (ie/ whether there should be an -ability message) - from the thread it looks like it shouldn't activate at all? I'm also not keen on leaving the substitute volatile around, I feel it could break things, as everything would then need to check for sub hp etc

  • add some kind of subbroken volatile if the sub was broken that turn (removed at end of turn), and look for that in Intimidate. Adding a new volatiles feels contrived.

So yeah, not really sure about the best way to fix this, not a fan of most of the approaches I can think of. Starting this PR as a draft looking for ideas before I dive in deeper, the the worst case I can't figure out anything and I can at least submit a pending test to help document our bugs.

@scheibo
Copy link
Contributor Author

scheibo commented Mar 1, 2019

From UPC, it seems like this could in fact just be a special interaction with U-turn and Substitute, not something more general

If the user has a substitute at the beginning of an attack segment in which a Pokémon in battle other than the user uses U-turn, and that other Pokémon is replaced with a Pokémon with Intimidate during that attack segment, that ability will do nothing to the user during that attack segment even if U-turn caused the substitute to fade.

@scheibo scheibo changed the title Add test for Gen 4 U-turn + Substitute Fix Gen 4 interaction between U-turn/Substitute/Intimidate Mar 2, 2019
source.lastDamage = damage;
if (target.volatiles['substitute'].hp <= 0) {
target.removeVolatile('substitute');
target.addVolatile('substitutebroken');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These three lines are the only ones that changed - shame to have to copy the rest of effect from Gen 5.

@@ -50,6 +50,12 @@ let BattleStatuses = {
return false;
},
},
substitutebroken: {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah.... Not super keen on having added a new volatile....

data/mods/gen4/abilities.js Outdated Show resolved Hide resolved
@Marty-D
Copy link
Collaborator

Marty-D commented Mar 2, 2019

Hmm, I'm not sure if BeforeTurn is appropriate here (but I don't really have other suggestions; Double Battle situations were what kept this unfixed for this long). Maybe something crazy like removing all substitutebroken volatiles as part of runSwitch?

If p2a has a substitute from a previous turn, p1a breaks it with U-turn and switches into whatever, p1b uses Baton Pass or U-turn against anyone and brings in something with Intimidate, it works against p2a.

@scheibo scheibo mentioned this pull request Mar 4, 2019
23 tasks
@scheibo
Copy link
Contributor Author

scheibo commented Mar 4, 2019

If p2a has a substitute from a previous turn, p1a breaks it with U-turn and switches into whatever, p1b uses Baton Pass or U-turn against anyone and brings in something with Intimidate, it works against p2a.

Was not aware of this. Switched to special casing gen 4 in runSwitch logic.

@Zarel
Copy link
Member

Zarel commented Mar 4, 2019

We can also show hint messages to exactly one side, using |split.

@scheibo
Copy link
Contributor Author

scheibo commented Mar 4, 2019

We can also show hint messages to exactly one side, using |split.

Alright, I think I did that (I copied the pattern from Gen 3 Pressure)? On my other PR I also wanted slightly fancier hints, so i extracted this out to a Battle method I can migrate these to.

@scheibo scheibo marked this pull request as ready for review March 5, 2019 03:35
@Marty-D Marty-D merged commit 961b988 into smogon:master Mar 6, 2019
@Marty-D Marty-D mentioned this pull request Mar 6, 2019
@scheibo scheibo deleted the gen4-uturnsub branch March 10, 2019 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants