mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-18 01:14:19 +01:00
Merge pull request #1918 from kleeenexfeu/be_mega_evo_alter_turn
Mega Evolution alters turn order
This commit is contained in:
commit
3404039330
@ -92,6 +92,9 @@
|
|||||||
#define GEN_8 5
|
#define GEN_8 5
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Mega Evolution settings
|
||||||
|
#define B_MEGA_EVO_TURN_ORDER GEN_7 // In Gen7, a Pokémon's Speed after Mega Evolution is used to determine turn order, not its Speed before.
|
||||||
|
|
||||||
// Calculation settings
|
// Calculation settings
|
||||||
#define B_CRIT_CHANCE GEN_7 // Chances of a critical hit landing. See CalcCritChanceStage.
|
#define B_CRIT_CHANCE GEN_7 // Chances of a critical hit landing. See CalcCritChanceStage.
|
||||||
#define B_CRIT_MULTIPLIER GEN_7 // In Gen6+, critical hits multiply damage by 1.5 instead of 2.
|
#define B_CRIT_MULTIPLIER GEN_7 // In Gen6+, critical hits multiply damage by 1.5 instead of 2.
|
||||||
|
@ -104,6 +104,7 @@ static void RunTurnActionsFunctions(void);
|
|||||||
static void SetActionsAndBattlersTurnOrder(void);
|
static void SetActionsAndBattlersTurnOrder(void);
|
||||||
static void sub_803CDF8(void);
|
static void sub_803CDF8(void);
|
||||||
static bool8 AllAtActionConfirmed(void);
|
static bool8 AllAtActionConfirmed(void);
|
||||||
|
static void TryChangeTurnOrder(void);
|
||||||
static void CheckFocusPunch_ClearVarsBeforeTurnStarts(void);
|
static void CheckFocusPunch_ClearVarsBeforeTurnStarts(void);
|
||||||
static void CheckMegaEvolutionBeforeTurn(void);
|
static void CheckMegaEvolutionBeforeTurn(void);
|
||||||
static void CheckQuickClaw_CustapBerryActivation(void);
|
static void CheckQuickClaw_CustapBerryActivation(void);
|
||||||
@ -4688,10 +4689,37 @@ static void CheckMegaEvolutionBeforeTurn(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if B_MEGA_EVO_TURN_ORDER <= GEN_6
|
||||||
|
gBattleMainFunc = CheckFocusPunch_ClearVarsBeforeTurnStarts;
|
||||||
|
gBattleStruct->focusPunchBattlerId = 0;
|
||||||
|
#else
|
||||||
|
gBattleMainFunc = TryChangeTurnOrder; // This will just do nothing if no mon has mega evolved
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// In gen7, priority and speed are recalculated during the turn in which a pokemon mega evolves
|
||||||
|
static void TryChangeTurnOrder(void)
|
||||||
|
{
|
||||||
|
s32 i, j;
|
||||||
|
for (i = 0; i < gBattlersCount - 1; i++)
|
||||||
|
{
|
||||||
|
for (j = i + 1; j < gBattlersCount; j++)
|
||||||
|
{
|
||||||
|
u8 battler1 = gBattlerByTurnOrder[i];
|
||||||
|
u8 battler2 = gBattlerByTurnOrder[j];
|
||||||
|
if (gActionsByTurnOrder[i] == B_ACTION_USE_MOVE
|
||||||
|
&& gActionsByTurnOrder[j] == B_ACTION_USE_MOVE)
|
||||||
|
{
|
||||||
|
if (GetWhoStrikesFirst(battler1, battler2, FALSE))
|
||||||
|
SwapTurnOrder(i, j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
gBattleMainFunc = CheckFocusPunch_ClearVarsBeforeTurnStarts;
|
gBattleMainFunc = CheckFocusPunch_ClearVarsBeforeTurnStarts;
|
||||||
gBattleStruct->focusPunchBattlerId = 0;
|
gBattleStruct->focusPunchBattlerId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void CheckFocusPunch_ClearVarsBeforeTurnStarts(void)
|
static void CheckFocusPunch_ClearVarsBeforeTurnStarts(void)
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user