summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraaaaaa123456789 <aaaaaa123456789@acidch.at>2021-11-17 04:02:37 -0300
committeraaaaaa123456789 <aaaaaa123456789@acidch.at>2021-11-17 04:02:37 -0300
commite06363a95e0978193fe585dcd64b6b1074d9bfe6 (patch)
tree7464775ab7366d49f371d96345ea560343ec9672
parent4ca541cca3013062301103d74258af92264f065a (diff)
Revert incorrect changes
-rw-r--r--Smashing-rocks-has-a-chance-to-contain-items.md25
1 files changed, 12 insertions, 13 deletions
diff --git a/Smashing-rocks-has-a-chance-to-contain-items.md b/Smashing-rocks-has-a-chance-to-contain-items.md
index 81af5bc..2bda45f 100644
--- a/Smashing-rocks-has-a-chance-to-contain-items.md
+++ b/Smashing-rocks-has-a-chance-to-contain-items.md
@@ -69,22 +69,21 @@ We have to define `RockItemEncounter`, and a suitable place to put it would be i
+ ret
+
+.RockItems:
-+ db 2 percent, MAX_REVIVE
-+ db 2 percent, THICK_CLUB
-+ db 2 percent, NUGGET
-+ db 2 percent, STAR_PIECE
-+ db 4 percent, BIG_PEARL
-+ db 8 percent, ETHER
-+ db 10 percent, HARD_STONE
-+ db 10 percent, SOFT_SAND
-+ db 20 percent, PEARL
-+ db 25 percent, BRICK_PIECE
++ db 1, MAX_REVIVE
++ db 2, THICK_CLUB
++ db 4, NUGGET
++ db 6, STAR_PIECE
++ db 12, BIG_PEARL
++ db 18, ETHER
++ db 24, HARD_STONE
++ db 24, SOFT_SAND
++ db 48, PEARL
++ db 64, BRICK_PIECE
+ db -1
```
-For starters, `RockItemEncounter` will load the `.RockItems` table into `hl`, and then call `Random`, which will load a random byte (i.e., a value between 0 and 255) in `a`. With this random value generated, it performs comparisons against the probabilities encoded in the `.RockItems` table, picking an item with the listed odds (out of 256: in the example, there's a 2 percent [or 5 in 256] chance of getting a Max Revive, and a 25 percent [or 64 in 256] chance of getting a Brick Piece). For more info about how the `percent` symbol works, go to [macros/data.asm](https://github.com/pret/pokecrystal/blob/master/macros/data.asm).
-
-Since the probabilities in the table add up to less than 100 percent, the `db -1` line at the end indicates the end of the table. If this line is reached, the function will load a 0 (which represents `NO_ITEM`), indicating that the rocks didn't contain an item. If this is the case, the `iffalse .no_item` line in the script will skip giving an item to the player. Otherwise, the selected item, which will have already been loaded into the script variable (`wScriptVar`) by the function, will be awarded to the player by the script.
+For starters, `RockItemEncounter` will load the `.RockItems` table into `hl`, and then call `Random`, which will load a random byte (i.e., a value between 0 and 255) in `a`. With this random value generated, it performs comparisons against the probabilities encoded in the `.RockItems` table, picking an item with the listed odds (out of 256: in the example, there's a 1 in 256 chance of getting a Max Revive, and a 64 in 256 (or 1 in 4) chance of getting a Brick Piece).
+Since the probabilities in the table add up to less than 256, the `db -1` line at the end indicates the end of the table. If this line is reached, the function will load a 0 (which represents `NO_ITEM`), indicating that the rocks didn't contain an item. If this is the case, the `iffalse .no_item` line in the script will skip giving an item to the player. Otherwise, the selected item, which will have already been loaded into the script variable (`wScriptVar`) by the function, will be awarded to the player by the script.
And there you have it, the player can now find items within smashed rocks! You can add your own items and chances by editing the `.RockItems` table in `checkhiddenitems.asm`, or even add something more complex like the Fossils/Old Amber from RBY.