Turned Retaliate into a side timer

This commit is contained in:
LOuroboros 2021-10-16 05:41:50 -03:00
parent 2bf8022673
commit 3b6ceb1dfa
5 changed files with 11 additions and 5 deletions

View file

@ -210,6 +210,7 @@ struct SideTimer
u8 tailwindBattlerId;
u8 luckyChantTimer;
u8 luckyChantBattlerId;
u8 retaliateTimer;
};
struct FieldTimer

View file

@ -220,7 +220,6 @@
#define SIDE_STATUS_WIDE_GUARD (1 << 19)
#define SIDE_STATUS_CRAFTY_SHIELD (1 << 20)
#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_SCREEN_ANY (SIDE_STATUS_REFLECT | SIDE_STATUS_LIGHTSCREEN | SIDE_STATUS_AURORA_VEIL)

View file

@ -3583,7 +3583,6 @@ static void HandleEndTurn_ContinueBattle(void)
gBattleMons[i].status2 &= ~(STATUS2_FLINCHED);
if ((gBattleMons[i].status1 & STATUS1_SLEEP) && (gBattleMons[i].status2 & STATUS2_MULTIPLETURNS))
CancelMultiTurnMoves(i);
gSideStatuses[GET_BATTLER_SIDE(i)] &= ~SIDE_STATUS_RETALIATE;
}
gBattleStruct->turnEffectsTracker = 0;
gBattleStruct->turnEffectsBattlerId = 0;

View file

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

View file

@ -1881,6 +1881,7 @@ enum
ENDTURN_PSYCHIC_TERRAIN,
ENDTURN_ION_DELUGE,
ENDTURN_FAIRY_LOCK,
ENDTURN_RETALIATE,
ENDTURN_FIELD_COUNT,
};
@ -2312,6 +2313,12 @@ u8 DoFieldEndTurnEffects(void)
}
gBattleStruct->turnCountersTracker++;
break;
case ENDTURN_RETALIATE:
gActiveBattler = gBattlerByTurnOrder[gBattleStruct->turnSideTracker];
if (gSideTimers[GET_BATTLER_SIDE(gActiveBattler)].retaliateTimer > 0)
gSideTimers[GET_BATTLER_SIDE(gActiveBattler)].retaliateTimer--;
gBattleStruct->turnCountersTracker++;
break;
case ENDTURN_FIELD_COUNT:
effect++;
break;
@ -7934,7 +7941,7 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
MulModifier(&modifier, UQ_4_12(2.0));
break;
case EFFECT_RETALIATE:
if (gSideStatuses[atkSide] & SIDE_STATUS_RETALIATE)
if (gSideTimers[atkSide].retaliateTimer == 1)
MulModifier(&modifier, UQ_4_12(2.0));
break;
case EFFECT_SOLARBEAM: