Implemented Retaliate's effect

This commit is contained in:
LOuroboros 2021-10-11 03:16:59 -03:00
parent 6212a3c431
commit 6c550cd749
4 changed files with 10 additions and 1 deletions

View File

@ -908,5 +908,6 @@ 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 gCanRetaliate;
#endif // GUARD_BATTLE_H #endif // GUARD_BATTLE_H

View File

@ -231,6 +231,7 @@ 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 gCanRetaliate = FALSE;
// IWRAM common vars // IWRAM common vars
void (*gPreBattleCallback1)(void); void (*gPreBattleCallback1)(void);
@ -2876,6 +2877,8 @@ static void BattleStartClearSetData(void)
gHasFetchedBall = FALSE; gHasFetchedBall = FALSE;
gLastUsedBall = 0; gLastUsedBall = 0;
gCanRetaliate = FALSE;
gBattlerAttacker = 0; gBattlerAttacker = 0;
gBattlerTarget = 0; gBattlerTarget = 0;
gBattleWeather = 0; gBattleWeather = 0;

View File

@ -3499,6 +3499,7 @@ static void Cmd_tryfaintmon(void)
if (gBattleResults.playerFaintCounter < 0xFF) if (gBattleResults.playerFaintCounter < 0xFF)
gBattleResults.playerFaintCounter++; gBattleResults.playerFaintCounter++;
AdjustFriendshipOnBattleFaint(gActiveBattler); AdjustFriendshipOnBattleFaint(gActiveBattler);
gCanRetaliate = TRUE;
} }
else else
{ {

View File

@ -7933,7 +7933,11 @@ 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:
// todo if (gCanRetaliate)
{
MulModifier(&modifier, UQ_4_12(2.0));
gCanRetaliate = FALSE;
}
break; break;
case EFFECT_SOLARBEAM: case EFFECT_SOLARBEAM:
if (WEATHER_HAS_EFFECT && gBattleWeather & (WEATHER_HAIL_ANY | WEATHER_SANDSTORM_ANY | WEATHER_RAIN_ANY)) if (WEATHER_HAS_EFFECT && gBattleWeather & (WEATHER_HAIL_ANY | WEATHER_SANDSTORM_ANY | WEATHER_RAIN_ANY))