Skip to content

Commit

Permalink
Fixes dynamax move target and canceling in doubles (#3470)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexOn1ine authored Oct 27, 2023
1 parent b560720 commit 57a99e9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
7 changes: 2 additions & 5 deletions src/battle_controller_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -707,11 +707,8 @@ static void HandleInputChooseMove(u32 battler)
}

// Status moves turn into Max Guard when Dynamaxed, targets user.
if ((IsDynamaxed(battler) || gBattleStruct->dynamax.playerSelect)
&& gBattleMoves[moveInfo->moves[gMoveSelectionCursor[battler]]].split == SPLIT_STATUS)
{
moveTarget = MOVE_TARGET_USER;
}
if ((IsDynamaxed(battler) || gBattleStruct->dynamax.playerSelect))
moveTarget = gBattleMoves[GetMaxMove(battler, moveInfo->moves[gMoveSelectionCursor[battler]])].target;

if (moveTarget & MOVE_TARGET_USER)
gMultiUsePlayerCursor = battler;
Expand Down
6 changes: 3 additions & 3 deletions src/battle_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4253,8 +4253,8 @@ static void HandleTurnActionSelectionState(void)

gBattleStruct->mega.toEvolve &= ~(gBitTable[BATTLE_PARTNER(GetBattlerPosition(battler))]);
gBattleStruct->burst.toBurst &= ~(gBitTable[BATTLE_PARTNER(GetBattlerPosition(battler))]);
gBattleStruct->dynamax.toDynamax &= ~(gBitTable[battler]);
gBattleStruct->dynamax.usingMaxMove[battler] = FALSE;
gBattleStruct->dynamax.toDynamax &= ~(gBitTable[BATTLE_PARTNER(GetBattlerPosition(battler))]);
gBattleStruct->dynamax.usingMaxMove[BATTLE_PARTNER(GetBattlerPosition(battler))] = FALSE;
gBattleStruct->zmove.toBeUsed[BATTLE_PARTNER(GetBattlerPosition(battler))] = MOVE_NONE;
BtlController_EmitEndBounceEffect(battler, BUFFER_A);
MarkBattlerForControllerExec(battler);
Expand Down Expand Up @@ -4354,7 +4354,7 @@ static void HandleTurnActionSelectionState(void)
gBattleStruct->burst.toBurst |= gBitTable[battler];
else if (gBattleResources->bufferB[battler][2] & RET_DYNAMAX)
gBattleStruct->dynamax.toDynamax |= gBitTable[battler];

// Max Move check
if (ShouldUseMaxMove(battler, gChosenMoveByBattler[battler]))
{
Expand Down
7 changes: 4 additions & 3 deletions src/battle_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ void HandleAction_UseMove(void)
gCurrentMove = gBattleStruct->zmove.toBeUsed[gBattlerAttacker];
}

moveTarget = GetBattlerMoveTargetType(gBattlerAttacker, gCurrentMove);

if (gBattleMons[gBattlerAttacker].hp != 0)
{
Expand All @@ -343,6 +342,8 @@ void HandleAction_UseMove(void)
gBattleStruct->dynamax.activeSplit = gBattleStruct->dynamax.splits[gBattlerAttacker];
}

moveTarget = GetBattlerMoveTargetType(gBattlerAttacker, gCurrentMove);

// choose target
side = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker));
if (IsAffectedByFollowMe(gBattlerAttacker, side, gCurrentMove)
Expand Down Expand Up @@ -8193,10 +8194,10 @@ bool32 IsBattlerProtected(u32 battler, u32 move)

// Z-Moves and Max Moves bypass protection (except Max Guard).
if ((IsMaxMove(move) || gBattleStruct->zmove.active)
&& (!gProtectStructs[battler].maxGuarded
&& (!gProtectStructs[battler].maxGuarded
|| gBattleMoves[move].argument == MAX_EFFECT_BYPASS_PROTECT))
return FALSE;

// Max Guard is silly about the moves it blocks, including Teatime.
if (gProtectStructs[battler].maxGuarded && IsMoveBlockedByMaxGuard(move))
return TRUE;
Expand Down

0 comments on commit 57a99e9

Please sign in to comment.