Oops, I forgot to take the opponent's side into account

This commit is contained in:
LOuroboros 2021-10-15 05:02:14 -03:00
parent 6c550cd749
commit 1f97198267
4 changed files with 13 additions and 6 deletions

View File

@ -908,6 +908,7 @@ extern u8 gBattleControllerData[MAX_BATTLERS_COUNT];
extern bool8 gHasFetchedBall;
extern u8 gLastUsedBall;
extern u16 gLastThrownBall;
extern bool8 gCanRetaliate;
extern bool8 gCanPlayerRetaliate;
extern bool8 gCanOpponentRetaliate;
#endif // GUARD_BATTLE_H

View File

@ -231,7 +231,8 @@ EWRAM_DATA struct TotemBoost gTotemBoosts[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA bool8 gHasFetchedBall = FALSE;
EWRAM_DATA u8 gLastUsedBall = 0;
EWRAM_DATA u16 gLastThrownBall = 0;
EWRAM_DATA bool8 gCanRetaliate = FALSE;
EWRAM_DATA bool8 gCanPlayerRetaliate = FALSE;
EWRAM_DATA bool8 gCanOpponentRetaliate = FALSE;
// IWRAM common vars
void (*gPreBattleCallback1)(void);
@ -2877,7 +2878,8 @@ static void BattleStartClearSetData(void)
gHasFetchedBall = FALSE;
gLastUsedBall = 0;
gCanRetaliate = FALSE;
gCanPlayerRetaliate = FALSE;
gCanOpponentRetaliate = FALSE;
gBattlerAttacker = 0;
gBattlerTarget = 0;

View File

@ -3499,13 +3499,14 @@ static void Cmd_tryfaintmon(void)
if (gBattleResults.playerFaintCounter < 0xFF)
gBattleResults.playerFaintCounter++;
AdjustFriendshipOnBattleFaint(gActiveBattler);
gCanRetaliate = TRUE;
gCanPlayerRetaliate = TRUE;
}
else
{
if (gBattleResults.opponentFaintCounter < 0xFF)
gBattleResults.opponentFaintCounter++;
gBattleResults.lastOpponentSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES, NULL);
gCanOpponentRetaliate = TRUE;
}
if ((gHitMarker & HITMARKER_DESTINYBOND) && gBattleMons[gBattlerAttacker].hp != 0)
{

View File

@ -7933,10 +7933,13 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
MulModifier(&modifier, UQ_4_12(2.0));
break;
case EFFECT_RETALIATE:
if (gCanRetaliate)
if (gCanPlayerRetaliate || gCanOpponentRetaliate)
{
MulModifier(&modifier, UQ_4_12(2.0));
gCanRetaliate = FALSE;
if (gCanPlayerRetaliate)
gCanPlayerRetaliate = FALSE;
else if (gCanOpponentRetaliate)
gCanOpponentRetaliate = FALSE;
}
break;
case EFFECT_SOLARBEAM: