Fixes dynamax move target and canceling in doubles (#3470)

This commit is contained in:
Alex 2023-10-27 15:38:40 +02:00 committed by GitHub
parent b5607209f3
commit 57a99e9be6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 11 deletions

View file

@ -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;

View file

@ -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);
@ -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]))
{

View file

@ -322,7 +322,6 @@ void HandleAction_UseMove(void)
gCurrentMove = gBattleStruct->zmove.toBeUsed[gBattlerAttacker];
}
moveTarget = GetBattlerMoveTargetType(gBattlerAttacker, gCurrentMove);
if (gBattleMons[gBattlerAttacker].hp != 0)
{
@ -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)
@ -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;