xhydrochaeris

Effects of Pokémon Abilities on Wild Encounter Rate

Jul 23rd, 2026
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. Effects of Pokémon Abilities on Wild Encounter Rate
  2.  
  3. In the Pokémon Emerald disassembly:
  4. https://github.com/pret/pokeemerald/blob/83df84e40623b79281f2397faa611cbf044170bd/src/wild_encounter.c#L509
  5.  
  6. if (!ignoreAbility && !GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG))
  7. {
  8. u32 ability = GetMonAbility(&gPlayerParty[0]);
  9.  
  10. if (ability == ABILITY_STENCH && gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_FLOOR)
  11. encounterRate = encounterRate * 3 / 4;
  12. else if (ability == ABILITY_STENCH)
  13. encounterRate /= 2;
  14. else if (ability == ABILITY_ILLUMINATE)
  15. encounterRate *= 2;
  16. else if (ability == ABILITY_WHITE_SMOKE)
  17. encounterRate /= 2;
  18. else if (ability == ABILITY_ARENA_TRAP)
  19. encounterRate *= 2;
  20. else if (ability == ABILITY_SAND_VEIL && gSaveBlock1Ptr->weather == WEATHER_SANDSTORM)
  21. encounterRate /= 2;
  22. }
  23.  
  24. GetMonData() is defined here:
  25. https://github.com/pret/pokeemerald/blob/83df84e40623b79281f2397faa611cbf044170bd/src/pokemon.c#L3642
  26.  
  27. 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.
  28.  
  29. In other words the if statement from the function from wild_encounter.c can be simplified to:
  30. if (don't ignore ability && mon isn't egg) {
  31. if mon's ability is Arena Trap:
  32. double the encounter rate
  33. }
  34.  
  35. This also applies to all other abilities that raise or lower the encounter rate.
  36.  
  37. 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