mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 19:54:21 +01:00
Added shiny rerolls to Lures + reverted repel var name
This commit is contained in:
parent
e3005e5275
commit
0944232059
@ -19,7 +19,7 @@
|
|||||||
#define REPEL_LURE_MASK (1 << 15)
|
#define REPEL_LURE_MASK (1 << 15)
|
||||||
#define IS_LAST_USED_LURE(var) (var & REPEL_LURE_MASK)
|
#define IS_LAST_USED_LURE(var) (var & REPEL_LURE_MASK)
|
||||||
#define REPEL_LURE_STEPS(var) (var & (REPEL_LURE_MASK - 1))
|
#define REPEL_LURE_STEPS(var) (var & (REPEL_LURE_MASK - 1))
|
||||||
#define LURE_STEPS(var) (IS_LAST_USED_LURE(var) ? REPEL_LURE_STEPS(var) : 0)
|
#define LURE_STEP_COUNT (IS_LAST_USED_LURE(VarGet(VAR_REPEL_STEP_COUNT)) ? REPEL_LURE_STEPS(VarGet(VAR_REPEL_STEP_COUNT)) : 0)
|
||||||
#define REPEL_STEPS(var) (!IS_LAST_USED_LURE(var) ? REPEL_LURE_STEPS(var) : 0)
|
#define REPEL_STEP_COUNT (!IS_LAST_USED_LURE(VarGet(VAR_REPEL_STEP_COUNT)) ? REPEL_LURE_STEPS(VarGet(VAR_REPEL_STEP_COUNT)) : 0)
|
||||||
|
|
||||||
#endif // GUARD_ITEM_CONSTANTS_H
|
#endif // GUARD_ITEM_CONSTANTS_H
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
// general purpose vars
|
// general purpose vars
|
||||||
#define VAR_RECYCLE_GOODS 0x4020
|
#define VAR_RECYCLE_GOODS 0x4020
|
||||||
#define VAR_REPEL_LURE_STEP_COUNT 0x4021
|
#define VAR_REPEL_STEP_COUNT 0x4021
|
||||||
#define VAR_ICE_STEP_COUNT 0x4022
|
#define VAR_ICE_STEP_COUNT 0x4022
|
||||||
#define VAR_STARTER_MON 0x4023 // 0=Treecko, 1=Torchic, 2=Mudkip
|
#define VAR_STARTER_MON 0x4023 // 0=Treecko, 1=Torchic, 2=Mudkip
|
||||||
#define VAR_MIRAGE_RND_H 0x4024
|
#define VAR_MIRAGE_RND_H 0x4024
|
||||||
|
@ -848,7 +848,7 @@ static void RemoveUsedItem(void)
|
|||||||
|
|
||||||
void ItemUseOutOfBattle_Repel(u8 taskId)
|
void ItemUseOutOfBattle_Repel(u8 taskId)
|
||||||
{
|
{
|
||||||
if (REPEL_STEPS(VarGet(VAR_REPEL_LURE_STEP_COUNT)) == 0)
|
if (REPEL_STEP_COUNT == 0)
|
||||||
gTasks[taskId].func = Task_StartUseRepel;
|
gTasks[taskId].func = Task_StartUseRepel;
|
||||||
else if (!InBattlePyramid())
|
else if (!InBattlePyramid())
|
||||||
DisplayItemMessage(taskId, FONT_NORMAL, gText_RepelEffectsLingered, CloseItemMessage);
|
DisplayItemMessage(taskId, FONT_NORMAL, gText_RepelEffectsLingered, CloseItemMessage);
|
||||||
@ -872,7 +872,7 @@ static void Task_UseRepel(u8 taskId)
|
|||||||
{
|
{
|
||||||
if (!IsSEPlaying())
|
if (!IsSEPlaying())
|
||||||
{
|
{
|
||||||
VarSet(VAR_REPEL_LURE_STEP_COUNT, ItemId_GetHoldEffectParam(gSpecialVar_ItemId));
|
VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(gSpecialVar_ItemId));
|
||||||
#if I_VAR_LAST_REPEL_LURE_USED != 0
|
#if I_VAR_LAST_REPEL_LURE_USED != 0
|
||||||
VarSet(I_VAR_LAST_REPEL_LURE_USED, gSpecialVar_ItemId);
|
VarSet(I_VAR_LAST_REPEL_LURE_USED, gSpecialVar_ItemId);
|
||||||
#endif
|
#endif
|
||||||
@ -886,13 +886,13 @@ static void Task_UseRepel(u8 taskId)
|
|||||||
void HandleUseExpiredRepel(void)
|
void HandleUseExpiredRepel(void)
|
||||||
{
|
{
|
||||||
#if I_VAR_LAST_REPEL_LURE_USED != 0
|
#if I_VAR_LAST_REPEL_LURE_USED != 0
|
||||||
VarSet(VAR_REPEL_LURE_STEP_COUNT, ItemId_GetHoldEffectParam(VarGet(I_VAR_LAST_REPEL_LURE_USED)));
|
VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(VarGet(I_VAR_LAST_REPEL_LURE_USED)));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemUseOutOfBattle_Lure(u8 taskId)
|
void ItemUseOutOfBattle_Lure(u8 taskId)
|
||||||
{
|
{
|
||||||
if (LURE_STEPS(VarGet(VAR_REPEL_LURE_STEP_COUNT)) == 0)
|
if (LURE_STEP_COUNT == 0)
|
||||||
gTasks[taskId].func = Task_StartUseLure;
|
gTasks[taskId].func = Task_StartUseLure;
|
||||||
else if (!InBattlePyramid())
|
else if (!InBattlePyramid())
|
||||||
DisplayItemMessage(taskId, FONT_NORMAL, gText_LureEffectsLingered, CloseItemMessage);
|
DisplayItemMessage(taskId, FONT_NORMAL, gText_LureEffectsLingered, CloseItemMessage);
|
||||||
@ -916,7 +916,7 @@ static void Task_UseLure(u8 taskId)
|
|||||||
{
|
{
|
||||||
if (!IsSEPlaying())
|
if (!IsSEPlaying())
|
||||||
{
|
{
|
||||||
VarSet(VAR_REPEL_LURE_STEP_COUNT, ItemId_GetHoldEffectParam(gSpecialVar_ItemId) | REPEL_LURE_MASK);
|
VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(gSpecialVar_ItemId) | REPEL_LURE_MASK);
|
||||||
#if I_VAR_LAST_REPEL_LURE_USED != 0
|
#if I_VAR_LAST_REPEL_LURE_USED != 0
|
||||||
VarSet(I_VAR_LAST_REPEL_LURE_USED, gSpecialVar_ItemId);
|
VarSet(I_VAR_LAST_REPEL_LURE_USED, gSpecialVar_ItemId);
|
||||||
#endif
|
#endif
|
||||||
@ -931,7 +931,7 @@ static void Task_UseLure(u8 taskId)
|
|||||||
void HandleUseExpiredLure(void)
|
void HandleUseExpiredLure(void)
|
||||||
{
|
{
|
||||||
#if I_VAR_LAST_REPEL_LURE_USED != 0
|
#if I_VAR_LAST_REPEL_LURE_USED != 0
|
||||||
VarSet(VAR_REPEL_LURE_STEP_COUNT, ItemId_GetHoldEffectParam(VarGet(I_VAR_LAST_REPEL_LURE_USED)) | REPEL_LURE_MASK);
|
VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(VarGet(I_VAR_LAST_REPEL_LURE_USED)) | REPEL_LURE_MASK);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3308,6 +3308,8 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
|
|||||||
|
|
||||||
if (CheckBagHasItem(ITEM_SHINY_CHARM, 1))
|
if (CheckBagHasItem(ITEM_SHINY_CHARM, 1))
|
||||||
totalRerolls += I_SHINY_CHARM_REROLLS;
|
totalRerolls += I_SHINY_CHARM_REROLLS;
|
||||||
|
if (LURE_STEP_COUNT != 0)
|
||||||
|
totalRerolls += 1;
|
||||||
|
|
||||||
while (GET_SHINY_VALUE(value, personality) >= SHINY_ODDS && totalRerolls > 0)
|
while (GET_SHINY_VALUE(value, personality) >= SHINY_ODDS && totalRerolls > 0)
|
||||||
{
|
{
|
||||||
|
@ -212,7 +212,7 @@ static u8 ChooseWildMonIndex_Land(void)
|
|||||||
else
|
else
|
||||||
wildMonIndex = 11;
|
wildMonIndex = 11;
|
||||||
|
|
||||||
if (LURE_STEPS(VarGet(VAR_REPEL_LURE_STEP_COUNT)) && (Random() % 10 < 2))
|
if (LURE_STEP_COUNT != 0 && (Random() % 10 < 2))
|
||||||
swap = TRUE;
|
swap = TRUE;
|
||||||
|
|
||||||
if (swap)
|
if (swap)
|
||||||
@ -239,7 +239,7 @@ static u8 ChooseWildMonIndex_WaterRock(void)
|
|||||||
else
|
else
|
||||||
wildMonIndex = 4;
|
wildMonIndex = 4;
|
||||||
|
|
||||||
if (LURE_STEPS(VarGet(VAR_REPEL_LURE_STEP_COUNT)) && (Random() % 10 < 2))
|
if (LURE_STEP_COUNT != 0 && (Random() % 10 < 2))
|
||||||
swap = TRUE;
|
swap = TRUE;
|
||||||
|
|
||||||
if (swap)
|
if (swap)
|
||||||
@ -256,7 +256,7 @@ static u8 ChooseWildMonIndex_Fishing(u8 rod)
|
|||||||
u8 rand = Random() % max(max(ENCOUNTER_CHANCE_FISHING_MONS_OLD_ROD_TOTAL, ENCOUNTER_CHANCE_FISHING_MONS_GOOD_ROD_TOTAL),
|
u8 rand = Random() % max(max(ENCOUNTER_CHANCE_FISHING_MONS_OLD_ROD_TOTAL, ENCOUNTER_CHANCE_FISHING_MONS_GOOD_ROD_TOTAL),
|
||||||
ENCOUNTER_CHANCE_FISHING_MONS_SUPER_ROD_TOTAL);
|
ENCOUNTER_CHANCE_FISHING_MONS_SUPER_ROD_TOTAL);
|
||||||
|
|
||||||
if (LURE_STEPS(VarGet(VAR_REPEL_LURE_STEP_COUNT)) && (Random() % 10 < 2))
|
if (LURE_STEP_COUNT != 0 && (Random() % 10 < 2))
|
||||||
swap = TRUE;
|
swap = TRUE;
|
||||||
|
|
||||||
switch (rod)
|
switch (rod)
|
||||||
@ -556,7 +556,7 @@ static bool8 DoWildEncounterRateTest(u32 encounterRate, bool8 ignoreAbility)
|
|||||||
encounterRate = encounterRate * 80 / 100;
|
encounterRate = encounterRate * 80 / 100;
|
||||||
ApplyFluteEncounterRateMod(&encounterRate);
|
ApplyFluteEncounterRateMod(&encounterRate);
|
||||||
ApplyCleanseTagEncounterRateMod(&encounterRate);
|
ApplyCleanseTagEncounterRateMod(&encounterRate);
|
||||||
if (LURE_STEPS(VarGet(VAR_REPEL_LURE_STEP_COUNT)) != 0)
|
if (LURE_STEP_COUNT != 0)
|
||||||
encounterRate *= 2;
|
encounterRate *= 2;
|
||||||
if (!ignoreAbility && !GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG))
|
if (!ignoreAbility && !GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG))
|
||||||
{
|
{
|
||||||
@ -929,7 +929,7 @@ u16 GetLocalWaterMon(void)
|
|||||||
|
|
||||||
bool8 UpdateRepelCounter(void)
|
bool8 UpdateRepelCounter(void)
|
||||||
{
|
{
|
||||||
u16 repelLureVar = VarGet(VAR_REPEL_LURE_STEP_COUNT);
|
u16 repelLureVar = VarGet(VAR_REPEL_STEP_COUNT);
|
||||||
u16 steps = REPEL_LURE_STEPS(repelLureVar);
|
u16 steps = REPEL_LURE_STEPS(repelLureVar);
|
||||||
bool32 isLure = IS_LAST_USED_LURE(repelLureVar);
|
bool32 isLure = IS_LAST_USED_LURE(repelLureVar);
|
||||||
|
|
||||||
@ -943,7 +943,7 @@ bool8 UpdateRepelCounter(void)
|
|||||||
steps--;
|
steps--;
|
||||||
if (!isLure)
|
if (!isLure)
|
||||||
{
|
{
|
||||||
VarSet(VAR_REPEL_LURE_STEP_COUNT, steps);
|
VarSet(VAR_REPEL_STEP_COUNT, steps);
|
||||||
if (steps == 0)
|
if (steps == 0)
|
||||||
{
|
{
|
||||||
ScriptContext_SetupScript(EventScript_RepelWoreOff);
|
ScriptContext_SetupScript(EventScript_RepelWoreOff);
|
||||||
@ -952,7 +952,7 @@ bool8 UpdateRepelCounter(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VarSet(VAR_REPEL_LURE_STEP_COUNT, steps | REPEL_LURE_MASK);
|
VarSet(VAR_REPEL_STEP_COUNT, steps | REPEL_LURE_MASK);
|
||||||
if (steps == 0)
|
if (steps == 0)
|
||||||
{
|
{
|
||||||
ScriptContext_SetupScript(EventScript_LureWoreOff);
|
ScriptContext_SetupScript(EventScript_LureWoreOff);
|
||||||
@ -968,7 +968,7 @@ static bool8 IsWildLevelAllowedByRepel(u8 wildLevel)
|
|||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
|
|
||||||
if (!REPEL_STEPS(VarGet(VAR_REPEL_LURE_STEP_COUNT)))
|
if (!REPEL_STEP_COUNT)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
for (i = 0; i < PARTY_SIZE; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user