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

View file

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

View file

@ -7933,7 +7933,11 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
MulModifier(&modifier, UQ_4_12(2.0));
break;
case EFFECT_RETALIATE:
// todo
if (gCanRetaliate)
{
MulModifier(&modifier, UQ_4_12(2.0));
gCanRetaliate = FALSE;
}
break;
case EFFECT_SOLARBEAM:
if (WEATHER_HAS_EFFECT && gBattleWeather & (WEATHER_HAIL_ANY | WEATHER_SANDSTORM_ANY | WEATHER_RAIN_ANY))