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

Fixes dynamax move target and canceling in doubles #3470

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
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
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
Loading