MrDollSteak

Formerly known as 11bayerf1

Age 24
Male
Hong Kong
Seen 3 Weeks Ago
Posted May 15th, 2019
846 posts
10.8 Years
PsyStrike effect for Emerald :

Spoiler:
.text
.align 2
.thumb
.thumb_func
.global swapdefsandboosts

main:
push {r0-r3, lr}
ldr r0, .TargetBank
ldr r1, .BattleData
ldrb r0, [r0]
mov r2, #0x58
mul r0, r2
add r1, #0x4
add r1, r0
ldrh r2, [r1]
ldrh r3, [r1, #0x6]
strh r3, [r1]
strh r2, [r1, #0x6]
ldr r0, .TargetBank
ldr r1, .BattleData
ldrb r0, [r0]
mov r2, #0x58
mul r0, r2
add r1, #0x1A
add r1, r0
ldrb r2, [r1]
ldrb r3, [r1, #0x3]
strb r3, [r1]
strb r2, [r1, #0x3]
pop {r0-r3, pc}
bx r0

.align 2
.BattleData:.word 0x02024084
.TargetBank:.word 0x0202420C


It swaps defense/defense special as well as the boost defense/def spe. Though it doesn't handle Fur coat/Marvel Scale. Other than that it's fine.
callasm this routine before AND after calculate damage.

With that Mewtwo will take down Blissey !

EDIT : A way to have a proper effect is to make the move physical, and rather than swaps the defense of the foe, you swap attacks/boosts of the user. This way ability the damage-reduced ability will be kept, so here is the second routine (which I advice to use) :

Spoiler:
.text
.align 2
.thumb
.thumb_func
.global swapdefsandboosts

main:
push {r0-r3, lr}
ldr r0, .UserBank
ldr r1, .BattleData
ldrb r0, [r0]
mov r2, #0x58
mul r0, r2
add r1, #0x2
add r1, r0
ldrh r2, [r1]
ldrh r3, [r1, #0x6]
strh r3, [r1]
strh r2, [r1, #0x6]
ldr r0, .UserBank
ldr r1, .BattleData
ldrb r0, [r0]
mov r2, #0x58
mul r0, r2
add r1, #0x19
add r1, r0
ldrb r2, [r1]
ldrb r3, [r1, #0x3]
strb r3, [r1]
strb r2, [r1, #0x3]
pop {r0-r3, pc}
bx r0

.align 2
.BattleData:.word 0x02024084
.UserBank:.word 0x0202420B


So here you have to set the move "Physical" and it'll work exactly as expected, you still have to callasm this routine before AND after calculate damage in BSP.
I believe this won't actually take into account other multipliers. For example if you have x2 sp. atk. it's not going to correctly apply the damage. Because you'll be swapping say 160 attack with 320 sp atk. Instead of using an the sp.atk stat of 640, it'll use 320, because it's now treated as the attack stat.

The best way to do it as far as I can tell would be to have a check in the damage calculation for the move effect, as opposed to a custom battle script, which means you can place it after different multipliers. I'd probably find where it actually loads the 'fully treated' Sp. Attack of the user and Sp. Defense of the opponent, and just load the Defense stat instead.