Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .thumb
- .equ table_offset, 0x08250C04 @change this, it's your table of moves
- .equ main, 0x08800000
- .equ Iron_Fist, 0x5A
- .equ Sheer_Force, 0x7E
- .equ Sand_Rush, 0x93
- .equ Sand_Force, 0xA0
- .equ Strong_Jaw, 0xAE
- .equ Mega_Launcher, 0xB3
- .align 2
- .org 0x0801E59E
- hook_in_base_damage_calc:
- nop
- ldr r0, base_power_override_rewrite
- bx r0
- .align 2
- base_power_override_rewrite: .word main + 1
- null1:
- nop
- .org 0x08021130
- hook_in_seteffectwithchancetarget:
- ldr r1, skip_atk15_if_sheer_force
- bx r1
- .align 2
- skip_atk15_if_sheer_force: .word atk15_sheer_force_check + 1
- null2:
- nop
- .org 0x08021214
- hook_in_seteffecttarget:
- ldr r1, skip_atk16_if_sheer_force
- bx r1
- .align 2
- skip_atk16_if_sheer_force: .word atk16_sheer_force_check + 1
- @--------------------
- .org 0x08028D60
- sandstorm_check_rewrite:
- @r0 is the battle struct
- @r1 is attacker x 0x58
- @r2 is the attacker
- @r3 is nothing important but it's needed for the damage and all the checks
- @r4 is the offset of the weather
- @r5 is the offset of the attacker
- @45 commands needed, no more no less. that's why i have nops in there.
- add r3, r0, r1 @r1 is now the offset of the attacker
- add r3, #0x20 @ability
- ldrb r0, [r3]
- cmp r0, #8 @sand veil
- beq 0x08028DD4 @store 0 damage from sandstorm
- cmp r0, #Sand_Force
- beq 0x08028DD4
- cmp r0, #Sand_Rush
- beq 0x08028DD4
- mov r1, #0
- type_check_loop:
- add r3, #1
- ldrb r0, [r3]
- cmp r0, #4 @ground
- beq 0x08028DD4
- cmp r0, #5 @rock
- beq 0x08028DD4
- cmp r0, #8 @steel
- beq 0x08028DD4
- cmp r1, #1
- beq continue_rewrite
- add r1, #1
- b type_check_loop
- continue_rewrite:
- ldr r0, status_bits_atk96
- lsl r1, r2, #2
- add r1, r0
- ldr r1, [r1]
- mov r0, #0x80 @dig flag
- and r0, r1
- cmp r0, #0
- bne 0x08028DD4
- mov r0, #80
- lsl r0, #0xB @mov r0, #0x40000, the dive flag
- and r1, r0
- cmp r1, #0
- bne 0x08028DD4
- ldr r1, sandstorm_damage
- ldrh r0, [r3, #8] @max hp
- lsr r0, #4
- str r0, [r1]
- cmp r0, #0
- bne 0x08028DDA
- mov r0, #1
- b 0x08028DD8
- nop
- nop
- nop
- .word 0x02022B4C @battle_type_flags
- .word 0x02023D6B @b_attacker
- .word 0x02023F1C @weather
- .word 0x02023BE4 @battle_struct
- status_bits_atk96: .word 0x02023DFC
- sandstorm_damage: .word 0x02023D50 @also known as b_move_damage but i wrote this after the rest
- @so i don't know what label number to use and i'm too lazy to check
- @--------------------
- .org main
- .align 2
- start:
- ldr r0, attacker1
- ldrb r0, [r0]
- mov r1, #0x58 @length of battle struct
- mul r0, r1
- ldr r2, battle_struct1 @make it r2 if there's an ability that stops some of these
- add r0, r0, r2
- mov r4, r0 @r4 is the offset of the attacker
- ldr r0, defender
- ldrb r0, [r0]
- mul r0, r1
- mov r5, r0 @r5 is the defender offset
- setup:
- ldr r0, move_to_execute1
- ldrh r6, [r0]
- ldr r0, move_table1
- mov r1, #0xC
- mul r1, r6
- add r1, r0
- ldrb r7, [r1, #0x2]
- attacker_ability_jump:
- add r4, #0x20
- ldrb r0, [r4] @ability
- cmp r0, #Iron_Fist
- beq iron_fist_routine
- cmp r0, #Strong_Jaw
- beq strong_jaw_routine
- cmp r0, #Mega_Launcher
- beq mega_launcher_routine
- cmp r0, #Sand_Force
- beq sand_force_routine
- cmp r0, #Sheer_Force @delete this line
- beq sheer_force_routine @delete this line
- defender_ability_jump:
- all_ability_jump:
- b end1
- @r0 has the ability of the attacker/defender, idk i haven't seen any ability that lowers bp yet
- @r1 is the offset of the move to be executed
- @r2 is the battle struct
- @r3 is nothing
- @r4 is the offset of the attacker
- @r5 is the offset of the defender
- @r6 is the move to execute
- @r7 is the base power of the move to execute
- sand_force_routine:
- ldr r0, weather
- ldrh r0, [r0]
- mov r3, #0x18
- and r0, r3
- cmp r0, #0
- bne end1
- check_attack_type:
- ldrb r0, [r1, #3] @type of the move
- cmp r0, #4 @ground
- beq sheer_force_routine
- cmp r0, #5 @rock
- beq sheer_force_routine
- cmp r0, #8 @steel
- bne end1
- sheer_force_routine:
- mov r0, r7
- mov r1, #0xA
- ldr r2, divsi3
- bl jump_with_r2 @r0 will be 1/10 of the bp
- mov r1, #3
- mul r0, r1 @and that's the 30%
- add r7, r0
- b end_of_attacking_ability_routine
- iron_fist_routine:
- ldr r1, iron_fist_pointer
- b read_table
- strong_jaw_routine:
- ldr r1, strong_jaw_pointer
- b read_table
- mega_launcher_routine:
- ldr r1, mega_launcher_pointer
- read_table:
- ldrh r0, [r1]
- cmp r0, #0
- beq end1
- add r1, #2
- cmp r0, r6
- bne read_table
- check_for_iron_fist:
- ldrb r0, [r4] @ability
- cmp r0, #Iron_Fist
- bne add_one_half_boost_for_launcher_jaw
- add_one_fifth_to_base_power_for_iron_fist:
- mov r0, r7
- mov r1, #5
- ldr r2, divsi3
- bl jump_with_r2
- add r7, r0, r7 @(bp/5) + bp = r7
- b end_of_attacking_ability_routine
- add_one_half_boost_for_launcher_jaw:
- lsr r0, r7, #1
- add r7, r0
- end_of_attacking_ability_routine:
- ldr r0, base_power_override
- strh r7, [r0]
- end1:
- add sp, #-0x10
- ldr r4, flags_per_side_status
- ldr r5, defender
- ldrb r0, [r5]
- ldr r2, get_side_per_status
- bl jump_with_r2
- ldr r2, return_address1
- jump_with_r2:
- bx r2
- .align 2
- attacker1: .word 0x02023D6B
- defender: .word 0x02023D6C
- battle_struct1: .word 0x02023BE4
- move_to_execute1: .word 0x02023D4A
- move_table1: .word table_offset
- iron_fist_pointer: .word iron_fist_table
- strong_jaw_pointer: .word strong_jaw_table
- mega_launcher_pointer: .word mega_launcher_table
- divsi3: .word 0x081E4018 + 1
- flags_per_side_status: .word 0x02023DDE
- get_side_per_status: .word 0x080751D8 + 1
- return_address1: .word 0x0801E5AA + 1
- weather: .word 0x02023F1C
- base_power_override: .word 0x02023F50
- @--------------------
- atk15_sheer_force_check:
- add r0, r2 @r0 is the offset of the attacker
- add r0, #0x20
- ldrb r0, [r0] @loading the ability to r0
- cmp r0, #Sheer_Force
- beq end3
- cmp r0, #0x20 @serene grace
- bne end4
- end2:
- bx lr
- end3:
- ldr r0, move_script_pointer1
- ldr r1, [r0]
- add r1, #1
- str r1, [r0]
- ldr r0, return_address2
- bx r0
- end4:
- ldr r0, return_address3
- bx r0
- .align 2
- return_address2: .word 0x080211FC + 1
- return_address3: .word 0x08021160 + 1
- move_script_pointer1: .word 0x02023D74
- @--------------------
- atk16_sheer_force_check:
- ldr r0, attacker2
- ldrb r0, [r0]
- mov r1, #0x58
- mul r0, r1
- ldr r1, battle_struct2
- add r0, r1
- add r0, #0x20 @to get in range of the ability
- ldrb r0, [r0]
- cmp r0, #Sheer_Force
- beq end5
- continue:
- mov r0, #1
- mov r1, #0
- ldr r2, apply_effect
- bl jump_with_r2_again
- end5:
- pop {pc}
- jump_with_r2_again:
- bx r2
- .align 2
- attacker2: .word 0x02023D6B
- battle_struct2: .word 0x02023BE4
- apply_effect: .word 0x0801FF20 + 1
- @--------------------
- iron_fist_table:
- .hword 0x4 @comet punch
- .hword 0x5 @mega punch
- .hword 0x7 @fire punch
- .hword 0x8 @ice punch
- .hword 0x9 @thunder punch
- .hword 0x92 @dizzy punch
- .hword 0xB7 @mach punch
- .hword 0xDF @dynamic punch
- .hword 0x108 @focus punch
- .hword 0x135 @meteor mash
- .hword 0x145 @shadow punch
- .hword 0x147 @sky uppercut
- .hword 0x167 @hammer arm
- .hword 0x199 @drain punch
- .hword 0x1A2 @bullet punch
- .hword 0x264 @power-up punch
- .hword 0x0 @end of table
- strong_jaw_table:
- .hword 0x2C @bite
- .hword 0xF2 @crunch
- .hword 0x131 @poison fang
- .hword 0x1A6 @thunder fang
- .hword 0x1A7 @ice fang
- .hword 0x1A8 @fire fang
- .hword 0x0 @end of table
- mega_launcher_table:
- .hword 0x160 @water pulse
- .hword 0x18C @aura sphere
- .hword 0x18F @dark pulse
- .hword 0x196 @dragon pulse
- .hword 0x1F9 @heal pulse
- .hword 0x26A @origin pulse
- .hword 0x0 @end of table
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement