Advertiser Content

Development Move Resource Thread Page 14

Started by Spherical Ice April 22nd, 2013 10:29 PM
  • 163581 views
  • 425 replies
Male
Seen January 10th, 2019
Posted May 4th, 2017
216 posts
6.1 Years
Here are some Battle Scripts I've ported on Emerald from FireRed.

Close Combat
Spoiler:
Battle Script
Spoiler:
#dynamic 0x9C0B20
#freespacebyte 0xFF

#org @start
attackcanceler
accuracycheck 0x82D8A5E 0x0
attackstring
ppreduce
calculatedamage
attackanimation
waitanimation
missmessage
cmd5c 0x0
waitstate
graphicalhpupdate 0x0
datahpupdate 0x0
critmessage
waitmessage 0x40
resultmessage
waitmessage 0x40
faintpokemon 0x0 0x0 0x9C0B200
callasm 0x8AAAAAA + 1

Routine at AAAAAA
Spoiler:
.text
.align 2
.thumb
.thumb_func

Main:
ldr r1, .BattleData
ldr r0, .UserBank
ldrb r0, [r0]
mov r2, #0x58
mul r2, r0
add r1, #0x1a
add r1, r2
ldrb r0, [r1]
ldrb r2, [r1, #0x3]
mov r3, #0x0
cmp r0, r3
beq DefIsZero
cmp r2, r3
beq SpDefIsZero
ldr r4, .LowerBothBS
b End

DefIsZero:
cmp r2, r3
beq BothBS
ldr r4, .LowerSpDefBS
b End

SpDefIsZero:
ldr r4, .LowerDefBS
b End

BothBS:
ldr r4, .EndBS

End:
ldr r5, .ActiveBSPointer
str r4, [r5, #0x0]
bx lr

.align 2
.align 2
.BattleData: .word 0x02024084
.UserBank: .word 0x0202420B
.ActiveBSPointer: .word 0x02024214
.LowerSpDefBS: .word 0x08BBBBBB
.LowerDefBS: .word 0x08CCCCCC
.LowerBothBS: .word 0x08DDDDDD
.EndBS: .word 0x082D8A4E

Battle Script at BBBBBB: Lowers Defense
Spoiler:
#dynamic 0x9C0B20
#freespacebyte 0xFF

#org @start
setbyte 0x202448F 0x0
playstatchangeanimation 0x1 0x4 0x1
setbyte 0x202448E 0x92
statbuffchange 0x80 true @end
jumpifbyte 0x0 statchange 0x2 @end
printfromtable 0x85CC8A8
waitmessage 0x40

#org @end
goto 0x82D8A4E

Battle Script at CCCCCC: Lowers Special Defense
Spoiler:
#dynamic 0x9C0B20
#freespacebyte 0xFF

#org @start
setbyte 0x202448F 0x0
playstatchangeanimation 0x1 0x20 0x1
setbyte 0x202448E 0x95
statbuffchange 0x80 true @end
jumpifbyte 0x0 statchange 0x2 @end
printfromtable 0x85CC8A8
waitmessage 0x40

#org @end
goto 0x82D8A4E

Battle Script at DDDDD: Lowers Both Defense and Special Defense
Spoiler:
#dynamic 0x9C0B20
#freespacebyte 0xFF

#org @start
setbyte 0x202448F 0x0
playstatchangeanimation 0x1 0x24 0x1
setbyte 0x202448E 0x92
statbuffchange 0x80 true @end
jumpifbyte 0x0 statchange 0x2 @end
printfromtable 0x85CC8A8
waitmessage 0x40
setbyte 0x202448E 0x95
statbuffchange 0x80 true @end
jumpifbyte 0x0 statchange 0x2 @end
printfromtable 0x85CC8A8
waitmessage 0x40

#org @end
goto 0x82D8A4E


Hone Claws
Spoiler:
#dynamic 0x9C0B20
#freespacebyte 0xFF

#org @pickmove
jumpifhalfword 0x0 0x20241EA 0x1D4 @honeclaws
goto 0x2D8C7A

#org @honeclaws
attackcanceler
attackstring
ppreduce
jumpifstat BANK_USER 0x3 0x1 0xC @attack
jumpifstat BANK_USER B_= 0x6 0xC 0x82DA71D

#org @attack
attackanimation
waitanimation
setbyte 0x202448F 0x0
playstatchangeanimation 0x0 0x42 0x0
setbyte 0x202448E 0x11
statbuffchange 0x1 true @accuracy
jumpifbyte 0x0 0x2024337 0x2 @accuracy
printfromtable 0x85CC89C
waitmessage 0x40

#org @accuracy
setbyte 0x202448E 0x16
statbuffchange 0x1 true 0x82DA718
jumpifbyte 0x0 0x2024337 0x2 0x82DA718
printfromtable 0x85CC89C
waitmessage 0x40
goto 0x2D8A4E
0x1D4 is the index number of Hone Claws. Change it if you are using a different index number of your Hone Claws move.


Flame Charge
Spoiler:
#dynamic 0x9C0B20
#freespacebyte 0xFF

#org @pickmove
jumpifhalfword 0x0 0x20241EA 0x1E8 @speedboost
goto 0x82D9392

#org @speedboost
setbyte 0x2024335 0xD1
goto 0x82D8A00
0x1E8 is the index number of Flame Charge. Change it if you are using a different index number of your Flame Charge move.


Coil
Spoiler:
#dynamic 0x9C0B20
#freespacebyte 0xFF

#org @pickmove
jumpifhalfword 0x0 0x20241EA 0x1E9 @coil
goto 0x2DA655

#org @coil
attackcanceler
attackstring
ppreduce
jumpifstat BANK_USER 0x3 0x1 0xC @attack
jumpifstat BANK_USER 0x3 0x2 0xC @attack
jumpifstat BANK_USER B_= 0x6 0xC 0x82DA71D

#org @attack
attackanimation
waitanimation
setbyte 0x202448F 0x0
playstatchangeanimation 0x0 0x46 0x0
setbyte 0x202448E 0x11
statbuffchange 0x1 true @defense
jumpifbyte 0x0 0x2024337 0x2 @defense
printfromtable 0x85CC89C
waitmessage 0x40

#org @defense
setbyte 0x202448E 0x12
statbuffchange 0x1 true @accuracy
jumpifbyte 0x0 0x2024337 0x2 @accuracy
printfromtable 0x85CC89C
waitmessage 0x40

#org @accuracy
setbyte 0x202448E 0x16
statbuffchange 0x1 true 0x82DA718
jumpifbyte 0x0 0x2024337 0x2 0x82DA718
printfromtable 0x85CC89C
waitmessage 0x40
goto 0x2D8A4E
0x1E9 is the index number of Coil. Change it if you are using a different index number of your Coil move.


Shift Gear and Shell Smash
Spoiler:
#dynamic 0x9C0B20
#freespacebyte 0xFF

#org @pickmove
jumpifhalfword 0x0 0x20241EA 0x1FC @shiftgear
jumpifhalfword 0x0 0x20241EA 0x1F8 @shellsmash
goto 0x2DA655

#org @shiftgear
attackcanceler
attackstring
ppreduce
jumpifstat BANK_USER 0x3 0x1 0xC @attack
jumpifstat BANK_USER B_= 0x3 0xC 0x82DA71D

#org @attack
attackanimation
waitanimation
setbyte 0x202448F 0x0
playstatchangeanimation 0x0 0xA 0x0
setbyte 0x202448E 0x11
statbuffchange 0x1 true @speed
jumpifbyte 0x0 0x2024337 0x2 @speed
printfromtable 0x85CC89C
waitmessage 0x40

#org @speed
setbyte 0x202448E 0x23
statbuffchange 0x1 true 0x82DA718
jumpifbyte 0x0 0x2024337 0x2 0x82DA718
printfromtable 0x85CC89C
waitmessage 0x40
goto 0x2D8A4E

#org @shellsmash
attackcanceler
attackstring
ppreduce
jumpifstat BANK_USER 0x2 0x2 0x0 @dropdefense
jumpifstat BANK_USER B_= 0x5 0x0 @boost

#org @dropdefense
attackanimation
waitanimation
setbyte 0x202448F 0x0
playstatchangeanimation 0x1 0x24 0x9
setbyte 0x202448E 0x92
statbuffchange 0x81 true @dropspdefense
jumpifbyte 0x0 0x2024337 0x2 @dropspdefense
printfromtable 0x85CC89C
waitmessage 0x40

#org @dropspdefense
setbyte 0x202448E 0x95
statbuffchange 0x81 true @boost
jumpifbyte 0x0 0x2024337 0x2 @boost
printfromtable 0x85CC89C
waitmessage 0x40

#org @boost
jumpifstat BANK_USER 0x3 0x1 0xC @sharpattack
jumpifstat BANK_USER 0x3 0x4 0xC @sharpattack
jumpifstat BANK_USER B_= 0x3 0xC 0x82DA71D

#org @sharpattack
setbyte 0x202448F 0x0
playstatchangeanimation 0x0 0x1A 0x0
setbyte 0x202448E 0x21
statbuffchange 0x1 true @sharpspattack
jumpifbyte 0x0 0x2024337 0x2 @sharpspattack
printfromtable 0x85CC89C
waitmessage 0x40

#org @sharpspattack
setbyte 0x202448E 0x24
statbuffchange 0x1 true @sharpspeed
jumpifbyte 0x0 0x2024337 0x2 @sharpspeed
printfromtable 0x85CC89C
waitmessage 0x40

#org @sharpspeed
setbyte 0x202448E 0x23
statbuffchange 0x1 true 0x82DA718
jumpifbyte 0x0 0x2024337 0x2 0x82DA718
printfromtable 0x85CC89C
waitmessage 0x40
goto 0x2D8A4E
0x1FC and 0x1F8 are the index numbers of Shift Gear and Shell Smash respectively. Change them if you are using a different index numbers of your Shift Gear and Shell Smash moves.


Growth/Work Up/Rototiller
Spoiler:
#include abilities.bsh
#dynamic 0x9C0B20
#freespacebyte 0xFF

#org @pickmove
jumpifhalfword 0x0 0x20241EA 0x4A @growth
jumpifhalfword 0x0 0x20241EA 0x20E @workup
jumpifhalfword 0x0 0x20241EA 0x233 @rototiller
goto 0x1D6B8D

#org @growth
jumpifabilitypresent ABILITY_CLOUDNINE @workup
jumpifabilitypresent ABILITY_AIRLOCK @workup
jumpifabilitypresent ABILITY_DELTASTREAM @workup
jumpifhalfword B_& 0x20243CC 0x60 @sunlight
goto @workup

#org @sunlight
attackcanceler
attackstring
ppreduce
jumpifstat BANK_USER 0x3 0x1 0xC @attack2
jumpifstat BANK_USER B_= 0x4 0xC 0x82DA71D

#org @attack2
attackanimation
waitanimation
setbyte 0x202448F 0x0
playstatchangeanimation 0x0 0x12 0x0
setbyte 0x202448E 0x21
statbuffchange 0x1 true @spatk2
jumpifbyte 0x0 0x2024337 0x2 @spatk2
printfromtable 0x85CC89C
waitmessage 0x40

#org @spatk2
setbyte 0x202448E 0x24
statbuffchange 0x1 true 0x82DA718
jumpifbyte 0x0 0x2024337 0x2 0x82DA718
printfromtable 0x85CC89C
waitmessage 0x40
goto 0x2D8A4E

#org @workup
attackcanceler
attackstring
ppreduce
jumpifstat BANK_USER 0x3 0x1 0xC @attack
jumpifstat BANK_USER B_= 0x4 0xC 0x82DA71D

#org @attack
attackanimation
waitanimation
setbyte 0x202448F 0x0
playstatchangeanimation 0x0 0x12 0x0
setbyte 0x202448E 0x11
statbuffchange 0x1 true @spatk
jumpifbyte 0x0 0x2024337 0x2 @spatk
printfromtable 0x85CC89C
waitmessage 0x40

#org @spatk
setbyte 0x202448E 0x14
statbuffchange 0x1 true 0x82DA718
jumpifbyte 0x0 0x2024337 0x2 0x82DA718
printfromtable 0x85CC89C
waitmessage 0x40
goto 0x2D8A4E

#org @rototiller
setbyte 0x2024200 0x0
attackcanceler
attackstring
ppreduce
cmd25
jumpiftype 0x1 0xC @selfgrass
goto @call

#org @selfgrass
jumpifsecondarystatus 0x1 0x1000000 @next
jumpifstat 0x1 B_>= 0x1 0xC @next
jumpifstat 0x1 B_>= 0x4 0xC @next
jumpifbyte B_= 0x2024200 0x1 @selfnoanimation
attackanimation
waitanimation
setbyte 0x2024200 0x1

#org @selfnoanimation
cmd47
playstatchangeanimation 0x1 0x12 0x0
setbyte 0x202448E 0x11
statbuffchange 0x80 true @selfnoanimation2
jumpifbyte B_>= 0x2024337 0x2 @selfnoanimation2
printfromtable 0x85CC89C
waitmessage 0x40

#org @selfnoanimation2
setbyte 0x202448E 0x14
statbuffchange 0x80 true @next
jumpifbyte B_>= 0x2024337 0x2 @next
printfromtable 0x85CC89C
waitmessage 0x40

#org @next
cmd25

#org @call
jumpifarrayequal 0x202420B 0x202420C 0x1 @next
call @target
setbyte 0x2024488 0x0
cmd49 0x2 0x10
jumpwhiletargetvalid @next
jumpifbyte B_= 0x2024200 0x0 @nobuffs
end

#org @target
jumpiftype 0x0 0xC @grass
goto @return

#org @grass
jumpifsecondarystatus 0x0 0x1000000 @return
jumpifstat 0x0 B_>= 0x1 0xC @return
jumpifstat 0x0 B_>= 0x4 0xC @return
jumpifbyte B_= 0x02024200 0x1 @noanimation
attackanimation
waitanimation
setbyte 0x02024200 0x1

#org @noanimation
cmd47
playstatchangeanimation 0x0 0x12 0x0
setbyte 0x202448E 0x11
statbuffchange 0x0 false @noanimation2
jumpifbyte B_>= 0x2024337 0x2 @noanimation2
printfromtable 0x85CC89C
waitmessage 0x40

#org @noanimation2
setbyte 0x202448E 0x14
statbuffchange 0x0 false @return
jumpifbyte B_>= 0x2024337 0x2 @return
printfromtable 0x85CC89C
waitmessage 0x40

#org @return
return

#org @nobuffs
pause 0x20
orbyte 0x202427C 0x20
resultmessage
waitmessage 0x40
end
0x20E and 0x233 are the index numbers of Work Up and Rototiller respectively. Change them if you are using a different index numbers of your Work Up and Rototiller moves. If you do not have Delta Stream listed on abilities.bsh, just replace ABILITY_DELTASTREAM with 0xC0, it's index number.


Credits to Spherical Ice for his original Close Combat routine for FireRed, and also to mamamama for his offsets for Emerald. mamamama's post did not cover the changes in scripts so, I made changes on the scripts and fully working. Credits to MrDollSteak for the rest of the moves here.
You should remove the check for Delta Stream, if the mega/primal weather are used, the check has to be made through ASM. Indeed, if those ability are used, the fact that they are present on the field doesn't mean they're active, also, if Air lock is present but Desolate land is active, Growth still gives a +2 boost, already handled in my implementation.
Male
Antarctica
Seen January 29th, 2018
Posted September 26th, 2017
326 posts
5.4 Years
You'll need to apply this stuff, credit to Doesnt.
Also huge props to kleenexfeu, he helped me through this and is awesome.

RELIC SONG
Spoiler:
Battle script.
Spoiler:
AAAAAA is a piece of ASM related, it's next.
#include moves.bsh
#dynamic 0x800000
#org @start
jumpifhalfword B_!= 0x2023D4A 0x(index of your relic song) 0x81D6A60
setbyte 0x02023E85 0x1
attackcanceler
accuracycheck 0x81D695E 0x0
attackstring
ppreduce
calculatedamage
attackanimation
waitanimation
missmessage
cmd5c BANK_TARGET
waitstate
graphicalhpupdate BANK_TARGET
datahpupdate BANK_TARGET
critmessage
waitmessage DELAY_1SECOND
resultmessage
waitmessage DELAY_1SECOND
seteffectwithchancetarget
faintpokemon BANK_TARGET 0x0 0x8000000
callasm 0x(AAAAAA + 1)
jumpifbyte 0x1 0x020370D4 0x1 @doanimation
setbyte 0x02023FD8 0x0
cmd49 0x0 0x0
end
#org @doanimation
setbyte 0x020370D4 0x1
playanimation 0x1 0x1C 0x0 //the 0x1C is discussed in a later section, go to 'how things work' for more info
setbyte 0x02023FD8 0x0
cmd49 0x0 0x0
end

Actual forme change ASM (AAAAAA)
Spoiler:
.thumb
@in this example, pirouette form is 0xF1, and aria is 0xF0
check_pkmn_id:
 push {lr}
 ldr r0, attacking_bank
 ldrb r1, [r0] @which mon did the attack
 ldr r0, ram_pointer
 ldr r0, [r0]
 add r0, r0, #0x60
 cmp r1, #0x0
 beq set_player_singles
 cmp r1, #0x1
 beq set_enemy_singles
 cmp r1, #0x2
 beq set_player_doubles
 cmp r1, #0x3
 beq set_enemy_doubles
get_battle_struct:
 ldr r0, attacking_bank
 ldrb r1, [r0] @which mon did the attack
 mov r0, #0x58 @length of battle structs
 mul r1, r0, r1 @multiplies length of battle structs with which mon did the attack to get the the battle structure i'm working with
 ldr r0, battle_struct
 add r0, r1, r0 @r0 is the battle struct i'm working with
check_if_aria:
 add r2, r2, #0x20
 ldrh r1, [r2]
 cmp r1, #0xF0
 bne end
set_pirouette_forme:
 mov r1, #0xF1
 strh r1, [r0] @species in battle struct is now the correct thing
 strh r1, [r2] @species in party is now pirouette's
 sub r2, r2, #0x20 @makes r2 go to the beginning of the party again
 push {r0}
 mov r0, r2
 mov r1, r2
 push {r2}
 ldr r3, calc_stats
 bl jump @stats should be calculated
 pop {r2}
 pop {r0} @r2 is the beginning of the party slot, r0 is the beginning of the battle struct
update_type:
 add r0, #0x22
 mov r1, #0x1
 strb r1, [r0] @second type in battle struct is now fighting
update_battl_struct:
 sub r0, r0, #0x20
 add r2, r2, #0x5A @r0 is at the attack stat, r2 is at the party attack stat
 mov r3, #0x0
stat_loop:
 ldrh r1, [r2]
 strh r1, [r0]
 add r0, r0, #0x2
 add r2, r2, #0x2
 add r3, r3, #0x1
 cmp r3, #0x4
 bne stat_loop
end:
 pop {pc}
jump:
 mov pc, r3
set_player_singles:
 ldrb r0, [r0]
 lsr r0, #0x4 @only one digit is left
 mov r1, #0x64 @length of party entry
 ldr r2, player_party
 mul r0, r0, r1
 add r2, r0, r2 @gets r2 to the correct slot
 b get_battle_struct
set_enemy_singles:
 add r0, r0, #0x3 @gets to party order for enemy
 ldrb r0, [r0]
 lsr r0, #0x4
 mov r1, #0x64
 ldr r2, enemy_party
 mul r0, r0, r1
 add r2, r0, r2
 b get_battle_struct
set_player_doubles:
 ldrb r0, [r0]
 lsl r0, #0x1C
 lsr r0, #0x1C @gets the second pokemon's location
 mov r1, #0x64
 ldr r2, player_party
 mul r0, r0, r1
 add r2, r0, r2
 b get_battle_struct
set_enemy_doubles:
 add r0, r0, #0x3
 ldrb r0, [r0]
 lsl r0, #0x1C
 lsr r0, #0x1C 
 mov r1, #0x64
 ldr r2, enemy_party
 mul r0, r0, r1
 add r2, r0, r2
 b get_battle_struct
.align 2
battle_struct: .word 0x02023BE4
player_party: .word 0x02024284
enemy_party: .word 0x0202402C
order_pointer: .word 0x02023FE8
attacking_bank: .word 0x02023D6B
calc_stats: .word 0x0803E47C
ram_pointer: .word 0x02023FE8

Revert (BBBBBB)
Spoiler:
.thumb @the hooks decide whether or not to use the enemy's party table or
.align 2 @the player's, that's why they're not here.
start:
 push {lr}
 add r0, r0, #0x20
loop:
 ldrh r1, [r0]
 cmp r1, #0xF1 @compares the species to pirouette forme
 beq push_hp @if the pokemon is pirouette forme, reverts the pokemon
 add r0, r0, #0x64 @goes to the next slot
 add r2, r2, #0x1 @sets counter to one more
 cmp r2, #0x5 @checks if whole party has been scanned
 bne loop @if it hasn't happened 6 times it'll loop again
skip:
 pop {pc} @ends if nothing in the party is pirouette forme
push_hp:
 add r0, r0, #0x36
 ldrh r3, [r0]
 mov r4, r0
 push {r3}
 push {r4}
revert:
 mov r1, #0xF0
 strh r1, [r0] @makes species aria forme
 sub r0, r0, #0x56 @makes r0 the beginning of the party
 mov r1, r0 @r0 and r1 should be the same
 ldr r2, calc_stats
 bl jump
fix_hp:
 pop {r4}
 pop {r3} @r3 is the current hp, r4 is the offset of that
 strh r3, [r4]
continue:
 pop {pc} @ends
jump:
 mov pc, r2 @executes calc_stats
.align 2
calc_stats: .word 0x0803E47C

Hook just about everwhere.
Spoiler:
The switch check (credit to MrDollSteak for his Regenerator code)
.text @00 48 00 47 XX+1 XX XX 08 00 00 at 02CCDC
.align 2
.thumb
.thumb_func
.global regenerator
check_active:
 cmp r0, #0x1
 beq set_enemy
 cmp r0, #0x3
 beq set_enemy
 push {r0-r4}
 ldr r0, player_party
revert:
 ldr r1, revert_to_aria
 bl jump_with_r1
 ldr r0, ram_loc
 mov r1, #0x0
 strh r1, [r0]
 pop {r0-r4}
AbilityBuffer:
 add r0, r1, r3
 add r0, #0x20
 ldrb r0, [r0]
RegeneratorCheck:
 cmp r0, #0x91
 beq Regenerator
NaturalCureCheck:
 cmp r0, #0x1E
 bne NoAbility
NaturalCure:
 ldr r0, .Return
 bx r0
NoAbility:
 ldr r0, .Return2
 bx r0
Regenerator:
GetHP:
 add r3, #0x28
 add r3, r1, r3
 ldrh r0, [r3, #0x4]
 mov r1, #0x20
 mul r0, r1
 mov r1, #0x60
 push {r3}
 bl Divide
 pop {r3}
 ldrh r1, [r3]
 add r0, r0, r1
CheckHP:
 ldrh r2, [r3, #0x4]
 cmp r0, r2
 ble StoreHP
MaxHP:
 mov r0, r2
StoreHP:
 strh r0, [r3]
BufferHealthChange:
 ldr r2, .CommandTable
 ldrb r1, [r4]
 ldr r0, .RamLoc
 ldr r0, [r0]
 add r0, r1, r0
 add r0, #0x58
 ldrb r0, [r0]
 lsl r0, r0, #0x2
 add r0, r0, r2
 ldrb r2, [r0]
 mov r0, r1
 mul r0, r6
 add r0, r0, r3
 str r0, [sp]
 mov r0, #0x0
HealthChangeIndex:
 mov r1, #0x2A
Success:
 ldr r3, .Return3
 bx r3
Divide:
 ldr r3, .DivideLoc
 bx r3
set_enemy:
 push {r0-r4}
 ldr r0, enemy_party
 b revert
jump_with_r1:
 mov pc, r1
.align 2
.Return: .word 0x0802CCE7
.Return2: .word 0x0802CD1B
.CommandTable: .word 0x0825E45C
.RamLoc: .word 0x02023FE8
.Return3: .word 0x0802CD0F
.DivideLoc: .word 0x081E4019
revert_to_aria: .word 0x08BBBBBB
player_party: .word 0x02024284
enemy_party: .word 0x0202402C
ram_loc: .word 0x020370D4
Faint hook
.thumb @00 4B 9F 46 XX XX XX 08 at 0x326C4
.align 2
faint_hook:
 add r0, r2
 push {r0-r3}
 ldr r0, player_party
 ldr r3, revert_to_aria
 bl call_via_r3
 ldr r0, ram_loc
 mov r1, #0x0
 strh r1, [r0]
 pop {r0-r3}
continue:
 ldr r3, =(0x08035244 + 1)
 bl call_via_r3
 mov r1, #0x40
 ldr r3, =(0x080326CC + 1)
call_via_r3:
 bx r3
.align 2
revert_to_aria: .word 0x08BBBBBB + 1
player_party: .word 0x02024284
ram_loc: .word 0x020370D4
End battle hook
.thumb @00 48 00 47 XX+1 XX XX 08 at 0x159DC
start:
 push {r0-r4}
 ldr r0, player_party
 ldr r1, revert
 bl jump
 ldr r0, ram_loc
 mov r1, #0x0
 strh r1, [r0]
 pop {r0-r4}
 ldr r1, =(0x03004F84)
 ldr r0, =(0x08015A31)
 str r0, [r1]
 ldr r1, =(0x0300537C)
 ldr r0, =(0x080159E5)
 bx r0
jump:
 mov pc, r1
.align 2
revert: .word 0x08BBBBBB
ram_loc: .word 0x020370D4
player_party: .word 0x02024284

For you more attentive people out there, here are the things that work behind the scenes to make this work.
Spoiler:
Fixing the weird fading palette thing from Transform
.thumb @00 48 87 46 XX XX XX 08 at 0x34FFC
start:
 ldr r0, current_move
 ldrh r0, [r0]
 cmp r0, #0x90 @compares move to Tranform
 bne nopalfade
continue:
 ldr r3, thing
 mov r0, r10
 mov r1, #0x10
 mov r2, #0x6
 ldr r4, palfade
 bl jump
 ldr r1, return
 mov pc, r1
nopalfade:
 ldr r0, return2
 mov pc, r0
jump:
 mov pc, r4
.align 2
current_move: .word 0x02023D4A
thing:  .word 0x7FFF
palfade: .word 0x08045274
return:  .word 0x08035008
return2: .word 0x08035036
Here's the reason that we're even talking about the 0x1C animation and Transform.
Spoiler:
There is a pointer at 0x34150. This pointer is the pointer to the playanimation table. Go to where that's pointing to, and copy 0x70 bytes and place that in free space. Right after that, write 11 28 1D 08, which is the pointer to the Transform animation.
That's animation number 0x1C. If you know you've expanded this in the past(I think Mega Evolution by Touched does this), then you'll add 4 bytes to the amount you're copying, and add 1 to the 1C(or more if you've done it more times).

Here's how to make this compatible with mega-evolutions if you've already added them(apply mega evolutions first if at all)
Spoiler:
Go to 0x326C8 in a hex editor, and you'll see a pointer. Add 3 to that pointer, and then follow the new pointer in a dissassembler. VBA has one built in. There should be a bl (some random offset). We'll call that YYYYYY.
Fixing the faint hook; after the first bl call_via_r3, write
ldr r0, player_party
ldr r3, revert_mega
bl call_via_r3
Go to the .align 2 at the bottom and add a new line. It'll be revert_mega: .word 0x08YYYYYY + 1
Fixing the exit battle hook; after bl jump, write
ldr r0, player_party
ldr r1, revert_mega
bl jump
Go to the .align 2 at the bottom and add a new line. It'll be revert_mega: .word 0x08YYYYYY
You do not need to add the + 1 this time.


~EDIT~ now completely bug free yay
Male
Seen January 10th, 2019
Posted May 4th, 2017
216 posts
6.1 Years
Here are more Emerald implementations from FireRed.

Flower Shield
Spoiler:
#dynamic 0x800000
#freespacebyte 0xFF

#org @Effect11
setbyte 0x202448E 0x12
jumpifhalfword B_= 0x20241EA 0x243 @FlowerShield
goto 0x2D8CA1

#org @FlowerShield
setbyte 0x02024200 0x0
attackcanceler
attackstring
ppreduce
cmd25
jumpiftype 0x1 0xC @SelfGrass
goto @Call

#org @SelfGrass
jumpifsecondarystatus 0x1 0x1000000 @NextTarget
jumpifstat 0x1 B_>= 0x2 0xC @NextTarget
jumpifbyte B_= 0x02024200 0x1 @SelfNoAnimation
attackanimation
waitanimation
setbyte 0x02024200 0x1
goto @SelfNoAnimation

#org @SelfNoAnimation
cmd47
playstatchangeanimation 0x1 0x4 0x0
statbuffchange 0x80 true @NextTarget
jumpifbyte B_>= 0x2024337  0x2 @NextTarget
printfromtable 0x85CC89C
waitmessage 0x40

#org @NextTarget
cmd25

#org @Call
jumpifarrayequal 0x202420B 0x202420C 0x1 @NextTarget
call @TargetBuff
setbyte 0x2024488 0x0
cmd49 0x2 0x10
jumpwhiletargetvalid @NextTarget
jumpifbyte B_= 0x02024200 0x0 @NoBuffs
end

#org @TargetBuff
jumpiftype 0x0 0xC @Grass
goto @Return

#org @Grass
jumpifsecondarystatus 0x0 0x1000000 @Return
jumpifstat 0x0 B_>= 0x2 0xC @Return
jumpifbyte B_= 0x02024200 0x1 @NoAnimation
attackanimation
waitanimation
setbyte 0x02024200 0x1
goto @NoAnimation

#org @NoAnimation
cmd47
playstatchangeanimation 0x0 0x4 0x0
statbuffchange 0x0 false @Return
jumpifbyte B_>= 0x2024337 0x2 @Return
printfromtable 0x85CC89C
waitmessage 0x40

#org @Return
return

#org @NoBuffs
pause 0x20
orbyte 0x202427C 0x20
resultmessage
waitmessage 0x40
end
Replace effect 11 with this battle script. 0x243 is the index number of Flower Shield. Change it if you are using another different index number of your Flower Shield move.


Cotton Guard
Spoiler:
This requires Setword and Battle String Loader hack implemented.
#dynamic 0x800000
#freespacebyte 0xFF

#org @pickmove
jumpifhalfword 0x0 0x20241EA 0x21A @cottonguard
goto 0x2D921D

#org @cottonguard
jumpifstat BANK_USER B_>= 0x2 0xA 0x2D921D
jumpifstat BANK_USER B_>= 0x2 0xB 0x2D8C85
attackcanceler
attackstring
ppreduce
setbyte 0x202448E 0x22
statbuffchange 0x1 true 0x82D8CCF
jumpifbyte 0x0 0x2023E87 0x2 0x82D8CC7

#org @singleboost
attackanimation
waitanimation
cmd47
playanimation BANK_USER 0x1 0x2024484
setbyte 0x202448E 0x12
statbuffchange 0x1 true 0x82D8CCF
jumpifbyte 0x0 0x2024337 0x2 0x82D8CCF

#org @end
setword 0x203E320 0x8CCCCCC
printstring 0x184
waitmessage DELAY_1SECOND
goto 0x82D8A4E
String at CCCCCC:
FD 0F B4 E7 00 BE D9 DA D9 E2 E7 D9 FE D8 E6 D5 E7 E8 DD D7 D5 E0 E0 ED 00 E6 E3 E7 D9 AB
Replace effect 51 with this battle script. 0x21A is the index number of Cotton Guard. Change it if you are using another different index number of your Cotton Guard move.


Tail Glow
Spoiler:
This requires Setword and Battle String Loader hack implemented.
#dynamic 0x800000
#freespacebyte 0xFF

#org @pickmove
jumpifhalfword 0x0 0x20241EA 0x126 @tailglow
goto 0x1D7119

#org @tailglow
jumpifstat BANK_USER B_>= 0x4 0xA 0x2D9233
jumpifstat BANK_USER B_>= 0x4 0xB 0x2D8C90
attackcanceler
attackstring
ppreduce
setbyte 0x202448E 0x24
statbuffchange 0x1 true 0x82D8CCF
jumpifbyte 0x0 0x2024337 0x2 0x82D8CC7

#org @singleboost
attackanimation
waitanimation
cmd47
playanimation BANK_USER 0x1 0x2024484
setbyte 0x2023FDE 0x14
statbuffchange 0x1 true 0x82D8CCF
jumpifbyte 0x0 0x2023E87 0x2 0x82D8CC7

#org @end
setword 0x203E320 0x8DDDDDD
printstring 0x184
waitmessage DELAY_1SECOND
goto 0x82D8A4E
String at CCCCCC:
FD 0F B4 E7 00 CD E4 AD 00 BB E8 DF FE D8 E6 D5 E7 E8 DD D7 D5 E0 E0 ED 00 E6 E3 E7 D9 AB
Replace effect 53 with this battle script. 0x126 is the index number of Tail Glow.


Charge
Spoiler:
#dynamic 0x800000
#freespacebyte 0xFF

#org @charge
attackcanceler
attackstring
ppreduce
setcharge
attackanimation
waitanimation
printstring 0xA5
waitmessage DELAY_1SECOND

#org @spdefboost
setbyte 0x202448E 0x15
statbuffchange 0x1 true 0x82D8CCF
jumpifbyte B_!= 0x2023E87 0x2 0x82D8CCF
goto 0x82D8CBF
Replace effect 174 with this battle script. It's Charge but now with a permanent Sp. Def boost that's added after the charge effect to match the message style of Gen V.


Assurance
Spoiler:
This requires Callasm command implemented.

Battle Script:
#dynamic 0x800000
#freespacebyte 0xFF

#org @start
callasm 0x8AABBCC +1
Routine at AABBCC:
.text
.align 2
.thumb
.thumb_func

Main:
ldr r1, .PhysDamage
ldr r0, .TargetBank
ldrb r0, [r0]
mov r2, #0x10
mul r2, r0
add r1, r2
ldrb r0, [r1]
ldrb r2, [r1, #0x2]
mov r3, #0x0
cmp r0, r3
bne DoubleDamage
cmp r2, r3
bne DoubleDamage
b End

DoubleDamage:
ldr r3, .DamageMultiplier
mov r0, #0x2
strb r0, [r3, #0x0]

End:
ldr r4, .ReturnBS
ldr r5, .ActiveBSPointer
str r4, [r5, #0x0]
bx lr

.align 2
.PhysDamage:		.word 0x02024340
.TargetBank:		.word 0x0202420C
.ActiveBSPointer:	.word 0x02024214
.DamageMultiplier:	.word 0x02024482
.ReturnBS:		.word 0x082D8A26


Crush Grip
Spoiler:
.text
.align 2
.thumb
.thumb_func
.global crushgrip

main:
push {lr}
ldr r0, targetBank
ldrb r0, [r0]
ldr r1, battleData
mov r2, #0x58
mul r0, r2
add r3, r0, r1
ldrh r0, [r3, #0x28]
mov r2, #0x78
mul r0, r2
ldrh r1, [r3, #0x2c]
bl divide
mov r1, #0x1
add r1, r0
ldr r2, basePower
strb r1, [r2]
pop {r0}
bx r0

divide:
ldr r2, divider
bx r2

.align 2
targetBank: .word 0x0202420C
battleData: .word 0x02024084
divider: .word 0x082E7541
basePower: .word 0x02024400
Just use the callasm statement after the announcement of attack and before the damage calculation.


Topsy-Turvy
Spoiler:
This requires Callasm, Setword, and Battle String Loader hack implemented.
Battle Script:
#org @main
attackcanceler
attackstring
ppreduce
callasm 0x8DDDDDD+1
attackanimation
waitanimation
setword 0x203E320 0x8CCCCCC
printstring 0x184
waitmessage 0x40
goto 0x82D8A4E
Routine at DDDDDD:
.text
.align 2
.thumb
.thumb_func
.global topsyturvy

main:
push {lr}
ldr r0, targetBank
ldrb r0, [r0]
ldr r1, battleData
mov r2, #0x58
mul r0, r2
add r2, r0, r1
add r2, #0x19
mov r0, #0x0
mov r1, #0x6
loop: 
add r3, r2, r0
ldrb r4, [r3]
cmp r4, #0x6
beq loopend
cmp r4, #0x6
bgt greater
sub r5, r1, r4
lsl r5, #0x1
add r4, r5
strb r4, [r3]
b loopend

greater:
sub r5, r4, #0x6
lsl r5, #0x1
sub r4, r5
strb r4, [r3]

loopend:
add r0, #0x1
cmp r0, #0x7
blt loop
pop {r0}
bx r0

.align 2
targetBank: .word 0x0202420C
battleData: .word 0x02024084
String at CCCCCC:
FD 10 B4 E7 00 E7 E8 D5 E8 E7 00 D7 DC D5 E2 DB D9 E7 00 EB D9 E6 D9 FE E6 D9 EA D9 E6 E7 D9 D8 AB FF


Final Gambit
Spoiler:
This requires Callasm command installed.
Battle Script:
#org @main
attackcanceler
accuracycheck 0x82D8A5E 0x0
attackstring
ppreduce
cmd6
bicbyte 0x202426C 0x6
callasm 0x08AAAAAA+1
cmd69
attackanimation
waitanimation
missmessage
cmd5c 0x0
waitstate
graphicalhpupdate 0x0
datahpupdate 0x0
critmessage
waitmessage 0x40
resultmessage
waitmessage 0x40
faintpokemon 0x0 0x0 0x8000000
jumpifbyte 0x0 0x202426C 0x8 0x82D8A4E
setuserhptozero
graphicalhpupdate 0x1
datahpupdate 0x1
faintpokemon 0x1 0x0 0x8000000
goto 0x82D8A4E
Routine at AAAAAA:
Spoiler:
.text
.align 2
.thumb
.thumb_func
.global finalgambit

main:
push {lr}
ldr r0, userBank
ldrb r0, [r0]
ldr r1, battleData
mov r2, #0x58
mul r0, r2
add r2, r0, r1
add r2, #0x28
ldrb r0, [r2]
ldr r2, damage
strb r0, [r2]
pop {r0}
bx r0

.align 2
userBank: .word 0x0202420B
battleData: .word 0x02024084
damage: .word 0x020241F0


Credits Spherical Ice for Assurance, KDS for Crush Grip, Topsy-Turvy and Final Gambit, and MrDollSteak for the rest I've modified originally all of these are for FireRed.

I've edited my implementation into Emerald of Work Up and Growth on my previous post. It finally includes Rototiller as if I've used MrDollSteak's script than Tlachtli's anymore.

And one more thing, I've found a "setword" command being already existed in BSP. I just dunno if this is exactly what we are mostly using to call a free RAM location and a string. However, the existing setword command doesn't have its index number display but it gets the same description. But, I assure it isn't (if Jambo also made the command so why the callasm isn't included in the unmodified BSP). I think we should stop using "setword" on "setword 0x203E320 0x89CDCDC" and use "loadstring" or something else or whatever might anyone want unless we can modify the program to replace "setword" into something else."
There are several typos in these BS : goto 0x2D9XXX instead of 0x82D9XXX, sometimes the location are still from fire red too.
They appear multiple times in several battlescripts

Chacha Dinosaur

Adamant and adaptive dinosaur.

Age 24
Male
Seen March 4th, 2018
Posted September 8th, 2017
454 posts
6.1 Years
King Shield, Spiky Shield, Quick Guard, Wide Guard, Crafty Shield, Mat Block

Spoiler:

With kleenexfeu telling me a wonderful trick to compile multiple different type of resources together in just a single click that he used in his Emerald Mega implementation too, the protection moves are also implemented using the same trick which makes it ridiculously easy to insert any resource when using ASM.

Emerald:-
Spoiler:

The red portion can be changed according to your ROM.
For Quick Guard, you need to additionally compile and insert this or the routine for speed related Abilities in the Ability resource thread and then set the value of the Priority BL to an appropriate value. The location is 0x803D074 if you are using the first one.

Give these moves 111 as Effect ID.
The routine uses Move IDs to distinguish the effects of Protection moves. See the Protection Move Table in the lower portion of the code fragment to find the Move IDs controlling the code.


.thumb
.thumb_func
.global protectionmoves

.equ Myloc, 0xE00000   @Location of non hooking resource area (main routines plus Battle Scripts and Strings). Requires 0x598 bytes of free space.
.equ YourWordLocation, 0x203E320  @RAM Area used for Battle String Loader Hack.
.equ MoveDataLoc, 0x831C898
.equ PriorityBLLoc, 0x8888888  @Compile the first side BC rewrite in the ASM resource thread. 
.equ MagicGuardIndex, 0x63
.equ DefiantIndex, 0x81
.equ CompetitiveIndex, 0xAD
.equ SetWordCommand, 0xFB
.equ CallasmCommand, 0xF9

@ScriptStringReferences

.equ PMTLoc, RomAreaOffset+ProtectionMoveTable
.equ POTLoc, RomAreaOffset+ProtectionOddTable
.equ NPMLoc, RomAreaOffset+NewMessageScript
.equ MatStringLoc, RomAreaOffset+MatMessage
.equ GuardStringUserLoc, RomAreaOffset+GuardMessageUser
.equ GuardStringFoeLoc, RomAreaOffset+GuardMessageFoe
.equ NMSLoc, RomAreaOffset+NewMessageScript

@@ Character table.

.equ Space, 0x0
.equ JumpLine, 0xFE
.equ BuffCharac, 0xFD
.equ Apos, 0xB4
.equ Dot, 0xAD
.equ Exclam, 0xAB
.equ Termin, 0xFF
.equ Dash, 0xAE

.equ A_, 0xBB
.equ B_, 0xBC
.equ C_, 0xBD
.equ D_, 0xBE
.equ E_, 0xBF
.equ F_, 0xC0
.equ G_, 0xC1
.equ H_, 0xC2
.equ I_, 0xC3
.equ J_, 0xC4
.equ K_, 0xC5
.equ L_, 0xC6
.equ M_, 0xC7
.equ N_, 0xC8
.equ O_, 0xC9
.equ P_, 0xCA
.equ Q_, 0xCB
.equ R_, 0xCC
.equ S_, 0xCD
.equ T_, 0xCE
.equ U_, 0xCF
.equ V_, 0xD0
.equ W_, 0xD1
.equ X_, 0xD2
.equ Y_, 0xD3
.equ Z_, 0xD4

.equ a_, 0xD5
.equ b_, 0xD6
.equ c_, 0xD7
.equ d_, 0xD8
.equ e_, 0xD9
.equ f_, 0xDA
.equ g_, 0xDB
.equ h_, 0xDC
.equ i_, 0xDD
.equ j_, 0xDE
.equ k_, 0xDF
.equ l_, 0xE0
.equ m_, 0xE1
.equ n_, 0xE2
.equ o_, 0xE3
.equ p_, 0xE4
.equ q_, 0xE5
.equ r_, 0xE6
.equ s_, 0xE7
.equ t_, 0xE8
.equ u_, 0xE9
.equ v_, 0xEA
.equ w_, 0xEB
.equ x_, 0xEC
.equ y_, 0xED
.equ z_, 0xEE


.equ RomAreaOffset, 0x8000000

.align 2
.org 0x464B4
    ldr r0, .Hook1
    bx r0

.align 2
.Hook1: .word Main2+RomAreaOffset+1

.align 2
.org 0x48410
    ldr r0, .Hook2
    bx r0

.align 2
.Hook2: .word ProtectMessageCheck+RomAreaOffset+1

.align 2
.org 0x4DF8C
    ldr r0, .Hook3
    bx r0

.align 2
.Hook3: .word RomAreaOffset+Main+1

.align 2
.org Myloc
Main:
    push {r4-r7, lr}

LoadAttackerBank:            
    ldr r1, .Attacker
    ldrb r5, [r1]

LoadConsecutiveSuccessfulProtectUsage:
    ldr r2, .DisableStruct
    lsl r0, r5, #0x3
    sub r0, r0, r5
    lsl r0, r0, #2
    add r3, r0, r2 @Disable Data

CheckIfLastMover:
    ldr r0, .CurrentTurnOrderIteration
    ldrb r1, [r0]
    ldr r0, .NoOfBattlers
    ldrb r0, [r0]
    sub r0, #1
    cmp r1, r0
    beq Fail

CheckCurrentMove:
    ldr r1, .CurrMove
    ldrh r1, [r1]

LoadProtectTypeTable:
    ldr r7, .ProtectionMoveTableLoc
    mov r6, r7

LoadFFFFHalfword:
    mov r2, #0xFF
    lsl r4, r2, #0x8
    add r4, r4, r2
    
Loop:
    ldrh r2, [r7]
    cmp r2, r4
    beq Fail
    cmp r2, r1
    beq CheckForNoFailure
    add r7, r7, #0x4
    b Loop   

CheckForNoFailure:
    ldrb r2, [r7, #0x2]
    lsl r0, r2, #0x18
    cmp r0, #0x0
    bge MatCheck
    
CheckMoveUsedPreviousTurn:
    ldr r2, .PreviousTurnMoveData
    lsl r0, r5, #1
    add r0, r0, r2
    ldrh r0, [r0]  

Loop2:
    ldrh r1, [r6]
    cmp r1, r4
    beq ZeroFailureOdds
    cmp r1, r0
    beq CheckIfPrevMoveDecreasesOdds
    add r6, r6, #0x4
    b Loop2
  
CheckIfPrevMoveDecreasesOdds:
    ldrb r2, [r6, #0x2]
    lsl r2, r2, #0x19
    cmp r2, #0x0
    blt CheckFailureOdds

ZeroFailureOdds:
    mov r1, #0x0
    strb r1, [r3, #0x8]
    b Success

CheckFailureOdds:
    ldrb r1, [r3, #0x8]
    cmp r1, #0x0
    beq MatCheck
    cmp r1, #0x10
    bge Fail
    ldr r2, .ProtectionOddTableLoc
    lsl r4, r1, #1
    add r4, r4, r2
    ldr r0, .RNG
    bl Linker
    ldrh r1, [r4]
    lsl r0, r0, #0x10
    lsr r0, r0, #0x10
    cmp r1, r0
    bcc Fail

MatCheck:
    ldrb r0, [r7, #0x3]
    lsr r0, r0, #0x4
    cmp r0, #0x4
    bne Success

FirstTurnCheck:
    ldrb r0, [r3, #0x16]
    cmp r0, #0x1
    bne Fail

Success:
    ldrb r4, [r7, #0x2]
    lsl r1, r4, #0x19
    lsl r2, r4, #0x1C
    lsr r2, r2, #0x1C

CheckIfMoveDecreasesOddsForSuccessiveUse:
    cmp r1, #0x0
    beq LoadProtectStructByte
    ldrb r0, [r3, #0x8]
    add r0, r0, #1
    strb r0, [r3, #0x8]

LoadProtectStructByte:
    ldr r3, .ProtectStruct
    add r3, r2, r3

LoadOrringBit:
    ldrb r1, [r7, #0x3]
    lsl r1, r1, #0x1C
    lsr r1, r1, #0x1A
    ldr r0, .PowersOfTwo
    add r1, r1, r0
    ldr r6, [r1] 

SetBitsForUser:    
    lsl r1, r5, #4
    add r1, r1, r3
    ldrb r0, [r1]
    orr r0, r6
    strb r0, [r1] 
    lsl r0, r4, #0x1A
    cmp r0, #0x0
    blt TeamProtectionMove

SingleProtectionMove:
    ldrb r0, [r7, #0x3]
    lsr r0, r0, #0x4
    b SetMessage

Fail: 
    mov r1, #0x0
    strb r1, [r3, #0x8]
    ldr r1, .Outcome
    ldrb r0, [r1]
    mov r2, #0x1 
    orr r0, r2
    strb r0, [r1]
    mov r0, #0x2
 
SetMessage:
    ldr r1, .MultiStringChooser
    strb r0, [r1, #0x5]
    ldr r1, .ScriptPointer
    ldr r0, [r1]
    add r0, r0, #0x1
    b Exit

TeamProtectionMove:
CheckForDoubleBattles:
    ldr r4, .NoOfBattlers
    ldrb r4, [r4]
    cmp r4, #0x2
    beq SetTeamMessage
    
SetBitsForPartner:
    mov r4, #2
    eor r4, r5
    lsl r1, r4, #4
    add r1, r1, r3    
    ldrb r0, [r1]
    orr r0, r6
    strb r0, [r1] 

SetTeamMessage:
    ldrb r0, [r7, #0x3]
    lsr r0, r0, #0x4
    cmp r0, #0x4 
    bne GuardMessage
    
MatBlockMessage:
    ldr r2, .MatString
    b BranchToCustomMessageBS

GuardMessage:
    mov r0, r5
    ldr r2, .GuardStringUser
    mov r1, #0x1
    and r0, r1
    cmp r0, #0x0
    beq BranchToCustomMessageBS 
    
FoeMessage:
    ldr r2, .GuardStringFoe

BranchToCustomMessageBS:
    ldr r1, .StringLoaderOffset
    str r2, [r1]
    ldr r1, .ScriptPointer
    ldr r0, .OtherMessageBS
    
        
Exit:
    str r0, [r1]
    pop {r4-r7}
    pop {r0}
    bx r0

Linker:
    bx r0

.align 2
.Attacker: .word 0x202420B
.DisableStruct: .word 0x20242BC
.CurrentTurnOrderIteration: .word 0x2024082
.NoOfBattlers: .word 0x202406C
.CurrMove: .word 0x20241EA
.ProtectionMoveTableLoc: .word PMTLoc
.PreviousTurnMoveData: .word 0x2024260
.ProtectionOddTableLoc: .word POTLoc
.ProtectStruct: .word 0x202433C
.PowersOfTwo: .word 0x832A328
.StringLoaderOffset: .word YourWordLocation
.GuardStringUser: .word GuardStringUserLoc
.GuardStringFoe: .word GuardStringFoeLoc
.MatString: .word MatStringLoc
.Outcome: .word 0x202427C
.MultiStringChooser: .word 0x2024332
.ScriptPointer: .word 0x2024214
.RNG: .word 0x806F5CC+1
.OtherMessageBS: .word NMSLoc

@@@@@@@@@@@@@@@Protection Conditions:
.align 2

Main2:
   push {r3-r7}
LoadProtectStructs:
   ldr r1, .ProtectStruct2
   ldr r7, .Attacker2
   ldrb r0, [r7, #0x1]
   lsl r0, r0, #0x4
   add r5, r0, r1

LoadMoveData:
   ldr r2, .MoveData2
   ldr r0, .CurrMove2
   ldrh r1, [r0]
   lsl r0, r1, #0x1
   add r0, r0, r1
   lsl r0, r0, #0x2
   add r6, r0, r2

CheckProtectableMove:
   ldrb r1, [r6, #8]
   mov r0, #0x2
   and r0, r1
   cmp r0, #0x0
   beq NoProtection

CheckProtect:
   ldrb r0, [r5]
   lsl r0, r0, #0x1F
   cmp r0, #0x0
   bne Protection

CheckKingShield:
   ldrb r4, [r6, #0xA] 
   ldrb r2, [r5, #0x3]
   lsl r0, r2, #0x1F
   cmp r0, #0x0
   beq CheckSpikyShield  
   cmp r4, #0x2
   bne Protection
   b NoProtection

CheckSpikyShield:
   lsl r0, r2, #0x1E
   cmp r0, #0x0 
   blt Protection

CheckWideGuard:
   lsl r0, r2, #0x1D
   cmp r0, #0x0
   bge CheckQuickGuard
   cmp r4, #0x2
   beq NoProtection
   ldrb r1, [r6, #0x6]
   cmp r1, #0x8
   beq Protection
   cmp r1, #0x20
   beq Protection
   b NoProtection 

CheckQuickGuard:
   lsl r0, r2, #0x1C
   cmp r0, #0x0
   bge CheckCraftyShield
   sub r7, #0x1
   ldrb r0, [r7]
   ldr r1, .LoadMovePriorityBL
   bl Linker2
   cmp r0, #0x0
   bgt Protection
   b NoProtection

CheckCraftyShield:
   lsl r0, r2, #0x1B
   cmp r0, #0x0
   bge CheckMatBlock
   cmp r4, #0x2
   beq Protection
   b NoProtection

CheckMatBlock:
   lsl r0, r2, #0x1A
   cmp r0, #0x0
   bge NoProtection
   cmp r4, #0x2
   bne Protection

NoProtection:
   ldr r1, .ReturnProtectBL1
   pop {r3-r7}
   bx r1

Protection:
   ldr r1, .ReturnProtectBL2
   pop {r3-r7}
   bx r1

.align 2
.ProtectStruct2: .word 0x202433C
.Attacker2: .word 0x202420B
.MoveData2: .word MoveDataLoc
.CurrMove2: .word 0x20241EA
.LoadMovePriorityBL: .word PriorityBLLoc+1
.ReturnProtectBL1: .word 0x80464F9
.ReturnProtectBL2: .word 0x80464DF

@@@@@@@@@@@@@@@After Protection Effects
ProtectMessageCheck:
   ldrb r0, [r7, #0x6]
   cmp r0, #0x1
   bne MissMessage

CheckProtectEffect:
   push {r1} 
   ldr r0, .Attacker3
   ldrb r0, [r0, #0x1]
   lsl r0, r0, #0x4
   ldr r1, .ProtectStruct3   
   add r1, r1, r0
   ldrb r2, [r1, #0x0]
   lsl r0, r2, #0x1F   
   cmp r0, #0x0
   bne ProtectEffect

CheckKingShieldEffect:
   ldrb r2, [r1, #0x3]
   lsl r0, r2, #0x1F
   cmp r0, #0x0
   blt CheckContactMove

CheckSpikyShieldEffect:
   lsl r0, r2, #0x1E
   cmp r0, #0x0 
   blt CheckContactMove2
   
CheckWideGuardEffect:
   lsl r0, r2, #0x1D
   cmp r0, #0x0
   bge CheckQuickGuardEffect
   ldr r6, .WGPMessage
   b LoadCustomMessage   

CheckQuickGuardEffect:
   lsl r0, r2, #0x1C
   cmp r0, #0x0
   bge CheckCraftyShieldEffect
   ldr r6, .QGPMessage
   b LoadCustomMessage 

CheckCraftyShieldEffect:
   lsl r0, r2, #0x1B
   cmp r0, #0x0
   bge CheckMatBlockEffect
   ldr r6, .CSPMessage
   b LoadCustomMessage
 
CheckMatBlockEffect:
   lsl r0, r2, #0x1A
   cmp r0, #0x0
   bge ProtectEffect
   ldr r6, .MBPMessage

LoadCustomMessage:
   pop {r1}    
   ldr r0, .StringLoaderOffset3
   str r6, [r0]
   mov r3, #0xC2
   lsl r3, r3, #0x1
   b Exit3

CheckContactMove2:
   ldr r3, .CurrMove3
   ldr r2, .MoveData3
   ldrh r3, [r3]
   lsl r0, r3, #1
   add r0, r0, r3
   lsl r0, r0, #2
   add r0, r0, r2
   ldrb r0, [r0, #0x8]
   lsl r0, r0, #0x1F
   cmp r0, #0x0
   beq ProtectEffect

CheckMagicGuard:
   ldr r0, .BattleStruct
   mov r5, #0x58
   ldr r1, .Attacker3
   ldrb r1, [r1]
   mul r1, r5
   add r1, r1, r0
   ldrb r1, [r0]
   ldr r2, .MGI
   cmp r1, r2
   beq ProtectEffect

SetDamage:   
   ldrh r1, [r0, #0xC]
   ldr r2, .Damage
   lsr r1, r1, #0x3
   cmp r1, #0x0
   bne NonZeroDamage
   mov r1, #0x1

NonZeroDamage:
   str r1, [r2]
   ldr r6, .SpikyShieldBS 
   b CallScript 

CheckContactMove:
   ldr r6, .KingShieldBS
   ldr r3, .CurrMove3
   ldr r2, .MoveData3
   ldrh r3, [r3]
   lsl r0, r3, #1
   add r0, r0, r3
   lsl r0, r0, #2
   add r0, r0, r2
   ldrb r0, [r0, #0x8]
   lsl r0, r0, #0x1F
   cmp r0, #0x0
   beq ProtectEffect

ClearBitForStatDrop:
   ldrb r0, [r1, #0x3]
   mov r2, #0x1
   bic r0, r2
   strb r0, [r1, #0x3]

CallScript:
   ldr r4, .ScriptPointer3
   ldr r0, [r4]
   add r0, r0, #0x1
   str r0, [r4]
   ldr r0, .ScriptPusher
   bl Linker3
   str r6, [r4]
   pop {r1}
   pop {r4-r7}
   pop {r0}
   bx r0

ProtectEffect:
   mov r0, #0x1
   pop {r1}

MissMessage:
   lsl r0, r0, #0x1
   add r0, r0, r1
   ldrh r3, [r0]

Exit3:
   strb r4, [r7, #0x7]
   ldr r1, .Return3
   bx r1

Linker3:
   bx r0

.align 2
.MoveData3: .word MoveDataLoc
.KingShieldBS: .word RomAreaOffset+KSBattleScript
.SpikyShieldBS: .word RomAreaOffset+SSBattleScript
.WGPMessage: .word RomAreaOffset+WGProtMess
.QGPMessage: .word RomAreaOffset+QGProtMess
.CSPMessage: .word RomAreaOffset+CSProtMess
.MBPMessage: .word RomAreaOffset+MBProtMess
.StringLoaderOffset3: .word YourWordLocation
.ScriptPointer3: .word 0x2024214
.ProtectStruct3: .word 0x202433C
.Attacker3: .word 0x202420B
.CurrMove3: .word 0x20241EA
.BattleStruct: .word 0x20240A4
.Damage: .word 0x20241F0
.Return3: .word 0x804856A+1
.ScriptPusher: .word 0x803FAFC+1
.MGI: .word MagicGuardIndex

@@@@@@@@@@@@@@@Restore King Shield Bit
.align 2
Main4:
   ldr r0, .Attacker4
   ldrb r0, [r0, #0x1]
   lsl r0, r0, #0x4
   ldr r1, .ProtectStruct4   
   add r1, r1, r0
   ldrb r2, [r1, #0x3]
   mov r3, #0x1
   orr r2, r3
   strb r2, [r1, #0x3]
   bx lr

.align 2
.ProtectStruct4: .word 0x202433C
.Attacker4: .word 0x202420B

@@@@@@@@@@@@@@@Protection Odds Table
.align 2

ProtectionOddTable:
.byte 0xFF, 0xFF
.byte 0xFF, 0x7F
.byte 0xFF, 0x3F
.byte 0xFF, 0x1F
.byte 0xFF, 0xF
.byte 0xFF, 0x7
.byte 0xFF, 0x3
.byte 0xFF, 0x1
.byte 0xFF, 0x0
.byte 0x7F, 0x0
.byte 0x3F, 0x0
.byte 0x1F, 0x0
.byte 0xF, 0x0
.byte 0x7, 0x0
.byte 0x3, 0x0
.byte 0x1, 0x0
.byte 0x0, 0x0


@@@@@@@@@ Protection Move Table
@ Table entry format (8 bytes): 
@ Move ID (2 bytes)
@ Protect Structure Byte No & Flags (1st MSB: Chance Check, 2nd MSB: Protect Chance Inhibitor, 3rd MSB: Protect Team)
@ Protect Structure Bit No (4 MSBs String No., 4 LSBs Bit No.)
.align 2

ProtectionMoveTable:
Protect:
.byte 0xB6, 0x0  @Move ID in reverse hex
.byte 0xC0
.byte 0x00

Detect:
.byte 0xC5, 0x0
.byte 0xC0
.byte 0x00

Endure:
.byte 0xCB, 0x0
.byte 0xC0
.byte 0x11

KingShield:
.byte 0x4C, 0x2
.byte 0xC3
.byte 0x00

SpikyShield:
.byte 0x54, 0x2
.byte 0xC3
.byte 0x01

WideGuard:
.byte 0xD5, 0x1
.byte 0x63
.byte 0x32

QuickGuard:
.byte 0xF5, 0x1
.byte 0x63
.byte 0x33

CraftyShield:
.byte 0x42, 0x2
.byte 0x23
.byte 0x34

MatBlock:
.byte 0x31, 0x2
.byte 0x23
.byte 0x45

TerminateTable:
.byte 0xFF, 0xFF

@@@@@@@@@@@@@@@@ New Message Script
NewMessageScript:
.byte 0x9

.byte 0xA

.byte 0x10, 0x84, 0x1

.byte 0x12, 0x40, 0x0

.byte 0x28
.word 0x82D8A4E

@@@@@@@@@@@@@@@@ King Shield Script
KSBattleScript:
.byte 0x10, 0x18, 0x0

.byte 0x12, 0x40, 0x0

.byte 0x2E
.word 0x202448E
.byte 0xA1

.byte 0x89, 0x41
.word RomAreaOffset+EndKSS

.byte 0x29, 0x0
.word 0x2024337
.byte 0x2
.word RomAreaOffset+EndKSS

.byte 0x47

.byte 0x45, 0x1, 0x1
.word 0x2024484

.byte 0x13
.word 0x85CC89C @StatDropMessageTable

.byte 0x12, 0x40, 0x0

.byte 0x1E
.byte 0x1, DefiantIndex
.word RomAreaOffset+KSDefiantBoost

.byte 0x1E
.byte 0x1, CompetitiveIndex
.word RomAreaOffset+KSCompBoost

.byte 0x28
.word RomAreaOffset+EndKSS

KSDefiantBoost:
.byte 0x2E
.word 0x202448E
.byte 0x21

.byte 0x28
.word BoostStats+RomAreaOffset

KSCompBoost:
.byte 0x2E 
.word 0x202448E
.byte 0x24

BoostStats:
.byte 0x89, 0x41
.word RomAreaOffset+EndKSS

.byte 0x29, 0x0
.word 0x2024337
.byte 0x2
.word RomAreaOffset+EndKSS

.byte 0x47

.byte 0x45, 0x1, 0x1
.word 0x2024484

.byte SetWordCommand
.word YourWordLocation
.word BoostString+RomAreaOffset

.byte 0x10, 0x84, 0x1

.byte 0x12, 0x40, 0x0

EndKSS:
.byte CallasmCommand
.word Main4+RomAreaOffset+1

.byte 0x3C


@@@@@@@@@@@@@@@@@@@@@@@@@@@Spiky Shield
SSBattleScript:
.byte 0x10, 0x18, 0x0

.byte 0x12, 0x40, 0x0

.byte 0x36
.word 0x202427C
.byte 0x1

.byte 0x35
.word 0x2024280
.word 0x100100

.byte 0xB, 0x1

.byte 0xC, 0x1

.byte SetWordCommand
.word YourWordLocation
.word HurtString+RomAreaOffset

.byte 0x10, 0x84, 0x1

.byte 0x12, 0x40, 0x0

.byte 0x19, 0x1, 0x0
.word 0x0

.byte 0x33
.word 0x202427C
.byte 0x1

.byte 0x28
.word 0x82D8A4E

@@@@@@@@@@@@@@@@@Battle Strings Used
GuardMessageUser:
.byte 0xFD, 0x14, Space, p_, r_, o_, t_, e_, c_, t_, e_, d_, Space, y_, o_, u_, r_, Space, t_, e_, a_, m_, Exclam, Termin

GuardMessageFoe:
.byte 0xFD, 0x14, Space, p_, r_, o_, t_, e_, c_, t_, e_, d_, Space, t_, h_, e_, Space, o_, p_, p_, o_, n_, e_, n_, t_
.byte Apos, s_, Space, t_, e_, a_, m_, Exclam, Termin

MatMessage:
.byte 0xFD, 0xF, Space, i_, n_, t_, e_, n_, d_, s_, Space, t_, o_, Space, f_, l_, i_, p_, Space
.byte u_, p_, Space, a_, Space, m_, a_, t_, JumpLine, a_, n_, d_, Space, b_, l_, o_, c_, k_, Space
.byte i_, n_, c_, o_, m_, i_, n_, g_, Space, a_, t_, t_, a_, c_, k_, s_, Exclam, Termin

WGProtMess:
.byte W_, i_, d_, e_, Space, G_, u_, a_, r_, d_, Space, p_, r_, o_, t_, e_, c_, t_, e_, d_, Space, 0xFD, 0x10, Exclam, Termin

QGProtMess:
.byte Q_, u_, i_, c_, k_, Space, G_, u_, a_, r_, d_, Space, p_, r_, o_, t_, e_, c_, t_, e_, d_, Space, 0xFD, 0x10, Exclam, Termin

CSProtMess:
.byte C_, r_, a_, f_, t_, y_, Space, S_, h_, e_, i_, l_, d_, Space, p_, r_, o_, t_, e_, c_, t_, e_, d_, Space, 0xFD, 0x10, Exclam, Termin

MBProtMess:
.byte 0xFD, 0x14, Space, i_, s_, Space, b_, l_, o_, c_, k_, e_, d_, Space, b_, y_, Space, t_, h_, e_, JumpLine, k_, i_, c_, k_
.byte e_, d_, Dash, u_, p_, Space, m_, a_, t_, 0xAB, 0xFF

BoostString:
.byte 0xFD, 0xF, 0xB4, 0xE7, 0xFD, 0x18, 0x0, 0xE7, 0xDC, 0xD5, 0xE6, 0xE4, 0xE0, 0xED, 0xFE, 0xE6, 0xD5, 0xDD, 0xE7, 0xD9
.byte 0xD8, 0x0, 0xDD, 0xE8, 0xE7, 0x0, 0xFD, 0x0, 0xAB, 0xFF

HurtString:
.byte 0xFD, 0xF, Space, i_, s_, Space, h_, u_, r_, t_, Space, b_, y_, JumpLine, 0xFD, 0x10, Apos, s_, Space
.byte S_, p_, i_, k_, y_, Space, S_, h_, e_, i_, l_, d_, 0xAB, 0xFF

MrDollSteak

Formerly known as 11bayerf1

Age 24
Male
Hong Kong
Seen 3 Days Ago
Posted May 15th, 2019
846 posts
10.7 Years
King Shield, Spiky Shield, Quick Guard, Wide Guard, Crafty Shield, Mat Block

With kleenexfeu telling me a wonderful trick to compile multiple different type of resources together in just a single click that he used in his Emerald Mega implementation too, the protection moves are also implemented using the same trick which makes it ridiculously easy to insert any resource when using ASM.
Is that trick dynamic battle scripts and strings using .byte and .word? If so that's actually awesome and makes inserting battle script abilities and moves a lot easier!

Chacha Dinosaur

Adamant and adaptive dinosaur.

Age 24
Male
Seen March 4th, 2018
Posted September 8th, 2017
454 posts
6.1 Years
Is that trick dynamic battle scripts and strings using .byte and .word? If so that's actually awesome and makes inserting battle script abilities and moves a lot easier!
Yes. It becomes very easy.

More importantly, it also avoids the hassle of 'insert this string at SSSSSS, script at DDDDDD' etc. The compilation automatically aligns and assigns the location for them.

I most probably will do the Surf BS for Emerald this way because the one I uploaded can become too confusing to insert.
Male
Seen January 10th, 2019
Posted May 4th, 2017
216 posts
6.1 Years
Yes. It becomes very easy.

More importantly, it also avoids the hassle of 'insert this string at SSSSSS, script at DDDDDD' etc. The compilation automatically aligns and assigns the location for them.

I most probably will do the Surf BS for Emerald this way because the one I uploaded can become too confusing to insert.
That would be awesome yeah. Also, I use .align 2 for the strings too, because when the routines become long, the assembler does weird things sometimes.



Update, more defines, please use them!

It'd be more convenient if everyone use the same.

Macro & Defines for Abilities and Moves implementation:


Spoiler:

BS Macro & Defines:
Spoiler:

Emerald
Spoiler:

@@ Compare operands
.equ Equal, 0x0
.equ Notequal, 0x1
.equ Inferior, 0x2
.equ Superior, 0x3
.equ Anded, 0x4

@@@@@@@@@@@@@@@@@ Macro

@@ Banks
.macro BANK_USER
.byte 0x1
.endm

.macro BANK_TARGET
.byte 0
.endm

@@ Delay
.macro DELAY_HALFSECOND
.byte 0x20
.endm

.macro DELAY_1SECOND
.byte 0x40
.endm

@@ Super commands
.macro calculatedamage
.word 0x7060504
.endm

@@ Custom commands
.macro callasm callasm_routine
.byte 0xF9
.word \callasm_routine
.endm

.macro setword YourWordLocation setword_pointer_to_string
.byte 0xFA
.word YourWordLocation
.word \setword_pointer_to_string
.endm

@@ Index commands
.macro attackcanceler
.byte 0
.endm

.macro accuracycheck accuracycheck_address accuracycheck_parameter1
.byte 1
.word \accuracycheck_address
.hword \accuracycheck_parameter1
.endm

.macro attackstring
.byte 2
.endm

.macro ppreduce
.byte 3
.endm

.macro critcalc
.byte 4
.endm


.macro cmd5
.byte 5
.endm

.macro cmd6
.byte 6
.endm

.macro cmd7
.byte 7
.endm

.macro cmd8
.byte 8
.endm

.macro attackanimation
.byte 9
.endm

.macro waitanimation
.byte 0xA
.endm

.macro graphicalhpupdate graphicalhpupdate_bank
.byte 0xB
.byte \graphicalhpupdate_bank
.endm

.macro datahpupdate datahpupdate_bank
.byte 0xC
.byte \datahpupdate_bank
.endm

.macro critmessage
.byte 0xD
.endm

.macro missmessage
.byte 0xE
.endm

.macro resultmessage
.byte 0xF
.endm

.macro printstring printstring_string
.byte 0x10
.hword \printstring_string
.endm

.macro printstring2 printstring2_string
.byte 0x11
.hword \printstring2_string
.endm

.macro waitmessage waitmessage_delay
.byte 0x12
.hword \waitmessage_delay
.endm

.macro printfromtable printfromtable_table
.byte 0x13
.word \printfromtable_table
.endm

.macro printfromtable2 printfromtable2_table
.byte 0x14
.word \printfromtable2_table
.endm

.macro seteffectwithchancetarget
.byte 0x15
.endm

.macro seteffecttarget
.byte 0x16
.endm

.macro seteffectuser
.byte 0x17
.endm

.macro clearstatus clearstatus_bank
.byte 0x18
.byte \clearstatus_bank
.endm

.macro faintpokemon faintpokemon_parameter1 faintpokemon_parameter2 faintpokemon_parameter3
.byte 0x19
.byte \faintpokemon_parameter1
.byte \faintpokemon_parameter2
.word \faintpokemon_parameter3
.endm

.macro cmd1a cmd1a_parameter1
.byte 0x1A
.byte cmd1a_parameter1
.endm

.macro cmd1b cmd1b_bank
.byte 0x1B
.byte \cmd1b_bank
.endm

.macro jumpifstatus jumpifstatus_bank jumpifstatus_status jumpifstatus_address
.byte 0x1C
.byte \jumpifstatus_bank
.word \jumpifstatus_status
.word \jumpifstatus_address
.endm

.macro jumpifsecondarytstatus jumpifsecondarytstatus_bank jumpifsecondarytstatus_status jumpifsecondartstatus_address
.byte 0x1D
.byte \jumpifsecondarytstatus_bank
.word \jumpifsecondarytstatus_status
.word \jumpifsecondarytstatus_address
.endm

.macro jumpifability jumpifability_bank jumpifability_ability jumpifability_address
.byte 0x1E
.byte \jumpifability_bank
.byte \jumpifability_ability
.word \jumpifability_address
.endm

.macro jumpifhalverset jumpifhalverset_bank jumpifhalverset_status jumpifhalverset_address
.byte 0x1F
.byte \jumpifhalverset_bank
.hword \jumpifhalverset_status
.word \jumpifhalverset_address
.endm

.macro jumpifstat jumpifstat_bank jumpifstat_flag jumpifstat_quantity jumpifstat_statid jumpifstat_address
.byte 0x20
.byte \jumpifstat_bank
.byte \jumpifstat_flag
.byte \jumpifstat_quantity
.byte \jumpifstat_statid
.word \jumpifstat_address
.endm

.macro jumpifspecialstatusflag jumpifspecialstatusflag_bank jumpifspecialstatusflag_word_to_and  jumpifspecialstatusflag_statut jumpifspecialstatusflag_address
.byte 0x21
.byte \jumpifspecialstatusflag_bank
.word \jumpifspecialstatusflag_word_to_and
.byte \jumpifspecialstatusflag_statut
.word \jumpifspecialstatusflag_address
.endm

.macro jumpiftype jumpiftype_bank jumpiftype_type jumpiftype_address
.byte 0x22
.byte \jumpiftype_bank
.byte \jumpiftype_type
.word \jumpiftype_address
.endm

.macro cmd23 cmd23_side_or_bank
.byte 0x23
.byte \cmd23_side_or_bank
.endm

.macro gotoandsomething gotoandsomething_address
.byte 0x24
.word \gotoandsomething_address
.endm

.macro cmd25
.byte 0x25
.endm

.macro cmd26 cmd26_param1
.byte 0x26
.byte \cmd26_param1
.endm

.macro cmd27 cmd27_address
.byte 0x27
.word \cmd27_address
.endm

.macro goto goto_address
.byte 0x28
.word \goto_address
.endm

.macro jumpifbyte jumpifbyte_ifflag jumpifbyte_checkaddr jumpifbyte_compare jumpifbyte_address
.byte 0x29
.byte \jumpifbyte_ifflag
.word \jumpifbyte_checkaddr
.byte \jumpifbyte_compare
.word \jumpifbyte_address
.endm

.macro jumpifhalfword jumpifhalfword_ifflag jumpifhalfword_checkaddr jumpifhalfword_compare jumpifhalfword_address
.byte 0x2A
.byte \jumpifhalfword_ifflag
.word \jumpifhalfword_checkaddr
.hword \jumpifhalfword_compare
.word \jumpifhalfword_address
.endm

.macro jumpifword jumpifword_ifflag jumpifword_checkaddr jumpifword_compare jumpifword_address
.byte 0x2B
.byte \jumpifword_ifflag
.word \jumpifword_checkaddr
.word \jumpifword_compare
.word \jumpifword_address
.endm

.macro jumpifarrayequal jumpifarrayequal_mem1 jumpifarrayequal_mem2 jumpifarrayequal_size jumpifarrayequal_address
.byte 0x2C
.word \jumpifarrayequal_mem1
.word \jumpifarrayequal_mem2
.byte \jumpifarrayequal_size
.word \jumpifarrayequal_address
.endm

.macro jumpifarraynotequal jumpifarraynotequal_mem1 jumpifarraynotequal_mem2 jumpifarraynotequal_size jumpifarraynotequal_address
.byte 0x2D
.word \jumpifarraynotequal_mem1
.word \jumpifarraynotequal_mem2
.byte \jumpifarraynotequal_size
.word \jumpifarraynotequal_address
.endm

.macro setbyte setbyte_pointer setbyte_value
.byte 0x2E
.word \setbyte_pointer
.byte \setbyte_value
.endm

.macro addbyte addbyte_pointer addbyte_value
.byte 0x2F
.word \addbyte_pointer
.byte \addbyte_value
.endm

.macro subtractbyte subtractbyte_pointer subtractbyte_value
.byte 0x30
.word \subtractbyte_pointer
.byte \subtractbyte_value
.endm

.macro copyarray copyarray_destination copyarray_source copyarray_size
.byte 0x31
.word \copyarray_destination
.word \copyarray_source
.byte \copyarray_size
.endm

.macro cmd32 cmd32_param1 cmd32_param2 cmd32_param3 cmd32_byte
.byte 0x32
.word \cmd32_param1
.word \cmd32_param2
.word \cmd32_param3
.byte \cmd32_byte
.endm

.macro orbyte orbyte_pointer orbyte_value
.byte 0x33
.word \orbyte_pointer
.byte \orbyte_value
.endm

.macro orhalfword orhalfword_pointer orhalfword_value
.byte 0x34
.word \orhalfword_pointer
.hword \orhalfword_value
.endm

.macro orword orword_pointer orword_value
.byte 0x35
.word \orword_pointer
.word \orword_value
.endm

.macro bicbyte bicbyte_pointer bicbyte_value
.byte 0x36
.word \bicbyte_pointer
.byte \bicbyte_value
.endm

.macro bichalfword bichalfword_pointer bichalfword_value
.byte 0x37
.word \bichalfword_pointer
.hword \bichalfword_value
.endm

.macro bicword bicword_pointer bicword_value
.byte 0x38
.word \bicword_pointer
.word \bicword_value
.endm

.macro pause pause_duration
.byte 0x39
.hword \pause_duration
.endm

.macro waitstate
.byte 0x3A
.endm

.macro somethinghealcmd3b somethinghealcmd3b_bank
.byte 0x3B
.byte \somethinghealcmd3b_bank
.endm

.macro return
.byte 0x3C
.endm

.macro end
.byte 0x3D
.endm

.macro end2
.byte 0x3E
.endm

.macro end3
.byte 0x3F
.endm

.macro cmd40 cmd40_address
.byte 0x40
.word \cmd40_address
.endm

.macro call call_address
.byte 0x41
.word \call_address
.endm

.macro jumpiftype2 jumpiftype2_bank jumpiftype2_type jumpiftype2_address
.byte 0x42
.byte \jumpiftype2_bank
.byte \jumpiftype2_type
.word \jumpiftype2_address
.endm

.macro jumpifabilitypresent jumpifabilitypresent_ability jumpifabilitypresent_address
.byte 0x43
.byte \jumpifabilitypresent_ability
.word \jumpifabilitypresent_address
.endm

.macro cmd44
.byte 0x44
.endm

.macro playanimation playanimation_bank playanimation_animation playanimation_word
.byte 0x45
.byte \playanimation_bank
.byte \playanimation_animation
.word \playanimation_word
.endm

.macro cmd46 cmd46_bank cmd46_address cmd46_address2
.byte 0x46
.byte \cmd46_bank
.word \cmd46_address
.word \cmd46_address2
.endm

.macro cmd47
.byte 0x47
.endm

.macro playstatchangeanimation playstatchangeanimation_bank playstatchangeanimation_colour playstatchangeanimation_byte
.byte 0x48
.byte \playstatchangeanimation_bank
.byte \playstatchangeanimation_colour
.byte \playstatchangeanimation_byte
.endm

.macro cmd49 cmd49_byte1 cmd49_byte2
.byte 0x49
.byte \cmd49_byte1
.byte \cmd49_byte2
.endm

.macro damagecalc2
.byte 0x4A
.endm

.macro cmd4b
.byte 0x4B
.endm

.macro switch1 switch1_bank
.byte 0x4C
.byte \switch1_bank
.endm

.macro switch2 switch2_bank
.byte 0x4D
.byte \switch2_bank
.endm

.macro switch3 switch3_bank switch3_byte
.byte 0x4E
.byte \switch3_bank
.byte \switch3_byte
.endm

.macro jumpifcannotswitch jumpifcannotswitch_bank jumpifcannotswitch_address
.byte 0x4F
.byte \jumpifcannotswitch_bank
.word \jumpifcannotswitch_address
.endm

.macro openpartyscreen openpartyscreen_bank openpartyscreen_address
.byte 0x50
.byte \openpartyscreen_bank
.word \openpartyscreen_address
.endm

.macro cmd51 cmd51_bank cmd51_param2
.byte 0x51
.byte \cmd51_bank
.byte \cmd51_param2
.endm

.macro cmd52 cmd52_bank
.byte 0x52
.byte \cmd52_bank
.endm

.macro cmd53 cmd53_bank
.byte 0x53
.byte \cmd53_bank
.endm

.macro cmd54 cmd54_hword
.byte 0x54
.hword \cmd54_hword
.endm

.macro cmd55 cmd55_word
.byte 0x55
.word \cmd55_word
.endm

.macro cmd56 cmd56_bank_or_side
.byte 0x56
.byte \cmd56_bank_or_side
.endm

.macro cmd57
.byte 0x57
.endm

.macro cmd58 cmd58_bank
.byte 0x58
.byte \cmd58_bank
.endm

.macro checkiflearnmoveinbattle checkiflearnmoveinbattle_param1 checkiflearnmoveinbattle_param2 checkiflearnmoveinbattle_bank_maybe
.byte 0x59
.word \checkiflearnmoveinbattle_param1
.word \checkiflearnmoveinbattle_param2
.byte \checkiflearnmoveinbattle_bank_maybe
.endm

.macro cmd5a cmd5a_address
.byte 0x5A
.word \cmd5a_address
.endm

.macro cmd5b cmd5b_address
.byte 0x5B
.word \cmd5b_address
.endm

.macro cmd5c cmd5c_bank
.byte 0x5C
.byte \cmd5c_bank
.endm

.macro cmd5d
.byte 0x5D
.endm

.macro cmd5e cmd5e_bank
.byte 0x5E
.byte \cmd5e_bank
.endm

.macro cmd5f
.byte 0x5F
.endm

.macro cmd60 cmd60_byte
.byte 0x60
.byte \cmd60_byte
.endm

.macro cmd61 cmd61_bank_or_side
.byte 0x61
.byte \cmd61_bank_or_side
.endm

.macro cmd62 cmd62_bank_or_side
.byte 0x62
.byte \cmd62_bank_or_side
.endm

.macro jumptoattack jumptoattack_bank
.byte 0x63
.byte \jumptoattack_bank
.endm

.macro statusanimation statusanimation_bank
.byte 0x64
.byte \statusanimation_bank
.endm

.macro cmd65 cmd65_bank_or_side cmd65_address
.byte 0x65
.byte \cmd65_bank_or_side
.word \cmd65_address
.endm

.macro cmd66 cmd66_bank_or_side cmd66_bank_or_side2 cmd66_address
.byte 0x66
.byte \cmd66_bank_or_side
.byte \cmd66_bank_or_side2
.word \cmd66_address
.endm

.macro cmd67
.byte 0x67
.endm

.macro cmd68
.byte 0x68
.endm

.macro cmd69
.byte 0x69
.endm

.macro removeitem removeitem_bank
.byte 0x6A
.byte \removeitem_bank
.endm

.macro cmd6b
.byte 0x6B
.endm

.macro cmd6c
.byte 0x6C
.endm

.macro cmd6d
.byte 0x6D
.endm

.macro cmd6e
.byte 0x6E
.endm

.macro cmd6f cmd6f_bank
.byte 0x6F
.byte \cmd6f_bank
.endm

.macro cmd70 cmd70_bank
.byte 0x70
.byte \cmd70_bank
.endm

.macro cmd71
.byte 0x71
.endm

.macro cmd72 cmd72_address
.byte 0x72
.word \cmd72_address
.endm

.macro cmd73 cmd73_bank
.byte 0x73
.byte \cmd73_bank
.endm

.macro cmd74 cmd74_bank
.byte 0x74
.byte \cmd74_bank
.endm

.macro cmd75
.byte 0x75
.endm

.macro cmd76 cmd76_bank cmd76_byte
.byte 0x76
.byte \cmd76_bank
.byte \cmd76_byte
.endm

.macro setprotect
.byte 0x77
.endm

.macro faintifabilitynotdamp
.byte 0x78
.endm

.macro setuserhptozero
.byte 0x79
.endm

.macro jumpwhiletargetvalid jumpwhiletargetvalid_address
.byte 0x7A
.word \jumpwhiletargetvalid_address
.endm

.macro setdamageasrestorehalfmaxhp setdamageasrestorehalfmaxhp_address setdamageasrestorehalfmaxhp_byte
.byte 0x7B
.word \setdamageasrestorehalfmaxhp_address
.byte \setdamageasrestorehalfmaxhp_byte
.endm

.macro jumptolastusedattack
.byte 0x7C
.endm

.macro setrain
.byte 0x7D
.endm

.macro setreflect
.byte 0x7E
.endm

.macro setleechseed
.byte 0x7F
.endm

.macro manipulatedamage
.byte 0x80
.endm

.macro setrest setrest_address
.byte 0x81
.word \setrest_address
.endm

.macro jumpifnotfirstturn jumpifnotfirstturn_address
.byte 0x82
.word \jumpifnotfirstturn_address
.endm

.macro nop3
.byte 0x83
.endm

.macro jumpifcannotsleep jumpifcannotsleep_address
.byte 0x84
.word \jumpifcannotsleep_address
.endm

.macro stockpile
.byte 0x85
.endm

.macro stockpiletobasedamage stockpiletobasedamage_address
.byte 0x86
.word \stockpiletobasedamage_address
.endm

.macro stockpiletohprecovery stockpiletohprecovery_address
.byte 0x87
.word \stockpiletohprecovery_address
.endm

.macro negativedamage
.byte 0x88
.endm

.macro statbuffchange statbuffchange_target statbuffchange_address
.byte 0x89
.byte \statbuffchange_target
.word \statbuffchange_address
.endm

.macro normalisebuffs
.byte 0x8A
.endm

.macro setbide
.byte 0x8B
.endm

.macro confuseifrepeatingattackends
.byte 0x8C
.endm

.macro setloopcounter setloopcounter_number_of_loop
.byte 0x8D
.byte \setloopcounter_number_of_loop
.endm

.macro cmd8e
.byte 0x8E
.endm

.macro forcerandomswitch forcerandomswitch_address
.byte 0x8F
.word \forcerandomswitch_address
.endm

.macro changetypestoenemyattacktype changetypestoenemyattacktype_address
.byte 0x90
.word \changetypestoenemyattacktype_address
.endm

.macro givemoney
.byte 0x91
.endm

.macro setlightscreen
.byte 0x92
.endm

.macro koplussomethings koplussomethings_address
.byte 0x93
.word \koplussomethings_address
.endm

.macro gethalfcurrentenemyhp
.byte 0x94
.endm

.macro setsandstorm
.byte 0x95
.endm

.macro weatherdamage
.byte 0x96
.endm

.macro tryinfatuatetarget tryinfatuatetarget_address
.byte 0x97
.word \tryinfatuatetarget_address
.endm

.macro cmd98 cmd98_byte
.byte 0x98
.byte \cmd98_byte
.endm

.macro setmisteffect
.byte 0x99
.endm

.macro setincreasedcriticalchance
.byte 0x9A
.endm

.macro transformdataexecution
.byte 0x9B
.endm

.macro setsubstituteeffect
.byte 0x9C
.endm

.macro copyattack copyattack_address
.byte 0x9D
.word \copyattack_address
.endm

.macro metronomeeffect
.byte 0x9E
.endm

.macro nightshadedamageeffect
.byte 0x9F
.endm

.macro psywavedamageeffect
.byte 0xA0
.endm

.macro counterdamagecalculator counterdamagecalculator_address
.byte 0xA1
.word \counterdamagecalculator_address
.endm

.macro mirrorcoatdamagecalculator mirrorcoatdamagecalculator_address
.byte 0xA2
.word \mirrorcoatdamagecalculator_address
.endm

.macro disablelastusedattack disablelastusedattack_address
.byte 0xA3
.word \disablelastusedattack_address
.endm

.macro setencore setencore_address
.byte 0xA4
.word \setencore_address
.endm

.macro painsplitdamagecalculator painsplitdamagecalculator_address
.byte 0xA5
.word \painsplitdamagecalculator_address
.endm

.macro settypetorandomresistance settypetorandomresistance_address
.byte 0xA6
.word \settypetorandomresistance_address
.endm

.macro setalwaymukflag
.byte 0xA7
.endm

.macro copymovepermanently copymovepermanently_address
.byte 0xA8
.word \copymovepermanently_address
.endm

.macro selectrandommovefromusermoves selectrandommovefromusermoves_address
.byte 0xA9
.word \selectrandommovefromusermoves_address
.endm

.macro destinybondeffect
.byte 0xAA
.endm

.macro cmdab
.byte 0xAB
.endm

.macro remaininghptopower
.byte 0xAC
.endm

.macro reducepprandom reducepprandom_address
.byte 0xAD
.word \reducepprandom_address
.endm

.macro clearstatusifnotsoundproofed
.byte 0xAE
.endm

.macro cursetarget cursetarget_address
.byte 0xAF
.word \cursetarget_address
.endm

.macro setspikes setspikes_address
.byte 0xB0
.word \setspikes_address
.endm

.macro setforesight
.byte 0xB1
.endm

.macro setperishsong setperishsong_address
.byte 0xB2
.word \setperishsong_address
.endm

.macro rolloutdamagecalculation
.byte 0xB3
.endm

.macro jumpifconfusedandattackmaxed jumpifconfusedandattackmaxed_bank jumpifconfusedandattackmaxed_address
.byte 0xB4
.byte \jumpifconfusedandattackmaxed_bank
.word \jumpifconfusedandattackmaxed_address
.endm

.macro furycutterdamagecalculation
.byte 0xB5
.endm

.macro happinesstodamagecalculation
.byte 0xB6
.endm

.macro presentdamagecalculation
.byte 0xB7
.endm

.macro setsafeguard
.byte 0xB8
.endm

.macro magnitudedamagecalculation
.byte 0xB9
.endm

.macro cmdba cmdba_address
.byte 0xBA
.word \cmdba_address
.endm

.macro setsunny
.byte 0xBB
.endm

.macro maxattackhalvehp maxattackhalvehp_address
.byte 0xBC
.word \maxattackhalvehp_address
.endm

.macro copyfoestats copyfoestats_address
.byte 0xBD
.word \copyfoestats_address
.endm

.macro breakfree
.byte 0xBE
.endm

.macro setcurled
.byte 0xBF
.endm

.macro recoverbasedonsunlight
.byte 0xC0
.endm

.macro hiddenpowerdamagecalculation
.byte 0xC1
.endm

.macro selectnexttarget
.byte 0xC2
.endm

.macro setfutureattack setfutureattack_address
.byte 0xC3
.word \setfutureattack_address
.endm

.macro beatupcalculation beatupcalculation_address1 beatupcalculation_address2
.byte 0xC4
.word \beatupcalculation_address1
.word \beatupcalculation_address2
.endm

.macro hidepreattack
.byte 0xC5
.endm

.macro unhidepostattack
.byte 0xC6
.endm

.macro setminimize
.byte 0xC7
.endm

.macro sethail
.byte 0xC8
.endm

.macro jumpifattackandspecialattackcannotfall jumpifattackandspecialattackcannotfall_address
.byte 0xC9
.word \jumpifattackandspecialattackcannotfall_address
.endm

.macro setforcedtarget
.byte 0xCA
.endm

.macro setcharge
.byte 0xCB
.endm

.macro callterrainattack
.byte 0xCC
.endm

.macro cureifburnedparalysedorpoisoned cureifburnedparalysedorpoisoned_address
.byte 0xCD
.word \cureifburnedparalysedorpoisoned_address
.endm

.macro settorment settorment_address
.byte 0xCE
.word \settorment_address
.endm

.macro jumpifnodamage jumpifnodamage_address
.byte 0xCF
.word \jumpifnodamage_address
.endm

.macro settaunt settaunt_address
.byte 0xD0
.word \settaunt_address
.endm

.macro sethelpinghand sethelpinghand_address
.byte 0xD1
.word \sethelpinghand_address
.endm

.macro itemswap itemswap_address
.byte 0xD2
.word \itemswap_address
.endm

.macro copyability copyability_address
.byte 0xD3
.word \copyability_address
.endm

.macro cmdd4 cmdd4_byte cmdd4_address
.byte 0xD4
.byte \cmdd4_byte
.word \cmdd4_address
.endm

.macro setroots setroots_address
.byte 0xD5
.word \setroots_address
.endm

.macro doubledamagedealtifdamaged
.byte 0xD6
.endm

.macro setyawn setyawn_address
.byte 0xD7
.word \setyawn_address
.endm

.macro setdamagetohealthdifference setdamagetohealthdifference_address
.byte 0xD8
.word \setdamagetohealthdifference_address
.endm

.macro scaledamagebyhealthratio
.byte 0xD9
.endm

.macro abilityswap abilityswap_address
.byte 0xDA
.word \abilityswap_address
.endm

.macro imprisoneffect imprisoneffect_address
.byte 0xDB
.word \imprisoneffect_address
.endm

.macro setgrudge setgrudge_address
.byte 0xDC
.word \setgrudge_address
.endm

.macro weightdamagecalculation
.byte 0xDD
.endm

.macro assistattackselect assistattackselect_address
.byte 0xDE
.word \assistattackselect_address
.endm

.macro setmagiccoat setmagiccoat_address
.byte 0xDF
.word \setmagiccoat_address
.endm

.macro setstealstatchange setstealstatchange_address
.byte 0xE0
.word \setstealstatchange_address
.endm

.macro cmde1 cmde1_address
.byte 0xE1
.word \cmde1_address
.endm

.macro cmde2 cmde2_bank
.byte 0xE2
.byte \cmde2_bank
.endm

.macro jumpiffainted jumpiffainted_bank jumpiffainted_address
.byte 0xE3
.byte \jumpiffainted_bank
.word \jumpiffainted_address
.endm

.macro naturepowereffect
.byte 0xE4
.endm

.macro pickupitemcalculation
.byte 0xE5
.endm

.macro actualcastformswitch
.byte 0xE6
.endm

.macro castformswitch
.byte 0xE7
.endm

.macro settypebasedhalvers settypebasedhalvers_address
.byte 0xE8
.word \settypebasedhalvers_address
.endm

.macro seteffectbyweather
.byte 0xE9
.endm

.macro recycleitem recycleitem_address
.byte 0xEA
.word \recycleitem_address
.endm

.macro settypetoterrain settypetoterrain_address
.byte 0xEB
.word \settypetoterrain_address
.endm

.macro pursuitwhenswitched pursuitwhenswitched_address
.byte 0xEC
.word \pursuitwhenswitched_address
.endm

.macro snatchmove
.byte 0xED
.endm

.macro removereflectlightscreen
.byte 0xEE
.endm

.macro pokemoncatchfunction
.byte 0xEF
.endm

.macro catchpoke
.byte 0xF0
.endm

.macro capturesomethingf1 capturesomethingf1_address
.byte 0xF1
.word \capturesomethingf1_address
.endm

.macro capturesomethingf2
.byte 0xF2
.endm

.macro capturesomethingf3 capturesomethingf3_address
.byte 0xF3
.word \capturesomethingf3_address
.endm

.macro removehp
.byte 0xF4
.endm

.macro curestatutfirstword
.byte 0xF5
.endm

.macro cmdf6
.byte 0xF6
.endm

.macro activesidesomething
.byte 0xF7
.endm

.macro cmdf8 cmdf8_bank
.byte 0xF8
.byte \cmdf8_bank
.endm

Fire Red:
Spoiler:

@@ Compare operands
.equ Equal, 0x0
.equ Notequal, 0x1
.equ Inferior, 0x2
.equ Superior, 0x3
.equ Anded, 0x4

@@@@@@@@@@@@@@@@@ Macro

@@ Banks
.macro BANK_USER
.byte 0x1
.endm

.macro BANK_TARGET
.byte 0
.endm

@@ Delay
.macro DELAY_HALFSECOND
.byte 0x20
.endm

.macro DELAY_1SECOND
.byte 0x40
.endm

@@ Super commands
.macro calculatedamage
.word 0x7060504
.endm

@@ Custom commands
.macro callasm callasm_routine
.byte 0xF8
.word \callasm_routine
.endm

.macro setword YourWordLocation setword_pointer_to_string
.byte 0xF9
.word YourWordLocation
.word \setword_pointer_to_string
.endm

@@ Index commands
.macro attackcanceler
.byte 0
.endm

.macro accuracycheck accuracycheck_address accuracycheck_parameter1
.byte 1
.word \accuracycheck_address
.hword \accuracycheck_parameter1
.endm

.macro attackstring
.byte 2
.endm

.macro ppreduce
.byte 3
.endm

.macro critcalc
.byte 4
.endm


.macro cmd5
.byte 5
.endm

.macro cmd6
.byte 6
.endm

.macro cmd7
.byte 7
.endm

.macro cmd8
.byte 8
.endm

.macro attackanimation
.byte 9
.endm

.macro waitanimation
.byte 0xA
.endm

.macro graphicalhpupdate graphicalhpupdate_bank
.byte 0xB
.byte \graphicalhpupdate_bank
.endm

.macro datahpupdate datahpupdate_bank
.byte 0xC
.byte \datahpupdate_bank
.endm

.macro critmessage
.byte 0xD
.endm

.macro missmessage
.byte 0xE
.endm

.macro resultmessage
.byte 0xF
.endm

.macro printstring printstring_string
.byte 0x10
.hword \printstring_string
.endm

.macro printstring2 printstring2_string
.byte 0x11
.hword \printstring2_string
.endm

.macro waitmessage waitmessage_delay
.byte 0x12
.hword \waitmessage_delay
.endm

.macro printfromtable printfromtable_table
.byte 0x13
.word \printfromtable_table
.endm

.macro printfromtable2 printfromtable2_table
.byte 0x14
.word \printfromtable2_table
.endm

.macro seteffectwithchancetarget
.byte 0x15
.endm

.macro seteffecttarget
.byte 0x16
.endm

.macro seteffectuser
.byte 0x17
.endm

.macro clearstatus clearstatus_bank
.byte 0x18
.byte \clearstatus_bank
.endm

.macro faintpokemon faintpokemon_parameter1 faintpokemon_parameter2 faintpokemon_parameter3
.byte 0x19
.byte \faintpokemon_parameter1
.byte \faintpokemon_parameter2
.word \faintpokemon_parameter3
.endm

.macro cmd1a cmd1a_parameter1
.byte 0x1A
.byte cmd1a_parameter1
.endm

.macro cmd1b cmd1b_bank
.byte 0x1B
.byte \cmd1b_bank
.endm

.macro jumpifstatus jumpifstatus_bank jumpifstatus_status jumpifstatus_address
.byte 0x1C
.byte \jumpifstatus_bank
.word \jumpifstatus_status
.word \jumpifstatus_address
.endm

.macro jumpifsecondarytstatus jumpifsecondarytstatus_bank jumpifsecondarytstatus_status jumpifsecondarytstatus_address
.byte 0x1D
.byte \jumpifsecondarytstatus_bank
.word \jumpifsecondarytstatus_status
.word \jumpifsecondarytstatus_address
.endm

.macro jumpifability jumpifability_bank jumpifability_ability jumpifability_address
.byte 0x1E
.byte \jumpifability_bank
.byte \jumpifability_ability
.word \jumpifability_address
.endm

.macro jumpifhalverset jumpifhalverset_bank jumpifhalverset_status jumpifhalverset_address
.byte 0x1F
.byte \jumpifhalverset_bank
.hword \jumpifhalverset_status
.word \jumpifhalverset_address
.endm

.macro jumpifstat jumpifstat_bank jumpifstat_flag jumpifstat_quantity jumpifstat_statid jumpifstat_address
.byte 0x20
.byte \jumpifstat_bank
.byte \jumpifstat_flag
.byte \jumpifstat_quantity
.byte \jumpifstat_statid
.word \jumpifstat_address
.endm

.macro jumpifspecialstatusflag jumpifspecialstatusflag_bank jumpifspecialstatusflag_word_to_and jumpifspecialstatusflag_statut jumpifspecialstatusflag_address
.byte 0x21
.byte \jumpifspecialstatusflag_bank
.word \jumpifspecialstatusflag_word_to_and
.byte \jumpifspecialstatusflag_statut
.word \jumpifspecialstatusflag_address
.endm

.macro jumpiftype jumpiftype_bank jumpiftype_type jumpiftype_address
.byte 0x22
.byte \jumpiftype_bank
.byte \jumpiftype_type
.word \jumpiftype_address
.endm

.macro cmd23 cmd23_side_or_bank
.byte 0x23
.byte \cmd23_side_or_bank
.endm

.macro gotoandsomething gotoandsomething_address
.byte 0x24
.word \gotoandsomething_address
.endm

.macro cmd25
.byte 0x25
.endm

.macro cmd26 cmd26_param1
.byte 0x26
.byte \cmd26_param1
.endm

.macro cmd27 cmd27_address
.byte 0x27
.word \cmd27_address
.endm

.macro goto goto_address
.byte 0x28
.word \goto_address
.endm

.macro jumpifbyte jumpifbyte_ifflag jumpifbyte_checkaddr jumpifbyte_compare jumpifbyte_address
.byte 0x29
.byte \jumpifbyte_ifflag
.word \jumpifbyte_checkaddr
.byte \jumpifbyte_compare
.word \jumpifbyte_address
.endm

.macro jumpifhalfword jumpifhalfword_ifflag jumpifhalfword_checkaddr jumpifhalfword_compare jumpifhalfword_address
.byte 0x2A
.byte \jumpifhalfword_ifflag
.word \jumpifhalfword_checkaddr
.hword \jumpifhalfword_compare
.word \jumpifhalfword_address
.endm

.macro jumpifword jumpifword_ifflag jumpifword_checkaddr jumpifword_compare jumpifword_address
.byte 0x2B
.byte \jumpifword_ifflag
.word \jumpifword_checkaddr
.word \jumpifword_compare
.word \jumpifword_address
.endm

.macro jumpifarrayequal jumpifarrayequal_mem1 jumpifarrayequal_mem2 jumpifarrayequal_size jumpifarrayequal_address
.byte 0x2C
.word \jumpifarrayequal_mem1
.word \jumpifarrayequal_mem2
.byte \jumpifarrayequal_size
.word \jumpifarrayequal_address
.endm

.macro jumpifarraynotequal jumpifarraynotequal_mem1 jumpifarraynotequal_mem2 jumpifarraynotequal_size jumpifarraynotequal_address
.byte 0x2D
.word \jumpifarraynotequal_mem1
.word \jumpifarraynotequal_mem2
.byte \jumpifarraynotequal_size
.word \jumpifarraynotequal_address
.endm

.macro setbyte setbyte_pointer setbyte_value
.byte 0x2E
.word \setbyte_pointer
.byte \setbyte_value
.endm

.macro addbyte addbyte_pointer addbyte_value
.byte 0x2F
.word \addbyte_pointer
.byte \addbyte_value
.endm

.macro subtractbyte subtractbyte_pointer subtractbyte_value
.byte 0x30
.word \subtractbyte_pointer
.byte \subtractbyte_value
.endm

.macro copyarray copyarray_destination copyarray_source copyarray_size
.byte 0x31
.word \copyarray_destination
.word \copyarray_source
.byte \copyarray_size
.endm

.macro cmd32 cmd32_param1 cmd32_param2 cmd32_param3 cmd32_byte
.byte 0x32
.word \cmd32_param1
.word \cmd32_param2
.word \cmd32_param3
.byte \cmd32_byte
.endm

.macro orbyte orbyte_pointer orbyte_value
.byte 0x33
.word \orbyte_pointer
.byte \orbyte_value
.endm

.macro orhalfword orhalfword_pointer orhalfword_value
.byte 0x34
.word \orhalfword_pointer
.hword \orhalfword_value
.endm

.macro orword orword_pointer orword_value
.byte 0x35
.word \orword_pointer
.word \orword_value
.endm

.macro bicbyte bicbyte_pointer bicbyte_value
.byte 0x36
.word \bicbyte_pointer
.byte \bicbyte_value
.endm

.macro bichalfword bichalfword_pointer bichalfword_value
.byte 0x37
.word \bichalfword_pointer
.hword \bichalfword_value
.endm

.macro bicword bicword_pointer bicword_value
.byte 0x38
.word \bicword_pointer
.word \bicword_value
.endm

.macro pause pause_duration
.byte 0x39
.hword \pause_duration
.endm

.macro waitstate
.byte 0x3A
.endm

.macro somethinghealcmd3b somethinghealcmd3b_bank
.byte 0x3B
.byte \somethinghealcmd3b_bank
.endm

.macro return
.byte 0x3C
.endm

.macro end
.byte 0x3D
.endm

.macro end2
.byte 0x3E
.endm

.macro end3
.byte 0x3F
.endm

.macro cmd40 cmd40_address
.byte 0x40
.word \cmd40_address
.endm

.macro call call_address
.byte 0x41
.word \call_address
.endm

.macro jumpiftype2 jumpiftype2_bank jumpiftype2_type jumpiftype2_address
.byte 0x42
.byte \jumpiftype2_bank
.byte \jumpiftype2_type
.word \jumpiftype2_address
.endm

.macro jumpifabilitypresent jumpifabilitypresent_ability jumpifabilitypresent_address
.byte 0x43
.byte \jumpifabilitypresent_ability
.word \jumpifabilitypresent_address
.endm

.macro cmd44
.byte 0x44
.endm

.macro playanimation playanimation_bank playanimation_animation playanimation_word
.byte 0x45
.byte \playanimation_bank
.byte \playanimation_animation
.word \playanimation_word
.endm

.macro cmd46 cmd46_bank cmd46_address cmd46_address2
.byte 0x46
.byte \cmd46_bank
.word \cmd46_address
.word \cmd46_address2
.endm

.macro cmd47
.byte 0x47
.endm

.macro playstatchangeanimation playstatchangeanimation_bank playstatchangeanimation_colour playstatchangeanimation_byte
.byte 0x48
.byte \playstatchangeanimation_bank
.byte \playstatchangeanimation_colour
.byte \playstatchangeanimation_byte
.endm

.macro cmd49 cmd49_byte1 cmd49_byte2
.byte 0x49
.byte \cmd49_byte1
.byte \cmd49_byte2
.endm

.macro damagecalc2
.byte 0x4A
.endm

.macro cmd4b
.byte 0x4B
.endm

.macro switch1 switch1_bank
.byte 0x4C
.byte \switch1_bank
.endm

.macro switch2 switch2_bank
.byte 0x4D
.byte \switch2_bank
.endm

.macro switch3 switch3_bank switch3_byte
.byte 0x4E
.byte \switch3_bank
.byte \switch3_byte
.endm

.macro jumpifcannotswitch jumpifcannotswitch_bank jumpifcannotswitch_address
.byte 0x4F
.byte \jumpifcannotswitch_bank
.word \jumpifcannotswitch_address
.endm

.macro openpartyscreen openpartyscreen_bank openpartyscreen_address
.byte 0x50
.byte \openpartyscreen_bank
.word \openpartyscreen_address
.endm

.macro cmd51 cmd51_bank cmd51_param2
.byte 0x51
.byte \cmd51_bank
.byte \cmd51_param2
.endm

.macro cmd52 cmd52_bank
.byte 0x52
.byte \cmd52_bank
.endm

.macro cmd53 cmd53_bank
.byte 0x53
.byte \cmd53_bank
.endm

.macro cmd54 cmd54_hword
.byte 0x54
.hword \cmd54_hword
.endm

.macro cmd55 cmd55_word
.byte 0x55
.word \cmd55_word
.endm

.macro cmd56 cmd56_bank_or_side
.byte 0x56
.byte \cmd56_bank_or_side
.endm

.macro cmd57
.byte 0x57
.endm

.macro cmd58 cmd58_bank
.byte 0x58
.byte \cmd58_bank
.endm

.macro checkiflearnmoveinbattle checkiflearnmoveinbattle_param1 checkiflearnmoveinbattle_param2 checkiflearnmoveinbattle_bank_maybe
.byte 0x59
.word \checkiflearnmoveinbattle_param1
.word \checkiflearnmoveinbattle_param2
.byte \checkiflearnmoveinbattle_bank_maybe
.endm

.macro cmd5a cmd5a_address
.byte 0x5A
.word \cmd5a_address
.endm

.macro cmd5b cmd5b_address
.byte 0x5B
.word \cmd5b_address
.endm

.macro cmd5c cmd5c_bank
.byte 0x5C
.byte \cmd5c_bank
.endm

.macro cmd5d
.byte 0x5D
.endm

.macro cmd5e cmd5e_bank
.byte 0x5E
.byte \cmd5e_bank
.endm

.macro cmd5f
.byte 0x5F
.endm

.macro cmd60 cmd60_byte
.byte 0x60
.byte \cmd60_byte
.endm

.macro cmd61 cmd61_bank_or_side
.byte 0x61
.byte \cmd61_bank_or_side
.endm

.macro cmd62 cmd62_bank_or_side
.byte 0x62
.byte \cmd62_bank_or_side
.endm

.macro jumptoattack jumptoattack_bank
.byte 0x63
.byte \jumptoattack_bank
.endm

.macro statusanimation statusanimation_bank
.byte 0x64
.byte \statusanimation_bank
.endm

.macro cmd65 cmd65_bank_or_side cmd65_address
.byte 0x65
.byte \cmd65_bank_or_side
.word \cmd65_address
.endm

.macro cmd66 cmd66_bank_or_side cmd66_bank_or_side2 cmd66_address
.byte 0x66
.byte \cmd66_bank_or_side
.byte \cmd66_bank_or_side2
.word \cmd66_address
.endm

.macro cmd67
.byte 0x67
.endm

.macro cmd68
.byte 0x68
.endm

.macro cmd69
.byte 0x69
.endm

.macro removeitem removeitem_bank
.byte 0x6A
.byte \removeitem_bank
.endm

.macro cmd6b
.byte 0x6B
.endm

.macro cmd6c
.byte 0x6C
.endm

.macro cmd6d
.byte 0x6D
.endm

.macro cmd6e
.byte 0x6E
.endm

.macro cmd6f cmd6f_bank
.byte 0x6F
.byte \cmd6f_bank
.endm

.macro cmd70 cmd70_bank
.byte 0x70
.byte \cmd70_bank
.endm

.macro cmd71
.byte 0x71
.endm

.macro cmd72 cmd72_address
.byte 0x72
.word \cmd72_address
.endm

.macro cmd73 cmd73_bank
.byte 0x73
.byte \cmd73_bank
.endm

.macro cmd74 cmd74_bank
.byte 0x74
.byte \cmd74_bank
.endm

.macro cmd75
.byte 0x75
.endm

.macro cmd76 cmd76_bank cmd76_byte
.byte 0x76
.byte \cmd76_bank
.byte \cmd76_byte
.endm

.macro setprotect
.byte 0x77
.endm

.macro faintifabilitynotdamp
.byte 0x78
.endm

.macro setuserhptozero
.byte 0x79
.endm

.macro jumpwhiletargetvalid jumpwhiletargetvalid_address
.byte 0x7A
.word \jumpwhiletargetvalid_address
.endm

.macro setdamageasrestorehalfmaxhp setdamageasrestorehalfmaxhp_address setdamageasrestorehalfmaxhp_byte
.byte 0x7B
.word \setdamageasrestorehalfmaxhp_address
.byte \setdamageasrestorehalfmaxhp_byte
.endm

.macro jumptolastusedattack
.byte 0x7C
.endm

.macro setrain
.byte 0x7D
.endm

.macro setreflect
.byte 0x7E
.endm

.macro setleechseed
.byte 0x7F
.endm

.macro manipulatedamage
.byte 0x80
.endm

.macro setrest setrest_address
.byte 0x81
.word \setrest_address
.endm

.macro jumpifnotfirstturn jumpifnotfirstturn_address
.byte 0x82
.word \jumpifnotfirstturn_address
.endm

.macro nop3
.byte 0x83
.endm

.macro jumpifcannotsleep jumpifcannotsleep_address
.byte 0x84
.word \jumpifcannotsleep_address
.endm

.macro stockpile
.byte 0x85
.endm

.macro stockpiletobasedamage stockpiletobasedamage_address
.byte 0x86
.word \stockpiletobasedamage_address
.endm

.macro stockpiletohprecovery stockpiletohprecovery_address
.byte 0x87
.word \stockpiletohprecovery_address
.endm

.macro negativedamage
.byte 0x88
.endm

.macro statbuffchange statbuffchange_target statbuffchange_address
.byte 0x89
.byte \statbuffchange_target
.word \statbuffchange_address
.endm

.macro normalisebuffs
.byte 0x8A
.endm

.macro setbide
.byte 0x8B
.endm

.macro confuseifrepeatingattackends
.byte 0x8C
.endm

.macro setloopcounter setloopcounter_number_of_loop
.byte 0x8D
.byte \setloopcounter_number_of_loop
.endm

.macro cmd8e
.byte 0x8E
.endm

.macro forcerandomswitch forcerandomswitch_address
.byte 0x8F
.word \forcerandomswitch_address
.endm

.macro changetypestoenemyattacktype changetypestoenemyattacktype_address
.byte 0x90
.word \changetypestoenemyattacktype_address
.endm

.macro givemoney
.byte 0x91
.endm

.macro setlightscreen
.byte 0x92
.endm

.macro koplussomethings koplussomethings_address
.byte 0x93
.word \koplussomethings_address
.endm

.macro gethalfcurrentenemyhp
.byte 0x94
.endm

.macro setsandstorm
.byte 0x95
.endm

.macro weatherdamage
.byte 0x96
.endm

.macro tryinfatuatetarget tryinfatuatetarget_address
.byte 0x97
.word \tryinfatuatetarget_address
.endm

.macro cmd98 cmd98_byte
.byte 0x98
.byte \cmd98_byte
.endm

.macro setmisteffect
.byte 0x99
.endm

.macro setincreasedcriticalchance
.byte 0x9A
.endm

.macro transformdataexecution
.byte 0x9B
.endm

.macro setsubstituteeffect
.byte 0x9C
.endm

.macro copyattack copyattack_address
.byte 0x9D
.word \copyattack_address
.endm

.macro metronomeeffect
.byte 0x9E
.endm

.macro nightshadedamageeffect
.byte 0x9F
.endm

.macro psywavedamageeffect
.byte 0xA0
.endm

.macro counterdamagecalculator counterdamagecalculator_address
.byte 0xA1
.word \counterdamagecalculator_address
.endm

.macro mirrorcoatdamagecalculator mirrorcoatdamagecalculator_address
.byte 0xA2
.word \mirrorcoatdamagecalculator_address
.endm

.macro disablelastusedattack disablelastusedattack_address
.byte 0xA3
.word \disablelastusedattack_address
.endm

.macro setencore setencore_address
.byte 0xA4
.word \setencore_address
.endm

.macro painsplitdamagecalculator painsplitdamagecalculator_address
.byte 0xA5
.word \painsplitdamagecalculator_address
.endm

.macro settypetorandomresistance settypetorandomresistance_address
.byte 0xA6
.word \settypetorandomresistance_address
.endm

.macro setalwaymukflag
.byte 0xA7
.endm

.macro copymovepermanently copymovepermanently_address
.byte 0xA8
.word \copymovepermanently_address
.endm

.macro selectrandommovefromusermoves selectrandommovefromusermoves_address
.byte 0xA9
.word \selectrandommovefromusermoves_address
.endm

.macro destinybondeffect
.byte 0xAA
.endm

.macro cmdab
.byte 0xAB
.endm

.macro remaininghptopower
.byte 0xAC
.endm

.macro reducepprandom reducepprandom_address
.byte 0xAD
.word \reducepprandom_address
.endm

.macro clearstatusifnotsoundproofed
.byte 0xAE
.endm

.macro cursetarget cursetarget_address
.byte 0xAF
.word \cursetarget_address
.endm

.macro setspikes setspikes_address
.byte 0xB0
.word \setspikes_address
.endm

.macro setforesight
.byte 0xB1
.endm

.macro setperishsong setperishsong_address
.byte 0xB2
.word \setperishsong_address
.endm

.macro rolloutdamagecalculation
.byte 0xB3
.endm

.macro jumpifconfusedandattackmaxed jumpifconfusedandattackmaxed_bank jumpifconfusedandattackmaxed_address
.byte 0xB4
.byte \jumpifconfusedandattackmaxed_bank
.word \jumpifconfusedandattackmaxed_address
.endm

.macro furycutterdamagecalculation
.byte 0xB5
.endm

.macro happinesstodamagecalculation
.byte 0xB6
.endm

.macro presentdamagecalculation
.byte 0xB7
.endm

.macro setsafeguard
.byte 0xB8
.endm

.macro magnitudedamagecalculation
.byte 0xB9
.endm

.macro cmdba cmdba_address
.byte 0xBA
.word \cmdba_address
.endm

.macro setsunny
.byte 0xBB
.endm

.macro maxattackhalvehp maxattackhalvehp_address
.byte 0xBC
.word \maxattackhalvehp_address
.endm

.macro copyfoestats copyfoestats_address
.byte 0xBD
.word \copyfoestats_address
.endm

.macro breakfree
.byte 0xBE
.endm

.macro setcurled
.byte 0xBF
.endm

.macro recoverbasedonsunlight
.byte 0xC0
.endm

.macro hiddenpowerdamagecalculation
.byte 0xC1
.endm

.macro selectnexttarget
.byte 0xC2
.endm

.macro setfutureattack setfutureattack_address
.byte 0xC3
.word \setfutureattack_address
.endm

.macro beatupcalculation beatupcalculation_address1 beatupcalculation_address2
.byte 0xC4
.word \beatupcalculation_address1
.word \beatupcalculation_address2
.endm

.macro hidepreattack
.byte 0xC5
.endm

.macro unhidepostattack
.byte 0xC6
.endm

.macro setminimize
.byte 0xC7
.endm

.macro sethail
.byte 0xC8
.endm

.macro jumpifattackandspecialattackcannotfall jumpifattackandspecialattackcannotfall_address
.byte 0xC9
.word \jumpifattackandspecialattackcannotfall_address
.endm

.macro setforcedtarget
.byte 0xCA
.endm

.macro setcharge
.byte 0xCB
.endm

.macro callterrainattack
.byte 0xCC
.endm

.macro cureifburnedparalysedorpoisoned cureifburnedparalysedorpoisoned_address
.byte 0xCD
.word \cureifburnedparalysedorpoisoned_address
.endm

.macro settorment settorment_address
.byte 0xCE
.word \settorment_address
.endm

.macro jumpifnodamage jumpifnodamage_address
.byte 0xCF
.word \jumpifnodamage_address
.endm

.macro settaunt settaunt_address
.byte 0xD0
.word \settaunt_address
.endm

.macro sethelpinghand sethelpinghand_address
.byte 0xD1
.word \sethelpinghand_address
.endm

.macro itemswap itemswap_address
.byte 0xD2
.word \itemswap_address
.endm

.macro copyability copyability_address
.byte 0xD3
.word \copyability_address
.endm

.macro cmdd4 cmdd4_byte cmdd4_address
.byte 0xD4
.byte \cmdd4_byte
.word \cmdd4_address
.endm

.macro setroots setroots_address
.byte 0xD5
.word \setroots_address
.endm

.macro doubledamagedealtifdamaged
.byte 0xD6
.endm

.macro setyawn setyawn_address
.byte 0xD7
.word \setyawn_address
.endm

.macro setdamagetohealthdifference setdamagetohealthdifference_address
.byte 0xD8
.word \setdamagetohealthdifference_address
.endm

.macro scaledamagebyhealthratio
.byte 0xD9
.endm

.macro abilityswap abilityswap_address
.byte 0xDA
.word \abilityswap_address
.endm

.macro imprisoneffect imprisoneffect_address
.byte 0xDB
.word \imprisoneffect_address
.endm

.macro setgrudge setgrudge_address
.byte 0xDC
.word \setgrudge_address
.endm

.macro weightdamagecalculation
.byte 0xDD
.endm

.macro assistattackselect assistattackselect_address
.byte 0xDE
.word \assistattackselect_address
.endm

.macro setmagiccoat setmagiccoat_address
.byte 0xDF
.word \setmagiccoat_address
.endm

.macro setstealstatchange setstealstatchange_address
.byte 0xE0
.word \setstealstatchange_address
.endm

.macro cmde1 cmde1_address
.byte 0xE1
.word \cmde1_address
.endm

.macro cmde2 cmde2_bank
.byte 0xE2
.byte \cmde2_bank
.endm

.macro jumpiffainted jumpiffainted_bank jumpiffainted_address
.byte 0xE3
.byte \jumpiffainted_bank
.word \jumpiffainted_address
.endm

.macro naturepowereffect
.byte 0xE4
.endm

.macro pickupitemcalculation
.byte 0xE5
.endm

.macro actualcastformswitch
.byte 0xE6
.endm

.macro castformswitch
.byte 0xE7
.endm

.macro settypebasedhalvers settypebasedhalvers_address
.byte 0xE8
.word \settypebasedhalvers_address
.endm

.macro seteffectbyweather
.byte 0xE9
.endm

.macro recycleitem recycleitem_address
.byte 0xEA
.word \recycleitem_address
.endm

.macro settypetoterrain settypetoterrain_address
.byte 0xEB
.word \settypetoterrain_address
.endm

.macro pursuitwhenswitched pursuitwhenswitched_address
.byte 0xEC
.word \pursuitwhenswitched_address
.endm

.macro snatchmove
.byte 0xED
.endm

.macro removereflectlightscreen
.byte 0xEE
.endm

.macro pokemoncatchfunction
.byte 0xEF
.endm

.macro catchpoke
.byte 0xF0
.endm

.macro capturesomethingf1 capturesomethingf1_address
.byte 0xF1
.word \capturesomethingf1_address
.endm

.macro capturesomethingf2
.byte 0xF2
.endm

.macro capturesomethingf3 capturesomethingf3_address
.byte 0xF3
.word \capturesomethingf3_address
.endm

.macro removehp
.byte 0xF4
.endm

.macro curestatutfirstword
.byte 0xF5
.endm

.macro cmdf6
.byte 0xF6
.endm

.macro activesidesomething
.byte 0xF7
.endm


Abilities Index:
Spoiler:

.equ NO_ABILITY, 0x0
.equ STENCH, 0x1
.equ DRIZZLE, 0x2
.equ SPEED_BOOST, 0x3
.equ BATTLE_ARMOR, 0x4
.equ STURDY, 0x5
.equ DAMP, 0x6
.equ LIMBER, 0x7
.equ SAND_VEIL, 0x8
.equ STATIC, 0x9
.equ VOLT_ABSORB, 0xA
.equ WATER_ABSORB, 0xB
.equ OBLIVIOUS, 0xC
.equ CLOUD_NINE, 0xD
.equ COMPOUND_EYES, 0xE
.equ INSOMNIA, 0xF
.equ COLOR_CHANGE, 0x10
.equ IMMUNITY, 0x11
.equ FLASH_FIRE, 0x12
.equ SHIELD_DUST, 0x13
.equ OWN_TEMPO, 0x14
.equ SUCTION_CUPS, 0x15
.equ INTIMIDATE, 0x16
.equ SHADOW_TAG, 0x17
.equ ROUGH_SKIN, 0x18
.equ WONDER_GUARD, 0x19
.equ LEVITATE, 0x1A
.equ EFFECT_SPORE, 0x1B
.equ SYNCHRONIZE, 0x1C
.equ CLEAR_BODY, 0x1D
.equ NATURAL_CURE, 0x1E
.equ LIGHTNING_ROD, 0x1F
.equ SERENE_GRACE, 0x20
.equ SWIFT_SWIM, 0x21
.equ CHLOROPHYLL, 0x22
.equ ILLUMINATE, 0x23
.equ TRACE, 0x24
.equ HUGE_POWER, 0x25
.equ POISON_POINT, 0x26
.equ INNER_FOCUS, 0x27
.equ MAGMA_ARMOR, 0x28
.equ WATER_VEIL, 0x29
.equ MAGNET_PULL, 0x2A
.equ SOUNDPROOF, 0x2B
.equ RAIN_DISH, 0x2C
.equ SAND_STREAM, 0x2D
.equ PRESSURE, 0x2E
.equ THICK_FAT, 0x2F
.equ EARLY_BIRD, 0x30
.equ FLAME_BODY, 0x31
.equ RUN_AWAY, 0x32
.equ KEEN_EYE, 0x33
.equ HYPER_CUTTER, 0x34
.equ PICKUP, 0x35
.equ TRUANT, 0x36
.equ HUSTLE, 0x37
.equ CUTE_CHARM, 0x38
.equ PLUS, 0x39
.equ MINUS, 0x3A
.equ FORECAST, 0x3B
.equ STICKY_HOLD, 0x3C
.equ SHED_SKIN, 0x3D
.equ GUTS, 0x3E
.equ MARVEL_SCALE, 0x3F
.equ LIQUID_OOZE, 0x40
.equ OVERGROW, 0x41
.equ BLAZE, 0x42
.equ TORRENT, 0x43
.equ SWARM, 0x44
.equ ROCK_HEAD, 0x45
.equ DROUGHT, 0x46
.equ ARENA_TRAP, 0x47
.equ VITAL_SPIRIT, 0x48
.equ WHITE_SMOKE, 0x49
.equ PURE_POWER, 0x4A
.equ SHELL_ARMOR, 0x4B
.equ CACOPHONY, 0x4C
.equ AIR_LOCK, 0x1+0x4C
.equ TANGLED_FEET, 0x1+0x4D
.equ MOTOR_DRIVE, 0x1+0x4E
.equ RIVALRY, 0x1+0x4F
.equ STEADFAST, 0x1+0x50
.equ SNOW_CLOAK, 0x1+0x51
.equ GLUTTONY, 0x1+0x52
.equ ANGER_POINT, 0x1+0x53
.equ UNBURDEN, 0x1+0x54
.equ HEATPROOF, 0x1+0x55
.equ SIMPLE, 0x1+0x56
.equ DRY_SKIN, 0x1+0x57
.equ DOWNLOAD, 0x1+0x58
.equ IRON_FIST, 0x1+0x59
.equ POISON_HEAL, 0x1+0x5A
.equ ADAPTABILITY, 0x1+0x5B
.equ SKILL_LINK, 0x1+0x5C
.equ HYDRATION, 0x1+0x5D
.equ SOLAR_POWER, 0x1+0x5E
.equ QUICK_FEET, 0x1+0x5F
.equ NORMALIZE, 0x1+0x60
.equ SNIPER, 0x1+0x61
.equ MAGIC_GUARD, 0x1+0x62
.equ NO_GUARD, 0x1+0x63
.equ STALL, 0x1+0x64
.equ TECHNICIAN, 0x1+0x65
.equ LEAF_GUARD, 0x1+0x66
.equ KLUTZ, 0x1+0x67
.equ MOLD_BREAKER, 0x1+0x68
.equ SUPER_LUCK, 0x1+0x69
.equ AFTERMATH, 0x1+0x6A
.equ ANTICIPATION, 0x1+0x6B
.equ FOREWARN, 0x1+0x6C
.equ UNAWARE, 0x1+0x6D
.equ TINTED_LENS, 0x1+0x6E
.equ FILTER, 0x1+0x6F
.equ SLOW_START, 0x1+0x70
.equ SCRAPPY, 0x1+0x71
.equ STORM_DRAIN, 0x1+0x72
.equ ICE_BODY, 0x1+0x73
.equ SOLID_ROCK, 0x1+0x74
.equ SNOW_WARNING, 0x1+0x75
.equ HONEY_GATHER, 0x1+0x76
.equ FRISK, 0x1+0x77
.equ RECKLESS, 0x1+0x78
.equ MULTITYPE, 0x1+0x79
.equ FLOWER_GIFT, 0x1+0x7A
.equ BAD_DREAMS, 0x1+0x7B
.equ PICKPOCKET, 0x1+0x7C
.equ SHEER_FORCE, 0x1+0x7D
.equ CONTRARY, 0x1+0x7E
.equ UNNERVE, 0x1+0x7F
.equ DEFIANT, 0x1+0x80
.equ DEFEATIST, 0x1+0x81
.equ CURSED_BODY, 0x1+0x82
.equ HEALER, 0x1+0x83
.equ FRIEND_GUARD, 0x1+0x84
.equ WEAK_ARMOR, 0x1+0x85
.equ HEAVY_METAL, 0x1+0x86
.equ LIGHT_METAL, 0x1+0x87
.equ MULTISCALE, 0x1+0x88
.equ TOXIC_BOOST, 0x1+0x89
.equ FLARE_BOOST, 0x1+0x8A
.equ HARVEST, 0x1+0x8B
.equ TELEPATHY, 0x1+0x8C
.equ MOODY, 0x1+0x8D
.equ OVERCOAT, 0x1+0x8E
.equ POISON_TOUCH, 0x1+0x8F
.equ REGENERATOR, 0x1+0x90
.equ BIG_PECKS, 0x1+0x91
.equ SAND_RUSH, 0x1+0x92
.equ WONDER_SKIN, 0x1+0x93
.equ ANALYTIC, 0x1+0x94
.equ ILLUSION, 0x1+0x95
.equ IMPOSTER, 0x1+0x96
.equ INFILTRATOR, 0x1+0x97
.equ MUMMY, 0x1+0x98
.equ MOXIE, 0x1+0x99
.equ JUSTIFIED, 0x1+0x9A
.equ RATTLED, 0x1+0x9B
.equ MAGIC_BOUNCE, 0x1+0x9C
.equ SAP_SIPPER, 0x1+0x9D
.equ PRANKSTER, 0x1+0x9E
.equ SAND_FORCE, 0x1+0x9F
.equ IRON_BARBS, 0x1+0xA0
.equ ZEN_MODE, 0x1+0xA1
.equ VICTORY_STAR, 0x1+0xA2
.equ TURBOBLAZE, 0x1+0xA3
.equ TERAVOLT, 0x1+0xA4
.equ AROMA_VEIL, 0x1+0xA5
.equ FLOWER_VEIL, 0x1+0xA6
.equ CHEEK_POUCH, 0x1+0xA7
.equ PROTEAN, 0x1+0xA8
.equ FUR_COAT, 0x1+0xA9
.equ MAGICIAN, 0x1+0xAA
.equ BULLETPROOF, 0x1+0xAB
.equ COMPETITIVE, 0x1+0xAC
.equ STRONG_JAW, 0x1+0xAD
.equ REFRIGERATE, 0x1+0xAE
.equ SWEET_VEIL, 0x1+0xAF
.equ STANCE_CHANGE, 0x1+0xB0
.equ GALE_WINGS, 0x1+0xB1
.equ MEGA_LAUNCHER, 0x1+0xB2
.equ GRASS_PELT, 0x1+0xB3
.equ SYMBIOSIS, 0x1+0xB4
.equ TOUGH_CLAWS, 0x1+0xB5
.equ PIXILATE, 0x1+0xB6
.equ GOOEY, 0x1+0xB7
.equ AERILATE, 0x1+0xB8
.equ PARENTAL_BOND, 0x1+0xB9
.equ DARK_AURA, 0x1+0xBA
.equ FAIRY_AURA, 0x1+0xBB
.equ AURA_BREAK, 0x1+0xBC
.equ PRIMORDIA_SEA, 0x1+0xBD
.equ DESOLATE_LAND, 0x1+0xBE
.equ DELTA_STREAM, 0x1+0xBF

Attack Indexes:
Spoiler:

.equ ABSORB, 0x47
.equ ACID, 0x33
.equ ACID_ARMOR, 0x97
.equ ACID_SPRAY, 0x1EB
.equ ACROBATICS, 0x200
.equ ACUPRESSURE, 0x16F
.equ AERIAL_ACE, 0x14C
.equ AEROBLAST, 0xB1
.equ AFTER_YOU, 0x1EF
.equ AGILITY, 0x61
.equ AIR_CUTTER, 0x13A
.equ AIR_SLASH, 0x193
.equ ALLY_SWITCH, 0x1F6
.equ AMNESIA, 0x85
.equ ANCIENT_POWER, 0xF6
.equ AQUA_JET, 0x1C5
.equ AQUA_RING, 0x188
.equ AQUA_TAIL, 0x191
.equ ARM_THRUST, 0x124
.equ AROMATHERAPY, 0x138
.equ AROMATIC_MIST, 0x255
.equ ASSIST, 0x112
.equ ASSURANCE, 0x174
.equ ASTONISH, 0x136
.equ ATTACK_ORDER, 0x1C6
.equ ATTRACT, 0xD5
.equ AURA_SPHERE, 0x18C
.equ AURORA_BEAM, 0x3E
.equ AUTOTOMIZE, 0x1DB
.equ AVALANCHE, 0x1A3
.equ BABYDOLL_EYES, 0x260
.equ BARRAGE, 0x8C
.equ BARRIER, 0x70
.equ BATON_PASS, 0xE2
.equ BEAT_UP, 0xFB
.equ BELCH, 0x232
.equ BELLY_DRUM, 0xBB
.equ BESTOW, 0x204
.equ BIDE, 0x75
.equ BIND, 0x14
.equ BITE, 0x2C
.equ BLAST_BURN, 0x133
.equ BLAZE_KICK, 0x12B
.equ BLIZZARD, 0x3B
.equ BLOCK, 0x14F
.equ BLUE_FLARE, 0x227
.equ BODY_SLAM, 0x22
.equ BOLT_STRIKE, 0x226
.equ BONE_CLUB, 0x7D
.equ BONE_RUSH, 0xC6
.equ BONEMERANG, 0x9B
.equ BOOMBURST, 0x24A
.equ BOUNCE, 0x154
.equ BRAVE_BIRD, 0x19D
.equ BRICK_BREAK, 0x118
.equ BRINE, 0x16A
.equ BUBBLE, 0x91
.equ BUBBLE_BEAM, 0x3D
.equ BUG_BITE, 0x1C2
.equ BUG_BUZZ, 0x195
.equ BULK_UP, 0x153
.equ BULLDOZE, 0x20B
.equ BULLET_PUNCH, 0x1A2
.equ BULLET_SEED, 0x14B
.equ CALM_MIND, 0x15B
.equ CAMOUFLAGE, 0x125
.equ CAPTIVATE, 0x1BD
.equ CELEBRATE, 0x25E
.equ CHARGE, 0x10C
.equ CHARGE_BEAM, 0x1C3
.equ CHARM, 0xCC
.equ CHATTER, 0x1C0
.equ CHIP_AWAY, 0x1F2
.equ CIRCLE_THROW, 0x1FD
.equ CLAMP, 0x80
.equ CLEAR_SMOG, 0x1F3
.equ CLOSE_COMBAT, 0x172
.equ COIL, 0x1E9
.equ COMET_PUNCH, 0x4
.equ CONFIDE, 0x24E
.equ CONFUSE_RAY, 0x6D
.equ CONFUSION, 0x5D
.equ CONSTRICT, 0x84
.equ CONVERSION, 0xA0
.equ CONVERSION_2, 0xB0
.equ COPYCAT, 0x17F
.equ COSMIC_POWER, 0x142
.equ COTTON_GUARD, 0x21A
.equ COTTON_SPORE, 0xB2
.equ COUNTER, 0x44
.equ COVET, 0x157
.equ CRABHAMMER, 0x98
.equ CRAFTY_SHIELD, 0x242
.equ CROSS_CHOP, 0xEE
.equ CROSS_POISON, 0x1B8
.equ CRUNCH, 0xF2
.equ CRUSH_CLAW, 0x132
.equ CRUSH_GRIP, 0x1CE
.equ CURSE, 0xAE
.equ CUT, 0xF
.equ DARK_PULSE, 0x18F
.equ DARK_VOID, 0x1D0
.equ DAZZLING_GLEAM, 0x25D
.equ DEFEND_ORDER, 0x1C7
.equ DEFENSE_CURL, 0x6F
.equ DEFOG, 0x1B0
.equ DESTINY_BOND, 0xC2
.equ DETECT, 0xC5
.equ DIAMOND_STORM, 0x24F
.equ DIG, 0x5B
.equ DISABLE, 0x32
.equ DISARMING_VOICE, 0x23E
.equ DISCHARGE, 0x1B3
.equ DIVE, 0x123
.equ DIZZY_PUNCH, 0x92
.equ DOOM_DESIRE, 0x161
.equ DOUBLEEDGE, 0x26
.equ DOUBLE_HIT, 0x1CA
.equ DOUBLE_KICK, 0x18
.equ DOUBLE_SLAP, 0x3
.equ DOUBLE_TEAM, 0x68
.equ DRACO_METEOR, 0x1B2
.equ DRAGON_ASCENT, 0x26C
.equ DRAGON_BREATH, 0xE1
.equ DRAGON_CLAW, 0x151
.equ DRAGON_DANCE, 0x15D
.equ DRAGON_PULSE, 0x196
.equ DRAGON_RAGE, 0x52
.equ DRAGON_RUSH, 0x197
.equ DRAGON_TAIL, 0x20D
.equ DRAINING_KISS, 0x241
.equ DRAIN_PUNCH, 0x199
.equ DREAM_EATER, 0x8A
.equ DRILL_PECK, 0x41
.equ DRILL_RUN, 0x211
.equ DUAL_CHOP, 0x212
.equ DYNAMIC_PUNCH, 0xDF
.equ EARTH_POWER, 0x19E
.equ EARTHQUAKE, 0x59
.equ ECHOED_VOICE, 0x1F1
.equ EERIE_IMPULSE, 0x256
.equ EGG_BOMB, 0x79
.equ ELECTRIC_TERRAIN, 0x25C
.equ ELECTRIFY, 0x246
.equ ELECTRO_BALL, 0x1E6
.equ ELECTROWEB, 0x20F
.equ EMBARGO, 0x175
.equ EMBER, 0x34
.equ ENCORE, 0xE3
.equ ENDEAVOR, 0x11B
.equ ENDURE, 0xCB
.equ ENERGY_BALL, 0x19C
.equ ENTRAINMENT, 0x1EE
.equ ERUPTION, 0x11C
.equ EXPLOSION, 0x99
.equ EXTRASENSORY, 0x146
.equ EXTREME_SPEED, 0xF5
.equ FACADE, 0x107
.equ FEINT_ATTACK, 0xB9
.equ FAIRY_LOCK, 0x24B
.equ FAIRY_WIND, 0x248
.equ FAKE_OUT, 0xFC
.equ FAKE_TEARS, 0x139
.equ FALSE_SWIPE, 0xCE
.equ FEATHER_DANCE, 0x129
.equ FEINT, 0x16C
.equ FELL_STINGER, 0x235
.equ FIERY_DANCE, 0x228
.equ FINAL_GAMBIT, 0x203
.equ FIRE_BLAST, 0x7E
.equ FIRE_FANG, 0x1A8
.equ FIRE_PLEDGE, 0x207
.equ FIRE_PUNCH, 0x7
.equ FIRE_SPIN, 0x53
.equ FISSURE, 0x5A
.equ FLAIL, 0xAF
.equ FLAME_BURST, 0x1E1
.equ FLAME_CHARGE, 0x1E8
.equ FLAME_WHEEL, 0xAC
.equ FLAMETHROWER, 0x35
.equ FLARE_BLITZ, 0x18A
.equ FLASH, 0x94
.equ FLASH_CANNON, 0x1AE
.equ FLATTER, 0x104
.equ FLING, 0x176
.equ FLOWER_SHIELD, 0x243
.equ FLY, 0x13
.equ FLYING_PRESS, 0x230
.equ FOCUS_BLAST, 0x19B
.equ FOCUS_ENERGY, 0x74
.equ FOCUS_PUNCH, 0x108
.equ FOLLOW_ME, 0x10A
.equ FORCE_PALM, 0x18B
.equ FORESIGHT, 0xC1
.equ FORESTS_CURSE, 0x23B
.equ FOUL_PLAY, 0x1EC
.equ FREEZEDRY, 0x23D
.equ FREEZE_SHOCK, 0x229
.equ FRENZY_PLANT, 0x152
.equ FROST_BREATH, 0x20C
.equ FRUSTRATION, 0xDA
.equ FURY_ATTACK, 0x1F
.equ FURY_CUTTER, 0xD2
.equ FURY_SWIPES, 0x9A
.equ FUSION_BOLT, 0x22F
.equ FUSION_FLARE, 0x22E
.equ FUTURE_SIGHT, 0xF8
.equ GASTRO_ACID, 0x17C
.equ GEAR_GRIND, 0x220
.equ GEOMANCY, 0x259
.equ GIGA_DRAIN, 0xCA
.equ GIGA_IMPACT, 0x1A0
.equ GLACIATE, 0x225
.equ GLARE, 0x89
.equ GRASS_KNOT, 0x1BF
.equ GRASS_PLEDGE, 0x208
.equ GRASS_WHISTLE, 0x140
.equ GRASSY_TERRAIN, 0x244
.equ GRAVITY, 0x164
.equ GROWL, 0x2D
.equ GROWTH, 0x4A
.equ GRUDGE, 0x120
.equ GUARD_SPLIT, 0x1D6
.equ GUARD_SWAP, 0x181
.equ GUILLOTINE, 0xC
.equ GUNK_SHOT, 0x1B9
.equ GUST, 0x10
.equ GYRO_BALL, 0x168
.equ HAIL, 0x102
.equ HAMMER_ARM, 0x167
.equ HAPPY_HOUR, 0x25B
.equ HARDEN, 0x6A
.equ HAZE, 0x72
.equ HEAD_CHARGE, 0x21F
.equ HEAD_SMASH, 0x1C9
.equ HEADBUTT, 0x1D
.equ HEAL_BELL, 0xD7
.equ HEAL_BLOCK, 0x179
.equ HEAL_ORDER, 0x1C8
.equ HEAL_PULSE, 0x1F9
.equ HEALING_WISH, 0x169
.equ HEART_STAMP, 0x213
.equ HEART_SWAP, 0x187
.equ HEAT_CRASH, 0x217
.equ HEAT_WAVE, 0x101
.equ HEAVY_SLAM, 0x1E4
.equ HELPING_HAND, 0x10E
.equ HEX, 0x1FA
.equ HIDDEN_POWER, 0xED
.equ HIGH_JUMP_KICK, 0x88
.equ HOLD_BACK, 0x262
.equ HOLD_HANDS, 0x267
.equ HONE_CLAWS, 0x1D4
.equ HORN_ATTACK, 0x1E
.equ HORN_DRILL, 0x20
.equ HORN_LEECH, 0x214
.equ HOWL, 0x150
.equ HURRICANE, 0x21E
.equ HYDRO_CANNON, 0x134
.equ HYDRO_PUMP, 0x38
.equ HYPER_BEAM, 0x3F
.equ HYPER_FANG, 0x9E
.equ HYPERSPACE_FURY, 0x26D
.equ HYPERSPACE_HOLE, 0x251
.equ HYPER_VOICE, 0x130
.equ HYPNOSIS, 0x5F
.equ ICE_BALL, 0x12D
.equ ICE_BEAM, 0x3A
.equ ICE_BURN, 0x22A
.equ ICE_FANG, 0x1A7
.equ ICE_PUNCH, 0x8
.equ ICE_SHARD, 0x1A4
.equ ICICLE_CRASH, 0x22C
.equ ICICLE_SPEAR, 0x14D
.equ ICY_WIND, 0xC4
.equ IMPRISON, 0x11E
.equ INCINERATE, 0x1FE
.equ INFERNO, 0x205
.equ INFESTATION, 0x263
.equ INGRAIN, 0x113
.equ ION_DELUGE, 0x239
.equ IRON_DEFENSE, 0x14E
.equ IRON_HEAD, 0x1BA
.equ IRON_TAIL, 0xE7
.equ JUDGMENT, 0x1C1
.equ JUMP_KICK, 0x1A
.equ KARATE_CHOP, 0x2
.equ KINESIS, 0x86
.equ KINGS_SHIELD, 0x24C
.equ KNOCK_OFF, 0x11A
.equ LANDS_WRATH, 0x268
.equ LAST_RESORT, 0x183
.equ LAVA_PLUME, 0x1B4
.equ LEAF_BLADE, 0x15C
.equ LEAF_STORM, 0x1B5
.equ LEAF_TORNADO, 0x218
.equ LEECH_LIFE, 0x8D
.equ LEECH_SEED, 0x49
.equ LEER, 0x2B
.equ LICK, 0x7A
.equ LIGHT_OF_RUIN, 0x269
.equ LIGHT_SCREEN, 0x71
.equ LOCKON, 0xC7
.equ LOVELY_KISS, 0x8E
.equ LOW_KICK, 0x43
.equ LOW_SWEEP, 0x1EA
.equ LUCKY_CHANT, 0x17D
.equ LUNAR_DANCE, 0x1CD
.equ LUSTER_PURGE, 0x127
.equ MACH_PUNCH, 0xB7
.equ MAGIC_COAT, 0x115
.equ MAGIC_ROOM, 0x1DE
.equ MAGICAL_LEAF, 0x159
.equ MAGMA_STORM, 0x1CF
.equ MAGNET_BOMB, 0x1BB
.equ MAGNETIC_FLUX, 0x25A
.equ MAGNET_RISE, 0x189
.equ MAGNITUDE, 0xDE
.equ MAT_BLOCK, 0x231
.equ ME_FIRST, 0x17E
.equ MEAN_LOOK, 0xD4
.equ MEDITATE, 0x60
.equ MEGA_DRAIN, 0x48
.equ MEGA_KICK, 0x19
.equ MEGA_PUNCH, 0x5
.equ MEGAHORN, 0xE0
.equ MEMENTO, 0x106
.equ METAL_BURST, 0x170
.equ METAL_CLAW, 0xE8
.equ METAL_SOUND, 0x13F
.equ METEOR_MASH, 0x135
.equ METRONOME, 0x76
.equ MILK_DRINK, 0xD0
.equ MIMIC, 0x66
.equ MIND_READER, 0xAA
.equ MINIMIZE, 0x6B
.equ MIRACLE_EYE, 0x165
.equ MIRROR_COAT, 0xF3
.equ MIRROR_MOVE, 0x77
.equ MIRROR_SHOT, 0x1AD
.equ MIST, 0x36
.equ MIST_BALL, 0x128
.equ MISTY_TERRAIN, 0x245
.equ MOONBLAST, 0x249
.equ MOONLIGHT, 0xEC
.equ MORNING_SUN, 0xEA
.equ MUD_SLAP, 0xBD
.equ MUD_BOMB, 0x1AA
.equ MUD_SHOT, 0x155
.equ MUD_SPORT, 0x12C
.equ MUDDY_WATER, 0x14A
.equ MYSTICAL_FIRE, 0x253
.equ NASTY_PLOT, 0x1A1
.equ NATURAL_GIFT, 0x16B
.equ NATURE_POWER, 0x10B
.equ NEEDLE_ARM, 0x12E
.equ NIGHT_DAZE, 0x21B
.equ NIGHT_SHADE, 0x65
.equ NIGHT_SLASH, 0x190
.equ NIGHTMARE, 0xAB
.equ NOBLE_ROAR, 0x238
.equ NUZZLE, 0x261
.equ OBLIVION_WING, 0x265
.equ OCTAZOOKA, 0xBE
.equ ODOR_SLEUTH, 0x13C
.equ OMINOUS_WIND, 0x1D2
.equ ORIGIN_PULSE, 0x26A
.equ OUTRAGE, 0xC8
.equ OVERHEAT, 0x13B
.equ PAIN_SPLIT, 0xDC
.equ PARABOLIC_CHARGE, 0x23A
.equ PARTING_SHOT, 0x23F
.equ PAY_DAY, 0x6
.equ PAYBACK, 0x173
.equ PECK, 0x40
.equ PERISH_SONG, 0xC3
.equ PETAL_BLIZZARD, 0x23C
.equ PETAL_DANCE, 0x50
.equ PHANTOM_FORCE, 0x236
.equ PIN_MISSILE, 0x2A
.equ PLAY_NICE, 0x24D
.equ PLAY_ROUGH, 0x247
.equ PLUCK, 0x16D
.equ POISON_FANG, 0x131
.equ POISON_GAS, 0x8B
.equ POISON_JAB, 0x18E
.equ POISON_POWDER, 0x4D
.equ POISON_STING, 0x28
.equ POISON_TAIL, 0x156
.equ POUND, 0x1
.equ POWDER, 0x258
.equ POWDER_SNOW, 0xB5
.equ POWER_GEM, 0x198
.equ POWER_SPLIT, 0x1D7
.equ POWER_SWAP, 0x180
.equ POWER_TRICK, 0x17B
.equ POWERUP_PUNCH, 0x264
.equ POWER_WHIP, 0x1B6
.equ PRECIPICE_BLADES, 0x26B
.equ PRESENT, 0xD9
.equ PROTECT, 0xB6
.equ PSYBEAM, 0x3C
.equ PSYCH_UP, 0xF4
.equ PSYCHIC, 0x5E
.equ PSYCHO_BOOST, 0x162
.equ PSYCHO_CUT, 0x1AB
.equ PSYCHO_SHIFT, 0x177
.equ PSYSHOCK, 0x1D9
.equ PSYSTRIKE, 0x21C
.equ PSYWAVE, 0x95
.equ PUNISHMENT, 0x182
.equ PURSUIT, 0xE4
.equ QUASH, 0x1FF
.equ QUICK_ATTACK, 0x62
.equ QUICK_GUARD, 0x1F5
.equ QUIVER_DANCE, 0x1E3
.equ RAGE, 0x63
.equ RAGE_POWDER, 0x1DC
.equ RAIN_DANCE, 0xF0
.equ RAPID_SPIN, 0xE5
.equ RAZOR_LEAF, 0x4B
.equ RAZOR_SHELL, 0x216
.equ RAZOR_WIND, 0xD
.equ RECOVER, 0x69
.equ RECYCLE, 0x116
.equ REFLECT, 0x73
.equ REFLECT_TYPE, 0x201
.equ REFRESH, 0x11F
.equ RELIC_SONG, 0x223
.equ REST, 0x9C
.equ RETALIATE, 0x202
.equ RETURN, 0xD8
.equ REVENGE, 0x117
.equ REVERSAL, 0xB3
.equ ROAR, 0x2E
.equ ROAR_OF_TIME, 0x1CB
.equ ROCK_BLAST, 0x15E
.equ ROCK_CLIMB, 0x1AF
.equ ROCK_POLISH, 0x18D
.equ ROCK_SLIDE, 0x9D
.equ ROCK_SMASH, 0xF9
.equ ROCK_THROW, 0x58
.equ ROCK_TOMB, 0x13D
.equ ROCK_WRECKER, 0x1B7
.equ ROLE_PLAY, 0x110
.equ ROLLING_KICK, 0x1B
.equ ROLLOUT, 0xCD
.equ ROOST, 0x163
.equ ROTOTILLER, 0x233
.equ ROUND, 0x1F0
.equ SACRED_FIRE, 0xDD
.equ SACRED_SWORD, 0x215
.equ SAFEGUARD, 0xDB
.equ SAND_ATTACK, 0x1C
.equ SAND_TOMB, 0x148
.equ SANDSTORM, 0xC9
.equ SCALD, 0x1F7
.equ SCARY_FACE, 0xB8
.equ SCRATCH, 0xA
.equ SCREECH, 0x67
.equ SEARING_SHOT, 0x221
.equ SECRET_POWER, 0x122
.equ SECRET_SWORD, 0x224
.equ SEED_BOMB, 0x192
.equ SEED_FLARE, 0x1D1
.equ SEISMIC_TOSS, 0x45
.equ SELFDESTRUCT, 0x78
.equ SHADOW_BALL, 0xF7
.equ SHADOW_CLAW, 0x1A5
.equ SHADOW_FORCE, 0x1D3
.equ SHADOW_PUNCH, 0x145
.equ SHADOW_SNEAK, 0x1A9
.equ SHARPEN, 0x9F
.equ SHEER_COLD, 0x149
.equ SHELL_SMASH, 0x1F8
.equ SHIFT_GEAR, 0x1FC
.equ SHOCK_WAVE, 0x15F
.equ SIGNAL_BEAM, 0x144
.equ SILVER_WIND, 0x13E
.equ SIMPLE_BEAM, 0x1ED
.equ SING, 0x2F
.equ SKETCH, 0xA6
.equ SKILL_SWAP, 0x11D
.equ SKULL_BASH, 0x82
.equ SKY_ATTACK, 0x8F
.equ SKY_DROP, 0x1FB
.equ SKY_UPPERCUT, 0x147
.equ SLACK_OFF, 0x12F
.equ SLAM, 0x15
.equ SLASH, 0xA3
.equ SLEEP_POWDER, 0x4F
.equ SLEEP_TALK, 0xD6
.equ SLUDGE, 0x7C
.equ SLUDGE_BOMB, 0xBC
.equ SLUDGE_WAVE, 0x1E2
.equ SMACK_DOWN, 0x1DF
.equ SMELLING_SALTS, 0x109
.equ SMOG, 0x7B
.equ SMOKESCREEN, 0x6C
.equ SNARL, 0x22B
.equ SNATCH, 0x121
.equ SNORE, 0xAD
.equ SPIKY_SHIELD, 0x254
.equ SOAK, 0x1E7
.equ SOFTBOILED, 0x87
.equ SOLAR_BEAM, 0x4C
.equ SONIC_BOOM, 0x31
.equ SPACIAL_REND, 0x1CC
.equ SPARK, 0xD1
.equ SPIDER_WEB, 0xA9
.equ SPIKE_CANNON, 0x83
.equ SPIKES, 0xBF
.equ SPIT_UP, 0xFF
.equ SPITE, 0xB4
.equ SPLASH, 0x96
.equ SPORE, 0x93
.equ STEALTH_ROCK, 0x1BE
.equ STEAM_ERUPTION, 0x250
.equ STEEL_WING, 0xD3
.equ STICKY_WEB, 0x234
.equ STOCKPILE, 0xFE
.equ STOMP, 0x17
.equ STONE_EDGE, 0x1BC
.equ STORED_POWER, 0x1F4
.equ STORM_THROW, 0x1E0
.equ STEAMROLLER, 0x219
.equ STRENGTH, 0x46
.equ STRING_SHOT, 0x51
.equ STRUGGLE, 0xA5
.equ STRUGGLE_BUG, 0x20A
.equ STUN_SPORE, 0x4E
.equ SUBMISSION, 0x42
.equ SUBSTITUTE, 0xA4
.equ SUCKER_PUNCH, 0x185
.equ SUNNY_DAY, 0xF1
.equ SUPER_FANG, 0xA2
.equ SUPERPOWER, 0x114
.equ SUPERSONIC, 0x30
.equ SURF, 0x39
.equ SWAGGER, 0xCF
.equ SWALLOW, 0x100
.equ SWEET_KISS, 0xBA
.equ SWEET_SCENT, 0xE6
.equ SWIFT, 0x81
.equ SWITCHEROO, 0x19F
.equ SWORDS_DANCE, 0xE
.equ SYNCHRONOISE, 0x1E5
.equ SYNTHESIS, 0xEB
.equ TACKLE, 0x21
.equ TAIL_GLOW, 0x126
.equ TAIL_SLAP, 0x21D
.equ TAIL_WHIP, 0x27
.equ TAILWIND, 0x16E
.equ TAKE_DOWN, 0x24
.equ TAUNT, 0x10D
.equ TECHNO_BLAST, 0x222
.equ TEETER_DANCE, 0x12A
.equ TELEKINESIS, 0x1DD
.equ TELEPORT, 0x64
.equ THIEF, 0xA8
.equ THOUSAND_ARROWS, 0x266
.equ THOUSAND_WAVES, 0x267
.equ THRASH, 0x25
.equ THUNDER, 0x57
.equ THUNDER_FANG, 0x1A6
.equ THUNDER_PUNCH, 0x9
.equ THUNDER_SHOCK, 0x54
.equ THUNDER_WAVE, 0x56
.equ THUNDERBOLT, 0x55
.equ TICKLE, 0x141
.equ TOPSYTURVY, 0x240
.equ TORMENT, 0x103
.equ TOXIC, 0x5C
.equ TOXIC_SPIKES, 0x186
.equ TRANSFORM, 0x90
.equ TRI_ATTACK, 0xA1
.equ TRICK, 0x10F
.equ TRICKORTREAT, 0x237
.equ TRICK_ROOM, 0x1B1
.equ TRIPLE_KICK, 0xA7
.equ TRUMP_CARD, 0x178
.equ TWINEEDLE, 0x29
.equ TWISTER, 0xEF
.equ UTURN, 0x171
.equ UPROAR, 0xFD
.equ VCREATE, 0x22D
.equ VACUUM_WAVE, 0x19A
.equ VENOM_DRENCH, 0x257
.equ VENOSHOCK, 0x1DA
.equ VICE_GRIP, 0xB
.equ VINE_WHIP, 0x16
.equ VITAL_THROW, 0xE9
.equ VOLT_SWITCH, 0x209
.equ VOLT_TACKLE, 0x158
.equ WAKEUP_SLAP, 0x166
.equ WATER_GUN, 0x37
.equ WATER_PLEDGE, 0x206
.equ WATER_PULSE, 0x160
.equ WATER_SPORT, 0x15A
.equ WATER_SPOUT, 0x143
.equ WATERFALL, 0x7F
.equ WATER_SHURIKEN, 0x252
.equ WEATHER_BALL, 0x137
.equ WHIRLPOOL, 0xFA
.equ WHIRLWIND, 0x12
.equ WIDE_GUARD, 0x1D5
.equ WILD_CHARGE, 0x210
.equ WILLOWISP, 0x105
.equ WING_ATTACK, 0x11
.equ WISH, 0x111
.equ WITHDRAW, 0x6E
.equ WONDER_ROOM, 0x1D8
.equ WOOD_HAMMER, 0x1C4
.equ WORK_UP, 0x20E
.equ WORRY_SEED, 0x184
.equ WRAP, 0x23
.equ WRING_OUT, 0x17A
.equ XSCISSOR, 0x194
.equ YAWN, 0x119
.equ ZAP_CANNON, 0xC0
.equ ZEN_HEADBUTT, 0x1AC

RAM Locations Emerald:
Spoiler:

.equ FlagBattle, 0x02022FEC	
.equ b_active_side, 0x2024064
.equ NPokeField, 0x202406C
.equ TurnOrderPoke, 0x0202407E
.equ BattleData, 0x2024084
.equ CurrentMove, 0x20241EA
.equ StoreDamage, 0x20241F0
.equ ItemBuffer, 0x2024208
.equ Bank, 0x202420B
.equ Critical_Hit_Loc, 0x2024211
.equ CurrentBS, 0x2024214
.equ OutCome, 0x202427C
.equ HitMarker, 0x2024280
.equ b_statut3_bits_pbs, 0x20242AC
.equ SomeLoc, 0x2024332
.equ EffectChooser, 0x2024335
.equ MultiStringChooser, 0x2024337
.equ PokeAlreadyPlayed, 0x202433E
.equ Weathers, 0x20243CC
.equ WeathersDuration, 0x20243F8
.equ BasePowerMove, 0x2024400
.equ EnigmaRamArea, 0x2024404
.equ Cmd49TableCounter, 0x2024488
.equ MemLoc, 0x0202449C
.equ b_Resources, 0x20244A8
.equ VariableBasePowerMove, 0x20244E0
.equ PlayerParty, 0x020244EC
.equ AIParty, 0x2024744
.equ DamageMultiplier, 0x02024882

Misc Routines:
Spoiler:

.equ PlaySoundRoutine, 0x80A37A4+1
.equ ScriptPusher, 0x803FAFC+1
.equ ExecuteScript, 0x8044498+1
.equ b_std_message, 0x803F964+1
.equ pokemon_calculate_stats, 0x8068D0C+1
.equ pokemon_calc_checksum, 0x8068C78+1
.equ pokemon_encrypt, 0x806A228+1
.equ set_attr, 0x806ACAC+1
.equ ability_something, 0x8042828+1
.equ play_cry, 0x80A32E4+1
.equ DivideLoc, 0x82E7540+1
.equ u_DivideLoc, 0x82E7B68+1

Characters string in-battle:
Spoiler:

.equ Space, 0x00
.equ JumpLine, 0xFE
.equ BuffCharac, 0xFD
.equ Apos, 0xB4
.equ Comma, 0xB8
.equ Dot, 0xAD
.equ Exclam, 0xAB
.equ Interro, 0xAC
.equ Termin, 0xFF
.equ Dash, 0xAE

.equ A_, 0xBB
.equ B_, 0xBC
.equ C_, 0xBD
.equ D_, 0xBE
.equ E_, 0xBF
.equ F_, 0xC0
.equ G_, 0xC1
.equ H_, 0xC2
.equ I_, 0xC3
.equ J_, 0xC4
.equ K_, 0xC5
.equ L_, 0xC6
.equ M_, 0xC7
.equ N_, 0xC8
.equ O_, 0xC9
.equ P_, 0xCA
.equ Q_, 0xCB
.equ R_, 0xCC
.equ S_, 0xCD
.equ T_, 0xCE
.equ U_, 0xCF
.equ V_, 0xD0
.equ W_, 0xD1
.equ X_, 0xD2
.equ Y_, 0xD3
.equ Z_, 0xD4

.equ a_, 0xD5
.equ b_, 0xD6
.equ c_, 0xD7
.equ d_, 0xD8
.equ e_, 0xD9
.equ f_, 0xDA
.equ g_, 0xDB
.equ h_, 0xDC
.equ i_, 0xDD
.equ j_, 0xDE
.equ k_, 0xDF
.equ l_, 0xE0
.equ m_, 0xE1
.equ n_, 0xE2
.equ o_, 0xE3
.equ p_, 0xE4
.equ q_, 0xE5
.equ r_, 0xE6
.equ s_, 0xE7
.equ t_, 0xE8
.equ u_, 0xE9
.equ v_, 0xEA
.equ w_, 0xEB
.equ x_, 0xEC
.equ y_, 0xED
.equ z_, 0xEE

.macro dispsent  dispsent_1  dispsent_2  dispsent_3  dispsent_4  dispsent_5  dispsent_6  dispsent_7  dispsent_8  dispsent_9  dispsent_10  dispsent_11  dispsent_12  dispsent_13  dispsent_14  dispsent_15  dispsent_16  dispsent_17  dispsent_18  dispsent_19  dispsent_20  dispsent_21  dispsent_22  dispsent_23  dispsent_24  dispsent_25  dispsent_26  dispsent_27  dispsent_28  dispsent_29  dispsent_30  dispsent_31  dispsent_32  dispsent_33  dispsent_34  dispsent_35  dispsent_36  dispsent_37  dispsent_38  dispsent_39  dispsent_40  dispsent_41  dispsent_42  dispsent_43  dispsent_44  dispsent_45  dispsent_46  dispsent_47  dispsent_48  dispsent_49  dispsent_50  dispsent_51  dispsent_52  dispsent_53  dispsent_54  dispsent_55  dispsent_56  dispsent_57  dispsent_58  dispsent_59  dispsent_60  dispsent_61  dispsent_62  dispsent_63  dispsent_64  dispsent_65  dispsent_66  dispsent_67  dispsent_68  dispsent_69  dispsent_70  dispsent_71  dispsent_72  dispsent_73  dispsent_74  dispsent_75  dispsent_76  dispsent_77  dispsent_78  dispsent_79  dispsent_80  dispsent_81  dispsent_82  dispsent_83  dispsent_84  dispsent_85  dispsent_86  dispsent_87  dispsent_88  dispsent_89  dispsent_90  dispsent_91  dispsent_92  dispsent_93  dispsent_94  dispsent_95  dispsent_96  dispsent_97  dispsent_98  dispsent_99  dispsent_100  dispsent_101  dispsent_102  dispsent_103  dispsent_104  dispsent_105  dispsent_106  dispsent_107  dispsent_108  dispsent_109  dispsent_110  dispsent_111  dispsent_112  dispsent_113  dispsent_114  dispsent_115  dispsent_116  dispsent_117  dispsent_118  dispsent_119  dispsent_120  dispsent_121  dispsent_123  dispsent_124  dispsent_125  dispsent_126  dispsent_127  dispsent_128  dispsent_129  dispsent_130  dispsent_131  dispsent_132  dispsent_133  dispsent_134  dispsent_135  dispsent_136  dispsent_137  dispsent_138  dispsent_139  dispsent_140  dispsent_141  dispsent_142  dispsent_143  dispsent_144  dispsent_145  dispsent_146  dispsent_147  dispsent_148  dispsent_149  dispsent_150  dispsent_151  dispsent_152  dispsent_153  dispsent_154  dispsent_155  dispsent_156  dispsent_157  dispsent_158  dispsent_159  dispsent_160  dispsent_161  dispsent_162  dispsent_163  dispsent_164  dispsent_165  dispsent_166  dispsent_167  dispsent_168  dispsent_169  dispsent_170  dispsent_171  dispsent_172  dispsent_173  dispsent_174  dispsent_175  dispsent_176  dispsent_177  dispsent_178  dispsent_179  dispsent_180  dispsent_181  dispsent_182  dispsent_183  dispsent_184  dispsent_185  dispsent_186  dispsent_187  dispsent_188  dispsent_189  dispsent_190  dispsent_191  dispsent_192  dispsent_193  dispsent_194  dispsent_195  dispsent_196  dispsent_197  dispsent_198  dispsent_199  dispsent_200  dispsent_201  dispsent_202  dispsent_203  dispsent_204  dispsent_205  dispsent_206  dispsent_207 dispsent_1_1  dispsent_1_2  dispsent_1_3  dispsent_1_4  dispsent_1_5  dispsent_1_6  dispsent_1_7  dispsent_1_8  dispsent_1_9  dispsent_1_10  dispsent_1_11  dispsent_1_12  dispsent_1_13  dispsent_1_14  dispsent_1_15  dispsent_1_16  dispsent_1_17  dispsent_1_18  dispsent_1_19  dispsent_1_20  dispsent_1_21  dispsent_1_22  dispsent_1_23  dispsent_1_24  dispsent_1_25  dispsent_1_26  dispsent_1_27  dispsent_1_28  dispsent_1_29  dispsent_1_30  dispsent_1_31  dispsent_1_32  dispsent_1_33  dispsent_1_34  dispsent_1_35  dispsent_1_36  dispsent_1_37  dispsent_1_38  dispsent_1_39  dispsent_1_40  dispsent_1_41  dispsent_1_42  dispsent_1_43  dispsent_1_44  dispsent_1_45  dispsent_1_46  dispsent_1_47  dispsent_1_48  dispsent_1_49  dispsent_1_50  dispsent_1_51  dispsent_1_52  dispsent_1_53  dispsent_1_54  dispsent_1_55  dispsent_1_56  dispsent_1_57  dispsent_1_58  dispsent_1_59  dispsent_1_60  dispsent_1_61  dispsent_1_62  dispsent_1_63  dispsent_1_64  dispsent_1_65  dispsent_1_66  dispsent_1_67  dispsent_1_68  dispsent_1_69  dispsent_1_70  dispsent_1_71  dispsent_1_72  dispsent_1_73  dispsent_1_74  dispsent_1_75  dispsent_1_76  dispsent_1_77  dispsent_1_78  dispsent_1_79  dispsent_1_80  dispsent_1_81  dispsent_1_82  dispsent_1_83  dispsent_1_84  dispsent_1_85  dispsent_1_86  dispsent_1_87  dispsent_1_88  dispsent_1_89  dispsent_1_90  dispsent_1_91  dispsent_1_92  dispsent_1_93  dispsent_1_94  dispsent_1_95  dispsent_1_96  dispsent_1_97  dispsent_1_98  dispsent_1_99  dispsent_1_100  dispsent_1_101  dispsent_1_102  dispsent_1_103  dispsent_1_104  dispsent_1_105  dispsent_1_106  dispsent_1_107  dispsent_1_108  dispsent_1_109  dispsent_1_110  dispsent_1_111  dispsent_1_112  dispsent_1_113  dispsent_1_114  dispsent_1_115  dispsent_1_116  dispsent_1_117  dispsent_1_118  dispsent_1_119  dispsent_1_120  dispsent_1_121  dispsent_1_123  dispsent_1_124  dispsent_1_125  dispsent_1_126  dispsent_1_127  dispsent_1_128  dispsent_1_129  dispsent_1_130  dispsent_1_131  dispsent_1_132  dispsent_1_133  dispsent_1_134  dispsent_1_135  dispsent_1_136  dispsent_1_137  dispsent_1_138  dispsent_1_139  dispsent_1_140  dispsent_1_141  dispsent_1_142  dispsent_1_143  dispsent_1_144  dispsent_1_145  dispsent_1_146  dispsent_1_147  dispsent_1_148  dispsent_1_149  dispsent_1_150  dispsent_1_151  dispsent_1_152  dispsent_1_153  dispsent_1_154  dispsent_1_155  dispsent_1_156  dispsent_1_157  dispsent_1_158  dispsent_1_159  dispsent_1_160  dispsent_1_161  dispsent_1_162  dispsent_1_163  dispsent_1_164  dispsent_1_165  dispsent_1_166  dispsent_1_167  dispsent_1_168  dispsent_1_169  dispsent_1_170  dispsent_1_171  dispsent_1_172  dispsent_1_173  dispsent_1_174  dispsent_1_175  dispsent_1_176  dispsent_1_177  dispsent_1_178  dispsent_1_179  dispsent_1_180  dispsent_1_181  dispsent_1_182  dispsent_1_183  dispsent_1_184  dispsent_1_185  dispsent_1_186  dispsent_1_187  dispsent_1_188  dispsent_1_189  dispsent_1_190  dispsent_1_191  dispsent_1_192  dispsent_1_193  dispsent_1_194  dispsent_1_195  dispsent_1_196  dispsent_1_197  dispsent_1_198  dispsent_1_199  dispsent_1_200  dispsent_1_201  dispsent_1_202  dispsent_1_203  dispsent_1_204  dispsent_1_205  dispsent_1_206  dispsent_1_207
.byte \dispsent_1
.byte \dispsent_2
.byte \dispsent_3
.byte \dispsent_4
.byte \dispsent_5
.byte \dispsent_6
.byte \dispsent_7
.byte \dispsent_8
.byte \dispsent_9
.byte \dispsent_10
.byte \dispsent_11
.byte \dispsent_12
.byte \dispsent_13
.byte \dispsent_14
.byte \dispsent_15
.byte \dispsent_16
.byte \dispsent_17
.byte \dispsent_18
.byte \dispsent_19
.byte \dispsent_20
.byte \dispsent_21
.byte \dispsent_22
.byte \dispsent_23
.byte \dispsent_24
.byte \dispsent_25
.byte \dispsent_26
.byte \dispsent_27
.byte \dispsent_28
.byte \dispsent_29
.byte \dispsent_30
.byte \dispsent_31
.byte \dispsent_32
.byte \dispsent_33
.byte \dispsent_34
.byte \dispsent_35
.byte \dispsent_36
.byte \dispsent_37
.byte \dispsent_38
.byte \dispsent_39
.byte \dispsent_40
.byte \dispsent_41
.byte \dispsent_42
.byte \dispsent_43
.byte \dispsent_44
.byte \dispsent_45
.byte \dispsent_46
.byte \dispsent_47
.byte \dispsent_48
.byte \dispsent_49
.byte \dispsent_50
.byte \dispsent_51
.byte \dispsent_52
.byte \dispsent_53
.byte \dispsent_54
.byte \dispsent_55
.byte \dispsent_56
.byte \dispsent_57
.byte \dispsent_58
.byte \dispsent_59
.byte \dispsent_60
.byte \dispsent_61
.byte \dispsent_62
.byte \dispsent_63
.byte \dispsent_64
.byte \dispsent_65
.byte \dispsent_66
.byte \dispsent_67
.byte \dispsent_68
.byte \dispsent_69
.byte \dispsent_70
.byte \dispsent_71
.byte \dispsent_72
.byte \dispsent_73
.byte \dispsent_74
.byte \dispsent_75
.byte \dispsent_76
.byte \dispsent_77
.byte \dispsent_78
.byte \dispsent_79
.byte \dispsent_80
.byte \dispsent_81
.byte \dispsent_82
.byte \dispsent_83
.byte \dispsent_84
.byte \dispsent_85
.byte \dispsent_86
.byte \dispsent_87
.byte \dispsent_88
.byte \dispsent_89
.byte \dispsent_90
.byte \dispsent_91
.byte \dispsent_92
.byte \dispsent_93
.byte \dispsent_94
.byte \dispsent_95
.byte \dispsent_96
.byte \dispsent_97
.byte \dispsent_98
.byte \dispsent_99
.byte \dispsent_100
.byte \dispsent_101
.byte \dispsent_102
.byte \dispsent_103
.byte \dispsent_104
.byte \dispsent_105
.byte \dispsent_106
.byte \dispsent_107
.byte \dispsent_108
.byte \dispsent_109
.byte \dispsent_110
.byte \dispsent_111
.byte \dispsent_112
.byte \dispsent_113
.byte \dispsent_114
.byte \dispsent_115
.byte \dispsent_116
.byte \dispsent_117
.byte \dispsent_118
.byte \dispsent_119
.byte \dispsent_120
.byte \dispsent_121
.byte \dispsent_123
.byte \dispsent_124
.byte \dispsent_125
.byte \dispsent_126
.byte \dispsent_127
.byte \dispsent_128
.byte \dispsent_129
.byte \dispsent_130
.byte \dispsent_131
.byte \dispsent_132
.byte \dispsent_133
.byte \dispsent_134
.byte \dispsent_135
.byte \dispsent_136
.byte \dispsent_137
.byte \dispsent_138
.byte \dispsent_139
.byte \dispsent_140
.byte \dispsent_141
.byte \dispsent_142
.byte \dispsent_143
.byte \dispsent_144
.byte \dispsent_145
.byte \dispsent_146
.byte \dispsent_147
.byte \dispsent_148
.byte \dispsent_149
.byte \dispsent_150
.byte \dispsent_151
.byte \dispsent_152
.byte \dispsent_153
.byte \dispsent_154
.byte \dispsent_155
.byte \dispsent_156
.byte \dispsent_157
.byte \dispsent_158
.byte \dispsent_159
.byte \dispsent_160
.byte \dispsent_161
.byte \dispsent_162
.byte \dispsent_163
.byte \dispsent_164
.byte \dispsent_165
.byte \dispsent_166
.byte \dispsent_167
.byte \dispsent_168
.byte \dispsent_169
.byte \dispsent_170
.byte \dispsent_171
.byte \dispsent_172
.byte \dispsent_173
.byte \dispsent_174
.byte \dispsent_175
.byte \dispsent_176
.byte \dispsent_177
.byte \dispsent_178
.byte \dispsent_179
.byte \dispsent_180
.byte \dispsent_181
.byte \dispsent_182
.byte \dispsent_183
.byte \dispsent_184
.byte \dispsent_185
.byte \dispsent_186
.byte \dispsent_187
.byte \dispsent_188
.byte \dispsent_189
.byte \dispsent_190
.byte \dispsent_191
.byte \dispsent_192
.byte \dispsent_193
.byte \dispsent_194
.byte \dispsent_195
.byte \dispsent_196
.byte \dispsent_197
.byte \dispsent_198
.byte \dispsent_199
.byte \dispsent_200
.byte \dispsent_201
.byte \dispsent_202
.byte \dispsent_203
.byte \dispsent_204
.byte \dispsent_205
.byte \dispsent_206
.byte \dispsent_207
.byte \dispsent_1_1
.byte \dispsent_1_2
.byte \dispsent_1_3
.byte \dispsent_1_4
.byte \dispsent_1_5
.byte \dispsent_1_6
.byte \dispsent_1_7
.byte \dispsent_1_8
.byte \dispsent_1_9
.byte \dispsent_1_10
.byte \dispsent_1_11
.byte \dispsent_1_12
.byte \dispsent_1_13
.byte \dispsent_1_14
.byte \dispsent_1_15
.byte \dispsent_1_16
.byte \dispsent_1_17
.byte \dispsent_1_18
.byte \dispsent_1_19
.byte \dispsent_1_20
.byte \dispsent_1_21
.byte \dispsent_1_22
.byte \dispsent_1_23
.byte \dispsent_1_24
.byte \dispsent_1_25
.byte \dispsent_1_26
.byte \dispsent_1_27
.byte \dispsent_1_28
.byte \dispsent_1_29
.byte \dispsent_1_30
.byte \dispsent_1_31
.byte \dispsent_1_32
.byte \dispsent_1_33
.byte \dispsent_1_34
.byte \dispsent_1_35
.byte \dispsent_1_36
.byte \dispsent_1_37
.byte \dispsent_1_38
.byte \dispsent_1_39
.byte \dispsent_1_40
.byte \dispsent_1_41
.byte \dispsent_1_42
.byte \dispsent_1_43
.byte \dispsent_1_44
.byte \dispsent_1_45
.byte \dispsent_1_46
.byte \dispsent_1_47
.byte \dispsent_1_48
.byte \dispsent_1_49
.byte \dispsent_1_50
.byte \dispsent_1_51
.byte \dispsent_1_52
.byte \dispsent_1_53
.byte \dispsent_1_54
.byte \dispsent_1_55
.byte \dispsent_1_56
.byte \dispsent_1_57
.byte \dispsent_1_58
.byte \dispsent_1_59
.byte \dispsent_1_60
.byte \dispsent_1_61
.byte \dispsent_1_62
.byte \dispsent_1_63
.byte \dispsent_1_64
.byte \dispsent_1_65
.byte \dispsent_1_66
.byte \dispsent_1_67
.byte \dispsent_1_68
.byte \dispsent_1_69
.byte \dispsent_1_70
.byte \dispsent_1_71
.byte \dispsent_1_72
.byte \dispsent_1_73
.byte \dispsent_1_74
.byte \dispsent_1_75
.byte \dispsent_1_76
.byte \dispsent_1_77
.byte \dispsent_1_78
.byte \dispsent_1_79
.byte \dispsent_1_80
.byte \dispsent_1_81
.byte \dispsent_1_82
.byte \dispsent_1_83
.byte \dispsent_1_84
.byte \dispsent_1_85
.byte \dispsent_1_86
.byte \dispsent_1_87
.byte \dispsent_1_88
.byte \dispsent_1_89
.byte \dispsent_1_90
.byte \dispsent_1_91
.byte \dispsent_1_92
.byte \dispsent_1_93
.byte \dispsent_1_94
.byte \dispsent_1_95
.byte \dispsent_1_96
.byte \dispsent_1_97
.byte \dispsent_1_98
.byte \dispsent_1_99
.byte \dispsent_1_100
.byte \dispsent_1_101
.byte \dispsent_1_102
.byte \dispsent_1_103
.byte \dispsent_1_104
.byte \dispsent_1_105
.byte \dispsent_1_106
.byte \dispsent_1_107
.byte \dispsent_1_108
.byte \dispsent_1_109
.byte \dispsent_1_110
.byte \dispsent_1_111
.byte \dispsent_1_112
.byte \dispsent_1_113
.byte \dispsent_1_114
.byte \dispsent_1_115
.byte \dispsent_1_116
.byte \dispsent_1_117
.byte \dispsent_1_118
.byte \dispsent_1_119
.byte \dispsent_1_120
.byte \dispsent_1_121
.byte \dispsent_1_123
.byte \dispsent_1_124
.byte \dispsent_1_125
.byte \dispsent_1_126
.byte \dispsent_1_127
.byte \dispsent_1_128
.byte \dispsent_1_129
.byte \dispsent_1_130
.byte \dispsent_1_131
.byte \dispsent_1_132
.byte \dispsent_1_133
.byte \dispsent_1_134
.byte \dispsent_1_135
.byte \dispsent_1_136
.byte \dispsent_1_137
.byte \dispsent_1_138
.byte \dispsent_1_139
.byte \dispsent_1_140
.byte \dispsent_1_141
.byte \dispsent_1_142
.byte \dispsent_1_143
.byte \dispsent_1_144
.byte \dispsent_1_145
.byte \dispsent_1_146
.byte \dispsent_1_147
.byte \dispsent_1_148
.byte \dispsent_1_149
.byte \dispsent_1_150
.byte \dispsent_1_151
.byte \dispsent_1_152
.byte \dispsent_1_153
.byte \dispsent_1_154
.byte \dispsent_1_155
.byte \dispsent_1_156
.byte \dispsent_1_157
.byte \dispsent_1_158
.byte \dispsent_1_159
.byte \dispsent_1_160
.byte \dispsent_1_161
.byte \dispsent_1_162
.byte \dispsent_1_163
.byte \dispsent_1_164
.byte \dispsent_1_165
.byte \dispsent_1_166
.byte \dispsent_1_167
.byte \dispsent_1_168
.byte \dispsent_1_169
.byte \dispsent_1_170
.byte \dispsent_1_171
.byte \dispsent_1_172
.byte \dispsent_1_173
.byte \dispsent_1_174
.byte \dispsent_1_175
.byte \dispsent_1_176
.byte \dispsent_1_177
.byte \dispsent_1_178
.byte \dispsent_1_179
.byte \dispsent_1_180
.byte \dispsent_1_181
.byte \dispsent_1_182
.byte \dispsent_1_183
.byte \dispsent_1_184
.byte \dispsent_1_185
.byte \dispsent_1_186
.byte \dispsent_1_187
.byte \dispsent_1_188
.byte \dispsent_1_189
.byte \dispsent_1_190
.byte \dispsent_1_191
.byte \dispsent_1_192
.byte \dispsent_1_193
.byte \dispsent_1_194
.byte \dispsent_1_195
.byte \dispsent_1_196
.byte \dispsent_1_197
.byte \dispsent_1_198
.byte \dispsent_1_199
.byte \dispsent_1_200
.byte \dispsent_1_201
.byte \dispsent_1_202
.byte \dispsent_1_203
.byte \dispsent_1_204
.byte \dispsent_1_205
.byte \dispsent_1_206
.byte \dispsent_1_207
.endm

DizzyEgg

Age 21
Male
Poland
Seen 12 Hours Ago
Posted 1 Week Ago
783 posts
5.6 Years
Foul Play
Spoiler:
Thanks to kleenexfeu, I was able to write a routine for Foul Play. There may be errors, so if you find one, please inform me!

Asm Routine:
Spoiler:

.text
.align 2
.thumb
.thumb_func

main:
push {r0-r4, lr}

Get_Attack:
ldr r0, UserBank
ldrb r0, [r0]
mov r1, #0x58
mul r1, r0, r1
ldr r0, battle_struct
add r0, r0, r1 @r0 = user data
ldrh r1, [r0, #0x2] @r1 = user attack

ldr r2, TargetBank
ldrb r2, [r2]
mov r3, #0x58
mul r3, r2, r3
ldr r2, battle_struct
add r2, r2, r3 @r2 = target data
ldrh r3, [r2, #0x2] @r3 = target attack

Huge_Power_Check:
mov r4, #0x20
add r4, r2, r4
ldrb r4, [r4]
cmp r4, #0x25
beq double
cmp r4, #0x4A
beq double
b Swap_Attack

double:
lsl r3, r3, #1
lsr r1, r1, #1

Swap_Attack:
strh r1, [r2, #0x2]
strh r3, [r0, #0x2]

Get_Modifier:
ldr r0, UserBank
ldrb r0, [r0]
mov r1, #0x58
mul r1, r0, r1
ldr r0, battle_struct
add r0, r0, r1
add r0, r0, #0x19 @r0 = user modifier offset
ldrb r1, [r0] @r1 = user modifier

ldr r2, TargetBank
ldrb r2, [r2]
mov r3, #0x58
mul r3, r2, r3
ldr r2, battle_struct
add r2, r2, r3
add r2, r2, #0x19 @r2 = target modifier offset
ldrb r3, [r2] @r3 = target modifier

Swap_Modifier:
strb r1, [r2]
strb r3, [r0]
pop {r0-r4, pc}

.align 2

battle_struct: .word 0x02023BE4
UserBank: .word 0x02023D6B
TargetBank: .word 0x02023D6C


And Move Effect
Spoiler:

#dynamic 0xoffset

#org @start
jumpifhalfword 0x1 0x2023D4A 0x39 @move
jumpifspecialstatusflag 0x0 0x40000 0x1 @move
orword 0x2023DD0 0x40000
setbyte 0x2023FD2 0x2

#org @move
attackcanceler
accuracycheck 0x81D695E 0x0
attackstring
ppreduce
callasm 0x8offset+1
calculatedamage
callasm 0x8offset+1
attackanimation
waitanimation
missmessage
cmd5c 0x0
waitstate
graphicalhpupdate 0x0
datahpupdate 0x0
critmessage
waitmessage 0x40
resultmessage
waitmessage 0x40
seteffectwithchancetarget
faintpokemon 0x0 0x0 0x8000000
setbyte 0x2023FD8 0x0
cmd49 0x0 0x0
end


Entrainment
Spoiler:
ASM
Spoiler:

.text
.align 2
.thumb
.thumb_func

main:
push {r0-r4, lr}

Get_Ability:
ldr r0, UserBank
ldrb r0, [r0]
mov r1, #0x58
mul r1, r0, r1
ldr r0, battle_struct
add r0, r0, r1 @r0 = user data
add r0, r0, #0x20
ldrb r1, [r0] @r1 = ability

Change_Ability:
ldr r0, TargetBank
ldrb r0, [r0]
mov r2, #0x58
mul r2, r0, r2
ldr r0, battle_struct
add r0, r0, r2 @r0 = target data
add r0, r0, #0x20
strb r1, [r0]

Switch_in_Abilities:
mov r0, #0
mov r2, #0
mov r3, #0
ldr r1, TargetBank
ldrb r1, [r1]
ldr r4, =(0x08019F19)
bl call
cmp r0, #0
beq end
ldr r0, CurrentScript
ldr r1, [r0]
sub r1, #5
str r1, [r0]
b end

call:
bx r4

end:
pop {r0-r4, pc}

.align 2
.pool
battle_struct: .word 0x02023BE4
UserBank: .word 0x02023D6B
TargetBank: .word 0x02023D6C
CurrentScript: .word 0x02023d74


Battle String

Spoiler:

FD 10 00 D5 D7 E5 E9 DD E6 D9 D8 00 FD 18 AD FF


Battle Script
I suggest changing the 178 move effect's pointer to this script. I used RolePlay's index since those two moves are very similar and hopefully AI will know how to use it. Jambo's Battle String Hack Loader is required.
(If you don't have those abilities or their indices differ, feel free to edit bolded part of code accordingly)
Spoiler:

#dynamic 0xoffset

#org @start
jumpifhalfword 0x0 0x2023D4A 0xID_OF_ENTRAINMENT @entrainment
goto 0x81D8126 //RolePlay script

#org @entrainment
attackcanceler
attackstring
ppreduce
accuracycheck 0x81D7DF2 0xFFFF
jumpifability 0x0 0x36 0x81D7DF2 //truant
jumpifability 0x0 0x24 0x81D7DF2 //trace
jumpifability 0x0 0x79 0x81D7DF2 //multitype
jumpifability 0x0 0x7A 0x81D7DF2 //flower gift
jumpifability 0x0 0x96 0x81D7DF2 //imposter
jumpifability 0x0 0xA1 0x81D7DF2 //zen mode
jumpifability 0x0 0xB0 0x81D7DF2 //stance chance

attackanimation
waitanimation
setword 0x0203C020 0x8offset_of_battlestring (don't +1)
printstring 0x184
waitmessage 0x40
callasm 0x8offset_of_asmroutine+1
goto 0x81D694E


Reflect Type

Spoiler:
ASM
Spoiler:
.text
.align 2
.thumb
.thumb_func

main:
push {r0-r3, lr}
ldr r0, TargetBank
ldrb r0, [r0]
mov r1, #0x58
mul r1, r1, r0
ldr r0, battle_struct
add r0, r0, r1
add r0, r0, #0x21 @first type
ldrb r1, [r0] @r1 = enemy's first type
ldrb r0, [r0, #0x1] @r0 = enemy's second type

Change_Types:
ldr r2, UserBank
ldrb r2, [r2]
mov r3, #0x58
mul r3, r3, r2
ldr r2, battle_struct
add r2, r2, r3
add r2, r2, #0x21
strb r1, [r2] @user's first type
strb r0, [r2, #0x1] @user's second type
pop {r0-r3, pc}

.align 2

battle_struct: .word 0x02023BE4
UserBank: .word 0x02023D6B
TargetBank: .word 0x02023D6C


Battle String
Spoiler:
FD 0F B4 E7 00 E8 ED E4 D9 00 D7 DC D5 E2 DB D9 D8 FE E8 E3 00 E1 D5 E8 D7 DC 00 FD 10 B4 E7 AB FF


Battle Script (I used Conversion's effect since they're similar moves, number is 30)
Spoiler:
#dynamic 0xoffset

#org @start
jumpifhalfword 0x0 0x2023D4A 0xID_OF_REFLECT_TYPE @refl
goto 0x81D6D9D //Conversion script

#org @refl
attackcanceler
attackstring
ppreduce
jumpifability 0x1 0x79 0x81D7DF2 //multitype
callasm 0x8offset+1
attackanimation
waitanimation
setword 0x0203C020 0x8offset(don't+1)
printstring 0x184
waitmessage 0x40
goto 0x81D694E


Seed Flare

Spoiler:
Battle Script

Spoiler:
#dynamic 0xOffset

#org @before
setbyte 0x02023E85 0x32
jumpifhalfword 0x1 0x2023D4A 0x39 @move
jumpifspecialstatusflag 0x0 0x40000 0x1 @move
orword 0x2023DD0 0x40000
setbyte 0x2023FD2 0x2

#org @move
attackcanceler
accuracycheck 0x81D695E 0x0
attackstring
ppreduce
calculatedamage
attackanimation
waitanimation
missmessage
cmd5c 0x0
waitstate
graphicalhpupdate 0x0
datahpupdate 0x0
critmessage
waitmessage 0x40
resultmessage
waitmessage 0x40
seteffectwithchancetarget
faintpokemon 0x0 0x0 0x8000000
setbyte 0x2023FD8 0x0
cmd49 0x0 0x0
end


Also, all moves are for FR. Though, porting them to Emerald should be a matter of changing locations in ASM routines.

Chacha Dinosaur

Adamant and adaptive dinosaur.

Age 24
Male
Seen March 4th, 2018
Posted September 8th, 2017
454 posts
6.1 Years
stuffs
In Foul Play, there is no need for Huge Power handling. It does not considers the target's Huge Power at all.

Also, this:
#org @start
jumpifhalfword 0x1 0x2023D4A 0x39 @move
jumpifspecialstatusflag 0x0 0x40000 0x1 @move
orword 0x2023DD0 0x40000
setbyte 0x2023FD2 0x2
is unnecessary. This is the code for Surf hitting a diving target for double damage. In fact all instances of x1D6900 in the Battle Scripts Region should replaced with x1D6926 (except the first entry of the Move Effect table if you are not using the new Surf Battle Script).

Here is the new Surf done using an ASM file for easier insertion. Also corrects Boomburst vs Soundproof.
Surf, Boomburst, Petal Blizzard, Parabolic Charge, Discharge, Sludge Wave, Lava Plume, Bulldoze
Spoiler:

Fire Red:-
Spoiler:


Replace all instances of x1d6900 with x1D6926 in the BS Region.
To determine the address for keywords for new absorb abilities like LightningRodEnd, use the address of the last goto statement (in the Lightning Rod Battle Script) + 1.

.thumb
.thumb_func
.global multitargetmoves

.equ Myloc, 0xE00700   @Location of non hooking resource area (Main routines plus Battle Scripts and Strings).
.equ YourWordLocation, 0x203C020  @RAM Area used for Battle String Loader Hack
.equ MoveEffectTable, 0x1d65A8
.equ MoveTable, 0x8250C04

@@ Move IDs 
.equ BoomburstID, 0x24A
.equ PetalBlizzardID, 0x23C
.equ ParaChargeID, 0x23A
.equ SurfID, 0x39
.equ LavaPlumeID, 0x1B4
.equ BulldozeID, 0x20B
.equ DischargeID, 0x1B3
.equ SludgeWaveID, 0x1E2
.equ SearingShotID, 0x221

@@Move Effect Script Pointers to be Replaced.
@@ Change these if you have changed the script pointers, for example if have used something like Flame Charge with LowFoeSpeedBS
.equ StdSingleTgtDmgBS, 0x81D6926  @Effect 0
.equ StdSingleTgtDmgPrlzBS, 0x81d6A6B@Effect 6
.equ StdSingleTgtDmgBrnBS, 0x81D6A55@Effect 4
.equ StdSingleTgtDmgPsnBS, 0x81D69DC@Effect 2
.equ StdSingleTgtDmgLowFoeSpeedBS, 0x81D7275@Effect 70
.equ StdSingleTgtDmgDrainBS, 0x81D69E7@Effect 3

@@ Ram Locations
.equ CurrMove, 0x2023D4A
.equ HitMarker, 0x2023DD0
.equ DamageMultiplier, 0x02023FD2
.equ ScriptPointer, 0x2023D74
.equ Cmd49TableCounter, 0x2023FD8
.equ AppliedEffectByte, 0x2023E85


@@Keywords
.equ CancelerCheckSkip, 0x200
.equ ObedienceCheckSkip, 0x2000000
.equ DivingState, 0x40000
.equ OverrideDiveEvasion, 0x40000
.equ BurnEffect, 0x3
.equ ParalysisEffect, 0x5
.equ PoisonEffect, 0x2
.equ LowFoeSpeedEffect, 0x18

@@ Compare operands
.equ Equals, 0x0
.equ NotEquals, 0x1
.equ LessThan, 0x2
.equ GreaterThan, 0x3
.equ Anded, 0x4

@@ Banks
.equ BANK_USER, 0x1
.equ BANK_TARGET, 0x0

@@ Delay
.equ DELAY_HALFSECOND, 0x20
.equ DELAY_1SECOND, 0x40

@@ Index commands
.equ calculatedamage, 0x7060504
.equ attackcanceler, 0x0
.equ accuracycheck, 0x1
.equ attackstring, 0x2
.equ ppreduce, 0x3
.equ critcalc, 0x4
.equ cmd5, 0x5
.equ cmd6, 0x6
.equ cmd7, 0x7
.equ cmd8, 0x8
.equ attackanimation, 0x9
.equ waitanimation, 0xA
.equ graphicalhpupdate, 0xB
.equ datahpupdate, 0xC
.equ critmessage, 0xD
.equ missmessage, 0xE
.equ resultmessage, 0xF
.equ printstring, 0x10
.equ printstring2, 0x11
.equ waitmessage, 0x12
.equ printfromtable, 0x13
.equ printfromtable2, 0x14
.equ seteffectwithchancetarget, 0x15
.equ seteffecttarget, 0x16
.equ seteffectuser, 0x17
.equ clearstatus, 0x18
.equ faintpokemon, 0x19
.equ cmd1a, 0x1A
.equ cmd1b, 0x1B
.equ jumpifstatus, 0x1C
.equ jumpifsecondarystatus, 0x1D
.equ jumpifability, 0x1E
.equ jumpifhalverset, 0x1F
.equ jumpifstat, 0x20
.equ jumpifspecialstatusflag, 0x21
.equ jumpiftype, 0x22
.equ cmd23, 0x23
.equ gotoandsomething, 0x24
.equ cmd25, 0x25
.equ cmd26, 0x26
.equ cmd27, 0x27
.equ goto, 0x28
.equ jumpifbyte, 0x29
.equ jumpifhalfword, 0x2A
.equ jumpifword, 0x2B
.equ jumpifarrayequal, 0x2C
.equ jumpifarraynotequal, 0x2D
.equ setbyte, 0x2E
.equ addbyte, 0x2F
.equ subtractbyte, 0x30
.equ copyarray, 0x31
.equ cmd32, 0x32
.equ orbyte, 0x33
.equ orhalfword, 0x34
.equ orword, 0x35
.equ bicbyte, 0x36
.equ bichalfword, 0x37
.equ bicword, 0x38
.equ pause, 0x39
.equ waitstate, 0x3A
.equ somethinghealcmd3b, 0x3B
.equ return, 0x3C
.equ end, 0x3D
.equ end2, 0x3E
.equ end3, 0x3F
.equ cmd40, 0x40
.equ call, 0x41
.equ jumpiftype2, 0x42
.equ jumpifabilitypresent, 0x43
.equ cmd44, 0x44
.equ playanimation, 0x45
.equ cmd46, 0x46
.equ cmd47, 0x47
.equ playstatchangeanimation, 0x48
.equ cmd49, 0x49
.equ damagecalc2, 0x4A
.equ cmd4b, 0x4B
.equ switch1, 0x4C
.equ switch2, 0x4D
.equ switch3, 0x4E
.equ jumpifcannotswitch, 0x4F
.equ openpartyscreen, 0x50
.equ cmd51, 0x51
.equ cmd52, 0x52
.equ cmd53, 0x53
.equ cmd54, 0x54
.equ cmd55, 0x55
.equ cmd56, 0x56
.equ cmd57, 0x57
.equ cmd58, 0x58
.equ checkiflearnmoveinbattle, 0x59
.equ cmd5a, 0x5A
.equ cmd5b, 0x5B
.equ cmd5c, 0x5C
.equ cmd5d, 0x5D
.equ cmd5e, 0x5E
.equ cmd5f, 0x5F
.equ cmd60, 0x60
.equ cmd61, 0x61
.equ cmd62, 0x62
.equ jumptoattack, 0x63
.equ statusanimation, 0x64
.equ cmd65, 0x65
.equ cmd66, 0x66
.equ cmd67, 0x67
.equ cmd68, 0x68
.equ cmd69, 0x69
.equ removeitem, 0x6A
.equ cmd6b, 0x6B
.equ cmd6c, 0x6C
.equ cmd6d, 0x6D
.equ cmd6e, 0x6E
.equ cmd6f, 0x6F
.equ cmd70, 0x70
.equ cmd71, 0x71
.equ somethingwithhelditem, 0x72
.equ cmd73, 0x73
.equ cmd74, 0x74
.equ cmd75, 0x75
.equ cmd76, 0x76
.equ setprotect, 0x77
.equ faintifabilitynotdamp, 0x78
.equ setuserhptozero, 0x79
.equ jumpwhiletargetvalid, 0x7A
.equ setdamageasrestorehalfmaxhp, 0x7B
.equ jumptolastusedattack, 0x7C
.equ setrain, 0x7D
.equ setreflect, 0x7E
.equ setleechseed, 0x7F
.equ manipulatedamage, 0x80
.equ setrest, 0x81
.equ jumpifnotfirstturn, 0x82
.equ nop3, 0x83
.equ jumpifcannotsleep, 0x84
.equ stockpile, 0x85
.equ stockpiletobasedamage, 0x86
.equ stockpiletohprecovery, 0x87
.equ negativedamage, 0x88
.equ statbuffchange, 0x89
.equ normalisebuffs, 0x8A
.equ setbide, 0x8B
.equ confuseifrepeatingattackends, 0x8C
.equ setloopcounter, 0x8D
.equ cmd8e, 0x8E
.equ forcerandomswitch, 0x8F
.equ changetypestoenemyattacktype, 0x90
.equ givemoney, 0x91
.equ setlightscreen, 0x92
.equ koplussomethings, 0x93
.equ gethalfcurrentenemyhp, 0x94
.equ setsandstorm, 0x95
.equ weatherdamage, 0x96
.equ tryinfatuatetarget, 0x97
.equ cmd98, 0x98
.equ setmisteffect, 0x99
.equ setincreasedcriticalchance, 0x9A
.equ transformdataexecution, 0x9B
.equ setsubstituteeffect, 0x9C
.equ copyattack, 0x9D
.equ metronomeeffect, 0x9E
.equ nightshadedamageeffect, 0x9F
.equ psywavedamageeffect, 0xA0
.equ counterdamagecalculator, 0xA1
.equ mirrorcoatdamagecalculator, 0xA2
.equ disablelastusedattack, 0xA3
.equ setencore, 0xA4
.equ painsplitdamagecalculator, 0xA5
.equ settypetorandomresistance, 0xA6
.equ setalwaymukflag, 0xA7
.equ copymovepermanently, 0xA8
.equ selectrandommovefromusermoves, 0xA9
.equ destinybondeffect, 0xAA
.equ cmdab, 0xAB
.equ remaininghptopower, 0xAC
.equ reducepprandom, 0xAD
.equ clearstatusifnotsoundproofed, 0xAE
.equ cursetarget, 0xAF
.equ setspikes, 0xB0
.equ setforesight, 0xB1
.equ setperishsong, 0xB2
.equ rolloutdamagecalculation, 0xB3
.equ jumpifconfusedandattackmaxed, 0xB4
.equ furycutterdamagecalculation, 0xB5
.equ happinesstodamagecalculation, 0xB6
.equ presentdamagecalculation, 0xB7
.equ setsafeguard, 0xB8
.equ magnitudedamagecalculation, 0xB9
.equ cmdba, 0xBA
.equ setsunny, 0xBB
.equ maxattackhalvehp, 0xBC
.equ copyfoestats, 0xBD
.equ breakfree, 0xBE
.equ setcurled, 0xBF
.equ recoverbasedonsunlight, 0xC0
.equ hiddenpowerdamagecalculation, 0xC1
.equ selectnexttarget, 0xC2
.equ setfutureattack, 0xC3
.equ beatupcalculation, 0xC4
.equ hidepreattack, 0xC5
.equ unhidepostattack, 0xC6
.equ setminimize, 0xC7
.equ sethail, 0xC8
.equ jumpifattackandspecialattackcannotfall, 0xC9
.equ setforcedtarget, 0xCA
.equ setcharge, 0xCB
.equ callterrainattack, 0xCC
.equ cureifburnedparalysedorpoisoned, 0xCD
.equ settorment, 0xCE
.equ jumpifnodamage, 0xCF
.equ settaunt, 0xD0
.equ sethelpinghand, 0xD1
.equ itemswap, 0xD2
.equ copyability, 0xD3
.equ cmdd4, 0xD4
.equ setroots, 0xD5
.equ doubledamagedealtifdamaged, 0xD6
.equ setyawn, 0xD7
.equ setdamagetohealthdifference, 0xD8
.equ scaledamagebyhealthratio, 0xD9
.equ abilityswap, 0xDA
.equ imprisoneffect, 0xDB
.equ setgrudge, 0xDC
.equ weightdamagecalculation, 0xDD
.equ asistattackselect, 0xDE
.equ setmagiccoat, 0xDF
.equ setstealstatchange, 0xE0
.equ cmde1, 0xE1
.equ cmde2, 0xE2
.equ jumpiffainted, 0xE3
.equ naturepowereffect, 0xE4
.equ pickupitemcalculation, 0xE5
.equ actualcastformswitch, 0xE6
.equ castformswitch, 0xE7
.equ settypebasedhalvers, 0xE8
.equ seteffectbyweather, 0xE9
.equ recycleitem, 0xEA
.equ settypetoterrain, 0xEB
.equ pursuitwhenswitched, 0xEC
.equ snatchmove, 0xED
.equ removereflectlightscreen, 0xEE
.equ pokemoncatchfunction, 0xEF
.equ catchpoke, 0xF0
.equ capturesomethingf1, 0xF1
.equ capturesomethingf2, 0xF2
.equ capturesomethingf3, 0xF3
.equ removehp, 0xF4
.equ curestatutfirstword, 0xF5
.equ cmdf6, 0xF6
.equ activesidesomething, 0xF7
.equ callasm, 0xF8
.equ setword, 0xFA


@ScriptReferences
.equ WaterVoltAbsorbEnd, 0x1D93DC
.equ FlashFireEnd, 0x1D9404
.equ DoesNotAffectEnd, 0x1D93F2
.equ SoundProofEnd, 0x1D947A
@.equ LightningRodEnd,
@.equ DrySkinEnd,
@.equ StormDrainEnd,
@.equ MotorDriveEnd,
@.equ SapSipperEnd,
.equ StandardEndScriptBS, 0x81D694E
.equ BoomburstBS, BoomburstBSLabel+RomAreaOffset
.equ SurfBS, Myloc+RomAreaOffset
.equ DischargeBS, DischargeBSLabel+RomAreaOffset
.equ LavaPlumeBS, LavaPlumeBSLabel+RomAreaOffset
.equ LavaPlumeMainBS, LavaPlumeMainBSLabel+RomAreaOffset
.equ SludgeWaveBS, SludgeWaveBSLabel+RomAreaOffset
.equ BulldozeBS, BulldozeBSLabel+RomAreaOffset
.equ ParaChargeBS, ParaChargeBSLabel+RomAreaOffset
.equ SurfIteration, SurfIterationLabel+RomAreaOffset
.equ BoomburstIteration, BoomburstIterationLabel+RomAreaOffset
.equ DischargeIteration, DischargeIterationLabel+RomAreaOffset
.equ LavaPlumeIteration, LavaPlumeIterationLabel+RomAreaOffset
.equ SludgeWaveIteration, SludgeWaveIterationLabel+RomAreaOffset
.equ BulldozeIteration, BulldozeIterationLabel+RomAreaOffset
.equ ParaChargeIteration, ParaChargeIterationLabel+RomAreaOffset
.equ AbsorbRebrancher, AbsorbRebrancherLabel+RomAreaOffset
.equ StdMultiTgtDmgeBS, StandardMultiTargetDamageBSLabel+RomAreaOffset
.equ MissMultiTgtDmgBS, MissMultiDamageTargetBSLabel+RomAreaOffset
.equ NoDivingTargetSurf, NoDivingTargetSurfLabel+RomAreaOffset
.equ ReturnAfterAbsorb, ReturnAfterAbsorbLabel+RomAreaOffset
.equ NextIterationBS, NextIterationBSLabel+RomAreaOffset
.equ JumpIfMoveTargetRangeFoesAndAllies, MoveRangeCheckASM+RomAreaOffset

.equ RomAreaOffset, 0x8000000

@@@@Sort the order of these orgs in increasing order of locations so you don't get the error message: attempt to move org backwards.

@.align 2
@.org LightningRodEnd
@.word AbsorbRebrancher


@.org StormDrainEnd
@.word AbsorbRebrancher


@.org MotorDriveEnd
@.word AbsorbRebrancher


@.org SapSipperEnd
@.word AbsorbRebrancher


.org MoveEffectTable
.word SurfBS


.org MoveEffectTable+0x8 @(Effect 2)
.word SludgeWaveBS


.org MoveEffectTable+0xC @(Effect 3)
.word ParaChargeBS

.org MoveEffectTable+0x10 @(Effect 4)
.word LavaPlumeBS


.org MoveEffectTable+0x18  @(Effect 6)
.word DischargeBS


.org MoveEffectTable+0x118 @(Effect 70)
.word BulldozeBS


.org WaterVoltAbsorbEnd
.word AbsorbRebrancher


.org DoesNotAffectEnd
.word AbsorbRebrancher


.org FlashFireEnd
.word AbsorbRebrancher


.org SoundProofEnd
.word AbsorbRebrancher

@@@@@@@@@@ Surf Damage
.org Myloc

SurfBSLabel:
.byte jumpifhalfword, Equals
.word CurrMove
.hword BoomburstID
.word BoomburstBS

.byte jumpifhalfword, Equals
.word CurrMove
.hword PetalBlizzardID
.word BoomburstBS

.byte jumpifhalfword, NotEquals
.word CurrMove
.hword SurfID
.word StdSingleTgtDmgBS

.byte attackcanceler, attackstring, ppreduce, selectnexttarget

SurfIterationLabel:
.byte cmd25

.byte jumpifspecialstatusflag, BANK_TARGET
.word DivingState
.byte 0x1
.word NoDivingTargetSurf

.byte orword
.word HitMarker, OverrideDiveEvasion

.byte setbyte
.word DamageMultiplier
.byte 0x2

.byte goto
.word StdMultiTgtDmgeBS

NoDivingTargetSurfLabel:

.byte bicword
.word HitMarker, OverrideDiveEvasion

.byte setbyte
.word DamageMultiplier
.byte 0x1

.byte goto
.word StdMultiTgtDmgeBS


@@@@@@@@@@@For Boomburst & Petal Blizzard 
BoomburstBSLabel:
.byte selectnexttarget  @The name should be selectfirstpossibletarget actually
BoomburstIterationLabel:

.byte attackcanceler, attackstring, ppreduce, cmd25

.byte orword
.word HitMarker
.word 0x2000200

.byte goto
.word StdMultiTgtDmgeBS

@@@@@@@@@@Lava Plume Battle Script
LavaPlumeBSLabel:
.byte jumpifhalfword, Equals
.word CurrMove
.hword SearingShotID 
.word LavaPlumeMainBS

.byte jumpifhalfword, NotEquals
.word CurrMove
.hword LavaPlumeID 
.word StdSingleTgtDmgBrnBS

LavaPlumeMainBSLabel:

.byte attackcanceler, attackstring, ppreduce, selectnexttarget

LavaPlumeIterationLabel:
.byte cmd25
.byte setbyte
.word AppliedEffectByte
.byte BurnEffect


.byte goto
.word StdMultiTgtDmgeBS

@@@@@@@@@@Discharge Battle Script
DischargeBSLabel:
.byte jumpifhalfword, NotEquals
.word CurrMove
.hword DischargeID 
.word StdSingleTgtDmgPrlzBS

.byte attackcanceler, attackstring, ppreduce, selectnexttarget

DischargeIterationLabel:
.byte cmd25
.byte setbyte
.word AppliedEffectByte
.byte ParalysisEffect


.byte goto
.word StdMultiTgtDmgeBS


@@@@@@@@@@Sludge Wave Battle Script
SludgeWaveBSLabel:
.byte jumpifhalfword, NotEquals
.word CurrMove
.hword SludgeWaveID 
.word StdSingleTgtDmgPsnBS

.byte attackcanceler, attackstring, ppreduce, selectnexttarget

SludgeWaveIterationLabel:
.byte cmd25
.byte setbyte
.word AppliedEffectByte
.byte PoisonEffect


.byte goto
.word StdMultiTgtDmgeBS


@@@@@@@@@@Bulldoze Battle Script
BulldozeBSLabel:
.byte jumpifhalfword, NotEquals
.word CurrMove
.hword BulldozeID 
.word StdSingleTgtDmgLowFoeSpeedBS

.byte attackcanceler, attackstring, ppreduce, selectnexttarget

BulldozeIterationLabel:
.byte cmd25
.byte setbyte
.word AppliedEffectByte
.byte LowFoeSpeedEffect


.byte goto
.word StdMultiTgtDmgeBS

@@@@@@@@@@@
ParaChargeBSLabel:
.byte jumpifhalfword, NotEquals
.word CurrMove
.hword ParaChargeID
.word StdSingleTgtDmgDrainBS

.byte attackcanceler, attackstring, ppreduce, selectnexttarget

ParaChargeIterationLabel:
.byte cmd25

.byte accuracycheck
.word MissMultiTgtDmgBS
.hword 0x0

.word calculatedamage

.byte attackanimation, waitanimation, missmessage, cmd5c, 0x0, waitstate

.byte graphicalhpupdate, 0x0, datahpupdate, 0x0

.byte critmessage, waitmessage
.hword 0x40

.byte resultmessage, waitmessage
.hword 0x40

.byte negativedamage

.byte jumpiffainted, BANK_USER
.word ReturnAfterAbsorb

.byte jumpifbyte, 0x4
.word 0x2023DCC
.byte 0x29
.word ReturnAfterAbsorb

.byte orword
.word HitMarker, 0x100

.byte jumpifability, BANK_TARGET, 0x40
.word OozeEffect+RomAreaOffset

.byte setbyte
.word 0x2023E87
.byte 0x0

.byte goto
.word UserHPUpdate+RomAreaOffset

OozeEffect:
.byte manipulatedamage, 0x0
.byte setbyte
.word 0x2023E87
.byte 0x0

UserHPUpdate:
.byte graphicalhpupdate, 0x1, datahpupdate, 0x1

.byte printfromtable
.word 0x83FE5DC


.byte waitmessage
.hword 0x40

.byte faintpokemon, BANK_USER, 0x0
.word 0x0

.byte faintpokemon, BANK_FOE, 0x0
.word 0x0

.byte bicword
.word HitMarker, 0x100

.byte printstring
.hword 0x130
.byte waitmessage
.hword 0x40

.byte setbyte
.word Cmd49TableCounter
.byte 0x0

.byte cmd49, 0x0, 0x0

.byte jumpwhiletargetvalid
.word NextIterationBS

.byte end

@@@@@@@@@@Master Battle Script
StandardMultiTargetDamageBSLabel:
.byte accuracycheck
.word MissMultiTgtDmgBS
.hword 0x0

.word calculatedamage

.byte attackanimation, waitanimation, missmessage, cmd5c, 0x0, waitstate

.byte graphicalhpupdate, 0x0, datahpupdate, 0x0

.byte critmessage, waitmessage
.hword 0x40

.byte resultmessage, waitmessage
.hword 0x40

.byte printstring
.hword 0x130
.byte waitmessage
.hword 0x40

.byte seteffectwithchancetarget

.byte faintpokemon, BANK_FOE, 0x0
.word 0x0

.byte setbyte
.word Cmd49TableCounter
.byte 0x0

.byte cmd49, 0x0, 0x0

.byte jumpwhiletargetvalid
.word NextIterationBS

.byte end
@@@@@@@@@@

MissMultiDamageTargetBSLabel:
.byte pause, 0x20, 0x0, cmd6, missmessage

.byte resultmessage, waitmessage
.hword 0x40

ReturnAfterAbsorbLabel:

.byte setbyte
.word Cmd49TableCounter
.byte 0x0

.byte cmd49, 0x0, 0x0

.byte jumpwhiletargetvalid
.word NextIterationBS

.byte end

@@@@@@@@@@
NextIterationBSLabel:
.byte jumpifhalfword, Equals
.word CurrMove
.hword SurfID 
.word SurfIteration

.byte jumpifhalfword, Equals
.word CurrMove
.hword BulldozeID 
.word BulldozeIteration

.byte jumpifhalfword, Equals
.word CurrMove
.hword DischargeID 
.word DischargeIteration

.byte jumpifhalfword, Equals
.word CurrMove
.hword LavaPlumeID 
.word LavaPlumeIteration

.byte jumpifhalfword, Equals
.word CurrMove
.hword ParaChargeID 
.word ParaChargeIteration

.byte jumpifhalfword, Equals
.word CurrMove
.hword SearingShotID 
.word LavaPlumeIteration

.byte goto
.word BoomburstIteration
@@@@@@@@@@@@@@@@@@@@@@@@@@

AbsorbRebrancherLabel:
.byte callasm
.word JumpIfMoveTargetRangeFoesAndAllies+1
.byte goto
.word StandardEndScriptBS

@@@@@@@@@@@@@@@@@@@
.align 2
MoveRangeCheckASM:
       ldr r1, =CurrMove
       ldr r2, =MoveTable
       ldrh r0, [r1]
       lsl r1, r0, #1
       add r0, r0, r1
       lsl r1, r0, #2
       add r2, r1, r2
       ldrb r0, [r2, #0x6]
       cmp r0, #0x20
       bne EndASM
       ldrb r0, [r2, #0xA]
       cmp r0, #0x2
       beq EndASM
       ldr r1, =HitMarker
       ldr r0, [r1]
       ldr r2, =0x2000200
       orr r0, r2
       str r0, [r1]
       ldr r0, =ReturnAfterAbsorb
       sub r0, #0x5
       ldr r1, =ScriptPointer
       str r0, [r1]
EndASM:
       bx lr
.align 2
.pool

Emerald:-
Spoiler:


Replace all instances of x2d8A00 with x2D8A26 in the BS Region.
To determine the address for keywords for new absorb abilities like LightningRodEnd, use the address of the last goto statement (in the Lightning Rod Battle Script) + 1.

.thumb
.thumb_func
.global multitargetmoves

.equ Myloc, 0xE00700   @Location of non hooking resource area (Main routines plus Battle Scripts and Strings).
.equ YourWordLocation, 0x203E320  @RAM Area used for Battle String Loader Hack
.equ MoveEffectTable, 0x2D86A8
.equ MoveTable, 0x831C898

@@ Move IDs 
.equ BoomburstID, 0x24A
.equ PetalBlizzardID, 0x23C
.equ ParaChargeID, 0x23A
.equ SurfID, 0x39
.equ LavaPlumeID, 0x1B4
.equ BulldozeID, 0x20B
.equ DischargeID, 0x1B3
.equ SludgeWaveID, 0x1E2
.equ SearingShotID, 0x221

@@Move Effect Script Pointers to be Replaced.
@@ Change these if you have changed the script pointers, for example if have used something like Flame Charge with LowFoeSpeedBS
.equ StdSingleTgtDmgBS, 0x82D8A26  @Effect 0
.equ StdSingleTgtDmgPrlzBS, 0x82D8B6E@Effect 6
.equ StdSingleTgtDmgBrnBS, 0x82D8B58@Effect 4
.equ StdSingleTgtDmgPsnBS, 0x82D8ADF@Effect 2
.equ StdSingleTgtDmgLowFoeSpeedBS, 0x82D9392@Effect 70
.equ StdSingleTgtDmgDrainBS, 0x82D8AEA@Effect 3

@@ Ram Locations
.equ CurrMove, 0x20241EA
.equ HitMarker, 0x2024280
.equ DamageMultiplier, 0x02024882
.equ ScriptPointer, 0x2024214
.equ Cmd49TableCounter, 0x2024488
.equ AppliedEffectByte, 0x2024335


@@Keywords
.equ CancelerCheckSkip, 0x200
.equ ObedienceCheckSkip, 0x2000000
.equ DivingState, 0x40000
.equ OverrideDiveEvasion, 0x40000
.equ BurnEffect, 0x3
.equ ParalysisEffect, 0x5
.equ PoisonEffect, 0x2
.equ LowFoeSpeedEffect, 0x18

@@ Compare operands
.equ Equals, 0x0
.equ NotEquals, 0x1
.equ LessThan, 0x2
.equ GreaterThan, 0x3
.equ Anded, 0x4

@@ Banks
.equ BANK_USER, 0x1
.equ BANK_TARGET, 0x0

@@ Delay
.equ DELAY_HALFSECOND, 0x20
.equ DELAY_1SECOND, 0x40

@@ Index commands
.equ calculatedamage, 0x7060504
.equ attackcanceler, 0x0
.equ accuracycheck, 0x1
.equ attackstring, 0x2
.equ ppreduce, 0x3
.equ critcalc, 0x4
.equ cmd5, 0x5
.equ cmd6, 0x6
.equ cmd7, 0x7
.equ cmd8, 0x8
.equ attackanimation, 0x9
.equ waitanimation, 0xA
.equ graphicalhpupdate, 0xB
.equ datahpupdate, 0xC
.equ critmessage, 0xD
.equ missmessage, 0xE
.equ resultmessage, 0xF
.equ printstring, 0x10
.equ printstring2, 0x11
.equ waitmessage, 0x12
.equ printfromtable, 0x13
.equ printfromtable2, 0x14
.equ seteffectwithchancetarget, 0x15
.equ seteffecttarget, 0x16
.equ seteffectuser, 0x17
.equ clearstatus, 0x18
.equ faintpokemon, 0x19
.equ cmd1a, 0x1A
.equ cmd1b, 0x1B
.equ jumpifstatus, 0x1C
.equ jumpifsecondarystatus, 0x1D
.equ jumpifability, 0x1E
.equ jumpifhalverset, 0x1F
.equ jumpifstat, 0x20
.equ jumpifspecialstatusflag, 0x21
.equ jumpiftype, 0x22
.equ cmd23, 0x23
.equ gotoandsomething, 0x24
.equ cmd25, 0x25
.equ cmd26, 0x26
.equ cmd27, 0x27
.equ goto, 0x28
.equ jumpifbyte, 0x29
.equ jumpifhalfword, 0x2A
.equ jumpifword, 0x2B
.equ jumpifarrayequal, 0x2C
.equ jumpifarraynotequal, 0x2D
.equ setbyte, 0x2E
.equ addbyte, 0x2F
.equ subtractbyte, 0x30
.equ copyarray, 0x31
.equ cmd32, 0x32
.equ orbyte, 0x33
.equ orhalfword, 0x34
.equ orword, 0x35
.equ bicbyte, 0x36
.equ bichalfword, 0x37
.equ bicword, 0x38
.equ pause, 0x39
.equ waitstate, 0x3A
.equ somethinghealcmd3b, 0x3B
.equ return, 0x3C
.equ end, 0x3D
.equ end2, 0x3E
.equ end3, 0x3F
.equ cmd40, 0x40
.equ call, 0x41
.equ jumpiftype2, 0x42
.equ jumpifabilitypresent, 0x43
.equ cmd44, 0x44
.equ playanimation, 0x45
.equ cmd46, 0x46
.equ cmd47, 0x47
.equ playstatchangeanimation, 0x48
.equ cmd49, 0x49
.equ damagecalc2, 0x4A
.equ cmd4b, 0x4B
.equ switch1, 0x4C
.equ switch2, 0x4D
.equ switch3, 0x4E
.equ jumpifcannotswitch, 0x4F
.equ openpartyscreen, 0x50
.equ cmd51, 0x51
.equ cmd52, 0x52
.equ cmd53, 0x53
.equ cmd54, 0x54
.equ cmd55, 0x55
.equ cmd56, 0x56
.equ cmd57, 0x57
.equ cmd58, 0x58
.equ checkiflearnmoveinbattle, 0x59
.equ cmd5a, 0x5A
.equ cmd5b, 0x5B
.equ cmd5c, 0x5C
.equ cmd5d, 0x5D
.equ cmd5e, 0x5E
.equ cmd5f, 0x5F
.equ cmd60, 0x60
.equ cmd61, 0x61
.equ cmd62, 0x62
.equ jumptoattack, 0x63
.equ statusanimation, 0x64
.equ cmd65, 0x65
.equ cmd66, 0x66
.equ cmd67, 0x67
.equ cmd68, 0x68
.equ cmd69, 0x69
.equ removeitem, 0x6A
.equ cmd6b, 0x6B
.equ cmd6c, 0x6C
.equ cmd6d, 0x6D
.equ cmd6e, 0x6E
.equ cmd6f, 0x6F
.equ cmd70, 0x70
.equ cmd71, 0x71
.equ somethingwithhelditem, 0x72
.equ cmd73, 0x73
.equ cmd74, 0x74
.equ cmd75, 0x75
.equ cmd76, 0x76
.equ setprotect, 0x77
.equ faintifabilitynotdamp, 0x78
.equ setuserhptozero, 0x79
.equ jumpwhiletargetvalid, 0x7A
.equ setdamageasrestorehalfmaxhp, 0x7B
.equ jumptolastusedattack, 0x7C
.equ setrain, 0x7D
.equ setreflect, 0x7E
.equ setleechseed, 0x7F
.equ manipulatedamage, 0x80
.equ setrest, 0x81
.equ jumpifnotfirstturn, 0x82
.equ nop3, 0x83
.equ jumpifcannotsleep, 0x84
.equ stockpile, 0x85
.equ stockpiletobasedamage, 0x86
.equ stockpiletohprecovery, 0x87
.equ negativedamage, 0x88
.equ statbuffchange, 0x89
.equ normalisebuffs, 0x8A
.equ setbide, 0x8B
.equ confuseifrepeatingattackends, 0x8C
.equ setloopcounter, 0x8D
.equ cmd8e, 0x8E
.equ forcerandomswitch, 0x8F
.equ changetypestoenemyattacktype, 0x90
.equ givemoney, 0x91
.equ setlightscreen, 0x92
.equ koplussomethings, 0x93
.equ gethalfcurrentenemyhp, 0x94
.equ setsandstorm, 0x95
.equ weatherdamage, 0x96
.equ tryinfatuatetarget, 0x97
.equ cmd98, 0x98
.equ setmisteffect, 0x99
.equ setincreasedcriticalchance, 0x9A
.equ transformdataexecution, 0x9B
.equ setsubstituteeffect, 0x9C
.equ copyattack, 0x9D
.equ metronomeeffect, 0x9E
.equ nightshadedamageeffect, 0x9F
.equ psywavedamageeffect, 0xA0
.equ counterdamagecalculator, 0xA1
.equ mirrorcoatdamagecalculator, 0xA2
.equ disablelastusedattack, 0xA3
.equ setencore, 0xA4
.equ painsplitdamagecalculator, 0xA5
.equ settypetorandomresistance, 0xA6
.equ setalwaymukflag, 0xA7
.equ copymovepermanently, 0xA8
.equ selectrandommovefromusermoves, 0xA9
.equ destinybondeffect, 0xAA
.equ cmdab, 0xAB
.equ remaininghptopower, 0xAC
.equ reducepprandom, 0xAD
.equ clearstatusifnotsoundproofed, 0xAE
.equ cursetarget, 0xAF
.equ setspikes, 0xB0
.equ setforesight, 0xB1
.equ setperishsong, 0xB2
.equ rolloutdamagecalculation, 0xB3
.equ jumpifconfusedandattackmaxed, 0xB4
.equ furycutterdamagecalculation, 0xB5
.equ happinesstodamagecalculation, 0xB6
.equ presentdamagecalculation, 0xB7
.equ setsafeguard, 0xB8
.equ magnitudedamagecalculation, 0xB9
.equ cmdba, 0xBA
.equ setsunny, 0xBB
.equ maxattackhalvehp, 0xBC
.equ copyfoestats, 0xBD
.equ breakfree, 0xBE
.equ setcurled, 0xBF
.equ recoverbasedonsunlight, 0xC0
.equ hiddenpowerdamagecalculation, 0xC1
.equ selectnexttarget, 0xC2
.equ setfutureattack, 0xC3
.equ beatupcalculation, 0xC4
.equ hidepreattack, 0xC5
.equ unhidepostattack, 0xC6
.equ setminimize, 0xC7
.equ sethail, 0xC8
.equ jumpifattackandspecialattackcannotfall, 0xC9
.equ setforcedtarget, 0xCA
.equ setcharge, 0xCB
.equ callterrainattack, 0xCC
.equ cureifburnedparalysedorpoisoned, 0xCD
.equ settorment, 0xCE
.equ jumpifnodamage, 0xCF
.equ settaunt, 0xD0
.equ sethelpinghand, 0xD1
.equ itemswap, 0xD2
.equ copyability, 0xD3
.equ cmdd4, 0xD4
.equ setroots, 0xD5
.equ doubledamagedealtifdamaged, 0xD6
.equ setyawn, 0xD7
.equ setdamagetohealthdifference, 0xD8
.equ scaledamagebyhealthratio, 0xD9
.equ abilityswap, 0xDA
.equ imprisoneffect, 0xDB
.equ setgrudge, 0xDC
.equ weightdamagecalculation, 0xDD
.equ asistattackselect, 0xDE
.equ setmagiccoat, 0xDF
.equ setstealstatchange, 0xE0
.equ cmde1, 0xE1
.equ cmde2, 0xE2
.equ jumpiffainted, 0xE3
.equ naturepowereffect, 0xE4
.equ pickupitemcalculation, 0xE5
.equ actualcastformswitch, 0xE6
.equ castformswitch, 0xE7
.equ settypebasedhalvers, 0xE8
.equ seteffectbyweather, 0xE9
.equ recycleitem, 0xEA
.equ settypetoterrain, 0xEB
.equ pursuitwhenswitched, 0xEC
.equ snatchmove, 0xED
.equ removereflectlightscreen, 0xEE
.equ pokemoncatchfunction, 0xEF
.equ catchpoke, 0xF0
.equ capturesomethingf1, 0xF1
.equ capturesomethingf2, 0xF2
.equ capturesomethingf3, 0xF3
.equ removehp, 0xF4
.equ curestatutfirstword, 0xF5
.equ cmdf6, 0xF6
.equ activesidesomething, 0xF7
.equ cmdf8, 0xF8
.equ callasm, 0xF9
.equ setword, 0xFA


@ScriptReferences
.equ WaterVoltAbsorbEnd, 0x2DB58D 
.equ FlashFireEnd, 0x2DB5B5
.equ DoesNotAffectEnd, 0x2DB5A3
.equ SoundProofEnd, 0x2DB62B
@.equ LightningRodEnd,
@.equ DrySkinEnd,
@.equ StormDrainEnd,
@.equ MotorDriveEnd,
@.equ SapSipperEnd,
.equ StandardEndScriptBS, 0x82D8A4E
.equ BoomburstBS, BoomburstBSLabel+RomAreaOffset
.equ SurfBS, Myloc+RomAreaOffset
.equ DischargeBS, DischargeBSLabel+RomAreaOffset
.equ LavaPlumeBS, LavaPlumeBSLabel+RomAreaOffset
.equ LavaPlumeMainBS, LavaPlumeMainBSLabel+RomAreaOffset
.equ SludgeWaveBS, SludgeWaveBSLabel+RomAreaOffset
.equ BulldozeBS, BulldozeBSLabel+RomAreaOffset
.equ ParaChargeBS, ParaChargeBSLabel+RomAreaOffset
.equ SurfIteration, SurfIterationLabel+RomAreaOffset
.equ BoomburstIteration, BoomburstIterationLabel+RomAreaOffset
.equ DischargeIteration, DischargeIterationLabel+RomAreaOffset
.equ LavaPlumeIteration, LavaPlumeIterationLabel+RomAreaOffset
.equ SludgeWaveIteration, SludgeWaveIterationLabel+RomAreaOffset
.equ BulldozeIteration, BulldozeIterationLabel+RomAreaOffset
.equ ParaChargeIteration, ParaChargeIterationLabel+RomAreaOffset
.equ AbsorbRebrancher, AbsorbRebrancherLabel+RomAreaOffset
.equ StdMultiTgtDmgeBS, StandardMultiTargetDamageBSLabel+RomAreaOffset
.equ MissMultiTgtDmgBS, MissMultiDamageTargetBSLabel+RomAreaOffset
.equ NoDivingTargetSurf, NoDivingTargetSurfLabel+RomAreaOffset
.equ ReturnAfterAbsorb, ReturnAfterAbsorbLabel+RomAreaOffset
.equ NextIterationBS, NextIterationBSLabel+RomAreaOffset
.equ JumpIfMoveTargetRangeFoesAndAllies, MoveRangeCheckASM+RomAreaOffset

.equ RomAreaOffset, 0x8000000

@@@@Sort the order of these orgs in increasing order of locations so you don't get the error message: attempt to move org backwards.

@.align 2
@.org LightningRodEnd
@.word AbsorbRebrancher


@.org StormDrainEnd
@.word AbsorbRebrancher


@.org MotorDriveEnd
@.word AbsorbRebrancher


@.org SapSipperEnd
@.word AbsorbRebrancher


.org MoveEffectTable
.word SurfBS


.org MoveEffectTable+0x8 @(Effect 2)
.word SludgeWaveBS


.org MoveEffectTable+0xC @(Effect 3)
.word ParaChargeBS

.org MoveEffectTable+0x10 @(Effect 4)
.word LavaPlumeBS


.org MoveEffectTable+0x18  @(Effect 6)
.word DischargeBS


.org MoveEffectTable+0x118 @(Effect 70)
.word BulldozeBS


.org WaterVoltAbsorbEnd
.word AbsorbRebrancher


.org DoesNotAffectEnd
.word AbsorbRebrancher


.org FlashFireEnd
.word AbsorbRebrancher


.org SoundProofEnd
.word AbsorbRebrancher

@@@@@@@@@@ Surf Damage
.org Myloc

SurfBSLabel:
.byte jumpifhalfword, Equals
.word CurrMove
.hword BoomburstID
.word BoomburstBS

.byte jumpifhalfword, Equals
.word CurrMove
.hword PetalBlizzardID
.word BoomburstBS

.byte jumpifhalfword, NotEquals
.word CurrMove
.hword SurfID
.word StdSingleTgtDmgBS

.byte attackcanceler, attackstring, ppreduce, selectnexttarget

SurfIterationLabel:
.byte cmd25

.byte jumpifspecialstatusflag, BANK_TARGET
.word DivingState
.byte 0x1
.word NoDivingTargetSurf

.byte orword
.word HitMarker, OverrideDiveEvasion

.byte setbyte
.word DamageMultiplier
.byte 0x2

.byte goto
.word StdMultiTgtDmgeBS

NoDivingTargetSurfLabel:

.byte bicword
.word HitMarker, OverrideDiveEvasion

.byte setbyte
.word DamageMultiplier
.byte 0x1

.byte goto
.word StdMultiTgtDmgeBS


@@@@@@@@@@@For Boomburst & Petal Blizzard 
BoomburstBSLabel:
.byte selectnexttarget  @The name should be selectfirstpossibletarget actually
BoomburstIterationLabel:

.byte attackcanceler, attackstring, ppreduce, cmd25

.byte orword
.word HitMarker
.word 0x2000200

.byte goto
.word StdMultiTgtDmgeBS

@@@@@@@@@@Lava Plume Battle Script
LavaPlumeBSLabel:
.byte jumpifhalfword, Equals
.word CurrMove
.hword SearingShotID 
.word LavaPlumeMainBS

.byte jumpifhalfword, NotEquals
.word CurrMove
.hword LavaPlumeID 
.word StdSingleTgtDmgBrnBS

LavaPlumeMainBSLabel:

.byte attackcanceler, attackstring, ppreduce, selectnexttarget

LavaPlumeIterationLabel:
.byte cmd25
.byte setbyte
.word AppliedEffectByte
.byte BurnEffect


.byte goto
.word StdMultiTgtDmgeBS

@@@@@@@@@@Discharge Battle Script
DischargeBSLabel:
.byte jumpifhalfword, NotEquals
.word CurrMove
.hword DischargeID 
.word StdSingleTgtDmgPrlzBS

.byte attackcanceler, attackstring, ppreduce, selectnexttarget

DischargeIterationLabel:
.byte cmd25
.byte setbyte
.word AppliedEffectByte
.byte ParalysisEffect


.byte goto
.word StdMultiTgtDmgeBS


@@@@@@@@@@Sludge Wave Battle Script
SludgeWaveBSLabel:
.byte jumpifhalfword, NotEquals
.word CurrMove
.hword SludgeWaveID 
.word StdSingleTgtDmgPsnBS

.byte attackcanceler, attackstring, ppreduce, selectnexttarget

SludgeWaveIterationLabel:
.byte cmd25
.byte setbyte
.word AppliedEffectByte
.byte PoisonEffect


.byte goto
.word StdMultiTgtDmgeBS


@@@@@@@@@@Bulldoze Battle Script
BulldozeBSLabel:
.byte jumpifhalfword, NotEquals
.word CurrMove
.hword BulldozeID 
.word StdSingleTgtDmgLowFoeSpeedBS

.byte attackcanceler, attackstring, ppreduce, selectnexttarget

BulldozeIterationLabel:
.byte cmd25
.byte setbyte
.word AppliedEffectByte
.byte LowFoeSpeedEffect


.byte goto
.word StdMultiTgtDmgeBS

@@@@@@@@@@@
ParaChargeBSLabel:
.byte jumpifhalfword, NotEquals
.word CurrMove
.hword ParaChargeID
.word StdSingleTgtDmgDrainBS

.byte attackcanceler, attackstring, ppreduce, selectnexttarget

ParaChargeIterationLabel:
.byte cmd25

.byte accuracycheck
.word MissMultiTgtDmgBS
.hword 0x0

.word calculatedamage

.byte attackanimation, waitanimation, missmessage, cmd5c, 0x0, waitstate

.byte graphicalhpupdate, 0x0, datahpupdate, 0x0

.byte critmessage, waitmessage
.hword 0x40

.byte resultmessage, waitmessage
.hword 0x40

.byte negativedamage

.byte jumpiffainted, BANK_USER
.word ReturnAfterAbsorb

.byte jumpifbyte, 0x4
.word 0x202427C
.byte 0x29
.word ReturnAfterAbsorb

.byte orword
.word HitMarker, 0x100

.byte jumpifability, BANK_TARGET, 0x40
.word OozeEffect+RomAreaOffset

.byte setbyte
.word 0x2024337
.byte 0x0

.byte goto
.word UserHPUpdate+RomAreaOffset

OozeEffect:
.byte manipulatedamage, 0x0
.byte setbyte
.word 0x2024337
.byte 0x0

UserHPUpdate:
.byte graphicalhpupdate, 0x1, datahpupdate, 0x1

.byte printfromtable
.word 0x85CC8FC

.byte waitmessage
.hword 0x40

.byte faintpokemon, BANK_USER, 0x0
.word 0x0

.byte faintpokemon, BANK_FOE, 0x0
.word 0x0

.byte bicword
.word HitMarker, 0x100

.byte printstring
.hword 0x130
.byte waitmessage
.hword 0x40

.byte setbyte
.word Cmd49TableCounter
.byte 0x0

.byte cmd49, 0x0, 0x0

.byte jumpwhiletargetvalid
.word NextIterationBS

.byte end

@@@@@@@@@@Master Battle Script
StandardMultiTargetDamageBSLabel:
.byte accuracycheck
.word MissMultiTgtDmgBS
.hword 0x0

.word calculatedamage

.byte attackanimation, waitanimation, missmessage, cmd5c, 0x0, waitstate

.byte graphicalhpupdate, 0x0, datahpupdate, 0x0

.byte critmessage, waitmessage
.hword 0x40

.byte resultmessage, waitmessage
.hword 0x40

.byte printstring
.hword 0x130
.byte waitmessage
.hword 0x40

.byte seteffectwithchancetarget

.byte faintpokemon, BANK_FOE, 0x0
.word 0x0

.byte setbyte
.word Cmd49TableCounter
.byte 0x0

.byte cmd49, 0x0, 0x0

.byte jumpwhiletargetvalid
.word NextIterationBS

.byte end
@@@@@@@@@@

MissMultiDamageTargetBSLabel:
.byte pause, 0x20, 0x0, cmd6, missmessage

.byte resultmessage, waitmessage
.hword 0x40

ReturnAfterAbsorbLabel:

.byte setbyte
.word Cmd49TableCounter
.byte 0x0

.byte cmd49, 0x0, 0x0

.byte jumpwhiletargetvalid
.word NextIterationBS

.byte end

@@@@@@@@@@
NextIterationBSLabel:
.byte jumpifhalfword, Equals
.word CurrMove
.hword SurfID 
.word SurfIteration

.byte jumpifhalfword, Equals
.word CurrMove
.hword BulldozeID 
.word BulldozeIteration

.byte jumpifhalfword, Equals
.word CurrMove
.hword DischargeID 
.word DischargeIteration

.byte jumpifhalfword, Equals
.word CurrMove
.hword LavaPlumeID 
.word LavaPlumeIteration

.byte jumpifhalfword, Equals
.word CurrMove
.hword ParaChargeID 
.word ParaChargeIteration

.byte jumpifhalfword, Equals
.word CurrMove
.hword SearingShotID 
.word LavaPlumeIteration

.byte goto
.word BoomburstIteration
@@@@@@@@@@@@@@@@@@@@@@@@@@

AbsorbRebrancherLabel:
.byte callasm
.word JumpIfMoveTargetRangeFoesAndAllies+1
.byte goto
.word StandardEndScriptBS

@@@@@@@@@@@@@@@@@@@
.align 2
MoveRangeCheckASM:
       ldr r1, =CurrMove
       ldr r2, =MoveTable
       ldrh r0, [r1]
       lsl r1, r0, #1
       add r0, r0, r1
       lsl r1, r0, #2
       add r2, r1, r2
       ldrb r0, [r2, #0x6]
       cmp r0, #0x20
       bne EndASM
       ldrb r0, [r2, #0xA]
       cmp r0, #0x2
       beq EndASM
       ldr r1, =HitMarker
       ldr r0, [r1]
       ldr r2, =0x2000200
       orr r0, r2
       str r0, [r1]
       ldr r0, =ReturnAfterAbsorb
       sub r0, #0x5
       ldr r1, =ScriptPointer
       str r0, [r1]
EndASM:
       bx lr
.align 2
.pool

MrDollSteak

Formerly known as 11bayerf1

Age 24
Male
Hong Kong
Seen 3 Days Ago
Posted May 15th, 2019
846 posts
10.7 Years
In Foul Play, there is no need for Huge Power handling. It does not considers the target's Huge Power at all.

Also, this:
#org @start
jumpifhalfword 0x1 0x2023D4A 0x39 @move
jumpifspecialstatusflag 0x0 0x40000 0x1 @move
orword 0x2023DD0 0x40000
setbyte 0x2023FD2 0x2
is unnecessary. This is the code for Surf hitting a diving target for double damage. In fact all instances of x1D6900 in the Battle Scripts Region should replaced with x1D6926 (except the first entry of the Move Effect table if you are not using the new Surf Battle Script).

Here is the new Surf done with an ASM file for easier insertion. Also corrects Boomburst vs Soundproof.
That looks fantastic KDS! What would I have to do to make it compatible with my Absorb abilities routine at the Ability Resource thread? Just branch to this routine in the battle scripts?

Chacha Dinosaur

Adamant and adaptive dinosaur.

Age 24
Male
Seen March 4th, 2018
Posted September 8th, 2017
454 posts
6.1 Years
That looks fantastic KDS! What would I have to do to make it compatible with my Absorb abilities routine at the Ability Resource thread? Just branch to this routine in the battle scripts?
You just need to change the pointer of the Goto statement in the Absorb ability Battle Script to the address of AbsorbRebrancherLabel (the last Battle Script in the Surf code just above the solitary routine).

Alternatively, for example if you want to make Lightning Rod compatible.
Insert the Lightning Rod Absorb Battle Script first without changing anything from the ability thread.
Note the address of the Goto statement in that Battle Script. Add +1 to it. Let this address by xXXXXXX
Then in this Surf ASM file uncomment these portions :
@.equ LightningRodEnd
Assign the value 8XXXXXX to this equ.

@.org LightningRodEnd
@.word AbsorbRebrancher
Then sort the orgs in the increasing order of addresses if neccesary.
Then the parameter of Goto command in the Absorb ability BS will change to the address of Absorb Rebrancher.
Male
Seen January 10th, 2019
Posted May 4th, 2017
216 posts
6.1 Years
I'm just letting everyone knows that I updated my post containing macro and defines, it let us switch between BSP and ASM directly (except for the command statbuff, cmd46 and perhaps other, that have the wrong number of parameter in BSP).

Chacha Dinosaur

Adamant and adaptive dinosaur.

Age 24
Male
Seen March 4th, 2018
Posted September 8th, 2017
454 posts
6.1 Years
Would implementing the speed-system for Quick Guard require new implementations of Gyro Ball/Electro Ball (the routines made by Mr. DollSteak)? Or can they still work alongside one another?
Yes, it would require new implementations.

MrDollSteak

Formerly known as 11bayerf1

Age 24
Male
Hong Kong
Seen 3 Days Ago
Posted May 15th, 2019
846 posts
10.7 Years
Would implementing the speed-system for Quick Guard require new implementations of Gyro Ball/Electro Ball (the routines made by Mr. DollSteak)? Or can they still work alongside one another?
Yeah I'm going to rewrite these to use the new speed system! Just a matter of having the callasm base the calculations off of the result returned by the BL.

EDIT: They're fixed! Just reinsert them! They're in the same post.
Seen January 10th, 2017
Posted April 21st, 2016
180 posts
5.5 Years
Move Effect

Venom Drench

Spoiler:
Emerald
Spoiler:


Make sure to put target to "Both foes" in PGA.

#Dynamic 0x[Offset]
#freespace 0xFF

#org @Start
jumpifhalfword 0x0 0x20231EA 0x[Move ID] @VenomDrench
goto [Offset of move you choose to hi-jack]

#org @VenomDrench
attackcanceler
attackstring
ppreduce
jumpifstatus 0x0 0x8 @Status   
jumpifstatus 0x0 0x80 @Status  
goto 0x82D9F1C

#org @Status
jumpifstat 0x0 0x2 0x1 0x0 @Att
jumpifstat 0x0 0x2 0x4 0x0 @Att
jumpifstat 0x0 0x0 0x3 0x0 0x82DA5CF

#org @Att
accuracycheck 0x82D9F1C 0x0
attackanimation
waitanimation
setbyte 0x202448F 0x0
playstatchangeanimation 0x0 0x1A 0x5
playstatchangeanimation 0x0 0x2 0x3 
setbyte 0x202448E 0x91
statbuffchange 0x1 FALSE @SpAtt
jumpifbyte 0x0 0x2024337 0x2 @SpAtt
printfromtable 0x85CC8A8
waitmessage 0x40

#org @SpAtt
playstatanimation 0x0 0x10 0x3
setbyte 0x202448E 0x94
statbuffchange 0x1 FALSE @Speed
jumpifbyte 0x0 0x2024337 0x2 @Speed
printfromtable 0x85CC8A8
waitmessage 0x40

#org @Speed
playstatanimation 0x0 0x8 0x3
setbyte 0x202448E 0x93
statbuffchange 0x1 FALSE 0x82DA5CA
jumpifbyte 0x0 0x2024337 0x2 0x82DA5CA
printfromtable 0x85CC8A8
waitmessage 0x40
goto 0x82D8A4E
Seen January 10th, 2017
Posted April 21st, 2016
180 posts
5.5 Years
Update

It is now 100% working, Psystrike/Psyshock and Secret Sword
I've noticed that the bytes originally at 69918 are moved to 69920 after applying the Physical/Special split patch. I just want to double confirm that the Psyshock effect is applied after this patch so the first byte you alter at 69918 is changing 10 and not 3F
Male
Seen January 10th, 2019
Posted May 4th, 2017
216 posts
6.1 Years
I've noticed that the bytes originally at 69918 are moved to 69920 after applying the Physical/Special split patch. I just want to double confirm that the Psyshock effect is applied after this patch so the first byte you alter at 69918 is changing 10 and not 3F
I assumed you applied the PSS patch when implementing this move. Though I've found a far better way when rewriting the damage calculator, so soon this implementation will be useless (though it does work)

Xencleamas

Suddenly lurking in the shadows...

Male
Asgard
Seen January 21st, 2019
Posted August 7th, 2018
460 posts
5.5 Years
Gastro Acid
Gastro Acid for Emerald.

Battle Script:
Spoiler:
#org @main
attackcanceler
attackstring
ppreduce
jumpifability 0x0 0x7A 0x82D9F1C // Multitype
jumpifability 0x0 0x9D 0x82D9F1C // Magic Bounce
jumpifability 0x0 0xB1 0x82D9F1C // Stance Change
callasm 0x8AAAAAA
attackanimation
waitanimation
setword 0x203E320 0x8BBBBBB
printstring 0x184
waitmessage 0x40
goto 0x82D8A4E
RAW Code:
00
02
03
1E 00 7A 1C 9F 2D 08
1E 00 9D 1C 9F 2D 08
1E 00 B1 1C 9F 2D 08
F9 AA+1 AA AA 08
09
0A
FA 20 E3 03 02 BB BB BB 08
10 84 01
12 40 00
28 4E 8A 2D 08


ASM Routine at AAAAAA:
Spoiler:
.text
.align 2
.thumb
.thumb_func
.global test

main:
push {lr}
ldr r0, .TargetBank
ldr r1, .BattleData
ldrb r0, [r0]
mov r2, #0x58
mul r2, r0
add r1, #0x20
add r1, r2
mov r3, #0x0
ldrb r4, [r1]
cmp r3, r4
beq Abort
strb r3, [r1]
b End

Abort:
ldr r0, .CurrentScript
ldr r1, .FailScript
str r1, [r0]

End:
pop {r0}
bx r0

.align 2
.BattleData: .word 0x02024084
.UserBank: .word 0x0202420B
.TargetBank: .word 0x0202420C
.BasePower: .word 0x02024400
.CurrentScript: .word 0x02024214
.FailScript: .word 0x082D9F1A
RAW Code:
00 B5 0B 48 08 49 00 78 58 22 42 43 20 31 89 18
0F 23 0C 78 A3 42 01 D0 0B 70 02 E0 06 48 07 49
01 60 01 BC 00 47 C0 46 84 40 02 02 0B 42 02 02
0C 42 02 02 00 44 02 02 14 42 02 02 1A 9F 2D 08


String at BBBBBB:
Spoiler:
FD 10 B4 E7 00 FE BB D6 DD E0 DD E8 ED 00 EB D5
E7 00 E7 E9 E4 E4 E6 D9 E7 E7 D9 D8 AB FF 00

Xencleamas Untitled Pokémon Fan Game (Coming Soon!) Untitled Region (Coming Soon!)
Male
Seen January 10th, 2019
Posted May 4th, 2017
216 posts
6.1 Years
Gastro Acid for Emerald

I'd like to update this effect to add which abilities restricts Gastro Acid. And, finally, porting it to Emerald. However, there is a new Battle Script command introduced in the battle script itself. It is the jumpifabilitypresenttargetfield. But first, you need to do the prerequisite part in this post here, and my default command for that is 0xFC (if not, please change the FC's in the RAW codes).

Battle Script:
Spoiler:
#org @main
attackcanceler
attackstring
ppreduce
jumpifabilitypresenttargetfield 0x7A 0x82D9F1C // Multitype
jumpifabilitypresenttargetfield 0x9D 0x82D9F1C // Magic Bounce
jumpifabilitypresenttargetfield 0xB1 0x82D9F1C // Stance Change
callasm 0x8AAAAAA
attackanimation
waitanimation
setword 0x203E320 0x8BBBBBB
printstring 0x184
waitmessage 0x40
goto 0x82D8A4E
RAW Code:
00 02 03 FC 7A 1C 9F 2D 08 FC 9D 1C 9F 2D 08 FC
B1 1C 9F 2D 08 F9 F5 CD A0 08 09 0A FA 20 E3 03
02 D6 CD A0 08 10 84 01 12 40 00 28 4E 8A 2D 08


ASM Routine at AAAAAA:
Spoiler:
.text
.align 2
.thumb
.thumb_func
.global test

main:
push {lr}
ldr r0, .TargetBank
ldr r1, .BattleData
ldrb r0, [r0]
mov r2, #0x58
mul r2, r0
add r1, #0x20
add r1, r2
mov r3, #0x0
ldrb r4, [r1]
cmp r3, r4
beq Abort
strb r3, [r1]
b End

Abort:
ldr r0, .CurrentScript
ldr r1, .FailScript
str r1, [r0]

End:
pop {r0}
bx r0

.align 2
.BattleData: .word 0x02024084
.UserBank: .word 0x0202420B
.TargetBank: .word 0x0202420C
.BasePower: .word 0x02024400
.CurrentScript: .word 0x02024214
.FailScript: .word 0x082D9F1A
RAW Code:
00 B5 0B 48 08 49 00 78 58 22 42 43 20 31 89 18
0F 23 0C 78 A3 42 01 D0 0B 70 02 E0 06 48 07 49
01 60 01 BC 00 47 C0 46 84 40 02 02 0B 42 02 02
0C 42 02 02 00 44 02 02 14 42 02 02 1A 9F 2D 08


String at BBBBBB:
Spoiler:
FD 10 B4 E7 00 FE BB D6 DD E0 DD E8 ED 00 EB D5
E7 00 E7 E9 E4 E4 E6 D9 E7 E7 D9 D8 AB FF 00
The check target field command is useless, you can simply use jumpifability command with the right parameters (which I don't remember on the top of my head)
But this isn't what you want to do here, you'd simply want to check if the target has one of those abilities, and if so, branch to fail script.
This check can be included in the ASM routine removing the ability

Chacha Dinosaur

Adamant and adaptive dinosaur.

Age 24
Male
Seen March 4th, 2018
Posted September 8th, 2017
454 posts
6.1 Years
Acupressure:

Spoiler:

With the help of IDA, VBA-SDL and some luck I was able to find the cursor routine the controls the target selection for Single Target Moves in Doubles. So the targeting scheme is correct up to standards as of the latest generations.
Set targeting scheme to 2 in your move editor for acupressure. The routines here will automatically handle the range of the cursor for Acupressure.
Modified the random stat selection routine a bit so that the odds of raising different stats are same (previously, the odds of raising the Attack stat was double than the rest).
Due to some stupid reason, I enforced red color stat raise animation for all stats. That is corrected as well.
Also, added handling for the Contrary Ability.
MyLoc is also the location of the Battle Script.

Fire Red:-
Spoiler:

.text
.align 2
.thumb
.thumb_func
.global Acupressure

.equ MyLoc, 0x900000
.equ ContraryID, 0x7F
.equ AcupressureID, 0x___

.equ FaintMarkerBits, 0x2023D70
.equ PowersOfTwo, 0x825E45C
.equ UserBank, 0x02023D6B
.equ TargetBank, 0x02023D6C
.equ BattleData, 0x02023BE4
.equ RNG, 0x8044EC8+1
.equ DivMod, 0x81E4684+1
.equ StatChangeByte, 0x2023FDE
.equ ActiveBank, 0x2023BC4
.equ PokemonTeamID, 0x2023BCE
.equ PlayerPartyPkmData, 0x2024284
.equ MoveIndexChosen, 0x2023FFC
.equ PokemonGetAttr, 0x803FBE8+1
.equ ScriptPointer, 0x02023D74
.equ Comp, 0x0C0C0C00
.equ FailBS, 0x081D7DF2
.equ Return3, 0x802E882+1
.equ Return2, 0x802E7CC+1
.equ Return1, 0x802E86E+1
.equ Return6, 0x802E9A6+1
.equ Return5, 0x802E8F0+1
.equ Return4, 0x802E992+1
.equ Return7, 0x802EB3A+1
.equ Return8, 0x802EB00+1
.equ RomAreaOffset, 0x8000000

@@ Super commands
.macro calculatedamage
.word 0x7060504
.endm

@@ Custom commands
.macro callasm callasm_routine
.byte 0xF8
.word \callasm_routine
.endm

.macro setword YourWordLocation setword_pointer_to_string
.byte 0xFA
.word YourWordLocation
.word \setword_pointer_to_string
.endm

@@ Index commands
.macro attackcanceler
.byte 0
.endm

.macro accuracycheck accuracycheck_address accuracycheck_parameter1
.byte 1
.word \accuracycheck_address
.hword \accuracycheck_parameter1
.endm

.macro attackstring
.byte 2
.endm

.macro ppreduce
.byte 3
.endm

.macro critcalc
.byte 4
.endm


.macro cmd5
.byte 5
.endm

.macro cmd6
.byte 6
.endm

.macro cmd7
.byte 7
.endm

.macro cmd8
.byte 8
.endm

.macro attackanimation
.byte 9
.endm

.macro waitanimation
.byte 0xA
.endm

.macro graphicalhpupdate graphicalhpupdate_bank
.byte 0xB
.byte \graphicalhpupdate_bank
.endm

.macro datahpupdate datahpupdate_bank
.byte 0xC
.byte \datahpupdate_bank
.endm

.macro critmessage
.byte 0xD
.endm

.macro missmessage
.byte 0xE
.endm

.macro resultmessage
.byte 0xF
.endm

.macro printstring printstring_string
.byte 0x10
.hword \printstring_string
.endm

.macro printstring2 printstring2_string
.byte 0x11
.hword \printstring2_string
.endm

.macro waitmessage waitmessage_delay
.byte 0x12
.hword \waitmessage_delay
.endm

.macro printfromtable printfromtable_table
.byte 0x13
.word \printfromtable_table
.endm

.macro printfromtable2 printfromtable2_table
.byte 0x14
.word \printfromtable2_table
.endm

.macro seteffectwithchancetarget
.byte 0x15
.endm

.macro seteffecttarget
.byte 0x16
.endm

.macro seteffectuser
.byte 0x17
.endm

.macro clearstatus clearstatus_bank
.byte 0x18
.byte \clearstatus_bank
.endm

.macro faintpokemon faintpokemon_parameter1 faintpokemon_parameter2 faintpokemon_parameter3
.byte 0x19
.byte \faintpokemon_parameter1
.byte \faintpokemon_parameter2
.word \faintpokemon_parameter3
.endm

.macro cmd1a cmd1a_parameter1
.byte 0x1A
.byte cmd1a_parameter1
.endm

.macro cmd1b cmd1b_bank
.byte 0x1B
.byte \cmd1b_bank
.endm

.macro jumpifstatus jumpifstatus_bank jumpifstatus_status jumpifstatus_address
.byte 0x1C
.byte \jumpifstatus_bank
.word \jumpifstatus_status
.word \jumpifstatus_address
.endm

.macro jumpifsecondartstatus jumpifsecondartstatus_bank jumpifsecondartstatus_status jumpifsecondartstatus_address
.byte 0x1D
.byte \jumpifsecondartstatus_bank
.word \jumpifsecondartstatus_status
.word \jumpifsecondartstatus_address
.endm

.macro jumpifability jumpifability_bank jumpifability_ability jumpifability_address
.byte 0x1E
.byte \jumpifability_bank
.byte \jumpifability_ability
.word \jumpifability_address
.endm

.macro jumpifhalverset jumpifhalverset_bank jumpifhalverset_status jumpifhalverset_address
.byte 0x1F
.byte \jumpifhalverset_bank
.hword \jumpifhalverset_status
.word \jumpifhalverset_address
.endm

.macro jumpifstat jumpifstat_bank jumpifstat_flag jumpifstat_quantity jumpifstat_statid jumpifstat_address
.byte 0x20
.byte \jumpifstat_bank
.byte \jumpifstat_flag
.byte \jumpifstat_quantity
.byte \jumpifstat_statid
.word \jumpifstat_address
.endm

.macro jumpifspecialstatusflag jumpifspecialstatusflag_bank jumpifspecialstatusflag_word_to_and  jumpifspecialstatusflag_address
.byte 0x21
.byte \jumpifspecialstatusflag_bank
.word \jumpifspecialstatusflag_word_to_and
.byte \jumpifspecialstatusflag_statut
.word \jumpifspecialstatusflag_address
.endm

.macro jumpiftype jumpiftype_bank jumpiftype_type jumpiftype_address
.byte 0x22
.byte \jumpiftype_bank
.byte \jumpiftype_type
.word \jumpiftype_address
.endm

.macro cmd23 cmd23_side_or_bank
.byte 0x23
.byte \cmd23_side_or_bank
.endm

.macro gotoandsomething gotoandsomething_address
.byte 0x24
.word \gotoandsomething_address
.endm

.macro cmd25
.byte 0x25
.endm

.macro cmd26 cmd26_param1
.byte 0x26
.byte \cmd26_param1
.endm

.macro cmd27 cmd27_address
.byte 0x27
.word \cmd27_address
.endm

.macro goto goto_address
.byte 0x28
.word \goto_address
.endm

.macro jumpifbyte jumpifbyte_ifflag jumpifbyte_checkaddr jumpifbyte_compare jumpifbyte_address
.byte 0x29
.byte \jumpifbyte_ifflag
.word \jumpifbyte_checkaddr
.byte \jumpifbyte_compare
.word \jumpifbyte_address
.endm

.macro jumpifhalfword jumpifhalfword_ifflag jumpifhalfword_checkaddr jumpifhalfword_compare jumpifhalfword_address
.byte 0x2A
.byte \jumpifhalfword_ifflag
.word \jumpifhalfword_checkaddr
.hword \jumpifhalfword_compare
.word \jumpifhalfword_address
.endm

.macro jumpifword jumpifword_ifflag jumpifword_checkaddr jumpifword_compare jumpifword_address
.byte 0x2B
.byte \jumpifword_ifflag
.word \jumpifword_checkaddr
.word \jumpifword_compare
.word \jumpifword_address
.endm

.macro jumpifarrayequal jumpifarrayequal_mem1 jumpifarrayequal_mem2 jumpifarrayequal_size jumpifarrayequal_address
.byte 0x2C
.word \jumpifarrayequal_mem1
.word \jumpifarrayequal_mem2
.byte \jumpifarrayequal_size
.word \jumpifarrayequal_address
.endm

.macro jumpifarraynotequal jumpifarraynotequal_mem1 jumpifarraynotequal_mem2 jumpifarraynotequal_size jumpifarraynotequal_address
.byte 0x2D
.word \jumpifarraynotequal_mem1
.word \jumpifarraynotequal_mem2
.byte \jumpifarraynotequal_size
.word \jumpifarraynotequal_address
.endm

.macro setbyte setbyte_pointer setbyte_value
.byte 0x2E
.word \setbyte_pointer
.byte \setbyte_value
.endm

.macro addbyte addbyte_pointer addbyte_value
.byte 0x2F
.word \addbyte_pointer
.byte \addbyte_value
.endm

.macro subtractbyte subtractbyte_pointer subtractbyte_value
.byte 0x30
.word \subtractbyte_pointer
.byte \subtractbyte_value
.endm

.macro copyarray copyarray_destination copyarray_source copyarray_size
.byte 0x31
.word \copyarray_destination
.word \copyarray_source
.byte \copyarray_size
.endm

.macro cmd32 cmd32_param1 cmd32_param2 cmd32_param3 cmd32_byte
.byte 0x32
.word \cmd32_param1
.word \cmd32_param2
.word \cmd32_param3
.byte \cmd32_byte
.endm

.macro orbyte orbyte_pointer orbyte_value
.byte 0x33
.word \orbyte_pointer
.byte \orbyte_value
.endm

.macro orhalfword orhalfword_pointer orhalfword_value
.byte 0x34
.word \orhalfword_pointer
.hword \orhalfword_value
.endm

.macro orword orword_pointer orword_value
.byte 0x35
.word \orword_pointer
.word \orword_value
.endm

.macro bicbyte bicbyte_pointer bicbyte_value
.byte 0x36
.word \bicbyte_pointer
.byte \bicbyte_value
.endm

.macro bichalfword bichalfword_pointer bichalfword_value
.byte 0x37
.word \bichalfword_pointer
.hword \bichalfword_value
.endm

.macro bicword bicword_pointer bicword_value
.byte 0x38
.word \bicword_pointer
.word \bicword_value
.endm

.macro pause pause_duration
.byte 0x39
.hword \pause_duration
.endm

.macro waitstate
.byte 0x3A
.endm

.macro somethinghealcmd3b somethinghealcmd3b_bank
.byte 0x3B
.byte \somethinghealcmd3b_bank
.endm

.macro return
.byte 0x3C
.endm

.macro end
.byte 0x3D
.endm

.macro end2
.byte 0x3E
.endm

.macro end3
.byte 0x3F
.endm

.macro cmd40 cmd40_address
.byte 0x40
.word \cmd40_address
.endm

.macro call call_address
.byte 0x41
.word \call_address
.endm

.macro jumpiftype2 jumpiftype2_bank jumpiftype2_type jumpiftype2_address
.byte 0x42
.byte \jumpiftype2_bank
.byte \jumpiftype2_type
.word \jumpiftype2_address
.endm

.macro jumpifabilitypresent jumpifabilitypresent_ability jumpifabilitypresent_address
.byte 0x43
.byte \jumpifabilitypresent_ability
.word \jumpifabilitypresent_address
.endm

.macro cmd44
.byte 0x44
.endm

.macro playanimation playanimation_bank playanimation_animation playanimation_word
.byte 0x45
.byte \playanimation_bank
.byte \playanimation_animation
.word \playanimation_word
.endm

.macro cmd46 cmd46_bank cmd46_address cmd46_address2
.byte 0x46
.byte \cmd46_bank
.word \cmd46_address
.word \cmd46_address2
.endm

.macro cmd47
.byte 0x47
.endm

.macro playstatchangeanimation playstatchangeanimation_bank playstatchangeanimation_colour playstatchangeanimation_byte
.byte 0x48
.byte \playstatchangeanimation_bank
.byte \playstatchangeanimation_colour
.byte \playstatchangeanimation_byte
.endm

.macro cmd49 cmd49_byte1 cmd49_byte2
.byte 0x49
.byte \cmd49_byte1
.byte \cmd49_byte2
.endm

.macro damagecalc2
.byte 0x4A
.endm

.macro cmd4b
.byte 0x4B
.endm

.macro switch1 switch1_bank
.byte 0x4C
.byte \switch1_bank
.endm

.macro switch2 switch2_bank
.byte 0x4D
.byte \switch2_bank
.endm

.macro switch3 switch3_bank switch3_byte
.byte 0x4E
.byte \switch3_bank
.byte \switch3_byte
.endm

.macro jumpifcannotswitch jumpifcannotswitch_bank jumpifcannotswitch_address
.byte 0x4F
.byte \jumpifcannotswitch_bank
.word \jumpifcannotswitch_address
.endm

.macro openpartyscreen openpartyscreen_bank openpartyscreen_address
.byte 0x50
.byte \openpartyscreen_bank
.word \openpartyscreen_address
.endm

.macro cmd51 cmd51_bank cmd51_param2
.byte 0x51
.byte \cmd51_bank
.byte \cmd51_param2
.endm

.macro cmd52 cmd52_bank
.byte 0x52
.byte \cmd52_bank
.endm

.macro cmd53 cmd53_bank
.byte 0x53
.byte \cmd53_bank
.endm

.macro cmd54 cmd54_hword
.byte 0x54
.hword \cmd54_hword
.endm

.macro cmd55 cmd55_word
.byte 0x55
.word \cmd55_word
.endm

.macro cmd56 cmd56_bank_or_side
.byte 0x56
.byte \cmd56_bank_or_side
.endm

.macro cmd57
.byte 0x57
.endm

.macro cmd58 cmd58_bank
.byte 0x58
.byte \cmd58_bank
.endm

.macro checkiflearnmoveinbattle checkiflearnmoveinbattle_param1 checkiflearnmoveinbattle_param2 checkiflearnmoveinbattle_bank_maybe
.byte 0x59
.word \checkiflearnmoveinbattle_param1
.word \checkiflearnmoveinbattle_param2
.byte \checkiflearnmoveinbattle_bank_maybe
.endm

.macro cmd5a cmd5a_address
.byte 0x5A
.word \cmd5a_address
.endm

.macro cmd5b cmd5b_address
.byte 0x5B
.word \cmd5b_address
.endm

.macro cmd5c cmd5c_bank
.byte 0x5C
.byte \cmd5c_bank
.endm

.macro cmd5d
.byte 0x5D
.endm

.macro cmd5e cmd5e_bank
.byte 0x5E
.byte \cmd5e_bank
.endm

.macro cmd5f
.byte 0x5F
.endm

.macro cmd60 cmd60_byte
.byte 0x60
.byte \cmd60_byte
.endm

.macro cmd61 cmd61_bank_or_side
.byte 0x61
.byte \cmd61_bank_or_side
.endm

.macro cmd62 cmd62_bank_or_side
.byte 0x62
.byte \cmd62_bank_or_side
.endm

.macro jumptoattack jumptoattack_bank
.byte 0x63
.byte \jumptoattack_bank
.endm

.macro statusanimation statusanimation_bank
.byte 0x64
.byte \statusanimation_bank
.endm

.macro cmd65 cmd65_bank_or_side cmd65_address
.byte 0x65
.byte \cmd65_bank_or_side
.word \cmd65_address
.endm

.macro cmd66 cmd66_bank_or_side cmd66_bank_or_side2 cmd66_address
.byte 0x66
.byte \cmd66_bank_or_side
.byte \cmd66_bank_or_side2
.word \cmd66_address
.endm

.macro cmd67
.byte 0x67
.endm

.macro cmd68
.byte 0x68
.endm

.macro cmd69
.byte 0x69
.endm

.macro removeitem removeitem_bank
.byte 0x6A
.byte \removeitem_bank
.endm

.macro cmd6b
.byte 0x6B
.endm

.macro cmd6c
.byte 0x6C
.endm

.macro cmd6d
.byte 0x6D
.endm

.macro cmd6e
.byte 0x6E
.endm

.macro cmd6f cmd6f_bank
.byte 0x6F
.byte \cmd6f_bank
.endm

.macro cmd70 cmd70_bank
.byte 0x70
.byte \cmd70_bank
.endm

.macro cmd71
.byte 0x71
.endm

.macro cmd72 cmd72_address
.byte 0x72
.word \cmd72_address
.endm

.macro cmd73 cmd73_bank
.byte 0x73
.byte \cmd73_bank
.endm

.macro cmd74 cmd74_bank
.byte 0x74
.byte \cmd74_bank
.endm

.macro cmd75
.byte 0x75
.endm

.macro cmd76 cmd76_bank cmd76_byte
.byte 0x76
.byte \cmd76_bank
.byte \cmd76_byte
.endm

.macro setprotect
.byte 0x77
.endm

.macro faintifabilitynotdamp
.byte 0x78
.endm

.macro setuserhptozero
.byte 0x79
.endm

.macro jumpwhiletargetvalid jumpwhiletargetvalid_address
.byte 0x7A
.word \jumpwhiletargetvalid_address
.endm

.macro setdamageasrestorehalfmaxhp setdamageasrestorehalfmaxhp_address setdamageasrestorehalfmaxhp_byte
.byte 0x7B
.word \setdamageasrestorehalfmaxhp_address
.byte \setdamageasrestorehalfmaxhp_byte
.endm

.macro jumptolastusedattack
.byte 0x7C
.endm

.macro setrain
.byte 0x7D
.endm

.macro setreflect
.byte 0x7E
.endm

.macro setleechseed
.byte 0x7F
.endm

.macro manipulatedamage
.byte 0x80
.endm

.macro setrest setrest_address
.byte 0x81
.word \setrest_address
.endm

.macro jumpifnotfirstturn jumpifnotfirstturn_address
.byte 0x82
.word \jumpifnotfirstturn_address
.endm

.macro nop3
.byte 0x83
.endm

.macro jumpifcannotsleep jumpifcannotsleep_address
.byte 0x84
.word \jumpifcannotsleep_address
.endm

.macro stockpile
.byte 0x85
.endm

.macro stockpiletobasedamage stockpiletobasedamage_address
.byte 0x86
.word \stockpiletobasedamage_address
.endm

.macro stockpiletohprecovery stockpiletohprecovery_address
.byte 0x87
.word \stockpiletohprecovery_address
.endm

.macro negativedamage
.byte 0x88
.endm

.macro statbuffchange statbuffchange_target statbuffchange_address
.byte 0x89
.byte \statbuffchange_target
.word \statbuffchange_address
.endm

.macro normalisebuffs
.byte 0x8A
.endm

.macro setbide
.byte 0x8B
.endm

.macro confuseifrepeatingattackends
.byte 0x8C
.endm

.macro setloopcounter setloopcounter_number_of_loop
.byte 0x8D
.byte \setloopcounter_number_of_loop
.endm

.macro cmd8e
.byte 0x8E
.endm

.macro cmd98 cmd98_byte
.byte 0x98
.byte \cmd98_byte
.endm



.org 0x2E828, 0xFF
ldr r1, Hook1
bx r1
.align 2
Hook1: .word RomAreaOffset+StoreBankForValidityCheck+1

.org 0x2E94C, 0xFF
ldr r1, Hook2
bx r1
.align 2
Hook2: .word RomAreaOffset+StoreBankForValidityCheck2+1

.org 0x2EADC, 0xFf
ldr r0, Hook3
bx r0
.align 2
Hook3: .word RomAreaOffset+CheckMoveID2+1

.org 0x2EAF8, 0xFF
ldr r0, Hook4
bx r0
.align 2
Hook4: .word RomAreaOffset+TargetRangeCheck+1



.org MyLoc, 0xFF
@ Battle Script Main
callasm TargetCorrector+RomAreaOffset+1
attackcanceler
attackstring
ppreduce
callasm CheckAcuSuccess+RomAreaOffset+1
attackanimation
waitanimation
callasm RandomStatRaise+RomAreaOffset+1
statbuffchange 0x1 0x81D694E
jumpifbyte 0x0 0x2023E87 0x2 0x81D694E
cmd47
playanimation 0x0 0x1 0x2023FD4
printfromtable 0x83FE57C
waitmessage 0x40
goto 0x81D694E

@@Handles exceptions in case target is out of Range.
.align 2
TargetCorrector:
    ldr r2, =UserBank
    ldrb r0, [r2, #0x0]
    ldrb r1, [r2, #0x1]
    cmp r0, r1
    beq EndCorrector

CompareUserTargetSides:
    mov r3, #0x2
    eor r3, r1
    cmp r3, r0
    bne MakeUserTheTarget

CheckForFaintedAlly:
    ldr r3, =FaintMarkerBits
    ldrb r3, [r3]
    ldr r4, =PowersOfTwo
    lsl r1, r1, #0x2
    add r4, r1, r4
    ldrb r4, [r4]
    and r4, r3
    cmp r4, #0x0
    beq EndCorrector
   
MakeUserTheTarget:
    strb r0, [r2, #0x1]
    
EndCorrector:
    bx lr
    
.align 2
.pool

.align 2
@Checks For Ally's Subsitute or All Stats Maxed Out.
CheckAcuSuccess:
    push {lr}
    ldr r0, =UserBank
    ldrb r0, [r0, #0x1]
    ldr r1, =BattleData
    mov r2, #0x58
    mul r2, r0
    add r3, r2, r1
    ldr r1, =UserBank
    ldrb r1, [r1]
    cmp r1, r0
    beq NoSub 

SubstituteCheck:
    ldr r4, [r3, #0x50]
    mov r5, #0x80
    lsl r5, r5, #0x11
    cmp r4, r5
    beq FailAcu

NoSub:
    mov r6, #0x20
    add r6, r3, r6
    ldrb r6, [r6]
    ldr r7, =ContraryID
    cmp r6, r7
    beq ContraryHandler
    ldr r4, [r3, #0x18]
    ldr r5, =Comp
    cmp r4, r5
    ble CheckSuccessEnd

AllMax:
    ldr r4, [r3, #0x1C]
    add r5, #0xC
    cmp r4, r5
    bne CheckSuccessEnd
    b FailAcu

ContraryHandler:
    ldr r4, [r3, #0x18]
    cmp r4, #0xC
    bne CheckSuccessEnd

Allmin:
    ldr r4, [r3, #0x1C]
    cmp r4, #0x0
    bne CheckSuccessEnd

FailAcu:
    ldr r1, =FailBS
    sub r1, #0x5
    ldr r0, =ScriptPointer
    str r1, [r0]

CheckSuccessEnd:
    pop {r0}
    bx r0

.align 2
.pool

RandomStatRaise:
   push {lr}
   ldr r0, =TargetBank
   ldrb r0, [r0]
   ldr r1, =BattleData
   mov r2, #0x58
   mul r0, r2
   add r7, r0, r1
   add r7, #0x19
   add r5, r7, #0x7
   ldrb r5, [r5]
   ldr r4, =ContraryID

StatSelector:
   ldr r2, =RNG
   bl Linker
   lsl r0, r0, #0x10
   lsr r0, r0, #0x10
   mov r1, #0x7
   ldr r2, =DivMod
   bl Linker
   add r6, r0, r7
   ldrb r1, [r6]
   cmp r4, r5
   beq ContraryCheck
   cmp r1, #0xC
   bne Selected
   b StatSelector

ContraryCheck:
   cmp r1, #0x0
   beq StatSelector

Selected:
   mov r2, #0x21
   add r0, r0, r2
   ldr r1, =StatChangeByte
   strb r0, [r1]
   pop {r0}
   bx r0 

Linker:
   bx r2

.align 2
.pool

@Control Cursor Range If Up Or Left Button is Pressed.
.align 2
StoreBankForValidityCheck:
    push {r0}

LoadSelectedMove:
    
    ldr r2, =ActiveBank
    ldr r1, =PokemonTeamID
    ldrb r2, [r2]
    lsl r0, r2, #1
    add r0, r0, r1
    ldrh r1, [r0]
    mov r0, #0x64
    mul r0, r1
    ldr r1, =PlayerPartyPkmData
    add r0, r0, r1
    ldr r1, =MoveIndexChosen
    add r2, r2, r1
    ldrb r1, [r2]
    add r1, #0xD
    ldr r2, =PokemonGetAttr
    bl Linker2
    ldr r2, =AcupressureID
    cmp r0, r2
    bne NormalMoveCursorManipulation   

AcupressureCurserManipulation:
    pop {r0}
    cmp r0, #0x0
    beq ValidCursor
    cmp r0, #0x2
    beq ValidCursor
    b InvalidCursor

NormalMoveCursorManipulation:
    mov r3, r0
    pop {r0}
    cmp r0, #0x0
    blt InvalidCursor
    cmp r0, #0x4
    bge InvalidCursor
    cmp r0, #0x1
    beq ValidCursor
    cmp r0, #0x3
    beq ValidCursor

UserTargetCheck:
    ldr r2, =ActiveBank
    ldrb r0, [r2]
    ldrb r1, [r5]
    cmp r0, r1
    bne ValidCursor    

SameUserTarget:
    mov r0, r3
    ldr r2, =Return1
    bx r2

InvalidCursor:
    ldr r2, =Return2
    bx r2

ValidCursor:
    ldr r2, =Return3

Linker2:
    bx r2    
.align 2
.pool


@Control Cursor Range If Down Or Right Button is Pressed.
.align 2
StoreBankForValidityCheck2:
    push {r0}

LoadSelectedMove2:
    
    ldr r2, =ActiveBank
    ldr r1, =PokemonTeamID
    ldrb r2, [r2]
    lsl r0, r2, #1
    add r0, r0, r1
    ldrh r1, [r0]
    mov r0, #0x64
    mul r0, r1
    ldr r1, =PlayerPartyPkmData
    add r0, r0, r1
    ldr r1, =MoveIndexChosen
    add r2, r2, r1
    ldrb r1, [r2]
    add r1, #0xD
    ldr r2, =PokemonGetAttr
    bl Linker3
    ldr r2, =AcupressureID
    cmp r0, r2
    bne NormalMoveCursorManipulation2  

AcupressureCurserManipulation2:
    pop {r0}
    cmp r0, #0x0
    beq ValidCursor2
    cmp r0, #0x2
    beq ValidCursor2
    b InvalidCursor2

NormalMoveCursorManipulation2:
    mov r3, r0
    pop {r0}
    cmp r0, #0x0
    blt InvalidCursor2
    cmp r0, #0x4
    bge InvalidCursor2
    cmp r0, #0x1
    beq ValidCursor2
    cmp r0, #0x3
    beq ValidCursor2

UserTargetCheck2:
    ldr r2, =ActiveBank
    ldrb r0, [r2]
    ldrb r1, [r5]
    cmp r0, r1
    bne ValidCursor2    

SameUserTarget2:
    mov r0, r3
    ldr r2, =Return4
    bx r2

InvalidCursor2:
    ldr r2, =Return5
    bx r2

ValidCursor2:
    ldr r2, =Return6

Linker3:
    bx r2    
.align 2
.pool

.align 2
@Disable Cursor Routine for Acupressure in case of Fainted Ally.
TargetRangeCheck:
    mov r0, #0x7D
    and r0, r4
    cmp r0, #0x0
    bne NoCursor

CheckMoveID:
    ldr r0, =MoveIndexChosen
    add r0, r0, r2
    ldrb r0, [r0]
    lsl r0, r0, #0x1
    add r0, r0, r7
    ldrh r0, [r0]
    ldr r1, =AcupressureID 
    cmp r0, r1
    bne EnableCursor

CheckFaintedAlly:
    mov r3, #0x2
    eor r3, r2
    ldr r1, =PowersOfTwo
    lsl r3, r3, #2
    add r1, r1, r3
    ldr r1, [r1]
    ldr r0, =FaintMarkerBits
    ldrb r0, [r0]
    and r0, r1
    cmp r0, #0x0
    beq EnableCursor

NoCursor:
    ldr r0, =Return7
    bx r0            

EnableCursor:
    ldr r0, =Return8
    bx r0

.align 2
.pool

@Disable Cursor Routine for Acupressure in Singles.
.align 2
CheckMoveID2:
    ldr r0, =MoveIndexChosen
    add r0, r0, r2
    ldrb r0, [r0]
    lsl r0, r0, #0x1
    add r0, r0, r7
    ldrh r0, [r0]
    ldr r2, =AcupressureID 
    cmp r0, r2
    beq NoCursor2
    add r0, r3, #2
    add r0, r1, r0
    ldrb r0, [r0]
    cmp r0, #0x0
    bne NoCursor2

EnableCursor2:
    mov r0, #0x1
    mov r8, r0
    
NoCursor2:
    ldr r0, =Return7
    bx r0
  
.align 2
.pool


Emerald:-
Spoiler:

.text
.align 2
.thumb
.thumb_func
.global Acupressure

.equ MyLoc, 0x9c2000
.equ ContraryID, 0x7F
.equ AcupressureID, 0x___

.equ FaintMarkerBits, 0x2024210
.equ PowersOfTwo, 0x832A328
.equ UserBank, 0x0202420B
.equ TargetBank, 0x0202420C
.equ BattleData, 0x02024084
.equ RNG, 0x806F5CC+1
.equ DivMod, 0x82E7BE0+1
.equ StatChangeByte, 0x202448E
.equ ActiveBank, 0x2024064
.equ PokemonTeamID, 0x202406E
.equ PlayerPartyPkmData, 0x20244EC
.equ MoveIndexChosen, 0x20244B0
.equ PokemonGetAttr, 0x806A518+1
.equ ScriptPointer, 0x02024214
.equ Comp, 0x0C0C0C00
.equ FailBS, 0x082D9F1C
.equ Return3, 0x8057A6E+1
.equ Return2, 0x80579B8+1
.equ Return1, 0x8057A5A+1
.equ Return6, 0x8057B92+1
.equ Return5, 0x8057ADC+1
.equ Return4, 0x8057B7E+1
.equ Return7, 0x8057D62+1
.equ Return8, 0x8057D20+1
.equ Return9, 0x8057D5A+1
.equ RomAreaOffset, 0x8000000

@@ Super commands
.macro calculatedamage
.word 0x7060504
.endm

@@ Custom commands
.macro callasm callasm_routine
.byte 0xF9
.word \callasm_routine
.endm

.macro setword YourWordLocation setword_pointer_to_string
.byte 0xFA
.word YourWordLocation
.word \setword_pointer_to_string
.endm

@@ Index commands
.macro attackcanceler
.byte 0
.endm

.macro accuracycheck accuracycheck_address accuracycheck_parameter1
.byte 1
.word \accuracycheck_address
.hword \accuracycheck_parameter1
.endm

.macro attackstring
.byte 2
.endm

.macro ppreduce
.byte 3
.endm

.macro critcalc
.byte 4
.endm


.macro cmd5
.byte 5
.endm

.macro cmd6
.byte 6
.endm

.macro cmd7
.byte 7
.endm

.macro cmd8
.byte 8
.endm

.macro attackanimation
.byte 9
.endm

.macro waitanimation
.byte 0xA
.endm

.macro graphicalhpupdate graphicalhpupdate_bank
.byte 0xB
.byte \graphicalhpupdate_bank
.endm

.macro datahpupdate datahpupdate_bank
.byte 0xC
.byte \datahpupdate_bank
.endm

.macro critmessage
.byte 0xD
.endm

.macro missmessage
.byte 0xE
.endm

.macro resultmessage
.byte 0xF
.endm

.macro printstring printstring_string
.byte 0x10
.hword \printstring_string
.endm

.macro printstring2 printstring2_string
.byte 0x11
.hword \printstring2_string
.endm

.macro waitmessage waitmessage_delay
.byte 0x12
.hword \waitmessage_delay
.endm

.macro printfromtable printfromtable_table
.byte 0x13
.word \printfromtable_table
.endm

.macro printfromtable2 printfromtable2_table
.byte 0x14
.word \printfromtable2_table
.endm

.macro seteffectwithchancetarget
.byte 0x15
.endm

.macro seteffecttarget
.byte 0x16
.endm

.macro seteffectuser
.byte 0x17
.endm

.macro clearstatus clearstatus_bank
.byte 0x18
.byte \clearstatus_bank
.endm

.macro faintpokemon faintpokemon_parameter1 faintpokemon_parameter2 faintpokemon_parameter3
.byte 0x19
.byte \faintpokemon_parameter1
.byte \faintpokemon_parameter2
.word \faintpokemon_parameter3
.endm

.macro cmd1a cmd1a_parameter1
.byte 0x1A
.byte cmd1a_parameter1
.endm

.macro cmd1b cmd1b_bank
.byte 0x1B
.byte \cmd1b_bank
.endm

.macro jumpifstatus jumpifstatus_bank jumpifstatus_status jumpifstatus_address
.byte 0x1C
.byte \jumpifstatus_bank
.word \jumpifstatus_status
.word \jumpifstatus_address
.endm

.macro jumpifsecondartstatus jumpifsecondartstatus_bank jumpifsecondartstatus_status jumpifsecondartstatus_address
.byte 0x1D
.byte \jumpifsecondartstatus_bank
.word \jumpifsecondartstatus_status
.word \jumpifsecondartstatus_address
.endm

.macro jumpifability jumpifability_bank jumpifability_ability jumpifability_address
.byte 0x1E
.byte \jumpifability_bank
.byte \jumpifability_ability
.word \jumpifability_address
.endm

.macro jumpifhalverset jumpifhalverset_bank jumpifhalverset_status jumpifhalverset_address
.byte 0x1F
.byte \jumpifhalverset_bank
.hword \jumpifhalverset_status
.word \jumpifhalverset_address
.endm

.macro jumpifstat jumpifstat_bank jumpifstat_flag jumpifstat_quantity jumpifstat_statid jumpifstat_address
.byte 0x20
.byte \jumpifstat_bank
.byte \jumpifstat_flag
.byte \jumpifstat_quantity
.byte \jumpifstat_statid
.word \jumpifstat_address
.endm

.macro jumpifspecialstatusflag jumpifspecialstatusflag_bank jumpifspecialstatusflag_word_to_and  jumpifspecialstatusflag_address
.byte 0x21
.byte \jumpifspecialstatusflag_bank
.word \jumpifspecialstatusflag_word_to_and
.byte \jumpifspecialstatusflag_statut
.word \jumpifspecialstatusflag_address
.endm

.macro jumpiftype jumpiftype_bank jumpiftype_type jumpiftype_address
.byte 0x22
.byte \jumpiftype_bank
.byte \jumpiftype_type
.word \jumpiftype_address
.endm

.macro cmd23 cmd23_side_or_bank
.byte 0x23
.byte \cmd23_side_or_bank
.endm

.macro gotoandsomething gotoandsomething_address
.byte 0x24
.word \gotoandsomething_address
.endm

.macro cmd25
.byte 0x25
.endm

.macro cmd26 cmd26_param1
.byte 0x26
.byte \cmd26_param1
.endm

.macro cmd27 cmd27_address
.byte 0x27
.word \cmd27_address
.endm

.macro goto goto_address
.byte 0x28
.word \goto_address
.endm

.macro jumpifbyte jumpifbyte_ifflag jumpifbyte_checkaddr jumpifbyte_compare jumpifbyte_address
.byte 0x29
.byte \jumpifbyte_ifflag
.word \jumpifbyte_checkaddr
.byte \jumpifbyte_compare
.word \jumpifbyte_address
.endm

.macro jumpifhalfword jumpifhalfword_ifflag jumpifhalfword_checkaddr jumpifhalfword_compare jumpifhalfword_address
.byte 0x2A
.byte \jumpifhalfword_ifflag
.word \jumpifhalfword_checkaddr
.hword \jumpifhalfword_compare
.word \jumpifhalfword_address
.endm

.macro jumpifword jumpifword_ifflag jumpifword_checkaddr jumpifword_compare jumpifword_address
.byte 0x2B
.byte \jumpifword_ifflag
.word \jumpifword_checkaddr
.word \jumpifword_compare
.word \jumpifword_address
.endm

.macro jumpifarrayequal jumpifarrayequal_mem1 jumpifarrayequal_mem2 jumpifarrayequal_size jumpifarrayequal_address
.byte 0x2C
.word \jumpifarrayequal_mem1
.word \jumpifarrayequal_mem2
.byte \jumpifarrayequal_size
.word \jumpifarrayequal_address
.endm

.macro jumpifarraynotequal jumpifarraynotequal_mem1 jumpifarraynotequal_mem2 jumpifarraynotequal_size jumpifarraynotequal_address
.byte 0x2D
.word \jumpifarraynotequal_mem1
.word \jumpifarraynotequal_mem2
.byte \jumpifarraynotequal_size
.word \jumpifarraynotequal_address
.endm

.macro setbyte setbyte_pointer setbyte_value
.byte 0x2E
.word \setbyte_pointer
.byte \setbyte_value
.endm

.macro addbyte addbyte_pointer addbyte_value
.byte 0x2F
.word \addbyte_pointer
.byte \addbyte_value
.endm

.macro subtractbyte subtractbyte_pointer subtractbyte_value
.byte 0x30
.word \subtractbyte_pointer
.byte \subtractbyte_value
.endm

.macro copyarray copyarray_destination copyarray_source copyarray_size
.byte 0x31
.word \copyarray_destination
.word \copyarray_source
.byte \copyarray_size
.endm

.macro cmd32 cmd32_param1 cmd32_param2 cmd32_param3 cmd32_byte
.byte 0x32
.word \cmd32_param1
.word \cmd32_param2
.word \cmd32_param3
.byte \cmd32_byte
.endm

.macro orbyte orbyte_pointer orbyte_value
.byte 0x33
.word \orbyte_pointer
.byte \orbyte_value
.endm

.macro orhalfword orhalfword_pointer orhalfword_value
.byte 0x34
.word \orhalfword_pointer
.hword \orhalfword_value
.endm

.macro orword orword_pointer orword_value
.byte 0x35
.word \orword_pointer
.word \orword_value
.endm

.macro bicbyte bicbyte_pointer bicbyte_value
.byte 0x36
.word \bicbyte_pointer
.byte \bicbyte_value
.endm

.macro bichalfword bichalfword_pointer bichalfword_value
.byte 0x37
.word \bichalfword_pointer
.hword \bichalfword_value
.endm

.macro bicword bicword_pointer bicword_value
.byte 0x38
.word \bicword_pointer
.word \bicword_value
.endm

.macro pause pause_duration
.byte 0x39
.hword \pause_duration
.endm

.macro waitstate
.byte 0x3A
.endm

.macro somethinghealcmd3b somethinghealcmd3b_bank
.byte 0x3B
.byte \somethinghealcmd3b_bank
.endm

.macro return
.byte 0x3C
.endm

.macro end
.byte 0x3D
.endm

.macro end2
.byte 0x3E
.endm

.macro end3
.byte 0x3F
.endm

.macro cmd40 cmd40_address
.byte 0x40
.word \cmd40_address
.endm

.macro call call_address
.byte 0x41
.word \call_address
.endm

.macro jumpiftype2 jumpiftype2_bank jumpiftype2_type jumpiftype2_address
.byte 0x42
.byte \jumpiftype2_bank
.byte \jumpiftype2_type
.word \jumpiftype2_address
.endm

.macro jumpifabilitypresent jumpifabilitypresent_ability jumpifabilitypresent_address
.byte 0x43
.byte \jumpifabilitypresent_ability
.word \jumpifabilitypresent_address
.endm

.macro cmd44
.byte 0x44
.endm

.macro playanimation playanimation_bank playanimation_animation playanimation_word
.byte 0x45
.byte \playanimation_bank
.byte \playanimation_animation
.word \playanimation_word
.endm

.macro cmd46 cmd46_bank cmd46_address cmd46_address2
.byte 0x46
.byte \cmd46_bank
.word \cmd46_address
.word \cmd46_address2
.endm

.macro cmd47
.byte 0x47
.endm

.macro playstatchangeanimation playstatchangeanimation_bank playstatchangeanimation_colour playstatchangeanimation_byte
.byte 0x48
.byte \playstatchangeanimation_bank
.byte \playstatchangeanimation_colour
.byte \playstatchangeanimation_byte
.endm

.macro cmd49 cmd49_byte1 cmd49_byte2
.byte 0x49
.byte \cmd49_byte1
.byte \cmd49_byte2
.endm

.macro damagecalc2
.byte 0x4A
.endm

.macro cmd4b
.byte 0x4B
.endm

.macro switch1 switch1_bank
.byte 0x4C
.byte \switch1_bank
.endm

.macro switch2 switch2_bank
.byte 0x4D
.byte \switch2_bank
.endm

.macro switch3 switch3_bank switch3_byte
.byte 0x4E
.byte \switch3_bank
.byte \switch3_byte
.endm

.macro jumpifcannotswitch jumpifcannotswitch_bank jumpifcannotswitch_address
.byte 0x4F
.byte \jumpifcannotswitch_bank
.word \jumpifcannotswitch_address
.endm

.macro openpartyscreen openpartyscreen_bank openpartyscreen_address
.byte 0x50
.byte \openpartyscreen_bank
.word \openpartyscreen_address
.endm

.macro cmd51 cmd51_bank cmd51_param2
.byte 0x51
.byte \cmd51_bank
.byte \cmd51_param2
.endm

.macro cmd52 cmd52_bank
.byte 0x52
.byte \cmd52_bank
.endm

.macro cmd53 cmd53_bank
.byte 0x53
.byte \cmd53_bank
.endm

.macro cmd54 cmd54_hword
.byte 0x54
.hword \cmd54_hword
.endm

.macro cmd55 cmd55_word
.byte 0x55
.word \cmd55_word
.endm

.macro cmd56 cmd56_bank_or_side
.byte 0x56
.byte \cmd56_bank_or_side
.endm

.macro cmd57
.byte 0x57
.endm

.macro cmd58 cmd58_bank
.byte 0x58
.byte \cmd58_bank
.endm

.macro checkiflearnmoveinbattle checkiflearnmoveinbattle_param1 checkiflearnmoveinbattle_param2 checkiflearnmoveinbattle_bank_maybe
.byte 0x59
.word \checkiflearnmoveinbattle_param1
.word \checkiflearnmoveinbattle_param2
.byte \checkiflearnmoveinbattle_bank_maybe
.endm

.macro cmd5a cmd5a_address
.byte 0x5A
.word \cmd5a_address
.endm

.macro cmd5b cmd5b_address
.byte 0x5B
.word \cmd5b_address
.endm

.macro cmd5c cmd5c_bank
.byte 0x5C
.byte \cmd5c_bank
.endm

.macro cmd5d
.byte 0x5D
.endm

.macro cmd5e cmd5e_bank
.byte 0x5E
.byte \cmd5e_bank
.endm

.macro cmd5f
.byte 0x5F
.endm

.macro cmd60 cmd60_byte
.byte 0x60
.byte \cmd60_byte
.endm

.macro cmd61 cmd61_bank_or_side
.byte 0x61
.byte \cmd61_bank_or_side
.endm

.macro cmd62 cmd62_bank_or_side
.byte 0x62
.byte \cmd62_bank_or_side
.endm

.macro jumptoattack jumptoattack_bank
.byte 0x63
.byte \jumptoattack_bank
.endm

.macro statusanimation statusanimation_bank
.byte 0x64
.byte \statusanimation_bank
.endm

.macro cmd65 cmd65_bank_or_side cmd65_address
.byte 0x65
.byte \cmd65_bank_or_side
.word \cmd65_address
.endm

.macro cmd66 cmd66_bank_or_side cmd66_bank_or_side2 cmd66_address
.byte 0x66
.byte \cmd66_bank_or_side
.byte \cmd66_bank_or_side2
.word \cmd66_address
.endm

.macro cmd67
.byte 0x67
.endm

.macro cmd68
.byte 0x68
.endm

.macro cmd69
.byte 0x69
.endm

.macro removeitem removeitem_bank
.byte 0x6A
.byte \removeitem_bank
.endm

.macro cmd6b
.byte 0x6B
.endm

.macro cmd6c
.byte 0x6C
.endm

.macro cmd6d
.byte 0x6D
.endm

.macro cmd6e
.byte 0x6E
.endm

.macro cmd6f cmd6f_bank
.byte 0x6F
.byte \cmd6f_bank
.endm

.macro cmd70 cmd70_bank
.byte 0x70
.byte \cmd70_bank
.endm

.macro cmd71
.byte 0x71
.endm

.macro cmd72 cmd72_address
.byte 0x72
.word \cmd72_address
.endm

.macro cmd73 cmd73_bank
.byte 0x73
.byte \cmd73_bank
.endm

.macro cmd74 cmd74_bank
.byte 0x74
.byte \cmd74_bank
.endm

.macro cmd75
.byte 0x75
.endm

.macro cmd76 cmd76_bank cmd76_byte
.byte 0x76
.byte \cmd76_bank
.byte \cmd76_byte
.endm

.macro setprotect
.byte 0x77
.endm

.macro faintifabilitynotdamp
.byte 0x78
.endm

.macro setuserhptozero
.byte 0x79
.endm

.macro jumpwhiletargetvalid jumpwhiletargetvalid_address
.byte 0x7A
.word \jumpwhiletargetvalid_address
.endm

.macro setdamageasrestorehalfmaxhp setdamageasrestorehalfmaxhp_address setdamageasrestorehalfmaxhp_byte
.byte 0x7B
.word \setdamageasrestorehalfmaxhp_address
.byte \setdamageasrestorehalfmaxhp_byte
.endm

.macro jumptolastusedattack
.byte 0x7C
.endm

.macro setrain
.byte 0x7D
.endm

.macro setreflect
.byte 0x7E
.endm

.macro setleechseed
.byte 0x7F
.endm

.macro manipulatedamage
.byte 0x80
.endm

.macro setrest setrest_address
.byte 0x81
.word \setrest_address
.endm

.macro jumpifnotfirstturn jumpifnotfirstturn_address
.byte 0x82
.word \jumpifnotfirstturn_address
.endm

.macro nop3
.byte 0x83
.endm

.macro jumpifcannotsleep jumpifcannotsleep_address
.byte 0x84
.word \jumpifcannotsleep_address
.endm

.macro stockpile
.byte 0x85
.endm

.macro stockpiletobasedamage stockpiletobasedamage_address
.byte 0x86
.word \stockpiletobasedamage_address
.endm

.macro stockpiletohprecovery stockpiletohprecovery_address
.byte 0x87
.word \stockpiletohprecovery_address
.endm

.macro negativedamage
.byte 0x88
.endm

.macro statbuffchange statbuffchange_target statbuffchange_address
.byte 0x89
.byte \statbuffchange_target
.word \statbuffchange_address
.endm

.macro normalisebuffs
.byte 0x8A
.endm

.macro setbide
.byte 0x8B
.endm

.macro confuseifrepeatingattackends
.byte 0x8C
.endm

.macro setloopcounter setloopcounter_number_of_loop
.byte 0x8D
.byte \setloopcounter_number_of_loop
.endm

.macro cmd8e
.byte 0x8E
.endm

.macro forcerandomswitch forcerandomswitch_address
.byte 0x8F
.word \forcerandomswitch_address
.endm

.macro changetypestoenemyattacktype changetypestoenemyattacktype_address
.byte 0x90
.word \changetypestoenemyattacktype_address
.endm

.macro givemoney
.byte 0x91
.endm

.macro setlightscreen
.byte 0x92
.endm

.macro koplussomethings koplussomethings_address
.byte 0x93
.word \koplussomethings_address
.endm

.macro gethalfcurrentenemyhp
.byte 0x94
.endm

.macro setsandstorm
.byte 0x95
.endm

.macro weatherdamage
.byte 0x96
.endm

.macro tryinfatuatetarget tryinfatuatetarget_address
.byte 0x97
.word \tryinfatuatetarget_address
.endm


.org 0x57A14, 0xFF
ldr r1, Hook1
bx r1
.align 2
Hook1: .word RomAreaOffset+StoreBankForValidityCheck+1

.org 0x57B38, 0xFF
ldr r1, Hook2
bx r1
.align 2
Hook2: .word RomAreaOffset+StoreBankForValidityCheck2+1

.org 0x57CFA, 0xFF
lsl r0, r0, #0x0
ldr r0, Hook3
bx r0
.align 2
Hook3: .word RomAreaOffset+CheckMoveID2+1

.org 0x57D18, 0xFF
ldr r0, Hook4
bx r0
.align 2
Hook4: .word RomAreaOffset+TargetRangeCheck+1



.org MyLoc, 0xFF
@ Battle Script Main
callasm TargetCorrector+RomAreaOffset+1
attackcanceler
attackstring
ppreduce
callasm CheckAcuSuccess+RomAreaOffset+1
attackanimation
waitanimation
callasm RandomStatRaise+RomAreaOffset+1
statbuffchange 0x1 0x82D8A4E
jumpifbyte 0x0 0x2024337 0x2 0x82D8A4E
cmd47
playanimation 0x0 0x1 0x2024484
printfromtable 0x85CC89C
waitmessage 0x40
goto 0x82D8A4E

@@Handles exceptions in case target is out of Range.
.align 2
TargetCorrector:
    ldr r2, =UserBank
    ldrb r0, [r2, #0x0]
    ldrb r1, [r2, #0x1]
    cmp r0, r1
    beq EndCorrector

CompareUserTargetSides:
    mov r3, #0x2
    eor r3, r1
    cmp r3, r0
    bne MakeUserTheTarget

CheckForFaintedAlly:
    ldr r3, =FaintMarkerBits
    ldrb r3, [r3]
    ldr r4, =PowersOfTwo
    lsl r1, r1, #0x2
    add r4, r1, r4
    ldrb r4, [r4]
    and r4, r3
    cmp r4, #0x0
    beq EndCorrector
   
MakeUserTheTarget:
    strb r0, [r2, #0x1]
    
EndCorrector:
    bx lr
    
.align 2
.pool

.align 2
@Checks For Ally's Subsitute or All Stats Maxed Out.
CheckAcuSuccess:
    push {lr}
    ldr r0, =UserBank
    ldrb r0, [r0, #0x1]
    ldr r1, =BattleData
    mov r2, #0x58
    mul r2, r0
    add r3, r2, r1
    ldr r1, =UserBank
    ldrb r1, [r1]
    cmp r1, r0
    beq NoSub 

SubstituteCheck:
    ldr r4, [r3, #0x50]
    mov r5, #0x80
    lsl r5, r5, #0x11
    cmp r4, r5
    beq FailAcu

NoSub:
    mov r6, #0x20
    add r6, r3, r6
    ldrb r6, [r6]
    ldr r7, =ContraryID
    cmp r6, r7
    beq ContraryHandler
    ldr r4, [r3, #0x18]
    ldr r5, =Comp
    cmp r4, r5
    ble CheckSuccessEnd

AllMax:
    ldr r4, [r3, #0x1C]
    add r5, #0xC
    cmp r4, r5
    bne CheckSuccessEnd
    b FailAcu

ContraryHandler:
    ldr r4, [r3, #0x18]
    cmp r4, #0xC
    bne CheckSuccessEnd

Allmin:
    ldr r4, [r3, #0x1C]
    cmp r4, #0x0
    bne CheckSuccessEnd

FailAcu:
    ldr r1, =FailBS
    sub r1, #0x5
    ldr r0, =ScriptPointer
    str r1, [r0]

CheckSuccessEnd:
    pop {r0}
    bx r0

.align 2
.pool

RandomStatRaise:
   push {lr}
   ldr r0, =TargetBank
   ldrb r0, [r0]
   ldr r1, =BattleData
   mov r2, #0x58
   mul r0, r2
   add r7, r0, r1
   add r7, #0x19
   add r5, r7, #0x7
   ldrb r5, [r5]
   ldr r4, =ContraryID

StatSelector:
   ldr r2, =RNG
   bl Linker
   lsl r0, r0, #0x10
   lsr r0, r0, #0x10
   mov r1, #0x7
   ldr r2, =DivMod
   bl Linker
   add r6, r0, r7
   ldrb r1, [r6]
   cmp r4, r5
   beq ContraryCheck
   cmp r1, #0xC
   bne Selected
   b StatSelector

ContraryCheck:
   cmp r1, #0x0
   beq StatSelector

Selected:
   mov r2, #0x21
   add r0, r0, r2
   ldr r1, =StatChangeByte
   strb r0, [r1]
   pop {r0}
   bx r0 

Linker:
   bx r2

.align 2
.pool

@Control Cursor Range If Up Or Left Button is Pressed.
.align 2
StoreBankForValidityCheck:
    push {r0}

LoadSelectedMove:
    
    ldr r2, =ActiveBank
    ldr r1, =PokemonTeamID
    ldrb r2, [r2]
    lsl r0, r2, #1
    add r0, r0, r1
    ldrh r1, [r0]
    mov r0, #0x64
    mul r0, r1
    ldr r1, =PlayerPartyPkmData
    add r0, r0, r1
    ldr r1, =MoveIndexChosen
    add r2, r2, r1
    ldrb r1, [r2]
    add r1, #0xD
    ldr r2, =PokemonGetAttr
    bl Linker2
    ldr r2, =AcupressureID
    cmp r0, r2
    bne NormalMoveCursorManipulation   

AcupressureCurserManipulation:
    pop {r0}
    cmp r0, #0x0
    beq ValidCursor
    cmp r0, #0x2
    beq ValidCursor
    b InvalidCursor

NormalMoveCursorManipulation:
    mov r3, r0
    pop {r0}
    cmp r0, #0x0
    blt InvalidCursor
    cmp r0, #0x4
    bge InvalidCursor
    cmp r0, #0x1
    beq ValidCursor
    cmp r0, #0x3
    beq ValidCursor

UserTargetCheck:
    ldr r2, =ActiveBank
    ldrb r0, [r2]
    ldrb r1, [r5]
    cmp r0, r1
    bne ValidCursor    

SameUserTarget:
    mov r0, r3
    ldr r2, =Return1
    bx r2

InvalidCursor:
    ldr r2, =Return2
    bx r2

ValidCursor:
    ldr r2, =Return3

Linker2:
    bx r2    
.align 2
.pool


@Control Cursor Range If Down Or Right Button is Pressed.
.align 2
StoreBankForValidityCheck2:
    push {r0}

LoadSelectedMove2:
    
    ldr r2, =ActiveBank
    ldr r1, =PokemonTeamID
    ldrb r2, [r2]
    lsl r0, r2, #1
    add r0, r0, r1
    ldrh r1, [r0]
    mov r0, #0x64
    mul r0, r1
    ldr r1, =PlayerPartyPkmData
    add r0, r0, r1
    ldr r1, =MoveIndexChosen
    add r2, r2, r1
    ldrb r1, [r2]
    add r1, #0xD
    ldr r2, =PokemonGetAttr
    bl Linker3
    ldr r2, =AcupressureID
    cmp r0, r2
    bne NormalMoveCursorManipulation2  

AcupressureCurserManipulation2:
    pop {r0}
    cmp r0, #0x0
    beq ValidCursor2
    cmp r0, #0x2
    beq ValidCursor2
    b InvalidCursor2

NormalMoveCursorManipulation2:
    mov r3, r0
    pop {r0}
    cmp r0, #0x0
    blt InvalidCursor2
    cmp r0, #0x4
    bge InvalidCursor2
    cmp r0, #0x1
    beq ValidCursor2
    cmp r0, #0x3
    beq ValidCursor2

UserTargetCheck2:
    ldr r2, =ActiveBank
    ldrb r0, [r2]
    ldrb r1, [r5]
    cmp r0, r1
    bne ValidCursor2    

SameUserTarget2:
    mov r0, r3
    ldr r2, =Return4
    bx r2

InvalidCursor2:
    ldr r2, =Return5
    bx r2

ValidCursor2:
    ldr r2, =Return6

Linker3:
    bx r2    
.align 2
.pool

.align 2
@Disable Cursor Routine for Acupressure in case of Fainted Ally.
TargetRangeCheck:
    mov r0, #0x7D
    and r0, r4
    cmp r0, #0x0
    bne NoCursor

CheckMoveID:
    ldr r0, =MoveIndexChosen
    add r0, r0, r3
    ldrb r0, [r0]
    lsl r0, r0, #0x1
    add r0, r0, r6
    ldrh r0, [r0]
    ldr r1, =AcupressureID 
    cmp r0, r1
    bne EnableCursor

CheckFaintedAlly:
    mov r2, #0x2
    eor r2, r3
    ldr r1, =PowersOfTwo
    lsl r2, r2, #2
    add r1, r1, r2
    ldr r1, [r1]
    ldr r0, =FaintMarkerBits
    ldrb r0, [r0]
    and r0, r1
    cmp r0, #0x0
    beq EnableCursor

NoCursor:
    ldr r0, =Return7
    bx r0            

EnableCursor:
    ldr r0, =Return8
    bx r0

.align 2
.pool

@Disable Cursor Routine for Acupressure in Singles.
.align 2
CheckMoveID2:
    ldr r0, =MoveIndexChosen
    add r0, r0, r3
    ldrb r0, [r0]
    lsl r0, r0, #0x1
    add r0, r0, r6
    ldrh r0, [r0]
    ldr r1, =AcupressureID 
    cmp r0, r1
    beq NoCursor2
    add r0, r5, #2
    add r0, r2, r0
    ldrb r0, [r0]
    cmp r0, #0x0
    bne NoCursor2

EnableCursor2:
    mov r0, #0x1
    mov r8, r0
    
NoCursor2:
    ldr r0, =Return9
    bx r0
  
.align 2
.pool


Xencleamas

Suddenly lurking in the shadows...

Male
Asgard
Seen January 21st, 2019
Posted August 7th, 2018
460 posts
5.5 Years
The check target field command is useless, you can simply use jumpifability command with the right parameters (which I don't remember on the top of my head)
But this isn't what you want to do here, you'd simply want to check if the target has one of those abilities, and if so, branch to fail script.
This check can be included in the ASM routine removing the ability
Alright! I've modified the routine, and thanks for the suggestions and corrections.
*edited

Xencleamas Untitled Pokémon Fan Game (Coming Soon!) Untitled Region (Coming Soon!)
Male
Seen January 10th, 2019
Posted May 4th, 2017
216 posts
6.1 Years
I'm letting everyone know that I updated the macro and define post again, which allows you now to compile strings like this :
Spoiler:

dispsent T_ h_ i_ s_ Space i_ s_ Space a_ Space s_ t_ r_ i_ n_ g_  0xFF

Instead of :
Spoiler:

.byte T_, h_, i_, s_, Space, i_, s_, Space, a_, Space, s_, t_, r_, i_, n_, g_,  0xFF


I found it a bit more convenient. The string can go up to 414 charac, but it's easy to make it supports more.
Also, you don't waste space, the string will take only the number of parameters you gave, it won't have blank space.
Seen January 7th, 2017
Posted August 6th, 2016
58 posts
4 Years
I'm letting everyone know that I updated the macro and define post again, which allows you now to compile strings like this :
Spoiler:

dispsent T_ h_ i_ s_ Space i_ s_ Space a_ Space s_ t_ r_ i_ n_ g_  0xFF

Instead of :
Spoiler:

.byte T_, h_, i_, s_, Space, i_, s_, Space, a_, Space, s_, t_, r_, i_, n_, g_,  0xFF


I found it a bit more convenient. The string can go up to 414 charac, but it's easy to make it supports more.
Also, you don't waste space, the string will take only the number of parameters you gave, it won't have blank space.
It's surely useful! But could you tell me how to use the macroinstruction?
Male
Seen January 10th, 2019
Posted May 4th, 2017
216 posts
6.1 Years
It's surely useful! But could you tell me how to use the macroinstruction?
Perhaps I could answer you through an exemple.

Here is Gastro Acid :

Gastro Acid for Emerald.

Battle Script:
Spoiler:
#org @main
attackcanceler
attackstring
ppreduce
jumpifability 0x0 0x7A 0x82D9F1C // Multitype
jumpifability 0x0 0x9D 0x82D9F1C // Magic Bounce
jumpifability 0x0 0xB1 0x82D9F1C // Stance Change
callasm 0x8AAAAAA
attackanimation
waitanimation
setword 0x203E320 0x8BBBBBB
printstring 0x184
waitmessage 0x40
goto 0x82D8A4E
RAW Code:
00
02
03
1E 00 7A 1C 9F 2D 08
1E 00 9D 1C 9F 2D 08
1E 00 B1 1C 9F 2D 08
F9 AA+1 AA AA 08
09
0A
FA 20 E3 03 02 BB BB BB 08
10 84 01
12 40 00
28 4E 8A 2D 08


ASM Routine at AAAAAA:
Spoiler:
.text
.align 2
.thumb
.thumb_func
.global test

main:
push {lr}
ldr r0, .TargetBank
ldr r1, .BattleData
ldrb r0, [r0]
mov r2, #0x58
mul r2, r0
add r1, #0x20
add r1, r2
mov r3, #0x0
ldrb r4, [r1]
cmp r3, r4
beq Abort
strb r3, [r1]
b End

Abort:
ldr r0, .CurrentScript
ldr r1, .FailScript
str r1, [r0]

End:
pop {r0}
bx r0

.align 2
.BattleData: .word 0x02024084
.UserBank: .word 0x0202420B
.TargetBank: .word 0x0202420C
.BasePower: .word 0x02024400
.CurrentScript: .word 0x02024214
.FailScript: .word 0x082D9F1A
RAW Code:
00 B5 0B 48 08 49 00 78 58 22 42 43 20 31 89 18
0F 23 0C 78 A3 42 01 D0 0B 70 02 E0 06 48 07 49
01 60 01 BC 00 47 C0 46 84 40 02 02 0B 42 02 02
0C 42 02 02 00 44 02 02 14 42 02 02 1A 9F 2D 08


String at BBBBBB:
Spoiler:
FD 10 B4 E7 00 FE BB D6 DD E0 DD E8 ED 00 EB D5
E7 00 E7 E9 E4 E4 E6 D9 E7 E7 D9 D8 AB FF 00
Here is what you have to do without the macros :
-Insert the string somewhere.
-Note the address of that string.
-Then you assemble the ASM routine.
-Then you open BSP, you compile your BS and put the right addresses where it's needed in the BS.

With the macros, you assemble this and you're done:
Spoiler:

.thumb
.thumb_func
.global gastroacid

.equ Myloc, 0x[Address you want to insert it without the 08 prefix]

.include "absolute_path_of_your_define_and_macro.its_extension"

.org Myloc, 0xFF
attackcanceler
attackstring
ppreduce
jumpifability 0x0 MULTITYPE 0x82D9F1C
jumpifability 0x0 MAGIC_BOUNCE 0x82D9F1C
jumpifability 0x0 STANCE_CHANGE 0x82D9F1C
callasm main+SizeRom+1
attackanimation
waitanimation
setword 0x203E320 String_Used+SizeRom
printstring 0x184
waitmessage 0x40
goto 0x82D8A4E

.align 2
main:
push {lr}
ldr r0, .TargetBank
ldr r1, .BattleData
ldrb r0, [r0]
mov r2, #0x58
mul r2, r0
add r1, #0x20
add r1, r2
mov r3, #0x0
ldrb r4, [r1]
cmp r3, r4
beq Abort
strb r3, [r1]
b End

Abort:
ldr r0, .CurrentScript
ldr r1, .FailScript
str r1, [r0]

End:
pop {r0}
bx r0

.align 2
.BattleData: .word 0x02024084
.UserBank: .word 0x0202420B
.TargetBank: .word 0x0202420C
.BasePower: .word 0x02024400
.CurrentScript: .word 0x02024214
.FailScript: .word 0x082D9F1A

.align 2
String_Used:
dispsent 0xFD 0x10 l_ o_ s_ t_ Space i_ t_ s_ Space a_ b_ i_ l_ i_ t_ y_ Exclam 0xFF
Advertiser Content