Tlachtli

Crit happens.

Age 28
Male
Faraway place
Seen 4 Days Ago
Posted June 15th, 2017
267 posts
7.3 Years
EDIT: I realized that my Light Metal had a pretty big oversight in it, so I'm getting to work on fixing that. In the meantime, I'll post some simple-but-useful ASMs for battle scripts.

I've actually been doing some work on getting some Gen 4-6 abilities into Emerald. With Jambo's callasm method for his Battle Script Pro, a lot of them can be done with a combination of battle scripting and relatively simple asm. BSP's damage multiplier can only handle integer multiplication though and a lot of damage multipliers are fractional, so I wrote a couple simple ASMs that can be called in place of the regular damage multiplier command. The 1/2 damage ASM (and others) could be used for several applications, they just need to be called after calculatedamage but before any hp removal.

x0.5 Damage:
.align 2
.thumb

Start:
    push {r0-r1}
    ldr r0, .input
    ldr r1, [r0]
    lsr r1, #1
    cmp r1, #0x0
    bne Finish
    add r1, #0x1

Finish:
    stm r0!, {r1}
    pop {r0-r1}
    bx lr

.align 2
.input:    .word 0x020241F0 /*attack damage*/
x0.75 Damage:
.align 2
.thumb

Start:
    push {r0-r2}
    ldr r0, .input
    ldr r1, [r0]
    mov r2, #0x3
    mul r1, r2
    lsr r1, #2
    cmp r1, #0x0
    bne Finish
    add r1, #0x1

Finish:
    stm r0!, {r1}
    pop {r0-r2}
    bx lr

.align 2
.input:    .word 0x020241F0 /*attack damage*/
*Note: the 0.5 and 0.75 multiplications will never return zero damage, because if the logical shift results in zero damage 0x1 will be added to make it nonzero. If you want to change that so it can give zero damage, just get rid of the cmp/bne/add lines above Finish.

x1.25 Damage:
.align 2
.thumb

Start:
    push {r0-r2}
    ldr r0, .input
    ldr r1, [r0]
    mov r2, #0x5
    mul r1, r2
    lsr r1, #2
    stm r0!, {r1}
    pop {r0-r2}
    bx lr

.align 2
.input:    .word 0x020241F0 /*attack damage*/
x1.5 Damage
.align 2
.thumb

Start:
    push {r0-r2}
    ldr r0, .input
    ldr r1, [r0]
    mov r2, #0x3
    mul r1, r2
    lsr r1, #1
    stm r0!, {r1}
    pop {r0-r2}
    bx lr

.align 2
.input:    .word 0x020241F0 /*attack damage*/
*Note: the values given for addresses only apply to BPEE, for any other version they need to point to the proper memory addresses.

I have psuedo-code written/planned for probably 25-30 in-battle abilities, I just need to go through the grunt work of actually typing out the scripts and asm's.
Pokemon Sigma Σmerald:
(now under management by DraconianWing)

A Gen 3 remake de-make, featuring many new encounters and Gen VI mechanics