Advertisement
NewDenverCity

sand force/rush immunities, sheer power, bp boosting ability

Aug 7th, 2016
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.33 KB | None | 0 0
  1. .thumb
  2.  
  3. .equ table_offset, 0x08250C04 @change this, it's your table of moves
  4. .equ main, 0x08800000
  5.  
  6. .equ Iron_Fist, 0x5A
  7. .equ Sheer_Force, 0x7E
  8. .equ Sand_Rush, 0x93
  9. .equ Sand_Force, 0xA0
  10. .equ Strong_Jaw, 0xAE
  11. .equ Mega_Launcher, 0xB3
  12.  
  13. .align 2
  14. .org 0x0801E59E
  15. hook_in_base_damage_calc:
  16. nop
  17. ldr r0, base_power_override_rewrite
  18. bx r0
  19.  
  20. .align 2
  21. base_power_override_rewrite: .word main + 1
  22.  
  23. null1:
  24. nop
  25.  
  26. .org 0x08021130
  27. hook_in_seteffectwithchancetarget:
  28. ldr r1, skip_atk15_if_sheer_force
  29. bx r1
  30.  
  31. .align 2
  32. skip_atk15_if_sheer_force: .word atk15_sheer_force_check + 1
  33.  
  34. null2:
  35. nop
  36.  
  37. .org 0x08021214
  38. hook_in_seteffecttarget:
  39. ldr r1, skip_atk16_if_sheer_force
  40. bx r1
  41.  
  42. .align 2
  43. skip_atk16_if_sheer_force: .word atk16_sheer_force_check + 1
  44.  
  45. @--------------------
  46.  
  47. .org 0x08028D60
  48. sandstorm_check_rewrite:
  49. @r0 is the battle struct
  50. @r1 is attacker x 0x58
  51. @r2 is the attacker
  52. @r3 is nothing important but it's needed for the damage and all the checks
  53. @r4 is the offset of the weather
  54. @r5 is the offset of the attacker
  55. @45 commands needed, no more no less. that's why i have nops in there.
  56. add r3, r0, r1 @r1 is now the offset of the attacker
  57. add r3, #0x20 @ability
  58. ldrb r0, [r3]
  59. cmp r0, #8 @sand veil
  60. beq 0x08028DD4 @store 0 damage from sandstorm
  61. cmp r0, #Sand_Force
  62. beq 0x08028DD4
  63. cmp r0, #Sand_Rush
  64. beq 0x08028DD4
  65. mov r1, #0
  66. type_check_loop:
  67. add r3, #1
  68. ldrb r0, [r3]
  69. cmp r0, #4 @ground
  70. beq 0x08028DD4
  71. cmp r0, #5 @rock
  72. beq 0x08028DD4
  73. cmp r0, #8 @steel
  74. beq 0x08028DD4
  75. cmp r1, #1
  76. beq continue_rewrite
  77. add r1, #1
  78. b type_check_loop
  79. continue_rewrite:
  80. ldr r0, status_bits_atk96
  81. lsl r1, r2, #2
  82. add r1, r0
  83. ldr r1, [r1]
  84. mov r0, #0x80 @dig flag
  85. and r0, r1
  86. cmp r0, #0
  87. bne 0x08028DD4
  88. mov r0, #80
  89. lsl r0, #0xB @mov r0, #0x40000, the dive flag
  90. and r1, r0
  91. cmp r1, #0
  92. bne 0x08028DD4
  93. ldr r1, sandstorm_damage
  94. ldrh r0, [r3, #8] @max hp
  95. lsr r0, #4
  96. str r0, [r1]
  97. cmp r0, #0
  98. bne 0x08028DDA
  99. mov r0, #1
  100. b 0x08028DD8
  101. nop
  102. nop
  103. nop
  104. .word 0x02022B4C @battle_type_flags
  105. .word 0x02023D6B @b_attacker
  106. .word 0x02023F1C @weather
  107. .word 0x02023BE4 @battle_struct
  108. status_bits_atk96: .word 0x02023DFC
  109. sandstorm_damage: .word 0x02023D50 @also known as b_move_damage but i wrote this after the rest
  110. @so i don't know what label number to use and i'm too lazy to check
  111.  
  112. @--------------------
  113.  
  114. .org main
  115. .align 2
  116. start:
  117. ldr r0, attacker1
  118. ldrb r0, [r0]
  119. mov r1, #0x58 @length of battle struct
  120. mul r0, r1
  121. ldr r2, battle_struct1 @make it r2 if there's an ability that stops some of these
  122. add r0, r0, r2
  123. mov r4, r0 @r4 is the offset of the attacker
  124. ldr r0, defender
  125. ldrb r0, [r0]
  126. mul r0, r1
  127. mov r5, r0 @r5 is the defender offset
  128.  
  129. setup:
  130. ldr r0, move_to_execute1
  131. ldrh r6, [r0]
  132. ldr r0, move_table1
  133. mov r1, #0xC
  134. mul r1, r6
  135. add r1, r0
  136. ldrb r7, [r1, #0x2]
  137.  
  138. attacker_ability_jump:
  139. add r4, #0x20
  140. ldrb r0, [r4] @ability
  141. cmp r0, #Iron_Fist
  142. beq iron_fist_routine
  143. cmp r0, #Strong_Jaw
  144. beq strong_jaw_routine
  145. cmp r0, #Mega_Launcher
  146. beq mega_launcher_routine
  147. cmp r0, #Sand_Force
  148. beq sand_force_routine
  149. cmp r0, #Sheer_Force @delete this line
  150. beq sheer_force_routine @delete this line
  151.  
  152. defender_ability_jump:
  153.  
  154. all_ability_jump:
  155. b end1
  156.  
  157. @r0 has the ability of the attacker/defender, idk i haven't seen any ability that lowers bp yet
  158. @r1 is the offset of the move to be executed
  159. @r2 is the battle struct
  160. @r3 is nothing
  161. @r4 is the offset of the attacker
  162. @r5 is the offset of the defender
  163. @r6 is the move to execute
  164. @r7 is the base power of the move to execute
  165.  
  166. sand_force_routine:
  167. ldr r0, weather
  168. ldrh r0, [r0]
  169. mov r3, #0x18
  170. and r0, r3
  171. cmp r0, #0
  172. bne end1
  173. check_attack_type:
  174. ldrb r0, [r1, #3] @type of the move
  175. cmp r0, #4 @ground
  176. beq sheer_force_routine
  177. cmp r0, #5 @rock
  178. beq sheer_force_routine
  179. cmp r0, #8 @steel
  180. bne end1
  181.  
  182. sheer_force_routine:
  183. mov r0, r7
  184. mov r1, #0xA
  185. ldr r2, divsi3
  186. bl jump_with_r2 @r0 will be 1/10 of the bp
  187. mov r1, #3
  188. mul r0, r1 @and that's the 30%
  189. add r7, r0
  190. b end_of_attacking_ability_routine
  191.  
  192. iron_fist_routine:
  193. ldr r1, iron_fist_pointer
  194. b read_table
  195.  
  196. strong_jaw_routine:
  197. ldr r1, strong_jaw_pointer
  198. b read_table
  199.  
  200. mega_launcher_routine:
  201. ldr r1, mega_launcher_pointer
  202.  
  203. read_table:
  204. ldrh r0, [r1]
  205. cmp r0, #0
  206. beq end1
  207. add r1, #2
  208. cmp r0, r6
  209. bne read_table
  210.  
  211. check_for_iron_fist:
  212. ldrb r0, [r4] @ability
  213. cmp r0, #Iron_Fist
  214. bne add_one_half_boost_for_launcher_jaw
  215.  
  216. add_one_fifth_to_base_power_for_iron_fist:
  217. mov r0, r7
  218. mov r1, #5
  219. ldr r2, divsi3
  220. bl jump_with_r2
  221. add r7, r0, r7 @(bp/5) + bp = r7
  222. b end_of_attacking_ability_routine
  223.  
  224. add_one_half_boost_for_launcher_jaw:
  225. lsr r0, r7, #1
  226. add r7, r0
  227.  
  228. end_of_attacking_ability_routine:
  229. ldr r0, base_power_override
  230. strh r7, [r0]
  231.  
  232. end1:
  233. add sp, #-0x10
  234. ldr r4, flags_per_side_status
  235. ldr r5, defender
  236. ldrb r0, [r5]
  237. ldr r2, get_side_per_status
  238. bl jump_with_r2
  239. ldr r2, return_address1
  240.  
  241. jump_with_r2:
  242. bx r2
  243.  
  244. .align 2
  245. attacker1: .word 0x02023D6B
  246. defender: .word 0x02023D6C
  247. battle_struct1: .word 0x02023BE4
  248. move_to_execute1: .word 0x02023D4A
  249. move_table1: .word table_offset
  250. iron_fist_pointer: .word iron_fist_table
  251. strong_jaw_pointer: .word strong_jaw_table
  252. mega_launcher_pointer: .word mega_launcher_table
  253. divsi3: .word 0x081E4018 + 1
  254. flags_per_side_status: .word 0x02023DDE
  255. get_side_per_status: .word 0x080751D8 + 1
  256. return_address1: .word 0x0801E5AA + 1
  257. weather: .word 0x02023F1C
  258. base_power_override: .word 0x02023F50
  259.  
  260. @--------------------
  261.  
  262. atk15_sheer_force_check:
  263. add r0, r2 @r0 is the offset of the attacker
  264. add r0, #0x20
  265. ldrb r0, [r0] @loading the ability to r0
  266. cmp r0, #Sheer_Force
  267. beq end3
  268. cmp r0, #0x20 @serene grace
  269. bne end4
  270. end2:
  271. bx lr
  272. end3:
  273. ldr r0, move_script_pointer1
  274. ldr r1, [r0]
  275. add r1, #1
  276. str r1, [r0]
  277. ldr r0, return_address2
  278. bx r0
  279. end4:
  280. ldr r0, return_address3
  281. bx r0
  282.  
  283. .align 2
  284. return_address2: .word 0x080211FC + 1
  285. return_address3: .word 0x08021160 + 1
  286. move_script_pointer1: .word 0x02023D74
  287.  
  288. @--------------------
  289.  
  290. atk16_sheer_force_check:
  291. ldr r0, attacker2
  292. ldrb r0, [r0]
  293. mov r1, #0x58
  294. mul r0, r1
  295. ldr r1, battle_struct2
  296. add r0, r1
  297. add r0, #0x20 @to get in range of the ability
  298. ldrb r0, [r0]
  299. cmp r0, #Sheer_Force
  300. beq end5
  301. continue:
  302. mov r0, #1
  303. mov r1, #0
  304. ldr r2, apply_effect
  305. bl jump_with_r2_again
  306. end5:
  307. pop {pc}
  308.  
  309. jump_with_r2_again:
  310. bx r2
  311.  
  312. .align 2
  313. attacker2: .word 0x02023D6B
  314. battle_struct2: .word 0x02023BE4
  315. apply_effect: .word 0x0801FF20 + 1
  316.  
  317. @--------------------
  318.  
  319. iron_fist_table:
  320. .hword 0x4 @comet punch
  321. .hword 0x5 @mega punch
  322. .hword 0x7 @fire punch
  323. .hword 0x8 @ice punch
  324. .hword 0x9 @thunder punch
  325. .hword 0x92 @dizzy punch
  326. .hword 0xB7 @mach punch
  327. .hword 0xDF @dynamic punch
  328. .hword 0x108 @focus punch
  329. .hword 0x135 @meteor mash
  330. .hword 0x145 @shadow punch
  331. .hword 0x147 @sky uppercut
  332. .hword 0x167 @hammer arm
  333. .hword 0x199 @drain punch
  334. .hword 0x1A2 @bullet punch
  335. .hword 0x264 @power-up punch
  336. .hword 0x0 @end of table
  337.  
  338. strong_jaw_table:
  339. .hword 0x2C @bite
  340. .hword 0xF2 @crunch
  341. .hword 0x131 @poison fang
  342. .hword 0x1A6 @thunder fang
  343. .hword 0x1A7 @ice fang
  344. .hword 0x1A8 @fire fang
  345. .hword 0x0 @end of table
  346.  
  347. mega_launcher_table:
  348. .hword 0x160 @water pulse
  349. .hword 0x18C @aura sphere
  350. .hword 0x18F @dark pulse
  351. .hword 0x196 @dragon pulse
  352. .hword 0x1F9 @heal pulse
  353. .hword 0x26A @origin pulse
  354. .hword 0x0 @end of table
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement