Research & Development Got a well-founded knack with ROM hacking? Love reverse-engineering the Pokémon games? Or perhaps you love your assembly language. 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!

Reply
 
Thread Tools
  #51    
Old May 2nd, 2015 (10:24 AM).
Chacha Dinosaur's Avatar
Chacha Dinosaur Chacha Dinosaur is offline
Adamant and adaptive dinosaur.
     
    Join Date: Jul 2013
    Age: 24
    Gender: Male
    Posts: 453
    Quote:
    Originally Posted by RaileysXerilyasRX View Post
    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.
    Reply With Quote
      #52    
    Old May 5th, 2015 (10:14 PM).
    Xencleamas's Avatar
    Xencleamas Xencleamas is offline
    Suddenly lurking in the shadows...
       
      Join Date: Feb 2014
      Location: Asgard
      Gender: Male
      Nature: Adamant
      Posts: 458
      Quote:
      Originally Posted by KDS View Post
      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.
      __________________

      Xencleamas Untitled Pokémon Fan Game (Coming Soon!) Untitled Region (Coming Soon!)
      Reply With Quote
        #53    
      Old May 6th, 2015 (2:37 AM).
      Chacha Dinosaur's Avatar
      Chacha Dinosaur Chacha Dinosaur is offline
      Adamant and adaptive dinosaur.
         
        Join Date: Jul 2013
        Age: 24
        Gender: Male
        Posts: 453
        Quote:
        Originally Posted by RaileysXerilyasRX View Post
        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 is already covered in the new switch-in system in this thread. Just not has been ported to Emerald yet.
        Reply With Quote
          #54    
        Old May 12th, 2015 (3:25 PM).
        MrDollSteak's Avatar
        MrDollSteak MrDollSteak is offline
        Formerly known as 11bayerf1
           
          Join Date: Dec 2008
          Location: Hong Kong
          Age: 23
          Gender: Male
          Posts: 844
          Quote:
          Originally Posted by kleenexfeu View Post
          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
          No. This isn't a good way to do it.

          A) Protean doesn't change your type if you're frozen, asleep, etc. Not because a move doesn't affect it. All moves will change your type, which is why the BS method doesn't work as well, and why having a table is a bad idea.

          As I explained before, the best location to put Protean is in the Attack Canceler routine. That way, if a move fails, you don't activate Protean, as opposed to having an incorrect table.
          __________________
          Reply With Quote
            #55    
          Old May 13th, 2015 (1:40 PM). Edited November 12th, 2015 by kleenexfeu.
          kleenexfeu kleenexfeu is offline
             
            Join Date: Aug 2013
            Gender: Male
            Posts: 216
            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.
            When I say, "don't use it if X", it is because it is already covered and improved in X.

            Checking switch-in Abilities(don't use it if you want to implement Mega Evolution) :
            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 (don't use it if you want to implement stance change):
            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 (don't use it if you want mega evolution or stance change):
            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
            
            @ 00 4C 20 47 xx+1 xx xx 08 at 0x8042834


            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
            __________________
            Links for my work:
            Dynamic Emerald Attack ROMbase
            Arceus and Giratina Forms

            Touched's Emerald IDB + Battle stuff (probably outdated)
            Touched's Emerald IDB 6.8 + Battle stuff (probably outdated)
            Reply With Quote
              #56    
            Old May 18th, 2015 (5:50 PM). Edited October 25th, 2015 by kleenexfeu.
            kleenexfeu kleenexfeu is offline
               
              Join Date: Aug 2013
              Gender: Male
              Posts: 216
              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/Strong Jaw/Iron Fist/Though Claws/Mega Launcher/Sand Force for Emerald :
              Spoiler:

              Main routine :
              Spoiler:

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

              Info for the tables Abilities :
              Spoiler:

              For IronFistTable, Mega Launcher and StrongJawTable you have to create three tables with the number in hex reversed of the moves affected. Exemple : if you're using a vanilla Emerald your StrongJaw table should look like this : 2C 00 F2 00 31 01 (reversed number of Bite, Crunch and Poison Fang).

              Iron Fist Vanilla Table: 02 00 04 00 05 00 07 00 08 00 09 00 B7 00 DF 00 35 01 (thunder/fire/ice punch, mega punch etc..)

              Mega Launcher vanilla Table: 60 01 (yeah this one is not that useful without adding new moves)

              You can change it accordingly to what you want.

              Tough claws check the "contact" flag, you can simply edit with G3T what move you want to be affected. (The default setting are those used in official genVI games).

              Sand Force checks directly the type and the sandstorm, as well as if a pokémon on the field has Air lock or Cloud nine.

              Prevent taking damage from Sandstorm for Sand Force :
              Spoiler:

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



              I used the same location to hook than MrDollSteak's technician because it seemed to be appriopriate to me.
              __________________
              Links for my work:
              Dynamic Emerald Attack ROMbase
              Arceus and Giratina Forms

              Touched's Emerald IDB + Battle stuff (probably outdated)
              Touched's Emerald IDB 6.8 + Battle stuff (probably outdated)
              Reply With Quote
                #57    
              Old May 21st, 2015 (4:35 PM). Edited September 13th, 2015 by kleenexfeu.
              kleenexfeu kleenexfeu is offline
                 
                Join Date: Aug 2013
                Gender: Male
                Posts: 216
                Triple post, it's getting worse, sorry for that :X Little update : Optimisation

                I'm pretty proud of these. Full implementation of Bad Dreams and Poison Heal for Emerald :
                Spoiler:

                Main routine :
                Spoiler:

                Code:
                .thumb
                
                CheckIfUserAsleep:
                push {r0-r7}
                ldr r0, [r0]
                mov r1, #7
                and r0, r1
                cmp r0, #0
                beq CheckPoison
                
                StartCheck:
                CheckField:
                mov r2, #0x7C	/*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, #0x7C	/*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, #0x5B	/*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*/

                Routine for Toxic :
                Spoiler:

                Code:
                .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, #0x5B	/*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 */
                It handles the fact that if your Darkrai is the only one to have bad dreams, and it's asleep, it won't take damage. If Darkrai is your ally and you're asleep, you won't take damage. You take correctly damages when switching in-out Darkrai/asleep pokémon.


                The battlescripts :
                Spoiler:

                Bad Dreams :
                Spoiler:
                Code:
                #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
                At XX XX XX :
                Code:
                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

                Poison Heal now :
                Spoiler:

                Code:
                #org 0xA22D30
                waitmessage 0x40
                orword 0x2024280 0x100
                setword 0x203E320 0x8TTTTTT
                printstring 0x184
                statusanimation 0x1
                graphicalhpupdate 0x1
                datahpupdate 0x1
                end2
                At TT TT TT :
                Code:
                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
                It says "Buffer's Poison heal restored its HP or something, you can change it in whatever you want, I didn't ever had this ability so I don't know what is the message.


                Reply With Quote
                  #58    
                Old May 21st, 2015 (8:15 PM). Edited June 15th, 2015 by MrDollSteak.
                MrDollSteak's Avatar
                MrDollSteak MrDollSteak is offline
                Formerly known as 11bayerf1
                   
                  Join Date: Dec 2008
                  Location: Hong Kong
                  Age: 23
                  Gender: Male
                  Posts: 844
                  Quote:
                  Restart, everything here is for Emerald : Implementation of Delta Stream/DesolateLand/Primordial Sea
                  Overall this is pretty good, but I reckon, rather than editing the moxie and regenerator routines, you should just have a check at the 'end' command of the battle script that checks if the Pokemon that activate Delta Stream is still active on the field, and if not making the weather stop.

                  Quote:
                  Originally Posted by kleenexfeu View Post
                  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 [b]
                  Won't be accepting this one as such for a few reasons.

                  I've already made all of them in a seperate location (apart from the type change ones)
                  and in a much longer routine. Basically the way I handled it was by putting ALL the abilities that multiply by an amount other than 1.5 in the same routine, as to not waste space.

                  That being said, Strong Jaw and Mega Launcher could totally go into the Technician Routine.

                  Also the Type Change abilities shouldn't go here (outside of the 1.3 boost), because there are lots of different damage calcs that factor in type, so the type change would need to go before all of them. IE. If you change a move to the Ice type here, it mighn't be affected by Thick Fat / Nevermeltice etc. etc.

                  Quote:
                  Triple post, it's getting worse, sorry for that :X

                  I'm pretty proud of this one. Full implementation of Bad Dreams for Emerald :
                  This is really good thanks! I'll look into porting it to Fire Red / optimising it.
                  Did you just hook it from the Nightmare check?

                  ALSO as a general note Kleenex, you'll need to change ALL your ability indexes to match the ones listen in the OP. Also the message location should not be 203E3F0, but rather 203E320, as that's what I've used for every other ability.
                  __________________
                  Reply With Quote
                    #59    
                  Old May 22nd, 2015 (1:33 AM). Edited July 13th, 2015 by MrDollSteak.
                  MrDollSteak's Avatar
                  MrDollSteak MrDollSteak is offline
                  Formerly known as 11bayerf1
                     
                    Join Date: Dec 2008
                    Location: Hong Kong
                    Age: 23
                    Gender: Male
                    Posts: 844
                    Quote:
                    Originally Posted by kleenexfeu View Post
                    Responses in bold.
                    I don't think you do need 2 battle scripts to be honest. Even if Rayquaza is first in battle it should activate. Look at how Drought etc. do it.
                    Clearing it on faint and switch seems fair enough, but I think there is probably a simpler way to do it. Fine for now though.

                    I don't want those abilities with Technician for the reason I mentioned. I'll upload my routine later for those abilities later.

                    Doing it with the status damage calculations makes quite a bit of sense. On that note of status damage, here are the routines I have!

                    Heatproof

                    Spoiler:
                    Fire Red
                    Spoiler:
                    Routine I
                    Code:
                    .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
                    Routine II (Also includes Magic Guard)
                    Code:
                    .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

                    Emerald
                    Spoiler:
                    Routine I
                    Code:
                    .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
                    Routine II (Also includes Magic Guard)
                    Code:
                    .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

                    __________________
                    Reply With Quote
                      #60    
                    Old May 23rd, 2015 (5:22 PM). Edited June 15th, 2015 by MrDollSteak.
                    MrDollSteak's Avatar
                    MrDollSteak MrDollSteak is offline
                    Formerly known as 11bayerf1
                       
                      Join Date: Dec 2008
                      Location: Hong Kong
                      Age: 23
                      Gender: Male
                      Posts: 844
                      Quote:
                      Originally Posted by kleenexfeu View Post
                      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)
                      To stop the animation playing multiple times look at the battlescripts for Dragon Dance, Cosmic Power etc. They only play one animation that changes colours depending on which stats it is raising. Because if say your attack is already maxed and it only raises speed, it will only do that colour. Same with Superpower.

                      Also I'd put all of your routine into a spoiler, and make the tables and routines a lot clearer (look at Moxie for Emerald) please try that format. It makes things so much more convenient.

                      Anyway, I've added Big Pecks here because it's a fairly short and easy ability to add.

                      Big Pecks

                      Spoiler:
                      Fire Red
                      Spoiler:
                      Code:
                      .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

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

                      __________________
                      Reply With Quote
                        #61    
                      Old May 24th, 2015 (12:46 AM).
                      Spherical Ice's Avatar
                      Spherical Ice Spherical Ice is offline
                       
                      Join Date: Nov 2007
                      Location: Bristol, UK
                      Age: 20
                      Posts: 5,239
                      Quote:
                      Originally Posted by kleenexfeu View Post
                      Sphice made a routine/battle script for close combat which took 3 battle script, V-create took 7, it's factorial. Anc power would take 5!+1 battle script, which means 121. I'm sorry but I'm not gonna do that.
                      It's worth noting the system I used is actually very inefficient and I did it when I wasn't very familiar with battle scripting as a whole, so that isn't necessarily the case.
                      __________________
                      Reply With Quote
                        #62    
                      Old May 24th, 2015 (4:26 PM). Edited November 19th, 2015 by MrDollSteak.
                      MrDollSteak's Avatar
                      MrDollSteak MrDollSteak is offline
                      Formerly known as 11bayerf1
                         
                        Join Date: Dec 2008
                        Location: Hong Kong
                        Age: 23
                        Gender: Male
                        Posts: 844
                        Quote:
                        Originally Posted by kleenexfeu View Post
                        I'm not sure we can do it the same way with ancpower since it's the byte 02024335 that control the changing stats. if I refer to the move resource thread, Sphice made a routine/battle script for close combat which took 3 battle script, V-create took 7, it's factorial. Anc power would take 5!+1 battle script, which means 121. I'm sorry but I'm not gonna do that.

                        I think I found a solution. In the routine that check damaging move, we can put a check in the user part for shield dust/clear body, a check for 0xF1, and if these two conditions are presents, branch to a battle script that force the attspe to be lowered. It could work, but too lazy to try it for now
                        Dude there are far too many problems with this. Rather than creating heaps of errors and trying different ratchet ways to fix it, the best thing to do is redo the routine.

                        Anyway, with that out of the way here is Unburden!

                        Unburden

                        Spoiler:
                        Fire Red
                        Spoiler:
                        Code:
                        .text
                        .align 2
                        .thumb
                        .thumb_func
                        .global unburden
                         
                        CheckUnburden:
                        	mov r1, #0x20
                        	add r1, r1, r0
                        	ldrb r1, [r1]
                        	cmp r1, #0x55
                        	bne Return
                        UnburdenEffect:
                        	ldrh r1, [r0, #0x6]
                        	lsl r1, r1, #0x1
                        	strh r1, [r0, #0x6]
                        Return:
                        	ldrb r0, [r5]
                        	mul r0, r3
                        	add r2, #0x2E
                        	add r0, r0, r2
                        	str r0, [sp]
                        	ldr r1, .Return
                        	bx r1
                        
                        .align 2
                        
                        .Return: .word 0x0802619D
                        
                        #insert 01 49 08 47 00 00 xx xx xx 08 at 026192
                        This routine branches from the remove item command so it activates when an item is consumed.

                        Emerald
                        Spoiler:
                        Code:
                        .text
                        .align 2
                        .thumb
                        .thumb_func
                        .global unburden
                         
                        CheckUnburden:
                        	mov r1, #0x20
                        	add r1, r1, r0
                        	ldrb r1, [r1]
                        	cmp r1, #0x55
                        	bne Return
                        UnburdenEffect:
                        	ldrh r1, [r0, #0x6]
                        	lsl r1, r1, #0x1
                        	strh r1, [r0, #0x6]
                        Return:
                        	ldrb r0, [r5]
                        	mul r0, r3
                        	add r2, #0x2E
                        	add r0, r0, r2
                        	str r0, [sp]
                        	ldr r1, .Return
                        	bx r1
                        
                        .align 2
                        
                        .Return: .word 0x0804EE99
                        
                        #insert 01 49 08 47 00 00 xx xx xx 08 at 04EE8E
                        This routine branches from the remove item command so it activates when an item is consumed.

                        So far this routine activates only on consumed items (which is the main point of it). I will have to add an extra routine to handle Knock Off when I find the branch location.

                        Another possible error, is that the Unburden boost maaay be lost on leveling up.
                        __________________
                        Reply With Quote
                          #63    
                        Old June 5th, 2015 (11:22 AM).
                        Xencleamas's Avatar
                        Xencleamas Xencleamas is offline
                        Suddenly lurking in the shadows...
                           
                          Join Date: Feb 2014
                          Location: Asgard
                          Gender: Male
                          Nature: Adamant
                          Posts: 458
                          Quote:
                          Originally Posted by kleenexfeu View Post
                          Would it be possible to use the same place for Unaware ? Check user : if it has unaware, load boost of the target, store them in FreeRam, deal the damage, restore the boost after the damages are done.
                          Unaware is already done. It is only for FireRed for a while but it will be easily to be ported to Emerald just by looking and changing the offsets used in the original routines and scripts.

                          Quote:
                          Originally Posted by KDS View Post
                          2. Unaware (+ Sacred Sword Effect)
                          Spoiler:
                          This only works with Doesntknowhowtoplay's DPSS patch.
                          LL is the move effect ID for Sacred sword effect (give it basic damaging script in the effect battle script pointer).

                          Fire Red:
                          Spoiler:
                          Just insert these routines and make bytes changes mentioned their comments.

                          Attack and Special Attack Unaware:
                          Spoiler:

                          Code:
                          .text
                          .align 2
                          .thumb
                          .thumb_func
                          .global unwareattack
                          
                          main:
                          cmp r4, #0x2
                          bne nocrit
                          cmp r2, #0x6
                          ble ignorestat
                          
                          nocrit:
                          mov r0, #0x20
                          ldr r1, [sp, #0x4]
                          ldrb r1, [r1, r0]
                          cmp r1, #0x6E
                          beq ignorestat
                          ldr r1, return1
                          bx r1
                          
                          ignorestat:
                          ldr r1, return2
                          bx r1
                          
                          .align 2
                          return1: .word 0x0803F3D1
                          return2: .word 0x0803F3E1
                          
                          @At 3F3C8: 00 49 08 47 XX XX XX 08

                          Defense and Special Defense Unaware:
                          Spoiler:

                          Code:
                          .text
                          .align 2
                          .thumb
                          .thumb_func
                          .global unwaredefense
                          
                          main:
                          cmp r4, #0x2
                          bne nocrit
                          cmp r2, #0x5
                          bgt ignorestat
                          
                          nocrit:
                          mov r0, #0x20
                          ldrb r1, [r6, r0]
                          cmp r1, #0x6E
                          beq ignorestat
                          
                          ldr r1, currMove
                          ldrh r1, [r1, #0x0]
                          mov r0, #0xC
                          mul r1, r0
                          ldr r0, moveTable
                          add r0, r0, r1
                          ldrb r1, [r0, #0x0]
                          cmp r1, #0xLL
                          beq ignorestat
                          
                          ldr r1, return1
                          bx r1
                          
                          ignorestat:
                          ldr r1, return2
                          bx r1
                          
                          .align 2
                          currMove: .word 0x02023D4C
                          moveTable: .word 0x08250C04
                          return1: .word 0x0803F419
                          return2: .word 0x0803F429
                          
                          @At 3F410: 00 49 08 47 XX XX XX 08

                          Accuracy and Evasiveness Unaware (When foresite is not on)
                          Spoiler:

                          Code:
                          .text
                          .align 2
                          .thumb
                          .thumb_func
                          
                          main:
                          mov r2, #0x20
                          add r1, r4, r3
                          ldrb r1, [r1, r2]
                          cmp r1, #0x6E
                          beq foeunaware
                          ldrb r5, [r0, #0x1e]
                          b cont
                          
                          foeunaware:
                          mov r5, #0x6 
                          
                          cont:
                          ldrb r1, [r0, r2]
                          cmp r1, #0x6E
                          beq ignorestat
                          
                          ldr r1, currMove
                          ldrh r1, [r1, #0x0]
                          mov r0, #0xC
                          mul r1, r0
                          ldr r0, moveTable
                          add r0, r0, r1
                          ldrb r1, [r0, #0x0]
                          cmp r1, #0xLL
                          beq ignorestat
                          
                          add r1, r4, r3
                          ldrb r1, [r1, #0x1f]
                          lsl r0, r5, #0x0
                          add r0, #0x6
                          ldr r2, return
                          bx r2
                          
                          ignorestat:
                          ldr r2, return2
                          bx r2
                          
                          .align 2
                          currMove: .word 0x02023D4A
                          moveTable: .word 0x08250C04
                          return: .word 0x0801DFA9
                          return2: .word 0x0801DFAF
                          
                          @At 1DFA0: 00 4A 10 47 XX XX XX 08

                          Accuracy and Evasiveness Unaware (When foresite is in effect on the target. Also updates foresite)
                          Spoiler:

                          Code:
                          .text
                          .align 2
                          .thumb
                          .thumb_func
                          
                          main:
                          mul r0, r2
                          add r0, r0, r3
                          mov r2, #0x20
                          add r1, r4, r3
                          ldrb r1, [r1, r2]
                          cmp r1, #0x6E
                          beq foeunaware
                          ldrb r5, [r0, #0x1e]
                          b cont
                          
                          foeunaware:
                          mov r5, #0x6 
                          
                          cont:
                          ldrb r1, [r0, r2]
                          cmp r1, #0x6E
                          beq ignorestat
                          
                          ldr r1, currMove
                          ldrh r1, [r1, #0x0]
                          mov r0, #0xC
                          mul r1, r0
                          ldr r0, moveTable
                          add r0, r0, r1
                          ldrb r1, [r0, #0x0]
                          cmp r1, #0xLL
                          beq ignorestat
                          
                          add r1, r4, r3
                          ldrb r1, [r1, #0x1f]
                          cmp r1, #0x5
                          bgt ignorestat
                          
                          lsl r0, r5, #0x0
                          add r0, #0x6
                          ldr r2, return
                          bx r2
                          
                          ignorestat:
                          ldr r2, return2
                          bx r2
                          
                          .align 2
                          currMove: .word 0x02023D4A
                          moveTable: .word 0x08250C04
                          return: .word 0x0801DFA9
                          return2: .word 0x0801DFAF
                          
                          @ At 1DF80: 00 49 08 47 XX XX XX 08



                          __________________

                          Xencleamas Untitled Pokémon Fan Game (Coming Soon!) Untitled Region (Coming Soon!)
                          Reply With Quote
                            #64    
                          Old June 5th, 2015 (11:08 PM).
                          Chacha Dinosaur's Avatar
                          Chacha Dinosaur Chacha Dinosaur is offline
                          Adamant and adaptive dinosaur.
                             
                            Join Date: Jul 2013
                            Age: 24
                            Gender: Male
                            Posts: 453
                            Quote:
                            Originally Posted by kleenexfeu View Post
                            Yeah I know but KDS said it would actually takes 6 routines, so perhaps different hook, different operations. I wanted to find a more simple way. And since that ability need many test, I wanted to know if someone already tested it since it will be a tedious task.
                            Actually, the 6 routine method is more AI friendly and should be done that way. The locations to hook are already in my notes. Just a matter of time to implement it.

                            You can directly port the accuracy ones to emerald.

                            I did mold breaker the short way because there are 50+ abilities it negates. And even if you put that amount of Mold Breaker checks for each ability affected by Mold Breaker, the AI would only be able to recognize the damage calc ones (there also a cheap way to accomodate that) plus few others but not things like Clear Body Growl etc.
                            Reply With Quote
                              #65    
                            Old June 9th, 2015 (3:13 AM).
                            Chacha Dinosaur's Avatar
                            Chacha Dinosaur Chacha Dinosaur is offline
                            Adamant and adaptive dinosaur.
                               
                              Join Date: Jul 2013
                              Age: 24
                              Gender: Male
                              Posts: 453
                              Tinted Lens, Solid Rock, Filter (+ Expert Belt)

                              Spoiler:


                              Routine I does the actual Damage Manipulation and Routine II makes the AI recognize
                              Damage Modification due to these Abilities.

                              Replace KK with Held Item Effect Byte of Expert Belt.

                              Fire Red:-
                              Spoiler:


                              Routine I:
                              Code:
                              .text
                              .align 2
                              .thumb
                              .thumb_func
                              .global tintedlenssolidrockexpertbelt
                              
                              EffectivnessCheck:
                                     ldrb r1, [r0, #0x0]
                                     mov r0, #0x8
                                     and r0, r1
                                     cmp r0, #0x0
                                     bne NotEffective
                                     
                              MissCheck:
                                     mov r0, #0x31
                                     and r0, r1
                                     cmp r0, #0x0
                                     bne Exit
                              
                              NotVeryEffectiveCheck:       
                                     mov r0, #0x4
                                     and r0, r1
                                     cmp r0, #0x0
                                     beq SuperEffectiveCheck
                                     ldr r0, .UserBank
                                     ldr r1, .BattleStruct
                                     mov r2, #0x58
                                     ldrb r0, [r0]
                                     mul r2, r0
                                     add r1, r1, r2
                                     ldrb r1, [r1]
                                     cmp r1, #0x6F
                                     bne Exit
                              
                              HasTintedLens:
                                     ldr r0, .Damage
                                     ldrh r1, [r0]
                                     lsl r1, r1, #0x1
                                     strh r1, [r0]
                                     b Exit
                              
                              SuperEffectiveCheck:
                                     mov r0, #0x2
                                     and r0, r1
                                     cmp r0, #0x0       
                                     beq Exit
                                     ldr r0, .TargetBank
                                     ldr r4, .BattleStruct
                                     mov r3, #0x58
                                     ldrb r0, [r0]
                                     mul r0, r3
                                     add r1, r0, r4
                                     ldrb r0, [r1]
                                     cmp r0, #0x75
                                     beq HasSolidRock
                                     cmp r0, #0x70
                                     bne ExpertBeltCheck
                              HasSolidRock:
                                     ldr r0, .Damage
                                     ldrh r1, [r0]
                                     lsl r2, r1, #0x1
                                     add r1, r1, r2
                                     lsr r1, r1, #0x2
                                     cmp r1, #0x0
                                     bne NotZero
                                     mov r1, #0x1
                              
                              NotZero:
                                     strh r1, [r0]
                              
                              ExpertBeltCheck:
                                     ldr r0, .UserBank
                                     ldrb r0, [r0]
                                     mul r0, r3
                                     add r1, r0, r4
                                     add r1, #0xE
                                     ldrh r0, [r1]
                                     bl EffectGetter
                                     cmp r0, #0xKK
                                     bne Exit
                                     ldr r4, .Damage
                                     ldrh r0, [r4]
                                     mov r2, #0x6
                                     mul r0, r2
                                     mov r1, #0x5
                                     bl Divider
                                     strh r0, [r4]
                              Exit:
                                     ldr r1, =0x0801EA71
                                     bx r1
                              
                              NotEffective:
                                     ldr r1, =0x0801EA5F
                                     bx r1
                              
                              EffectGetter:
                                     ldr r1, =0x0809A925
                                     bx r1
                                    
                              Divider:
                                     ldr r2, =0x081E4019
                                     bx r2
                              
                              .align 2
                              .UserBank: .word 0x02023D6B
                              .TargetBank: .word 0x02023D6C
                              .BattleStruct: .word 0x02023C04
                              .Damage: .word 0x02023D50
                              
                              /* 1EA54: 00 49 08 47 XX+1 XX XX 08 00 00*/
                              Routine II:
                              Code:
                              .text
                              .align 2
                              .thumb
                              .thumb_func
                              .global tintedlenssolidrockexpertbeltai
                              
                              StruggleCheck:
                                     mov r1, r10
                                     cmp r1, #0xA5
                                     beq Quit
                              
                              EffectivnessCheck:
                                     ldrb r1, [r0, #0x0]
                                     mov r0, #0x39
                                     and r0, r1
                                     cmp r0, #0x0
                                     bne Exit
                              
                              NotVeryEffectiveCheck:       
                                     mov r0, #0x4
                                     and r0, r1
                                     cmp r0, #0x0
                                     beq SuperEffectiveCheck
                                     ldr r0, .UserBank
                                     ldr r1, .BattleStruct
                                     mov r2, #0x58
                                     ldrb r0, [r0]
                                     mul r2, r0
                                     add r1, r1, r2
                                     ldrb r1, [r1]
                                     cmp r1, #0x6F
                                     bne Exit
                              
                              HasTintedLens:
                                     ldr r0, .Damage
                                     ldrh r1, [r0]
                                     lsl r1, r1, #0x1
                                     strh r1, [r0]
                                     b Exit
                              
                              SuperEffectiveCheck:
                                     mov r0, #0x2
                                     and r0, r1
                                     cmp r0, #0x0       
                                     beq Exit
                                     ldr r0, .TargetBank
                                     ldr r4, .BattleStruct
                                     mov r3, #0x58
                                     ldrb r0, [r0]
                                     mul r0, r3
                                     add r1, r0, r4
                                     ldrb r0, [r1]
                                     cmp r0, #0x75
                                     beq HasSolidRock
                                     cmp r0, #0x70
                                     bne ExpertBeltCheck
                              HasSolidRock:
                                     ldr r0, .Damage
                                     ldrh r1, [r0]
                                     lsl r2, r1, #0x1
                                     add r1, r1, r2
                                     lsr r1, r1, #0x2
                                     cmp r1, #0x0
                                     bne NotZero
                                     mov r1, #0x1
                              
                              NotZero:
                                     strh r1, [r0]
                              
                              ExpertBeltCheck:
                                     ldr r0, .UserBank
                                     ldrb r0, [r0]
                                     mul r0, r3
                                     add r1, r0, r4
                                     add r1, #0xE
                                     ldrh r0, [r1]
                                     bl EffectGetter
                                     cmp r0, #0xKK
                              
                                     bne Exit
                                     ldr r4, .Damage
                                     ldrh r0, [r4]
                                     mov r2, #0x6
                                     mul r0, r2
                                     mov r1, #0x5
                                     bl Divider
                                     strh r0, [r4]
                              Exit:
                                     mov r0, sp
                                     ldrb r0, [r0, #0x0]
                              Quit:
                                     add sp, #0x10
                                     pop {r3-r5}
                                     mov r8, r3
                                     mov r9, r4
                                     mov r10, r5
                                     pop {r4-r7}
                                     pop {r1}
                                     bx r1
                              
                              EffectGetter:
                                     ldr r1, =0x0809A925
                                     bx r1
                                    
                              Divider:
                                     ldr r2, =0x081E4019
                                     bx r2
                              
                              .align 2
                              .UserBank: .word 0x02023D6B
                              .TargetBank: .word 0x02023D6C
                              .BattleStruct: .word 0x02023C04
                              .Damage: .word 0x02023D50
                              
                              /* 1EFAC: 00 00 00 00 00 49 08 47 XX+1 XX XX 08*/


                              Emerald:-
                              Spoiler:


                              Routine I:
                              Code:
                              .text
                              .align 2
                              .thumb
                              .thumb_func
                              .global tintedlenssolidrockexpertbelt
                              
                              EffectivnessCheck:
                                     ldrb r1, [r0, #0x0]
                                     mov r0, #0x8
                                     and r0, r1
                                     cmp r0, #0x0
                                     bne NotEffective
                                     
                              MissCheck:
                                     mov r0, #0x31
                                     and r0, r1
                                     cmp r0, #0x0
                                     bne Exit
                              
                              NotVeryEffectiveCheck:       
                                     mov r0, #0x4
                                     and r0, r1
                                     cmp r0, #0x0
                                     beq SuperEffectiveCheck
                                     ldr r0, .UserBank
                                     ldr r1, .BattleStruct
                                     mov r2, #0x58
                                     ldrb r0, [r0]
                                     mul r2, r0
                                     add r1, r1, r2
                                     ldrb r1, [r1]
                                     cmp r1, #0x6F
                                     bne Exit
                              
                              HasTintedLens:
                                     ldr r0, .Damage
                                     ldrh r1, [r0]
                                     lsl r1, r1, #0x1
                                     strh r1, [r0]
                                     b Exit
                              
                              SuperEffectiveCheck:
                                     mov r0, #0x2
                                     and r0, r1
                                     cmp r0, #0x0       
                                     beq Exit
                                     ldr r0, .TargetBank
                                     ldr r4, .BattleStruct
                                     mov r3, #0x58
                                     ldrb r0, [r0]
                                     mul r0, r3
                                     add r1, r0, r4
                                     ldrb r0, [r1]
                                     cmp r0, #0x75
                                     beq HasSolidRock
                                     cmp r0, #0x70
                                     bne ExpertBeltCheck
                              HasSolidRock:
                                     ldr r0, .Damage
                                     ldrh r1, [r0]
                                     lsl r2, r1, #0x1
                                     add r1, r1, r2
                                     lsr r1, r1, #0x2
                                     cmp r1, #0x0
                                     bne NotZero
                                     mov r1, #0x1
                              
                              NotZero:
                                     strh r1, [r0]
                              
                              ExpertBeltCheck:
                                     ldr r0, .UserBank
                                     ldrb r0, [r0]
                                     mul r0, r3
                                     add r1, r0, r4
                                     add r1, #0xE
                                     ldrh r0, [r1]
                                     bl EffectGetter
                                     cmp r0, #0xKK
                                     bne Exit
                                     ldr r4, .Damage
                                     ldrh r0, [r4]
                                     mov r2, #0x6
                                     mul r0, r2
                                     mov r1, #0x5
                                     bl Divider
                                     strh r0, [r4]
                              Exit:
                                     ldr r1, =0x08047261
                                     bx r1
                              
                              NotEffective:
                                     ldr r1, =0x0804724F
                                     bx r1
                              
                              EffectGetter:
                                     ldr r1, =0x080D74DD
                                     bx r1
                                    
                              Divider:
                                     ldr r2, =0x082E7541
                                     bx r2
                              
                              .align 2
                              .UserBank: .word 0x0202420B
                              .TargetBank: .word 0x0202420C
                              .BattleStruct: .word 0x020240A4
                              .Damage: .word 0x020241F0
                              
                              /* 47244: 00 49 08 47 XX+1 XX XX 08 00 00*/
                              Routine II:
                              Code:
                              .text
                              .align 2
                              .thumb
                              .thumb_func
                              .global tintedlenssolidrockexpertbeltai
                              
                              StruggleCheck:
                                     mov r1, r10
                                     cmp r1, #0xA5
                                     beq Quit
                              
                              EffectivnessCheck:
                                     ldrb r1, [r0, #0x0]
                                     mov r0, #0x39
                                     and r0, r1
                                     cmp r0, #0x0
                                     bne Exit
                              
                              NotVeryEffectiveCheck:       
                                     mov r0, #0x4
                                     and r0, r1
                                     cmp r0, #0x0
                                     beq SuperEffectiveCheck
                                     ldr r0, .UserBank
                                     ldr r1, .BattleStruct
                                     mov r2, #0x58
                                     ldrb r0, [r0]
                                     mul r2, r0
                                     add r1, r1, r2
                                     ldrb r1, [r1]
                                     cmp r1, #0x6F
                                     bne Exit
                              
                              HasTintedLens:
                                     ldr r0, .Damage
                                     ldrh r1, [r0]
                                     lsl r1, r1, #0x1
                                     strh r1, [r0]
                                     b Exit
                              
                              SuperEffectiveCheck:
                                     mov r0, #0x2
                                     and r0, r1
                                     cmp r0, #0x0       
                                     beq Exit
                                     ldr r0, .TargetBank
                                     ldr r4, .BattleStruct
                                     mov r3, #0x58
                                     ldrb r0, [r0]
                                     mul r0, r3
                                     add r1, r0, r4
                                     ldrb r0, [r1]
                                     cmp r0, #0x75
                                     beq HasSolidRock
                                     cmp r0, #0x70
                                     bne ExpertBeltCheck
                              HasSolidRock:
                                     ldr r0, .Damage
                                     ldrh r1, [r0]
                                     lsl r2, r1, #0x1
                                     add r1, r1, r2
                                     lsr r1, r1, #0x2
                                     cmp r1, #0x0
                                     bne NotZero
                                     mov r1, #0x1
                              
                              NotZero:
                                     strh r1, [r0]
                              
                              ExpertBeltCheck:
                                     ldr r0, .UserBank
                                     ldrb r0, [r0]
                                     mul r0, r3
                                     add r1, r0, r4
                                     add r1, #0xE
                                     ldrh r0, [r1]
                                     bl EffectGetter
                                     cmp r0, #0xKK
                                     bne Exit
                                     ldr r4, .Damage
                                     ldrh r0, [r4]
                                     mov r2, #0x6
                                     mul r0, r2
                                     mov r1, #0x5
                                     bl Divider
                                     strh r0, [r4]
                              Exit:
                                     mov r0, sp
                                     ldrb r0, [r0, #0x0]
                              Quit:
                                     add sp, #0x10
                                     pop {r3-r5}
                                     mov r8, r3
                                     mov r9, r4
                                     mov r10, r5
                                     pop {r4-r7}
                                     pop {r1}
                                     bx r1
                              
                              EffectGetter:
                                     ldr r1, =0x080D74DD
                                     bx r1
                                    
                              Divider:
                                     ldr r2, =0x082E7541
                                     bx r2
                              
                              .align 2
                              .UserBank: .word 0x0202420B
                              .TargetBank: .word 0x0202420C
                              .BattleStruct: .word 0x020240A4
                              .Damage: .word 0x020241F0
                              
                              /* 4779C: 00 00 00 00 00 49 08 47 XX+1 XX XX 08 00 00*/



                              I have slightly updated Mold Breaker using MrDS's Emerald Ports for this routine. The old routines also work perfectly fine but the new one's are optimized and more understandable.
                              Reply With Quote
                                #66    
                              Old June 9th, 2015 (3:27 AM).
                              MrDollSteak's Avatar
                              MrDollSteak MrDollSteak is offline
                              Formerly known as 11bayerf1
                                 
                                Join Date: Dec 2008
                                Location: Hong Kong
                                Age: 23
                                Gender: Male
                                Posts: 844
                                Quote:
                                Originally Posted by KDS View Post
                                Tinted Lens, Solid Rock, Filter (+ Expert Belt)

                                [SPOILER]

                                Routine I does the actual Damage Manipulation and Routine II makes the AI recognize
                                Damage Modification due to these Abilities.

                                Replace KK with Held Item Effect Byte of Expert Belt.

                                I have slightly updated Mold Breaker using MrDS's Emerald Ports for this routine. The old routines also work perfectly fine but the new one's are optimized and more understandable.
                                Awesome man! I was actually working on this one. Does yours take multitypes into account? I'd actually had it elsewhere and was struggling with that problem.
                                __________________
                                Reply With Quote
                                  #67    
                                Old June 9th, 2015 (3:57 AM).
                                Chacha Dinosaur's Avatar
                                Chacha Dinosaur Chacha Dinosaur is offline
                                Adamant and adaptive dinosaur.
                                   
                                  Join Date: Jul 2013
                                  Age: 24
                                  Gender: Male
                                  Posts: 453
                                  Quote:
                                  Originally Posted by MrDollSteak View Post
                                  Awesome man! I was actually working on this one. Does yours take multitypes into account? I'd actually had it elsewhere and was struggling with that problem.
                                  Yes, it actually checks the outcome 2023DCC first, then manipulates the damage.
                                  Reply With Quote
                                    #68    
                                  Old June 15th, 2015 (10:36 PM). Edited January 21st, 2016 by MrDollSteak.
                                  MrDollSteak's Avatar
                                  MrDollSteak MrDollSteak is offline
                                  Formerly known as 11bayerf1
                                     
                                    Join Date: Dec 2008
                                    Location: Hong Kong
                                    Age: 23
                                    Gender: Male
                                    Posts: 844
                                    I've actually been working on these for awhile (and I'll have to update this post a few times in the future once everything is complete and optimised). They require a few pre-requisites that will be addressed in the relevant spoilers, but here are:

                                    Leaf Guard, Aroma Veil, Flower Veil and Sweet Veil

                                    Spoiler:
                                    Fire Red
                                    Spoiler:
                                    I will update the routines here once I finish updating Emerald

                                    Emerald
                                    Spoiler:
                                    Pre-requisites
                                    Spoiler:
                                    Routine I: Check Target Field BL
                                    Spoiler:
                                    Code:
                                    .text
                                    .align 2
                                    .thumb
                                    .thumb_func
                                    .global checkabilitytargetfieldBL
                                    
                                    #accepts the ability you want to check for in register two. If the target field does not 
                                    #have it register zero will have the value zero, meaning you just need to do a cmp #0x0 bne.
                                    #Alternatively the ability byte will be in both r0 and r2, so you can cmp that way.
                                    
                                    #r0 - BattleType, Target Bank, later Ability Byte
                                    #r1 - Battle Data
                                    #r2 - Ability to check for
                                    
                                    CheckBattleType:
                                    	ldr r0, .BattleType
                                    	ldrb r0, [r0]
                                    	mov r1, #0x1
                                    	and r0, r1
                                    	cmp r0, #0x0
                                    	bne DoubleBattle
                                    SingleBattle:
                                    	ldr r0, .TargetBank
                                    	ldrb r0, [r0]
                                    	mov r1, #0x58
                                    	mul r1, r0
                                    	ldr r0, .BattleData
                                    	add r0, r0, r1
                                    	ldrb r0, [r0]
                                    	b CheckAbility
                                    DoubleBattle:
                                    CheckTargetField:
                                    	ldr r0, .TargetBank
                                    	ldrb r0, [r0]
                                    	mov r1, #0x1
                                    	and r0, r1
                                    	cmp r0, #0x0
                                    	beq CheckFoeTeam
                                    CheckUserTeam:
                                    	mov r0, #0x0
                                    	b DoubleLoop
                                    CheckFoeTeam:
                                    	mov r0, #0x1
                                    CheckFirstSlotAbility:
                                    	mov r1, #0x58
                                    	mul r0, r1
                                    	ldr r1, .BattleData
                                    	add r1, r0, r1
                                    	ldrb r0, [r1]
                                    	cmp r0, r2
                                    	beq Return
                                    	add r1, r1, #0xB0
                                    	ldrb r0, [r1]
                                    CheckAbility:
                                    	cmp r0, r2
                                    	beq Return
                                    AbilityNotPresent:
                                    	mov r0, #0x0
                                    Return:
                                    	bx lr
                                    
                                    .align
                                    .BattleType: .word 0x2022FEC
                                    .TargetBank: .word 0x0202420C
                                    .BattleData: .word 0x20240A4


                                    Routine II: jumpifabilitypresenttargetfield Battle Scripting Command
                                    Spoiler:
                                    Code:
                                    .text
                                    .align 2
                                    .thumb
                                    .thumb_func
                                    .global jumpifabilitypresenttargetfield
                                    
                                    Main:
                                    	push {r4, r14}
                                    	sub sp, #0x4
                                    	ldr r4, .ScriptLoc
                                    	ldr r0, [r4]
                                    LoadAbilityFlag:
                                    	ldrb r2, [r0, #0x1]
                                    	bl CheckTargetField
                                    CheckAbility:
                                    	cmp r0, r2
                                    	beq AbilityPresent
                                    	b AbilityNotPresent
                                    AbilityNotPresent:
                                    	ldr r2, [r4]
                                    	ldrb r1, [r2, #0x2]
                                    	ldrb r0, [r2, #0x3]
                                    	lsl r0, r0, #0x8
                                    	orr r1, r0
                                    	ldrb r0, [r2, #0x4]
                                    	lsl r0, r0, #0x10
                                    	orr r1, r0
                                    	ldrb r0, [r2, #0x5]
                                    	lsl r0, r0, #0x18
                                    	orr r1, r0
                                    	str r1, [r4]
                                    	b Return
                                    AbilityPresent:
                                    	ldr r0, [r4]
                                    	add r0, #0x6
                                    	str r0, [r4]
                                    	add sp, #0x4
                                    Return:
                                    	pop {r4}
                                    	pop {r0}
                                    	bx r0
                                    CheckTargetField:
                                    	ldr r0, .CheckTargetFieldBL
                                    	bx r0
                                    
                                    .align
                                    .ScriptLoc: .word 0x02024214
                                    .CheckTargetFieldBL: .word 0x8XXXXXX
                                    
                                    #CheckTargetFieldBL refers to the routine with that name


                                    What you'll need to do is insert both of these routines into free space.
                                    The first routine is a BL that will be called by most of the other routines here so make note of where you insert it.
                                    The second routine is a BS Command, you'll need to add it to your expanded battle script command table. I'll be using command FB.
                                    Add the following string to Battle Script Pro's 'commands' ini.

                                    #command jumpifabilitypresenttargetfield 0xFB 2 "Ability Byte" 1 "ROM address to jump to if true" 4

                                    This will allow you to correctly check if either of the Pokemon on your target's side of the field has a certain ability.

                                    Battle Scripts
                                    Spoiler:
                                    Make sure you have correctly inserted the pre-requisites. These scripts also update a few mechanics, such as Electric-type Pokemon being immune to Paralysis.

                                    Effect 1: Sleep
                                    Spoiler:
                                    Code:
                                    #include abilities.bsh
                                    
                                    #org @Main
                                    attackcanceler
                                    attackstring
                                    ppreduce
                                    jumpifabilitypresent ABILITY_CLOUDNINE @SafeguardCheck
                                    jumpifabilitypresent ABILITY_AIRLOCK @SafeguardCheck
                                    jumpifhalfword B_& 0x2023F1C 0x60 @LeafGuardCheck
                                    jumpifabilitypresenttargetfield 0xB0 0x82D9F1C
                                    jumpifabilitypresenttargetfield 0xA7 @GrassTypeCheck 
                                    goto @SafeguardCheck
                                    
                                    #org @LeafGuardCheck
                                    jumpifability BANK_TARGET 0x67 0x82DA378
                                    
                                    #org @GrassTypeCheck
                                    jumpiftype BANK_TARGET TYPE_GRASS 0x82D9F1C
                                    
                                    #org @SafeguardCheck
                                    jumpifsecondarystatus BANK_TARGET 0x1000000 0x82D9F1C
                                    jumpifstatus BANK_TARGET 0x7 0x82D8AB0
                                    jumpifcannotsleep 0x82D8ACF
                                    jumpifhalfword 0x0 0x202341A 0x4F @Spore
                                    jumpifhalfword 0x0 0x202341A 0x93 @Spore
                                    goto @Sleep
                                    
                                    #org @Spore
                                    jumpiftype BANK_TARGET TYPE_GRASS 0x82D9F2E
                                    
                                    #org @Sleep
                                    jumpifstatus BANK_TARGET 0xFF 0x82D9F1C
                                    accuracycheck 0x82D9F1C 0x0
                                    jumpifhalverset BANK_TARGET 0x20 0x82DAD01
                                    attackanimation
                                    waitanimation
                                    setbyte 0x2024335 0x1
                                    seteffecttarget
                                    goto 0x82D8A4E
                                    Insert this into free space and replace the pointer for Effect 1 in your Move Effect Table.

                                    Effect 33: Toxic Poison
                                    Spoiler:
                                    Code:
                                    #include abilities.bsh
                                    
                                    #org @Main
                                    attackcanceler
                                    attackstring
                                    ppreduce
                                    jumpifabilitypresent ABILITY_CLOUDNINE @ImmunityCheck
                                    jumpifabilitypresent ABILITY_AIRLOCK @ImmunityCheck
                                    jumpifhalfword B_& 0x2023F1C 0x60 @LeafGuardCheck
                                    jumpifabilitypresenttargetfield 0xA7 @GrassTypeCheck 
                                    goto @ImmunityCheck
                                    
                                    #org @LeafGuardCheck
                                    jumpifability BANK_TARGET 0x67 0x82D8F63
                                    
                                    #org @GrassTypeCheck
                                    jumpiftype BANK_TARGET TYPE_GRASS 0x82D9F1C
                                    
                                    #org @ImmunityCheck
                                    jumpifability BANK_TARGET ABILITY_IMMUNITY 0x82D8F63
                                    jumpifsecondarystatus BANK_TARGET 0x1000000 0x82D9F1C
                                    jumpifstatus BANK_TARGET 0x8 0x82D8F52
                                    jumpifstatus BANK_TARGET 0x80 0x82D8F52
                                    jumpifhalfword 0x0 0x202341A 0x4D @PoisonPowder
                                    goto @Poison
                                    
                                    #org @PoisonPowder
                                    jumpiftype BANK_TARGET TYPE_GRASS 0x82D9F2E
                                    
                                    #org @Poison
                                    jumpiftype BANK_TARGET TYPE_POISON 0x82D9F2E
                                    jumpiftype BANK_TARGET TYPE_STEEL 0x82D9F2E
                                    jumpifstatus BANK_TARGET 0xFF 0x82D9F1C
                                    accuracycheck 0x82D9F1C 0x0
                                    jumpifhalverset BANK_TARGET 0x20 0x82DAD01
                                    attackanimation
                                    waitanimation
                                    setbyte 0x2024335 0x6
                                    seteffecttarget
                                    resultmessage
                                    waitmessage DELAY_1SECOND
                                    goto 0x82D8A4E
                                    Insert this into free space and replace the pointer for Effect 33 in your Move Effect Table.

                                    Effect 66: Poison
                                    Spoiler:
                                    Code:
                                    #include abilities.bsh
                                    
                                    #org @Main
                                    attackcanceler
                                    attackstring
                                    ppreduce
                                    jumpifabilitypresent ABILITY_CLOUDNINE @ImmunityCheck
                                    jumpifabilitypresent ABILITY_AIRLOCK @ImmunityCheck
                                    jumpifhalfword B_& 0x2023F1C 0x60 @LeafGuardCheck
                                    jumpifabilitypresenttargetfield 0xA7 @GrassTypeCheck
                                    goto @ImmunityCheck
                                    
                                    #org @LeafGuardCheck
                                    jumpifability BANK_TARGET 0x67 0x82D8F63
                                    
                                    #org @GrassTypeCheck
                                    jumpiftype BANK_TARGET TYPE_GRASS 0x82D9F1C
                                    
                                    #org @ImmunityCheck
                                    jumpifability BANK_TARGET ABILITY_IMMUNITY 0x82D8F63
                                    jumpifsecondarystatus BANK_TARGET 0x1000000 0x82D9F1C
                                    jumpifstatus BANK_TARGET 0x8 0x82D8F52
                                    jumpifstatus BANK_TARGET 0x80 0x82D8F52
                                    jumpifhalfword 0x0 0x202341A 0x4D @PoisonPowder
                                    goto @Poison
                                    
                                    #org @PoisonPowder
                                    jumpiftype BANK_TARGET TYPE_GRASS 0x82D9F2E
                                    
                                    #org @Poison
                                    jumpiftype BANK_TARGET TYPE_POISON 0x82D9F2E
                                    jumpiftype BANK_TARGET TYPE_STEEL 0x82D9F2E
                                    jumpifstatus BANK_TARGET 0xFF 0x82D9F1C
                                    accuracycheck 0x82D9F1C 0x0
                                    jumpifhalverset BANK_TARGET 0x20 0x82DAD01
                                    attackanimation
                                    waitanimation
                                    setbyte 0x2024335 0x2
                                    seteffecttarget
                                    resultmessage
                                    waitmessage DELAY_1SECOND
                                    goto 0x82D8A4E
                                    Insert this into free space and replace the pointer for Effect 66 in your Move Effect Table.

                                    Effect 67: Paralysis
                                    Spoiler:
                                    Code:
                                    #include abilities.bsh
                                    
                                    #org @Main
                                    attackcanceler
                                    attackstring
                                    ppreduce
                                    jumpifabilitypresent ABILITY_CLOUDNINE @LimberCheck
                                    jumpifabilitypresent ABILITY_AIRLOCK @LimberCheck
                                    jumpifhalfword B_& 0x2023F1C 0x60 @LeafGuardCheck
                                    jumpifabilitypresenttargetfield 0xA7 @GrassTypeCheck
                                    goto @LimberCheck
                                    
                                    #org @LeafGuardCheck
                                    jumpifability BANK_TARGET 0x67 0x82D9362
                                    
                                    #org @GrassTypeCheck
                                    jumpiftype BANK_TARGET TYPE_GRASS 0x82D9F1C
                                    
                                    #org @LimberCheck
                                    jumpifability BANK_TARGET ABILITY_LIMBER 0x82D9362
                                    jumpifhalfword 0x0 0x202341A 0x4E @StunSpore
                                    goto @Paralyze
                                    
                                    #org @StunSpore
                                    jumpiftype BANK_TARGET TYPE_GRASS 0x82D9F2E
                                    
                                    #org @Paralyze
                                    jumpiftype BANK_TARGET TYPE_ELECTRIC 0x82D9F2E
                                    jumpifsecondarystatus BANK_TARGET 0x1000000 0x82D9F1C
                                    cmd6
                                    jumpifbyte B_& 0x202427C 0x29 0x82D9F1C
                                    jumpifstatus BANK_TARGET 0x40 0x82D9351
                                    jumpifstatus BANK_TARGET 0xFF 0x82D9F1C
                                    accuracycheck 0x82D9F1C 0x0
                                    jumpifhalverset BANK_TARGET 0x20 0x82DAD01
                                    attackanimation
                                    waitanimation
                                    setbyte 0x2024335 0x5
                                    seteffecttarget
                                    resultmessage
                                    waitmessage DELAY_1SECOND
                                    goto 0x82D8A4E
                                    Insert this into free space and replace the pointer for Effect 67 in your Move Effect Table.

                                    Effect 86: Disable
                                    Spoiler:
                                    #org @Main
                                    attackcanceler
                                    attackstring
                                    ppreduce
                                    jumpifabilitypresenttargetfield 0xA6 0x82D9F1C
                                    accuracycheck 0x82D9F1C 0x0
                                    disablelastusedattack 0x82D9F1C
                                    attackanimation
                                    waitanimation
                                    printstring 0x84
                                    waitmessage DELAY_1SECOND
                                    goto 0x82D8A4E

                                    Effect 90: Encore
                                    Spoiler:
                                    #org @Main
                                    attackcanceler
                                    accuracycheck 0x82D8A5E 0x0
                                    attackstring
                                    ppreduce
                                    jumpifabilitypresenttargetfield 0xA6 0x82D9F1C
                                    setencore 0x82D9F1C
                                    attackanimation
                                    waitanimation
                                    printstring 0x87
                                    waitmessage DELAY_1SECOND
                                    goto 0x82D8A4E

                                    Effect 120: Attract
                                    Spoiler:
                                    #org @Main
                                    attackcanceler
                                    attackstring
                                    ppreduce
                                    jumpifabilitypresenttargetfield 0xA6 0x82D9F1C
                                    accuracycheck 0x82D9F1C 0x0
                                    tryinfatuatetarget 0x82D9F1C
                                    attackanimation
                                    waitanimation
                                    printstring 0x45
                                    waitmessage DELAY_1SECOND
                                    goto 0x82D8A4E

                                    Effect 165: Torment
                                    Spoiler:
                                    #org @Main
                                    attackcanceler
                                    attackstring
                                    ppreduce
                                    jumpifabilitypresenttargetfield 0xA6 0x82D9F1C
                                    accuracycheck 0x82D9F1C 0x0
                                    settorment 0x82D9F1C
                                    attackanimation
                                    waitanimation
                                    printstring 0xA9
                                    waitmessage DELAY_1SECOND
                                    goto 0x82D8A4E

                                    Effect 167: Burn
                                    Spoiler:
                                    Code:
                                    #include abilities.bsh
                                    
                                    #org @Main
                                    attackcanceler
                                    attackstring
                                    ppreduce
                                    jumpifabilitypresent ABILITY_CLOUDNINE @WaterVeilCheck
                                    jumpifabilitypresent ABILITY_AIRLOCK @WaterVeilCheck
                                    jumpifhalfword B_& 0x2023F1C 0x60 @LeafGuardCheck
                                    jumpifabilitypresenttargetfield 0xA7 @GrassTypeCheck
                                    goto @WaterVeilCheck
                                    
                                    #org @LeafGuardCheck
                                    jumpifability BANK_TARGET 0x67 0x82DA0A1
                                    
                                    #org @GrassTypeCheck
                                    jumpiftype BANK_TARGET TYPE_GRASS 0x82D9F1C
                                    
                                    #org @WaterVeilCheck
                                    jumpifability BANK_TARGET ABILITY_WATERVEIL 0x82DA0A1
                                    jumpifsecondarystatus BANK_TARGET 0x1000000 0x82D9F1C
                                    jumpifstatus BANK_TARGET 0x10 0x82DA0BB
                                    jumpiftype BANK_TARGET TYPE_FIRE 0x82D9F2E
                                    jumpifstatus BANK_TARGET 0xFF 0x82D9F1C
                                    accuracycheck 0x82D9F1C 0x0
                                    jumpifhalverset BANK_TARGET 0x20 0x82DAD01
                                    attackanimation	
                                    waitanimation
                                    setbyte 0x2024335 0x3
                                    seteffecttarget
                                    goto 0x82D8A4E
                                    Insert this into free space and replace the pointer for Effect 167 in your Move Effect Table.

                                    Effect 175: Taunt
                                    Spoiler:
                                    #include abilities.bsh

                                    #org @Main
                                    attackcanceler
                                    attackstring
                                    ppreduce
                                    jumpifabilitypresenttargetfield 0xA6 0x82D9F1C
                                    jumpifability BANK_TARGET ABILITY_OBLIVIOUS 0x82D9F1C
                                    accuracycheck 0x82D9F1C 0x0
                                    settaunt 0x82D9F1C
                                    attackanimation
                                    waitanimation
                                    printstring 0xAC
                                    waitmessage DELAY_1SECOND
                                    goto 0x82D8A4E

                                    Effect 187: Yawn
                                    Spoiler:
                                    Code:
                                    #include abilities.bsh
                                    
                                    #org @Main
                                    attackcanceler
                                    attackstring
                                    ppreduce
                                    jumpifabilitypresent ABILITY_CLOUDNINE @AbilityCheck
                                    jumpifabilitypresent ABILITY_AIRLOCK @AbilityCheck
                                    jumpifhalfword B_& 0x2023F1C 0x60 @LeafGuardCheck
                                    jumpifabilitypresenttargetfield 0xB0 0x82D9F1C
                                    jumpifabilitypresenttargetfield 0xA7 @GrassTypeCheck
                                    goto @AbilityCheck
                                    
                                    #org @LeafGuardCheck
                                    jumpifability BANK_TARGET 0x67 0x82DA378
                                    
                                    #org @GrassTypeCheck
                                    jumpiftype BANK_TARGET TYPE_GRASS 0x82D9F1C
                                    
                                    #org @AbilityCheck
                                    jumpifability BANK_TARGET ABILITY_VITALSPIRIT 0x82DA378
                                    jumpifability BANK_TARGET ABILITY_INSOMNIA 0x82DA378
                                    jumpifsecondarystatus BANK_TARGET 0x1000000 0x82D9F1C
                                    jumpifhalverset BANK_TARGET 0x20 0x82DAD01
                                    accuracycheck 0x82D9F1C 0xFFFF
                                    jumpifcannotsleep 0x82D9F1C
                                    setyawn 0x82D9F1C
                                    attackanimation
                                    waitanimation
                                    printstring 0xB6	
                                    waitmessage DELAY_1SECOND
                                    goto 0x82D8A4E
                                    Insert this into free space and replace the pointer for Effect 187 in your Move Effect Table.

                                    I might update these to add a custom message for Aroma Veil, Sweet Veil and Flower Veil. Though at this stage I'm unsure of exactly how the messages are phrased in Gen VI, so I've made it so they will currently say 'But it Failed'.

                                    Routines
                                    Spoiler:
                                    Routine I: Prevent Sleep
                                    Spoiler:
                                    Code:
                                    .text
                                    .align 2
                                    .thumb
                                    .thumb_func
                                    .global preventsleep
                                    
                                    BufferTarget:
                                    	mov r4, r8
                                    	add r0, r1, r4
                                    	add r0, #0x20
                                    	ldrb r0, [r0]
                                    SweetVeilCheck:
                                    	push {r0-r2}
                                    	mov r2, #0xB0
                                    	bl CheckTargetField
                                    	cmp r0, #0x0
                                    	beq BufferType
                                    SweetVeil:
                                    	pop {r0-r2}
                                    	b PreventSleep
                                    BufferType:
                                    	pop {r0-r2}
                                    	push {r0-r2}
                                    	ldrb r1, [r0, #0x1]
                                    	ldrb r2, [r0, #0x2]
                                    CheckPrimaryTypeGrass:
                                    	cmp r1, #0xC
                                    	beq FlowerVeilCheck
                                    CheckSecondaryTypeGrass:
                                    	cmp r2, #0xC
                                    	bne LeafGuardCheck
                                    FlowerVeilCheck:
                                    	mov r2, #0xA7
                                    	bl CheckTargetField
                                    	cmp r0, #0x0
                                    	beq LeafGuardCheck
                                    FlowerVeil:
                                    	pop {r0-r2}
                                    	b PreventSleep
                                    LeafGuardCheck:
                                    	pop {r0-r2}
                                    	ldrb r0, [r0]
                                    	cmp r0, #0x67
                                    	bne VitalSpiritCheck
                                    Leafguard:
                                    	push {r0-r4}
                                    CheckCloudNine:
                                    	mov r0, #0x13
                                    	mov r1, #0x0
                                    	mov r2, #0xD
                                    	mov r3, #0x0
                                    	bl CheckField
                                    	cmp r0, #0x0
                                    	bne NoWeather
                                    CheckAirLock:
                                    	mov r0, #0x13
                                    	mov r1, #0x0
                                    	mov r2, #0x4D
                                    	mov r3, #0x0
                                    	bne NoWeather
                                    CheckWeather:
                                    	ldr r0, .WeatherAddr
                                    	ldrh r0, [r0, #0x0]
                                    	mov r1, #0x60
                                    	and r0, r0, r1
                                    	cmp r0, #0x0
                                    	beq NoWeather
                                    	pop {r0-r4}
                                    	b PreventSleep
                                    NoWeather:
                                    	pop {r0-r4}
                                    	b VitalSpiritCheck
                                    PreventSleep:
                                    	ldr r1, .Return
                                    	bx r1
                                    VitalSpiritCheck:
                                    	ldr r1, .Return2
                                    	bx r1
                                    CheckTargetField:
                                    	ldr r0, .CheckTargetFieldBL
                                    	bx r0
                                    FieldCheck:
                                    	ldr r4, .CheckFieldBL
                                    	bx r4
                                    
                                    .align 2
                                    .WeatherAddr:  .word 0x020243CC
                                    .Return: .word 0x08048DF5
                                    .Return2: .word 0x080489E5
                                    .CheckTargetFieldBL: .word 0x8XXXXXX
                                    .CheckFieldBL: .word 0x08042829
                                    
                                    #insert 00 4C 20 47 xx xx xx 08 at 489DC
                                    XXXXXX is the location where you inserted CheckTargetFieldBL+1
                                    and xx xx xx is a pointer to the offset of this routine +1

                                    Routine II: Prevent Poison
                                    Spoiler:
                                    Code:
                                    .text
                                    .align 2
                                    .thumb
                                    .thumb_func
                                    .global preventpoison
                                    
                                    ImmunityCheck:
                                    	ldrb r1, [r0]
                                    	cmp r1, #0x11
                                    	bne LeafGuardCheck
                                    Immunity:
                                    	cmp r5, #0x1
                                    	beq PreventPoison
                                    	cmp r6, #0x80
                                    	beq PreventPoison
                                    LeafGuardCheck:
                                    	cmp r1, #0x67
                                    	bne BufferType
                                    Leafguard:
                                    	push {r0-r4}
                                    CheckCloudNine:
                                    	mov r0, #0x13
                                    	mov r1, #0x0
                                    	mov r2, #0xD
                                    	mov r3, #0x0
                                    	bl CheckField
                                    	cmp r0, #0x0
                                    	bne NoWeather
                                    CheckAirLock:
                                    	mov r0, #0x13
                                    	mov r1, #0x0
                                    	mov r2, #0x4D
                                    	mov r3, #0x0
                                    	bne NoWeather
                                    CheckWeather:
                                    	ldr r0, .WeatherAddr
                                    	ldrh r0, [r0, #0x0]
                                    	mov r1, #0x60
                                    	and r0, r0, r1
                                    	cmp r0, #0x0
                                    	beq NoWeather
                                    	pop {r0-r4}
                                    	b PreventPoison
                                    NoWeather:
                                    	pop {r0-r4}
                                    BufferType:
                                    	push {r0-r2}
                                    	ldrb r1, [r0, #0x1]
                                    	ldrb r2, [r0, #0x2]
                                    CheckPrimaryTypeGrass:
                                    	cmp r1, #0xC
                                    	beq FlowerVeilCheck
                                    CheckSecondaryTypeGrass:
                                    	cmp r2, #0xC
                                    	bne Return
                                    FlowerVeilCheck:
                                    	mov r2, #0xA7
                                    	bl CheckTargetField
                                    	cmp r0, #0x0
                                    	beq Return
                                    FlowerVeil:
                                    	pop {r0-r2}
                                    PreventPoison:
                                    	ldr r0, .Return
                                    	bx r0
                                    Return:
                                    	pop {r0-r2}
                                    	ldr r2, .Return2
                                    	bx r2
                                    FieldCheck:
                                    	ldr r4, .CheckFieldBL
                                    	bx r4
                                    CheckTargetField:
                                    	ldr r0, .CheckTargetFieldBL
                                    	bx r0
                                    
                                    .align 2
                                    .WeatherAddr:  .word 0x020243CC
                                    .Return: .word 0x08048A1B
                                    .Return2: .word 0x08048A71
                                    .CheckFieldBL: .word 0x08042829
                                    .CheckTargetFieldBL: .word 0x8XXXXXX
                                    
                                    #insert 00 49 08 47 xx xx xx 08 at 48A0C
                                    XXXXXX is the location where you inserted CheckTargetFieldBL+1
                                    and xx xx xx is a pointer to the offset of this routine +1

                                    Routine III: Prevent Burn
                                    Spoiler:
                                    Code:
                                    .text
                                    .align 2
                                    .thumb
                                    .thumb_func
                                    .global preventburn
                                    
                                    WaterVeilCheck:
                                    	ldrb r1, [r0]
                                    	cmp r1, #0x29
                                    	bne LeafGuardCheck
                                    WaterVeil:
                                    	cmp r5, #0x1
                                    	beq PreventBurn
                                    	cmp r6, #0x80
                                    	beq PreventBurn
                                    LeafGuardCheck:
                                    	cmp r1, #0x67
                                    	bne BufferType
                                    Leafguard:
                                    	push {r0-r4}
                                    CheckCloudNine:
                                    	mov r0, #0x13
                                    	mov r1, #0x0
                                    	mov r2, #0xD
                                    	mov r3, #0x0
                                    	bl CheckField
                                    	cmp r0, #0x0
                                    	bne NoWeather
                                    CheckAirLock:
                                    	mov r0, #0x13
                                    	mov r1, #0x0
                                    	mov r2, #0x4D
                                    	mov r3, #0x0
                                    	bne NoWeather
                                    CheckWeather:
                                    	ldr r0, .WeatherAddr
                                    	ldrh r0, [r0, #0x0]
                                    	mov r1, #0x60
                                    	and r0, r0, r1
                                    	cmp r0, #0x0
                                    	beq NoWeather
                                    	pop {r0-r4}
                                    	b PreventBurn
                                    NoWeather:
                                    	pop {r0-r4}
                                    BufferType:
                                    	push {r0-r2}
                                    	ldrb r1, [r0, #0x1]
                                    	ldrb r2, [r0, #0x2]
                                    CheckPrimaryTypeGrass:
                                    	cmp r1, #0xC
                                    	beq FlowerVeilCheck
                                    CheckSecondaryTypeGrass:
                                    	cmp r2, #0xC
                                    	bne Return
                                    FlowerVeilCheck:
                                    	mov r2, #0xA7
                                    	bl CheckTargetField
                                    	cmp r0, #0x0
                                    	beq Return
                                    FlowerVeil:
                                    	pop {r0-r2}
                                    PreventBurn:
                                    	ldr r0, .Return
                                    	bx r0
                                    Return:
                                    	pop {r0-r2}
                                    	ldr r2, .Return2
                                    	bx r2
                                    FieldCheck:
                                    	ldr r4, .CheckFieldBL
                                    	bx r4
                                    CheckTargetField:
                                    	ldr r0, .CheckTargetFieldBL
                                    	bx r0
                                    
                                    .align 2
                                    .WeatherAddr:  .word 0x020243CC
                                    .Return: .word 0x08048B17
                                    .Return2: .word 0x08048B55
                                    .CheckFieldBL: .word 0x08042829
                                    .CheckTargetFieldBL: .word 0x8XXXXXX
                                    
                                    #insert 00 49 08 47 xx xx xx 08 at 48B08

                                    Routine IV: Prevent Paralysis
                                    Spoiler:
                                    Code:
                                    .text
                                    .align 2
                                    .thumb
                                    .thumb_func
                                    .global preventparalysis
                                    
                                    LimberCheck:
                                    	add r0, #0x20
                                    	ldrb r2, [r0]
                                    	cmp r2, #0x7
                                    	bne LeafGuardCheck
                                    Limber:
                                    	cmp r5, #0x1
                                    	beq PreventParalysis
                                    	cmp r6, #0x80
                                    	beq PreventParalysis
                                    LeafGuardCheck:
                                    	cmp r2, #0x67
                                    	bne BufferType
                                    Leafguard:
                                    	push {r0-r4}
                                    CheckCloudNine:
                                    	mov r0, #0x13
                                    	mov r1, #0x0
                                    	mov r2, #0xD
                                    	mov r3, #0x0
                                    	bl CheckField
                                    	cmp r0, #0x0
                                    	bne NoWeather
                                    CheckAirLock:
                                    	mov r0, #0x13
                                    	mov r1, #0x0
                                    	mov r2, #0x4D
                                    	mov r3, #0x0
                                    	bne NoWeather
                                    CheckWeather:
                                    	ldr r0, .WeatherAddr
                                    	ldrh r0, [r0, #0x0]
                                    	mov r1, #0x60
                                    	and r0, r0, r1
                                    	cmp r0, #0x0
                                    	beq NoWeather
                                    	pop {r0-r4}
                                    	b PreventBurn
                                    NoWeather:
                                    	pop {r0-r4}
                                    BufferType:
                                    	push {r0-r2}
                                    	ldrb r1, [r0, #0x1]
                                    	ldrb r2, [r0, #0x2]
                                    CheckPrimaryTypeElectric:
                                    	cmp r1, #0xD
                                    	beq PreventParalysis
                                    CheckSecondaryTypeElectric:
                                    	cmp r1, #0xD
                                    	beq PreventParalysis
                                    CheckPrimaryTypeGrass:
                                    	cmp r1, #0xC
                                    	beq FlowerVeilCheck
                                    CheckSecondaryTypeGrass:
                                    	cmp r2, #0xC
                                    	bne Return
                                    FlowerVeilCheck:
                                    	mov r2, #0xA7
                                    	bl CheckTargetField
                                    	cmp r0, #0x0
                                    	beq Return
                                    FlowerVeil:
                                    	pop {r0-r2}
                                    PreventParalysis:
                                    	ldr r0, .Return
                                    	bx r0
                                    Return:
                                    	pop {r0-r2}
                                    	ldr r1, .Return2
                                    	bx r1
                                    FieldCheck:
                                    	ldr r4, .CheckFieldBL
                                    	bx r4
                                    CheckTargetField:
                                    	ldr r0, .CheckTargetFieldBL
                                    	bx r0
                                    
                                    .align 2
                                    .WeatherAddr:  .word 0x020243CC
                                    .Return: .word 0x08048CA3
                                    .Return2: .word 0x08048DF5
                                    .CheckFieldBL: .word 0x08042829
                                    .CheckTargetFieldBL: .word 0x8XXXXXX
                                    
                                    #insert 00 4A 10 47 xx xx xx 08 at 48C90

                                    Routine V: Prevent Freeze
                                    Spoiler:
                                    Code:
                                    .text
                                    .align 2
                                    .thumb
                                    .thumb_func
                                    .global preventfreeze
                                    
                                    BufferType:
                                    	mov r0, r1
                                    	add r0, #0x21
                                    	push {r0-r2}
                                    	ldrb r1, [r0, #0x0]
                                    	ldrb r2, [r0, #0x1]
                                    CheckPrimaryTypeIce:
                                    	cmp r1, #0xF
                                    	beq PreventFreeze
                                    CheckSecondaryTypeIce:
                                    	cmp r2, #0xF
                                    	beq PreventFreeze
                                    CheckPrimaryTypeGrass:
                                    	cmp r1, #0xC
                                    	beq FlowerVeilCheck
                                    CheckSecondaryTypeGrass:
                                    	cmp r2, #0xC
                                    	bne Return
                                    FlowerVeilCheck:
                                    	mov r2, #0xA7
                                    	bl CheckTargetField
                                    	cmp r0, #0x0
                                    	beq Return
                                    PreventFreeze:
                                    	pop {r0-r2}
                                    	ldr r1, .Return
                                    	bx r1
                                    Return:
                                    	pop {r0-r2}
                                    	ldr r0, .Return2
                                    	bx r0
                                    CheckTargetField:
                                    	ldr r0, .CheckTargetFieldBL
                                    	bx r0
                                    
                                    .align 2
                                    .Return: .word 0x08048DF5
                                    .Return2: .word 0x08048C4D
                                    .CheckTargetFieldBL: .word 0x8XXXXXX
                                    
                                    #insert 00 48 00 47 xx xx xx 08 at 48C34

                                    Routine VI: Prevent Toxic Poison
                                    Spoiler:
                                    Code:
                                    .text
                                    .align 2
                                    .thumb
                                    .thumb_func
                                    .global preventtoxicpoison
                                    
                                    ImmunityCheck:
                                    	add r0, #0x20
                                    	ldrb r1, [r0]
                                    	cmp r1, #0x11
                                    	bne LeafGuardCheck
                                    Immunity:
                                    	cmp r5, #0x1
                                    	beq PreventPoison
                                    	cmp r6, #0x80
                                    	beq PreventPoison
                                    LeafGuardCheck:
                                    	cmp r1, #0x67
                                    	bne BufferType
                                    Leafguard:
                                    	push {r0-r4}
                                    CheckCloudNine:
                                    	mov r0, #0x13
                                    	mov r1, #0x0
                                    	mov r2, #0xD
                                    	mov r3, #0x0
                                    	bl CheckField
                                    	cmp r0, #0x0
                                    	bne NoWeather
                                    CheckAirLock:
                                    	mov r0, #0x13
                                    	mov r1, #0x0
                                    	mov r2, #0x4D
                                    	mov r3, #0x0
                                    	bne NoWeather
                                    CheckWeather:
                                    	ldr r0, .WeatherAddr
                                    	ldrh r0, [r0, #0x0]
                                    	mov r1, #0x60
                                    	and r0, r0, r1
                                    	cmp r0, #0x0
                                    	beq NoWeather
                                    	pop {r0-r4}
                                    	b PreventPoison
                                    NoWeather:
                                    	pop {r0-r4}
                                    BufferType:
                                    	push {r0-r2}
                                    	ldrb r1, [r0, #0x1]
                                    	ldrb r2, [r0, #0x2]
                                    CheckPrimaryTypeGrass:
                                    	cmp r1, #0xC
                                    	beq FlowerVeilCheck
                                    CheckSecondaryTypeGrass:
                                    	cmp r2, #0xC
                                    	bne Return
                                    FlowerVeilCheck:
                                    	mov r2, #0xA7
                                    	bl CheckTargetField
                                    	cmp r0, #0x0
                                    	beq Return
                                    FlowerVeil:
                                    	pop {r0-r2}
                                    PreventPoison:
                                    	ldr r0, .Return
                                    	bx r0
                                    Return:
                                    	pop {r0-r2}
                                    	ldr r2, .Return2
                                    	bx r2
                                    FieldCheck:
                                    	ldr r4, .CheckFieldBL
                                    	bx r4
                                    CheckTargetField:
                                    	ldr r0, .CheckTargetFieldBL
                                    	bx r0
                                    
                                    .align 2
                                    .WeatherAddr:  .word 0x020243CC
                                    .Return: .word 0x08048A1B
                                    .Return2: .word 0x08048D2D
                                    .CheckFieldBL: .word 0x08042829
                                    .CheckTargetFieldBL: .word 0x8XXXXXX
                                    
                                    #insert 00 49 08 47 xx xx xx 08 at 48D0C
                                    XXXXXX is the location where you inserted CheckTargetFieldBL+1
                                    and xx xx xx is a pointer to the offset of this routine +1

                                    Routine VII: Prevent Stat Drops
                                    Spoiler:
                                    Code:
                                    .text
                                    .align 2
                                    .thumb
                                    .thumb_func
                                    .global flowerveil
                                     
                                    BufferType:
                                    	mov r10, r2
                                    FlowerVeilCheck:
                                    	push {r0}
                                    	mov r2, #0xA7
                                    	bl CheckTargetField
                                    	cmp r0, #0x0
                                    	beq PreventAllStatChangeChecks
                                    FlowerVeil:
                                    	pop {r0}
                                    	ldrb r1, [r0, #0x1]
                                    	ldrb r2, [r0, #0x2]
                                    CheckPrimaryTypeGrass:
                                    	cmp r1, #0xC
                                    	beq ClearBody
                                    CheckSecondaryTypeGrass:
                                    	cmp r2, #0xC
                                    	bne ClearBodyCheck
                                    	b ClearBody
                                    PreventAllStatChangeChecks:
                                    	pop {r0}
                                    ClearBodyCheck:
                                    	ldrb r0, [r0]
                                    	cmp r0, #0x1D
                                    	beq ClearBody
                                    WhiteSmokeCheck:
                                    	cmp r0, #0x49
                                    	bne OtherChecks
                                    ClearBody:
                                    	ldr r0, .Return
                                    	bx r0
                                    OtherChecks:
                                    	ldr r1, .Return2
                                    	bx r1
                                    CheckTargetField:
                                    	ldr r0, .CheckTargetFieldBL
                                    	bx r0
                                    
                                    .align 2
                                    .Return: .word 0x08050B95
                                    .Return2: .word 0x08050C2D
                                    .CheckTargetFieldBL: .word 0x8XXXXXX
                                    
                                    #insert 00 4C 20 47 xx xx xx 08 at 50B88
                                    XXXXXX is the location where you inserted CheckTargetFieldBL+1
                                    and xx xx xx is a pointer to the offset of this routine +1
                                    __________________
                                    Reply With Quote
                                      #69    
                                    Old June 21st, 2015 (8:22 AM).
                                    Chacha Dinosaur's Avatar
                                    Chacha Dinosaur Chacha Dinosaur is offline
                                    Adamant and adaptive dinosaur.
                                       
                                      Join Date: Jul 2013
                                      Age: 24
                                      Gender: Male
                                      Posts: 453
                                      Quote:
                                      Originally Posted by Sky High View Post
                                      I dunno if this bug exists on you but when anyone gets a super effective damage, the player's exp gain is only at the second one in the party (if you're alone, you don't gain exp).
                                      I don't think this has to do anything with the ability. I have not tested the Emerald ones though.
                                      Reply With Quote
                                        #70    
                                      Old June 21st, 2015 (9:57 AM).
                                      Starmytes's Avatar
                                      Starmytes Starmytes is offline
                                      Fabulous Fruit
                                         
                                        Join Date: May 2015
                                        Location: Canada
                                        Gender: Female
                                        Nature: Modest
                                        Posts: 21
                                        Is there a way to create new ability effects without using a battle script editor?

                                        /can you do the same steps for adding new move effects without replacing old ones?
                                        1. Copy a table of data into free space (ability effects table?)
                                        2. Repoint
                                        3. At the end of the effects table 'after the last effect and before the code that ends the table' add your new pointer(s) where your new effect(s) would be.
                                        4. At those pointers add your hex coding for the new ability effects.
                                        5. Change the ini of the program you'll be using so you can apply your effects etc

                                        If there is a way to do this it would be great, I have a basic understanding of hex coding. Would anyone have a tutorial on hex coding ability effects?
                                        I only want to add the abilities Refrigerate and Strong Jaw. (maybe Snow Warning also)
                                        __________________
                                        PerfectPokemon<3



                                        Reply With Quote
                                          #71    
                                        Old June 21st, 2015 (1:16 PM).
                                        kleenexfeu kleenexfeu is offline
                                           
                                          Join Date: Aug 2013
                                          Gender: Male
                                          Posts: 216
                                          Quote:
                                          Originally Posted by Starmytes View Post
                                          Is there a way to create new ability effects without using a battle script editor?

                                          /can you do the same steps for adding new move effects without replacing old ones?
                                          1. Copy a table of data into free space (ability effects table?)
                                          2. Repoint
                                          3. At the end of the effects table 'after the last effect and before the code that ends the table' add your new pointer(s) where your new effect(s) would be.
                                          4. At those pointers add your hex coding for the new ability effects.
                                          5. Change the ini of the program you'll be using so you can apply your effects etc

                                          If there is a way to do this it would be great, I have a basic understanding of hex coding. Would anyone have a tutorial on hex coding ability effects?
                                          I only want to add the abilities Refrigerate and Strong Jaw. (maybe Snow Warning also)
                                          Actually most of the abilities are done with ASM rather than battle script.

                                          There's no "table effect of abilities". Basically, you can see abilities like that :

                                          There's a lonng a complicated routine in the rom (several routines actually), that handle how the battles work.
                                          Calculate damage, buffering stats, switch, display something, gain exp, whiteout... etc

                                          It's code mostly in a language called "ASM" for assembler(bly?).

                                          Imagine the code :
                                          Spoiler:

                                          code
                                          code
                                          code
                                          ...
                                          ...
                                          ...
                                          ...
                                          Checkforsomething. Exemple : Check the ability of the user, if it's technician, check the base power of the move used, if it's equal or less than 60, boost it by 1.5
                                          ...
                                          ...
                                          ...
                                          AnotherCheckForSomethingElse


                                          And that's how it works most of the time. We're actually using that big code, and alter it to add new effects, that's why there's no easier way to do that.

                                          If you still have question you can read some ASM tutorial, this one is very useful.
                                          Reply With Quote
                                            #72    
                                          Old June 22nd, 2015 (5:54 AM).
                                          Starmytes's Avatar
                                          Starmytes Starmytes is offline
                                          Fabulous Fruit
                                             
                                            Join Date: May 2015
                                            Location: Canada
                                            Gender: Female
                                            Nature: Modest
                                            Posts: 21
                                            Quote:
                                            Originally Posted by kleenexfeu View Post
                                            Actually most of the abilities are done with ASM rather than battle script.

                                            There's no "table effect of abilities". Basically, you can see abilities like that :

                                            There's a lonng a complicated routine in the rom (several routines actually), that handle how the battles work.
                                            Calculate damage, buffering stats, switch, display something, gain exp, whiteout... etc

                                            It's code mostly in a language called "ASM" for assembler(bly?).

                                            Imagine the code :
                                            Spoiler:

                                            code
                                            code
                                            code
                                            ...
                                            ...
                                            ...
                                            ...
                                            Checkforsomething. Exemple : Check the ability of the user, if it's technician, check the base power of the move used, if it's equal or less than 60, boost it by 1.5
                                            ...
                                            ...
                                            ...
                                            AnotherCheckForSomethingElse


                                            And that's how it works most of the time. We're actually using that big code, and alter it to add new effects, that's why there's no easier way to do that.

                                            If you still have question you can read some ASM tutorial, this one is very useful.
                                            Ah thank you very much, this all makes more sense now xD
                                            I'll begin reading this tutorial <3
                                            __________________
                                            PerfectPokemon<3



                                            Reply With Quote
                                              #73    
                                            Old June 22nd, 2015 (4:27 PM).
                                            MrDollSteak's Avatar
                                            MrDollSteak MrDollSteak is offline
                                            Formerly known as 11bayerf1
                                               
                                              Join Date: Dec 2008
                                              Location: Hong Kong
                                              Age: 23
                                              Gender: Male
                                              Posts: 844
                                              Quote:
                                              Originally Posted by Starmytes View Post
                                              Ah thank you very much, this all makes more sense now xD
                                              I'll begin reading this tutorial <3
                                              I will actually be including all the abilities you want in the future, though I can't say when.

                                              As Kleenex said, there is no effects table, just the move names and descriptions which Sky High has written a tutorial about (linked in the first post).

                                              But you will need a Battle Script Editor (get BSP), a Hex Editor, and some sort of Ability Name and Description editor if you aren't comfortable in writing names and descriptions in Hex.

                                              Reserving this post for the absorb Type damage abilities such as Dry Skin, Sap Sipper etc.
                                              __________________
                                              Reply With Quote
                                                #74    
                                              Old June 23rd, 2015 (2:37 AM).
                                              FamiliaWerneck's Avatar
                                              FamiliaWerneck FamiliaWerneck is offline
                                                 
                                                Join Date: May 2015
                                                Location: São Paulo, Brasil
                                                Gender: Male
                                                Posts: 274
                                                1 - Is it possible to give two abilities to Pokémon, instead of only one in Fire Red?

                                                2 - Also, I wanted to make Ghost Pokémon not affected by any Physical attacks, not just Normal's. Also, even Normal's special attacks can hit them, like Hyper Beam.
                                                I asked this once as a type effectiveness question, but since that was unlikely to work alright, I remembered of Levitate and how it makes Pokémon with it not to be affected by Ground attacks. If it is possible to make it not be affected by Physical attacks, instead, it would be great!
                                                Is it possible to make an ability where Physical attacks do not work on the Pokémon with this ability?
                                                Reply With Quote
                                                  #75    
                                                Old June 23rd, 2015 (4:33 AM).
                                                MrDollSteak's Avatar
                                                MrDollSteak MrDollSteak is offline
                                                Formerly known as 11bayerf1
                                                   
                                                  Join Date: Dec 2008
                                                  Location: Hong Kong
                                                  Age: 23
                                                  Gender: Male
                                                  Posts: 844
                                                  Quote:
                                                  Originally Posted by FamiliaWerneck View Post
                                                  1 - Is it possible to give two abilities to Pokémon, instead of only one in Fire Red?

                                                  2 - Also, I wanted to make Ghost Pokémon not affected by any Physical attacks, not just Normal's. Also, even Normal's special attacks can hit them, like Hyper Beam.
                                                  I asked this once as a type effectiveness question, but since that was unlikely to work alright, I remembered of Levitate and how it makes Pokémon with it not to be affected by Ground attacks. If it is possible to make it not be affected by Physical attacks, instead, it would be great!
                                                  Is it possible to make an ability where Physical attacks do not work on the Pokémon with this ability?
                                                  To your first question - No.

                                                  To your second question, this isn't actually all that relevant to the ability resource thread as this is for making existing abilities not custom abilities. You'd have to branch in the attack canceler routine and do a check for Physical / Contact moves, whichever you want and branch to attack cancel if that's the case. However this would be an EXTREMELY broken ability / type if that is the case.
                                                  __________________
                                                  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
                                                  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 1:34 PM.