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

Replace hp checks with IsBattlerAlive #4429

Merged
merged 5 commits into from
May 7, 2024

Conversation

ghoulslash
Copy link
Collaborator

Can't find an issue number, but this fixes Toxic/Flame Orb from activating on fainted battlers.

Also updated a bunch of .hp != 0 --> IsBattlerAlive and .hp == 0 to !IsBattlerAlive while I was at it

@AlexOn1ine
Copy link
Collaborator

AlexOn1ine commented Apr 22, 2024

I wasn't able to repro the toxic / flame orb bug and it seems there is already a check when ItemBattleEffects is called.

        case ENDTURN_ORBS:
            if (IsBattlerAlive(battler) && ItemBattleEffects(ITEMEFFECT_ORBS, battler, FALSE))
                effect++;
            gBattleStruct->turnEffectsTracker++;
            break;

So the second check is redundant.

/Edit: Ghoul you fixed it yourself in #2585 😅

@ghoulslash
Copy link
Collaborator Author

I wasn't able to repro the toxic / flame orb bug and it seems there is already a check when ItemBattleEffects is called.

        case ENDTURN_ORBS:
            if (IsBattlerAlive(battler) && ItemBattleEffects(ITEMEFFECT_ORBS, battler, FALSE))
                effect++;
            gBattleStruct->turnEffectsTracker++;
            break;

So the second check is redundant.

/Edit: Ghoul you fixed it yourself in #2585 😅

lol that's funny. oops. Just removed the redundant checks

@ghoulslash ghoulslash changed the title Add IsBattlerAlive check to Flame/Toxic Orb. Replace hp checks with IsBattlerAlive Replace hp checks with IsBattlerAlive Apr 26, 2024
@@ -7954,7 +7954,7 @@ u8 ItemBattleEffects(u8 caseID, u32 battler, bool32 moveTurn)
}
break;
case HOLD_EFFECT_STICKY_BARB: // Not an orb per se, but similar effect, and needs to NOT activate with pickpocket
if (battlerAbility != ABILITY_MAGIC_GUARD)
if (IsBattlerAlive(battler) && battlerAbility != ABILITY_MAGIC_GUARD)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this one isn't needed as well.

src/battle_util.c Outdated Show resolved Hide resolved
@AlexOn1ine AlexOn1ine merged commit 5538095 into rh-hideout:upcoming May 7, 2024
1 check passed
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.

2 participants