.thumb
.thumb_func
.global megahack
[COLOR="red"][b]@@@@ What you have to read !
@ 0x1300 (4900) bytes of freespace needed.
.equ Myloc, 0x______ @ Change to whatever you want, you'll need 7000 (0x1B58) bytes of freespace to be sure.
@ That address musts end with 0
.equ DoubleWordMega, 0x0203E3E0 @ Double word (8 bytes) of free ram, used for Mega evolution, must ends with 0, it's important.
.equ YourWordLocation, 0x203E320 @ Word used by your setword command
.equ ImposterLocation, 0x203E3FC @ byte used by imposter
.equ WeathersMegaPrimal, 0x0203E330 @ One byte of free ram used for mega/primal weathers
.equ AegiFreeRam, 0x203E33C @ One byte of free ram used for Aegislash transformation
.equ YourMegaAnimationIndex, 0x1E @ Index of the animation, you remember the expanded table ? Put Delta stream and Mega animation here.
.equ YourDeltaStreamAnimIndex, 0x1F
.equ SetWordCommand, 0xFA @ As I said, these commands have to be implemented, so put their index here.
.equ CallAsmCommand, 0xF9
@@@ If you don't want the following abilities to work, just give them an unused index (like 0xF5) and don't give it to your pokémons.
.equ DeltaStreamAbility, 0xC0 @ Abilities indexes
.equ PrimordialSeaAbility, 0xBE
.equ DesolateLandAbility, 0xBF
.equ ImposterAbility, 0x97
.equ MoxieAbility, 0x9A
.equ NumberEvoPerPokemon, 0x5 @ Number of evolution you have per pokemon
.equ SoundWeWantToPlay, 0x1 @ Sound we want to play when triggering the mega evolution. 0x1 is not bad.
@@ If you don't want aegislash, just give it an index unused like 0x800
.equ AegislashShield, 0x142 @ Index number of Aegislash Shield
.equ AegislashBlade, 0x113 @ Index number of Aegislash Blade
.equ PokemonDataPointer, 0x803A270 @ I don't see why it would change since it's a pointer for the pokemon data, but just in case, I put it here
.equ EvolutionPointerLocation, 0x806D140 @ I don't see why it would change since it's a pointer for the evolution data, but just in case, I put it here
@@@@From now on, no need to read, everything is automated[/b][/COLOR]
.equ MegaEvolutionIndex, 0xFE @ 0xFE = Mega evolution. I choose to do as Touched here.
.equ WishMegaEvolutionIndex, 0xFC @ 0xFC = Wish
.equ PrimalReversionIndex, 0xFD @ 0xFD = Primal
@@ Charac 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
@@Locations BS
.equ MegaBattleScriptForPlayer, MegaBSPlayer+SizeRom
.equ MegaBattleScriptForAI, MegaBSForAI+SizeRom
.equ WishBattleScriptForPlayer, BattleScriptWishPlayer+SizeRom
.equ WishBattleScriptForAI, BattleScriptWishAI+SizeRom
.equ MegaBattleScriptForPlayer2, MegaBSPlayer2+SizeRom
.equ MegaBattleScriptForAI2, MegaBSForAI2+SizeRom
.equ WishBattleScriptForPlayer2, BattleScriptWishPlayer2+SizeRom
.equ WishBattleScriptForAI2, BattleScriptWishAI2+SizeRom
.equ BattleScriptForImposter, ImposterBattleScript+SizeRom
.equ PrimalBattleScript, BattleScriptPrimal+SizeRom
.equ BattleScriptDeltaStream, DeltaStreamBattleScript+SizeRom
.equ BattleScriptMoxieClear, ScriptMoxieClear+SizeRom
.equ BattleScriptClearWeather, ClearWeatherBattleScript+SizeRom
.equ SizeRom, 0x8000000
@@ Stuffs BS
.equ LocationStringZZAI2, StringZZAI2+SizeRom
.equ LocationStringLLAI, StringLLAI+SizeRom
.equ PlayCry, 1+PlayCryRoutine+SizeRom
.equ HelpSwitchIn, 1+HelpSwitchInRoutine+SizeRom
.equ LocationStringPrim, StringPrimalNull+SizeRom
.equ HelpSwitchInPrimal, 1+PrimalSwitchInRoutine+SizeRom
.equ LocationStringPrimal, StringPrimal+SizeRom
.equ LocationStringUUAI2, StringUUAI2+SizeRom
.equ LocationStringZZAI, StringZZAI+SizeRom
.equ LocationStringUUAI, StringUUAI+SizeRom
.equ LocationStringZZ2, StringZZ2+SizeRom
.equ LocationStringLL, StringLL+SizeRom
.equ LocationStringUU2, StringUU2+SizeRom
.equ LocationStringZZ, StringZZ+SizeRom
.equ LocationStringUU, StringUU+SizeRom
.equ SecondRoutineTransform, 1+RoutineTransformFirst+SizeRom
.equ FirstRoutineTransform, 1+RoutineTransformSecond+SizeRom
/*The idea is to check whether we are in the menu attack or not, we also check the touched pressed
(because that routine runs multiple times by frame). Depending on where we are and what touch are
pressed, we set a specific ram location. Then we'll have to hook at the very start of the attack
canceler to transform the pokemons.
We also need to check whether the pokemon can mega evolve or not, and if it has the good item/attack.
*/
/*
First word :
original turn order
Flag Trigger
Bank transformed
Banks:
0 1 2 3
OO OO OO OO XX XX XX XX
Flags : 1 = Mega, 2 = Wish, 4 = Transformed.
*/
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ HERE ARE THE HOOKS + a little routine
@@ Trigger player
.org 0x3BE80, 0xFF
ldr r0, Hook
mov pc, r0
.align 2
Hook: .word SizeRom+1+Myloc
@@ Clear ram end battle
.org 0x3DDE4, 0xFF
ldr r0, Hook6
mov pc, r0
.align 2
Hook6: .word 1+ClearRamEndBattle+SizeRom
@@@ Switch in check + primal
.org 0x42A20, 0xFF
ldr r3, Hook3
mov pc, r3
.align 2
Hook3: .word 1+SwitchInCheckPrimal+SizeRom
@@ Transformation
.org 0x45FFC, 0xFF
ldr r0, Hook2
mov pc, r0
.align 2
Hook2: .word 1+TransformationFromAttackCanceler+SizeRom
@@ Faintpokemon command
.org 0x49BE8, 0xFF
ldr r0, Hook4
mov pc, r0
.align 2
Hook4: .word 1+FaintPokemonCommand1+SizeRom
@@ Faintpokemon command
.org 0x49C08, 0xFF
ldr r1, Myloc5
mov pc, r1
.align 2
Myloc5: .word 1+FaintPokemonCommand2+SizeRom
@@ Handle Multi
.org 0x4DA14, 0xFF @ when 0x60 is added to the pointer in 0x0202449C, we can see the order of the party player/opponent
ldrb r0, [r7] @ At the start of a normal battle, the order is 01 23 45, 0 = first poke, 1 = second, etc. It's always updated when switch/faint etc
bl 0xA6A30 @ In multi, the order is 03 12 45, because there are really two part of the team (even if it's in the same area). The problem is the engine
cmp r0, #0 @ doesn't update the order for the opponent when we're in double. It's a problem when it comes to load the data of the opponent's pokemon.
bne pc+20 @ So that little routine corrects that.
@@@ Trigger AI
.org 0x63614, 0xFF
ldr r0, Hook1
mov pc, r0
.align 2
Hook1: .word 1+TriggeringTheAIMega+SizeRom
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ HERE START THE MAIN ROUTINES
@@@@@@@@@@@@@@@@@@@@@@@@ TRIGGER MEGA EVOLUTION FOR PLAYER
@@@@@@ CHECK MENU PART
.org Myloc, 0xFF
ldr r0, SomeLoc0
mov r1, #0
strb r1, [r0, #4]
ldr r0, b_active_side0 @ Until here it's the engine operations.
push {r0-r7}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
ldr r0, FlagBattle0
ldr r0, [r0]
ldr r2, FlagsMultiBattle0
and r0, r2
cmp r0, #0
beq CheckAllFlag0
mov r2, #1
mov r6, #7 @ 7 is 0x1(trigger mega) + 0x2(trigger wish) + 0x4(transformed), they are the flags for the first player.
b CheckingFlag0
CheckAllFlag0:
ldr r6, FlagsPlayer0 @ Or we check whether a mega evolution already happened or not, with flags of the first/second pokemon player, if not in multi
mov r2, #0
CheckingFlag0:
mov r8, r1
ldr r0, FirstMenu0 @ Used later, to know whether we're in the menu of the first or second pokemon
ldrb r1, [r0]
ldr r4, Pad0 @ This part loads the touch pressed
ldr r5, [r4] @ Same
lsl r5, r5, #0x18 @ Same
lsr r5, r5, #0x18 @ Same
cmp r1, #2 @ Comparison to know whether we're in first menu or second
bls ScdMenu0
ldr r0, InOutMenu0 @ We're in the first menu, so we're checking wether we're selecting an attack or not
ldrb r0, [r0]
cmp r0, #0x3F @ 0x4X we're out, 0x3X, we're in
bls InMenuFirst0
ClearTriggerFlagPlayerSide0:
mov r1, #0 @ If we are in the first menu, and we don't select an attack, we remove the triggers flag for player 1.
b Removing0
Return00:
b Return0
InMenuFirst0:
mov r0, r5 @ Those four lines check if B or select has been pressed
mov r4, #6
and r0, r4
cmp r0, #6
beq CheckStartPressedPlayer1
mov r1, #0
b Removing0 @ Remove the flags accordingly if pressed
CheckStartPressedPlayer1:
ldr r0, MegaRam0
ldr r0, [r0, #4]
and r0, r6 @ before checking start, we check if a flag hasn't be set already
cmp r0, #0
bne Return00
mov r0, r5
mov r4, #8 @ Check start
and r0, r4
cmp r0, #0
beq ActiveFirstMega0
b Return0
ActiveFirstMega0:
mov r5, #0
b CheckEvoMega0 @ Goto another part that checks mega evo.
FirstOk0: @ If the first can mega evolve, the loop back here. Otherwise it returns.
mov r1, #0
b Store0
ScdMenu0:
ldr r0, InOutMenu0
ldrb r0, [r0]
cmp r0, #0x3F @ Same than before, checking whether we're selecting an attack or not
bls InMenuScd0
b Return0
InMenuScd0:
mov r0, r5 @ Check B or select
mov r4, #6
and r0, r4
cmp r0, #6
beq CheckStartPressedPlayer2
mov r1, #2
b Removing0
CheckStartPressedPlayer2:
ldr r0, MegaRam0
ldr r0, [r0, #4]
and r0, r6 @ before checking start, we check if a flag hasn't be set already
cmp r0, #0
bne Return00
mov r0, r5
mov r4, #8
and r0, r4
cmp r0, #0
beq ActiveSecondMega0 @ Same than before but for the second poke
b Return0
ActiveSecondMega0: @Same thing than for the first
mov r5, #2
b CheckEvoMega0
SecondOk0:
mov r1, #2
b Store0
Removing0:
ldr r0, MegaRam0
add r0, #4
mov r2, #3
add r0, r1
ldrb r1, [r0]
bic r1, r2
strb r1, [r0]
b Return0
JumpForSound0:
bx r3
Store0:
ldr r0, MegaRam0
add r0, #4
add r0, r1
strb r4, [r0]
mov r0, #SoundWeWantToPlay
ldr r3, PlaySoundRoutine0
bl JumpForSound0
Return0:
pop {r5-r7}
mov r8, r5
mov r9, r6
mov r10, r7
pop {r0-r7}
ldr r5, Back0
mov pc, r5
@@@@@@@ CHECK EVOLUTION TABLE PART
CheckEvoMega0: @ r5 is the parameter, the bank 0 or 2
push {r5}
ldr r6, PlayerParty0
StartingCheck0:
ldr r0, MemLoc0
ldr r0, [r0]
add r0, #0x60
ldrb r0, [r0] @ loading the order of our party
HandleDouble0:
mov r1, #2
and r1, r5
cmp r1, #0
beq First0 @ We load a byte, like 01, and we just want the 0 or the 1, depending on what bank we have in r5
mov r1, #0xF
and r0, r1
b Continue0
First0:
mov r1, #0xF0
and r0, r1
lsr r0, r0, #4
Continue0:
mov r2, #0x64 @ Size of data party pokemon
mul r0, r2 @ Size x Index party number
add r0, r6 @ + party data
mov r4, r0
ldrh r0, [r0, #0x20] @ Start of its data + 0x20 = Index number after applying doesnt's hack (the link I gave you at the start)
mov r6, r0 @ I want to keep the index safe
ldr r0, EvoPointer0 @ I load the evolution from a pointer, that way if you move them the routine is still ok
ldr r0, [r0]
mov r1, #NumberEvoPerPokemon
mov r2, #8 @ Size of each evolution, doesn't change.
mul r1, r2
mul r1, r6 @ Index number poke x total size of evolution per poke
add r0, r1 @ + evo data
mov r2, #MegaEvolutionIndex @ initialise the loop
mov r7, #0 @ r7 = counter
mov r1, r0 @ keep r0 safe
mov r4, r5 @ keeps bank safe
Loop0:
cmp r7, #NumberEvoPerPokemon
beq CheckWish0
ldrh r3, [r0]
cmp r3, r2
beq CheckStone0
BuffLoopStone0:
add r0, #8
add r7, #1
b Loop0
CheckWish0:
mov r2, #WishMegaEvolutionIndex
mov r7, #0
mov r0, r1
LoopWish0:
cmp r7, #NumberEvoPerPokemon
beq NoTransformation0
ldrh r3, [r0]
cmp r3, r2
beq CheckAttack0
BuffLoopWish0:
add r0, #8
add r7, #1
b LoopWish0
CheckAttack0:
mov r5, r4
mov r1, #0x58
mul r5, r1
ldr r1, BattData0
add r5, r1
ldrh r6, [r0, #2]
cmp r6, #0
beq BuffLoopWish0
mov r3, r5
add r3, #0xC @ Battle data + 0xC = attacks of the poke
ldrh r1, [r3]
cmp r6, r1
beq AmorceWish0
ldrh r1, [r3, #2]
cmp r1, r6
beq AmorceWish0
ldrh r1, [r3, #4]
cmp r1, r6
beq AmorceWish0
ldrh r1, [r3, #6]
cmp r1, r6
beq AmorceWish0
b BuffLoopWish0
AmorceWish0:
mov r4, #2
b Amorce0
CheckStone0:
mov r5, r4
mov r1, #0x58
mul r5, r1
ldr r1, BattData0
add r5, r1
mov r3, r5
add r3, #0x2E @ Battle data + 0x2E = item held
ldrh r3, [r3]
ldrh r6, [r0, #2]
cmp r3, #0
beq BuffLoopStone0
cmp r6, #0
beq BuffLoopStone0
cmp r6, r3
bne BuffLoopStone0
AmorceMega0:
mov r4, #1
Amorce0:
pop {r5}
cmp r5, #0
beq NumberOne0
b SecondOk0
NumberOne0:
b FirstOk0
NoTransformation0:
pop {r5}
b Return0
.align 2
BattData0: .word 0x2024084
FlagsPlayer0: .word 0x70007
FlagBattle0: .word 0x02022FEC
FlagsMultiBattle0: .word 0x408040
PlaySoundRoutine0: .word 0x80A37A4+1
MegaRam0: .word DoubleWordMega
EvoPointer0: .word EvolutionPointerLocation
MemLoc0: .word 0x0202449C
PlayerParty0: .word 0x020244EC
b_active_side0: .word 0x2024064
SomeLoc0: .word 0x2024332
Back0: .word 0x803BE88+1
FirstMenu0: .word 0x200558C
SecondMenu0: .word 0x20055A4
InOutMenu0: .word 0x202018C
Pad0: .word 0x4000130
/*
First word :
original turn order
Order Flag Trigger Banks
Bank transformed
Banks:
0 1 2 3
OO OO OO OO XX XX XX XX UU TT
*/
/*For that routine I assumed we applied the changes of this post : https://www.pokecommunity.com/showpost.php?p=8963359&postcount=773*/
@@@@@@@@@@@@@@@@@@@ TRIGGER MEGA EVOLUTION FOR AI
.align 2
TriggeringTheAIMega:
Start11:
push {r4-r7, lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
ldr r0, b_active_side1
ldrb r5, [r0] @ Load the current bank the AI is handling
mov r8, r5 @keeping the bank safe
mov r2, #0 @ That part check whether we're in multi battle or not
ldr r0, FlagsMultiBattle111
ldr r1, FlagBattle111
ldr r1, [r1]
and r1, r0
cmp r1, #0
beq NotMultiBattle1
mov r2, #1 @ r2 = 0 if not multi, 1 if multi
NotMultiBattle1:
cmp r5, #1
beq FirstPokeAI11 @ Depending on the bank we're checking, different way to handle it
cmp r5, #2
beq AIPartnerPoke111
cmp r5, #3
beq AISecondPoke111
b GoOn11
FirstPokeAI11:
cmp r2, #1
bne CheckBothFlag1
ldr r1, FlagFirstPokeAI1
b CheckThePoke1
CheckBothFlag1:
ldr r1, FlagsBothPokeAI1
CheckThePoke1:
ldr r0, MegaRam11
ldr r0, [r0, #4]
and r0, r1
cmp r0, #0
beq FlagOkTransform1
mov r1, #0
b EndFlagsTriggerTransform1
FlagOkTransform1:
mov r1, #1
EndFlagsTriggerTransform1:
cmp r1, #1
beq DataPokemonToTrigger1
b GoOn11
AIPartnerPoke111:
ldr r1, FlagsPartnerAI1
b CheckThePoke1
AISecondPoke111:
cmp r2, #1
bne CheckBothFlag1
ldr r1, FlagSecondPokeAI1
b CheckThePoke1
DataPokemonToTrigger1:
mov r6, #0x58
mul r6, r5
ldr r0, BattleData11
add r0, r6
add r0, #0x28
ldrh r0, [r0]
cmp r0, #0 @ The AI check whether its pokemon is fainted or not (because of double battle)
bne Fine11
b GoOn11
Fine11:
cmp r5, #2
beq CheckAIPartner1
ldr r6, AIParty11
mov r1, #3 @ Remember the order party ? 3 bytes for the player, 3 bytes for the AI (there's also 6 bytes next to that, but we don't need them)
b CheckingTheParty1 @ So, depending on the side of the AI, we're loading the player darty data or the AI party data, because the partner of the poke
@ has the data of its poke stored in the party player
CheckAIPartner1:
ldr r6, PlayerParty11
mov r1, #0
CheckingTheParty1:
ldr r0, MemLoc11
ldr r0, [r0]
add r0, #0x60
ldrb r0, [r0, r1] @ Loading the order of the party
HandleDble11:
mov r1, r8
mov r2, #2
and r1, r2
cmp r1, #0
beq First111
mov r1, #0xF @ See my explanation in the Faintpokemon hook
and r0, r1
b Continue111
First111:
mov r1, #0xF0
and r0, r1
lsr r0, r0, #4
Continue111:
mov r2, #0x64
mul r0, r2
add r0, r6 @ r6 holds the party to load
mov r4, r0
ldrh r0, [r4, #0x20] @Now we're loading the pokemon
mov r6, r0
ldr r0, EvoPointer11
ldr r0, [r0]
mov r1, #NumberEvoPerPokemon
mov r2, #8
mul r1, r2
mul r1, r6
add r0, r1
mov r2, #MegaEvolutionIndex
mov r7, #0
mov r1, r0
Looop11:
cmp r7, #NumberEvoPerPokemon
beq CheckWish111
ldrh r3, [r0]
cmp r3, r2
beq CheckOrb111
BuffLoopOrb111:
add r0, #8
add r7, #1
b Looop11
CheckWish111:
mov r2, #WishMegaEvolutionIndex
mov r7, #0
mov r0, r1
LoopWish111:
cmp r7, #NumberEvoPerPokemon
beq GoOn11
ldrh r3, [r0]
cmp r3, r2
beq CheckAttack111
BuffLoopWish111:
add r0, #8
add r7, #1
b LoopWish111
CheckAttack111:
mov r1, #0x58
mul r5, r1 @ r5 still holds the bank
ldr r1, BattleData11
add r5, r1
ldrh r6, [r0, #2]
cmp r6, #0
beq BuffLoopWish111
mov r3, r5
add r3, #0xC
ldrh r1, [r3]
cmp r6, r1
beq Amorce111Wish
ldrh r1, [r3, #2]
cmp r1, r6
beq Amorce111Wish
ldrh r1, [r3, #4]
cmp r1, r6
beq Amorce111Wish
ldrh r1, [r3, #6]
cmp r1, r6
beq Amorce111Wish
b BuffLoopWish111
Amorce111Wish:
mov r7, #2
b Amorce111
CheckOrb111:
mov r5, r4
mov r1, #0x58
mul r5, r1
ldr r1, BattleData11
add r5, r1
mov r3, r5
add r3, #0x2E
ldrh r3, [r3]
ldrh r6, [r0, #2]
cmp r3, #0
beq BuffLoopOrb111
cmp r6, #0
beq BuffLoopOrb111
cmp r6, r3
bne BuffLoopOrb111
MegaAmorce1:
mov r7, #1
Amorce111:
ldr r2, MegaRam11
add r2, #4
mov r3, r8
strb r7, [r2, r3] @ We're storing the type of mega for the wanted bank in the Free Ram we use
mov r0, #0
b MegaActivated1
GoOn11:
MegaActivated1:
ldr r3, Back111
mov pc, r3
.align 2
b_active_side1: .word 0x02024064
FlagsPartnerAI1: .word 0x70000
FlagFirstPokeAI1: .word 0x700
FlagSecondPokeAI1: .word 0x7000000
FlagsBothPokeAI1: .word 0x7000700
FlagBattle111: .word 0x02022FEC
FlagsMultiBattle111: .word 0x408040
Back111: .word 0x806361E+1
NPokeField11: .word 0x202406C
MegaRam11: .word DoubleWordMega
EvoPointer11: .word EvolutionPointerLocation
BattleData11: .word 0x02024084
MemLoc11: .word 0x0202449C
PlayerParty11: .word 0x020244EC
AIParty11: .word 0x02024744
/*
First word :
original turn order
Order Flag Trigger Banks
Bank transformed
Banks:
0 1 2 3
OO OO OO OO XX XX XX XX UU TT
*/
/*For that routine I assumed we applied the changes of this post : https://www.pokecommunity.com/showpost.php?p=8963359&postcount=773*/
@@@@@@@@@@@@@@@@@@@@@@@@ TRANSFORMATION PART
.align 2
TransformationFromAttackCanceler:
push {r4-r7, lr}
mov r7, r9
mov r6, r8
push {r6,r7}
sub sp, sp, #4
ldr r0, MoveOrderTurn2
StartToCheck2:
ldr r2, RamMega2
add r2, #4
mov r3, #0
LoopCheck2: @ That loops loads the order of the turn, check one by one if the poke can mega evolve
cmp r3, #4
beq ByeBabe2
LoopCheckContinue12:
ldrb r1, [r0, r3]
ldrb r4, [r2, r1]
mov r5, #3
and r5, r4
cmp r5, #0
beq BuffLoop2
mov r8, r1 @ r8 holds the bank
mov r7, r5 @ r7 the type of mega
b LoadTransformation2
BuffLoop2:
add r3, #1
b LoopCheck2
LoadTransformation2:
mov r3, #0x58
mul r3, r1
ldr r5, BattleData2
add r5, r3
add r5, #0x28
ldrh r5, [r5]
cmp r5, #0
bne ItsOk2
mov r4, #0
strb r4, [r2, r1]
ByeBabe2:
b Return22
ItsOk2:
mov r4, #4
strb r4, [r2, r1]
Next2:
ldr r4, MemLoc2 @ Loads order party
ldr r4, [r4]
add r4, #0x60
mov r3, #1
and r3, r1 @ AI or player
cmp r3, #0
bne AIPicking2
ldrb r4, [r4]
ldr r5, PlayerParty2
b NextAgain2
AIPicking2:
ldrb r4, [r4, #3]
ldr r5, AIParty2
NextAgain2:
mov r3, #2
and r3, r1 @ First or second poke
cmp r3, #0
beq First2
mov r3, #0xF
and r4, r3
b Continue22
First2:
mov r3, #0xF0
and r4, r3
lsr r4, r4, #4
Continue22:
mov r3, #0x64
mul r4, r3
add r4, r5
ldrh r3, [r4, #0x20] @ Now we're loading the pokemon we want to check
ldr r0, EvoPointer2
ldr r0, [r0]
mov r1, #NumberEvoPerPokemon
mov r2, #8
mul r1, r2
mul r1, r3
add r0, r1 @ Loading its evolutions location
mov r5, #0
cmp r7, #1
bne CheckWish2
mov r2, #MegaEvolutionIndex
Loop2:
cmp r5, #NumberEvoPerPokemon @ We compare to number max of evolution, but it's not even necessary since we're sure we can mega evolve.
beq Returning2
ldrh r3, [r0]
cmp r3, r2
beq CheckStone2
BuffLoopStone2:
add r0, #8
add r5, #1
b Loop2
Returning2:
b Return22
CheckWish2:
mov r2, #WishMegaEvolutionIndex
LoopWish2:
cmp r5, #NumberEvoPerPokemon
beq Returning2
ldrh r3, [r0]
cmp r3, r2
beq CheckAttack2
BuffLoopWish2:
add r0, #8
add r5, #1
b LoopWish2
CheckAttack2:
mov r5, r8
mov r1, #0x58
mul r5, r1
ldr r1, BattleData2
add r5, r1
ldrh r6, [r0, #2]
cmp r6, #0
beq BuffLoopWish2
mov r3, r5
add r3, #0xC
ldrh r1, [r3]
cmp r6, r1
beq ChangeStats2
ldrh r1, [r3, #2]
cmp r1, r6
beq ChangeStats2
ldrh r1, [r3, #4]
cmp r1, r6
beq ChangeStats2
ldrh r1, [r3, #6]
cmp r1, r6
beq ChangeStats2
b BuffLoopWish2
CheckStone2:
mov r5, r4
mov r1, #0x58
mul r5, r1
ldr r1, BattleData2
add r5, r1
mov r3, r5
add r3, #0x2E
ldrh r3, [r3]
ldrh r6, [r0, #2]
cmp r3, #0
beq BuffLoopStone2
cmp r6, #0
beq BuffLoopStone2
cmp r6, r3
bne BuffLoopStone2
ChangeStats2:
ldrh r6, [r0, #4]
strh r6, [r5]
strh r6, [r4, #0x20]
mov r0, r4
ldr r3, calcstats2
bl Jump2
mov r0, r4
add r0, #0x5A
ldrh r3, [r0]
strh r3, [r5, #2] @ This part updates attack.
ldrh r3, [r0, #2] @
strh r3, [r5, #4] @ defense
ldrh r3, [r0, #0x4] @
strh r3, [r5, #0x6] @ speed
ldrh r3, [r0, #0x6] @
strh r3, [r5, #0x8] @ att special
ldrh r3, [r0, #0x8] @
strh r3, [r5, #0xA] @ def special. Ends here.
UpdateTypeAndAbility2:
add r5, #0x20 @ I assumed Mega evolutions can only have one ability
ldr r2, PokePointer2
ldr r2, [r2]
mov r3, #28
mul r3, r6
add r3, r2
add r3, #6
ldrb r2, [r3]
strb r2, [r5, #1]
ldrb r2, [r3, #1]
strb r2, [r5, #2]
add r3, #16
ldrb r2, [r3]
strb r2, [r5] @ Stats completly updated here.
ldr r3, ScriptPusher2 @ Keeps the current BS safe.
bl Jump2
ldr r1, CurBS2
mov r0, r8
mov r2, #1
and r2, r0
cmp r2, #0
bne AITransformation2
cmp r7, #1 @ r7 = 1 for mega, 2 for wish
bne WishPlayer2
cmp r0, #2
beq AIPartnerMega2
ldr r0, MegaBS2
b Transformation2
AIPartnerMega2:
ldr r0, MegaBS22
b Transformation2
WishPlayer2:
cmp r0, #2
beq AIPartnerWish2
ldr r0, MegaWishBS2
b Transformation2
AIPartnerWish2:
ldr r0, MegaWishBS22
b Transformation2
AITransformation2:
cmp r7, #1
bne WishAI2
cmp r0, #3
beq AITransformMega2
ldr r0, MegaBSAI2
b Transformation2
AITransformMega2:
ldr r0, MegaBSAI22
b Transformation2
AITransformWish2:
ldr r0, MegaWishAIBS22
b Transformation2
WishAI2:
cmp r0, #3
beq AITransformWish2
ldr r0, MegaWishAIBS2
Transformation2:
str r0, [r1]
DealWithTargetOrder2:
ldr r0, RamMega2
ldr r2, Bank2
ldrb r3, [r0]
mov r4, #0x10
and r4, r3
cmp r4, #0x10
beq DirectEnd2
ldrb r3, [r2]
mov r4, #0x10
orr r3, r4
strb r3, [r0]
DirectEnd2:
mov r3, r8
strb r3, [r2]
ldr r0, EndCanceler2
mov pc, r0
Return22:
ldr r0, RamMega2 @ Here we keep the banks safe.
ldr r2, Bank2 @ In our RAM location.
ldrb r3, [r0]
mov r4, #0x10
and r4, r3
cmp r4, #0
beq RealBack2
bic r3, r4
strb r3, [r2]
strb r3, [r0]
RealBack2:
ldr r0, Back2
mov pc, r0
Jump2:
mov pc, r3
.align 2
MoveOrderTurn2: .word 0x0202407E
EndCanceler2: .word 0x8046398+1
MegaBS2: .word MegaBattleScriptForPlayer
MegaBS22: .word MegaBattleScriptForPlayer2
MegaBSAI2: .word MegaBattleScriptForAI
MegaBSAI22: .word MegaBattleScriptForAI2
MegaWishBS2: .word WishBattleScriptForPlayer
MegaWishBS22: .word WishBattleScriptForPlayer2
MegaWishAIBS2: .word WishBattleScriptForAI
MegaWishAIBS22: .word WishBattleScriptForAI2
ScriptPusher2: .word 0x0803FAFC+1
CurBS2: .word 0x02024214
PokePointer2: .word PokemonDataPointer
calcstats2: .word 0x08068D0C+1
Back2: .word 0x8046006+1
RamMega2: .word DoubleWordMega
BankTarget2: .word 0x0202420C
Bank2: .word 0x0202420B
EvoPointer2: .word EvolutionPointerLocation
BattleData2: .word 0x02024084
MemLoc2: .word 0x0202449C
PlayerParty2: .word 0x020244EC
AIParty2: .word 0x02024744
@@@@@@@@@@@@@@@@@@@@@@@@ SWITCH IN + PRIMAL
.align 2
SwitchInCheckPrimal:
push {r0-r7}
ldr r0, FreeAegi3
mov r1, #0
strb r1, [r0]
mov r0, r10
mov r5, r10
mov r1, #1
and r1, r0
cmp r1, #0
beq Player3
AI3:
ldr r6, AIParty3
mov r1, #3
b CheckAegi
Player3:
ldr r6, PlayerParty3
mov r1, #0
CheckAegi:
ldr r0, MemLoc3
ldr r0, [r0]
add r0, #0x60
ldrb r0, [r0, r1] @ loading the order of our party
HandleDouble3:
mov r1, #2
and r1, r5
cmp r1, #0
beq First13
mov r1, #0xF
and r0, r1
b Continue223
First13:
mov r1, #0xF0
and r0, r1
lsr r0, r0, #4
Continue223:
mov r1, r6
mov r2, #0x64
mul r0, r2
add r0, r1
mov r4, r0
mov r1, #0xB
ldr r3, getattr3
bl Jump3
mov r6, r0
ldr r0, EvoPointer3
ldr r0, [r0]
mov r1, #NumberEvoPerPokemon
mov r2, #8
mul r1, r2
mul r1, r6
add r0, r1
mov r2, #PrimalReversionIndex
mov r7, #0
Loop3:
cmp r7, #NumberEvoPerPokemon
beq NoPrimal3
ldrh r3, [r0]
cmp r3, r2
beq CheckOrb3
add r0, #8
add r7, #1
b Loop3
CheckOrb3:
ldrh r7, [r0, #4]
bl BData
mov r3, r5
add r3, #0x2E
ldrh r3, [r3]
ldrh r2, [r0, #2]
cmp r3, #0
beq NoPrimal3
cmp r2, #0
beq NoPrimal3
cmp r2, r3
bne NoPrimal3
strh r7, [r5]
ldr r2, var8004
strh r7, [r2]
ChangePokeParty3:
mov r0, r4
mov r1, #0xB
ldr r3, setattr
bl Jump3
mov r0, r4
ldr r3, calcstats3
bl Jump3
ChangeBattleStats3:
mov r1, #0x54
mov r0, r4
ldr r3, getattr3
bl Jump3
strh r0, [r5, #2]
mov r1, #0x55
mov r0, r4
ldr r3, getattr3
bl Jump3
strh r0, [r5, #4]
mov r1, #0x56
mov r0, r4
ldr r3, getattr3
bl Jump3
strh r0, [r5, #6]
mov r1, #0x57
mov r0, r4
ldr r3, getattr3
bl Jump3
strh r0, [r5, #8]
mov r1, #0x58
mov r0, r4
ldr r3, getattr3
bl Jump3
strh r0, [r5, #0xA]
LoadAbilityBit3:
mov r1, #0x2E
mov r0, r4
ldr r3, getattr3
bl Jump3
add r5, #0x20
lsl r0, #0x1F
lsr r0, #0x1F
LoadAbilityTypeAndStore3:
ldr r2, PokePointer3
ldr r2, [r2]
mov r3, #28
mul r3, r7
add r3, r2
add r3, #6
ldrb r2, [r3]
strb r2, [r5, #1]
ldrb r2, [r3, #1]
strb r2, [r5, #2]
add r3, #16
ldrb r2, [r3]
strb r2, [r5]
ldr r0, Bank3
sub r0, #1
strb r2, [r0]
ldr r0, Bank3
mov r1, r10
strb r1, [r0]
pop {r0-r7}
ldr r0, PrimalBS
ldr r1, ExecScript
bl Jumpr1
b BackAfterScript
BData:
push {lr}
mov r1, #0x58
mul r5, r1
ldr r1, BattleData3
add r5, r1
pop {pc}
Jump3:
mov pc, r3
Jumpr1:
mov pc, r1
NoPrimal3:
pop {r0-r7}
StartCheckingSwitchInAbilities:
ldrb r3, [r5]
cmp r1, r3
blo CheckIfSwitchInAbility
mov r0, r10
strb r0, [r2]
CheckIfSwitchInAbility:
ldrb r0, [r7]
cmp r0, #0x2
bne CheckCloudNine
Drizzle:
ldr r2, FreeRam3
ldrb r1, [r2]
cmp r1, #0x00
bne NoSwitchInAbility
ldr r1, Drizzleback
bx r1
CheckCloudNine:
cmp r0, #0x0D
bne CheckIntimidate
b AirLockCloudNine
CheckIntimidate:
cmp r0, #0x16
bne CheckTrace
Intimidate:
ldr r1, Intimidateback
bx r1
CheckTrace:
cmp r0, #0x24
bne CheckSandStream
Trace:
ldr r1, Traceback
bx r1
CheckSandStream:
cmp r0, #0x2D
bne CheckForeCast
SandStream:
ldr r2, FreeRam3
ldrb r1, [r2]
cmp r1, #0x00
bne NoSwitchInAbility
ldr r1, Sandstreamback
bx r1
CheckForeCast:
cmp r0, #0x3B
bne CheckDrought
ForeCast:
ldr r1, Forecastback
bx r1
CheckDrought:
cmp r0, #0x46
bne CheckAirLock
Drought:
ldr r2, FreeRam3
ldrb r1, [r2]
cmp r1, #0x00
bne NoSwitchInAbility
ldr r1, Droughtback
bx r1
CheckAirLock:
cmp r0, #0x4D
bne CheckDelta
AirLockCloudNine:
ldr r2, FreeRam3
ldrb r1, [r2]
cmp r1, #0x00
bne NoSwitchInAbility
ldr r1, Airlockback
bx r1
CheckDelta:
cmp r0, #DeltaStreamAbility
bne CheckDeso
UpdateStrongWind:
ldr r0, CurrentWeather
mov r1, #0
strb r1, [r0]
ldr r0, FreeRam3
ldrb r1, [r0]
cmp r1, #DeltaStreamAbility
beq NoSwitchInAbility
mov r1, #DeltaStreamAbility
strb r1, [r0]
ldr r0, BattleScript3
bl ExecuteScript
BackAfterScript:
ldr r1, BackingAfterScript
bx r1
CheckDeso:
cmp r0, #DesolateLandAbility
bne CheckPrimo
UpdateDesolate:
ldr r2, FreeRam3
mov r0, #DesolateLandAbility
strb r0, [r2]
ldr r2, Droughtback
bx r2
CheckPrimo:
cmp r0, #PrimordialSeaAbility
bne CheckImposter
UpdatePrimordial:
ldr r2, FreeRam3
mov r0, #PrimordialSeaAbility
strb r0, [r2]
ldr r2, Drizzleback
bx r2
CheckImposter:
cmp r0, #ImposterAbility
beq Imposter
NoSwitchInAbility:
ldr r1, ReturnNoSwitch
bx r1
ExecuteScript:
ldr r1, Executescriptback
bx r1
Imposter:
mov r0, r10
ldr r1, Bank3
b CheckFlagAndStore
Store3:
ldr r0, BankTarget3
strb r4, [r0]
pop {r0-r4}
mov r0, r10
strb r0, [r1]
Next3:
ldr r0, BattleScriptImposter
bl ExecuteScript
b BackAfterScript
PopNoSwitch:
pop {r0-r4}
b NoSwitchInAbility
CheckFlagAndStore:
push {r0, r1}
ldr r0, NPokeOnTheField3
ldrb r1, [r0]
cmp r1, #2
beq Simple
pop {r0, r1}
cmp r0, #0
beq ThreeTarget
cmp r0, #2
beq OneTarget
cmp r0, #1
beq TwoTarget
mov r0, #0
b CheckTarget
DoubleBattle3:
ThreeTarget:
mov r0, #3
b CheckTarget
TwoTarget:
mov r0, #2
b CheckTarget
OneTarget:
mov r0, #1
b CheckTarget
Simple:
pop {r0, r1}
cmp r0, #0
beq OneTarget
mov r0, #0
CheckTarget:
push {r0-r4}
ldr r1, BattleData3
mov r2, #0x58
mov r4, r0
mul r0, r2
add r0, r1
add r0, #0x28
ldrh r3, [r0]
cmp r3, #0
beq PopNoSwitch
add r0, #0x28
ldr r3, [r0]
ldr r2, TransformSubStatut
and r2, r3
cmp r2, #0
bne PopNoSwitch
ldr r2, InvulnStatut
mov r0, r4
ldr r3, CheckInvulnerableStatut
lsl r0, #2
add r0, r3
ldr r3, [r0]
and r3, r2
cmp r3, #0
bne PopNoSwitch
b Store3
.align 2
Drizzleback: .word 0x8042B78+1
Intimidateback: .word 0x08042C08+1
Traceback: .word 0x08042C68+1
Sandstreamback: .word 0x08042BA8+1
Forecastback: .word 0x08042C3C+1
Droughtback: .word 0x08042BD8+1
Airlockback: .word 0x08042CA4+1
Executescriptback: .word 0x08042BEE+1
FreeAegi3: .word AegiFreeRam
BattleScriptImposter: .word BattleScriptForImposter
CheckInvulnerableStatut: .word 0x020242AC
PrimalBS: .word PrimalBattleScript
BattleScript3: .word BattleScriptDeltaStream
CurrentMove: .word 0x020241EA
CurrentWeather: .word 0x020243CC
FreeRam3: .word WeathersMegaPrimal
BankTarget3: .word 0x0202420C
Bank3: .word 0x0202420B
InvulnStatut: .word 0x400C0
TransformSubStatut: .word 0x1200000
NPokeOnTheField3: .word 0x0202406C
ReturnNoSwitch: .word 0x08042A7E+1
BackingAfterScript: .word 0x08042A72+1
ExecScript: .word 0x08042BEE+1
ScriptPusher3: .word 0x0803FAFC+1
CurBS3: .word 0x02024214
EvoPointer3: .word EvolutionPointerLocation
PokePointer3: .word PokemonDataPointer
BattleData3: .word 0x02024084
calcstats3: .word 0x08068D0C+1
setattr: .word 0x0806ACAC+1
var8004: .word 0x020275D8 + (0x8004*2)
MemLoc3: .word 0x0202449C
getattr3: .word 0x0806A518+1
PlayerParty3: .word 0x020244EC
AIParty3: .word 0x02024744
@@@@@@@@@@@@@@@@@@@@@@ FAINTPOKEMON (USER) HIJACK
.align 2
FaintPokemonCommand1:
Start4:
ldr r0, BankUser4
ldrb r0, [r0]
strb r0, [r1]
ldr r4, FreeRam4
ldrb r4, [r4]
cmp r4, #0
beq Return4
push {r0-r3}
ldr r1, BattleData4
mov r2, #0x58
mul r0, r2
add r0, r1
add r0, #0x20
ldrb r3, [r0]
ldrb r2, [r0, #8]
cmp r2, #0
bne PopAndReturn4
cmp r3, r4
beq Clear4
pop {r0-r3}
b Return4
Clear4:
pop {r0-r3}
ldr r4, FreeRam4
mov r3, #0
strb r3, [r4]
ldr r4, CurrentWeather4
strb r3, [r4]
bl StartingCheckMegaAegi4
ldr r0, BankTarget4
ldrb r0, [r0]
mov r9, r0
ldr r4, NormalWeatherScript4
ldr r0, SomethingBack4
bx r0
PopAndReturn4:
pop {r0-r3}
Return4:
bl StartingCheckMegaAegi4
ldr r0, BankTarget4
ldrb r0, [r0]
mov r9, r0
ldr r0, Back4
bx r0
StartingCheckMegaAegi4:
push {r0-r7,lr}
mov r5, r8
push {r5}
ldr r0, BankUser4
ldrb r2, [r0]
mov r1, #0x58
mul r2, r1
ldr r1, BattleData4
add r2, r1
add r2, #0x28
ldrh r2, [r2]
cmp r2, #0
bne ComeBack4
ldrb r0, [r0]
ldr r1, MemLoc4
ldr r1, [r1]
add r1, #0x60
mov r3, #0
mov r2, #1
and r2, r0
cmp r2, #0
beq Straight4
mov r3, #3
Straight4:
ldrb r5, [r1, r3]
mov r2, #2
and r2, r0
cmp r2, #0
beq First4
mov r1, #0xF
and r5, r1
b Continue14
First4:
mov r1, #0xF0
and r5, r1
lsr r5, r5, #4
Continue14:
mov r2, #0x64
mul r5, r2
cmp r3, #0
beq PlayerPartyLoading4
AIPartyLoading4:
ldr r4, AIParty4
b Continue4
PlayerPartyLoading4:
ldr r4, PlayerParty4
Continue4:
add r5, r4
ldrh r0, [r5, #0x20]
mov r7, r5
ldr r6, EvoPointer4
ldr r6, [r6]
Loop4:
ldr r1, AegiBlade4
cmp r0, r1
beq RevertAegi4
PrimalCheck4:
mov r3, #NumberEvoPerPokemon
mov r2, #8
mul r3, r2
mul r0, r3
add r0, r6
mov r2, #PrimalReversionIndex
mov r1, #0
Loop24:
cmp r1, #NumberEvoPerPokemon
beq ComeBack4
ldrh r3, [r0]
cmp r3, r2
bne CheckWish4
ContinueChecking4:
ldrh r3, [r0, #2]
cmp r3, #0
bne AddLoop24
ldrh r1, [r0, #4]
b Revert4
CheckWish4:
cmp r3, #WishMegaEvolutionIndex
bne CheckMega4
b ContinueChecking4
CheckMega4:
cmp r3, #MegaEvolutionIndex
bne AddLoop24
b ContinueChecking4
AddLoop24:
add r1, #1
b Loop24
RevertAegi4:
ldr r1, AegiShield4
Revert4:
strh r1, [r5, #0x20]
mov r0, r5
ldr r3, calcstats4
bl Jump4
ComeBack4:
pop {r5}
mov r8, r5
pop {r0-r7, pc}
Jump4:
mov pc, r3
.align 2
SomethingBack4: .word 0x08049C18+1
AegiBlade4: .word AegislashBlade
AegiShield4: .word AegislashShield
EvoPointer4: .word EvolutionPointerLocation
MemLoc4: .word 0x0202449C
CurrentWeather4: .word 0x020243CC
FreeRam4: .word WeathersMegaPrimal
BankTarget4: .word 0x0202420C
BankUser4: .word 0x0202420B
BattleData4: .word 0x02024084
MoxieandClear4: .word BattleScriptMoxieClear
Back4: .word 0x08049BF4+1
PokePointer4: .word PokemonDataPointer
calcstats4: .word 0x08068D0C+1
AIParty4: .word 0x02024744
PlayerParty4: .word 0x020244EC
NormalWeatherScript4: .word BattleScriptClearWeather
/*For that routine I assumed we applied the changes of this post : https://www.pokecommunity.com/showpost.php?p=8963359&postcount=773*/
@@@@@@@@@@@@@@@@@@@@@@@@ FAINTPOKEMON (TARGET) HIJACK
.align 2
FaintPokemonCommand2:
Start5:
ldr r1, b_active_side5
ldr r0, BankTarget5
ldrb r0, [r0]
StartCheckWeather5:
strb r0, [r1]
ldr r4, FreeRam5 @ We're checking if a mega or primal weather is active
ldrb r4, [r4]
cmp r4, #0
beq Return5
push {r0-r3}
ldr r1, BattleData5 @ We're loading the data of the pokemon
mov r2, #0x58
mul r0, r2
add r0, r1
add r0, #0x20
ldrb r3, [r0]
ldrb r2, [r0, #8]
cmp r2, #0 @ We're checking if still has HP
bne PopAndReturn5 @ If so, return
cmp r3, r4 @ Otherwise, we check if it is responsible of the actual mega or primal weather. If so, we remove it and play
beq Clear5 @ the apprioriated BS
pop {r0-r3}
b Return5
Clear5:
pop {r0-r3}
ldr r4, FreeRam5
mov r3, #0
strb r3, [r4] @ So we clear the ram
ldr r4, CurrentWeather5
strb r3, [r4] @ And the weather
bl StartingCheckMegaAegi5 @ Now we check if the poke has to be reverted, i.e is it a mega/primal or Aegi
ldr r0, BankUser5 @ Could be use for any other revert btw, if they exist
ldrb r0, [r0]
mov r9, r0
ldr r4, MoxieandClear5
ldr r0, ReturnSomething5
bx r0
PopAndReturn5:
pop {r0-r3}
Return5:
bl StartingCheckMegaAegi5 @ Here we also have to check if the poke need to be reverted
ldr r0, BankUser5
ldrb r0, [r0]
mov r9, r0
ldr r0, Back5
bx r0
StartingCheckMegaAegi5:
push {r0-r7,lr}
mov r5, r8
push {r5}
ldr r0, BankTarget5
ldrb r2, [r0]
mov r1, #0x58
mul r2, r1
ldr r1, BattleData5
add r2, r1
add r2, #0x28
ldrh r2, [r2]
cmp r2, #0 @ Check if the pokemon is indeed fainted
bne ComeBack5
ldrb r0, [r0]
ldr r1, MemLoc5
ldr r1, [r1]
add r1, #0x60 @ The pointer in MemLoc + 0x60 contains the order of your party and the party of the ennemy
mov r3, #0
mov r2, #1
and r2, r0 @ We "and" the Bank target with 1 to know whether we have to load the ennemy party or the player party
cmp r2, #0
beq Straight5
mov r3, #3 @ Used to load ennemy party
@ Otherwise r3 stays 0
Straight5: @ Our party takes the 3 first bytes, no matter how many poke you have, the 3 following are the order of the ennemy party
ldrb r5, [r1, r3] @ So we load it accordingly thanks to r3
mov r2, #2
and r2, r0 @ Now we're "anding" again, but with 2, to know whether the pokemon is the first or the second (in double)
cmp r2, #0 @ Don't worry it works also in simple
beq First5
mov r1, #0xF @ This party needs an explanation I think.
and r5, r1 @ So, assuming you have six pokemon, and you didn't switch/faint, the order in the RAM will be "01 23 45", 0 = first poke, 1 = second, and so on
b Continue15 @ It is the same for the ennemy, but 3 bytes further.
@ So, if it is the first poke, by "anding" wih 0xF0, we save the "index" or whatever you call that of the first poke. by
First5: @ "anding" with 0xF, we save the second poke. Then we have to divide by 16 (because hex) if it was the first poke (lsr r5, r5, #4)
mov r1, #0xF0 @ because if the order of your party was 23 45 01 for instance, anding with 0xF0 would give us 0x20, with the divide we have 0x2.
and r5, r1
lsr r5, r5, #4
Continue15:
mov r2, #0x64 @ Size of the data of a pokemon in the party (100 bytes or 0x64 bytes)
mul r5, r2 @ IndexOfOurPoke x Size of the data
cmp r3, #0 @ We're using r3 again to know whether we have to load the party of the player or the ennemy
beq PlayerPartyLoading5
AIPartyLoading5:
ldr r4, AIParty5
b Continue5
PlayerPartyLoading5:
ldr r4, PlayerParty5
Continue5:
add r5, r4
ldrh r0, [r5, #0x20] @ Assuming you correctly applied the change to prevent the decrypt poke, the index number of your pokemon
mov r7, r5 @ is the halfword at the 0x20th byte in its battle data.
ldr r6, EvoPointer5
ldr r6, [r6] @ Here I load the evolutions of the poke from a pointer, that way if you repointed you tables/expanded your evolution
@ the routine still works.
Loop5: @ Here the loop starts. It checks if your pokemon is aegi/primal/wish or mega evo, if so => Revert.
ldr r1, AegiBlade5
cmp r0, r1
beq RevertAegi5
PrimalCheck5:
mov r3, #NumberEvoPerPokemon
mov r2, #8
mul r3, r2
mul r0, r3
add r0, r6
mov r2, #PrimalReversionIndex
mov r1, #0
Loop25:
cmp r1, #NumberEvoPerPokemon
beq ComeBack5
ldrh r3, [r0]
cmp r3, r2
bne CheckWish5
ContinueChecking5:
ldrh r3, [r0, #2]
cmp r3, #0
bne AddLoop25
ldrh r1, [r0, #4]
b Revert5
CheckWish5:
cmp r3, #WishMegaEvolutionIndex
bne CheckMega5
b ContinueChecking5
CheckMega5:
cmp r3, #MegaEvolutionIndex
bne AddLoop25
b ContinueChecking5
AddLoop25:
add r1, #1
b Loop25
RevertAegi5:
ldr r1, AegiShield5
Revert5:
strh r1, [r5, #0x20]
mov r0, r5
ldr r3, calcstats5
bl Jump5
ComeBack5:
pop {r5}
mov r8, r5
pop {r0-r7, pc}
Jump5:
mov pc, r3
.align 2
b_active_side5: .word 0x02024064
ReturnSomething5: .word 0x08049C18+1
AegiBlade5: .word AegislashBlade
AegiShield5: .word AegislashShield
EvoPointer5: .word EvolutionPointerLocation
MemLoc5: .word 0x0202449C
CurrentWeather5: .word 0x020243CC
FreeRam5: .word WeathersMegaPrimal
BankTarget5: .word 0x0202420C
BankUser5: .word 0x0202420B
BattleData5: .word 0x02024084
MoxieandClear5: .word BattleScriptMoxieClear
Back5: .word 0x08049C16+1
PokePointer5: .word PokemonDataPointer
calcstats5: .word 0x08068D0C+1
AIParty5: .word 0x02024744
PlayerParty5: .word 0x020244EC
@@@@@@@@@@@@@@@@@@@@ CLEAR EVERYTHING END OF BATTLE
.align 2
ClearRamEndBattle:
CheckAegi6:
push {r0-r7}
mov r5, #0
ldr r7, PlayerParty6
ldr r6, EvoPointer6
ldr r6, [r6]
Loop6:
cmp r5, #6
beq BackEnd6
mov r4, r5
mov r2, #0x64
mul r4, r2
add r4, r7
mov r1, #0xB
mov r0, r4
ldr r3, getattr6
bl Jump6
cmp r0, #00
beq Loopplusone6
ldr r1, ABlade6 @ Check Aegi Blade
cmp r0, r1
beq RevertAegi6
PrimalCheck6:
mov r3, #NumberEvoPerPokemon
mov r2, #8
mul r3, r2
mul r0, r3
add r0, r6
mov r2, #PrimalReversionIndex
mov r1, #0
Loop26:
cmp r1, #NumberEvoPerPokemon
beq AddLoop6
ldrh r3, [r0]
cmp r3, r2
bne CheckWish6
ContinueChecking6:
ldrh r3, [r0, #2]
cmp r3, #0
bne AddLoop26
ldrh r1, [r0, #4]
b Revert6
CheckWish6:
cmp r3, #WishMegaEvolutionIndex
bne CheckMega6
b ContinueChecking6
CheckMega6:
cmp r3, #MegaEvolutionIndex
bne AddLoop26
b ContinueChecking6
AddLoop26:
add r1, #1
b Loop26
AddLoop6:
add r5, #1
b Loop6
Loopplusone6:
add r5, #1
b Loop6
BackEnd6:
pop {r0-r7}
b ClearRam6
RevertAegi6:
ldr r1, AShield6
b Revert6
Revert6:
add r5, #1
ldr r2, var80046
strh r1, [r2]
mov r0, r4
mov r1, #0xB
ldr r3, setattr6
bl Jump6
mov r0, r4
ldr r3, calcstats6
bl Jump6
b Loop6
ClearRam6:
ldr r0, Someotherstuff6
str r0, [r1]
ldr r0, FreeRam6
mov r1, #0
strb r1, [r0]
ldr r0, FreeRam26
strb r1, [r0]
ldr r0, MegaRam6
str r1, [r0]
str r1, [r0, #4]
strh r1, [r0, #8]
ldr r1, LocSomething6
ldr r0, LocStuff6
str r0, [r1]
ldr r0, Locstuffthing6
mov pc, r0
Jump6:
mov pc, r3
.align 2
Someotherstuff6: .word 0x803DE41
LocSomething6: .word 0x30061E8
LocStuff6: .word 0x8038421
Locstuffthing6: .word 0x803DE2A
MegaRam6: .word DoubleWordMega
FreeRam6: .word WeathersMegaPrimal
FreeRam26: .word AegiFreeRam
ABlade6: .word AegislashBlade
AShield6: .word AegislashShield
MemLoc6: .word 0x0202449C
getattr6: .word 0x0806A518+1
Bank6: .word 0x0202420B
PlayerParty6: .word 0x020244EC
calcstats6: .word 0x08068D0C+1
setattr6: .word 0x0806ACAC+1
var80046: .word 0x020275D8 + (0x8004*2)
EvoPointer6: .word EvolutionPointerLocation
@@@@@@@@@@@@ Battle script player/partner
.align 2
MegaBSPlayer: @ MegaBattleScriptForPlayer
.byte SetWordCommand
.word YourWordLocation
.word LocationStringUU
.byte 0x10, 0x84, 0x1 @ printstring 0x184
.byte 0x12, 0x20, 0x0 @ waitmessage
.byte 0x45 @ playanimation
.byte 0x1 @ Bankuser
.byte YourMegaAnimationIndex
.word 0x0
.byte 0xA @ waitanimation
.byte CallAsmCommand
.word PlayCry
.byte SetWordCommand
.word YourWordLocation
.word LocationStringLL
.byte 0x10, 0x84, 0x1 @ printstring 0x184
.byte 0x12, 0x40, 0x0 @ waitmessage
.byte CallAsmCommand
.word HelpSwitchIn
.byte 0x3C @ return
.align 2
BattleScriptWishPlayer: @ WishBattleScriptForPlayer
.byte SetWordCommand
.word YourWordLocation
.word LocationStringZZ
.byte 0x10, 0x84, 0x1 @ printstring 0x184
.byte 0x12, 0x20, 0x0 @ waitmessage
.byte 0x45 @ playanimation
.byte 0x1 @ Bankuser
.byte YourMegaAnimationIndex
.word 0x0
.byte 0xA @ waitanimation
.byte CallAsmCommand
.word PlayCry
.byte SetWordCommand
.word YourWordLocation
.word LocationStringLL
.byte 0x10, 0x84, 0x1 @ printstring 0x184
.byte 0x12, 0x40, 0x0 @ waitmessage
.byte CallAsmCommand
.word HelpSwitchIn
.byte 0x3C @ return
.align 2
MegaBSPlayer2: @ MegaBattleScriptForPlayer2
.byte SetWordCommand
.word YourWordLocation
.word LocationStringUU2
.byte 0x10, 0x84, 0x1 @ printstring 0x184
.byte 0x12, 0x20, 0x0 @ waitmessage
.byte 0x45 @ playanimation
.byte 0x1 @ Bankuser
.byte YourMegaAnimationIndex
.word 0x0
.byte 0xA @ waitanimation
.byte CallAsmCommand
.word PlayCry
.byte SetWordCommand
.word YourWordLocation
.word LocationStringLL
.byte 0x10, 0x84, 0x1 @ printstring 0x184
.byte 0x12, 0x40, 0x0 @ waitmessage
.byte CallAsmCommand
.word HelpSwitchIn
.byte 0x3C @ return
.align 2
BattleScriptWishPlayer2: @ WishBattleScriptForPlayer2
.byte SetWordCommand
.word YourWordLocation
.word LocationStringZZ2
.byte 0x10, 0x84, 0x1 @ printstring 0x184
.byte 0x12, 0x20, 0x0 @ waitmessage
.byte 0x45 @ playanimation
.byte 0x1 @ Bankuser
.byte YourMegaAnimationIndex
.word 0x0
.byte 0xA @ waitanimation
.byte CallAsmCommand
.word PlayCry
.byte SetWordCommand
.word YourWordLocation
.word LocationStringLL
.byte 0x10, 0x84, 0x1 @ printstring 0x184
.byte 0x12, 0x40, 0x0 @ waitmessage
.byte CallAsmCommand
.word HelpSwitchIn
.byte 0x3C @ return
@@@@@@@@@@@@@@@@@ Battle script AI first/second poke
.align 2
MegaBSForAI: @ MegaBattleScriptForAI
.byte SetWordCommand
.word YourWordLocation
.word LocationStringUUAI
.byte 0x10, 0x84, 0x1 @ printstring 0x184
.byte 0x12, 0x20, 0x0 @ waitmessage
.byte 0x45 @ playanimation
.byte 0x1 @ Bankuser
.byte YourMegaAnimationIndex
.word 0x0
.byte 0xA @ waitanimation
.byte CallAsmCommand
.word PlayCry
.byte SetWordCommand
.word YourWordLocation
.word LocationStringLLAI
.byte 0x10, 0x84, 0x1 @ printstring 0x184
.byte 0x12, 0x40, 0x0 @ waitmessage
.byte CallAsmCommand
.word HelpSwitchIn
.byte 0x3C @ return
.align 2
BattleScriptWishAI: @ WishBattleScriptForAI
.byte SetWordCommand
.word YourWordLocation
.word LocationStringZZAI
.byte 0x10, 0x84, 0x1 @ printstring 0x184
.byte 0x12, 0x20, 0x0 @ waitmessage
.byte 0x45 @ playanimation
.byte 0x1 @ Bankuser
.byte YourMegaAnimationIndex
.word 0x0
.byte 0xA @ waitanimation
.byte CallAsmCommand
.word PlayCry
.byte SetWordCommand
.word YourWordLocation
.word LocationStringLLAI
.byte 0x10, 0x84, 0x1 @ printstring 0x184
.byte 0x12, 0x40, 0x0 @ waitmessage
.byte CallAsmCommand
.word HelpSwitchIn
.byte 0x3C @ return
.align 2
MegaBSForAI2: @ MegaBattleScriptForAI2
.byte SetWordCommand
.word YourWordLocation
.word LocationStringUUAI2
.byte 0x10, 0x84, 0x1 @ printstring 0x184
.byte 0x12, 0x20, 0x0 @ waitmessage
.byte 0x45 @ playanimation
.byte 0x1 @ Bankuser
.byte YourMegaAnimationIndex
.word 0x0
.byte 0xA @ waitanimation
.byte CallAsmCommand
.word PlayCry
.byte SetWordCommand
.word YourWordLocation
.word LocationStringLLAI
.byte 0x10, 0x84, 0x1 @ printstring 0x184
.byte 0x12, 0x40, 0x0 @ waitmessage
.byte CallAsmCommand
.word HelpSwitchIn
.byte 0x3C @ return
.align 2
BattleScriptWishAI2: @ WishBattleScriptForAI2
.byte SetWordCommand
.word YourWordLocation
.word LocationStringZZAI2
.byte 0x10, 0x84, 0x1 @ printstring 0x184
.byte 0x12, 0x20, 0x0 @ waitmessage
.byte 0x45 @ playanimation
.byte 0x1 @ Bankuser
.byte YourMegaAnimationIndex
.word 0x0
.byte 0xA @ waitanimation
.byte CallAsmCommand
.word PlayCry
.byte SetWordCommand
.word YourWordLocation
.word LocationStringLLAI
.byte 0x10, 0x84, 0x1 @ printstring 0x184
.byte 0x12, 0x40, 0x0 @ waitmessage
.byte CallAsmCommand
.word HelpSwitchIn
.byte 0x3C @ return
@@@@@@@@@@@@@@@@@ Strings Player/Partner
.align 2
StringUU: @ String UU
.byte BuffCharac, 0xF, Space, i_, s_, Space, r_, e_, a_, c_, t_, i_, n_, g_, Space, t_
.byte o_, Space, BuffCharac, 0x23, JumpLine, M_, e_, g_, a_, Space, B_, r_, a_, c_, e_, l_
.byte e_, t_, Exclam, Termin
.align 2
StringZZ: @ String ZZ
.byte BuffCharac, 0x23, Apos, s_, Space, f_, e_, r_, v_, e_, n_, t_, Space, w_, i_, s_
.byte h_, JumpLine, r_, e_, a_, c_, h_, e_, d_, Space, BuffCharac, 0x0F, Exclam, Termin
.align 2
StringLL: @ String LL
.byte BuffCharac, 0xF, Space, h_, a_, s_, Space, M_, e_, g_, a_, Space, E_, v_, o_, l_
.byte v_, e_, d_, Space, i_, n_, t_, o_, JumpLine, M_, e_, g_, a_, Space, BuffCharac, 0xF
.byte Exclam, Termin
.align 2
StringUU2: @ String UU2
.byte BuffCharac, 0xF, Space, i_, s_, Space, r_, e_, a_, c_, t_, i_, n_, g_, Space, t_
.byte o_, Space, BuffCharac, 0x33, Apos, s_, JumpLine, M_, e_, g_, a_, Space, B_, r_, a_, c_, e_, l_
.byte e_, t_, Exclam, Termin
.align 2
StringZZ2: @ String ZZ2
.byte BuffCharac, 0x33, Apos, s_, Space, f_, e_, r_, v_, e_, n_, t_, Space, W_, i_, s_
.byte h_, JumpLine, r_, e_, a_, c_, h_, e_, d_, Space, BuffCharac, 0xF, Exclam, Termin
@@@@@@@@@@@@@@@@@@ Strings AI/Second poke AI
.align 2
StringUUAI: @ String UUAI
.byte BuffCharac, 0xF, Space, i_, s_, Space, r_, e_, a_, c_, t_, i_, n_, g_, Space, t_
.byte o_, Space, BuffCharac, 0x1D, JumpLine, M_, e_, g_, a_, Space, B_, r_, a_, c_, e_, l_
.byte e_, t_, Exclam, Termin
.align 2
StringZZAI: @ String ZZAI
.byte BuffCharac, 0x1D, Apos, s_, Space, f_, e_, r_, v_, e_, n_, t_, Space, W_, i_, s_
.byte h_, JumpLine, r_, e_, a_, c_, h_, e_, d_, Space, BuffCharac, 0xF, Exclam, Termin
.align 2
StringLLAI: @ String LLAI
.byte BuffCharac, 0xF, Space, h_, a_, s_, Space, M_, e_, g_, a_, Space, E_, v_, o_, l_
.byte v_, e_, d_, Space, i_, n_, t_, o_, JumpLine, M_, e_, g_, a_, Space, BuffCharac, 0x8
.byte Exclam, Termin
.align 2
StringUUAI2: @ String UUAI2
.byte BuffCharac, 0xF, Space, i_, s_, Space, r_, e_, a_, c_, t_, i_, n_, g_, Space, t_
.byte o_, Space, BuffCharac, 0x2F, JumpLine, M_, e_, g_, a_, Space, B_, r_, a_, c_, e_, l_
.byte e_, t_, Exclam, Termin
.align 2
StringZZAI2: @ String ZZAI2
.byte BuffCharac, 0x2F, Apos, s_, Space, f_, e_, r_, v_, e_, n_, t_, Space, W_, i_, s_
.byte h_, JumpLine, r_, e_, a_, c_, h_, e_, d_, Space, BuffCharac, 0xF, Exclam, Termin
@@@@@@@@@@@ End Strings.
.align 2
PlayCryRoutine: @@ Play cry routine
push {lr}
ldr r0, BattleData8
ldr r3, Bank8
ldrb r3, [r3]
mov r2, #0x58
mul r3, r2
add r3, r0
ldrh r0, [r0]
mov r1, #0x19
neg r1, r1
mov r2, #0x5
ldr r3, play_cry_maybe8
bl Jump8
pop {pc}
Jump8:
mov pc, r3
.align 2
Bank8: .word 0x202420B
BattleData8: .word 0x2024084
play_cry_maybe8: .word 0x80A32E4+1
.align 2
HelpSwitchInRoutine: @@ Help switch-in abilities for mega
Start9:
push {lr}
ldr r1, bank9
ldrb r1, [r1]
mov r0, #0
mov r2, #0
mov r3, #0
ldr r4, ability_something9
bl Jump9
cmp r0, #0
beq Return9
ldr r0, CurrentBS9
ldr r1, [r0]
sub r1, #5
str r1, [r0]
pop {pc}
Return9:
pop {pc}
Jump9:
mov pc, r4
.align 2
bank9: .word 0x0202420B
ability_something9: .word 0x08042828+1
CurrentBS9: .word 0x02024214
.align 2
BattleScriptPrimal: @@ PrimalBattleScript
.byte SetWordCommand
.word LocationStringPrim
.byte 0x10, 0x84, 0x1 @ printstring 0x184
.byte 0x12, 0x20, 0x0 @ waitmessage
.byte 0x45 @ playanimation
.byte 0x1 @ Bankuser
.byte YourMegaAnimationIndex
.word 0x0
.byte 0xA @ waitanimation
.byte CallAsmCommand
.word PlayCry
.byte SetWordCommand
.word YourWordLocation
.word LocationStringPrimal
.byte 0x10, 0x84, 0x1 @ printstring 0x184
.byte 0x12, 0x40, 0x0 @ waitmessage
.byte CallAsmCommand
.word HelpSwitchInPrimal
.byte 0x41 @ Call command
.word 0x82DB48D
.byte 0x3F @ End3 command
.align 2
StringPrimalNull:
.byte Space, Termin
.align 2
StringPrimal: @ String primal
.byte BuffCharac, 0x13, Apos, s_, Space, P_, r_, i_, m_, a_, l_, Space, R_, e_, v_, e_
.byte r_, s_, i_, o_, n_, Exclam, JumpLine, i_, t_, Space, r_, e_, v_, e_, r_, t_
.byte e_, d_, Space, t_, o_, Space, i_, t_, s_, Space, p_, r_, i_, m_, a_, l_
.byte Space, f_, o_, r_, m_, Exclam, Termin
.align 2
PrimalSwitchInRoutine: @ Help switch-in primal.
Start10:
push {lr}
ldr r1, bank10
ldrb r1, [r1]
cmp r1, #0
beq Return
mov r0, #0
mov r2, #0
mov r3, #0
ldr r4, ability_something10
bl Jump10
cmp r0, #0
beq Return10
ldr r0, CurrentBS10
ldr r1, [r0]
sub r1, #5
str r1, [r0]
Return10:
pop {pc}
Jump10:
mov pc, r4
.align 2
bank10: .word 0x0202420B
ability_something10: .word 0x08042828+1
CurrentBS10: .word 0x02024214
.align 2
ImposterBattleScript: @ Battlescript imposter
.byte CallAsmCommand
.word FirstRoutineTransform
.byte 0x9B @ Transformdataexecution
.byte 0x9 @ Attackanimation
.byte 0xA @ Waitanimation
.byte 0x13 @ Printfromtable
.word 0x85CC8D4
.byte 0x12, 0x40, 0x0
.byte CallAsmCommand
.word SecondRoutineTransform
.byte 0x3F @ End3
.align 2
RoutineTransformSecond: @ FirstRoutineTransform
push {lr}
ldr r0, CurrentMove11
ldrh r1, [r0]
ldr r2, ImposterLocation11
strh r1, [r2]
mov r1, #0x90 @ Transform Move
strh r1, [r0]
pop {pc}
.align 2
ImposterLocation11: .word ImposterLocation
CurrentMove11: .word 0x20241EA
.align 2
RoutineTransformFirst: @ SecondRoutineTransform
push {lr}
ldr r0, CurrentMove12
ldr r2, ImposterLocation12
ldrh r1, [r2]
strh r1, [r0]
pop {pc}
.align 2
ImposterLocation12: .word ImposterLocation
CurrentMove12: .word 0x20241EA
.align 2
ScriptMoxieClear: @ BattleScriptMoxieClear
.byte 0x56, 0x0, 0x39, 0x40, 0x0, 0x1A, 0x0, 0x1B, 0x0, 0x10, 0x1D, 0x0, 0x10, 0x30, 0x1, 0x39
.byte 0x40, 0x0
.byte SetWordCommand
.word YourWordLocation
.word StringWeatherFade+SizeRom
.byte 0x10, 0x84, 0x1, 0x12, 0x40, 0x0, 0x1E, 0x1
.byte MoxieAbility
.word JumpIfMoxie+SizeRom
.byte 0x3C
JumpIfMoxie:
.byte 0xE3, 0x1
.word JumpIfUserFainted+SizeRom
.byte 0x20, 0x1, 0x0, 0x1, 0xC
.word JumpIfUserFainted+SizeRom
.byte 0x39, 0x20, 0x0, 0x2E
.word 0x202448F
.byte 0x0, 0x48, 0x1, 0x2, 0x0, 0x2E
.word 0x202448E
.byte 0x11, 0x89, 0x41
.word JumpIfUserFainted+SizeRom
.byte SetWordCommand
.word YourWordLocation
.word StringMoxie+SizeRom
.byte 0x10, 0x84, 0x1, 0x12, 0x40, 0x0
JumpIfUserFainted:
.byte 0x3C
.align 2
StringWeatherFade:
.byte T_, h_, e_, Space, w_, e_, a_, t_, h_, e_, r_, Space, h_, a_, s_, Space
.byte r_, e_, t_, u_, r_, n_, e_, d_, JumpLine, t_, o_, Space, n_, o_, r_, m_
.byte a_, l_, Exclam, Termin
.align 2
StringMoxie:
.byte BuffCharac, 0xF, Apos, s_, Space, M_, o_, x_, i_, e_, JumpLine, r_, a_, i_, s_, e_
.byte d_, Space, i_, t_, s_, Space, A_, t_, t_, a_, c_, k_, Exclam, Termin
.align 2
DeltaStreamBattleScript: @@ BattleScriptDeltaStream
.byte SetWordCommand
.word YourWordLocation
.word StringDeltaStream+SizeRom
.byte 0x10, 0x84, 0x1, 0x12, 0x40, 0x0, 0x45
.byte 0x0
.byte YourDeltaStreamAnimIndex
.word 0x0
.byte 0xA, 0x41
.word 0x82DB48D
.byte 0x3F
.byte 0xFF
.byte 0xFF
.align 2
StringDeltaStream:
.byte A_, Space, m_, y_, s_, t_, e_, r_, i_, o_, u_, s_, Space, a_, i_, r_
.byte Space, c_, u_, r_, r_, e_, n_, t_, Space, i_, s_, JumpLine, p_, r_, o_, t_
.byte e_, c_, t_, i_, n_, g_, Space, F_, l_, y_, i_, n_, g_, Dash, t_, y_
.byte p_, e_, Space, P_, o_, k_, e_, m_, o_, n_, Exclam, Termin
.align 2
ClearWeatherBattleScript: @ BattleScriptClearWeather
.byte SetWordCommand
.word YourWordLocation
.word StringWeatherFade+SizeRom
.byte 0x10, 0x84, 0x1, 0x12, 0x40, Space, 0x56, 0x1, 0x39, 0x40, 0x0, 0x1A, 0x1, 0x1B, 0x1, 0x10
.byte 0x1C, Space, 0x3C, 0xFF