aboutsummaryrefslogtreecommitdiffstats
path: root/engine/battle/wild_encounters.asm
diff options
context:
space:
mode:
authordannye <33dannye@gmail.com>2020-11-04 00:06:44 -0600
committerdannye <33dannye@gmail.com>2020-11-04 00:06:44 -0600
commit5647ca687b92954dcf37a6ea6bfbc9a341c32de4 (patch)
treedde1937a1bfdb3a835f4155e1c2eb8f1aaf86f63 /engine/battle/wild_encounters.asm
parentMerge pull request #55 from Deokishisu/patch-1 (diff)
downloadpokeyellow-5647ca687b92954dcf37a6ea6bfbc9a341c32de4.tar.gz
pokeyellow-5647ca687b92954dcf37a6ea6bfbc9a341c32de4.tar.xz
pokeyellow-5647ca687b92954dcf37a6ea6bfbc9a341c32de4.zip
Sync with pokered
Diffstat (limited to 'engine/battle/wild_encounters.asm')
-rw-r--r--engine/battle/wild_encounters.asm32
1 files changed, 9 insertions, 23 deletions
diff --git a/engine/battle/wild_encounters.asm b/engine/battle/wild_encounters.asm
index 0285346e..d16c6515 100644
--- a/engine/battle/wild_encounters.asm
+++ b/engine/battle/wild_encounters.asm
@@ -7,14 +7,14 @@ TryDoWildEncounter:
ld a, [wd736]
and a
ret nz
- callab IsPlayerStandingOnDoorTileOrWarpTile
+ callfar IsPlayerStandingOnDoorTileOrWarpTile
jr nc, .notStandingOnDoorOrWarpTile
.CantEncounter
ld a, $1
and a
ret
.notStandingOnDoorOrWarpTile
- callab IsPlayerJustOutsideMap
+ callfar IsPlayerJustOutsideMap
jr z, .CantEncounter
ld a, [wRepelRemainingSteps]
and a
@@ -26,7 +26,7 @@ TryDoWildEncounter:
; determine if wild pokemon can appear in the half-block we're standing in
; is the bottom left tile (8,9) of the half-block we're standing in a grass/water tile?
; note that by using the bottom left tile, this prevents the "left-shore" tiles from generating grass encounters
- coord hl, 8, 9
+ hlcoord 8, 9
ld c, [hl]
ld a, [wGrassTile]
cp c
@@ -40,7 +40,7 @@ TryDoWildEncounter:
; so long as the map is "indoor" and has wild pokemon defined.
; ...as long as it's not Viridian Forest or Safari Zone.
ld a, [wCurMap]
- cp REDS_HOUSE_1F ; is this an indoor map?
+ cp FIRST_INDOOR_MAP ; is this an indoor map?
jr c, .CantEncounter2
ld a, [wCurMapTileset]
cp FOREST ; Viridian Forest/Safari Zone
@@ -49,10 +49,10 @@ TryDoWildEncounter:
.CanEncounter
; compare encounter chance with a random number to determine if there will be an encounter
ld b, a
- ld a, [hRandomAdd]
+ ldh a, [hRandomAdd]
cp b
jr nc, .CantEncounter2
- ld a, [hRandomSub]
+ ldh a, [hRandomSub]
ld b, a
ld hl, WildMonEncounterSlotChances
.determineEncounterSlot
@@ -65,7 +65,7 @@ TryDoWildEncounter:
; determine which wild pokemon (grass or water) can appear in the half-block we're standing in
ld c, [hl]
ld hl, wGrassMons
- aCoord 8, 9
+ lda_coord 8, 9
cp $14 ; is the bottom left tile (8,9) of the half-block we're standing in a water tile?
jr nz, .gotWildEncounterType ; else, it's treated as a grass tile by default
ld hl, wWaterMons
@@ -89,7 +89,7 @@ TryDoWildEncounter:
.lastRepelStep
ld [wRepelRemainingSteps], a
ld a, TEXT_REPEL_WORE_OFF
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call EnableAutoTextBoxDrawing
call DisplayTextID
.CantEncounter2
@@ -100,18 +100,4 @@ TryDoWildEncounter:
xor a
ret
-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 $32, $00 ; 51/256 = 19.9% chance of slot 0
- db $65, $02 ; 51/256 = 19.9% chance of slot 1
- db $8C, $04 ; 39/256 = 15.2% chance of slot 2
- db $A5, $06 ; 25/256 = 9.8% chance of slot 3
- db $BE, $08 ; 25/256 = 9.8% chance of slot 4
- db $D7, $0A ; 25/256 = 9.8% chance of slot 5
- db $E4, $0C ; 13/256 = 5.1% chance of slot 6
- db $F1, $0E ; 13/256 = 5.1% chance of slot 7
- db $FC, $10 ; 11/256 = 4.3% chance of slot 8
- db $FF, $12 ; 3/256 = 1.2% chance of slot 9
+INCLUDE "data/wild/probabilities.asm"