-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
[Ability] Implement Wimp Out and Emergency Exit #4701
base: beta
Are you sure you want to change the base?
Conversation
@muscode13 Thank you for your contribution. |
Hey! @flx-sta Added some videos. Let me know if you'd like some more! Also just added the nightmare interaction following its recent bug fix |
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 feel like this can all be condensed into a single attribute if applied in Pokemon.damage
, which covers every source of damage and is where the Pokemon's HP is actually updated. A new subset of ability attributes (say, PostDamageAbAttr
) and a new apply function applyPostDamageAbAttrs
in support of Wimp Out/EE's attribute could also be helpful.
@innerthunder Refactored the code to now use a new class |
Alright! I updated the videos. They are all of the refactored version. Ready for another review |
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.
Just one nit left on my end
What are the changes the user will see?
Wimp Out and Emergency Exit implemented
Why am I making these changes?
Ability is not implemented
What are the changes from a developer perspective?
There are several attributes and a condition function, as well as some helper functions I added to make this ability work:
getHealthKnockedBelowHalf
- This function determines if the Pokemon's health was knocked below half. It checks through different phases and evaluates based off conditions that can happen during it, such as Stealth Rocks during PostSummon or Leech Seed damage during TurnEndcalculateTurnEndDamage
- This functions calculates how much damage the Pokemon would take from TurnEnd effects like Poison, Salt Cure, WhirlpoolcalculateSleepDamage
- This function calculates how much damage the Pokemon would take from abilities like Bad DreamscalculateShellBellRecovery
- Calculates the amount healed off Shell Bell. This covers the case where if the pokemon's health falls below half and recovers back above half from a Shell Bell, Wimp Out should activate even after the Shell Bell recoverycheckSheerForceCondition
- Since the two conditions were unable to coexist, I added a check to verify that an attack that would trigger Wimp Out from a Sheer Force user wouldn't. I'd normally refactor getSheerForceHitDisableAbCondition to use this helper, but I wanted to keep my changes isolated.ForceSwitchOutHelper
- This is mostly logic from the ForceSwitchOutAttr in moves that was lifted and shifted here.PostDefendForceSwitchOutAttr
- Triggers Wimp Out if the Pokemon's health drops below half after taking an attack. If defending from a multi-hit move, the ability will trigger after the last hit. Phasing damaging moves like Dragon Tail and Circle Throw's effect will be applied and Wimp Out will not trigger.PostAttackForceSwitchOutAttr
- Triggers Wimp Out if the Pokemon's health drops below half after attacking. This triggers primarily off recoil. It will not trigger if the user cuts it's health with moves like Substitute or Belly Drum.PostSummonForceSwitchOutAttr
- Triggers Wimp Out if the Pokemon's health drops below half after entering the field. Triggers off entry hazards.PostTurnForceSwitchOutAttr
- Triggers Wimp Out if the Pokemon's health drops below half after Turn End damage like poison, leech seed, etc.PostWeatherForceSwitchOutAttr
- Triggers Wimp Out if the Pokemon's health drops below half after suffering from Weather damage. It calculates how much the Pokemon would take from the weather, and if it would drop it below half, the damage is applied and the pokemon switches out.PostVictoryForceSwitchOutAttr
- Triggers Wimp Out if the Pokemon's health drops below half after killing an enemy. Accounts for abilities like Aftermath and Innards OutI also had to add a small check and helper function to ForceSwitchOutAttr in moves.ts, to account for an edge case interaction: If Wimp Out activates due to being hit by U-turn or Volt Switch, the user of that move will not be switched out.
Videos
Hazard Activation (Stealth Rocks):
https://github.com/user-attachments/assets/26695b08-b768-4579-889b-918108146b12
Recoil Activation:
https://github.com/user-attachments/assets/422dab42-5332-4a0e-a7b0-a106a9df883e
Post Defend Activation:
https://github.com/user-attachments/assets/61ddc753-891a-4e97-aa81-e18d5173d01d
Weather Activation (Hail):
https://github.com/user-attachments/assets/40405beb-6e56-43a3-b130-28a8f100724c
Post Turn Damage Activation (Leech Seed):
https://github.com/user-attachments/assets/9e79be8d-b3a4-4372-9d26-04de3a824ff4
Victory Activation (Aftermath):
https://github.com/user-attachments/assets/f5728f84-5145-4945-8079-5042e34af3db
Ignore Trapped to Flee:
https://github.com/user-attachments/assets/51a0400d-4c0b-4ce9-b8c7-74fb7c80a30c
Substitute does not trigger Ability:
https://github.com/user-attachments/assets/c3809e94-f179-49fe-9b78-f433d491e426
Wild Battle:
https://github.com/user-attachments/assets/74dde6a4-9b1e-47e2-837f-6a96f567aff4
Trainer Battle:
https://github.com/user-attachments/assets/23ef5f24-e595-4ae9-acae-e5f64c2da4e7
Vortex Trap (Whirlpool):
https://github.com/user-attachments/assets/6f58f604-80f5-4c61-be2e-9944e375d64b
Sky Drop Interaction:
https://github.com/user-attachments/assets/763921c5-adef-4e88-b3a8-eb962ecfa194
Sheer Force Interaction:
https://github.com/user-attachments/assets/5b4cf6f5-34fb-44bd-81f9-f0993a42bdfd
Multi-Hit moves continue uninterrupted:
https://github.com/user-attachments/assets/02941c0c-dcf5-4a9c-ad7e-d1f5594339c6
U-Turn/Volt Switch interaction:
https://github.com/user-attachments/assets/bc36aa29-93c6-4700-b5e6-53b82e0989ea
Does not Trigger when below half:
https://github.com/user-attachments/assets/48257a7e-43ba-4ab8-a9e1-6b26d98dfe43
Status Damage:
https://github.com/user-attachments/assets/7996d7d1-f1ec-4eed-9c85-a17ea64f5a53
Status Applied to Wimp Out user as they switch:
https://github.com/user-attachments/assets/dbdc39d3-dff7-47b0-a837-0113a26b81a1
If it falls below half and recovers back above half from a Shell Bell, Wimp Out will activate even after the Shell Bell recovery:
https://github.com/user-attachments/assets/fd987440-8283-42b6-bfe2-66bd29ca0123
How to test the changes?
npm run test wimp_out
Checklist
beta
as my base branchnpm run test
)