Skip to content

Commit

Permalink
Fix Infinite Tera Orb racharging (#4863)
Browse files Browse the repository at this point in the history
* Fix Infinte Tera Orb charges

* trainer_parties.h
  • Loading branch information
AlexOn1ine committed Jul 13, 2024
1 parent 385b701 commit 45275fe
Showing 1 changed file with 14 additions and 12 deletions.
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

0 comments on commit 45275fe

Please sign in to comment.