Spoiler: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 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
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 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
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 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
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, .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
For anyone who uses this, just remember that you HAVE to place Mold Breaker in Ability slot #2 for whatever Pokemon you are editing or it WON'T work. (i.e. Pangoro would be Ability 1: Iron Fist Ability 2: Mold Breaker)
Last edited: