Tweak mega evo to hopefully be compatibile with recorded battles.
This commit is contained in:
parent
1018b8f2a8
commit
abebf479a6
5 changed files with 9 additions and 11 deletions
|
@ -640,4 +640,4 @@
|
|||
|
||||
#define MOVES_COUNT MOVES_COUNT_GEN6
|
||||
|
||||
#endif // GUARD_CONSTANTS_MOVES_H
|
||||
#endif // GUARD_CONSTANTS_MOVES_H
|
||||
|
|
|
@ -1572,7 +1572,7 @@ static void OpponentHandleChooseMove(void)
|
|||
gBattlerTarget = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
|
||||
}
|
||||
if (CanMegaEvolve(gActiveBattler)) // If opponent can mega evolve, do it.
|
||||
BtlController_EmitTwoReturnValues(1, 10 | RET_MEGA_EVOLUTION, (chosenMoveId) | (gBattlerTarget << 8));
|
||||
BtlController_EmitTwoReturnValues(1, 10, (chosenMoveId) | (RET_MEGA_EVOLUTION) | (gBattlerTarget << 8));
|
||||
else
|
||||
BtlController_EmitTwoReturnValues(1, 10, (chosenMoveId) | (gBattlerTarget << 8));
|
||||
break;
|
||||
|
|
|
@ -387,7 +387,7 @@ static void HandleInputChooseTarget(void)
|
|||
PlaySE(SE_SELECT);
|
||||
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C;
|
||||
if (gBattleStruct->playerMegaEvoSelect)
|
||||
BtlController_EmitTwoReturnValues(1, 10 | RET_MEGA_EVOLUTION, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8));
|
||||
BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | RET_MEGA_EVOLUTION | (gMultiUsePlayerCursor << 8));
|
||||
else
|
||||
BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8));
|
||||
EndBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX);
|
||||
|
@ -544,7 +544,7 @@ static void HandleInputChooseMove(void)
|
|||
if (!canSelectTarget)
|
||||
{
|
||||
if (gBattleStruct->playerMegaEvoSelect)
|
||||
BtlController_EmitTwoReturnValues(1, 10 | RET_MEGA_EVOLUTION, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8));
|
||||
BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | RET_MEGA_EVOLUTION | (gMultiUsePlayerCursor << 8));
|
||||
else
|
||||
BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8));
|
||||
PlayerBufferExecCompleted();
|
||||
|
|
|
@ -4382,12 +4382,9 @@ static void HandleTurnActionSelectionState(void)
|
|||
case STATE_WAIT_ACTION_CASE_CHOSEN:
|
||||
if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF0000000) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 0xC))))
|
||||
{
|
||||
bool32 shouldMegaEvolve;
|
||||
switch (gChosenActionByBattler[gActiveBattler])
|
||||
{
|
||||
case B_ACTION_USE_MOVE:
|
||||
shouldMegaEvolve = gBattleBufferB[gActiveBattler][1] & RET_MEGA_EVOLUTION;
|
||||
gBattleBufferB[gActiveBattler][1] &= ~(RET_MEGA_EVOLUTION);
|
||||
switch (gBattleBufferB[gActiveBattler][1])
|
||||
{
|
||||
case 3:
|
||||
|
@ -4426,10 +4423,10 @@ static void HandleTurnActionSelectionState(void)
|
|||
RecordedBattle_SetBattlerAction(gActiveBattler, gBattleBufferB[gActiveBattler][2]);
|
||||
RecordedBattle_SetBattlerAction(gActiveBattler, gBattleBufferB[gActiveBattler][3]);
|
||||
}
|
||||
*(gBattleStruct->chosenMovePositions + gActiveBattler) = gBattleBufferB[gActiveBattler][2];
|
||||
*(gBattleStruct->chosenMovePositions + gActiveBattler) = gBattleBufferB[gActiveBattler][2] & ~(RET_MEGA_EVOLUTION);
|
||||
gChosenMoveByBattler[gActiveBattler] = gBattleMons[gActiveBattler].moves[*(gBattleStruct->chosenMovePositions + gActiveBattler)];
|
||||
*(gBattleStruct->moveTarget + gActiveBattler) = gBattleBufferB[gActiveBattler][3];
|
||||
if (shouldMegaEvolve)
|
||||
if (gBattleBufferB[gActiveBattler][2] & RET_MEGA_EVOLUTION)
|
||||
gBattleStruct->toMegaEvolve |= gBitTable[gActiveBattler];
|
||||
gBattleCommunication[gActiveBattler]++;
|
||||
}
|
||||
|
|
|
@ -604,7 +604,8 @@ static bool32 IsHealBlockPreventingMove(u8 battler, u32 move)
|
|||
u8 TrySetCantSelectMoveBattleScript(void)
|
||||
{
|
||||
u8 limitations = 0;
|
||||
u32 move = gBattleMons[gActiveBattler].moves[gBattleBufferB[gActiveBattler][2]];
|
||||
u8 moveId = gBattleBufferB[gActiveBattler][2] & ~(RET_MEGA_EVOLUTION);
|
||||
u32 move = gBattleMons[gActiveBattler].moves[moveId];
|
||||
u32 holdEffect = GetBattlerHoldEffect(gActiveBattler, TRUE);
|
||||
u16* choicedMove = &gBattleStruct->choicedMove[gActiveBattler];
|
||||
|
||||
|
@ -729,7 +730,7 @@ u8 TrySetCantSelectMoveBattleScript(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (gBattleMons[gActiveBattler].pp[gBattleBufferB[gActiveBattler][2]] == 0)
|
||||
if (gBattleMons[gActiveBattler].pp[moveId] == 0)
|
||||
{
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue