Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ChooseWildEncounter_BugContest::
- ; Pick a random mon out of ContestMons.
- .loop
- call Random
- cp 100 << 1
- jr nc, .loop
- srl a
- ld hl, ContestMons
- ld de, 4
- .CheckMon:
- sub [hl]
- jr c, .GotMon
- add hl, de
- jr .CheckMon
- .GotMon:
- inc hl
- ; Species
- ld a, [hli]
- ld [wTempWildMonSpecies], a
- ; Min level
- ld a, [hli]
- ld d, a
- ; Max level
- ld a, [hl]
- sub d
- jr nz, .RandomLevel
- ; If min and max are the same.
- ld a, d
- jr .GotLevel
- .RandomLevel:
- ; Get a random level between the min and max.
- ld c, a
- inc c
- call Random
- ldh a, [hRandomAdd]
- call SimpleDivide
- add d
- .GotLevel:
- ld [wCurPartyLevel], a
- xor a
- ret
- TryWildEncounter_BugContest:
- ld a, [wPlayerStandingTile]
- call CheckSuperTallGrassTile
- ld b, 40 percent
- jr z, .ok
- ld b, 20 percent
- .ok
- farcall ApplyMusicEffectOnEncounterRate
- farcall ApplyCleanseTagEffectOnEncounterRate
- call Random
- ldh a, [hRandomAdd]
- cp b
- ret c
- ld a, 1
- and a
- ret
- INCLUDE "data/wild/bug_contest_mons.asm"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement