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

Variadic IS_BATTLER_OF_TYPE and GetBattlerTypes #5708

Open
wants to merge 1 commit into
base: upcoming
Choose a base branch
from

Conversation

mrgriffin
Copy link
Collaborator

@AlexOn1ine wanted something like !IS_BATTLER_ANY_TYPE(gBattlerAttacker, TYPE_ROCK, TYPE_GROUND, TYPE_STEEL).

In addition to that I added GetBattlerTypes which computes all the types at the same time, to improve the performance of any code which checks multiple types at once, and updated all GetBattlerTypes to use the new function.

So that downstream code continues to work:

  • GetBattlerType is implemented in terms of GetBattlerTypes.
  • IS_BATTLER_OF_TYPE is implemented in terms of IS_BATTLER_ANY_TYPE.

Things to note in the release changelog:

  • IS_BATTLER_ANY_TYPE should be preferred to IS_BATTLER_OF_TYPE whenever more than one type is being checked.
  • GetBattlerTypes should be preferred to GetBattlerType whenever more than one type is being checked.

@AlexOn1ine AlexOn1ine added category: battle-mechanic Pertains to battle mechanics new-feature Adds a feature labels Nov 22, 2024
@mrgriffin
Copy link
Collaborator Author

Oh for God's sake, I forgot agbcc still exists on master 🤦

@mrgriffin mrgriffin force-pushed the rhh-variadic-is-battler-of-type branch from 72ad544 to 41d3714 Compare November 22, 2024 16:28
@mrgriffin mrgriffin changed the base branch from master to upcoming November 22, 2024 16:29
@mrgriffin
Copy link
Collaborator Author

Rebased onto upcoming at Alex's request. I didn't check for any new IS_BATTLER_OF_TYPE to combine.

@mrgriffin mrgriffin force-pushed the rhh-variadic-is-battler-of-type branch from 41d3714 to 7d8ec6d Compare November 22, 2024 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: battle-mechanic Pertains to battle mechanics new-feature Adds a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants