AI Ability Use Decisions

From Final Fantasy Hacktics Wiki
(Redirected from 0019e5d8 - 0019ef20)
Jump to navigation Jump to search
BATTLE.BIN :  :  - AI_Ability_Use_Decisions
This routine checks certain data and decides whether a particular capacity can be used on a particular unit.
Abilities 0x76 0x92 and 0x96 will be set unusable 50% of the time if they affect stats (hardcoded)
------------------------------------------------------------------------------------------
Parameter :  r4 = Considered Unit ID
             r5 = 0 or 1 (bypass reflect)
Return : r2 = 0x00 if Unusable or 100% miss
         r2 = 0x01 if usable and usefull
         r2 = 0x02 if usable but will disserve acting unit team (healing opponent, damaging ally etc…)
------------------------------------------------------------------------------------------
0019e5d8: 27bdffc0 addiu r29,r29,-0x0040     |
0019e5dc: afbe0038 sw r30,0x0038(r29)        |
0019e5e0: 3c1e801a lui r30,0x801a            |
0019e5e4: 27def3c4 addiu r30,r30,-0x0c3c     |8019f3c4
0019e5e8: 000410c0 sll r2,r4,0x03            |Considered Unit ID * 8
0019e5ec: 00441023 subu r2,r2,r4             |ID*7
0019e5f0: 00021180 sll r2,r2,0x06            |iD*0x1c0
0019e5f4: 3c038019 lui r3,0x8019             |
0019e5f8: 246308cc addiu r3,r3,0x08cc        |
0019e5fc: afb60030 sw r22,0x0030(r29)        |
0019e600: 0043b021 addu r22,r2,r3            |Considered Unit Battle data pointer
0019e604: 00041100 sll r2,r4,0x04            |Considered Unit ID * 16
0019e608: 2442182c addiu r2,r2,0x182c        |
0019e60c: afb70034 sw r23,0x0034(r29)        |
0019e610: 005eb821 addu r23,r2,r30           |Considered Unit Decision data pointer 8019f3c4 + 0x182c + Unit ID  16
0019e614: 3c02801a lui r2,0x801a             |
0019e618: 8c42f3d0 lw r2,-0x0c30(r2)         |Considered  Ability  AI Flags 8019f3c4 - 0x0c to 0x0f
0019e61c: 3c07801a lui r7,0x801a             |
0019e620: 90e7f3c5 lbu r7,-0x0c3b(r7)        |Considered  Ability  CT 8019f3c4 - 0x01
0019e624: 3c032000 lui r3,0x2000             |
0019e628: afbf003c sw r31,0x003c(r29)        |
0019e62c: afb5002c sw r21,0x002c(r29)        |
0019e630: afb40028 sw r20,0x0028(r29)        |
0019e634: afb30024 sw r19,0x0024(r29)        |
0019e638: afb20020 sw r18,0x0020(r29)        |
0019e63c: afb1001c sw r17,0x001c(r29)        |
0019e640: afb00018 sw r16,0x0018(r29)        |

                  ----XXX  TARGETING RESTRICTION SECTION XXX----
0019e644: 00431024 and r2,r2,r3              |
0019e648: 10400005 beq r2,r0,0x0019e660      #If Ability has [Only hit enemies]
0019e64c: afa70010 sw r7,0x0010(r29)         |Store Ability CT on stack 0x10
0019e650: 92e20008 lbu r2,0x0008(r23)            |load enemy flag AI 0x182c - 0x08
0019e654: 00000000 nop                           |
0019e658: 10400225 beq r2,r0,0x0019eef0          #If This unit is an ally of Acting unit : branch to END - returns 0x00
0019e65c: 00001021 addu r2,r0,r0                 |
0019e660: 8fc2000c lw r2,0x000c(r30)         |Considered  Ability  AI Flags 8019f3c4 - 0x0c to 0x0f
0019e664: 3c034000 lui r3,0x4000             |
0019e668: 00431024 and r2,r2,r3              |
0019e66c: 10400005 beq r2,r0,0x0019e684      #If Ability has [Only hit Allies]
0019e670: 00000000 nop                           |
0019e674: 92e20008 lbu r2,0x0008(r23)            |load enemy flag AI 0x182c - 0x08
0019e678: 00000000 nop                           |
0019e67c: 1440021c bne r2,r0,0x0019eef0          #If This unit is an enemy of acting unit : branch to END - returns 0x00
0019e680: 00001021 addu r2,r0,r0                 |
0019e684: 93c20e2e lbu r2,0x0e2e(r30)        |Load Acting Unit ID
0019e688: 00000000 nop                       |
0019e68c: 1482000f bne r4,r2,0x0019e6cc      #If Considered Unit is t Acting unit 
0019e690: 00000000 nop                           |
0019e694: 87c30002 lh r3,0x0002(r30)             |Ability ID
0019e698: 00000000 nop                           |
0019e69c: 28620170 slti r2,r3,0x0170             |
0019e6a0: 1040000a beq r2,r0,0x0019e6cc          #If Ability Has a Data 2 Table (ID < 0x170)
0019e6a4: 000310c0 sll r2,r3,0x03                    |
0019e6a8: 00431023 subu r2,r2,r3                     |
0019e6ac: 00021040 sll r2,r2,0x01                    |Ability ID * 14
0019e6b0: 3c018006 lui r1,0x8006                     |
0019e6b4: 00220821 addu r1,r1,r2                     |
0019e6b8: 9022fbf4 lbu r2,-0x040c(r1)                |Ability Data 2 Flags 2 8005fbf0 + 0x04
0019e6bc: 00000000 nop                               |
0019e6c0: 30420001 andi r2,r2,0x0001                 |Check [Allow Self Target] - this is a reverted flag (0x01 if unchecked in patcher)
0019e6c4: 1440020a bne r2,r0,0x0019eef0              #If This Ability disallow self targeting :  Exit and returns 0x00
0019e6c8: 00001021 addu r2,r0,r0                     |

                  ----XXX  REFLECT SECTION XXX----
0019e6cc: 10a0000b beq r5,r0,0x0019e6fc      #If r5 <> 0x00 / Else Avoid Reflect section
0019e6d0: 00000000 nop                           |
0019e6d4: 8fc2000c lw r2,0x000c(r30)             |Considered  Ability  AI Flags 8019f3c4 - 0x0c to 0x0f
0019e6d8: 00000000 nop                           |
0019e6dc: 30424000 andi r2,r2,0x4000             |
0019e6e0: 10400006 beq r2,r0,0x0019e6fc          #If Considered Ability has [Reflectable]
0019e6e4: 02c02821 addu r5,r22,r0                    |Send Considered Unit Battle data pointer
0019e6e8: 8fa40010 lw r4,0x0010(r29)                 |Considered Ability CT
0019e6ec: 0c067bc9 jal 0x0019ef24                    |-->Check if Status Should/Can be Added
0019e6f0: 34060026 ori r6,r0,0x0026                  |Check for Reflect
0019e6f4: 144001fe bne r2,r0,0x0019eef0              #Considered Unit has Reflect, don't use Exit and returns 0x00
0019e6f8: 00001021 addu r2,r0,r0                     |

                  ----XXX  FAITH  SECTION XXX----
0019e6fc: 8fc2000c lw r2,0x000c(r30)         |Considered  Ability  AI Flags 8019f3c4 - 0x0c to 0x0f
0019e700: 00000000 nop                       |
0019e704: 30420400 andi r2,r2,0x0400         |
0019e708: 10400006 beq r2,r0,0x0019e724      #If Considered Ability has [Affected by Faith]
0019e70c: 02c02821 addu r5,r22,r0                |
0019e710: 8fa40010 lw r4,0x0010(r29)             |Ability CT
0019e714: 0c067bc9 jal 0x0019ef24                |-->Check if Status Should/Can be Added
0019e718: 34060021 ori r6,r0,0x0021              |Check for Innocent
0019e71c: 144001f4 bne r2,r0,0x0019eef0          #Considered Unit has Innocent, don't use Exit and returns 0x00
0019e720: 00001021 addu r2,r0,r0                 |

                  ----XXX  JUMP  SECTION XXX----
0019e724: 8fa40010 lw r4,0x0010(r29)         |Ability CT
0019e728: 02c02821 addu r5,r22,r0            |
0019e72c: 0c067bc9 jal 0x0019ef24            |-->Check if Status Should/Can be Added
0019e730: 34060005 ori r6,r0,0x0005          |Check for Jump
0019e734: 144001ee bne r2,r0,0x0019eef0      #considered Unit is Jumping, don't use Exit and returns 0x00
0019e738: 00001021 addu r2,r0,r0             |

                  ----XXX  DEAD UNIT  SECTION XXX----
0019e73c: 8fc2000c lw r2,0x000c(r30)         |Considered  Ability  AI Flags 8019f3c4 - 0x0c to 0x0f
0019e740: 00000000 nop                       |
0019e744: 30420020 andi r2,r2,0x0020         |
0019e748: 10400005 beq r2,r0,0x0019e760      #If Considered Ability has [Cancel status]
0019e74c: 0000a021 addu r20,r0,r0            |Initialize Cancel dead flag
0019e750: 93c20007 lbu r2,0x0007(r30)            |load status infliction 1
0019e754: 00000000 nop                           |
0019e758: 30420020 andi r2,r2,0x0020             |Not null if this ability will cancel Dead
0019e75c: 0002a02b sltu r20,r0,r2                |
0019e760: 92e20007 lbu r2,0x0007(r23)        |AI 0x182c - 0x07
0019e764: 00000000 nop                       |
0019e768: 30420040 andi r2,r2,0x0040         |Check if Considered Unit is Dead with reraise
0019e76c: 10400009 beq r2,r0,0x0019e794      #If Considered Unit has [Dead] and [Reraise]
0019e770: 00000000 nop                           |
0019e774: 93d00001 lbu r16,0x0001(r30)           |load Ability CT
0019e778: 0c0666e6 jal 0x00199b98                |-->Calculate Clockticks Until Unit Acts
0019e77c: 02c02021 addu r4,r22,r0                |send pointer
0019e780: 0202802a slt r16,r16,r2                |0x1 if Ability will land before reraise 
0019e784: 1600003e bne r16,r0,0x0019e880         #If Ability is cast while considered Unit is still dead Exit and returns 0x00
0019e788: 00000000 nop                           |
0019e78c: 168001d8 bne r20,r0,0x0019eef0         #If Unit Revive before the cast : do not use a [cancel death] ability Exit and returns 0x00
0019e790: 00001021 addu r2,r0,r0                 |
0019e794: 92e20007 lbu r2,0x0007(r23)        |AI 0x182c - 0x07
0019e798: 00000000 nop                       |
0019e79c: 30420020 andi r2,r2,0x0020         |
0019e7a0: 10400009 beq r2,r0,0x0019e7c8      #If Considered Unit is dead (no reraise)
0019e7a4: 00000000 nop                           |
0019e7a8: 93d00001 lbu r16,0x0001(r30)           |r16 = Ability CT
0019e7ac: 0c066722 jal 0x00199c88                |-->Get number of clockticks till able to revive dead unit returns nb of clock tick before end of death counter
0019e7b0: 02c02021 addu r4,r22,r0                |r4 = Unit Data
0019e7b4: 0050102a slt r2,r2,r16                 |0x1 if Death counter will end before Ability cast
0019e7b8: 14400031 bne r2,r0,0x0019e880          #If death counter fade before unit cast :  Exit and returns 0x00
0019e7bc: 00000000 nop                           |
0019e7c0: 128001cb beq r20,r0,0x0019eef0         #Else Ability will be cast on a dead unit : any ability not canceling death will miss Exit and returns 0x00
0019e7c4: 00001021 addu r2,r0,r0                 |

                  ----XXX  PETRIFIED UNIT  SECTION XXX----
0019e7c8: 92c20059 lbu r2,0x0059(r22)        |Load Current Status 2
0019e7cc: 00000000 nop                       |
0019e7d0: 30420080 andi r2,r2,0x0080         |
0019e7d4: 1040000b beq r2,r0,0x0019e804      #If Unit has [Petrify]
0019e7d8: 02c02821 addu r5,r22,r0                |
0019e7dc: 8fc2000c lw r2,0x000c(r30)             |Considered  Ability  AI Flags 8019f3c4 - 0x0c to 0x0f
0019e7e0: 00000000 nop                           |
0019e7e4: 30420020 andi r2,r2,0x0020             |
0019e7e8: 104001c1 beq r2,r0,0x0019eef0          #If this Ability do not have [cancel status] flag Exit and returns 0x00
0019e7ec: 00001021 addu r2,r0,r0                 |
0019e7f0: 93c20008 lbu r2,0x0008(r30)            |Load status infliction 2 8019f3c4 + 0x08
0019e7f4: 00000000 nop                           |
0019e7f8: 30420080 andi r2,r2,0x0080             |
0019e7fc: 104001bc beq r2,r0,0x0019eef0          #If this Ability do not cancel petrify Exit and returns 0x00
0019e800: 00001021 addu r2,r0,r0                 |

                  ----XXX  WALL  SECTION XXX----
0019e804: 8fa40010 lw r4,0x0010(r29)         |Send Ability CT
0019e808: 0c067bc9 jal 0x0019ef24            |-->Check if Status Should/Can be Added
0019e80c: 3406001f ori r6,r0,0x001f          |Check for Wall
0019e810: 1040000b beq r2,r0,0x0019e840      #If Unit has [Wall]
0019e814: 00000000 nop                           |
0019e818: 8fc2000c lw r2,0x000c(r30)             |Considered  Ability  AI Flags 8019f3c4 - 0x0c to 0x0f
0019e81c: 00000000 nop                           |
0019e820: 30420020 andi r2,r2,0x0020             |
0019e824: 104001b2 beq r2,r0,0x0019eef0          #If this Ability do not have [cancel status] flag Exit and returns 0x00
0019e828: 00001021 addu r2,r0,r0                 |
0019e82c: 93c2000a lbu r2,0x000a(r30)            |load status infliction 4
0019e830: 00000000 nop                           |
0019e834: 30420001 andi r2,r2,0x0001             |
0019e838: 104001ad beq r2,r0,0x0019eef0          #if this Ability doesn't cancel Wall, don't use Exit and returns 0x00
0019e83c: 00001021 addu r2,r0,r0                 |

                  ----XXX  ELEMENTAL  NULLIFICATION SECTION XXX----
0019e840: 93d40010 lbu r20,0x0010(r30)       |This ability elements 8019f3c4 - 0x10
0019e844: 00000000 nop                       |
0019e848: 1280000f beq r20,r0,0x0019e888     #If This ability uses elements
0019e84c: 00000000 nop                           |
0019e850: 92c2006e lbu r2,0x006e(r22)            |Considered Unit elemental nullification
0019e854: 00000000 nop                           |
0019e858: 02821024 and r2,r20,r2                 |
0019e85c: 12820008 beq r20,r2,0x0019e880         #if Ability element is nullified Exit and returns 0x00
0019e860: 34020008 ori r2,r0,0x0008              |
0019e864: 16820008 bne r20,r2,0x0019e888         #If Ability has Earth elemental
0019e868: 00000000 nop                               |
0019e86c: 92c2005a lbu r2,0x005a(r22)                |Load Current Status 3
0019e870: 00000000 nop                               |
0019e874: 30420040 andi r2,r2,0x0040                 |
0019e878: 10400003 beq r2,r0,0x0019e888              #If Unit Has Float
0019e87c: 00000000 nop                                   |
0019e880: 08067bbc j 0x0019eef0                          >>Exit and returns 0x00
0019e884: 00001021 addu r2,r0,r0                             |

                  ----XXX  HARMFULL ABILITY SECTION XXX----
0019e888: 8fc3000c lw r3,0x000c(r30)         |Considered  Ability  AI Flags 8019f3c4 - 0x0c to 0x0f
0019e88c: 00000000 nop                       |
0019e890: 30620002 andi r2,r3,0x0002         |
0019e894: 10400074 beq r2,r0,0x0019ea68      #If Ability [Target enemies]
0019e898: 30622000 andi r2,r3,0x2000             |
                                             '--- REVERSION CHECK section ---
0019e89c: 1040000f beq r2,r0,0x0019e8dc          #If Ability has [Undead reverse]
0019e8a0: 00000000 nop                               |
0019e8a4: 92e20008 lbu r2,0x0008(r23)                |Load Enemy flag AI 182c 0x08
0019e8a8: 00000000 nop                               |
0019e8ac: 10400004 beq r2,r0,0x0019e8c0              #If Unit is an Enemy of Acting Unit
0019e8b0: 00000000 nop                                   |
0019e8b4: 92c20058 lbu r2,0x0058(r22)                    |Considered unit 1st set of current status
0019e8b8: 08067a3f j 0x0019e8fc                          >>Check if Undead  and Jump to  Final Reversion check
0019e8bc: 30420010 andi r2,r2,0x0010                         |
                                                    Else : If Unit is an Ally
0019e8c0: 92c20058 lbu r2,0x0058(r22)                    |Considered Unit Current Status 1
0019e8c4: 00000000 nop                                   |
0019e8c8: 30420010 andi r2,r2,0x0010                     |
0019e8cc: 14400050 bne r2,r0,0x0019ea10                  #If Ally is Undead  Branch to Harmfull on Enemy section ???
0019e8d0: 00000000 nop                                       |
0019e8d4: 08067bbc j 0x0019eef0                          >>Else : not undead : don't use harmfull ability on an ally Exit and returns 0x02
0019e8d8: 34020002 ori r2,r0,0x0002                          |
                                                Else : not [Undead reverse]
0019e8dc: 92e20008 lbu r2,0x0008(r23)                |Load Enemy flag AI 182c 0x08
0019e8e0: 00000000 nop                               |
0019e8e4: 10400009 beq r2,r0,0x0019e90c              #If Unit is an Ally Branch to Harmfull on ally section
0019e8e8: 02c02821 addu r5,r22,r0                    |
0019e8ec: 92c2006d lbu r2,0x006d(r22)                |Considered Unit Elemental Absorbtion
0019e8f0: 93c30010 lbu r3,0x0010(r30)                |Considered Ability Elements
0019e8f4: 00000000 nop                               |
0019e8f8: 00431024 and r2,r2,r3                      |
                                                Final reversion check
0019e8fc: 10400044 beq r2,r0,0x0019ea10              #If Harmfull Ability is not  eversed on an enemy Branch to Harmfull on Enemy section
0019e900: 34020002 ori r2,r0,0x0002                  |
0019e904: 08067bbc j 0x0019eef0                      >>Else : Harmfull reversed on Enemy Exit and returns 0x02
0019e908: 00000000 nop                               |
                                             '--- HARMFULL ABILITY on ALLY section ---
0019e90c: 8fa40010 lw r4,0x0010(r29)                 |Ability CT
0019e910: 0c067bc9 jal 0x0019ef24                    |-->Check if Status Should/Can be Added
0019e914: 34060022 ori r6,r0,0x0022                  |Check for Charm
0019e918: 10400005 beq r2,r0,0x0019e930              #If Unit has [Charm]
0019e91c: 02c02021 addu r4,r22,r0                        |
0019e920: 0c067bec jal 0x0019efb0                        |-->Check_if_Unit_will_get_his_Turn_without_Status
0019e924: 34050022 ori r5,r0,0x0022                      |Check for Charm
0019e928: 14400002 bne r2,r0,0x0019e934                  #If Unit will get his turn While Charmed : Enable charmed Flag
0019e92c: 34140001 ori r20,r0,0x0001                     |
                                                    Else : Unit is not Charmed- or Charm will fade off : Disable charmed flag
