Advertisement
NewDenverCity

asm + battle script

Nov 6th, 2015
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.69 KB | None | 0 0
  1. .thumb
  2. @in this example, pirouette form is 0xF1, and aria is 0xF0
  3. @i used the decrypting thing that Doesnt posted so that's why i'm not calling the
  4. @decrypting function or encrypting function.
  5.  
  6. check_pkmn_id:
  7. push {lr}
  8. ldr r0, attacking_bank
  9. ldrb r1, [r0] @which mon did the attack
  10. ldr r0, ram_pointer
  11. ldr r0, [r0]
  12. add r0, r0, #0x60
  13. cmp r1, #0x0
  14. beq set_player_singles
  15. cmp r1, #0x1
  16. beq set_enemy_singles
  17. cmp r1, #0x2
  18. beq set_player_doubles
  19. cmp r1, #0x3
  20. beq set_enemy_doubles
  21. get_battle_struct:
  22. ldr r0, attacking_bank
  23. ldrb r1, [r0] @which mon did the attack
  24. mov r0, #0x58 @length of battle structs
  25. mul r1, r0, r1 @multiplies length of battle structs with which mon did the attack to get the the battle structure i'm working with
  26. ldr r0, battle_struct
  27. add r0, r1, r0 @r0 is the battle struct i'm working with
  28. check_if_aria:
  29. add r2, r2, #0x20
  30. ldrh r1, [r2]
  31. cmp r1, #0xF0
  32. bne end
  33. sub r2, r2, #0x20
  34. set_pirouette_forme:
  35. mov r1, #0xF1
  36. strh r1, [r0] @species in battle struct is now the correct thing
  37. strh r1, [r2] @species in party is now pirouette's
  38. push {r0}
  39. mov r0, r2
  40. mov r1, r2
  41. push {r2}
  42. ldr r3, calc_stats
  43. bl jump @stats should be calculated
  44. pop {r2}
  45. pop {r0} @r2 is the beginning of the party slot, r0 is the beginning of the battle struct
  46. update_type:
  47. add r0, #0x22
  48. mov r1, #0x1
  49. strb r1, [r0] @second type in battle struct is now fighting
  50. update_battl_struct:
  51. sub r0, r0, #0x20
  52. add r2, r2, #0x5A @r0 is at the attack stat, r2 is at the party attack stat
  53. mov r3, #0x0
  54. stat_loop:
  55. ldrh r1, [r2]
  56. strh r1, [r0]
  57. add r0, r0, #0x2
  58. add r2, r2, #0x2
  59. add r3, r3, #0x1
  60. cmp r3, #0x4
  61. bne stat_loop
  62. end:
  63. pop {pc}
  64. jump:
  65. mov pc, r3
  66. set_player_singles:
  67. ldrb r0, [r0]
  68. lsr r0, #0x4 @only one digit is left
  69. mov r1, #0x64 @length of party entry
  70. ldr r2, player_party
  71. mul r0, r0, r1
  72. add r2, r0, r2 @gets r2 to the correct slot
  73. b get_battle_struct
  74. set_enemy_singles:
  75. add r0, r0, #0x3 @gets to party order for enemy
  76. ldrb r0, [r0]
  77. lsr r0, #0x4
  78. mov r1, #0x64
  79. ldr r2, enemy_party
  80. mul r0, r0, r1
  81. add r2, r0, r2
  82. b get_battle_struct
  83. set_player_doubles:
  84. ldrb r0, [r0]
  85. lsl r0, #0x1C
  86. lsr r0, #0x1C @gets the second pokemon's location
  87. mov r1, #0x64
  88. ldr r2, player_party
  89. mul r0, r0, r1
  90. add r2, r0, r2
  91. b get_battle_struct
  92. set_enemy_doubles:
  93. add r0, r0, #0x3
  94. ldrb r0, [r0]
  95. lsl r0, #0x1C
  96. lsr r0, #0x1C
  97. mov r1, #0x64
  98. ldr r2, enemy_party
  99. mul r0, r0, r1
  100. add r2, r0, r2
  101. b get_battle_struct
  102.  
  103. .align 2
  104. battle_struct: .word 0x02023BE4
  105. player_party: .word 0x02024284
  106. enemy_party: .word 0x0202402C
  107. order_pointer: .word 0x02023FE8
  108. attacking_bank: .word 0x02023D6B
  109. calc_stats: .word 0x0803E47C
  110. ram_pointer: .word 0x02023FE8
  111.  
  112.  
  113.  
  114. Battle script
  115. #org 0x71A2C8
  116. setbyte 0x2023E85 0x1 // 0x871A2C8
  117. jumpifhalfword 0x1 0x2023D4A 0x39 0x871A2F6 // 0x871A2CE
  118. jumpifspecialstatusflag 0x0 0x400C0 0x1 0x871A2F6 // 0x871A2DA
  119. orword 0x2023DD0 0x400C0 // 0x871A2E5
  120. setbyte 0x2023FD2 0x2 // 0x871A2EE
  121. @there's two bytes of FF here, dunno if that's correct or not
  122. #org 0x71A2F6
  123. attackcanceler // 0x871A2F6
  124. accuracycheck 0x81D695E 0x0 // 0x871A2F7
  125. attackstring // 0x871A2FE
  126. ppreduce // 0x871A2FF
  127. critcalc // 0x871A300
  128. cmd5 // 0x871A301
  129. cmd6 // 0x871A302
  130. cmd7 // 0x871A303
  131. attackanimation // 0x871A304
  132. waitanimation // 0x871A305
  133. missmessage // 0x871A306
  134. cmd5c 0x0 // 0x871A307
  135. waitstate // 0x871A309
  136. graphicalhpupdate 0x0 // 0x871A30A
  137. datahpupdate 0x0 // 0x871A30C
  138. critmessage // 0x871A30E
  139. waitmessage 0x40 // 0x871A30F
  140. seteffectwithchancetarget // 0x871A312
  141. faintpokemon 0x0 0x0 0x0 // 0x871A313
  142. callasm 0x8171A331 @where the asm is + 1
  143. setbyte 0x2023FD8 0x0
  144. cmd49 0x0 0x0
  145. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement