mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +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 IS_LAST_USED_LURE(var) (var & REPEL_LURE_MASK)
|
||||
#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 REPEL_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_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
|
||||
|
@ -47,7 +47,7 @@
|
||||
|
||||
// general purpose vars
|
||||
#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_STARTER_MON 0x4023 // 0=Treecko, 1=Torchic, 2=Mudkip
|
||||
#define VAR_MIRAGE_RND_H 0x4024
|
||||
|
@ -848,7 +848,7 @@ static void RemoveUsedItem(void)
|
||||
|
||||
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;
|
||||
else if (!InBattlePyramid())
|
||||
DisplayItemMessage(taskId, FONT_NORMAL, gText_RepelEffectsLingered, CloseItemMessage);
|
||||
@ -872,7 +872,7 @@ static void Task_UseRepel(u8 taskId)
|
||||
{
|
||||
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
|
||||
VarSet(I_VAR_LAST_REPEL_LURE_USED, gSpecialVar_ItemId);
|
||||
#endif
|
||||
@ -886,13 +886,13 @@ static void Task_UseRepel(u8 taskId)
|
||||
void HandleUseExpiredRepel(void)
|
||||
{
|
||||
#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
|
||||
}
|
||||
|
||||
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;
|
||||
else if (!InBattlePyramid())
|
||||
DisplayItemMessage(taskId, FONT_NORMAL, gText_LureEffectsLingered, CloseItemMessage);
|
||||
@ -916,7 +916,7 @@ static void Task_UseLure(u8 taskId)
|
||||
{
|
||||
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
|
||||
VarSet(I_VAR_LAST_REPEL_LURE_USED, gSpecialVar_ItemId);
|
||||
#endif
|
||||
@ -931,7 +931,7 @@ static void Task_UseLure(u8 taskId)
|
||||
void HandleUseExpiredLure(void)
|
||||
{
|
||||
#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
|
||||
}
|
||||
|
||||
|
@ -3308,6 +3308,8 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
|
||||
|
||||
if (CheckBagHasItem(ITEM_SHINY_CHARM, 1))
|
||||
totalRerolls += I_SHINY_CHARM_REROLLS;
|
||||
if (LURE_STEP_COUNT != 0)
|
||||
totalRerolls += 1;
|
||||
|
||||
while (GET_SHINY_VALUE(value, personality) >= SHINY_ODDS && totalRerolls > 0)
|
||||
{
|
||||
|
@ -212,7 +212,7 @@ static u8 ChooseWildMonIndex_Land(void)
|
||||
else
|
||||
wildMonIndex = 11;
|
||||
|
||||
if (LURE_STEPS(VarGet(VAR_REPEL_LURE_STEP_COUNT)) && (Random() % 10 < 2))
|
||||
if (LURE_STEP_COUNT != 0 && (Random() % 10 < 2))
|
||||
swap = TRUE;
|
||||
|
||||
if (swap)
|
||||
@ -239,7 +239,7 @@ static u8 ChooseWildMonIndex_WaterRock(void)
|
||||
else
|
||||
wildMonIndex = 4;
|
||||
|
||||
if (LURE_STEPS(VarGet(VAR_REPEL_LURE_STEP_COUNT)) && (Random() % 10 < 2))
|
||||
if (LURE_STEP_COUNT != 0 && (Random() % 10 < 2))
|
||||
swap = TRUE;
|
||||
|
||||
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),
|
||||
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;
|
||||
|
||||
switch (rod)
|
||||
@ -556,7 +556,7 @@ static bool8 DoWildEncounterRateTest(u32 encounterRate, bool8 ignoreAbility)
|
||||
encounterRate = encounterRate * 80 / 100;
|
||||
ApplyFluteEncounterRateMod(&encounterRate);
|
||||
ApplyCleanseTagEncounterRateMod(&encounterRate);
|
||||
if (LURE_STEPS(VarGet(VAR_REPEL_LURE_STEP_COUNT)) != 0)
|
||||
if (LURE_STEP_COUNT != 0)
|
||||
encounterRate *= 2;
|
||||
if (!ignoreAbility && !GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG))
|
||||
{
|
||||
@ -929,7 +929,7 @@ u16 GetLocalWaterMon(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);
|
||||
bool32 isLure = IS_LAST_USED_LURE(repelLureVar);
|
||||
|
||||
@ -943,7 +943,7 @@ bool8 UpdateRepelCounter(void)
|
||||
steps--;
|
||||
if (!isLure)
|
||||
{
|
||||
VarSet(VAR_REPEL_LURE_STEP_COUNT, steps);
|
||||
VarSet(VAR_REPEL_STEP_COUNT, steps);
|
||||
if (steps == 0)
|
||||
{
|
||||
ScriptContext_SetupScript(EventScript_RepelWoreOff);
|
||||
@ -952,7 +952,7 @@ bool8 UpdateRepelCounter(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
VarSet(VAR_REPEL_LURE_STEP_COUNT, steps | REPEL_LURE_MASK);
|
||||
VarSet(VAR_REPEL_STEP_COUNT, steps | REPEL_LURE_MASK);
|
||||
if (steps == 0)
|
||||
{
|
||||
ScriptContext_SetupScript(EventScript_LureWoreOff);
|
||||
@ -968,7 +968,7 @@ static bool8 IsWildLevelAllowedByRepel(u8 wildLevel)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
if (!REPEL_STEPS(VarGet(VAR_REPEL_LURE_STEP_COUNT)))
|
||||
if (!REPEL_STEP_COUNT)
|
||||
return TRUE;
|
||||
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
|
Loading…
Reference in New Issue
Block a user