Turned Retaliate's effect into a side status

This commit is contained in:
LOuroboros 2021-10-15 06:00:24 -03:00
parent 1f97198267
commit 3a25bce185
5 changed files with 6 additions and 14 deletions

View File

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

View File

@ -220,6 +220,7 @@
#define SIDE_STATUS_WIDE_GUARD (1 << 19) #define SIDE_STATUS_WIDE_GUARD (1 << 19)
#define SIDE_STATUS_CRAFTY_SHIELD (1 << 20) #define SIDE_STATUS_CRAFTY_SHIELD (1 << 20)
#define SIDE_STATUS_MAT_BLOCK (1 << 21) #define SIDE_STATUS_MAT_BLOCK (1 << 21)
#define SIDE_STATUS_RETALIATE (1 << 22)
#define SIDE_STATUS_HAZARDS_ANY (SIDE_STATUS_SPIKES | SIDE_STATUS_STICKY_WEB | SIDE_STATUS_TOXIC_SPIKES | SIDE_STATUS_STEALTH_ROCK) #define SIDE_STATUS_HAZARDS_ANY (SIDE_STATUS_SPIKES | SIDE_STATUS_STICKY_WEB | SIDE_STATUS_TOXIC_SPIKES | SIDE_STATUS_STEALTH_ROCK)
#define SIDE_STATUS_SCREEN_ANY (SIDE_STATUS_REFLECT | SIDE_STATUS_LIGHTSCREEN | SIDE_STATUS_AURORA_VEIL) #define SIDE_STATUS_SCREEN_ANY (SIDE_STATUS_REFLECT | SIDE_STATUS_LIGHTSCREEN | SIDE_STATUS_AURORA_VEIL)

View File

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

View File

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

View File

@ -7681,6 +7681,7 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
u16 basePower = CalcMoveBasePower(move, battlerAtk, battlerDef); u16 basePower = CalcMoveBasePower(move, battlerAtk, battlerDef);
u16 holdEffectModifier; u16 holdEffectModifier;
u16 modifier = UQ_4_12(1.0); u16 modifier = UQ_4_12(1.0);
u32 atkSide = GET_BATTLER_SIDE(battlerAtk);
// attacker's abilities // attacker's abilities
switch (GetBattlerAbility(battlerAtk)) switch (GetBattlerAbility(battlerAtk))
@ -7933,13 +7934,10 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
MulModifier(&modifier, UQ_4_12(2.0)); MulModifier(&modifier, UQ_4_12(2.0));
break; break;
case EFFECT_RETALIATE: case EFFECT_RETALIATE:
if (gCanPlayerRetaliate || gCanOpponentRetaliate) if (gSideStatuses[atkSide] & SIDE_STATUS_RETALIATE)
{ {
MulModifier(&modifier, UQ_4_12(2.0)); MulModifier(&modifier, UQ_4_12(2.0));
if (gCanPlayerRetaliate) gSideStatuses[atkSide] &= ~SIDE_STATUS_RETALIATE;
gCanPlayerRetaliate = FALSE;
else if (gCanOpponentRetaliate)
gCanOpponentRetaliate = FALSE;
} }
break; break;
case EFFECT_SOLARBEAM: case EFFECT_SOLARBEAM: