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

Fix Infinite Tera Orb racharging #4863

Merged
merged 2 commits into from
Jul 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions src/battle_terastal.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,21 @@ bool32 CanTerastallize(u32 battler)
{
u32 holdEffect = GetBattlerHoldEffect(battler, FALSE);

if (GetBattlerSide(battler) == B_SIDE_PLAYER)
if (TESTING || GetBattlerSide(battler) == B_SIDE_OPPONENT)
{
// Check if Player has Tera Orb and has charge.
if (!TESTING && !CheckBagHasItem(ITEM_TERA_ORB, 1))
return FALSE;

if (!TESTING
&& !(B_FLAG_TERA_ORB_NO_COST != 0 && FlagGet(B_FLAG_TERA_ORB_NO_COST))
&& (battler == B_POSITION_PLAYER_LEFT || (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) && battler == B_POSITION_PLAYER_RIGHT)))
{
if (B_FLAG_TERA_ORB_CHARGED != 0 && !FlagGet(B_FLAG_TERA_ORB_CHARGED))
return FALSE;
}
// Skip all other checks in this block, go to HasTrainerUsedGimmick
}
else if (!CheckBagHasItem(ITEM_TERA_ORB, 1))
{
return FALSE;
}
else if (FlagGet(B_FLAG_TERA_ORB_NO_COST))
{
// Tera Orb is not depleted, go to HasTrainerUsedGimmick
}
else if (!FlagGet(B_FLAG_TERA_ORB_CHARGED))
{
return FALSE;
}

// Check if Trainer has already Terastallized.
Expand Down
Loading