fightingdojo.asm 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. FightingDojoScript:
  2. call EnableAutoTextBoxDrawing
  3. ld hl, FightingDojoTrainerHeader0
  4. ld de, FightingDojoScriptPointers
  5. ld a, [wFightingDojoCurScript]
  6. call ExecuteCurMapScriptInTable
  7. ld [wFightingDojoCurScript], a
  8. ret
  9. FightingDojoScript_5cd70:
  10. xor a
  11. ld [wJoyIgnore], a
  12. ld [wFightingDojoCurScript], a
  13. ld [wCurMapScript], a
  14. ret
  15. FightingDojoScriptPointers:
  16. dw FightingDojoScript1
  17. dw DisplayEnemyTrainerTextAndStartBattle
  18. dw EndTrainerBattle
  19. dw FightingDojoScript3
  20. FightingDojoScript1:
  21. CheckEvent EVENT_DEFEATED_FIGHTING_DOJO
  22. ret nz
  23. call CheckFightingMapTrainers
  24. ld a, [wTrainerHeaderFlagBit]
  25. and a
  26. ret nz
  27. CheckEvent EVENT_BEAT_KARATE_MASTER
  28. ret nz
  29. xor a
  30. ld [hJoyHeld], a
  31. ld [wcf0d], a
  32. ld a, [wYCoord]
  33. cp $3
  34. ret nz
  35. ld a, [wXCoord]
  36. cp $4
  37. ret nz
  38. ld a, $1
  39. ld [wcf0d], a
  40. ld a, PLAYER_DIR_RIGHT
  41. ld [wPlayerMovingDirection], a
  42. ld a, $1
  43. ld [H_SPRITEINDEX], a
  44. ld a, SPRITE_FACING_LEFT
  45. ld [hSpriteFacingDirection], a
  46. call SetSpriteFacingDirectionAndDelay
  47. ld a, $1
  48. ld [hSpriteIndexOrTextID], a
  49. call DisplayTextID
  50. ret
  51. FightingDojoScript3:
  52. ld a, [wIsInBattle]
  53. cp $ff
  54. jp z, FightingDojoScript_5cd70
  55. ld a, [wcf0d]
  56. and a
  57. jr z, .asm_5cde4
  58. ld a, PLAYER_DIR_RIGHT
  59. ld [wPlayerMovingDirection], a
  60. ld a, $1
  61. ld [H_SPRITEINDEX], a
  62. ld a, SPRITE_FACING_LEFT
  63. ld [hSpriteFacingDirection], a
  64. call SetSpriteFacingDirectionAndDelay
  65. .asm_5cde4
  66. ld a, $f0
  67. ld [wJoyIgnore], a
  68. SetEventRange EVENT_BEAT_KARATE_MASTER, EVENT_BEAT_FIGHTING_DOJO_TRAINER_3
  69. ld a, $8
  70. ld [hSpriteIndexOrTextID], a
  71. call DisplayTextID
  72. xor a
  73. ld [wJoyIgnore], a
  74. ld [wFightingDojoCurScript], a
  75. ld [wCurMapScript], a
  76. ret
  77. FightingDojoTextPointers:
  78. dw FightingDojoText1
  79. dw FightingDojoText2
  80. dw FightingDojoText3
  81. dw FightingDojoText4
  82. dw FightingDojoText5
  83. dw FightingDojoText6
  84. dw FightingDojoText7
  85. dw FightingDojoText8
  86. FightingDojoTrainerHeader0:
  87. dbEventFlagBit EVENT_BEAT_FIGHTING_DOJO_TRAINER_0
  88. db ($4 << 4) ; trainer's view range
  89. dwEventFlagAddress EVENT_BEAT_FIGHTING_DOJO_TRAINER_0
  90. dw FightingDojoBattleText1 ; TextBeforeBattle
  91. dw FightingDojoAfterBattleText1 ; TextAfterBattle
  92. dw FightingDojoEndBattleText1 ; TextEndBattle
  93. dw FightingDojoEndBattleText1 ; TextEndBattle
  94. FightingDojoTrainerHeader1:
  95. dbEventFlagBit EVENT_BEAT_FIGHTING_DOJO_TRAINER_1
  96. db ($4 << 4) ; trainer's view range
  97. dwEventFlagAddress EVENT_BEAT_FIGHTING_DOJO_TRAINER_1
  98. dw FightingDojoBattleText2 ; TextBeforeBattle
  99. dw FightingDojoAfterBattleText2 ; TextAfterBattle
  100. dw FightingDojoEndBattleText2 ; TextEndBattle
  101. dw FightingDojoEndBattleText2 ; TextEndBattle
  102. FightingDojoTrainerHeader2:
  103. dbEventFlagBit EVENT_BEAT_FIGHTING_DOJO_TRAINER_2
  104. db ($3 << 4) ; trainer's view range
  105. dwEventFlagAddress EVENT_BEAT_FIGHTING_DOJO_TRAINER_2
  106. dw FightingDojoBattleText3 ; TextBeforeBattle
  107. dw FightingDojoAfterBattleText3 ; TextAfterBattle
  108. dw FightingDojoEndBattleText3 ; TextEndBattle
  109. dw FightingDojoEndBattleText3 ; TextEndBattle
  110. FightingDojoTrainerHeader3:
  111. dbEventFlagBit EVENT_BEAT_FIGHTING_DOJO_TRAINER_3
  112. db ($3 << 4) ; trainer's view range
  113. dwEventFlagAddress EVENT_BEAT_FIGHTING_DOJO_TRAINER_3
  114. dw FightingDojoBattleText4 ; TextBeforeBattle
  115. dw FightingDojoAfterBattleText4 ; TextAfterBattle
  116. dw FightingDojoEndBattleText4 ; TextEndBattle
  117. dw FightingDojoEndBattleText4 ; TextEndBattle
  118. db $ff
  119. FightingDojoText1:
  120. TX_ASM
  121. CheckEvent EVENT_DEFEATED_FIGHTING_DOJO
  122. jp nz, .continue1
  123. CheckEventReuseA EVENT_BEAT_KARATE_MASTER
  124. jp nz, .continue2
  125. ld hl, FightingDojoText_5ce8e
  126. call PrintText
  127. ld hl, wd72d
  128. set 6, [hl]
  129. set 7, [hl]
  130. ld hl, FightingDojoText_5ce93
  131. ld de, FightingDojoText_5ce93
  132. call SaveEndBattleTextPointers
  133. ld a, [hSpriteIndexOrTextID]
  134. ld [wSpriteIndex], a
  135. call EngageMapTrainer
  136. call InitBattleEnemyParameters
  137. ld a, $3
  138. ld [wFightingDojoCurScript], a
  139. ld [wCurMapScript], a
  140. jr .asm_9dba4
  141. .continue1
  142. ld hl, FightingDojoText_5ce9d
  143. call PrintText
  144. jr .asm_9dba4
  145. .continue2
  146. ld hl, FightingDojoText8
  147. call PrintText
  148. .asm_9dba4
  149. jp TextScriptEnd
  150. FightingDojoText_5ce8e:
  151. TX_FAR _FightingDojoText_5ce8e
  152. db "@"
  153. FightingDojoText_5ce93:
  154. TX_FAR _FightingDojoText_5ce93
  155. db "@"
  156. FightingDojoText8:
  157. TX_FAR _FightingDojoText_5ce98
  158. db "@"
  159. FightingDojoText_5ce9d:
  160. TX_FAR _FightingDojoText_5ce9d
  161. db "@"
  162. FightingDojoText2:
  163. TX_ASM
  164. ld hl, FightingDojoTrainerHeader0
  165. call TalkToTrainer
  166. jp TextScriptEnd
  167. FightingDojoBattleText1:
  168. TX_FAR _FightingDojoBattleText1
  169. db "@"
  170. FightingDojoEndBattleText1:
  171. TX_FAR _FightingDojoEndBattleText1
  172. db "@"
  173. FightingDojoAfterBattleText1:
  174. TX_FAR _FightingDojoAfterBattleText1
  175. db "@"
  176. FightingDojoText3:
  177. TX_ASM
  178. ld hl, FightingDojoTrainerHeader1
  179. call TalkToTrainer
  180. jp TextScriptEnd
  181. FightingDojoBattleText2:
  182. TX_FAR _FightingDojoBattleText2
  183. db "@"
  184. FightingDojoEndBattleText2:
  185. TX_FAR _FightingDojoEndBattleText2
  186. db "@"
  187. FightingDojoAfterBattleText2:
  188. TX_FAR _FightingDojoAfterBattleText2
  189. db "@"
  190. FightingDojoText4:
  191. TX_ASM
  192. ld hl, FightingDojoTrainerHeader2
  193. call TalkToTrainer
  194. jp TextScriptEnd
  195. FightingDojoBattleText3:
  196. TX_FAR _FightingDojoBattleText3
  197. db "@"
  198. FightingDojoEndBattleText3:
  199. TX_FAR _FightingDojoEndBattleText3
  200. db "@"
  201. FightingDojoAfterBattleText3:
  202. TX_FAR _FightingDojoAfterBattleText3
  203. db "@"
  204. FightingDojoText5:
  205. TX_ASM
  206. ld hl, FightingDojoTrainerHeader3
  207. call TalkToTrainer
  208. jp TextScriptEnd
  209. FightingDojoBattleText4:
  210. TX_FAR _FightingDojoBattleText4
  211. db "@"
  212. FightingDojoEndBattleText4:
  213. TX_FAR _FightingDojoEndBattleText4
  214. db "@"
  215. FightingDojoAfterBattleText4:
  216. TX_FAR _FightingDojoAfterBattleText4
  217. db "@"
  218. FightingDojoText6:
  219. ; Hitmonlee Poké Ball
  220. TX_ASM
  221. CheckEitherEventSet EVENT_GOT_HITMONLEE, EVENT_GOT_HITMONCHAN
  222. jr z, .GetMon
  223. ld hl, OtherHitmonText
  224. call PrintText
  225. jr .done
  226. .GetMon
  227. ld a, HITMONLEE
  228. call DisplayPokedex
  229. ld hl, WantHitmonleeText
  230. call PrintText
  231. call YesNoChoice
  232. ld a, [wCurrentMenuItem]
  233. and a
  234. jr nz, .done
  235. ld a, [wcf91]
  236. ld b, a
  237. ld c, 30
  238. call GivePokemon
  239. jr nc, .done
  240. ; once Poké Ball is taken, hide sprite
  241. ld a, HS_FIGHTING_DOJO_GIFT_1
  242. ld [wMissableObjectIndex], a
  243. predef HideObject
  244. SetEvents EVENT_GOT_HITMONLEE, EVENT_DEFEATED_FIGHTING_DOJO
  245. .done
  246. jp TextScriptEnd
  247. WantHitmonleeText:
  248. TX_FAR _WantHitmonleeText
  249. db "@"
  250. FightingDojoText7:
  251. ; Hitmonchan Poké Ball
  252. TX_ASM
  253. CheckEitherEventSet EVENT_GOT_HITMONLEE, EVENT_GOT_HITMONCHAN
  254. jr z, .GetMon
  255. ld hl, OtherHitmonText
  256. call PrintText
  257. jr .done
  258. .GetMon
  259. ld a, HITMONCHAN
  260. call DisplayPokedex
  261. ld hl, WantHitmonchanText
  262. call PrintText
  263. call YesNoChoice
  264. ld a, [wCurrentMenuItem]
  265. and a
  266. jr nz, .done
  267. ld a, [wcf91]
  268. ld b, a
  269. ld c, 30
  270. call GivePokemon
  271. jr nc, .done
  272. SetEvents EVENT_GOT_HITMONCHAN, EVENT_DEFEATED_FIGHTING_DOJO
  273. ; once Poké Ball is taken, hide sprite
  274. ld a, HS_FIGHTING_DOJO_GIFT_2
  275. ld [wMissableObjectIndex], a
  276. predef HideObject
  277. .done
  278. jp TextScriptEnd
  279. WantHitmonchanText:
  280. TX_FAR _WantHitmonchanText
  281. db "@"
  282. OtherHitmonText:
  283. TX_FAR _OtherHitmonText
  284. db "@"