0019e930: 0000a021 addu r20,r0,r0                        |No Charm flag
0019e934: 8fc2000c lw r2,0x000c(r30)                 |Considered  Ability  AI Flags 8019f3c4 - 0x0c to 0x0f
0019e938: 00000000 nop                               |
0019e93c: 30420080 andi r2,r2,0x0080                 |
0019e940: 10400015 beq r2,r0,0x0019e998              #If Considered Ability Affects HP  (check if you can cancels some status)
0019e944: 00000000 nop                                   |
0019e948: 93c20000 lbu r2,0x0000(r30)                    |Considered skillset
0019e94c: 3c018006 lui r1,0x8006                         |
0019e950: 00220821 addu r1,r1,r2                         |
0019e954: 90235cb4 lbu r3,0x5cb4(r1)                     |load action menu
0019e958: 3402000a ori r2,r0,0x000a                      |
0019e95c: 1062000e beq r3,r2,0x0019e998                  #If Action menu is not Charge : 
0019e960: 00000000 nop                                       |
0019e964: 92c20059 lbu r2,0x0059(r22)                        |Load Current Status 2
0019e968: 00000000 nop                                       |
0019e96c: 30420010 andi r2,r2,0x0010                         |
0019e970: 1440015f bne r2,r0,0x0019eef0                      #If Unit has [Confuse]  Exit and return 0x01 Can be used to break confuse 
0019e974: 34020001 ori r2,r0,0x0001                          |
0019e978: 8fa40010 lw r4,0x0010(r29)                         |Ability CT
0019e97c: 02c02821 addu r5,r22,r0                            |
0019e980: 0c067bc9 jal 0x0019ef24                            |-->Check if Status Should/Can be Added
0019e984: 34060023 ori r6,r0,0x0023                          |Check for Sleep
0019e988: 14400046 bne r2,r0,0x0019eaa4                      #If Unit has [Sleep] Exit and return 0x01 Can be used to break sleep
0019e98c: 00000000 nop                                       |
0019e990: 16800157 bne r20,r0,0x0019eef0                     #If Charm flag is ON  Exit and return 0x01 Can be used to break charm
0019e994: 34020001 ori r2,r0,0x0001                          |
0019e998: 92c2006d lbu r2,0x006d(r22)                |Unit Elemental absorbtion 801908cc + 0x6d
0019e99c: 93c30010 lbu r3,0x0010(r30)                |Ability Element 8019f3c4 + 0x10
0019e9a0: 00000000 nop                               |
0019e9a4: 00431024 and r2,r2,r3                      |elements & absorbs
0019e9a8: 10400006 beq r2,r0,0x0019e9c4              #If Considered Ally Unit Absorbs Ability
0019e9ac: 00000000 nop                                   |
0019e9b0: 92e20007 lbu r2,0x0007(r23)                    |AI Decision Byte 0x07 8019f3c4 + 0x182c +0x07
0019e9b4: 00000000 nop                                   |
0019e9b8: 30420001 andi r2,r2,0x0001                     |check if Unit have [Less than 50 % HP] flag
0019e9bc: 1440014c bne r2,r0,0x0019eef0                  #If This Ally is below 50% HP, you can use this Ability to heal Exit and return 0x01
0019e9c0: 34020001 ori r2,r0,0x0001                      |
0019e9c4: 92c20059 lbu r2,0x0059(r22)                |Load Current Status 2 801908cc + 0x59
0019e9c8: 00000000 nop                               |
0019e9cc: 30420014 andi r2,r2,0x0014                 |
0019e9d0: 14400003 bne r2,r0,0x0019e9e0              #If Considered Ally do not have [Confusion] nor [Blood Suck]
0019e9d4: 00000000 nop                                   |
0019e9d8: 12800145 beq r20,r0,0x0019eef0                 #If Ally is not charmed either Exit and return 0x02
0019e9dc: 34020002 ori r2,r0,0x0002                      |

0019e9e0: 8fc2000c lw r2,0x000c(r30)                 |Considered  Ability  AI Flags 8019f3c4 - 0x0c to 0x0f
0019e9e4: 00000000 nop                               |
0019e9e8: 30420010 andi r2,r2,0x0010                 |
0019e9ec: 1040ffb9 beq r2,r0,0x0019e8d4              #If Considered Ability do not [Add status] Exit and return 0x02 via backjumping
                                                    Else : Considered Ability has [Add status]
0019e9f0: 3c031c06 lui r3,0x1c06                         |Sleep, Don't Move, Don't Act, Slow and Stop
0019e9f4: 8fc20008 lw r2,0x0008(r30)                     |Ability Status infliction 2 to 5 8019f3c4 - 0x08 to 0x0b
0019e9f8: 00000000 nop                                   |
0019e9fc: 00431024 and r2,r2,r3                          |
0019ea00: 1440013b bne r2,r0,0x0019eef0                  #If this Ability can disable an uncontroled Ally unit  Exit and return 0x01
0019ea04: 34020001 ori r2,r0,0x0001                      |
0019ea08: 08067bbc j 0x0019eef0                          >>Else : This Ability will uneedly harm an Ally Exit and return 0x02
0019ea0c: 34020002 ori r2,r0,0x0002                      |

                                             '--- HARMFULL ABILITY on Enemy section ( or reversed on undead Ally)---
0019ea10: 8fc2000c lw r2,0x000c(r30)                 |Considered  Ability  AI Flags 8019f3c4 - 0x0c to 0x0f
0019ea14: 00000000 nop                               |
0019ea18: 30420080 andi r2,r2,0x0080                 |
0019ea1c: 10400006 beq r2,r0,0x0019ea38              #If This Ability [Affects HP]
0019ea20: 00000000 nop                                   |
0019ea24: 92c2005c lbu r2,0x005c(r22)                    |Load Current Status 5
0019ea28: 00000000 nop                                   |
0019ea2c: 30420001 andi r2,r2,0x0001                     |
0019ea30: 1040012f beq r2,r0,0x0019eef0                  #Attack Enemy unless [Death Sentence] Exit and return 0x01
0019ea34: 34020001 ori r2,r0,0x0001                      |
0019ea38: 8fc2000c lw r2,0x000c(r30)                 |Considered  Ability  AI Flags 8019f3c4 - 0x0c to 0x0f
0019ea3c: 00000000 nop                               |
0019ea40: 30420040 andi r2,r2,0x0040                 |
0019ea44: 10400007 beq r2,r0,0x0019ea64              #If This Ability [Affects MP]
0019ea48: 00000000 nop                                   |
0019ea4c: 96c3002c lhu r3,0x002c(r22)                    |Considered Foe MP 801908cc + 0x2c
0019ea50: 92e2000a lbu r2,0x000a(r23)                    |Lowest MP cost 8019f3c4 + 0x182c + 0x0a
0019ea54: 00000000 nop                                   |
0019ea58: 0043102b sltu r2,r2,r3                         |0x1 if Unit can still cast an MP using Ability
0019ea5c: 14400124 bne r2,r0,0x0019eef0                  #Use MP damage only if Unit has enough MP to cast an Ability Exit and return 0x01
0019ea60: 34020001 ori r2,r0,0x0001                      |

                  ----XXX  HELPFULL ABILITY SECTION XXX----
0019ea64: 8fc3000c lw r3,0x000c(r30)         |Considered  Ability  AI Flags 8019f3c4 - 0x0c to 0x0f
0019ea68: 00000000 nop                       |
0019ea6c: 30620001 andi r2,r3,0x0001         |
0019ea70: 10400036 beq r2,r0,0x0019eb4c      #If Considered Ability has [Target Allies]
0019ea74: 30622000 andi r2,r3,0x2000             |
                                             '--- Check Reversion ---
