diff options
| author | Engezerstorung <154867622+Engezerstorung@users.noreply.github.com> | 2026-01-17 22:42:57 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-17 16:42:57 -0500 |
| commit | c4f02f18deacba07cb51213af49c2c03cdc4daf2 (patch) | |
| tree | 60a9e827b1af23fe2578d5577de78352f1fab282 /data | |
| parent | Use map names with `ToggleData*` symbols (#563) (diff) | |
| download | pokeyellow-c4f02f18deacba07cb51213af49c2c03cdc4daf2.tar.gz pokeyellow-c4f02f18deacba07cb51213af49c2c03cdc4daf2.tar.xz pokeyellow-c4f02f18deacba07cb51213af49c2c03cdc4daf2.zip | |
Use macros for `WildMonEncounterSlotChances` (#562)
Diffstat (limited to 'data')
| -rw-r--r-- | data/wild/probabilities.asm | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/data/wild/probabilities.asm b/data/wild/probabilities.asm index 2c56c6b9..6896d937 100644 --- a/data/wild/probabilities.asm +++ b/data/wild/probabilities.asm @@ -1,15 +1,28 @@ +DEF wild_chance_slot = 0 +DEF wild_chance_total = 0 + +MACRO wild_chance + DEF wild_chance_total += \1 + db wild_chance_total - 1 + db wild_chance_slot * 2 + DEF wild_chance_slot += 1 +ENDM + WildMonEncounterSlotChances: -; There are 10 slots for wild pokemon, and this is the table that defines how common each of -; those 10 slots is. A random number is generated and then the first byte of each pair in this -; table is compared against that random number. If the random number is less than or equal -; to the first byte, then that slot is chosen. The second byte is double the slot number. - db 50, $00 ; 51/256 = 19.9% chance of slot 0 - db 101, $02 ; 51/256 = 19.9% chance of slot 1 - db 140, $04 ; 39/256 = 15.2% chance of slot 2 - db 165, $06 ; 25/256 = 9.8% chance of slot 3 - db 190, $08 ; 25/256 = 9.8% chance of slot 4 - db 215, $0A ; 25/256 = 9.8% chance of slot 5 - db 228, $0C ; 13/256 = 5.1% chance of slot 6 - db 241, $0E ; 13/256 = 5.1% chance of slot 7 - db 252, $10 ; 11/256 = 4.3% chance of slot 8 - db 255, $12 ; 3/256 = 1.2% chance of slot 9 +; There are 10 slots for wild pokemon, and this is the list that defines how common each of +; those 10 slots is. A random number is generated and then the cumulative chance value up to the current +; slot (included) is compared against that random number. If the random number is less than or equal +; to said cumulative value, then that slot is chosen. + table_width 2 + wild_chance 51 ; 51/256 = 19.9% chance of slot 0 + wild_chance 51 ; 51/256 = 19.9% chance of slot 1 + wild_chance 39 ; 39/256 = 15.2% chance of slot 2 + wild_chance 25 ; 25/256 = 9.8% chance of slot 3 + wild_chance 25 ; 25/256 = 9.8% chance of slot 4 + wild_chance 25 ; 25/256 = 9.8% chance of slot 5 + wild_chance 13 ; 13/256 = 5.1% chance of slot 6 + wild_chance 13 ; 13/256 = 5.1% chance of slot 7 + wild_chance 11 ; 11/256 = 4.3% chance of slot 8 + wild_chance 3 ; 3/256 = 1.2% chance of slot 9 + assert_table_length NUM_WILDMONS + ASSERT wild_chance_total == 256, "WildMonEncounterSlotChances sum to {d:wild_chance_total}, not 256!" |
