From 81617eb5774dbac030c5a4797120e907b9ec4ff8 Mon Sep 17 00:00:00 2001 From: Eduardo Alvaro Quezada D'Ottone Date: Wed, 15 Apr 2020 08:45:07 -0400 Subject: [PATCH] Overworld effects (#245) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Snow Cloak's overworld effect. (reduces the chance of encountering wild Pokémon on Snow by 50%) * Quick Feet's overworld effect. (reduces the chance of encountering wild Pokémon by 50%) * No Guard's overworld effect. (raises the chance of encountering wild Pokémon by 50%) * Honey Gather. * Checks if honey is defined. * Applied review changes. * Fixed pointer reference * Applied requested changes. * Using weather constants. --- src/battle_script_commands.c | 26 ++++++++++++++++++++++++++ src/wild_encounter.c | 6 ++++++ 2 files changed, 32 insertions(+) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index f292d16d92..b3aaf8647c 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -11030,6 +11030,19 @@ static void Cmd_pickup(void) heldItem = GetBattlePyramidPickupItemId(); SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &heldItem); } + #if (defined ITEM_HONEY) + else if (ability == ABILITY_HONEY_GATHER + && species != 0 + && species != SPECIES_EGG + && heldItem == ITEM_NONE) + { + if ((lvlDivBy10 + 1 ) * 5 > Random() % 100) + { + heldItem = ITEM_HONEY; + SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &heldItem); + } + } + #endif } } else @@ -11070,6 +11083,19 @@ static void Cmd_pickup(void) } } } + #if (defined ITEM_HONEY) + else if (ability == ABILITY_HONEY_GATHER + && species != 0 + && species != SPECIES_EGG + && heldItem == ITEM_NONE) + { + if ((lvlDivBy10 + 1 ) * 5 > Random() % 100) + { + heldItem = ITEM_HONEY; + SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &heldItem); + } + } + #endif } } diff --git a/src/wild_encounter.c b/src/wild_encounter.c index ca488f955c..9d791c34c6 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -496,6 +496,12 @@ static bool8 DoWildEncounterRateTest(u32 encounterRate, bool8 ignoreAbility) encounterRate *= 2; else if (ability == ABILITY_SAND_VEIL && gSaveBlock1Ptr->weather == WEATHER_SANDSTORM) encounterRate /= 2; + else if (ability == ABILITY_SNOW_CLOAK && gSaveBlock1Ptr->weather == WEATHER_SNOW) + encounterRate /= 2; + else if (ability == ABILITY_QUICK_FEET) + encounterRate /= 2; + else if (ability == ABILITY_NO_GUARD) + encounterRate = encounterRate * 3 / 2; } if (encounterRate > 2880) encounterRate = 2880;