| Blah |
October 2nd, 2015 6:50 AM |
To be specific, these are the values and calculations for Fire Red which I've found.
Code:
rand(100) = n
{n ∈ ℕ : n < 100} = { 0, 1, 2, 3, ..., 99}
zero :rand(100) - 0 < 20 = 0 to 19 = 20%
one :rand(100) - 20 <= 19 = 20 to 39 = 20%
two :rand(100) - 40 <= 9 = 40 to 49 = 10%
three :rand(100) - 50 <= 9 = 50 to 59 = 10%
four :rand(100) - 60 <= 9 = 60 to 69 = 10%
five :rand(100) - 70 <= 9 = 70 to 79 = 10%
six :rand(100) - 80 <= 4 = 80 to 84 = 5%
seven :rand(100) - 85 <= 4 = 85 to 89 = 5%
eight :rand(100) - 90 <= 3 = 90 to 93 = 4%
nine :rand(100) - 94 <= 3 = 94 to 97 = 4%
ten :rand(100) - 98 > 0 = 99 to 100 = 1%
eleven :rand(100) - 98 = 0 = 98 to 98 = 1%
Code:
ROM:0808274C wild_pokemon_rand_grass: @ CODE XREF: sub_8082AEC:loc_8082B16p
ROM:0808274C @ wild_pokemon_rand_for_map:loc_8083060p
ROM:0808274C PUSH {LR}
ROM:0808274E BL rand
ROM:08082752 LSLS R0, R0, #0x10
ROM:08082754 LSRS R0, R0, #0x10
ROM:08082756 MOVS R1, #0x64 @ 'd'
ROM:08082758 BL __umodsi3
ROM:0808275C LSLS R0, R0, #0x18
ROM:0808275E LSRS R1, R0, #0x18
ROM:08082760 CMP R1, #0x13
ROM:08082762 BHI loc_8082768
ROM:08082764 MOVS R0, #0
ROM:08082766 B loc_8082802
ROM:08082768 @ ---------------------------------------------------------------------------
ROM:08082768
ROM:08082768 loc_8082768: @ CODE XREF: wild_pokemon_rand_grass+16j
ROM:08082768 MOVS R0, R1
ROM:0808276A SUBS R0, #0x14
ROM:0808276C LSLS R0, R0, #0x18
ROM:0808276E LSRS R0, R0, #0x18
ROM:08082770 CMP R0, #0x13
ROM:08082772 BHI loc_8082778
ROM:08082774 MOVS R0, #1
ROM:08082776 B loc_8082802
ROM:08082778 @ ---------------------------------------------------------------------------
ROM:08082778
ROM:08082778 loc_8082778: @ CODE XREF: wild_pokemon_rand_grass+26j
ROM:08082778 MOVS R0, R1
ROM:0808277A SUBS R0, #0x28 @ '('
ROM:0808277C LSLS R0, R0, #0x18
ROM:0808277E LSRS R0, R0, #0x18
ROM:08082780 CMP R0, #9
ROM:08082782 BHI loc_8082788
ROM:08082784 MOVS R0, #2
ROM:08082786 B loc_8082802
ROM:08082788 @ ---------------------------------------------------------------------------
ROM:08082788
ROM:08082788 loc_8082788: @ CODE XREF: wild_pokemon_rand_grass+36j
ROM:08082788 MOVS R0, R1
ROM:0808278A SUBS R0, #0x32 @ '2'
ROM:0808278C LSLS R0, R0, #0x18
ROM:0808278E LSRS R0, R0, #0x18
ROM:08082790 CMP R0, #9
ROM:08082792 BHI loc_8082798
ROM:08082794 MOVS R0, #3
ROM:08082796 B loc_8082802
ROM:08082798 @ ---------------------------------------------------------------------------
ROM:08082798
ROM:08082798 loc_8082798: @ CODE XREF: wild_pokemon_rand_grass+46j
ROM:08082798 MOVS R0, R1
ROM:0808279A SUBS R0, #0x3C @ '<'
ROM:0808279C LSLS R0, R0, #0x18
ROM:0808279E LSRS R0, R0, #0x18
ROM:080827A0 CMP R0, #9
ROM:080827A2 BHI loc_80827A8
ROM:080827A4 MOVS R0, #4
ROM:080827A6 B loc_8082802
ROM:080827A8 @ ---------------------------------------------------------------------------
ROM:080827A8
ROM:080827A8 loc_80827A8: @ CODE XREF: wild_pokemon_rand_grass+56j
ROM:080827A8 MOVS R0, R1
ROM:080827AA SUBS R0, #0x46 @ 'F'
ROM:080827AC LSLS R0, R0, #0x18
ROM:080827AE LSRS R0, R0, #0x18
ROM:080827B0 CMP R0, #9
ROM:080827B2 BHI loc_80827B8
ROM:080827B4 MOVS R0, #5
ROM:080827B6 B loc_8082802
ROM:080827B8 @ ---------------------------------------------------------------------------
ROM:080827B8
ROM:080827B8 loc_80827B8: @ CODE XREF: wild_pokemon_rand_grass+66j
ROM:080827B8 MOVS R0, R1
ROM:080827BA SUBS R0, #0x50 @ 'P'
ROM:080827BC LSLS R0, R0, #0x18
ROM:080827BE LSRS R0, R0, #0x18
ROM:080827C0 CMP R0, #4
ROM:080827C2 BHI loc_80827C8
ROM:080827C4 MOVS R0, #6
ROM:080827C6 B loc_8082802
ROM:080827C8 @ ---------------------------------------------------------------------------
ROM:080827C8
ROM:080827C8 loc_80827C8: @ CODE XREF: wild_pokemon_rand_grass+76j
ROM:080827C8 MOVS R0, R1
ROM:080827CA SUBS R0, #0x55 @ 'U'
ROM:080827CC LSLS R0, R0, #0x18
ROM:080827CE LSRS R0, R0, #0x18
ROM:080827D0 CMP R0, #4
ROM:080827D2 BHI loc_80827D8
ROM:080827D4 MOVS R0, #7
ROM:080827D6 B loc_8082802
ROM:080827D8 @ ---------------------------------------------------------------------------
ROM:080827D8
ROM:080827D8 loc_80827D8: @ CODE XREF: wild_pokemon_rand_grass+86j
ROM:080827D8 MOVS R0, R1
ROM:080827DA SUBS R0, #0x5A @ 'Z'
ROM:080827DC LSLS R0, R0, #0x18
ROM:080827DE LSRS R0, R0, #0x18
ROM:080827E0 CMP R0, #3
ROM:080827E2 BHI loc_80827E8
ROM:080827E4 MOVS R0, #8
ROM:080827E6 B loc_8082802
ROM:080827E8 @ ---------------------------------------------------------------------------
ROM:080827E8
ROM:080827E8 loc_80827E8: @ CODE XREF: wild_pokemon_rand_grass+96j
ROM:080827E8 MOVS R0, R1
ROM:080827EA SUBS R0, #0x5E @ '^'
ROM:080827EC LSLS R0, R0, #0x18
ROM:080827EE LSRS R0, R0, #0x18
ROM:080827F0 CMP R0, #3
ROM:080827F2 BHI loc_80827F8
ROM:080827F4 MOVS R0, #9
ROM:080827F6 B loc_8082802
ROM:080827F8 @ ---------------------------------------------------------------------------
ROM:080827F8
ROM:080827F8 loc_80827F8: @ CODE XREF: wild_pokemon_rand_grass+A6j
ROM:080827F8 CMP R1, #0x62 @ 'b'
ROM:080827FA BEQ loc_8082800
ROM:080827FC MOVS R0, #0xB
ROM:080827FE B loc_8082802
ROM:08082800 @ ---------------------------------------------------------------------------
ROM:08082800
ROM:08082800 loc_8082800: @ CODE XREF: wild_pokemon_rand_grass+AEj
ROM:08082800 MOVS R0, #0xA
ROM:08082802
ROM:08082802 loc_8082802: @ CODE XREF: wild_pokemon_rand_grass+1Aj
ROM:08082802 @ wild_pokemon_rand_grass+2Aj ...
ROM:08082802 POP {R1}
ROM:08082804 BX R1
The encounter ratio in Advance Map is just an encounter ratio for when to do a wild battle, rather than the Pokemon's encounter ratios. These encounter ratios, as you see, are hard coded. It wouldn't be hard at all to expand this into map specific values. I'd hook right before this is called and compare the map values before deciding how to roll it.
|