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

[Ability] Implement Wimp Out and Emergency Exit #4701

Merged
merged 51 commits into from
Nov 3, 2024

Conversation

muscode13
Copy link
Contributor

@muscode13 muscode13 commented Oct 21, 2024

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:

  • calculateShellBellRecovery - 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 recovery
  • ForceSwitchOutHelper - This is mostly logic from the ForceSwitchOutAttr in moves that was lifted and shifted here.
  • PostDamageAbAttr - This ability attribute triggers after the pokemon takes damage.
  • PostDamageForceSwitchAbAttr - This triggers a forced switch out after the pokemon drops below the given ratio, defaulting at 50%, it has several conditions like certain moves not triggering it like Pain Split or if it falls below half and recovers back above half from a Shell Bell, it will activate even after the Shell Bell recovery

I also had to add a small check and helper function to PostDamageForceSwitchAbAttr 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):
hazards.mp4
Recoil Activation:
recoil.mp4
Post Defend Activation:
defending.mp4
Weather Activation (Hail):
weather.mp4
Post Turn Damage Activation (Leech Seed):
postturn.mp4
Victory Activation (Aftermath):
aftermath.mp4
Ignore Trapped to Flee:
trapped.mp4
Substitute does not trigger Ability:
substitute.mp4
Wild Battle:
wild.mp4
Trainer Battle:
trainer.mp4
Vortex Trap (Whirlpool):
trap.mp4
Sky Drop Interaction:
skydrop.mp4
Sheer Force Interaction:
sheerforce.mp4
Multi-Hit moves continue uninterrupted:
multihit.mp4
U-Turn/Volt Switch interaction:
voltswitch.mp4
Does not Trigger when below half:
belowhalf.mp4
Status Damage:
toxic.mp4
Status Applied to Wimp Out user as they switch:
applystatus.mp4
If it falls below half and recovers back above half from a Shell Bell, Wimp Out will activate even after the Shell Bell recovery:
shellbell.mp4
Updated Multi Hit Move:
multihit.mp4
Multi Lens moves continue uninterrupted and triggers Ability:
multilens.mp4
Parental Bond continues uninterrupted and triggers Ability:
pbond.mp4

How to test the changes?

  • Use Pokemon with Wimp Out in the game. If you want to test out a specific interaction, you can override and give the enemy pokemon a certain move, like Stealth Rock or Leech Seed.
  • run npm run test wimp_out

Checklist

  • I'm using beta as my base branch
  • There is no overlap with another PR? - The other PR has been closed for several months
  • The PR is self-contained and cannot be split into smaller PRs?
  • Have I provided a clear explanation of the changes?
  • Have I considered writing automated tests for the issue?
  • If I have text, did I make it translatable and add a key in the English locale file(s)?
  • Have I tested the changes (manually)?
    • Are all unit tests still passing? (npm run test)
  • Are the changes visual?
    • Have I provided screenshots/videos of the changes?

@flx-sta
Copy link
Collaborator

flx-sta commented Oct 21, 2024

@muscode13 Thank you for your contribution.
Please make sure to provide some videos/screenshots of in-game footage for these implementations

@Tempo-anon Tempo-anon added Move Affects a move Ability Affects an ability labels Oct 22, 2024
@muscode13
Copy link
Contributor Author

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

Copy link
Collaborator

@innerthunder innerthunder left a 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.

@muscode13
Copy link
Contributor Author

muscode13 commented Oct 22, 2024

@innerthunder Refactored the code to now use a new class PostDamageAbAttr as suggested. The ability attributes have been cut down to just PostDamageForceSwitchAttr, which covers damage during all phases. I'll add some new videos later tonight.

@muscode13
Copy link
Contributor Author

Alright! I updated the videos. They are all of the refactored version. Ready for another review

Copy link
Collaborator

@innerthunder innerthunder left a 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

src/data/ability.ts Outdated Show resolved Hide resolved
src/data/ability.ts Outdated Show resolved Hide resolved
@muscode13
Copy link
Contributor Author

@DayKev Added some code for Multi-Lens, but it's pretty ghetto since the modifier doesn't update the turnData with all the damage dealt. Let me know if you think we're better off without it. Thanks!

src/data/ability.ts Outdated Show resolved Hide resolved
@muscode13
Copy link
Contributor Author

Added 3 more videos to the description showing the updated Multi Hit, Multi Lens, and P Bond interaction

…ental Bond logic + test, put applyPostDamageAbAttrs back in damageAndUpdate
src/data/ability.ts Outdated Show resolved Hide resolved
Co-authored-by: innerthunder <[email protected]>
src/data/ability.ts Outdated Show resolved Hide resolved
src/data/ability.ts Outdated Show resolved Hide resolved
src/data/ability.ts Outdated Show resolved Hide resolved
src/data/ability.ts Outdated Show resolved Hide resolved
src/data/ability.ts Show resolved Hide resolved
src/data/move.ts Outdated Show resolved Hide resolved
src/data/move.ts Outdated Show resolved Hide resolved
src/data/move.ts Outdated Show resolved Hide resolved
src/data/move.ts Show resolved Hide resolved
src/field/pokemon.ts Outdated Show resolved Hide resolved
src/data/ability.ts Outdated Show resolved Hide resolved
@muscode13 muscode13 requested a review from DayKev November 2, 2024 19:23
DayKev
DayKev previously approved these changes Nov 2, 2024
innerthunder
innerthunder previously approved these changes Nov 2, 2024
@muscode13 muscode13 dismissed stale reviews from innerthunder and DayKev via 21fc752 November 3, 2024 05:41
@Tempo-anon Tempo-anon merged commit f0ae36d into pagefaultgames:beta Nov 3, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ability Affects an ability Move Affects a move
Development

Successfully merging this pull request may close these issues.

6 participants