diff options
author | libjet <libj3t@gmail.com> | 2020-05-21 15:30:00 +0100 |
---|---|---|
committer | libjet <libj3t@gmail.com> | 2020-05-21 15:30:00 +0100 |
commit | 625ec0e794b44f4c8430d3ac0c66a753389ae910 (patch) | |
tree | b196fa999f0b35bb8276e940ce1fcd81be6d2e8e /engine | |
parent | 878867473621c53c6bd54ee19462d4e493b96ffb (diff) |
Add engine/events/sweet_scent.asm
Diffstat (limited to 'engine')
-rwxr-xr-x | engine/events/sweet_scent.asm | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/engine/events/sweet_scent.asm b/engine/events/sweet_scent.asm new file mode 100755 index 00000000..9b99a256 --- /dev/null +++ b/engine/events/sweet_scent.asm @@ -0,0 +1,65 @@ +SweetScentFromMenu: + ld hl, .SweetScent + call QueueScript + ld a, $1 + ld [wFieldMoveSucceeded], a + ret + +.SweetScent: + reloadmappart + special UpdateTimePals + callasm GetPartyNick + writetext UseSweetScentText + waitbutton + callasm SweetScentEncounter + iffalse SweetScentNothing + checkflag ENGINE_BUG_CONTEST_TIMER + iftrue .BugCatchingContest + randomwildmon + startbattle + reloadmapafterbattle + end + +.BugCatchingContest: + farsjump BugCatchingContestBattleScript + +SweetScentNothing: + writetext SweetScentNothingText + waitbutton + closetext + end + +SweetScentEncounter: + farcall CanUseSweetScent + jr nc, .no_battle + ld hl, wStatusFlags2 + bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl] + jr nz, .not_in_bug_contest + farcall GetMapEncounterRate + ld a, b + and a + jr z, .no_battle + farcall ChooseWildEncounter + jr nz, .no_battle + jr .start_battle + +.not_in_bug_contest + farcall ChooseWildEncounter_BugContest + +.start_battle + ld a, $1 + ld [wScriptVar], a + ret + +.no_battle + xor a + ld [wScriptVar], a + ret + +UseSweetScentText: + text_far _UseSweetScentText + text_end + +SweetScentNothingText: + text_far _SweetScentNothingText + text_end |