Age 22
Seen 4 Days Ago
Posted 4 Weeks Ago
784 posts
5.6 Years
Heavy Slam for Fire Red. The script is simple as for Doesnt's ASMs. Use the callasm command just after the pp reducer and before damagecalculator in the script:

The ASM:
.align 2
.global heavyslam

push {lr}
ldr r0, userBank
ldrb r0, [r0]
ldr r1, battleData
mov r2, #0x58
mul r0, r2
add r3, r0, r1
ldr r0, targetBank
ldrb r0, [r0]
mul r0, r2
add r4, r0, r1
ldrb r5, [r3, #0x0]
ldrb r6, [r4, #0x0]
ldr r1, dexData
mov r2, #0x24
mul r5, r2
add r0, r1, r5
ldrh r5, [r0, #0xE]
mul r6, r2
add r0, r1, r6
ldrh r6, [r0, #0xE]

ldr r1, floatstoneindex
mov r7, r3
add r7, #0x20
ldrb r7, [r7]
cmp r7, #0xXX
bne label2
lsr r5, #0x1

cmp r7, #0xYY
bne label3
lsl r5, #0x1

ldrh r7, [r3, #0x2e]
cmp r7, r1
bne label4
lsr r5, #0x1

mov r7, r4
add r7, #0x20
ldrb r7, [r7]
cmp r7, #0xXX
bne label5
lsr r6, #0x1

cmp r7, #0xYY
bne label6
lsl r6, #0x1

ldrh r7, [r4, #0x2e]
cmp r7, r1
bne label7
lsr r5, #0x1

mov r2, #0x5
mul r2, r6
cmp r5, r2
bgt set120
sub r2, r6
cmp r5, r2
bgt set100
sub r2, r6
cmp r5, r2
bgt set80
sub r2, r6
cmp r5, r2
bgt set60
mov r1, #0x28
b end

mov r1, #0x3C
b end

mov r1, #0x50
b end

mov r1, #0x64
b end

mov r1, #0x78

ldr r2, basePower
strh r1, [r2, #0x0]
pop {r0}
bx r0

.align 2
floatstoneindex: .hword 0xZZZZ
targetBank: .word 0x02023D6C
userBank: .word 0x02023D6B
battleData: .word 0x02023BE4
basePower: .word 0x02023F50
dexData: .word 0x0844E850
1. The bold section of the code is meant to accommodate the weight changes due to Light Metal, Heavy Metal abilities and the item Float Stone because the Weight is directly loaded from the Dex Data in the ROM (even lowkick does).

2. If your ROM don't have anyone of these things remove the bolded section. Otherwise, replace XX with the index of Light Metal, replace YY with the index of Heavy Metal, and replace ZZZZ with the index of Float Stone.

3. If you have expanded the no of pokemons then the value of dexData also needs to be changed to the new location.

4. If someone wants to port it to Emerald, in addition to changing the value of offsets also change the mov r2, #0x24 to mov r2, #0x20 after the ldr r1, dexData, this because in every GBA Rom except Emerald the dex entry for each poke takes 36 bytes, whereas in Emerald it takes 32 bytes.
I have a problem with this routine, it always sets the move power to 120 no matter the weight. I removed all bolded lines and changed the value of dexData.