Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Effects of Pokémon Abilities on Wild Encounter Rate
- In the Pokémon Emerald disassembly:
- https://github.com/pret/pokeemerald/blob/83df84e40623b79281f2397faa611cbf044170bd/src/wild_encounter.c#L509
- if (!ignoreAbility && !GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG))
- {
- u32 ability = GetMonAbility(&gPlayerParty[0]);
- if (ability == ABILITY_STENCH && gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_FLOOR)
- encounterRate = encounterRate * 3 / 4;
- else if (ability == ABILITY_STENCH)
- encounterRate /= 2;
- else if (ability == ABILITY_ILLUMINATE)
- encounterRate *= 2;
- else if (ability == ABILITY_WHITE_SMOKE)
- encounterRate /= 2;
- else if (ability == ABILITY_ARENA_TRAP)
- encounterRate *= 2;
- else if (ability == ABILITY_SAND_VEIL && gSaveBlock1Ptr->weather == WEATHER_SANDSTORM)
- encounterRate /= 2;
- }
- GetMonData() is defined here:
- https://github.com/pret/pokeemerald/blob/83df84e40623b79281f2397faa611cbf044170bd/src/pokemon.c#L3642
- I won't go through much detail but basically the call GetMonData(&mon, field) is dispatched to function GetMonData2(*mon, field) which is an alias for GetMonData3(*mon, field, NULL). GetMonData3() doesn't have a case for MON_DATA_SANITY_IS_EGG so it calls GetBoxMonData(&mon->box, field, data). This function dispatches to GetBoxMonData3() which then returns boxMon->isEgg.
- In other words the if statement from the function from wild_encounter.c can be simplified to:
- if (don't ignore ability && mon isn't egg) {
- if mon's ability is Arena Trap:
- double the encounter rate
- }
- This also applies to all other abilities that raise or lower the encounter rate.
- Interestingly Stench multiplies the encounter rate by 3/4 (round down) only in the Battle Pyramid.
Advertisement
Add Comment
Please, Sign In to add comment