trysethelpinghand avoid illegal target (#8218)

This commit is contained in:
Martin Griffin 2025-11-12 21:53:35 +00:00 committed by GitHub
parent 2bb0d0249d
commit 16d80e9bb1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -12643,11 +12643,16 @@ static void Cmd_trysethelpinghand(void)
{
CMD_ARGS(const u8 *failInstr);
if (!IsDoubleBattle())
{
gBattlescriptCurrInstr = cmd->failInstr;
return;
}
gBattlerTarget = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerAttacker)));
if (IsDoubleBattle()
&& !(gAbsentBattlerFlags & (1u << gBattlerTarget))
&& !HasBattlerActedThisTurn(gBattlerTarget))
if (!(gAbsentBattlerFlags & (1u << gBattlerTarget))
&& !HasBattlerActedThisTurn(gBattlerTarget))
{
gProtectStructs[gBattlerTarget].helpingHand++;
gBattlescriptCurrInstr = cmd->nextInstr;