0019ea78: 1040000f beq r2,r0,0x0019eab8          #if Ability has [Undead Reverse]
0019ea7c: 00000000 nop                               |
0019ea80: 92e20008 lbu r2,0x0008(r23)                |load enemy flag 8019f3c4 + 0x182c + 0x08
0019ea84: 00000000 nop                               |
0019ea88: 10400008 beq r2,r0,0x0019eaac              #If Considered unit is in an enemy
0019ea8c: 00000000 nop                                   |
0019ea90: 92c30058 lbu r3,0x0058(r22)                    |Load Current Status 1
0019ea94: 00000000 nop                                   |
0019ea98: 30630010 andi r3,r3,0x0010                     |
0019ea9c: 10600114 beq r3,r0,0x0019eef0                  #If This Ennemy is not Undead : don't use Helpfull ability on Ally Exit and returns 0x02
0019eaa0: 34020002 ori r2,r0,0x0002                      |
                                                        Else : This Ability will be Harmfull for undead enemy
0019eaa4: 08067bbc j 0x0019eef0                              |Exit and returns 0x01
0019eaa8: 34020001 ori r2,r0,0x0001                          |
                                                    Else : Considered Unit is an Ally
0019eaac: 92c20058 lbu r2,0x0058(r22)                    |Load Current Status 1
0019eab0: 08067aaf j 0x0019eabc                          >>Jump to check reversion on Ally returns 0x02 if reversed
0019eab4: 30420010 andi r2,r2,0x0010                     |undead check
                                                Else : Helpfull Ability without undead reverse
0019eab8: 92e20008 lbu r2,0x0008(r23)                |Load enemy flag 8019f3c4 + 0x182c + 0x08
0019eabc: 00000000 nop                               |
0019eac0: 1440010b bne r2,r0,0x0019eef0              #If Unit is an Enemy : do not use this helpfull Ability  Exit and returns 0x02
0019eac4: 34020002 ori r2,r0,0x0002                  |
                                             '--- Death sentence ---
0019eac8: 92c2005c lbu r2,0x005c(r22)            |Load Current Status 5              
0019eacc: 00000000 nop                           |
0019ead0: 30420001 andi r2,r2,0x0001             |
0019ead4: 10400009 beq r2,r0,0x0019eafc          #If This Ally has [Death Sentence]
0019ead8: 00000000 nop                               |
0019eadc: 8fc3000c lw r3,0x000c(r30)                 |Considered  Ability  AI Flags 8019f3c4 - 0x0c to 0x0f
0019eae0: 00000000 nop                               |
0019eae4: 30630010 andi r3,r3,0x0010                 |
0019eae8: 10600101 beq r3,r0,0x0019eef0              #If This Ability do not [Add Status] Exit and returns 0x00
0019eaec: 00001021 addu r2,r0,r0                     |
0019eaf0: 93c20009 lbu r2,0x0009(r30)                |Load Inflicted Status 3 8019f3c4 + 0x09
0019eaf4: 08067bbb j 0x0019eeec                      >>Jump to END Exit and returns 0x01 if Add reraise - Else 0x00
0019eaf8: 30420020 andi r2,r2,0x0020                     |
                                             '--- HP or MP recovery ---
                                                Else : Considered Ally do not have Death sentence
0019eafc: 8fc2000c lw r2,0x000c(r30)                 |Considered  Ability  AI Flags 8019f3c4 - 0x0c to 0x0f
0019eb00: 00000000 nop                               |
0019eb04: 30420080 andi r2,r2,0x0080                 |
0019eb08: 10400006 beq r2,r0,0x0019eb24              #If This Ability [Affect HP]
0019eb0c: 00000000 nop                                   |
0019eb10: 92e20007 lbu r2,0x0007(r23)                    |Load AI Targeting 8019f3c4 + 182c + 0x07
0019eb14: 00000000 nop                                   |
0019eb18: 30420001 andi r2,r2,0x0001                     |
0019eb1c: 144000f4 bne r2,r0,0x0019eef0                  #If [Low HP] then  Exit and returns 0x01
0019eb20: 34020001 ori r2,r0,0x0001                          |
                                                    Else : This Ability do not affect HP
0019eb24: 8fc2000c lw r2,0x000c(r30)                     |Considered  Ability  AI Flags 8019f3c4 - 0x0c to 0x0f
0019eb28: 00000000 nop                                   |
0019eb2c: 30420040 andi r2,r2,0x0040                     |
0019eb30: 10400006 beq r2,r0,0x0019eb4c                  #If This  Ability Heal MP
0019eb34: 00000000 nop                                       |
0019eb38: 92e20007 lbu r2,0x0007(r23)                        |Load AI Targeting 8019f3c4 + 182c + 0x07
0019eb3c: 00000000 nop                                       |
0019eb40: 30420002 andi r2,r2,0x0002                         |check [Low MP] flag  (if Unit uses MP Abilities)
0019eb44: 144000ea bne r2,r0,0x0019eef0                      #If Unit has [Low MP] flag Exit and returns 0x01
0019eb48: 34020001 ori r2,r0,0x0001                              |

                  ----XXX  NEUTRAL ABILITY SECTION XXX----
0019eb4c: 8fc3000c lw r3,0x000c(r30)         |Considered  Ability  AI Flags 8019f3c4 - 0x0c to 0x0f
0019eb50: 00000000 nop                       |
0019eb54: 30620003 andi r2,r3,0x0003         |
0019eb58: 14400006 bne r2,r0,0x0019eb74      #If This Ability do not have hostility flags
0019eb5c: 30620080 andi r2,r3,0x0080             |
0019eb60: 144000e3 bne r2,r0,0x0019eef0          #If this Ability Affect HP Exit and returns 0x01 Just skip status only section ? 
0019eb64: 34020001 ori r2,r0,0x0001              |
0019eb68: 30620040 andi r2,r3,0x0040             |
0019eb6c: 144000e0 bne r2,r0,0x0019eef0          #If this Ability Affect MP Exit and returns 0x01 Just skip status only section ? 
0019eb70: 34020001 ori r2,r0,0x0001              |

                  ----XXX  ADD STATUS SECTION XXX----
0019eb74: 8fc2000c lw r2,0x000c(r30)         |Considered  Ability  AI Flags 8019f3c4 - 0x0c to 0x0f
0019eb78: 00000000 nop                       |
0019eb7c: 30420010 andi r2,r2,0x0010         |
0019eb80: 10400073 beq r2,r0,0x0019ed50      #If Considered Ability has [Add status]
0019eb84: 00000000 nop                           |
0019eb88: 0000a021 addu r20,r0,r0                |Reset counter
0019eb8c: 03d41021 addu r2,r30,r20               |Dynamic pointer to 8019f3c4 + Status set offset
                                                @LOOP - 5 set of Status
