pokered/scripts/FightingDojo.asm

298 lines
6 KiB
NASM
Raw Normal View History

FightingDojo_Script:
2014-05-18 18:19:10 +00:00
call EnableAutoTextBoxDrawing
ld hl, FightingDojoTrainerHeaders
ld de, FightingDojo_ScriptPointers
2015-08-31 02:38:41 +00:00
ld a, [wFightingDojoCurScript]
2014-05-18 18:19:10 +00:00
call ExecuteCurMapScriptInTable
2015-08-31 02:38:41 +00:00
ld [wFightingDojoCurScript], a
2014-05-18 18:19:10 +00:00
ret
2016-06-12 00:24:04 +00:00
FightingDojoScript_5cd70:
2014-05-18 18:19:10 +00:00
xor a
ld [wJoyIgnore], a
2015-08-31 02:38:41 +00:00
ld [wFightingDojoCurScript], a
ld [wCurMapScript], a
2014-05-18 18:19:10 +00:00
ret
FightingDojo_ScriptPointers:
2014-05-18 18:19:10 +00:00
dw FightingDojoScript1
2014-09-14 18:29:18 +00:00
dw DisplayEnemyTrainerTextAndStartBattle
2014-05-18 18:19:10 +00:00
dw EndTrainerBattle
dw FightingDojoScript3
2016-06-12 00:24:04 +00:00
FightingDojoScript1:
2015-07-21 17:36:03 +00:00
CheckEvent EVENT_DEFEATED_FIGHTING_DOJO
2014-05-18 18:19:10 +00:00
ret nz
call CheckFightingMapTrainers
ld a, [wTrainerHeaderFlagBit]
and a
ret nz
2015-07-21 17:36:03 +00:00
CheckEvent EVENT_BEAT_KARATE_MASTER
2014-05-18 18:19:10 +00:00
ret nz
xor a
ldh [hJoyHeld], a
ld [wcf0d], a
2015-08-31 02:38:41 +00:00
ld a, [wYCoord]
cp 3
2014-05-18 18:19:10 +00:00
ret nz
2015-08-31 02:38:41 +00:00
ld a, [wXCoord]
cp 4
2014-05-18 18:19:10 +00:00
ret nz
ld a, $1
ld [wcf0d], a
2015-07-20 00:52:26 +00:00
ld a, PLAYER_DIR_RIGHT
ld [wPlayerMovingDirection], a
2014-05-18 18:19:10 +00:00
ld a, $1
ldh [hSpriteIndex], a
ld a, SPRITE_FACING_LEFT
ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
2014-05-18 18:19:10 +00:00
ld a, $1
ldh [hSpriteIndexOrTextID], a
2014-05-18 18:19:10 +00:00
call DisplayTextID
ret
2016-06-12 00:24:04 +00:00
FightingDojoScript3:
2015-08-31 02:38:41 +00:00
ld a, [wIsInBattle]
2014-05-18 18:19:10 +00:00
cp $ff
jp z, FightingDojoScript_5cd70
ld a, [wcf0d]
2014-05-18 18:19:10 +00:00
and a
jr z, .asm_5cde4
2015-07-20 00:52:26 +00:00
ld a, PLAYER_DIR_RIGHT
ld [wPlayerMovingDirection], a
2014-05-18 18:19:10 +00:00
ld a, $1
ldh [hSpriteIndex], a
ld a, SPRITE_FACING_LEFT
ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
2014-05-18 18:19:10 +00:00
.asm_5cde4
ld a, $f0
ld [wJoyIgnore], a
2015-07-21 17:36:03 +00:00
SetEventRange EVENT_BEAT_KARATE_MASTER, EVENT_BEAT_FIGHTING_DOJO_TRAINER_3
2014-05-18 18:19:10 +00:00
ld a, $8
ldh [hSpriteIndexOrTextID], a
2014-05-18 18:19:10 +00:00
call DisplayTextID
xor a
ld [wJoyIgnore], a
2015-08-31 02:38:41 +00:00
ld [wFightingDojoCurScript], a
ld [wCurMapScript], a
2014-05-18 18:19:10 +00:00
ret
FightingDojo_TextPointers:
2014-05-18 18:19:10 +00:00
dw FightingDojoText1
dw FightingDojoText2
dw FightingDojoText3
dw FightingDojoText4
dw FightingDojoText5
dw FightingDojoText6
dw FightingDojoText7
dw FightingDojoText8
FightingDojoTrainerHeaders:
def_trainers 2
2016-06-12 00:24:04 +00:00
FightingDojoTrainerHeader0:
trainer EVENT_BEAT_FIGHTING_DOJO_TRAINER_0, 4, FightingDojoBattleText1, FightingDojoEndBattleText1, FightingDojoAfterBattleText1
2016-06-12 00:24:04 +00:00
FightingDojoTrainerHeader1:
trainer EVENT_BEAT_FIGHTING_DOJO_TRAINER_1, 4, FightingDojoBattleText2, FightingDojoEndBattleText2, FightingDojoAfterBattleText2
2016-06-12 00:24:04 +00:00
FightingDojoTrainerHeader2:
trainer EVENT_BEAT_FIGHTING_DOJO_TRAINER_2, 3, FightingDojoBattleText3, FightingDojoEndBattleText3, FightingDojoAfterBattleText3
2016-06-12 00:24:04 +00:00
FightingDojoTrainerHeader3:
trainer EVENT_BEAT_FIGHTING_DOJO_TRAINER_3, 3, FightingDojoBattleText4, FightingDojoEndBattleText4, FightingDojoAfterBattleText4
db -1 ; end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
FightingDojoText1:
text_asm
2015-07-21 17:36:03 +00:00
CheckEvent EVENT_DEFEATED_FIGHTING_DOJO
2014-05-18 18:19:10 +00:00
jp nz, .continue1
2015-07-21 17:36:03 +00:00
CheckEventReuseA EVENT_BEAT_KARATE_MASTER
2014-05-18 18:19:10 +00:00
jp nz, .continue2
ld hl, FightingDojoText_5ce8e
call PrintText
ld hl, wd72d
2014-05-18 18:19:10 +00:00
set 6, [hl]
set 7, [hl]
ld hl, FightingDojoText_5ce93
ld de, FightingDojoText_5ce93
2014-09-14 18:29:18 +00:00
call SaveEndBattleTextPointers
ldh a, [hSpriteIndexOrTextID]
2014-09-13 07:50:56 +00:00
ld [wSpriteIndex], a
2014-05-18 18:19:10 +00:00
call EngageMapTrainer
call InitBattleEnemyParameters
ld a, $3
2015-08-31 02:38:41 +00:00
ld [wFightingDojoCurScript], a
ld [wCurMapScript], a
jr .asm_9dba4
.continue1
2014-05-18 18:19:10 +00:00
ld hl, FightingDojoText_5ce9d
call PrintText
jr .asm_9dba4
.continue2
2014-05-18 18:19:10 +00:00
ld hl, FightingDojoText8
call PrintText
.asm_9dba4
2014-05-18 18:19:10 +00:00
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
FightingDojoText_5ce8e:
text_far _FightingDojoText_5ce8e
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
FightingDojoText_5ce93:
text_far _FightingDojoText_5ce93
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
FightingDojoText8:
text_far _FightingDojoText_5ce98
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
FightingDojoText_5ce9d:
text_far _FightingDojoText_5ce9d
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
FightingDojoText2:
text_asm
2014-05-18 18:19:10 +00:00
ld hl, FightingDojoTrainerHeader0
call TalkToTrainer
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
FightingDojoBattleText1:
text_far _FightingDojoBattleText1
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
FightingDojoEndBattleText1:
text_far _FightingDojoEndBattleText1
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
FightingDojoAfterBattleText1:
text_far _FightingDojoAfterBattleText1
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
FightingDojoText3:
text_asm
2014-05-18 18:19:10 +00:00
ld hl, FightingDojoTrainerHeader1
call TalkToTrainer
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
FightingDojoBattleText2:
text_far _FightingDojoBattleText2
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
FightingDojoEndBattleText2:
text_far _FightingDojoEndBattleText2
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
FightingDojoAfterBattleText2:
text_far _FightingDojoAfterBattleText2
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
FightingDojoText4:
text_asm
2014-05-18 18:19:10 +00:00
ld hl, FightingDojoTrainerHeader2
call TalkToTrainer
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
FightingDojoBattleText3:
text_far _FightingDojoBattleText3
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
FightingDojoEndBattleText3:
text_far _FightingDojoEndBattleText3
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
FightingDojoAfterBattleText3:
text_far _FightingDojoAfterBattleText3
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
FightingDojoText5:
text_asm
2014-05-18 18:19:10 +00:00
ld hl, FightingDojoTrainerHeader3
call TalkToTrainer
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
FightingDojoBattleText4:
text_far _FightingDojoBattleText4
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
FightingDojoEndBattleText4:
text_far _FightingDojoEndBattleText4
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
FightingDojoAfterBattleText4:
text_far _FightingDojoAfterBattleText4
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
FightingDojoText6:
2014-05-18 18:19:10 +00:00
; Hitmonlee Poké Ball
text_asm
2015-07-21 17:36:03 +00:00
CheckEitherEventSet EVENT_GOT_HITMONLEE, EVENT_GOT_HITMONCHAN
2014-05-18 18:19:10 +00:00
jr z, .GetMon
ld hl, OtherHitmonText
call PrintText
jr .done
.GetMon
ld a, HITMONLEE
call DisplayPokedex
ld hl, WantHitmonleeText
call PrintText
call YesNoChoice
ld a, [wCurrentMenuItem]
2014-05-18 18:19:10 +00:00
and a
jr nz, .done
ld a, [wcf91]
2014-05-18 18:19:10 +00:00
ld b, a
ld c, 30
call GivePokemon
jr nc, .done
; once Poké Ball is taken, hide sprite
ld a, HS_FIGHTING_DOJO_GIFT_1
2015-07-25 03:27:59 +00:00
ld [wMissableObjectIndex], a
predef HideObject
2015-07-21 17:36:03 +00:00
SetEvents EVENT_GOT_HITMONLEE, EVENT_DEFEATED_FIGHTING_DOJO
2014-05-18 18:19:10 +00:00
.done
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
WantHitmonleeText:
text_far _WantHitmonleeText
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
FightingDojoText7:
2014-05-18 18:19:10 +00:00
; Hitmonchan Poké Ball
text_asm
2015-07-21 17:36:03 +00:00
CheckEitherEventSet EVENT_GOT_HITMONLEE, EVENT_GOT_HITMONCHAN
2014-05-18 18:19:10 +00:00
jr z, .GetMon
ld hl, OtherHitmonText
call PrintText
jr .done
.GetMon
ld a, HITMONCHAN
call DisplayPokedex
ld hl, WantHitmonchanText
call PrintText
call YesNoChoice
ld a, [wCurrentMenuItem]
2014-05-18 18:19:10 +00:00
and a
jr nz, .done
ld a, [wcf91]
2014-05-18 18:19:10 +00:00
ld b, a
ld c, 30
2014-05-18 18:19:10 +00:00
call GivePokemon
jr nc, .done
2015-07-21 17:36:03 +00:00
SetEvents EVENT_GOT_HITMONCHAN, EVENT_DEFEATED_FIGHTING_DOJO
2014-05-18 18:19:10 +00:00
; once Poké Ball is taken, hide sprite
ld a, HS_FIGHTING_DOJO_GIFT_2
2015-07-25 03:27:59 +00:00
ld [wMissableObjectIndex], a
predef HideObject
2014-05-18 18:19:10 +00:00
.done
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
WantHitmonchanText:
text_far _WantHitmonchanText
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
OtherHitmonText:
text_far _OtherHitmonText
text_end