The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking > Binary Hack Research & Development
Reload this Page Code Ability Resource Thread

Notices
For all updates, view the main page.

Binary Hack Research & Development Got a well-founded knack with your binary Pokémon hacks? Love reverse-engineering them? For the traditional Pokémon ROM hacker, this is the spot for polling and gathering your ideas, and then implementing them! Share your hypothesis, get ideas from others, and collaborate to create!

Ad Content
Reply
 
Thread Tools
  #176   Link to this post, but load the entire thread.  
Old October 20th, 2015 (9:20 AM). Edited October 20th, 2015 by Spherical Ice.
Spherical Ice's Avatar
Spherical Ice Spherical Ice is offline
 
Join Date: Nov 2007
Location: Leicester, UK
Age: 25
Posts: 5,251
Quote:
Originally Posted by kleenexfeu View Post
Return2: .word 0x801F216+1 should be 0x801F294+1, though I doubt it would solve the problem
I don't think that's right, when I change it to that Sturdy doesn't work at all (moves that would inflict damage greater than the target's HP, which should trigger the endure BS, just faint it).
__________________
Reply With Quote
  #177   Link to this post, but load the entire thread.  
Old October 25th, 2015 (4:47 AM).
kleenexfeu kleenexfeu is offline
 
Join Date: Aug 2013
Gender: Male
Posts: 218
Quote:
Originally Posted by KDS View Post
Defiant/Competitive:

Spoiler:
Fire Red:-
Spoiler:

Battle Script at XXXXXX:
Spoiler:

Code:
89 01 YY YY YY 08 29 00 87 3E 02 02 02 YY YY YY 08 12 40 00 47 45 00 01 D4 3F 02 02 10 84 01 3C

// YYYYYY is the address of the blue bold byte


String at PPPPPP:
Code:
FD 10 B4 E7 00 FD 19 00 E7 DC D5 E6 E4 E0 ED FE E6 D5 DD E7 D9 D8 00 DD E8 E7 00 FD 00 AB FF
Main ASM Routine:
Spoiler:
Code:
.text
.align 2
.thumb
.thumb_func
.global defiantcompetitive


CheckFoeStatDropString:
                pop {r0}
                cmp r0, #0xD8
                bne Exit

CheckIfTargetIsAllyOrUser:
                ldr r0, =0x2023D6B
                ldrb r1, [r0]
                add r0, #0x1
                ldrb r2, [r0]
                mov r3, #0x1
                and r1, r3
                and r2, r3
                cmp r1, r2
                beq Exit

CheckAbility:
                mov r1, #0x58
                ldrb r2, [r0]
                mul r2, r1
                ldr r1, =0x2023c04
                add r1, r2
                ldrb r1, [r1]
                cmp r1, #0xAD   /*Index of Competitive*/
                beq Competitive
                cmp r1, #0x81   /*Index of Defiant*/
                bne Exit

Defiant:
                ldr r1, .StatBoostByte
                mov r0, #0x21
                b Common

Competitive:
                ldr r1, .StatBoostByte
                mov r0, #0x24

Common:
                
                strh r0, [r1]
                ldr r0, [r4]
                add r0, #0x5
                str r0, [r4]
                bl ScriptPusher
                ldr r0, .StatBoostScript
                str r0, [r4]
                ldr r1, .StringArguement
                ldr r0, .StringOffset
                str r0, [r1]
                b Exit2

Exit:
                
                ldr r0, [r4]
                add r0, #0x5
                str r0, [r4]

Exit2:
                mov r0, #0x1
                strb r0, [r5, #0x7]
                pop {r4,r5}
                pop {r0}
                bx r0

ScriptPusher:
                ldr r1, =0x08017545
                bx r1

.align 2
.StatBoostScript: .word 0x8XXXXXX
.StatBoostByte: .word 0x2023FDE
.StringArguement: .word 0x203C020
.StringOffset: .word 0x8PPPPPP

@At x1fe60: 01 B4 00 00 F7 F7 A2 FA 00 48 00 47 ZZ+1 ZZ ZZ 08, where ZZZZZZ is the address of routine.


Will add the case of Intimidate later.
I think you're overwriting 0x801FE6E with your hook, which is pointed by a conditionnal branch at 0x801FE38, perhaps this should be corrected
__________________
Arceus and Giratina Forms
Dynamic Pokémon Data
Reply With Quote
  #178   Link to this post, but load the entire thread.  
Old October 25th, 2015 (12:59 PM).
Trainer 781
Guest
 
Posts: n/a
Quote:
Originally Posted by kleenexfeu View Post
I think you're overwriting 0x801FE6E with your hook, which is pointed by a conditionnal branch at 0x801FE38, perhaps this should be corrected
Fixed. Kudos!
Reply With Quote
  #179   Link to this post, but load the entire thread.  
Old October 27th, 2015 (9:42 PM).
DraconianWing's Avatar
DraconianWing DraconianWing is offline
 
Join Date: Aug 2012
Location: Fallarbor Town
Age: 23
Gender: Male
Nature: Mild
Posts: 959
Posting to have this routine checked. It's a modified version of MrDS's Toxic Boost + Flare Boost routine for Emerald. Since only Toxic Boost is the ability in the routine planned to be added in SE, I've made attempts to change it so that Flare Boost and anything that relates to it in the code is gone. Index number(s) have been changed accordingly:
Code:
.text
.align 2
.thumb
.thumb_func
.global statusboostabilities
 
Main:
    ldrb r0, [r1]
    cmp r0, #0x81
    beq ToxicBoost
    cmp r0, #0x3E
    bne MarvelScaleCheck
Guts:
CheckStatus:
    ldr r0, [r6, #0x4C]
    cmp r0, #0x0
    beq MarvelScaleCheck
GutsReturn:
    ldr r0, .Return
    bx r0
ToxicBoost:
    ldr r0, [r6, #0x4C]
CheckPoison:
    cmp r0, #0x8
    beq AttackBoost
    cmp r0, #0x80
    bne MarvelScaleCheck
AttackBoost:
    lsr r0, r7, #0x1
    add r7, r0, r7
    b MarvelScaleCheck
CheckBurn:
    cmp r0, #0x10
    bne MarvelScaleCheck
MarvelScaleCheck:
    ldr r0, .Return2
    bx r0
 
.align 2
.Return: .word 0x08069909
.Return2: .word 0x08069917
__________________
"All dreams are but another reality. Never forget..."
Reply With Quote
  #180   Link to this post, but load the entire thread.  
Old October 28th, 2015 (1:34 AM).
MrDollSteak's Avatar
MrDollSteak MrDollSteak is offline
Formerly known as 11bayerf1
 
Join Date: Dec 2008
Location: Hong Kong
Age: 28
Gender: Male
Posts: 859
Quote:
Originally Posted by DraconianWing View Post
Posting to have this routine checked. It's a modified version of MrDS's Toxic Boost + Flare Boost routine for Emerald. Since only Toxic Boost is the ability in the routine planned to be added in SE, I've made attempts to change it so that Flare Boost and anything that relates to it in the code is gone. Index number(s) have been changed accordingly:
Code:
.text
.align 2
.thumb
.thumb_func
.global statusboostabilities
 
Main:
    ldrb r0, [r1]
    cmp r0, #0x81
    beq ToxicBoost
    cmp r0, #0x3E
    bne MarvelScaleCheck
Guts:
CheckStatus:
    ldr r0, [r6, #0x4C]
    cmp r0, #0x0
    beq MarvelScaleCheck
GutsReturn:
    ldr r0, .Return
    bx r0
ToxicBoost:
    ldr r0, [r6, #0x4C]
CheckPoison:
    cmp r0, #0x8
    beq AttackBoost
    cmp r0, #0x80
    bne MarvelScaleCheck
AttackBoost:
    lsr r0, r7, #0x1
    add r7, r0, r7
    b MarvelScaleCheck
CheckBurn:
    cmp r0, #0x10
    bne MarvelScaleCheck
MarvelScaleCheck:
    ldr r0, .Return2
    bx r0
 
.align 2
.Return: .word 0x08069909
.Return2: .word 0x08069917
It'd be better just to PM me that. You can also get rid of check burn. But yeah not the best place for it because it can confuse people.
__________________
Reply With Quote
  #181   Link to this post, but load the entire thread.  
Old November 6th, 2015 (8:55 PM). Edited November 6th, 2015 by Lance32497.
Lance32497's Avatar
Lance32497 Lance32497 is offline
LanceKoijer of Pokemon_Addicts
 
Join Date: Aug 2014
Location: Criscanto town-Ginoa Region xD
Gender: Male
Nature: Adamant
Posts: 792
Quote:
Originally Posted by kleenexfeu View Post
I can finally say it is completely done ! This is for Emerald : Implementation of Delta Stream/DesolateLand/Primordial Sea
Spoiler:

Read Me :
Spoiler:

In all of those routines and battlescripts I used 0x0203E331 as a free ram location to check whether a perma weather is set or not. You can use whatever you want while this is not used in-game.

Checking switch-in Abilities :
Spoiler:

The routine :
Spoiler:

Code:
.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, #0xC0	/*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, #0xC0	/*Number of your ability Delta Stream*/
beq NoSwitchInAbility
mov r1, #0xC0	/*Number of your ability Delta Stream*/
strb r1, [r0]
ldr r0, BattleScript
bl ExecuteScript
ldr r1, =(0x08042A72+1)
bx r1

CheckDeso:
cmp r0, #0xBF	/*Number of your ability Desolate Land*/
bne CheckPrimo

UpdateDesolate:
ldr r2, FreeRam
mov r0, #0xBF	/*Number of your ability Desolate Land*/
strb r0, [r2]
ldr r2, =(0x08042BD8+1)
bx r2

CheckPrimo:
cmp r0, #0xBE	/*Number of your ability Primordial Sea*/
bne NoSwitchInAbility

UpdatePrimordial:
ldr r2, FreeRam
mov r0, #0xBE	/*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*/

BattleScript :
Spoiler:
Spoiler:

Code:
#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

At TT TT TT :
Code:
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
This is the string that says "A mysterious air..." You can change it in whatever you want.

Also, you'll have to repoint a little table to play a new custom animation. At 0x5DA3C there's a pointer. Change this pointer to your new table which will be :
Spoiler:

Code:
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
Whith LL LL LL being the pointer to your new animation (you can use an existing one but you'll still have to repoint as I said).

I assumed here that FA is your setword command and 0x0203E320 your freelocation that point to your battlestring.

Weather attacks ineffective under Primal/Mega weathers :
Spoiler:

The battlescript :
Spoiler:

Code:
#org @YourOffset
jumpifhalfword 0x0 0x203E331 0xBE 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 0xBF 0x82D9F1A  ##Same thing
jumpifhalfword 0x0 0x203E331 0xC0 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


Finally make hail/raindance/sandstorm having the same effect which point on @YourOffset.

Modulation damages :
Spoiler:

The routines :
Spoiler:

Code:
.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, #0xBE	/*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, #0xBF	/*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 0x08E3D114         /*Take care to change this address accordingly to your type chart*/
BattleScript1: .word 0x08YourOffset       /*Change accordingly to the location your battle script1*/
BattleScript2: .word 0x08YourOffset       /*Change accordingly to the location your battle script2*/
ActiveBSPointer: .word 0x02024214

/*00 48 00 47 XX+1 XX XX 08 at 0x4713C*/

Spoiler:

Code:
.thumb

push {r4, r5, lr}
cmp r4, #2
bne Back
ldr r4, FreeRam
ldrb r4, [r4]
cmp r4, #0xC0	/*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*/

Battlescripts :
Spoiler:

At BattleScript1:
Spoiler:

Code:
#org 0xYourOffset
pause 0x20
setword 0x203E320 0x8PPPPPP
printstring 0x184
end2
at PPPPPP :
Spoiler:

Code:
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
the "move evaporated.." thing
[/code]


At BattleScript2:
Spoiler:

Code:
#org 0xYourOffset
pause 0x20
setword 0x203E320 0x8KKKKKK
printstring 0x184
end2
At KKKKKK :
Spoiler:

Code:
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
"Move damped..."




Checking switch-out :
Spoiler:

The routine :
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func
.global regenerator
 
AbilityBuffer:
	add r0, r1, r3
	add r0, #0x20
	ldrb r0, [r0]

RegeneratorCheck:
	cmp r0, #0x91	/*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, #0xC0	/*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, #0xBF	/*Index number of yout ability Desolate Land*/
	beq Desolate

CheckPrimordial:
	cmp r0, #0xBE	/*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, #0xC0	/*Index number of your ability Delta Stream*/
	bne NoAbility
	b ClearWeather
	
Desolate:
	ldr r2, .FreeRam
	ldrb r0, [r2]
	cmp r0, #0xBF	/*Index number of your ability Desolate Land*/
	bne NoAbility
	b ClearWeather

Primordial:
	ldr r2, .FreeRam
	ldrb r0, [r2]
	cmp r0, #0xBE	/*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*/
This is the MrDollSteak's regenerator routine wich I've modifed a bit to remove the permaweather if the mega/prima is switched out.

BattleScript at 0x08UUUUUU :
Spoiler:

Code:
#org 0xA1FCF0
pause 0x40
setword 0x203E320 0x8GGGGGG
printstring 0x184
return
At GGGGGG :
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
"The weather has returned to normal!"

Second routine :
Spoiler:

Code:
.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*/
This one clear the FreeRam in the end of every battle.



Modification of FaintPokemon command :
Spoiler:

The Routines :
Spoiler:

Target Routine :
Code:
.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*/
User Routine :
Code:
.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*/
Associated BattleScripts :
Note : I assumed you implemented Moxie in your rom (see page 1 of this thread). So if you don't want that ability you can remove the underlined part in the first battlescript.
Spoiler:

Target BattleScript (at PPPPPP:
Code:
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
jumpifability 0x1 0x9A @Moxie
return

#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

#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
User BattleScript :
Code:
Assuming FA is your Setword command and 0203E320 your location of battle string:
FA F0 E3 03 02 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



Altering check for Air Lock/Cloud Nine :
Spoiler:

Code:
.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


Thank a lot to MrDollSteak to pointing me how to handle a good part of this, thanks to daniilS for help me to fix some bugs, and thanks to Touched for being really patient with me.

Hope this could be useful to someone, if there's any problem or bugs PM me
Can someone port it in FireRed?
__________________
This signature has been disabled.
Scrollbar appears
Please review and fix the issues by reading the signature rules.

You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.

Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.
Reply With Quote
  #182   Link to this post, but load the entire thread.  
Old November 6th, 2015 (11:21 PM).
jirachiwishmaker's Avatar
jirachiwishmaker jirachiwishmaker is offline
 
Join Date: Jul 2007
Location: Forina
Gender: Male
Nature: Lonely
Posts: 116
Quote:
Originally Posted by Lance32497 View Post
Can someone port it in Emerald?
These routines actually are used for Emerald:
Quote:
Originally Posted by kleenexfeu
I can finally say it is completely done ! This is for Emerald : Implementation of Delta Stream/DesolateLand/Primordial Sea.
Reply With Quote
  #183   Link to this post, but load the entire thread.  
Old November 6th, 2015 (11:22 PM).
Lance32497's Avatar
Lance32497 Lance32497 is offline
LanceKoijer of Pokemon_Addicts
 
Join Date: Aug 2014
Location: Criscanto town-Ginoa Region xD
Gender: Male
Nature: Adamant
Posts: 792
Quote:
Originally Posted by jirachiwishmaker View Post
These routines actually are used for Emerald:
My Bad, that should be firered lol
__________________
This signature has been disabled.
Scrollbar appears
Please review and fix the issues by reading the signature rules.

You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.

Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.
Reply With Quote
  #184   Link to this post, but load the entire thread.  
Old November 8th, 2015 (3:51 AM). Edited December 8th, 2015 by MrDollSteak.
MrDollSteak's Avatar
MrDollSteak MrDollSteak is offline
Formerly known as 11bayerf1
 
Join Date: Dec 2008
Location: Hong Kong
Age: 28
Gender: Male
Posts: 859
Sorry for the long delay, but here are the Type Change Abilities! Credits to Kleenexfeu for the original routines, I've just optimised them and added Normalize.

Normalize, Refrigerate, Pixilate and Aerilate

Spoiler:
Fire Red
Spoiler:
Code:
.text
.align 2
.thumb
.thumb_func
.global typechangeabilities

BufferAbility:
	mov r0, r6
	add r0, #0x20
	ldrb r1, [r0]
NormalCheck:
	mov r0, r9
	cmp r0, #0x0
	bne NormalizeCheck
RefrigerateCheck:
	cmp r1, #0xAF
	bne PixilateCheck
Refrigerate:
	mov r0, #0xF
	b StoreType
PixilateCheck:
	cmp r1, #0xB7
	bne AerilateCheck
Pixilate:
	mov r0, #0x17
	b StoreType
AerilateCheck:
	cmp r1, #0xB9
	bne Return
Aerilate:
	mov r0, #0x2
StoreType:
	mov r9, r0
	ldr r0, .ChangeTypeLoc
	ldr r1, [r0]
	add r1, #0x13
	ldrb r1, [r1]
	mov r2, #0x3F
	and r2, r1
	cmp r2, #0x0
	bne Return
	mov r2, r9
	strb r2, [r1]
Boost:
	mov r0, r8
	mov r1, #0xA7
	mul r0, r1
	lsr r0, #0x7
	mov r8, r0
	mul r7, r1
	lsr r7, #0x7
	b Return
NormalizeCheck:
	cmp r1, #0x61
	bne Return
Normalize:
	mov r0, #0x0
	mov r9, r0
Return:
	ldr r0, [sp, #0x4]
	ldrh r0, [r0, #0xA]
	str r0, [sp, #0x18]
	ldrh r0, [r6, #0x2E]
	cmp r0, #0xAF
	bne NoEnigmaBerry
	ldr r1, .Return
	bx r1
NoEnigmaBerry:
	ldr r0, .Return2
	bx r0

.align 2
.ChangeTypeLoc: .word 0x02023FE8
.Return: .word 0x0803ED87
.Return2: .word 0x0803EDA1

Insert 01 48 00 47 00 00 xx+1 xx xx 08 at 0803ED7A

Emerald
Spoiler:
Code:
.text
.align 2
.thumb
.thumb_func
.global typechangeabilities

BufferAbility:
	mov r0, r6
	add r0, #0x20
	ldrb r1, [r0]
NormalCheck:
	mov r0, r10
	cmp r0, #0x0
	bne NormalizeCheck
RefrigerateCheck:
	cmp r1, #0xAF
	bne PixilateCheck
Refrigerate:
	mov r0, #0xF
	b StoreType
PixilateCheck:
	cmp r1, #0xB7
	bne AerilateCheck
Pixilate:
	mov r0, #0x17
	b StoreType
AerilateCheck:
	cmp r1, #0xB9
	bne Return
Aerilate:
	mov r0, #0x2
StoreType:
	mov r10, r0
	ldr r0, .ChangeTypeLoc
	ldr r1, [r0]
	add r1, #0x13
	ldrb r1, [r1]
	mov r2, #0x3F
	and r2, r1
	cmp r2, #0x0
	bne Return
	mov r2, r10
	strb r2, [r1]
Boost:
	mov r0, r8
	mov r1, #0xA7
	mul r0, r1
	lsr r0, #0x7
	mov r8, r0
	mul r7, r1
	lsr r7, #0x7
	b Return
NormalizeCheck:
	cmp r1, #0x61
	bne Return
Normalize:
	mov r0, #0x0
	mov r10, r0
Return:
	ldr r0, [sp, #0x4]
	ldrh r0, [r0, #0xA]
	str r0, [sp, #0x1C]
	ldrh r0, [r6, #0x2E]
	cmp r0, #0xAF
	bne NoEnigmaBerry
	ldr r1, .Return
	bx r1
NoEnigmaBerry:
	ldr r0, .Return2
	bx r0

.align 2
.ChangeTypeLoc: .word 0x0202449C
.Return: .word 0x0806961B
.Return2: .word 0x08069635

Insert 01 48 00 47 00 0 xx+1 xx xx 08 at 0806960E
__________________
Reply With Quote
  #185   Link to this post, but load the entire thread.  
Old November 8th, 2015 (11:30 AM).
Trainer 781
Guest
 
Posts: n/a
Just updated Unaware here by merging the accuracy ones into a single, clear and concise routine as well as including the updated effect of Keen Eye and also accommodating the evasion drop due to the move Gravity.
Reply With Quote
  #186   Link to this post, but load the entire thread.  
Old November 8th, 2015 (12:22 PM). Edited November 8th, 2015 by kleenexfeu.
kleenexfeu kleenexfeu is offline
 
Join Date: Aug 2013
Gender: Male
Posts: 218
Quote:
Originally Posted by MrDollSteak View Post
Sorry for the long delay, but here are the Type Change Abilities! Credits to Kleenexfeu for the original routines, I've just optimised them and added Normalize.

Normalize, Refrigerate, Pixilate and Aerilate

Spoiler:
Fire Red
Spoiler:
Code:
.text
.align 2
.thumb
.thumb_func
.global typechangeabilities

BufferAbility:
	mov r0, r6
	add r0, #0x20
	ldrb r1, [r0]
NormalCheck:
	mov r0, r10
	cmp r0, #0x0
	bne NormalizeCheck
RefrigerateCheck:
	cmp r1, #0xAF
	bne PixilateCheck
Refrigerate:
	mov r0, #0xF
	b Boost
PixilateCheck:
	cmp r1, #0xB7
	bne AerilateCheck
Pixilate:
	mov r0, #0x17
	b Boost
AerilateCheck:
	cmp r1, #0xB9
	bne Return
Aerilate:
	mov r0, #0x2
Boost:
	push {r0-r1}
	mov r0, r8
	mov r1, #0xA7
	mul r0, r1
	lsr r0, #0x7
	mov r8, r0
	mul r7, r1
	lsr r7, #0x7
	pop {r0-r1}
	b StoreType
NormalizeCheck:
	cmp r1, #0x61
	bne Return
Normalize:
	mov r0, #0x0
StoreType:
	mov r10, r0
	ldr r0, .ChangeTypeLoc
	ldr r1, [r0]
	add r1, #0x13
	ldrb r2, [r1]
	cmp r2, #0x0
	bne Return
	mov r2, r10
	strb r2, [r1]
Return:
	ldr r0, [sp, #0x4]
	ldrh r0, [r0, #0xA]
	str r0, [sp, #0x18]
	ldrh r0, [r6, #0x2E]
	cmp r0, #0xAF
	bne NoEnigmaBerry
	ldr r1, .Return
	bx r1
NoEnigmaBerry:
	ldr r0, .Return2
	bx r0

.align 2
ChangeTypeLoc: .word 0x02023FE8
Return: .word 0x0803ED87
Return2: .word 0x0803EDA1

Insert 00 48 00 47 xx+1 xx xx 08 at 0803ED7A

Emerald
Spoiler:
Code:
.text
.align 2
.thumb
.thumb_func
.global typechangeabilities

BufferAbility:
	mov r0, r6
	add r0, #0x20
	ldrb r1, [r0]
NormalCheck:
	mov r0, r10
	cmp r0, #0x0
	bne NormalizeCheck
RefrigerateCheck:
	cmp r1, #0xAF
	bne PixilateCheck
Refrigerate:
	mov r0, #0xF
	b Boost
PixilateCheck:
	cmp r1, #0xB7
	bne AerilateCheck
Pixilate:
	mov r0, #0x17
	b Boost
AerilateCheck:
	cmp r1, #0xB9
	bne Return
Aerilate:
	mov r0, #0x2
Boost:
	push {r0-r1}
	mov r0, r8
	mov r1, #0xA7
	mul r0, r1
	lsr r0, #0x7
	mov r8, r0
	mul r7, r1
	lsr r7, #0x7
	pop {r0-r1}
	b StoreType
NormalizeCheck:
	cmp r1, #0x61
	bne Return
Normalize:
	mov r0, #0x0
StoreType:
	mov r10, r0
	ldr r0, .ChangeTypeLoc
	ldr r1, [r0]
	add r1, #0x13
	ldrb r2, [r1]
	cmp r2, #0x0
	bne Return
	mov r2, r10
	strb r2, [r1]
Return:
	ldr r0, [sp, #0x4]
	ldrh r0, [r0, #0xA]
	str r0, [sp, #0x1C]
	ldrh r0, [r6, #0x2E]
	cmp r0, #0xAF
	bne NoEnigmaBerry
	ldr r1, .Return
	bx r1
NoEnigmaBerry:
	ldr r0, .Return2
	bx r0

.align 2
ChangeTypeLoc: .word 0x0202449C
Return: .word 0x0806961B
Return2: .word 0x08069635

Insert 00 48 00 47 xx+1 xx xx 08 at 0806960E
-ate aren't supposed to change the type of move like Judgment etc. So you check correctly that for the type, though you still give them a boost.
You should first check changetype loc, anding it with 0x3F, because moves like weather ball still store a value, even if the type is note changed, like 0x80, once "anded" with 0x3F, it gives 0. If once anded it's equal to 0, you can change the type and then boost.

Good catch for normalize, I didn't even paid attention to r10 x)

You also have to check changetypeloc for normalize, because it doesn't affect judgment and such
__________________
Arceus and Giratina Forms
Dynamic Pokémon Data
Reply With Quote
  #187   Link to this post, but load the entire thread.  
Old November 8th, 2015 (3:28 PM).
MrDollSteak's Avatar
MrDollSteak MrDollSteak is offline
Formerly known as 11bayerf1
 
Join Date: Dec 2008
Location: Hong Kong
Age: 28
Gender: Male
Posts: 859
Quote:
Originally Posted by kleenexfeu View Post
-ate aren't supposed to change the type of move like Judgment etc. So you check correctly that for the type, though you still give them a boost.
You should first check changetype loc, anding it with 0x3F, because moves like weather ball still store a value, even if the type is note changed, like 0x80, once "anded" with 0x3F, it gives 0. If once anded it's equal to 0, you can change the type and then boost.

Good catch for normalize, I didn't even paid attention to r10 x)

You also have to check changetypeloc for normalize, because it doesn't affect judgment and such

Well actually Normalize doesn't need to check changetypeloc, because it only activates on not Normal moves, so if r10 is storing Normal for Judgment and Hidden Power it won't change.

Good catch on the boost though, I'll swap the order around a little bit.
__________________
Reply With Quote
  #188   Link to this post, but load the entire thread.  
Old November 10th, 2015 (7:14 AM).
Trainer 781
Guest
 
Posts: n/a
Quote:
Originally Posted by Spherical Ice View Post
Sturdy

Any ideas?
In the second sturdy routine, you erroneously set the value of Flag label to x2023FDC instead of x2023DFC. This should fix your problem.
Also, the endured string is 0x99 same as the case in Emerald.
Reply With Quote
  #189   Link to this post, but load the entire thread.  
Old November 11th, 2015 (11:59 AM). Edited November 11th, 2015 by Trainer 781.
Trainer 781
Guest
 
Posts: n/a
Parental Bond:-

Fire Red:-
Spoiler:


Routine I:
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func
.global parentallock

ParentalMultiStopper:
      ldr r1, .ParentalByte
      mov r8, r1
      ldrb r0, [r1]
      cmp r0, #0x0
      bne Exit

ParentalAbilityCheck:
      ldr r2, .BattleStruct
      mov r9, r2
      ldr r4, .UserBank
      mov r6, #0x58
      ldrb r1, [r4]
      mul r1, r6
      add r1, r1, r2
      add r1, #0x20
      ldrb r0, [r1]
      cmp r0, #0xBA
      bne Exit

MoveBanListCheck:
      ldr r7, .CurrMove
      ldrh r1, [r7]
      lsl r0, r1, #0x01
      add r1, r1, r0
      lsl r1, r1, #0x02
      ldr r2, .MoveData
      add r2, r2, r1
      mov r10, r2

CheckForStatusMove:
      ldrb r2, [r2, #0xA]
      cmp r2, #0x2
      beq Exit
      ldr r2, .TableLoc
      ldr r3, =0xFEFE

Loop:
      ldrh r5, [r2]
      cmp r5, r3
      beq DoubleBattleCheck
      cmp r5, r7
      beq Exit
      add r2, #0x2
      b Loop

DoubleBattleCheck:
      mov r5, r9
      ldr r0, .BattleTypeFlags
      ldr r0, [r0, #0x0]
      mov r1, #0x1
      and r0, r1
      cmp r0, #0x0
      beq SingleTargetHPCheck
      mov r1, r10
      ldrb r0, [r1, #0x6]
      mov r2, #0x0       
      cmp r0, #0x8
      beq NoOfFoeCheck
      cmp r0, #0x20
      bne SingleTargetHPCheck

UserPartnerHP:
      ldrb r3, [r4]
      mov r1, #0x2
      eor r3, r1 
      mul r3, r6
      add r3, r5
      ldrh r0, [r3, #0x28]
      cmp r0, #0x0
      beq NoOfFoeCheck
      add r2, #0x1

NoOfFoeCheck:
      ldrb r3, [r4]
      mov r1, #0x1
      eor r3, r1
      and r3, r1
      mul r3, r6
      add r3, r5
      ldrh r0, [r3, #0x28]
      cmp r0, #0x0
      beq CheckNextIter
      add r2, #0x1 

CheckNextIter:
      lsl r6, r6, #0x1
      add r3, r6
      ldrh r0, [r3, #0x28]
      cmp r0, #0x0
      beq CheckNoOfAliveTargets
      add r2, #0x1
 
CheckNoOfAliveTargets:
      cmp r2, #0x1
      beq Success
      cmp r2, #0x2
      blt Exit

SetParentalBan:
      mov r1, r8
      mov r0, #0x3
      strb r0, [r1]
      b Exit

SingleTargetHPCheck:
      ldrb r3, [r4, #0x1]
      mul r3, r6
      add r3, r5
      ldrh r0, [r3, #0x28]
      cmp r0, #0x0
      beq Exit

Success:
      mov r1, r8
      mov r0, #0x2
      strb r0, [r1]

Exit:
      mov r0, #0x0
      mov r9, r0
      ldr r1, =0x2023FC8
      ldr r2, =0x2023FE8
      mov r10, r1
      mov r8, r2
      ldr r0, =0x8019302+1
      bx r0

.align 2
.ParentalByte: .word 0x0203C03C
.BattleStruct: .word 0x02023BE4
.UserBank: .word 0x02023D6B
.CurrMove: .word 0x02023D4A
.MoveData: .word 0x08250C04
.TableLoc: .word 0x08DDDDDD
.BattleTypeFlags: .word 0x02022B4C
/*At x192E0: 00 48 00 47 XX+1 XX XX 08*/
Table at DDDDDD
Code:
04 00 0C 00 0D 00 18 00 13 00 1F 00 20 00 29 00 2A 00 4C 00 5A 00 82 00 83 00 8C 00 8F 00 9A 00 9B 00 A7 00 C6 00 03 00 78 00 5E 01 DC 00 FB 00 12 01 23 01 24 01 49 01 4D 01 54 01 61 01 F8 00 5B 00 13 00 8F 00 99 00 1B 01 FE FE
This is a table that contains the indices (Half Words) of damaging moves not supported by Parental Bond like Multi-Hit, Charging Turn Moves etc. Terminated by FEFE. Add indices for new moves like Dual Chop, Double Hit etc.



Routine II:
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func
.global parentalbond

ParentalChecker:
      ldr r1, .ParentalByte
      mov r8, r1
      ldrb r0, [r1]
      cmp r0, #0x2
      bne Exit

CheckOutcome:
      ldr r1, .Outcome
      ldrb r0, [r1]
      mov r1, #0x29
      and r0, r1
      cmp r0, #0x0
      bne Exit

UserHPCheck:
      ldr r2, .BattleStruct
      ldr r4, .UserBank
      mov r6, #0x58
      ldrb r1, [r4]
      mul r1, r6
      add r1, r1, r2
      ldrh r0, [r1, #0x28]
      cmp r0, #0x0
      beq Exit

TargetHPCheck:
      ldrb r1, [r4, #0x1]
      mul r1, r6
      add r1, r1, r2
      ldrh r0, [r1, #0x28]
      cmp r0, #0x0
      beq Exit 

CheckDamage:
      ldr r2, .DamageStruct
      add r0, r4, #0x1
      ldrb r1, [r0, #0x0]
      lsl r0, r1, #0x2
      add r0, r0, r1
      lsl r1, r0, #0x2
      add r0, r1, #0x4
      add r0, r0, r2
      ldr r1, [r0, #0x0]
      cmp r1, #0x0
      beq Exit

CheckAsleep:
      ldr r5, .HitMarker
      ldr r2, [r5]
      mov r0, #0x80
      lsl r0, r0, #0xC
      and r0, r2
      cmp r0, #0
      bne Exit
      
Success:
      mov r0, #0x80
      lsl r0, r0, #0x4
      orr r2, r0
      str r2, [r5] /*Avoid PP Reduction Next Strike */
      mov r1, r8
      ldr r2, .CurrMove
      mov r8, r2
      mov r0, #0x1
      strb r0, [r1]
      mov r4, #0x0
      ldr r0, =0x80232F8+1
      bx r0 

Exit:
      ldr r0, =0x8023BAC+1
      bx r0

.align 2
.ParentalByte: .word 0x0203C03C
.BattleStruct: .word 0x02023BE4
.DamageStruct: .word 0x02023ECC
.Outcome: .word 0x02023DCC
.UserBank: .word 0x02023D6B
.CurrMove: .word 0x02023D4A
.HitMarker: .word 0x02023DD0
Make the pointer to this routine the 3rd last entry of Jump Table in cmd49 while expanding it as donehere .


Routine III:
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func
.global childturnaccuracy

CheckChildTurn:
  ldr r4, .ParentalByte
  ldrb r4, [r4]
  ldr r0, .ScriptPointer
  cmp r4, #0x1
  bne Exit

EnsureAccuracy:
   ldr r1, [r0]
   add r1, #0x7
   str r1, [r0]
   ldr r0, =0x0801E1C2+1
   bx r0  

Exit:
   ldr r0, [r0]
   ldrb r6, [r0, #5]
   ldrb r0, [r0, #6]
   lsl r0, r0, #8
   orr r6, r0
   ldr r0, =0x801DDDC+1
   bx r0

.align 2
.ParentalByte: .word 0x0203C03C
.ScriptPointer: .word 0x02023D74


/*At x1ddd0: 00 48 00 47 XX+1 XX XX 08*/


Routine IV:
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func
.global childturnpower

CheckChildTurn:
  ldr r4, .ParentalByte
  ldrb r4, [r4]
  cmp r4, #0x1
  bne Exit

HalfDamage:
  ldr r4, .Damage
  ldrh r5, [r4]
  lsr r5, r5, #0x1
  cmp r5, #0x0
  bne NotZero
  mov r5, #0x1

NotZero:
  strh r5, [r4]

Exit:
   ldr r0, [r1]
   add r0, #0x1
   str r0, [r1]
   add sp, #0x10
   pop {r4-r7}
   pop {r0}
   bx r0

.align 2
.ParentalByte: .word 0x0203C03C
.Damage: .word 0x02023D50

/*At x1e644: 00 4C 20 47 XX+1 XX XX 08*/


Routine V:
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]
        ldr r0, .ParentalByte
        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]
	bx lr

.align 2

.Outcome: .word 0x02023DCC
.Index: .word 0x02023BC4
.Battlers: .word 0x02023D6C
.DisabledAbilityLoc: .word 0x0203C034
.BattleData: .word 0x02023C04
.EndLoc: .word 0x02023BE3
.ParentalByte: .word 0x203C03C

@ Go to your Battle Script command table, search for CD 2C 02 08 and replace it by XX+1 XX XX 08 (We are replacing the 'End' Battle Script Command. Not the case in Emerald)
Basically the 4th Mold Breaker Routine with added logic to clear the Parental Byte.


Bugs
Spoiler:

Does not handle Knock Off, Smelling Salts and Color Change as done in Gen VI. This due to the differences in order between Gen VI and Gen III handling of events during a Move Execution.


Reply With Quote
  #190   Link to this post, but load the entire thread.  
Old November 11th, 2015 (2:41 PM).
kleenexfeu kleenexfeu is offline
 
Join Date: Aug 2013
Gender: Male
Posts: 218
Quote:
Originally Posted by KDS View Post
Parental Bond:-

Fire Red:-
Spoiler:


Routine I:
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func
.global parentallock

ParentalMultiStopper:
      ldr r1, .ParentalByte
      mov r8, r1
      ldrb r0, [r1]
      cmp r0, #0x0
      bne Exit

ParentalAbilityCheck:
      ldr r2, .BattleStruct
      mov r9, r2
      ldr r4, .UserBank
      mov r6, #0x58
      ldrb r1, [r4]
      mul r1, r6
      add r1, r1, r2
      add r1, #0x20
      ldrb r0, [r1]
      cmp r0, #0xBA
      bne Exit

MoveBanListCheck:
      ldr r7, .CurrMove
      ldrh r1, [r7]
      lsl r0, r1, #0x01
      add r1, r1, r0
      lsl r1, r1, #0x02
      ldr r2, .MoveData
      add r2, r2, r1
      mov r10, r2

CheckForStatusMove:
      ldrb r2, [r2, #0xA]
      cmp r2, #0x2
      beq Exit
      ldr r2, .TableLoc
      ldr r3, =0xFEFE

Loop:
      ldrh r5, [r2]
      cmp r5, r3
      beq DoubleBattleCheck
      cmp r5, r7
      beq Exit
      add r2, #0x2
      b Loop

DoubleBattleCheck:
      mov r5, r9
      ldr r0, .BattleTypeFlags
      ldr r0, [r0, #0x0]
      mov r1, #0x1
      and r0, r1
      cmp r0, #0x0
      beq SingleTargetHPCheck
      mov r1, r10
      ldrb r0, [r1, #0x6]
      mov r2, #0x0       
      cmp r0, #0x8
      beq NoOfFoeCheck
      cmp r0, #0x20
      bne SingleTargetHPCheck

UserPartnerHP:
      ldrb r3, [r4]
      mov r1, #0x2
      eor r3, r1 
      mul r3, r6
      add r3, r5
      ldrh r0, [r3, #0x28]
      cmp r0, #0x0
      beq NoOfFoeCheck
      add r2, #0x1

NoOfFoeCheck:
      ldrb r3, [r4]
      mov r1, #0x1
      eor r3, r1
      and r3, r1
      mul r3, r6
      add r3, r5
      ldrh r0, [r3, #0x28]
      cmp r0, #0x0
      beq CheckNextIter
      add r2, #0x1 

CheckNextIter:
      lsl r6, r6, #0x1
      add r3, r6
      ldrh r0, [r3, #0x28]
      cmp r0, #0x0
      beq CheckNoOfAliveTargets
      add r2, #0x1
 
CheckNoOfAliveTargets:
      cmp r2, #0x1
      beq Success
      cmp r2, #0x2
      blt Exit

SetParentalBan:
      mov r1, r8
      mov r0, #0x3
      strb r0, [r1]
      b Exit

SingleTargetHPCheck:
      ldrb r3, [r4, #0x1]
      mul r3, r6
      add r3, r5
      ldrh r0, [r3, #0x28]
      cmp r0, #0x0
      beq Exit

Success:
      mov r1, r8
      mov r0, #0x2
      strb r0, [r1]

Exit:
      mov r0, #0x0
      mov r9, r0
      ldr r1, =0x2023FC8
      ldr r2, =0x2023FE8
      mov r10, r1
      mov r8, r2
      ldr r0, =0x8019302+1
      bx r0

.align 2
.ParentalByte: .word 0x0203C03C
.BattleStruct: .word 0x02023BE4
.UserBank: .word 0x02023D6B
.CurrMove: .word 0x02023D4A
.MoveData: .word 0x08250C04
.TableLoc: .word 0x08DDDDDD
.BattleTypeFlags: .word 0x02022B4C
/*At x192E0: 00 48 00 47 XX+1 XX XX 08*/
Table at DDDDDD
Code:
04 00 0C 00 0D 00 18 00 13 00 1F 00 20 00 29 00 2A 00 4C 00 5A 00 82 00 83 00 8C 00 8F 00 9A 00 9B 00 A7 00 C6 00 03 00 78 00 5E 01 DC 00 FB 00 12 01 23 01 24 01 49 01 4D 01 54 01 61 01 F8 00 5B 00 13 00 8F 00 99 00 1B 01 FE FE
This is a table that contains the indices (Half Words) of damaging moves not supported by Parental Bond like Multi-Hit, Charging Turn Moves etc. Terminated by FEFE. Add indices for new moves like Dual Chop, Double Hit etc.



Routine II:
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func
.global parentalbond

ParentalChecker:
      ldr r1, .ParentalByte
      mov r8, r1
      ldrb r0, [r1]
      cmp r0, #0x2
      bne Exit

CheckOutcome:
      ldr r1, .Outcome
      ldrb r0, [r1]
      mov r1, #0x29
      and r0, r1
      cmp r0, #0x0
      bne Exit

UserHPCheck:
      ldr r2, .BattleStruct
      ldr r4, .UserBank
      mov r6, #0x58
      ldrb r1, [r4]
      mul r1, r6
      add r1, r1, r2
      ldrh r0, [r1, #0x28]
      cmp r0, #0x0
      beq Exit

TargetHPCheck:
      ldrb r1, [r4, #0x1]
      mul r1, r6
      add r1, r1, r2
      ldrh r0, [r1, #0x28]
      cmp r0, #0x0
      beq Exit 

CheckDamage:
      ldr r2, .DamageStruct
      add r0, r4, #0x1
      ldrb r1, [r0, #0x0]
      lsl r0, r1, #0x2
      add r0, r0, r1
      lsl r1, r0, #0x2
      add r0, r1, #0x4
      add r0, r0, r2
      ldr r1, [r0, #0x0]
      cmp r1, #0x0
      beq Exit

CheckAsleep:
      ldr r5, .HitMarker
      ldr r2, [r5]
      mov r0, #0x80
      lsl r0, r0, #0xC
      and r0, r2
      cmp r0, #0
      bne Exit
      
Success:
      mov r0, #0x80
      lsl r0, r0, #0x4
      orr r2, r0
      str r2, [r5] /*Avoid PP Reduction Next Strike */
      mov r1, r8
      ldr r2, .CurrMove
      mov r8, r2
      mov r0, #0x1
      strb r0, [r1]
      mov r4, #0x0
      ldr r0, =0x80232F8+1
      bx r0 

Exit:
      ldr r0, =0x8023BAC+1
      bx r0

.align 2
.ParentalByte: .word 0x0203C03C
.BattleStruct: .word 0x02023BE4
.DamageStruct: .word 0x02023ECC
.Outcome: .word 0x02023DCC
.UserBank: .word 0x02023D6B
.CurrMove: .word 0x02023D4A
.HitMarker: .word 0x02023DD0
Make the pointer to this routine the 3rd last entry of Jump Table in cmd49 while expanding it as donehere .


Routine III:
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func
.global childturnaccuracy

CheckChildTurn:
  ldr r4, .ParentalByte
  ldrb r4, [r4]
  ldr r0, .ScriptPointer
  cmp r4, #0x1
  bne Exit

EnsureAccuracy:
   ldr r1, [r0]
   add r1, #0x7
   str r1, [r0]
   ldr r0, =0x0801E1C2+1
   bx r0  

Exit:
   ldr r0, [r0]
   ldrb r6, [r0, #5]
   ldrb r0, [r0, #6]
   lsl r0, r0, #8
   orr r6, r0
   ldr r0, =0x801DDDC+1
   bx r0

.align 2
.ParentalByte: .word 0x0203C03C
.ScriptPointer: .word 0x02023D74


/*At x1ddd0: 00 48 00 47 XX+1 XX XX 08*/


Routine IV:
Spoiler:

Code:
.text
.align 2
.thumb
.thumb_func
.global childturnpower

CheckChildTurn:
  ldr r4, .ParentalByte
  ldrb r4, [r4]
  cmp r4, #0x1
  bne Exit

HalfDamage:
  ldr r4, .Damage
  ldrh r5, [r4]
  lsr r5, r5, #0x1
  cmp r5, #0x0
  bne NotZero
  mov r5, #0x1

NotZero:
  strh r5, [r4]

Exit:
   ldr r0, [r1]
   add r0, #0x1
   str r0, [r1]
   add sp, #0x10
   pop {r4-r7}
   pop {r0}
   bx r0

.align 2
.ParentalByte: .word 0x0203C03C
.Damage: .word 0x02023D50

/*At x1e644: 00 4C 20 47 XX+1 XX XX 08*/


Routine V:
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]
        ldr r0, .ParentalByte
        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]
	bx lr

.align 2

.Outcome: .word 0x02023DCC
.Index: .word 0x02023BC4
.Battlers: .word 0x02023D6C
.DisabledAbilityLoc: .word 0x0203C034
.BattleData: .word 0x02023C04
.EndLoc: .word 0x02023BE3
.ParentalByte: .word 0x203C03C

@ Go to your Battle Script command table, search for CD 2C 02 08 and replace it by XX+1 XX XX 08 (We are replacing the 'End' Battle Script Command. Not the case in Emerald)
Basically the 4th Mold Breaker Routine with added logic to clear the Parental Byte.


Bugs
Spoiler:

Does not handle Knock Off, Smelling Salts and Color Change as done in Gen VI. This due to the differences in order between Gen VI and Gen III handling of events during a Move Execution.


This and the new items effect effect, + the good place for multitype, that's really awesome KDS, thanks for your work !

Could we check the move effect instead of the move number ? Perhaps it'd be more practical.
__________________
Arceus and Giratina Forms
Dynamic Pokémon Data
Reply With Quote
  #191   Link to this post, but load the entire thread.  
Old November 11th, 2015 (4:09 PM).
Trainer 781
Guest
 
Posts: n/a
Quote:
Originally Posted by kleenexfeu View Post
This and the new items effect effect, + the good place for multitype, that's really awesome KDS, thanks for your work !

Could we check the move effect instead of the move number ? Perhaps it'd be more practical.
Thanks!
Yes you can. Feel free to mod.
Reply With Quote
  #192   Link to this post, but load the entire thread.  
Old November 15th, 2015 (7:20 PM).
pokefreak890's Avatar
pokefreak890 pokefreak890 is offline
The One that will make everything great
 
Join Date: Nov 2014
Gender: Male
Posts: 853
i have a request for you guys and i hope it isnt too big of a request can u guys code download for emerald that would be awesome
__________________
3DS FREIND CODE : 2724-3540-0898
Reply With Quote
  #193   Link to this post, but load the entire thread.  
Old November 19th, 2015 (1:00 AM). Edited November 19th, 2015 by Xencleamas.
Xencleamas's Avatar
Xencleamas Xencleamas is offline
Suddenly lurking in the shadows...
 
Join Date: Feb 2014
Gender: Male
Nature: Adamant
Posts: 456
Quote:
Originally Posted by MrDollSteak View Post
Normalize, Refrigerate, Pixilate and Aerilate
Is that where I supposedly put the hook because the pointer to be placed is not 4-byte aligned.

And there are few errors while compiling:
- Two instances of Return. One is a branch and one is a pointer. I believe that the branch Return should be ReturnType.
- Forgotten the . "dots" before the .align 2 of pointers (ChangeTypeLog and others)
- and r2, #0x3F... "and" seriously? Maybe a typo of add I suppose?
__________________
Reply With Quote
  #194   Link to this post, but load the entire thread.  
Old November 19th, 2015 (4:12 AM). Edited November 19th, 2015 by kleenexfeu.
kleenexfeu kleenexfeu is offline
 
Join Date: Aug 2013
Gender: Male
Posts: 218
Quote:
Originally Posted by Sky High View Post
Is that where I supposedly put the hook because the pointer to be placed is not 4-byte aligned.

And there are few errors while compiling:
- Two instances of Return. One is a branch and one is a pointer. I believe that the branch Return should be ReturnType.
- Forgotten the . "dots" before the .align 2 of pointers (ChangeTypeLog and others)
The alignement could be a problem indeed.

I hooked at 08069614 because I used 0806960C for psystrike (and the same location can be used later for other move of that kind), could you slightly change your hook ?
The dot before ChangeTypeLoc should be removed in the routine rather than added in the literal pool, as they are used for directive, using them for label/literal pool can be confusing.
You could indeed rename the label "Return" to "ReturnType", and then change the instances of the label Return in the routine.
I don't think "and r2, #0x3F" is allowed, at least with my assembler.
Finally, you should check the change type loc before moving r0 into r10, as r10 is used several times later. Something like :
ldr r1, ChangeTypeLoc
ldr r1, [r1]

stuffs

bne Return
mov r10, r0
strb r0, [r1]
__________________
Arceus and Giratina Forms
Dynamic Pokémon Data
Reply With Quote
  #195   Link to this post, but load the entire thread.  
Old November 20th, 2015 (9:02 PM).
sdw7sm sdw7sm is offline
 
Join Date: Mar 2014
Gender: Male
Posts: 119
The only link I found the Battle Script Editor is dead. Where can I download it?
Reply With Quote
  #196   Link to this post, but load the entire thread.  
Old November 20th, 2015 (9:20 PM).
DraconianWing's Avatar
DraconianWing DraconianWing is offline
 
Join Date: Aug 2012
Location: Fallarbor Town
Age: 23
Gender: Male
Nature: Mild
Posts: 959
Quote:
Originally Posted by sdw7sm View Post
The only link I found the Battle Script Editor is dead. Where can I download it?
Chrunch re-uploaded a copy at this thread :)
__________________
"All dreams are but another reality. Never forget..."
Reply With Quote
  #197   Link to this post, but load the entire thread.  
Old November 27th, 2015 (4:49 AM).
Vendily's Avatar
Vendily Vendily is offline
 
Join Date: Aug 2015
Nature: Calm
Posts: 1,604
This is a really cool resource.
How do you link the battle scripts to the ASM?
Or is the ASM linked to the Battle script?
__________________
| VPP Stats

Common Errors (and How to Fix Them) in Essentials
Reply With Quote
  #198   Link to this post, but load the entire thread.  
Old November 27th, 2015 (11:02 AM).
NewDenverCity's Avatar
NewDenverCity NewDenverCity is offline
 
Join Date: Apr 2014
Location: Antarctica
Gender: Male
Nature: Calm
Posts: 326
Quote:
Originally Posted by Vendily View Post
This is a really cool resource.
How do you link the battle scripts to the ASM?
Or is the ASM linked to the Battle script?
There's a post by Jambo in the Quick Research and Development that has a 'callasm' command for his battle script editor. We also use hooks in whatever routine the ability checks /should/ be in. So that's how we get battle scripts to use custom ASM in the middle of it.

Also, battle scripts are 'macro' ASM, so we can actually change what the commands do. So as you can see, literally everything in the game is ASM, a table, or a picture, but the battle scripts make things a lot shorter.
Reply With Quote
  #199   Link to this post, but load the entire thread.  
Old November 27th, 2015 (11:20 AM).
Vendily's Avatar
Vendily Vendily is offline
 
Join Date: Aug 2015
Nature: Calm
Posts: 1,604
Quote:
Originally Posted by NewDenverCity View Post
There's a post by Jambo in the Quick Research and Development that has a 'callasm' command for his battle script editor. We also use hooks in whatever routine the ability checks /should/ be in. So that's how we get battle scripts to use custom ASM in the middle of it.

Also, battle scripts are 'macro' ASM, so we can actually change what the commands do. So as you can see, literally everything in the game is ASM, a table, or a picture, but the battle scripts make things a lot shorter.
Thanks for the response!
To the thread!
__________________
| VPP Stats

Common Errors (and How to Fix Them) in Essentials
Reply With Quote
  #200   Link to this post, but load the entire thread.  
Old December 5th, 2015 (11:58 AM).
pokefreak890's Avatar
pokefreak890 pokefreak890 is offline
The One that will make everything great
 
Join Date: Nov 2014
Gender: Male
Posts: 853
i have another request for abilites can u guys do ice body and magician for emerald?
__________________
3DS FREIND CODE : 2724-3540-0898
Reply With Quote
Reply

Quick Reply

Join the conversation!

Create an account to post a reply in this thread, participate in other discussions, and more!

Create a PokéCommunity Account
Ad Content
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 8:52 AM.