For Regenerator, do we need to re-insert the routine if we're using your ROMbase and fixed Natural Cure with the byte changes, or should it work fine on its own?
Fur coat/multiscale still break the battle system (even if the ability is not in the battle), and noguard doesn't work for me
.text
.align 2
.thumb
.thumb_func
.global moldbreaker
AbilityBufferUser:
push {r2-r4}
ldr r0, .Bank
ldrb r0, [r0]
mov r1, #0x58
ldr r2, .BattleData
mul r0, r1
add r0, r0, r2
ldrb r0, [r0]
MoldBreakerCheck:
cmp r0, #0x69
beq MoldBreaker
cmp r0, #0xA4
beq MoldBreaker
cmp r0, #0xA5
bne Return
MoldBreaker:
AbilityBufferTarget:
ldr r0, .Bank
add r0, #0x1
ldrb r4, [r0]
mul r1, r4
add r1, r1, r2
ldrb r3, [r1]
LoadTable:
ldr r0, .MoldBreakerTable
add r2, r0, r3
ldrb r0, [r2]
CheckIfAffected:
cmp r0, #0x0
beq Return
Affected:
mov r0, #0xFF
strb r0, [r1]
ldr r0, .DisabledAbilityLoc
add r0, r4
strb r3, [r0]
Return:
pop {r2-r4}
bl Canceler
lsl r0, r0, #0x18
lsr r2, r0, #0x18
cmp r2, #0x0
beq Continue
ldr r0, .Return
bx r0
Continue:
ldr r0, .Return2
bx r0
Canceler:
ldr r0, .Return3
bx r0
.align 2
.Bank: .word 0x0202420B
.BattleData: .word 0x020240A4
.MoldBreakerTable: .word 0x08TTTTTT
.DisabledAbilityLoc: .word 0x0203E32C
.Return: .word 0x08046399
.Return2: .word 0x08046073
.Return3: .word 0x08041A6D
#insert 00 48 00 47 xx xx xx 08 at 046064
.text
.align 2
.thumb
.thumb_func
.global moldbreakermultipletargets
AbilityBufferUser:
push {r1-r4}
ldr r0, .Bank
ldrb r0, [r0]
mov r1, #0x58
ldr r2, .BattleData
mul r0, r1
add r0, r0, r2
ldrb r0, [r0]
MoldBreakerCheck:
cmp r0, #0x69
beq MoldBreaker
cmp r0, #0xA4
beq MoldBreaker
cmp r0, #0xA5
bne Return
MoldBreaker:
AbilityBufferTarget:
ldr r0, .Bank
add r0, #0x1
ldrb r4, [r0]
mul r1, r4
add r1, r1, r2
ldrb r3, [r1]
LoadTable:
ldr r0, .MoldBreakerTable
add r2, r0, r3
ldrb r0, [r2]
CheckIfAffected:
cmp r0, #0x0
beq Return
Affected:
mov r0, #0xFF
strb r0, [r1]
ldr r0, .DisabledAbilityLoc
add r0, r4
strb r3, [r0]
Return:
pop {r1-r4}
ldr r0, [r1]
add r0, #0x1
str r0, [r1]
pop {r0}
bx r0
.align 2
.Bank: .word 0x0202420B
.BattleData: .word 0x020240A4
.MoldBreakerTable: .word 0x08TTTTTT
.DisabledAbilityLoc: .word 0x0203E32C
#insert 00 48 00 47 xx xx xx 08 at 04AF78
09 0A E2 00 58 00 3A
2B 04 EC 2F 02 02
08 00 00 00
YY YY YY 08
2E 3A 43 02 02
05 F6
4C 00
4D 00
4E 00
00 3A 10 54 01
F9 XX+1 XX XX 08
52 00 28 4E 8A 2D 08
.text
.align 2
.thumb
.thumb_func
.global moldbreakermultipletargets
AbilityBufferUser:
push {lr}
ldr r0, .Bank
ldrb r0, [r0]
mov r1, #0x58
ldr r2, .BattleData
mul r0, r1
add r0, r0, r2
ldrb r0, [r0]
MoldBreakerCheck:
cmp r0, #0x69
beq MoldBreaker
cmp r0, #0xA4
beq MoldBreaker
cmp r0, #0xA5
bne Return
MoldBreaker:
AbilityBufferTarget:
ldr r0, .Bank
add r0, #0x1
ldrb r4, [r0]
mul r1, r4
add r1, r1, r2
ldrb r3, [r1]
LoadTable:
ldr r0, .MoldBreakerTable
add r2, r0, r3
ldrb r0, [r2]
CheckIfAffected:
cmp r0, #0x0
beq Return
Affected:
mov r0, #0xFF
strb r0, [r1]
ldr r0, .DisabledAbilityLoc
add r0, r4
strb r3, [r0]
Return:
pop {r0}
bx r0
.align 2
.Bank: .word 0x0202420B
.BattleData: .word 0x020240A4
.MoldBreakerTable: .word 0x08TTTTTT
.DisabledAbilityLoc: .word 0x0203E32C
.text
.align 2
.thumb
.thumb_func
.global restoreabilities
EndTurn:
ldr r0, .Outcome
mov r1, #0x0
strb r1, [r0]
ldr r0, .Index
strb r1, [r0]
RestoreAbilities:
push {r2-r6}
ldr r4, .Battlers
ldrb r4, [r4]
mov r3, #0x0
ldr r5, .DisabledAbilityLoc
ldr r6, .BattleData
Loop:
ldrb r2, [r5, #0x0]
cmp r2, #0x0
beq EndLoop
strb r2, [r6]
strb r1, [r5]
EndLoop:
add r3, r3, #0x1
cmp r3, r4
bge Exit
add r5, r5, #0x1
add r6, r6, #0x58
b Loop
Exit:
pop {r2-r6}
ldr r1, .EndLoc
mov r0, #0xB
strb r0, [r1]
pop {r0}
bx r0
.align 2
.Outcome: .word 0x0202427C
.Index: .word 0x02024064
.Battlers: .word 0x0202406C
.DisabledAbilityLoc: .word 0x0203E32C
.BattleData: .word 0x020240A4
.EndLoc: .word 0x02024083
#insert 00 48 00 47 xx xx xx 08 at 04B67C
Mold Breaker
Kudos for porting this! Saves me a lot of time.
Just 2 corrections need to be done.
1. In Routine I: .Return2: .word 0x08046072 should be +1
2. In routine IV the instruction should be:
At 4B67C: 00 48 00 47 XX+1 XX XX 08. (in FR I replaced the 'end' command with the ASM. But the Emerald's 'end' BS command uses a special BL (probably for battle frontier purposes) which is not the case in FR, so performing a branch in the 'end' code with this routine is the way to go.)
Also a fun fact. The '09' present at start the Battle Script of Routine 3 executes the Roar, Whirlwind animation.
Their battle scripts do not use the 'moveanimation' command directly but their animation is executed by this script reached via the 'forceswitch' command.
And this why the move animation for 'dragon tail' plays twice (the first reference to the move animation from the main battle script + the second reference this script).
So move id checks can be placed so that the second reference is skipped for moves like 'dragon tail' or 'circle throw'.
All fixed! Thanks KDS. Also that note about the roar animation is fantastic, i'll definitely remember it. To be honest rather than having the animation play once, it'd be best to play the move animation, and then at the 09 command, play the whirlwind animation.
You may also have noticed that I optimised the ability checks a tad, just shifts exactly what registers get put in where, saving on a few command cycles (no need to mov #0x58 a second time for example), you may want to consider doing those for FR too, just to save on the tiny bit of free space. No biggy though, fantastic code.
To be honest I'm also thinking of expanding your Routine 1, to include Protean because that'd probably be the best place for it. Thoughts? I'm just unsure of whether Protean would also need to be included in Routine 2.
I'm also going to reserve this post for porting your Unaware / Magic Bounce Code. Maybe a few other ones from my own rombase that I've got ready.
1. That is a superb idea.
2. I'll def look into it.Also correcting my grammar in that post.
3. It looks the best place. But before implementing this I suggest reading the Bulbapedia article regarding Protean. A very detailed explanation is given for it.
4. Regarding Unaware. The Emerald code will require 6 routines instead of 4. This is because of the different way Doesn't and Tailes made the DPSS for Fire Red and Emerald respectively. The accuaracy ones can be ported but different routines for attack, defense, special attack and special defense have to be coded from scratch.
The byte changes actually re-insert the routine for you. The implementation was broken, so the byte changes make it reflect this new routine.
Fur Coat and Multiscale definitely work 100% as intended, no breaking at all.
I fixed No Guard, basically I put a ldr, instead of ldrb, for the bank check, it definitely works now.
Mold Breaker, Teravolt and Turboblaze
Spoiler:Emerald (credits to KDS for the original Fire Red routines)
Spoiler:Step 1
Spoiler:Mold Breaker Table
Spoiler:00 00 00 00 01 01 00 01 01 00 01 01 01 00 00 01
00 02 01 01 01 01 00 00 00 01 02 00 00 01 00 00
00 00 00 00 00 00 00 01 01 01 00 01 00 00 00 01
00 00 00 01 01 00 00 00 00 00 00 00 01 00 00 01
00 00 00 00 00 00 00 00 01 01 00 01 00 00 01 01
00 00 01 00 00 00 01 01 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 02 00 00 00 00 00 00 01 00
01 00 00 00 00 01 00 00 00 00 00 01 00 00 00 01
00 00 00 00 00 00 00 01 01 01 00 00 00 01 00 01
00 00 01 00 01 00 00 00 00 00 00 00 00 01 01 00
00 00 00 00 00 00 00 00 00 00 01 00 01 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Insert this table if your ROM has the abilities in the same order that is mentioned in the OP (otherwise you will have to modify according to the format.
There are 256 entries in this table which equal to the maximum No. of abilities that can be accomodated in a GBA rom.
An entry for each ability takes one byte of space and there are entries for every ability. The entry is set to 00 if Mold Breaker does not negate the ability, 01 (or a non-zero value) if Mold Breaker is able to negate it and 02 if the the ability is negated to simulate the Gen V hazard effect.
For e.g, the first entry is for Ability ID 0x0 and does not need to be negated by mold breaker so its entry is set to 00. The second entry is for Stench (ID = 0x1) so set to 00. The 6th entry is set to 01 because MB negates Sturdy (ID = 0x5).
There are some abilities that do not work with this method and require special explicit checks and there entry is set to 00 to avoid wastage of time.
Spoiler:1. Damp (it checks in the whole battle field rather than a single target, so the 'faintifnotdamp' battlescript command needs to be edited for this. I'm leaving this for now)
2. Lightning and Storm Drain (mold breaker should allow redirection of move).
3. Friend Guard, Aroma Veil, Sweet Veil, Flower Veil (the target's boosts are sometimes by virtue of its ally's ability).
Modify the table accordingly if there is a need to.
Step 2
1a. Replace x8TTTTTT in the routines with the offset of the Mold breaker table.Spoiler:
1b. Insert these routines with byte changes in the respective code comments.
Spoiler:Routine 1 (Checks for user's Mold Breaker prior to move execution and then disables abilities that negate, also probably the best place to insert Stance Change)
Routine II (Checks for user's Mold Breaker in target iterating moves like Earthquake and then disables abilities that negate damage)Spoiler:Code:.text .align 2 .thumb .thumb_func .global moldbreaker AbilityBufferUser: push {r2-r4} ldr r0, .Bank ldr r0, [r0] mov r1, #0x58 ldr r2, .BattleData mul r0, r1 add r0, r0, r2 ldrb r0, [r0] MoldBreakerCheck: cmp r0, #0x69 beq MoldBreaker cmp r0, #0xA4 beq MoldBreaker cmp r0, #0xA5 bne Return MoldBreaker: AbilityBufferTarget: ldr r0, .Bank add r0, #0x1 ldrb r4, [r0] mul r1, r4 add r1, r1, r2 ldrb r3, [r1] LoadTable: ldr r0, .MoldBreakerTable add r2, r0, r3 ldrb r0, [r2] CheckIfAffected: cmp r0, #0x0 beq Return Affected: mov r0, #0xFF strb r0, [r1] ldr r0, .DisabledAbilitiesLoc add r0, r4 strb r3, [r0] Return: pop {r2-r4} bl Canceler lsl r0, r0, #0x18 lsr r2, r0, #0x18 cmp r2, #0x0 beq Continue ldr r0, .Return bx r0 Continue: ldr r0, .Return2 bx r0 Canceler: ldr r0, .Return3 bx r0 .align 2 .Bank: .word 0x0202420B .BattleData: .word 0x020240A4 .MoldBreakerTable: .word 0x08TTTTTT .DisabledAbilityLoc: .word 0x0203E32C .Return: .word 0x08046399 .Return2: .word 0x08046073 .Return3: .word 0x08041A6D #insert 00 48 00 47 xx xx xx 08 at 046064
Routine III (Generation V effect. Makes the foe affected by entry hazards even if it has an ability to negate the hazards effect (except Magic Guard))Spoiler:Code:.text .align 2 .thumb .thumb_func .global moldbreakermultipletargets AbilityBufferUser: push {r1-r4} ldr r0, .Bank ldr r0, [r0] mov r1, #0x58 ldr r2, .BattleData mul r0, r1 add r0, r0, r2 ldrb r0, [r0] MoldBreakerCheck: cmp r0, #0x69 beq MoldBreaker cmp r0, #0xA4 beq MoldBreaker cmp r0, #0xA5 bne Return MoldBreaker: AbilityBufferTarget: ldr r0, .Bank add r0, #0x1 ldrb r4, [r0] mul r1, r4 add r1, r1, r2 ldrb r3, [r1] LoadTable: ldr r0, .MoldBreakerTable add r2, r0, r3 ldrb r0, [r2] CheckIfAffected: cmp r0, #0x0 beq Return Affected: mov r0, #0xFF strb r0, [r1] ldr r0, .DisabledAbilitiesLoc add r0, r4 strb r3, [r0] Return: pop {r1-r4} ldr r0, [r1] add r0, #0x1 str r0, [r1] pop {r0} bx r0 .align 2 .Bank: .word 0x0202420B .BattleData: .word 0x020240A4 .MoldBreakerTable: .word 0x08TTTTTT .DisabledAbilityLoc: .word 0x0203E32C #insert 00 48 00 47 xx xx xx 08 at 04AF78
Routine IV (Restores disabled abilities at the end of move execution)Spoiler:At 028308 insert a pointer to free space XX XX XX 08.
Battle Script at XX XX XX
Code:09 0A E2 00 58 00 3A 2B 04 EC 2F 02 02 08 00 00 00 YY YY YY 08 2E 3A 43 02 02 05 F6
Battle Script at YY YY YY
Code:4C 00 4D 00 4E 00 00 3A 10 54 01 F9 XX+1 XX XX 08 52 00 28 4E 8A 2D 08
Routine at XX XX XX
Code:.text .align 2 .thumb .thumb_func .global moldbreakermultipletargets AbilityBufferUser: push {lr} ldr r0, .Bank ldr r0, [r0] mov r1, #0x58 ldr r2, .BattleData mul r0, r1 add r0, r0, r2 ldrb r0, [r0] MoldBreakerCheck: cmp r0, #0x69 beq MoldBreaker cmp r0, #0xA4 beq MoldBreaker cmp r0, #0xA5 bne Return MoldBreaker: AbilityBufferTarget: ldr r0, .Bank add r0, #0x1 ldrb r4, [r0] mul r1, r4 add r1, r1, r2 ldrb r3, [r1] LoadTable: ldr r0, .MoldBreakerTable add r2, r0, r3 ldrb r0, [r2] CheckIfAffected: cmp r0, #0x0 beq Return Affected: mov r0, #0xFF strb r0, [r1] ldr r0, .DisabledAbilitiesLoc add r0, r4 strb r3, [r0] Return: pop {r0} bx r0 .align 2 .Bank: .word 0x0202420B .BattleData: .word 0x020240A4 .MoldBreakerTable: .word 0x08TTTTTT .DisabledAbilityLoc: .word 0x0203E32C
Spoiler:Code:.text .align 2 .thumb .thumb_func .global restoreabilities EndTurn: ldr r0, .Outcome mov r1, #0x0 strb r1, [r0] ldr r0, .Index strb r1, [r0] RestoreAbilities: push {r2-r6} ldr r4, .Battlers ldrb r4, [r4] mov r3, #0x0 ldr r5, .DisabledAbilityLoc ldr r6, .BattleData Loop: ldrb r2 [r5, #0x0] cmp r2, #0x0 beq EndLoop strb r2, [r6] strb r1, [r5] EndLoop: add r3, r3, #0x1 cmp r3, r4 bge Exit add r5, r5, #0x1 add r6, r6, #0x58 b loop Exit: pop {r2-r6} ldr r1, . mov r0, #0xB strb r0, [r1] bx lr .align 2 .Outcome: .word 0x0202427C .Index: .word 0x02024064 .Battlers: .word 0x0202406C .DisabledAbilityLoc: .word 0x0203E32C .BattleData: .word 0x020240A4 .EndLoc: .word 0x02024083 #insert 00 48 00 47 xx xx xx 08 at 04B67C
can you create a tutorial for pokemon ruby RaileysXerilyasRX?Expanding Ability Names Data and Ability Descriptions Pointer Table
I think this should be here so I don't need to make a new thread with a very simple tutorial. Alright! I'm going to tell you how to expand Ability tables (the Names and the Descriptions). I'm using HxD here as a HEX Editor.
Legend:
- Green bolded text are for Emerald.
- Red bolded text are for FireRed.
Step 1: Ability Names
- Go to a new free space names (example: 0x720000). Select 3328 (0xD00 in HEX) bytes. Fill the bytes with AE AE AE AE AE AE AE FF 00 00 00 00 00.
- Go to 31B6DB or 24FC40. Select and copy 1014 (0x3F6 in HEX) bytes.
- Go to the offset of your names data (which the example is 0x720000) and paste the data there.
- Replace all DB B6 31 08 or 40 FC 24 08 with the "reversed hex in little indian of your new names data offset with 08 at the end" (example: 00 00 72 08)
Step 2: Ability Descriptions
- Go to a new free space descriptions (example: 0x720D00). Select 1024 (0x400 in HEX) bytes. Fill the bytes with 98 AF 31 08 or C4 F3 24 08.
- Go to 31BAD4 or 24FB08. Select and copy 312 (0x138 in HEX) bytes.
- Go to the offset of your description table (which the example is 0x720D00) and paste the data there.
- Replace all D4 BA 31 08 or 08 FB 24 08 with the "reversed hex in little indian of your new description data offset with 08 at the end" (example: 00 0D 72 08)
Then, change your .ini-s. Replace the old offsets in the .ini with your new data (they should be at where the Ability Names and Ability Descriptions are). Luckily, these don't have limiter stuff at all.
With the expanded data, the new data should be working. I have made this tutorial to have maximized the slots to 256 abilities (255 usable abilities plus one for the none "-----" slot). Now you have 178 new slots for Generation IV+ abilities. Noted that the game can only support up to 256 abilities. The rest of the tutorial on how to insert ability routines are on the first post of this thread since inserting ability routines are now complicated. I hope this post is to be linked up in the Extra Information of this thread so everyone can expand stuff too.
Mold Breaker, Turboblaze, and Teravolt
can you create a tutorial for pokemon ruby RaileysXerilyasRX?
Nice that you have worked on this but my assembler caught up many errors (such as the .DisabledAbilities and .DisabledAbility part and more errors that mostly on the last routine as well) Better check and correct those.
Even I made the possible corrections personally, there is a bug though which after beating a Pokemon, the game freezes. I guarantee that my bs loader, callasm, and setword impelementation are correct 'cause my implementation of Moxie works. I dunno what's wrong then but I will wait for your official corrections to be done and reinsert Mold Breaker again.
1. In the first three routines, the third line should be ldrb r0, [r0] instead of ldr r0, [r0]
2. The corrected last routine.
Spoiler:
.text
.align 2
.thumb
.thumb_func
.global restoreabilities
EndTurn:
ldr r0, .Outcome
mov r1, #0x0
strb r1, [r0]
ldr r0, .Index
strb r1, [r0]
RestoreAbilities:
push {r2-r6}
ldr r4, .Battlers
ldrb r4, [r4]
mov r3, #0x0
ldr r5, .DisabledAbilityLoc
ldr r6, .BattleData
Loop:
ldrb r2, [r5, #0x0]
cmp r2, #0x0
beq EndLoop
strb r2, [r6]
strb r1, [r5]
EndLoop:
add r3, r3, #0x1
cmp r3, r4
bge Exit
add r5, r5, #0x1
add r6, r6, #0x58
b Loop
Exit:
pop {r2-r6}
ldr r1, .EndLoc
mov r0, #0xB
strb r0, [r1]
pop {r0}
bx r0
.align 2
.Outcome: .word 0x0202427C
.Index: .word 0x02024064
.Battlers: .word 0x0202406C
.DisabledAbilityLoc: .word 0x0203E32C
.BattleData: .word 0x020240A4
.EndLoc: .word 0x02024083
Encountered these errors while porting these optimized routines back to FR.
Thanks! You're awesome dude. I've finally got it working, But then... should it have the "<name> breaks the mold!" or "<name> is radiating a blazing aura!" or "<name> is radiating a bursting aura!" message displayed when someone with Moldbreaker/Turboblaze/Teravolt ability is sent out in battle? I think this is one thing I suggest for those abilities.
It's for Emerald btw
EDIT : Stupid mistake, thank's to touched. The only thing that remind undone is the "[buffer] transformed into [buffer] type !"
EDIT 2 : Thank's again Touched for help me to fix the displayed message. It works now perfectly :)
Protean table : How to create this one ? Simple, if you have 354 attack, you'll have to write 354 bytes with 00 or 01. 01 mean protean is affected by this attack, 00 means it is not.
For the TypeList1, TypeList2 and MoveData it's the same than tlachtli's routine
.text
.align 2
.thumb
.thumb_func
.global checkswitchin
Start:
ldrb r3, [r5]
cmp r1, r3
blo CheckIfSwitchInAbility
mov r0, r10
strb r0, [r2]
CheckIfSwitchInAbility:
CheckDrizzle:
ldrb r0, [r7]
cmp r0, #0x2
bne CheckCloudNine
Drizzle:
ldr r2, FreeRam
ldrb r1, [r2]
cmp r1, #0x00
bne NoSwitchInAbility
ldr r1, =(0x08042B78+1)
bx r1
CheckCloudNine:
cmp r0, #0x0D
bne CheckIntimidate
b AirLockCloudNine
CheckIntimidate:
cmp r0, #0x16
bne CheckTrace
Intimidate:
ldr r1, =(0x08042C08+1)
bx r1
CheckTrace:
cmp r0, #0x24
bne CheckSandStream
Trace:
ldr r1, =(0x08042C68+1)
bx r1
CheckSandStream:
cmp r0, #0x2D
bne CheckForeCast
SandStream:
ldr r2, FreeRam
ldrb r1, [r2]
cmp r1, #0x00
bne NoSwitchInAbility
ldr r1, =(0x08042BA8+1)
bx r1
CheckForeCast:
cmp r0, #0x3B
bne CheckDrought
ForeCast:
ldr r1, =(0x08042C3C+1)
bx r1
CheckDrought:
cmp r0, #0x46
bne CheckAirLock
Drought:
ldr r2, FreeRam
ldrb r1, [r2]
cmp r1, #0x00
bne NoSwitchInAbility
ldr r1, =(0x08042BD8+1)
bx r1
CheckAirLock:
cmp r0, #0x4D
bne CheckDelta
AirLockCloudNine:
ldr r2, FreeRam
ldrb r1, [r2]
cmp r1, #0x00
bne NoSwitchInAbility
ldr r1, =(0x08042CA4+1)
bx r1
CheckDelta:
cmp r0, #[b]0xC0[/b] /*Number of your ability Delta Stream*/
bne CheckDeso
UpdateStrongWind:
ldr r0, CurrentWeather
mov r1, #0
strb r1, [r0]
ldr r0, FreeRam
ldrb r1, [r0]
cmp r1, #[b]0xC0[/b] /*Number of your ability Delta Stream*/
beq NoSwitchInAbility
mov r1, #[b]0xC0[/b] /*Number of your ability Delta Stream*/
strb r1, [r0]
ldr r0, BattleScript
bl ExecuteScript
ldr r1, =(0x08042A72+1)
bx r1
CheckDeso:
cmp r0, #[b]0xBF[/b] /*Number of your ability Desolate Land*/
bne CheckPrimo
UpdateDesolate:
ldr r2, FreeRam
mov r0, #[b]0xBF[/b] /*Number of your ability Desolate Land*/
strb r0, [r2]
ldr r2, =(0x08042BD8+1)
bx r2
CheckPrimo:
cmp r0, #[b]0xBE[/b] /*Number of your ability Primordial Sea*/
bne NoSwitchInAbility
UpdatePrimordial:
ldr r2, FreeRam
mov r0, #[b]0xBE[/b] /*Number of your ability Primordial Sea*/
strb r0, [r2]
ldr r2, =(0x08042B78+1)
bx r2
NoSwitchInAbility:
ldr r1, =(0x08042A7E+1)
bx r1
ExecuteScript:
ldr r1, =(0x08042BEE+1)
bx r1
.align 2
BattleScript: .word 0x08A21E80
CurrentWeather: .word 0x020243CC
FreeRam: .word 0x0203E331
ActiveBSPointer: .word 0x02024214
/*00 4B 18 47 xx+1 xx xx 08 at 08042A20*/
#org 0xA21E80
pause 0x20
setword 0x0203E320 0x08XXXXXX // Assuming 0x0203E320 is the pointer of your setword and XX XX XX the address of the message you want to display
printstring 0x184
waitmessage DELAY_1SECOND
playanimation 0x0 0x1E 0x0 //The table below ends with the 0x0 0x1D 0x0 animation, replace it accordingly (0x1E in my case, I just added this one)
waitanimation
call 0x82DB48D
end3
BB 00 E1 ED E7 E8 D9 E6 DD E3 E9 E7 00 D5 DD E6 00 D7 E9 E6 E6 D9 E2 E8 00 DD E7 FE E4 E6 E3 E8 D9 D7 E8 DD E2 DB 00 C0 E0 ED DD E2 DB AE E8 ED E4 D9 00 CA E3 DF D9 E1 E3 E2 AB
9E 7E 2D 08 D4 7E 2D 08 DD 7E 2D 08 1A 7F 2D 08 22 7F 2D 08 6A 7F 2D 08 75 7F 2D 08 08 81 2D 08 7C 81 2D 08 58 82 2D 08 A5 82 2D 08 EE 82 2D 08 F3 82 2D 08 F8 82 2D 08 FD 82 2D 08 0B 83 2D 08 3C 83 2D 08 61 83 2D 08 BF 83 2D 08 1E 84 2D 08 E3 84 2D 08 23 85 2D 08 66 85 2D 08 E3 85 2D 08 04 86 2D 08 15 86 2D 08 26 86 2D 08 7A 86 2D 08 93 86 2D 08 9D 86 2D 08 LL LL LL 08
#org @YourOffset
jumpifhalfword 0x0 0x203E331 [I][U]0xBE[/U][/I] 0x82D9F1A ##Here I check if the FreeRam loc that as used is different from 0, to see whether the mega/prima weather are activated or not
jumpifhalfword 0x0 0x203E331 [I][U]0xBF[/U][/I] 0x82D9F1A ##Same thing
jumpifhalfword 0x0 0x203E331 [I][U]0xC0[/U][/I] 0x82D9F1A ##Same
jumpifhalfword 0x0 0x20241EA 0xC9 0x82D99B7 ##Check if the move index correspond to sandstorm
jumpifhalfword 0x0 0x20241EA 0xF0 0x82D9B3D ##or rain dance
jumpifhalfword 0x0 0x20241EA 0xF1 0x82D9B55 ##or sunny day
jumpifhalfword 0x0 0x20241EA 0x102 0x82D9FD2 ##or finally hail
.text
.align 2
.thumb
.thumb_func
.global damagemodulationmegaprima
CheckPermaWeather:
ldr r5, FreeRam
ldrb r5, [r5]
cmp r5, #0x0
bne PrimoWeather
ClassicRoutine:
ldr r5, TypeChart
add r0, r3, r5
ldrb r0, [r0]
ClassicReturn:
cmp r0, r8
ldr r2, Return
bx r2
PrimoWeather:
FireUseless:
cmp r5, #[B][I][U]0xBE[/U][/I][/B] /*Index number of your ability Primordial Sea*/
bne WaterUseless
ldr r5, TypeChart
add r0, r3, r5
ldrb r0, [r0]
push {r1}
mov r1, #0xA
cmp r1, r8
beq Damped
pop {r1}
b ClassicReturn
WaterUseless:
cmp r5, #[B][I][U]0xBF[/U][/I][/B] /*Index number of your ability Desolate Land*/
bne ClassicRoutine
ldr r5, TypeChart
add r0, r3, r5
ldrb r0, [r0]
push {r1}
mov r1, #0xB
cmp r1, r8
beq Evaporated
pop {r1}
b ClassicReturn
Evaporated:
ldr r0, BattleScript1
b EndFail
Damped:
ldr r0, BattleScript2
EndFail:
pop {r1}
ldr r1, ActiveBSPointer
str r0, [r1]
ldr r1, ReturnFail
bx r1
.align 2
Return: .word 0x08047144+1
ReturnFail: .word 0x08047266+1
FreeRam: .word 0x0203E331
TypeChart: .word [B][I][U]0x08E3D114[/U][/I][/B] /*Take care to change this address accordingly to your type chart*/
BattleScript1: .word [U][I][B]0x08YourOffset[/B][/I][/U] /*Change accordingly to the location your battle script1*/
BattleScript2: .word [B][I][U]0x08YourOffset[/U][/I][/B] /*Change accordingly to the location your battle script2*/
ActiveBSPointer: .word 0x02024214
/*00 48 00 47 XX+1 XX XX 08 at 0x4713C*/
.thumb
push {r4, r5, lr}
cmp r4, #2
bne Back
ldr r4, FreeRam
ldrb r4, [r4]
cmp r4, #[B]0xC0[/B] /*Index number Delta Stream*/
bne Back
lsl r0, r0, #0x18
lsr r4, r0, #0x18
cmp r4, #0xA
ble Nope
ldr r5, Damage
ldr r0, [r5]
ldr r1, Return2
mov pc, r1
Back:
lsl r0, r0, #0x18
lsr r4, r0, #0x18
Nope:
ldr r5, Damage
ldr r0, [r5]
mul r0, r4
ldr r1, Return
mov pc, r1
.align 2
FreeRam: .word 0x203E331 /*Free Ram for weathers*/
Damage: .word 0x020241F0
Return: .word 0x8046F6C+1
Return2: .word 0x8046F72+1
/*00 49 08 47 xx+1 xx xx 08 at 46F60*/
#org 0xYourOffset
pause 0x20
setword 0x203E320 0x8PPPPPP
printstring 0x184
end2
CE DC D9 00 D1 D5 E8 D9 E6 AE E8 ED E4 D9 00 D5 E8 E8 D5 D7 DF FE D9 EA D5 E4 E3 E6 D5 E8 D9 D8 00 DD E2 00 E8 DC D9 00 DC D5 E6 E7 DC 00 E7 E9 E2 E0 DD DB DC E8 AB
#org 0xYourOffset
pause 0x20
setword 0x203E320 0x8KKKKKK
printstring 0x184
end2
CE DC D9 00 C0 DD E6 D9 AE E8 ED E4 D9 00 D5 E8 E8 D5 D7 DF FE DA DD EE EE E0 D9 D8 00 E3 E9 E8 00 DD E2 00 E8 DC D9 00 DC D9 D5 EA ED 00 E6 D5 DD E2 AB
.text
.align 2
.thumb
.thumb_func
.global regenerator
AbilityBuffer:
add r0, r1, r3
add r0, #0x20
ldrb r0, [r0]
RegeneratorCheck:
cmp r0, #[I][U]0x91[/U][/I] /*Index number of your ability Regenerator*/
beq Regenerator
NaturalCureCheck:
cmp r0, #0x1E
bne CheckDelta
NaturalCure:
ldr r0, .Return
bx r0
NoAbility:
ldr r0, .Return2
bx r0
Regenerator:
GetHP:
add r3, #0x28
add r3, r1, r3
mov r1, #0x20
mul r0, r1
mov r1, #0x60
push {r3}
bl Divide
pop {r3}
ldrh r1, [r3]
add r0, r0, r1
b CheckHP
CheckDelta:
cmp r0, #[I][U]0xC0[/U][/I] /*Index number of your ability Delta Stream*/
beq Delta
b CheckDesolate
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
CheckDesolate:
cmp r0, #[I][U]0xBF[/U][/I] /*Index number of yout ability Desolate Land*/
beq Desolate
CheckPrimordial:
cmp r0, #[I][U]0xBE[/U][/I] /*Index number of yout ability Primordial Sea*/
beq Primordial
b NoAbility
NormalWeather:
push {lr}
bl ScriptPusher
ldr r1, ActiveBS
ldr r2, ScriptNormalWeather
str r2, [r1]
pop {pc}
bl ScriptPoper
b NoAbility
Delta:
ldr r2, .FreeRam
ldrb r0, [r2]
cmp r0, #[I][U]0xC0[/U][/I] /*Index number of your ability Delta Stream*/
bne NoAbility
b ClearWeather
Desolate:
ldr r2, .FreeRam
ldrb r0, [r2]
cmp r0, #[I][U]0xBF[/U][/I] /*Index number of your ability Desolate Land*/
bne NoAbility
b ClearWeather
Primordial:
ldr r2, .FreeRam
ldrb r0, [r2]
cmp r0, #[I][U]0xBE[/U][/I] /*Index number of your ability Primordial Sea*/
bne NoAbility
ClearWeather:
mov r0, #0x00
strb r0, [r2]
ldr r2, .CurrentWeather
mov r0, #0x00
strb r0, [r2]
b NormalWeather
ScriptPusher:
ldr r0, ScriptPush
bx r0
ScriptPoper:
ldr r0, ScriptPop
bx r0
.align 2
.CurrentWeather: .word 0x020243CC
.FreeRam: .word 0x0203E331
.Return: .word 0x08055A9F
.Return2: .word 0x08055AD3
.CommandTable: .word 0x08A20000
.RamLoc: .word 0x0202449C
.Return3: .word 0x08055AC7
.DivideLoc: .word 0x082E7541
ActiveBS: .word 0x02024214
ScriptNormalWeather: .word 0x08UUUUUU
ScriptPush: .word 0x0803FAFC+1
ScriptPop: .word 0x0803FB24+1
/*Insert 00 48 00 47 XX+1 XX XX 08 00 00 at 0x55A94*/
#org 0xA1FCF0
pause 0x40
setword 0x203E320 0x8GGGGGG
printstring 0x184
return
CE DC D9 00 EB D9 D5 E8 DC D9 E6 00 DC D5 E7 00 E6 D9 E8 E9 E6 E2 D9 D8 FE E8 E3 00 E2 E3 E6 E1 D5 E0 AB
.thumb
ldr r0, =0x803DE41
str r0, [r1]
ldr r0, FreeRam
mov r1, #0
strb r1, [r0]
ldr r1, =0x30061E8
ldr r0, =0x8038421
str r0, [r1]
ldr r0, =0x803DE2A
mov pc, r0
.align 2
FreeRam: .word 0x0203E331
/*00 48 00 47 xx+1 xx xx 08 at 0803DDE4*/
.text
.align 2
.thumb
.thumb_func
.global clearweather
Start:
ldr r1, =0x02024064
ldr r0, BankTarget
ldrb r0, [r0]
strb r0, [r1]
ldr r4, FreeRam
ldrb r4, [r4]
cmp r4, #0
beq Return
push {r0-r3}
ldr r1, BattleData
mov r2, #0x58
mul r0, r2
add r0, r1
add r0, #0x20
ldrb r3, [r0]
ldrb r2, [r0, #8]
cmp r2, #0
bne PopAndReturn
cmp r3, r4
beq Clear
pop {r0-r3}
b Return
Clear:
pop {r0-r3}
ldr r4, FreeRam
mov r3, #0
strb r3, [r4]
ldr r4, CurrentWeather
strb r3, [r4]
ldr r0, BankUser
ldrb r0, [r0]
mov r9, r0
ldr r4, MoxieandClear
ldr r0, =0x08049C18+1
bx r0
PopAndReturn:
pop {r0-r3}
Return:
ldr r0, BankUser
ldrb r0, [r0]
mov r9, r0
ldr r0, Back
bx r0
.align 2
CurrentWeather: .word 0x020243CC
FreeRam: .word 0x0203E331
BankTarget: .word 0x0202420C
BankUser: .word 0x0202420B
BattleData: .word 0x02024084
MoxieandClear: .word 0x08PPPPPP
Back: .word 0x08049C16+1
/*00 49 08 47 XX+1 XX XX 08 at 08049C08*/
.text
.align 2
.thumb
.thumb_func
.global clearweather
Start:
ldr r0, BankUser
ldrb r0, [r0]
strb r0, [r1]
ldr r4, FreeRam
ldrb r4, [r4]
cmp r4, #0
beq Return
push {r0-r3}
ldr r1, BattleData
mov r2, #0x58
mul r0, r2
add r0, r1
add r0, #0x20
ldrb r3, [r0]
ldrb r2, [r0, #8]
cmp r2, #0
bne PopAndReturn
cmp r3, r4
beq Clear
pop {r0-r3}
b Return
Clear:
pop {r0-r3}
ldr r4, FreeRam
mov r3, #0
strb r3, [r4]
ldr r4, CurrentWeather
strb r3, [r4]
ldr r0, BankTarget
ldrb r0, [r0]
mov r9, r0
ldr r4, NormalWeatherScript
ldr r0, =0x08049C18+1
bx r0
PopAndReturn:
pop {r0-r3}
Return:
ldr r0, BankTarget
ldrb r0, [r0]
mov r9, r0
ldr r0, Back
bx r0
.align 2
CurrentWeather: .word 0x020243CC
FreeRam: .word 0x0203E331
BankTarget: .word 0x0202420C
BankUser: .word 0x0202420B
BattleData: .word 0x02024084
NormalWeatherScript: .word 0x08HHHHHH
Back: .word 0x08049BF4+1
/*00 48 00 47 XX+1 XX XX 08 at 08049BE8*/
For target :
56 00 39 40 00 1A 00 1B before the battlescript below. So you have to make it point on the "56".
#dynamic 0xSomeOffset
#freespace 0xFF
#org @start
attackcanceler
printstring 0x1D
printstring 0x130
pause 0x40
setword 0x203E320 0x8QQQQQQ
printstring 0x184
waitmessage 0x40
[U]jumpifability 0x1 [B][I][U]0x9A[/U][/I][/B] @Moxie[/U]
return
[U]#org @Moxie
jumpiffainted 0x1 @Ornot
jumpifstat 0x1 0x0 0x1 0xC @Ornot
pause 0x20
setbyte 0x202448F 0x0
playstatchangeanimation 0x1 0x2 0x0
setbyte 0x202448E 0x11
statbuffchange 0x1 TRUE @Ornot
setword 0x203E320 0x8MoxieString
printstring 0x184
waitmessage 0x40
return[/U]
#org @Ornot
return
At QQQQQQ :
[code]CE DC D9 00 EB D9 D5 E8 DC D9 E6 00 DC D5 E7 00 E6 D9 E8 E9 E6 E2 D9 D8 FE E8 E3 00 E2 E3 E6 E1 D5 E0 AB
Assuming FA is your Setword command and 0203E320 your location of battle string:
[B][I]FA[/I][/B] [I][U]F0 E3 03 02[/U][/I] QQ QQ QQ 08 10 84 01 12 40 00 56 01 39 40 00 1A 01 1B 01 10 1C 00 3C
At QQQQQQ :
[code]CE DC D9 00 EB D9 D5 E8 DC D9 E6 00 DC D5 E7 00 E6 D9 E8 E9 E6 E2 D9 D8 FE E8 E3 00 E2 E3 E6 E1 D5 E0 AB
.thumb
Start:
ldr r4, [sp, #0x48]
lsl r0, r0, #0x18
lsr r0, r0, #0x18
str r0, [sp, #4]
ldr r6, FreeRam
ldrb r6, [r6]
cmp r6, #0
bne NegCheck
Return:
ldr r6, =0x0804283C+1
mov pc, r6
NegCheck:
cmp r2, #0xD
beq Neg
cmp r2, #0x4D
bne Return
Neg:
mov r2, #0xFF
b Return
.align 2
FreeRam: .word 0x0203E331
@ 00 4C 20 47 xx+1 xx xx 08 at 0x8042834
.text
.align 2
.thumb
.thumb_func
.global basedamageability
Main:
cmp r4, #0x37
bne Sniper
HustleBoost:
lsr r0, r7, #0x1
add r7, r0, r7
Sniper:
cmp r4, #0x62 /*Number of your ability Sniper*/
bne Technician
CheckCrit:
ldr r0, CritLoc
ldrb r0, [r0]
cmp r0, #0x2
bne Return
b Boost
Technician:
cmp r4, #0x66 /*Number of your ability Technician*/
bne SlowStart
CheckBasePower:
ldr r0, BasePower
ldrb r0, [r0]
cmp r0, #0x3D
bge Return
Boost:
lsr r0, r7, #0x1
add r7, r0, r7
mov r2, r8
lsr r0, r2, #0x1
add r0, r0, r2
mov r8, r0
SlowStart:
cmp r4, #0x71 /*Number of your ability SlowStart*/
bne Adaptability
CheckCounter:
ldr r0, SlowStartLoc
ldr r2, [sp, #0x10]
add r0, r0, r2
ldrb r0, [r0]
cmp r0, #0x0
beq Return
AttackDrop:
lsr r7, r7, #0x1
Adaptability:
cmp r4, #0x5C /*Number of your ability Adaptability*/
beq GetPokeTypes
b Numberofattackused
Return:
ldr r0, Return0
bx r0
GetPokeTypes:
push {r0-r5}
ldr r1, BattleData2
ldr r0, Bank
ldrb r0, [r0]
mov r2, #0x58
mul r2, r0
add r1, #0x21
add r1, r2
ldrb r0, [r1]
ldrb r2, [r1, #1]
bl GetMoveType
CompareIfMatchGetBoost:
cmp r0, r4
beq BoostAdapt
cmp r2, r4
bne Return2
BoostAdapt:
mov r0, #0x2B
mul r7, r0
lsr r7, #5
mov r2, r8
mul r2, r0
lsr r2, #5
mov r8, r2
Return2:
pop {r0-r5}
b Return
Numberofattackused:
push {r0-r3, r5}
ldr r0, CurMoveIndex
ldrh r3, [r0]
mov r2, #0
mov r1, #0
CheckTableAbility:
cmp r4, #0xAE /*Number of your ability StrongJaw*/
beq StrongJawLoad
cmp r4, #0xB6 /*Number of your ability Tough Claws*/
beq ToughClaws
cmp r4, #0xB3 /*Number of your ability Mega Launcher*/
beq MegaLauncherLoad
cmp r4, #0xA0 /*Number of your ability SandForce*/
beq SandForce
cmp r4, #0x5A /*Number of your ability Iron Fist*/
bne Return3
IronFistLoad:
ldr r0, IronFistTable
b LoopLoad
StrongJawLoad:
ldr r0, StrongJawTable
b LoopLoad
MegaLauncherLoad:
ldr r0, MegaLauncherTable
LoopLoad:
add r2, r0, r1
ldrh r0, [r2]
ldr r5, =0x0000FFFF
cmp r0, r5
beq Return3
cmp r0, r3
beq TestBoost
mov r2, #0
add r1, #2
cmp r4, #0xB3 /*Number of your ability Mega Launcher*/
beq MegaLauncherLoad
cmp r4, #0xAE /*Number of your ability Strong Jaw*/
beq StrongJawLoad
cmp r4, #0x5A /*Number of your ability Iron Fist*/
beq IronFistLoad
b Return3
TestBoost:
cmp r4, #0x5A /*Number of your ability Iron Fist*/
beq BoostTwentyPercent
b BoostFiftyPercent
SandForce:
ldr r0, CurrentWeather
ldr r0, [r0]
cmp r0, #0x18
beq TypeAttack
cmp r0, #0x8
bne Return3
TypeAttack:
push {r3-r5}
bl GetMoveType
cmp r4, #4
beq PopAndBoostThirtyPercent
cmp r4, #5
beq PopAndBoostThirtyPercent
cmp r4, #8
beq PopAndBoostThirtyPercent
pop {r3-r5}
b Return3
PopAndBoostThirtyPercent:
pop {r3-r5}
push {r0-r4}
mov r2, #0xD
mov r0, #0x13
mov r1, #0
mov r3, #0
ldr r4, ability_something
bl Jump4
cmp r0, #0
bne PopReturn3
mov r2, #0x4D
mov r0, #0x13
mov r1, #0
mov r3, #0
ldr r4, ability_something
bl Jump4
cmp r0, #0
bne PopReturn3
pop {r0-r4}
b BoostThirtyPercent
PopReturn3:
pop {r0-r4}
b Return3
BoostTwentyPercent:
mov r0, #0x4D
mul r7, r0
lsr r7, #6
mov r2, r8
mul r2, r0
lsr r2, #6
mov r8, r2
b Return3
ToughClaws:
CheckContact:
ldr r1, MoveData
mov r2, #0xC
mul r2, r3
add r1, r2
add r1, #0x8
ldr r1, [r1]
lsl r1, #0x1F
lsr r1, #0x1F
cmp r1, #1
bne Return3
BoostThirtyPercent:
mov r0, r8
mov r3, #0xA7
mul r0, r3
lsr r0, #7
mov r8, r0
mul r7, r3
lsr r7, #7
b Return3
BoostFiftyPercent:
lsr r0, r7, #0x1
add r7, r0, r7
mov r2, r8
lsr r0, r2, #0x1
add r0, r0, r2
mov r8, r0
Return3:
pop {r0-r3, r5}
ldr r0, Return0
bx r0
GetMoveType:
Exception:
ldr r4, CheckTypeLoc
ldr r4, [r4]
ldrb r4, [r4, #0x13]
mov r5, #0x3F
and r4, r5
cmp r4, #0
beq MoveType
bx lr
MoveType:
ldr r3, CurMoveIndex
ldrh r3, [r3]
ldr r4, MoveData
mov r5, #0xC
mul r5, r3
add r4, r5
add r4, #0x2
ldrb r4, [r4]
bx lr
Jump4:
mov pc, r4
.align 2
IronFistTable: .word 0x08______ /*Location of your Iron fist table*/
StrongJawTable: .word 0x08______ /*Location of your Strong Jaw table*/
MegaLauncherTable: .word 0x08______ /*Location of your Mega Launcher table*/
CheckTypeLoc: .word 0x0202449C
Bank: .word 0x0202420B
MoveData: .word 0x831C898 /*Location of your move data*/
CurMoveIndex: .word 0x020241EA
BattleData2: .word 0x02024084
CritLoc: .word 0x02024211
BasePower: .word 0x020244E0
SlowStartLoc: .word 0x0203E324
Return0: .word 0x0806989A+1
CurrentWeather: .word 0x020243CC
ability_something: .word 0x08042828+1
/* Insert 00 48 00 47 XX+1 XX XX 08 at 0x08069888 */
.text
.align 2
.thumb
.thumb_func
.global sandforcenoadamage
Start:
add r0, #0x20
ldrb r0, [r0]
cmp r0, #8
beq NoDamage
cmp r0, #0x5C /*Number of your ability SandForce*/
beq NoDamage
ldr r0, Return
bx r0
NoDamage:
ldr r1, Untouched
bx r1
.align 2
Return: .word 0x08051B94+1
Untouched: .word 0x08051BD4+1
/*Type 00 49 08 47 xx+1 xx xx 08 at 08051B8C*/
.thumb
CheckIfUserAsleep:
push {r0-r7}
ldr r0, [r0]
mov r1, #7
and r0, r1
cmp r0, #0
beq CheckPoison
StartCheck:
CheckField:
mov r2, #[B]0x7C[/B] /*Index number Bad Dreams*/
mov r0, #0x13
mov r1, #0
mov r3, #0
ldr r4, ability_something
bl Jump4
lsl r0, r0, #0x18
lsr r0, r0, #0x18
cmp r0, #0
beq CheckPoison
CheckEveryAbility:
mov r6, #0
mov r5, #0
ldr r3, Bank
ldrb r0, [r3]
ldr r4, NPokeField
ldrb r7, [r4]
Prepare:
mov r1, #1
and r1, r0
cmp r1, #0
beq Player
mov r0, #0
b Amorce
Player:
mov r0, #1
Amorce:
mov r1, #0x58
ldr r2, BattleDataAbility
CheckingFoeField:
mov r4, r0
mul r4, r1
add r4, r2
ldrh r3, [r4, #0xC]
cmp r3, #0
beq Next
ldrb r3, [r4]
cmp r3, #[B]0x7C[/B] /*Index number Bad Dreams*/
bne Next
add r6, #1
Next:
add r0, #2
add r5, #1
cmp r7, #2
beq Checking
cmp r5, #2
beq Checking
b CheckingFoeField
Checking:
cmp r6, #0
beq CheckPoison
ActualDamage:
ldr r0, BattleDataAbility
ldr r1, Bank
ldrb r1, [r1]
mov r2, #0x58
mul r1, r2
add r0, r1
add r0, #8
ldrh r2, [r0]
cmp r2, #0
beq CheckPoison
ldrh r2, [r0, #4]
cmp r6, #2
beq Quart
lsr r5, r2, #3
b Damaging
Quart:
lsr r5, r2, #2
Damaging:
cmp r5, #0
bne NoChange
MunjaCase:
mov r5, #1
NoChange:
ldr r0, StoreDamage
strh r5, [r0]
pop {r0-r7}
ldr r0, BattleScriptBad
ldr r1, =(0x080412D0+1)
bx r1
CheckPoison:
pop {r0-r7}
ldr r0, [r0]
mov r1, #8
and r0, r1
cmp r0, #0
beq Return2
CheckAb:
push {r0-r4}
ldr r4, BattleDataAbility
ldr r0, Bank
ldrb r0, [r0]
mov r1, #0x58
mul r0, r1
add r0, r4
ldrb r2, [r0]
cmp r2, #[B]0x5B[/B] /*Number of your ability Poison Heal*/
bne PopAndReturn1
ldrh r2, [r0, #8]
cmp r2, #0
beq PopAndReturn2
ldrh r3, [r0, #0xC]
cmp r2, r3
beq PopAndReturn2
lsr r3, r3, #3
cmp r3, #0
beq Exception
b Healing
Exception:
mov r3, #1
Healing:
neg r3, r3
ldr r2, StoreDamage
str r3, [r2]
pop {r0-r4}
ldr r0, BattleScriptHeal
ldr r1, =(0x080412D0+1)
bx r1
PopAndReturn2:
pop {r0-r4}
b Return2
PopAndReturn1:
pop {r0-r4}
b Return1
Return1:
ldr r0, =(0x08040B60+1)
bx r0
Return2:
ldr r0, =(0x080412DE+1)
bx r0
Jump4:
mov pc, r4
.align 2
NPokeField: .word 0x0202406C
BattleDataAbility: .word 0x020240A4
Bank: .word 0x0202420B
BattleScriptBad: .word 0x08______
BattleScriptHeal: .word 0x08______
StoreDamage: .word 0x020241F0
ability_something: .word 0x08042828+1
/*00 49 08 47 XX+1 XX XX 08 at 0x08040B54*/
.text
.align 2
.thumb
.thumb_func
.global poisonhealsecond
Start:
cmp r0, #0
beq Return2
CheckAbility:
push {r0-r4}
ldr r4, BattleData
ldr r0, Bank
ldrb r0, [r0]
mov r1, #0x58
mul r0, r1
add r0, #0x20
add r0, r4
ldrb r2, [r0]
cmp r2, #[B][U]0x5B[/U][/B] /*Number of your ability Poison Heal*/
bne PopAndReturn1
ldrh r2, [r0, #8]
cmp r2, #0
beq PopAndReturn2
ldrh r3, [r0, #0xC]
cmp r2, r3
beq PopAndReturn2
lsr r3, r3, #3
cmp r3, #0
bne DontTouch
mov r3, #1
DontTouch:
neg r3, r3
ldr r2, StoreDamage
str r3, [r2]
pop {r0-r4}
ldr r0, BattleScriptHeal
ldr r1, =(0x080412D0+1)
bx r1
PopAndReturn1:
pop {r0-r4}
b Return1
PopAndReturn2:
pop {r0-r4}
b Return2
Return1:
add r1, r2, r4
ldr r0, =(0x08040BAC+1)
bx r0
Return2:
ldr r1, =(0x080412DE+1)
bx r1
.align 2
Bank: .word 0x0202420B
BattleData: .word 0x02024084
BattleScriptHeal: .word 0x08A22D30
StoreDamage: .word 0x020241F0
/*type 00 49 08 47 XX+1 XX XX at 0x08040BA4 */
#org 0xYourOffset
setword 0x203E320 0x8XXXXXX
printstring 0x184
waitmessage 0x40
playanimation 0x1 0x1F 0x0 //Here refer to the weathers abilities two post above to add your new animation. Nightmare with dark background should be ok.
orword 0x2024280 0x100100
graphicalhpupdate 0x1
datahpupdate 0x1
faintpokemon 0x1 0x0 0x0
Note the offset of your battlescript and in the end write those bytes : 24 XX XX XX 08 3D
with XX XX XX being the address of the "3D" after the 24 XX XX XX 08
FD 0F 00 DD E7 00 E8 E3 E9 E6 E1 D9 E2 E8 D9 D8 00 D6 ED FE BC D5 D8 00 BE E6 D9 D5 E1 E7 AB FF
#org 0xA22D30
waitmessage 0x40
orword 0x2024280 0x100
setword 0x203E320 0x8TTTTTT
printstring 0x184
statusanimation 0x1
graphicalhpupdate 0x1
datahpupdate 0x1
end2
FD 0F B4 E7 00 CA E3 DD E7 E3 E2 00 C2 D9 D5 E0 00 E6 D9 E7 E8 E3 E6 D9 D8 FE DD E8 E7 00 E0 DD DA D9 AB
Restart, everything here is for Emerald : Implementation of Delta Stream/DesolateLand/Primordial Sea
I know that it is bad to double post, but the precedent was long enough I think, and those abilities are not tied with the precedent.
Implementation of Adaptability/Refrigirate/Pixilate/Aerilate/Strong Jaw/Iron Fist/Though Claws for
Triple post, it's getting worse, sorry for that :X
I'm pretty proud of this one. Full implementation of Bad Dreams for Emerald :
Responses in bold.
.text
.align 2
.thumb
.thumb_func
.global heatproof
ThickFatCheck:
ldrb r0, [r1]
cmp r0, #0x2F
bne HeatProofCheck
BufferType:
mov r2, r9
CheckIceType:
cmp r2, #0xF
bne CheckFireType
b HalveDamage
HeatProofCheck:
cmp r0, #0x56
bne Return
mov r2, r9
CheckFireType:
cmp r2, #0xA
bne Return
HalveDamage:
ldr r0, .Return
bx r0
Return:
ldr r0, .Return2
bx r0
.align 2
.Return: .word 0x0803F049
.Return2: .word 0x0803F059
#insert 00 48 00 47 xx xx xx 08 at 3F038
.text
.align 2
.thumb
.thumb_func
.global preventburndamage
Main:
ldr r2, .DamageStore
mov r0, r1
add r0, #0x20
ldrb r0, [r0]
ldrh r1, [r1, #0x2C]
CheckHeatProof:
cmp r0, #0x56
bne CheckMagicGuard
HeatProof:
lsr r1, r1, #0x4
b Store
CheckMagicGuard:
cmp r0, #0x63
beq MagicGuard
BurnDamage:
lsr r1, r1, #0x3
CheckZero:
cmp r1, #0x0
bne Store
mov r1, #0x1
b Store
MagicGuard:
mov r1, #0x0
Store:
str r1, [r2]
Return:
ldr r0, .Return
bx r0
.align 2
.DamageStore: .word 0x02023D50
.Return: .word 0x08018577
#insert 01 4A 10 47 00 00 xx xx xx 08 at 18566
.text
.align 2
.thumb
.thumb_func
.global heatproof
ThickFatCheck:
ldrb r0, [r1]
cmp r0, #0x2F
bne HeatProofCheck
BufferType:
mov r2, r10
CheckIceType:
cmp r2, #0xF
bne CheckFireType
b HalveDamage
HeatProofCheck:
cmp r0, #0x56
bne Return
mov r2, r10
CheckFireType:
cmp r2, #0xA
bne Return
HalveDamage:
ldr r4, .Return
bx r4
Return:
ldr r0, .Return2
bx r0
.align 2
.Return: .word 0x0806987D
.Return2: .word 0x08069885
#insert 00 48 00 47 xx xx xx 08 at 6986C
.text
.align 2
.thumb
.thumb_func
.global preventburndamage
Main:
ldr r2, .DamageStore
mov r0, r1
add r0, #0x20
ldrb r0, [r0]
ldrh r1, [r1, #0x2C]
CheckHeatProof:
cmp r0, #0x56
bne CheckMagicGuard
HeatProof:
lsr r1, r1, #0x4
b Store
CheckMagicGuard:
cmp r0, #0x63
beq MagicGuard
BurnDamage:
lsr r1, r1, #0x3
CheckZero:
cmp r1, #0x0
bne Store
mov r1, #0x1
b Store
MagicGuard:
mov r1, #0x0
Store:
str r1, [r2]
Return:
ldr r0, .Return
bx r0
.align 2
.DamageStore: .word 0x020241F0
.Return: .word 0x08040C43
#insert 01 4A 10 47 00 00 xx xx xx 08 at 40C32
Let's implement Contrary for Emerald !
I think that all, please report any bug, or any problem to insert this (that are not already known)
.text
.align 2
.thumb
.thumb_func
.global bigpecks
BufferAbility:
mov r4, #0x58
mul r0, r4
add r0, r10
add r0, #0x20
ldrb r0, [r0]
BigPecksCheck:
cmp r0, #0x92
bne KeenEyeCheck
BigPecks:
mov r2, r9
cmp r2, #0x0
bne OtherChecks
cmp r7, #0x2
bne OtherChecks
cmp r5, #0x1
bne NotDefense
Sucess:
ldr r0, .Return
bx r0
KeenEyeCheck:
ldr r4, .Return2
bx r4
OtherChecks:
ldr r4, .Return3
bx r4
NotDefense:
ldr r0, .Return4
bx r0
.align 2
.Return: .word 0x08027E2D
.Return2: .word 0x08027E19
.Return3: .word 0x08027E6D
.Return4: .word 0x08027D49
#insert 00 4C 20 47 xx xx xx 08 58 24 at 027E10
.text
.align 2
.thumb
.thumb_func
.global bigpecks
BufferAbility:
mov r4, #0x58
mul r0, r4
add r0, r10
add r0, #0x20
ldrb r0, [r0]
BigPecksCheck:
cmp r0, #0x92
bne KeenEyeCheck
BigPecks:
mov r2, r9
cmp r2, #0x0
bne OtherChecks
cmp r7, #0x2
bne OtherChecks
cmp r5, #0x1
bne NotDefense
Sucess:
ldr r0, .Return
bx r0
KeenEyeCheck:
ldr r4, .Return2
bx r4
OtherChecks:
ldr r4, .Return3
bx r4
NotDefense:
ldr r0, .Return4
bx r0
.align 2
.Return: .word 0x08050C4D
.Return2: .word 0x08050C39
.Return3: .word 0x08050C8D
.Return4: .word 0x08050B69
#insert 00 4C 20 47 xx xx xx 08 58 24 at 50C30