Male
Seen January 10th, 2019
Posted May 4th, 2017
216 posts
6.2 Years
Made a routine that changes the attack into the user's primary type (Judgment...), here :

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

main:
push {lr}
ldr r0, .UserBank
ldr r1, .BattleData
ldrb r0, [r0]
mov r2, #0x58
mul r2, r0
add r1, #0x21
add r1, r0
ldrb r1, [r1]
ldr r0, .MemAddress
ldr r0, [r0]
add r0, #0x13
strb r1, [r0]
pop {r0}
bx r0

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


Just callasm this routine before the attackcanceler in battle script. Pm if there is bug/problem/other
I think it's not optimized but whatever, it works. I'll see if I can change it

Edited, thanks KDS
Spoiler:
Only problem in 2 lines.
1. mul r2,r0 should be mul r0,r2 (this can spoil the results)
2. ldrh r0, [r1] is redundant not needed.

Also for anyone wanting this for FR:
.BattleData:.word 0x02023BE4
.UserBank:.word 0x02023D6B
.MemAddress:.word 0x02023fe8


I actually got this and Judgement without the help of your second routine.
It is also displaying the correct outcome and the proper effectiveness sound is playing.
(I used Tackle and Move Effect ID 1 for this).

The problem lies with the placement of the 1st routine.
The battle script should be:
#org @main
callasm 0x8(offset of ASM ROUTINE 1+1)
attackcanceler
accuracycheck 0x81D695E 0x0
attackstring
ppreduce
calculatedamage
attackanimation
waitanimation
missmessage
cmd5c 0x0
waitstate
graphicalhpupdate 0x0
datahpupdate 0x0
critmessage
waitmessage 0x40
resultmessage
waitmessage 0x40
jumpifbyte 0x4 0x02023DCC 0x8 0x81D694E
removeitem 0x1
goto 0x81D6947
Move type changing routines should be placed before the attack canceler because it contains checks for abilities like Flash Fire, Water Absorb etc. The original battle script wouldn't account for this.
Also this might be the reason why the outcome might not be properly handled.
Judgment should a script like that of Weatherball i.e callasm then goto the regular attack routine.

Also the fail address pointer in the 1st routine should be (0x081D7DF2 - 0x5). Even though with the original value it is working. It might not be the case with other scripts.
While branching to custom scripts with callasm command, 0x5 must be subtracted from their offset, because callasm always adds 0x5 to the script pointer regardless of the branch.
That that the routine judgment won't work for a move that is not 0x0 type and you want to change to 0x0 type. Exemple : You have an fire (0xA) attack that uses this routine, and your primary type is normal(0x0), then the attack won't be changed to normal. This is because the MemAddress if by default 0, so set 0 at this place doesn't change anything. I don't know how to fix it atm but it's not a huge issue since every attack that are supposed to change type are normal by default. Just wanted to note