mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
32ed487a47
# Conflicts: # audio/engine.asm # constants/gfx_constants.asm # constants/map_data_constants.asm # constants/pokemon_data_constants.asm # constants/sprite_constants.asm # constants/wram_constants.asm # data/maps/data.asm # engine/battle/ai/scoring.asm # engine/battle/core.asm # engine/battle/effect_commands.asm # engine/battle/misc.asm # engine/battle_anims/getpokeballwobble.asm # engine/breeding.asm # engine/buy_sell_toss.asm # engine/decorations.asm # engine/events/battle_tower/battle_tower.asm # engine/events/battle_tower/rules.asm # engine/events/buena.asm # engine/events/bug_contest/contest_2.asm # engine/events/daycare.asm # engine/events/dratini.asm # engine/events/halloffame.asm # engine/events/happiness_egg.asm # engine/events/kurt.asm # engine/events/lucky_number.asm # engine/events/magnet_train.asm # engine/events/overworld.asm # engine/events/pokerus/pokerus.asm # engine/events/print_unown.asm # engine/events/print_unown_2.asm # engine/events/unown_walls.asm # engine/item_effects.asm # engine/link.asm # engine/mon_menu.asm # engine/player_object.asm # engine/routines/playslowcry.asm # engine/scripting.asm # engine/search.asm # engine/search2.asm # engine/specials.asm # engine/start_menu.asm # engine/timeset.asm # home/battle_vars.asm # home/map.asm # maps/GoldenrodUndergroundSwitchRoomEntrances.asm # maps/IlexForest.asm # maps/KrissHouse2F.asm # maps/Route39Barn.asm # mobile/mobile_12_2.asm # mobile/mobile_40.asm # mobile/mobile_5f.asm # wram.asm
134 lines
1.7 KiB
NASM
134 lines
1.7 KiB
NASM
Fish: ; 92402
|
|
; Using a fishing rod.
|
|
; Fish for monsters with rod e in encounter group d.
|
|
; Return monster e at level d.
|
|
|
|
push af
|
|
push bc
|
|
push hl
|
|
|
|
ld b, e
|
|
call GetFishGroupIndex
|
|
|
|
ld hl, FishGroups
|
|
rept 7
|
|
add hl, de
|
|
endr
|
|
call .Fish
|
|
|
|
pop hl
|
|
pop bc
|
|
pop af
|
|
ret
|
|
; 9241a
|
|
|
|
|
|
.Fish: ; 9241a
|
|
; Fish for monsters with rod b from encounter data in FishGroup at hl.
|
|
; Return monster e at level d.
|
|
|
|
call Random
|
|
cp [hl]
|
|
jr nc, .no_bite
|
|
|
|
; Get encounter data by rod:
|
|
; 0: Old
|
|
; 1: Good
|
|
; 2: Super
|
|
inc hl
|
|
ld e, b
|
|
ld d, 0
|
|
add hl, de
|
|
add hl, de
|
|
ld a, [hli]
|
|
ld h, [hl]
|
|
ld l, a
|
|
|
|
; Compare the encounter chance to select a Pokemon.
|
|
call Random
|
|
.loop
|
|
cp [hl]
|
|
jr z, .ok
|
|
jr c, .ok
|
|
inc hl
|
|
inc hl
|
|
inc hl
|
|
jr .loop
|
|
.ok
|
|
inc hl
|
|
|
|
; Species 0 reads from a time-based encounter table.
|
|
ld a, [hli]
|
|
ld d, a
|
|
and a
|
|
call z, .TimeEncounter
|
|
|
|
ld e, [hl]
|
|
ret
|
|
|
|
.no_bite
|
|
ld de, 0
|
|
ret
|
|
|
|
.TimeEncounter:
|
|
; The level byte is repurposed as the index for the new table.
|
|
ld e, [hl]
|
|
ld d, 0
|
|
ld hl, TimeFishGroups
|
|
rept 4
|
|
add hl, de
|
|
endr
|
|
|
|
ld a, [wTimeOfDay]
|
|
maskbits NUM_DAYTIMES
|
|
cp NITE_F
|
|
jr c, .time_species
|
|
inc hl
|
|
inc hl
|
|
|
|
.time_species
|
|
ld d, [hl]
|
|
inc hl
|
|
ret
|
|
; 9245b
|
|
|
|
|
|
GetFishGroupIndex: ; 9245b
|
|
; Return the index of fishgroup d in de.
|
|
|
|
push hl
|
|
ld hl, wDailyFlags
|
|
bit DAILYFLAGS_FISH_SWARM_F, [hl]
|
|
pop hl
|
|
jr z, .done
|
|
|
|
ld a, d
|
|
cp FISHGROUP_QWILFISH
|
|
jr z, .qwilfish
|
|
cp FISHGROUP_REMORAID
|
|
jr z, .remoraid
|
|
|
|
.done
|
|
dec d
|
|
ld e, d
|
|
ld d, 0
|
|
ret
|
|
|
|
.qwilfish
|
|
ld a, [wFishingSwarmFlag]
|
|
cp FISHSWARM_QWILFISH
|
|
jr nz, .done
|
|
ld d, FISHGROUP_QWILFISH_SWARM
|
|
jr .done
|
|
|
|
.remoraid
|
|
ld a, [wFishingSwarmFlag]
|
|
cp FISHSWARM_REMORAID
|
|
jr nz, .done
|
|
ld d, FISHGROUP_REMORAID_SWARM
|
|
jr .done
|
|
; 92488
|
|
|
|
|
|
INCLUDE "data/wild/fish.asm"
|