0019eb90: 02d41821 addu r3,r22,r20                   |Dynamic pointer to 801908cc + Status set offset
0019eb94: 90500007 lbu r16,0x0007(r2)                |This iteration Inflicted Status set 8019f3c4 + 0x07 (to 0x0b)
0019eb98: 90620058 lbu r2,0x0058(r3)                 |This iteration Current status
0019eb9c: 00000000 nop                               |
0019eba0: 02021024 and r2,r16,r2                     |
0019eba4: 02028026 xor r16,r16,r2                    |Remove statuses already present         
0019eba8: 12000065 beq r16,r0,0x0019ed40             #if No new status to add in this set Branch to next iteration
0019ebac: 00000000 nop                               |
0019ebb0: 90620053 lbu r2,0x0053(r3)                 |load status immunity
0019ebb4: 00000000 nop                               |
0019ebb8: 02021024 and r2,r16,r2                     |
0019ebbc: 02028026 xor r16,r16,r2                    |Remove status immunities
0019ebc0: 1200005f beq r16,r0,0x0019ed40             #if Unit is Immune to status in this set Branch to next iteration
0019ebc4: 34020002 ori r2,r0,0x0002                  |
0019ebc8: 1282001f beq r20,r2,0x0019ec48             #If 3rd Set of status Branch to 3rd set section
0019ebcc: 2a820003 slti r2,r20,0x0003                |
0019ebd0: 10400005 beq r2,r0,0x0019ebe8              #If less than 3rd set
0019ebd4: 34020001 ori r2,r0,0x0001                      |
0019ebd8: 1282000a beq r20,r2,0x0019ec04                 #If 2nd set Branch to dedicated section
0019ebdc: 32020008 andi r2,r16,0x0008                    |Check for Silence
0019ebe0: 08067b4e j 0x0019ed38                          >>if set 1  : jump to  Confirm status
0019ebe4: 00000000 nop                                       |
                                                    Else : More than 2nd set
0019ebe8: 34020003 ori r2,r0,0x0003                      |
0019ebec: 1282002e beq r20,r2,0x0019eca8                 #if 4rd Set  Branch to dedicated section
0019ebf0: 34020004 ori r2,r0,0x0004                      |
0019ebf4: 1282004a beq r20,r2,0x0019ed20                 #if 5th Set Branch to dedicated section
0019ebf8: 00000000 nop                                       |
0019ebfc: 08067b4e j 0x0019ed38                          >>Jump to confirm status by security
0019ec00: 00000000 nop                                       |
                                             '--- 2nd Set of Status (silence and blind check)---
0019ec04: 10400007 beq r2,r0,0x0019ec24              #If This Ability Add [Silence]
0019ec08: 32020020 andi r2,r16,0x0020                    |
0019ec0c: 92e2000c lbu r2,0x000c(r23)                    |Load Silenceable Mod
0019ec10: 00000000 nop                                   |
0019ec14: 14400003 bne r2,r0,0x0019ec24                  #If Considered Unit  uses less than 25% silencable Abilities
0019ec18: 32020020 andi r2,r16,0x0020                        |
0019ec1c: 3a100008 xori r16,r16,0x0008                       |Remove Silence because unit doesn't have Silenceable abilities
0019ec20: 32020020 andi r2,r16,0x0020                        |
0019ec24: 10400044 beq r2,r0,0x0019ed38              #If Ability do not add Blind Confirm status
0019ec28: 00000000 nop                                   |
                                                    Else : Ability Add [Blind]
0019ec2c: 92e2000d lbu r2,0x000d(r23)                    |load Evadable Abilities Modifier
0019ec30: 00000000 nop                                   |
0019ec34: 2c420002 sltiu r2,r2,0x0002                    |0x1 if silencable Mod is Null or 0x1 (25% of Abilities are evadable)
0019ec38: 1040003f beq r2,r0,0x0019ed38                  #If Considered Unit usesat least 50% of evadable abilities Confirm status (keep blind)
0019ec3c: 00000000 nop                                   |
0019ec40: 08067b4e j 0x0019ed38                          >>Else : less than 50% evadable abilities Confirm status (discard blind)
0019ec44: 3a100020 xori r16,r16,0x0020                   |Remove Blind because Unit doesn't have enough Evadable abilities
                                             '--- 3rd Set of Status (Reraise Frog Float check)---
0019ec48: 32020020 andi r2,r16,0x0020                    |
0019ec4c: 10400008 beq r2,r0,0x0019ec70              #If Considered Ability adds [Reraise]
0019ec50: 32020002 andi r2,r16,0x0002                    |
0019ec54: 92e20007 lbu r2,0x0007(r23)                    |Load AI Targeting
0019ec58: 00000000 nop                                   |
0019ec5c: 30420001 andi r2,r2,0x0001                     |
0019ec60: 14400003 bne r2,r0,0x0019ec70                  #If Considered Unit is NOT low on HP (<50%)
0019ec64: 32020002 andi r2,r16,0x0002                        |
0019ec68: 3a100020 xori r16,r16,0x0020                       |
0019ec6c: 32020002 andi r2,r16,0x0002                        |
0019ec70: 10400006 beq r2,r0,0x0019ec8c              #If Considered Ability adds [Frog]
0019ec74: 00000000 nop                                   |
0019ec78: 92e20008 lbu r2,0x0008(r23)                    |load enemy flag
0019ec7c: 00000000 nop                                   |
0019ec80: 14400002 bne r2,r0,0x0019ec8c                  #If This Unit is an Ally
0019ec84: 00000000 nop                                       |
0019ec88: 3a100002 xori r16,r16,0x0002                       |
0019ec8c: 92e20007 lbu r2,0x0007(r23)                |Load AI Targeting
0019ec90: 00000000 nop                               |
0019ec94: 30420080 andi r2,r2,0x0080                 |
0019ec98: 14400027 bne r2,r0,0x0019ed38              #If Unit has less than 75% of HP Confirm status 
0019ec9c: 00000000 nop                                   |
0019eca0: 08067b4e j 0x0019ed38                      >>Else if not Critical : discard [Float] and Confirm status 
0019eca4: 321000bf andi r16,r16,0x00bf                   |Don't add Float unless critical (lol)
                                             '--- 4th Set of Status ---
