The first thing you'll need to do is replace the Set Foresight command with this routine.
Miracle Eye I
Code:
.text
.align 2
.thumb
.thumb_func
.global miracleye
main:
ldrb r0, [r4]
mov r1, #0xC1
cmp r0, #0x0
beq user
b target
user:
ldr r0, .usermoveloc
ldrh r0, [r0]
cmp r0, r1
bne miracleye
b foresight
target:
ldr r0, .targetmoveloc
ldrb r0, [r0]
cmp r0, r1
bne miracleye
foresight:
ldr r0, .return
bx r0
miracleye:
ldr r1, .bank
ldr r0, .halfwordloader
ldrb r2, [r0]
mov r0, #0x58
mul r2, r0
add r1, #0x50
add r2, r2, r1
ldr r0, [r2]
mov r1, #0x1A
lsl r1, r1, #0x1A
orr r0, r1
str r0, [r2]
ldr r1, .scriptloc
ldr r0, [r1]
add r0, #0x1
str r0, [r1]
bx r14
.align 2
.usermoveloc: .word 0x2023DC6
.targetmoveloc: .word 0x2023DC4
.return: .word 0x802AAA5
.bank: .word 0x2023BE4
.halfwordloader: .word 0x2023D6C
.scriptloc: .word 0x2023D74
The Set Foresight command is located at 0x02AAA5 in the rom, so just search for that pointer and replace it with a pointer to the routine above.
It's not the most optimised as I wrote it when I was just starting Assembly, and I'd probably rewrite it to use 2023D4A, but it gets the job done.
This routine allows for a new word marker to be loaded into the ram location that controls moves such as Imprison and Foresight effects. It may overlap an existing one but I can't see any noticeable side effects, so if anyone finds anything, let me know and I'll load a new word.
The next thing you'll need to do is reformat your type effectiveness table. Nothing too difficult just swap the Dark immunity to Psychic moves (0E 11 00) and the first entry in your table (which should be 00 05 05).
Miracle Eye II (This routine deals with loading the type table)
Code:
.text
.align 2
.thumb
.thumb_func
.global miracleye
check:
ldr r0, r5
ldrb r1, [r2]
mov r2, #0x58
mul r1, r2
add r0, #0x50
add r0, r0, r1
ldr r2, r4
ldr r0, [r0]
mov r1, #0x80
lsl r1, r1, #0x18
and r0, r1
cmp r0, #0x0
beq noeye
miracleyes:
mov r0, #0x41
ldr r1, .typetableskip
add r0, r3, r1
mov r3, #0x3
mov r1, r1
b return
noeye:
mov r0, #0x041
ldr r1, .typetable
add r0, r3, r1
ldrb r0, [r0]
mov r1, r1
return:
ldr r0, .return
bx r0
.align 2
.typetableskip: .word 0x0824F053
.typetable: .word 0x0824F050
.return: .word 0x0801E941
Insert 00 48 00 47 XX+1 XX XX 08 at 0x1E938 where XX XX XX is the location of this routine.
If you have expanded your type table you'll need to replace the registers with the new location of your type table,
and the offset of the entry just past the Psychic immunity. It basically checks if the Miracle Eye word is set, and if it is
it skips the first entry (which is why the Psychic immunity was moved there).