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

Add missing absorbing abilities to FindMonThatAbsorbsOpponentsMove #3218

Merged

Conversation

Pawkkie
Copy link
Collaborator

@Pawkkie Pawkkie commented Aug 10, 2023

Description

Adds consideration for Sap Sipper, Storm Drain, Dry Skin, Motor Drive, and Lightning Rod to the FindMonThatAbsorbsOpponentsMove function, which is called by the ShouldSwitch function and affects the switch AI.

This works fine for Flash Fire, Water Absorb, and Volt Absorb by default, just adding the missing abilities. This was initially brought up by EZBREEZY on Discord, and Alex suggested I PR it.

Discord contact info

Pawkkie

if (absorbingTypeAbility == monAbility && Random() & 1)
if (absorbingTypeAbility == monAbility
|| (absorbingTypeAbility == ABILITY_WATER_ABSORB && (monAbility == ABILITY_STORM_DRAIN || monAbility == ABILITY_DRY_SKIN))
|| (absorbingTypeAbility == ABILITY_VOLT_ABSORB && (monAbility == ABILITY_MOTOR_DRIVE || monAbility == ABILITY_LIGHTNING_ROD))
Copy link
Collaborator

Choose a reason for hiding this comment

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

hmm, I think it might be better to have a small array that correlates each ability to the type it absorbs,

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated following this structure, almost exactly lifted from Buffel's Inclement Emerald so if this gets accepted please also credit them :)

Previous implementation involving piggybacking on a conditional in a bit of a messy fashion to check for each ability type, this should be more readable and more easily modified by a novice. This is almost exactly BuffelSaft's inclement emerald implementation.
@DizzyEggg DizzyEggg merged commit 906ea4a into rh-hideout:upcoming Aug 28, 2023
@Pawkkie Pawkkie deleted the absorbing_abilities_on_switchin branch August 30, 2023 01:03
@AsparagusEduardo AsparagusEduardo mentioned this pull request Sep 27, 2023
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.

4 participants