0019eca8: 32020040 andi r2,r16,0x0040                |
0019ecac: 10400007 beq r2,r0,0x0019eccc              #if This Ability adds [Regen]
0019ecb0: 00000000 nop                                   |
0019ecb4: 92e20007 lbu r2,0x0007(r23)                    |Load AI Targeting
0019ecb8: 00000000 nop                                   |
0019ecbc: 30420001 andi r2,r2,0x0001                     |
0019ecc0: 14400002 bne r2,r0,0x0019eccc                  #If Unit has more than 50% HP
0019ecc4: 00000000 nop                                       |
0019ecc8: 3a100040 xori r16,r16,0x0040                       |(Don't add Regen unless at 50% or less HP)
0019eccc: 92e20007 lbu r2,0x0007(r23)                |Load AI Targeting
0019ecd0: 00000000 nop                               |
0019ecd4: 30420080 andi r2,r2,0x0080                 |
0019ecd8: 14400003 bne r2,r0,0x0019ece8              #If Unit has less than 75% HP 
0019ecdc: 3202000c andi r2,r16,0x000c                    |
0019ece0: 321000ce andi r16,r16,0x00ce                   |(Don't add Protect/Shell/Wall unless Critical)
0019ece4: 3202000c andi r2,r16,0x000c                    |
0019ece8: 10400013 beq r2,r0,0x0019ed38              #If Ability add [Haste]  or [Slow]  --- Else branch to  Confirm status 
0019ecec: 00000000 nop                                   |
0019ecf0: 92c2005b lbu r2,0x005b(r22)                    |Load Current Status 4
0019ecf4: 00000000 nop                                   |
0019ecf8: 30420002 andi r2,r2,0x0002                     |
0019ecfc: 14400006 bne r2,r0,0x0019ed18                  #If Considered Unit hasn't [Stop]
0019ed00: 00000000 nop                                       |
0019ed04: 92c2005c lbu r2,0x005c(r22)                        |Load Current Status 5
0019ed08: 00000000 nop                                       |
0019ed0c: 30420010 andi r2,r2,0x0010                         |
0019ed10: 10400009 beq r2,r0,0x0019ed38                      #If Unit hasn't [Sleep] Confirm status 
0019ed14: 00000000 nop                                           |
                                                        Else : Unit has [Stop] or [Sleep]
0019ed18: 08067b4e j 0x0019ed38                              |Confirm status (discard Slow and Haste)
0019ed1c: 321000f3 andi r16,r16,0x00f3                       |Remove Haste/Slow
                                             '--- 5th Set of Status ---
0019ed20: 92e20007 lbu r2,0x0007(r23)                |Load AI Targeting
0019ed24: 00000000 nop                               |
0019ed28: 30420080 andi r2,r2,0x0080                 |
0019ed2c: 14400002 bne r2,r0,0x0019ed38              #If Unit has more than 75% of HP
0019ed30: 00000000 nop                                   |
0019ed34: 3210007d andi r16,r16,0x007d                   |
                                             '--- Check and Confirm   ---
0019ed38: 1600006d bne r16,r0,0x0019eef0             #if this Ability will add a status Exit and returns 0x01  Immunity is checked but not don't stack on
0019ed3c: 34020001 ori r2,r0,0x0001                      |
0019ed40: 26940001 addiu r20,r20,0x0001              |Status set counter +1
0019ed44: 2a820005 slti r2,r20,0x0005                |
0019ed48: 1440ff91 bne r2,r0,0x0019eb90          Λ Loop 5 times - or until you're adding something
0019ed4c: 03d41021 addu r2,r30,r20                   |Dynamic pointer to 8019f3c4 + Status set offset

                  ----XXX   CANCEL STATUS SECTION XX----
0019ed50: 8fc2000c lw r2,0x000c(r30)         |Considered  Ability  AI Flags 8019f3c4 - 0x0c to 0x0f
0019ed54: 00000000 nop                       |
0019ed58: 30420020 andi r2,r2,0x0020         |
0019ed5c: 1040004e beq r2,r0,0x0019ee98      #If This Ability has [Cancel Status] flag
0019ed60: 00000000 nop                           |
0019ed64: 0000a021 addu r20,r0,r0                |Reset status set counter
0019ed68: 03d41021 addu r2,r30,r20               |Part of AI dynamic pointer 8019f3c4 + Status set offset
                                                @LOOP
0019ed6c: 02d41821 addu r3,r22,r20                   |Part of Battle data dynamic pointer 801908cc +status set offset
0019ed70: 90500007 lbu r16,0x0007(r2)                |This iteration Considered Ability status infliction
0019ed74: 90620058 lbu r2,0x0058(r3)                 |This iteration considered Unit current status
0019ed78: 00000000 nop                               |
0019ed7c: 02028024 and r16,r16,r2                    |
0019ed80: 12000041 beq r16,r0,0x0019ee88             #If there is no status to remove : branch to  Next status set iteration
0019ed84: 00000000 nop                                   |
0019ed88: 9062004e lbu r2,0x004e(r3)                 |This iteration considered unit Innate status
0019ed8c: 00000000 nop                               |
0019ed90: 02021024 and r2,r16,r2                     |
0019ed94: 02028026 xor r16,r16,r2                    |remove innate status from canceling ones
0019ed98: 1200003b beq r16,r0,0x0019ee88             #If removable status are innate : branch to Next status set iteration
0019ed9c: 2a820003 slti r2,r20,0x0003                    |
0019eda0: 14400019 bne r2,r0,0x0019ee08              #If status set 1, 2 or 3 Go to dedicated section
0019eda4: 34020001 ori r2,r0,0x0001                      |
                                                Status set 4 or 5
0019eda8: 00009021 addu r18,r0,r0                    |reset Status counter (0x00 to 0x07)
0019edac: 0014a8c0 sll r21,r20,0x03                  |Set * 8
0019edb0: 34070080 ori r7,r0,0x0080                  |r7 = 0x0080 (base bitmask)
                                                    @LOOP
0019edb4: 02479807 srav r19,r7,r18                       |Bitmask for this iteration status
0019edb8: 02131024 and r2,r16,r19                        |
0019edbc: 1040000d beq r2,r0,0x0019edf4                  #If This iteration status will not be canceled : branch to  Next iteration
0019edc0: 00000000 nop                                       |
0019edc4: 8fa40010 lw r4,0x0010(r29)                     |Considered Ability CT
0019edc8: 02c02821 addu r5,r22,r0                        |send Unit battle data pointer
0019edcc: 02b28821 addu r17,r21,r18                      |Status ID (set*8 + status loop counter)
0019edd0: 0c067bc9 jal 0x0019ef24                        |-->Check if Status Should/Can be Added return 0x00 if inflictable/worth to be inflicted
0019edd4: 02203021 addu r6,r17,r0                        |Check for this iteration status
0019edd8: 10400005 beq r2,r0,0x0019edf0                  #If Status is on Unit and won't fade or do not have a CT
0019eddc: 02c02021 addu r4,r22,r0                            |
0019ede0: 0c067bec jal 0x0019efb0                            |-->Check_if_Unit_will_get_his_Turn_without_Status Works only for charm don't move and don't act - returns 0x01 if Unit get a turn with status (or wrong status)
0019ede4: 02202821 addu r5,r17,r0                            |
0019ede8: 14400002 bne r2,r0,0x0019edf4                      #If Status won't fade  Keep status in cancelable data
0019edec: 00000000 nop                                           |
                                                        Else : Status will fade
0019edf0: 02138026 xor r16,r16,r19                           |Discard this status
0019edf4: 26520001 addiu r18,r18,0x0001                  |Status counter + 1
0019edf8: 2a420008 slti r2,r18,0x0008                    |
0019edfc: 1440ffed bne r2,r0,0x0019edb4              Λ Go through all statuses
0019ee00: 34070080 ori r7,r0,0x0080                      |restore bitmask
0019ee04: 34020001 ori r2,r0,0x0001                      |
                                                Status Set 1 2 or 3
0019ee08: 12820005 beq r20,r2,0x0019ee20             #If Set 2 go to dedicated section
0019ee0c: 34020002 ori r2,r0,0x0002                  |
0019ee10: 12820014 beq r20,r2,0x0019ee64             #If Set 3 go to dedicated section
0019ee14: 32020002 andi r2,r16,0x0002                |
0019ee18: 08067ba0 j 0x0019ee80                      >>Change/Check nothing if set 1 : jump to  check and confirm status infliction
0019ee1c: 00000000 nop                               |
                                                    Cancel status set 2
0019ee20: 32020008 andi r2,r16,0x0008                    |
0019ee24: 10400007 beq r2,r0,0x0019ee44                  #If Ability cancels [silence]
0019ee28: 32020020 andi r2,r16,0x0020                        |
0019ee2c: 92e2000c lbu r2,0x000c(r23)                        |Load Silenceable Ability Mod 8019f3c4 + 0x182c + 0x0c
0019ee30: 00000000 nop                                       |
0019ee34: 14400003 bne r2,r0,0x0019ee44                      #If Unit uses less than 25% of silencable abilities - discard silence
0019ee38: 32020020 andi r2,r16,0x0020                            |
0019ee3c: 3a100008 xori r16,r16,0x0008                           |Discard silence
0019ee40: 32020020 andi r2,r16,0x0020                            |
0019ee44: 1040000e beq r2,r0,0x0019ee80                  #If Ability cancels [Blind]
0019ee48: 00000000 nop                                       |
0019ee4c: 92e2000d lbu r2,0x000d(r23)                        |Load Evadable Ability Mod 8019f3c4 + 0x182c + 0x0d
0019ee50: 00000000 nop                                       |
0019ee54: 1440000a bne r2,r0,0x0019ee80                      #If Unit uses more than 25% evadable abilities - keep blind check and confirm status infliction
0019ee58: 00000000 nop                                       |
0019ee5c: 08067ba0 j 0x0019ee80                              >>Else : less than 25% evadable abilities - Discard Blind check and confirm status infliction
0019ee60: 3a100020 xori r16,r16,0x0020                       |Remove Blind
                                                    Cancel status set 3
0019ee64: 10400006 beq r2,r0,0x0019ee80                  #If Ability cancels [Frog]
0019ee68: 00000000 nop                                       |
0019ee6c: 92e20008 lbu r2,0x0008(r23)                        |Load Enemy Flag 8019f3c4 + 0x182c + 0x08
0019ee70: 00000000 nop                                       |
0019ee74: 10400002 beq r2,r0,0x0019ee80                      #If Unit is an All - keep frog 
0019ee78: 00000000 nop                                       |
                                                            Else : Unit is an Enemy : do not cancel frog
0019ee7c: 3a100002 xori r16,r16,0x0002                           |Remove Frog (Don't want to undo frog, now do we?)

                                                Check and Confirm
0019ee80: 1600001b bne r16,r0,0x0019eef0             #If Ability is canceling a status Exit and returns 0x01
0019ee84: 34020001 ori r2,r0,0x0001                      |
0019ee88: 26940001 addiu r20,r20,0x0001              |Next Cancel Status block
0019ee8c: 2a820005 slti r2,r20,0x0005                |
0019ee90: 1440ffb6 bne r2,r0,0x0019ed6c          Λ Loop 5 times
0019ee94: 03d41021 addu r2,r30,r20                   |Part of AI dynamic pointer 8019f3c4 + Status set offset
                                                                                                                           

                  ----XXX  AFFECT STATS SECTION XXX----
0019ee98: 8fc2000c lw r2,0x000c(r30)         |Considered  Ability  AI Flags 8019f3c4 - 0x0c to 0x0f
0019ee9c: 00000000 nop                       |
0019eea0: 30420008 andi r2,r2,0x0008         |
0019eea4: 1040000e beq r2,r0,0x0019eee0      #If Considered Ability has [Affect stats]
0019eea8: 34020076 ori r2,r0,0x0076              |
0019eeac: 87c30002 lh r3,0x0002(r30)             |load ability ID
0019eeb0: 00000000 nop                           |
0019eeb4: 10620005 beq r3,r2,0x0019eecc          #if Ability is [Praise] : branch to  RNG
0019eeb8: 34020092 ori r2,r0,0x0092                  |
0019eebc: 10620003 beq r3,r2,0x0019eecc          #if Ability is [Accumulate] : branch to  RNG
0019eec0: 34020096 ori r2,r0,0x0096                  |
0019eec4: 1462000a bne r3,r2,0x0019eef0          #if Ability is not Yell Exit and returns 0x01
0019eec8: 34020001 ori r2,r0,0x0001                  |
                                            RNG - Praise Accumulate or Yell
0019eecc: 0c0088c3 jal 0x0002230                 |-->Random Number Generator
0019eed0: 00000000 nop                           |
0019eed4: 30420001 andi r2,r2,0x0001             |
0019eed8: 10400005 beq r2,r0,0x0019eef0          #50% Chances of keeping Yell Accumulate or Praise  Exit and returns 0x01
0019eedc: 34020001 ori r2,r0,0x0001              |

                  ----XXX  UNEQUIP SECTION XXX----
0019eee0: 8fc2000c lw r2,0x000c(r30)         |Considered  Ability  AI Flags 8019f3c4 - 0x0c to 0x0f
0019eee4: 00000000 nop                       |
0019eee8: 30420004 andi r2,r2,0x0004         |Check if ability has [Unequip]
0019eeec: 0002102b sltu r2,r0,r2             |
0019eef0: 8fbf003c lw r31,0x003c(r29)
0019eef4: 8fbe0038 lw r30,0x0038(r29)
0019eef8: 8fb70034 lw r23,0x0034(r29)
0019eefc: 8fb60030 lw r22,0x0030(r29)
0019ef00: 8fb5002c lw r21,0x002c(r29)
0019ef04: 8fb40028 lw r20,0x0028(r29)
0019ef08: 8fb30024 lw r19,0x0024(r29)
0019ef0c: 8fb20020 lw r18,0x0020(r29)
0019ef10: 8fb1001c lw r17,0x001c(r29)
0019ef14: 8fb00018 lw r16,0x0018(r29)
0019ef18: 27bd0040 addiu r29,r29,0x0040
0019ef1c: 03e00008 jr r31
0019ef20: 00000000 nop

Return locations

BATTLE.BIN
 001956cc: Set AI ability considerations for all units and self
 0019b120: AI_ability_use_control_routine
 0019b944: AI_Targeting_Matrix_Analysis_(0019b7b8)
 0019e58c: See_if_any_unit_decided_to_use_an_ability