AI Ability Use Decisions

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
AI Ability Use
r4 = Caster ID
r5 = 0 or 1 (bypass reflect)
Return r2:
0 = Unusable
1 = OK to use
2 = Not OK to use
0019e5d8: 27bdffc0 addiu r29,r29,0xffc0
0019e5dc: afbe0038 sw r30,0x0038(r29)
0019e5e0: 3c1e801a lui r30,0x801a
0019e5e4: 27def3c4 addiu r30,r30,0xf3c4              r30 = AI data
0019e5e8: 000410c0 sll r2,r4,0x03
0019e5ec: 00441023 subu r2,r2,r4
0019e5f0: 00021180 sll r2,r2,0x06
0019e5f4: 3c038019 lui r3,0x8019
0019e5f8: 246308cc addiu r3,r3,0x08cc                r3 = Unit Data
0019e5fc: afb60030 sw r22,0x0030(r29)
0019e600: 0043b021 addu r22,r2,r3					r22 = Unit Data
0019e604: 00041100 sll r2,r4,0x04
0019e608: 2442182c addiu r2,r2,0x182c                r2 = decision data
0019e60c: afb70034 sw r23,0x0034(r29)
0019e610: 005eb821 addu r23,r2,r30                   r23 = decision data
0019e614: 3c02801a lui r2,0x801a
0019e618: 8c42f3d0 lw r2,-0x0c30(r2)				Load AI Ability Flags
0019e61c: 3c07801a lui r7,0x801a
0019e620: 90e7f3c5 lbu r7,-0x0c3b(r7)                Load Unit AI Pointer
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)
<Enemy/Ally Targeting>
0019e644: 00431024 and r2,r2,r3
0019e648: 10400005 beq r2,r0,0x0019e660	      Branch if ability cannot target enemies
0019e64c: afa70010 sw r7,0x0010(r29)
0019e650: 92e20008 lbu r2,0x0008(r23)                load enemy flag
0019e654: 00000000 nop
0019e658: 10400225 beq r2,r0,0x0019eef0              Exit and return as unusable if no enemy flag
0019e65c: 00001021 addu r2,r0,r0					
0019e660: 8fc2000c lw r2,0x000c(r30)                 load ability AI behavior flags
0019e664: 3c034000 lui r3,0x4000
0019e668: 00431024 and r2,r2,r3
0019e66c: 10400005 beq r2,r0,0x0019e684              <Target Self> if can target enemies
0019e670: 00000000 nop
0019e674: 92e20008 lbu r2,0x0008(r23)                load enemy flag
0019e678: 00000000 nop
0019e67c: 1440021c bne r2,r0,0x0019eef0             Exit and return as unusable if no enemy flag
0019e680: 00001021 addu r2,r0,r0
<Target Self>
0019e684: 93c20e2e lbu r2,0x0e2e(r30)                load acting unit id
0019e688: 00000000 nop
0019e68c: 1482000f bne r4,r2,0x0019e6cc              <Reflect Check> if unit is not self
0019e690: 00000000 nop
0019e694: 87c30002 lh r3,0x0002(r30)                 load ability ID
0019e698: 00000000 nop
0019e69c: 28620170 slti r2,r3,0x0170
0019e6a0: 1040000a beq r2,r0,0x0019e6cc	     <Reflect Check> if Ability is not a normal skill
0019e6a4: 000310c0 sll r2,r3,0x03
0019e6a8: 00431023 subu r2,r2,r3
0019e6ac: 00021040 sll r2,r2,0x01
0019e6b0: 3c018006 lui r1,0x8006
0019e6b4: 00220821 addu r1,r1,r2
0019e6b8: 9022fbf4 lbu r2,-0x040c(r1)               load ability flags
0019e6bc: 00000000 nop
0019e6c0: 30420001 andi r2,r2,0x0001
0019e6c4: 1440020a bne r2,r0,0x0019eef0             Exit and return as unusable because you can't hit yourself with this spell
0019e6c8: 00001021 addu r2,r0,r0
<Reflect Check>
0019e6cc: 10a0000b beq r5,r0,0x0019e6fc				Bypass Reflect Check <Faith Check>
0019e6d0: 00000000 nop
0019e6d4: 8fc2000c lw r2,0x000c(r30)				Load Usage
0019e6d8: 00000000 nop
0019e6dc: 30424000 andi r2,r2,0x4000
0019e6e0: 10400006 beq r2,r0,0x0019e6fc             <Faith Check> if not reflectable
0019e6e4: 02c02821 addu r5,r22,r0					Get Unit Data Pointer
0019e6e8: 8fa40010 lw r4,0x0010(r29)				Get Clockticks
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				Unit has Reflect, don't use
0019e6f8: 00001021 addu r2,r0,r0
<Faith Check>
0019e6fc: 8fc2000c lw r2,0x000c(r30)				Load Usage
0019e700: 00000000 nop
0019e704: 30420400 andi r2,r2,0x0400
0019e708: 10400006 beq r2,r0,0x0019e724              <Jump Check> if not faith ability
0019e70c: 02c02821 addu r5,r22,r0
0019e710: 8fa40010 lw r4,0x0010(r29)
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				Unit has Innocent, don't use
0019e720: 00001021 addu r2,r0,r0
<Jump Check>
0019e724: 8fa40010 lw r4,0x0010(r29)
0019e728: 02c02821 addu r5,r22,r0
0019e72c: 0c067bc9 jal 0x0019ef2					Check if Status Should/Can be Added
0019e730: 34060005 ori r6,r0,0x0005					Check for Jump
0019e734: 144001ee bne r2,r0,0x0019eef0				Unit is Jumping, don't use
0019e738: 00001021 addu r2,r0,r0
<If Dead>
0019e73c: 8fc2000c lw r2,0x000c(r30)			Load Usage
0019e740: 00000000 nop
0019e744: 30420020 andi r2,r2,0x0020
0019e748: 10400005 beq r2,r0,0x0019e760        <Dead with Reraise> if this ability doesn't cancel status
0019e74c: 0000a021 addu r20,r0,r0
0019e750: 93c20007 lbu r2,0x0007(r30)          load status infliction 1
0019e754: 00000000 nop
0019e758: 30420020 andi r2,r2,0x0020
0019e75c: 0002a02b sltu r20,r0,r2              r20 = Unit is dead or spell will add dead
<Dead with Reraise>
0019e760: 92e20007 lbu r2,0x0007(r23)          load type of target
0019e764: 00000000 nop
0019e768: 30420040 andi r2,r2,0x0040
0019e76c: 10400009 beq r2,r0,0x0019e794        <Dead> if unit doesn't have reraise as well
0019e770: 00000000 nop
0019e774: 93d00001 lbu r16,0x0001(r30)         load CT
0019e778: 0c0666e6 jal 0x00199b98				Calculate Clockticks Until Unit Acts
0019e77c: 02c02021 addu r4,r22,r0
0019e780: 0202802a slt r16,r16,r2
0019e784: 1600003e bne r16,r0,0x0019e880		Don't use this ability because unit will get up before then
0019e788: 00000000 nop
0019e78c: 168001d8 bne r20,r0,0x0019eef0		Unit is dead but has reraise, don't revive
0019e790: 00001021 addu r2,r0,r0
<Dead>
0019e794: 92e20007 lbu r2,0x0007(r23)
0019e798: 00000000 nop
0019e79c: 30420020 andi r2,r2,0x0020
0019e7a0: 10400009 beq r2,r0,0x0019e7c8        	<If Petrified> if not even dead
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
0019e7b0: 02c02021 addu r4,r22,r0				r4 = Unit Data
0019e7b4: 0050102a slt r2,r2,r16
0019e7b8: 14400031 bne r2,r0,0x0019e880			It's too late to revive this unit (Won't be able to go off in time)		
0019e7bc: 00000000 nop
0019e7c0: 128001cb beq r20,r0,0x0019eef0		Ability doesn't cure Dead, don't use
0019e7c4: 00001021 addu r2,r0,r0
<If Petrified>
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 Wall> if not petrified
0019e7d8: 02c02821 addu r5,r22,r0
0019e7dc: 8fc2000c lw r2,0x000c(r30)			Load AI Ability Flags
0019e7e0: 00000000 nop
0019e7e4: 30420020 andi r2,r2,0x0020
0019e7e8: 104001c1 beq r2,r0,0x0019eef0         Ability doesn't cure Petrify, don't use
0019e7ec: 00001021 addu r2,r0,r0
0019e7f0: 93c20008 lbu r2,0x0008(r30)           load status infliction 2
0019e7f4: 00000000 nop
0019e7f8: 30420080 andi r2,r2,0x0080
0019e7fc: 104001bc beq r2,r0,0x0019eef0         Ability doesn't use Petrify, don't use
0019e800: 00001021 addu r2,r0,r0
<If Wall>
0019e804: 8fa40010 lw r4,0x0010(r29)
0019e808: 0c067bc9 jal 0x0019ef2				Check if Status Should/Can be Added
0019e80c: 3406001f ori r6,r0,0x001f				Check for Wall
0019e810: 1040000b beq r2,r0,0x0019e840			<Elemental Null> if unit doesn't have wall
0019e814: 00000000 nop
0019e818: 8fc2000c lw r2,0x000c(r30)
0019e81c: 00000000 nop
0019e820: 30420020 andi r2,r2,0x0020
0019e824: 104001b2 beq r2,r0,0x0019eef0           Ability doesn't cancel Wall, don't use
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           Ability doesn't cancel Wall, don't use
0019e83c: 00001021 addu r2,r0,r0
<Elemental Null>
0019e840: 93d40010 lbu r20,0x0010(r30)             load ability elements
0019e844: 00000000 nop
0019e848: 1280000f beq r20,r0,0x0019e888			<Undead Reverse> if no elements
0019e84c: 00000000 nop
0019e850: 92c2006e lbu r2,0x006e(r22)             Load target elemental nullification
0019e854: 00000000 nop
0019e858: 02821024 and r2,r20,r2
0019e85c: 12820008 beq r20,r2,0x0019e880			This unit blocks the element, don't use this ability
0019e860: 34020008 ori r2,r0,0x0008
<Float>
0019e864: 16820008 bne r20,r2,0x0019e888			Skip Float Evaluation if not 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           	<Undead Reverse> if not float
0019e87c: 00000000 nop
0019e880: 08067bbc j 0x0019eef0						Unit has float, don't use ability
0019e884: 00001021 addu r2,r0,r0
<Target Enemies>
<Undead Reverse>
0019e888: 8fc3000c lw r3,0x000c(r30)
0019e88c: 00000000 nop
0019e890: 30620002 andi r2,r3,0x0002
0019e894: 10400074 beq r2,r0,0x0019ea68            <Target Allies> if not target enemies
0019e898: 30622000 andi r2,r3,0x2000
0019e89c: 1040000f beq r2,r0,0x0019e8dc            <Elemental Absorb> if this ability doesn't reverse on undead
0019e8a0: 00000000 nop
0019e8a4: 92e20008 lbu r2,0x0008(r23)
0019e8a8: 00000000 nop
0019e8ac: 10400004 beq r2,r0,0x0019e8c0            <Healing Undead Ally> if ally
0019e8b0: 00000000 nop
0019e8b4: 92c20058 lbu r2,0x0058(r22)			Load Current Status 1
0019e8b8: 08067a3f j 0x0019e8fc					
0019e8bc: 30420010 andi r2,r2,0x0010             r2 = undead check
<Healing Undead Ally>
0019e8c0: 92c20058 lbu r2,0x0058(r22)			Current Status 1
0019e8c4: 00000000 nop
0019e8c8: 30420010 andi r2,r2,0x0010
0019e8cc: 14400050 bne r2,r0,0x0019ea10           <HP Ability> if ally = undead
0019e8d0: 00000000 nop
0019e8d4: 08067bbc j 0x0019eef0					Ally isn't Undead, this will hurt them
0019e8d8: 34020002 ori r2,r0,0x0002
<Elemental Absorb>
0019e8dc: 92e20008 lbu r2,0x0008(r23)         load enemy flag
0019e8e0: 00000000 nop
0019e8e4: 10400009 beq r2,r0,0x0019e90c       <Charmed Ally> if Ally
0019e8e8: 02c02821 addu r5,r22,r0
0019e8ec: 92c2006d lbu r2,0x006d(r22)        Elemental absorb
0019e8f0: 93c30010 lbu r3,0x0010(r30)         load ability elements
0019e8f4: 00000000 nop
0019e8f8: 00431024 and r2,r2,r3               absorbs & elements
0019e8fc: 10400044 beq r2,r0,0x0019ea10       <HP Ability> if no elements being absorbed by enemies/Enemy is undead
0019e900: 34020002 ori r2,r0,0x0002
0019e904: 08067bbc j 0x0019eef0					Don't use this ability because it'll heal them
0019e908: 00000000 nop
<Charmed Ally>
0019e90c: 8fa40010 lw r4,0x0010(r29)			
0019e910: 0c067bc9 jal 0x0019ef2				Check if Status Should/Can be Added
0019e914: 34060022 ori r6,r0,0x0022				Check for Charm
0019e918: 10400005 beq r2,r0,0x0019e930			Branch if unit doesn't have any Charm
0019e91c: 02c02021 addu r4,r22,r0
0019e920: 0c067bec jal 0x0019efb0				Check if Charm, Don't Act or Move can be added before unit acts
0019e924: 34050022 ori r5,r0,0x0022				Check for Charm
0019e928: 14400002 bne r2,r0,0x0019e934			Branch if it can be removed in time
0019e92c: 34140001 ori r20,r0,0x0001			Charm is present
0019e930: 0000a021 addu r20,r0,r0				Target has no Charm
0019e934: 8fc2000c lw r2,0x000c(r30)        	Load AI Flags    
0019e938: 00000000 nop
0019e93c: 30420080 andi r2,r2,0x0080
0019e940: 10400015 beq r2,r0,0x0019e998         <Elemental Healing> if not hp affecting ability (Why?)
0019e944: 00000000 nop
0019e948: 93c20000 lbu r2,0x0000(r30)           load skillset
0019e94c: 3c018006 lui r1,0x8006
0019e950: 00220821 addu r1,r1,r2
0019e954: 90235cb4 lbu r3,0x5cb4(r1)             load action byte
0019e958: 3402000a ori r2,r0,0x000a
0019e95c: 1062000e beq r3,r2,0x0019e998         <Elemental Healing> if Charge
0019e960: 00000000 nop
<Break Confuse>
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         Break Confuse
0019e974: 34020001 ori r2,r0,0x0001
<Break Sleep>
0019e978: 8fa40010 lw r4,0x0010(r29)
0019e97c: 02c02821 addu r5,r22,r0
0019e980: 0c067bc9 jal 0x0019ef2				Check if Status Should/Can be Added
0019e984: 34060023 ori r6,r0,0x0023				Check for Sleep
0019e988: 14400046 bne r2,r0,0x0019eaa4			Break Sleep
0019e98c: 00000000 nop
<Break Charm>
0019e990: 16800157 bne r20,r0,0x0019eef0		Break Charm with this ability
0019e994: 34020001 ori r2,r0,0x0001
<Elemental Healing>
0019e998: 92c2006d lbu r2,0x006d(r22)           Elemental absorb
0019e99c: 93c30010 lbu r3,0x0010(r30)           load elements
0019e9a0: 00000000 nop
0019e9a4: 00431024 and r2,r2,r3                	elements & absorbs
0019e9a8: 10400006 beq r2,r0,0x0019e9c4         <Don't Attack Ally> if unit doesn't absorb this element
0019e9ac: 00000000 nop
0019e9b0: 92e20007 lbu r2,0x0007(r23)           AI Decision Flag
0019e9b4: 00000000 nop
0019e9b8: 30420001 andi r2,r2,0x0001
0019e9bc: 1440014c bne r2,r0,0x0019eef0         Heal this unit if they have >50% HP
0019e9c0: 34020001 ori r2,r0,0x0001
<Don't Attack Ally>
0019e9c4: 92c20059 lbu r2,0x0059(r22)			Load Current Status 2
0019e9c8: 00000000 nop
0019e9cc: 30420014 andi r2,r2,0x0014
0019e9d0: 14400003 bne r2,r0,0x0019e9e0         <Disable Ally> if confusion or blood suck
0019e9d4: 00000000 nop
0019e9d8: 12800145 beq r20,r0,0x0019eef0		No reason to attack an ally then
0019e9dc: 34020002 ori r2,r0,0x0002
<Disable Ally>
0019e9e0: 8fc2000c lw r2,0x000c(r30)       
0019e9e4: 00000000 nop
0019e9e8: 30420010 andi r2,r2,0x0010
0019e9ec: 1040ffb9 beq r2,r0,0x0019e8d4         Branch to Exit if no add status; No reason to use this on an ally (Why branch all the way up there?)
0019e9f0: 3c031c06 lui r3,0x1c06                 Sleep, Don't Move, Don't Act, Slow and Stop
0019e9f4: 8fc20008 lw r2,0x0008(r30)
0019e9f8: 00000000 nop
0019e9fc: 00431024 and r2,r2,r3
0019ea00: 1440013b bne r2,r0,0x0019eef0          Use only these statuses to deal with Confused/Blood Suck Allies
0019ea04: 34020001 ori r2,r0,0x0001
0019ea08: 08067bbc j 0x0019eef0					Don't use any other status
0019ea0c: 34020002 ori r2,r0,0x0002				
<HP Ability>
0019ea10: 8fc2000c lw r2,0x000c(r30)
0019ea14: 00000000 nop
0019ea18: 30420080 andi r2,r2,0x0080
0019ea1c: 10400006 beq r2,r0,0x0019ea38          <MP Ability> if not HP affecting
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
0019ea34: 34020001 ori r2,r0,0x0001
<MP Ability>
0019ea38: 8fc2000c lw r2,0x000c(r30)            
0019ea3c: 00000000 nop
0019ea40: 30420040 andi r2,r2,0x0040
0019ea44: 10400007 beq r2,r0,0x0019ea64          <Target Allies> if not MP affecting
0019ea48: 00000000 nop
0019ea4c: 96c3002c lhu r3,0x002c(r22)           Load mp
0019ea50: 92e2000a lbu r2,0x000a(r23)            load lowest mp cost
0019ea54: 00000000 nop
0019ea58: 0043102b sltu r2,r2,r3
0019ea5c: 14400124 bne r2,r0,0x0019eef0          This unit has enough MP to cast his lowest MP ability
0019ea60: 34020001 ori r2,r0,0x0001
<Target Allies>
0019ea64: 8fc3000c lw r3,0x000c(r30)
0019ea68: 00000000 nop
0019ea6c: 30620001 andi r2,r3,0x0001
0019ea70: 10400036 beq r2,r0,0x0019eb4c          <Target Ally and Enemy> if not target allies
0019ea74: 30622000 andi r2,r3,0x2000
0019ea78: 1040000f beq r2,r0,0x0019eab8          <Allied Ability> if no Undead Reverse
0019ea7c: 00000000 nop
0019ea80: 92e20008 lbu r2,0x0008(r23)            load enemy flag
0019ea84: 00000000 nop
0019ea88: 10400008 beq r2,r0,0x0019eaac          <Allied Ability> if Ally
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          This unit isn't undead, no reason to heal this enemy
0019eaa0: 34020002 ori r2,r0,0x0002
0019eaa4: 08067bbc j 0x0019eef0					Heal Undead for damage
0019eaa8: 34020001 ori r2,r0,0x0001
<Allied Ability>
0019eaac: 92c20058 lbu r2,0x0058(r22)				Load Current Status 1
0019eab0: 08067aaf j 0x0019eabc						Jump to check
0019eab4: 30420010 andi r2,r2,0x0010                undead check
0019eab8: 92e20008 lbu r2,0x0008(r23)
0019eabc: 00000000 nop
0019eac0: 1440010b bne r2,r0,0x0019eef0             Don't heal Enemy/Undead Ally
0019eac4: 34020002 ori r2,r0,0x0002
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             <Heal HP> if not death sentence
0019ead8: 00000000 nop
0019eadc: 8fc3000c lw r3,0x000c(r30)				Load AI Flags
0019eae0: 00000000 nop
0019eae4: 30630010 andi r3,r3,0x0010
0019eae8: 10600101 beq r3,r0,0x0019eef0            Don't use this ability because it doesn't add Reraise
0019eaec: 00001021 addu r2,r0,r0					
0019eaf0: 93c20009 lbu r2,0x0009(r30)				Load Inflicted Status 3
0019eaf4: 08067bbb j 0x0019eeec						Check if Reraise before exiting
0019eaf8: 30420020 andi r2,r2,0x0020                
<Heal HP>
0019eafc: 8fc2000c lw r2,0x000c(r30)
0019eb00: 00000000 nop
0019eb04: 30420080 andi r2,r2,0x0080
0019eb08: 10400006 beq r2,r0,0x0019eb24              <Heal MP> if not HP ability
0019eb0c: 00000000 nop
0019eb10: 92e20007 lbu r2,0x0007(r23)				Load AI Targeting
0019eb14: 00000000 nop
0019eb18: 30420001 andi r2,r2,0x0001
0019eb1c: 144000f4 bne r2,r0,0x0019eef0             Heal unit if low hp (less than 50%)
0019eb20: 34020001 ori r2,r0,0x0001
<Heal MP>
0019eb24: 8fc2000c lw r2,0x000c(r30)
0019eb28: 00000000 nop
0019eb2c: 30420040 andi r2,r2,0x0040
0019eb30: 10400006 beq r2,r0,0x0019eb4c            <Target Ally and Enemy> if ability doesn't affect MP
0019eb34: 00000000 nop
0019eb38: 92e20007 lbu r2,0x0007(r23)
0019eb3c: 00000000 nop
0019eb40: 30420002 andi r2,r2,0x0002
0019eb44: 144000ea bne r2,r0,0x0019eef0            Heal unit's MP if low mp (less than 50%)
0019eb48: 34020001 ori r2,r0,0x0001
<Target Ally and Enemy>
0019eb4c: 8fc3000c lw r3,0x000c(r30)
0019eb50: 00000000 nop
0019eb54: 30620003 andi r2,r3,0x0003
0019eb58: 14400006 bne r2,r0,0x0019eb74            <Adding Status> if target enemies or target allies
0019eb5c: 30620080 andi r2,r3,0x0080
0019eb60: 144000e3 bne r2,r0,0x0019eef0            This ability deals damage so it's fine to use
0019eb64: 34020001 ori r2,r0,0x0001
0019eb68: 30620040 andi r2,r3,0x0040
0019eb6c: 144000e0 bne r2,r0,0x0019eef0            This ability deals MP Damage so it's fine to use
0019eb70: 34020001 ori r2,r0,0x0001
<Adding status>
0019eb74: 8fc2000c lw r2,0x000c(r30)
0019eb78: 00000000 nop
0019eb7c: 30420010 andi r2,r2,0x0010
0019eb80: 10400073 beq r2,r0,0x0019ed50            <Cancel Status> if no add status
0019eb84: 00000000 nop
0019eb88: 0000a021 addu r20,r0,r0
0019eb8c: 03d41021 addu r2,r30,r20
0019eb90: 02d41821 addu r3,r22,r20
0019eb94: 90500007 lbu r16,0x0007(r2)				Load Inflicted Status List
0019eb98: 90620058 lbu r2,0x0058(r3)              load 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          <Status++> if inflicting status that's already there/no status in that block
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			<Status++> if unit is immune to status/no statuses in that block
0019ebc4: 34020002 ori r2,r0,0x0002
0019ebc8: 1282001f beq r20,r2,0x0019ec48			<Current Status 3>
0019ebcc: 2a820003 slti r2,r20,0x0003
0019ebd0: 10400005 beq r2,r0,0x0019ebe8				<Current Status 4 and 5>
0019ebd4: 34020001 ori r2,r0,0x0001
0019ebd8: 1282000a beq r20,r2,0x0019ec04			Go to <Current Status 2>
0019ebdc: 32020008 andi r2,r16,0x0008				Check for Silence
0019ebe0: 08067b4e j 0x0019ed38						<Confirm Status>
0019ebe4: 00000000 nop
<Current Status 4 and 5>
0019ebe8: 34020003 ori r2,r0,0x0003
0019ebec: 1282002e beq r20,r2,0x0019eca8			<Current Status 4>
0019ebf0: 34020004 ori r2,r0,0x0004
0019ebf4: 1282004a beq r20,r2,0x0019ed20			<Current Status 5>
0019ebf8: 00000000 nop
0019ebfc: 08067b4e j 0x0019ed38						<Confirm Status>
0019ec00: 00000000 nop
<Current Status 2>
<Silence>
0019ec04: 10400007 beq r2,r0,0x0019ec24				<Blind> if not Silenced
0019ec08: 32020020 andi r2,r16,0x0020				Check for Blind
0019ec0c: 92e2000c lbu r2,0x000c(r23)               Load Silenceable Abilities Modifier
0019ec10: 00000000 nop
0019ec14: 14400003 bne r2,r0,0x0019ec24             <Blind> if Target has any Silenceable ability (Silence Modifier)
0019ec18: 32020020 andi r2,r16,0x0020				Check for Blind
0019ec1c: 3a100008 xori r16,r16,0x0008				Remove Silence because unit doesn't have Silenceable abilities
0019ec20: 32020020 andi r2,r16,0x0020				Check for Blind
<Blind>
0019ec24: 10400044 beq r2,r0,0x0019ed38				<Confirm Status> if not adding Blind			
0019ec28: 00000000 nop
0019ec2c: 92e2000d lbu r2,0x000d(r23)               load Evadable Abilities Modifier
0019ec30: 00000000 nop
0019ec34: 2c420002 sltiu r2,r2,0x0002               
0019ec38: 1040003f beq r2,r0,0x0019ed38             <Confirm Status> if Evade Mod > 1 (Greater than 25% of abilities learned)
0019ec3c: 00000000 nop
0019ec40: 08067b4e j 0x0019ed38						<Confirm Status>		
0019ec44: 3a100020 xori r16,r16,0x0020				Remove Blind because Unit doesn't have enough Evadable abilities
<Current Status 3>
<Reraise>
0019ec48: 32020020 andi r2,r16,0x0020
0019ec4c: 10400008 beq r2,r0,0x0019ec70				<Frog> if not adding 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              <Frog> if low hp (>50%) unit
0019ec64: 32020002 andi r2,r16,0x0002				Check for Frog
0019ec68: 3a100020 xori r16,r16,0x0020				Don't add Reraise if not at 50% HP or less
0019ec6c: 32020002 andi r2,r16,0x0002				Check for Frog
<Frog>
0019ec70: 10400006 beq r2,r0,0x0019ec8c				<Float> if not adding Frog
0019ec74: 00000000 nop
0019ec78: 92e20008 lbu r2,0x0008(r23)                load enemy flag
0019ec7c: 00000000 nop
0019ec80: 14400002 bne r2,r0,0x0019ec8c              <Float> if enemy
0019ec84: 00000000 nop
0019ec88: 3a100002 xori r16,r16,0x0002				Remove Frog (don't turn your allies into frogs I guess)
<Float>
0019ec8c: 92e20007 lbu r2,0x0007(r23)                 
0019ec90: 00000000 nop
0019ec94: 30420080 andi r2,r2,0x0080
0019ec98: 14400027 bne r2,r0,0x0019ed38              <Confirm Status> if critical hp unit
0019ec9c: 00000000 nop
0019eca0: 08067b4e j 0x0019ed38						<Confirm Status>
0019eca4: 321000bf andi r16,r16,0x00bf				Don't add Float unless critical (lol)
<Current Status 4>
<Regen>
0019eca8: 32020040 andi r2,r16,0x0040
0019ecac: 10400007 beq r2,r0,0x0019eccc				<Protect/Shell/Wall> if not adding Regen
0019ecb0: 00000000 nop
0019ecb4: 92e20007 lbu r2,0x0007(r23)                
0019ecb8: 00000000 nop
0019ecbc: 30420001 andi r2,r2,0x0001
0019ecc0: 14400002 bne r2,r0,0x0019eccc              <Protect/Shell/Wall> if low hp unit
0019ecc4: 00000000 nop
0019ecc8: 3a100040 xori r16,r16,0x0040				Remove Regen (Don't add Regen unless at 50% or less HP)
<Protect/Shell/Wall>
0019eccc: 92e20007 lbu r2,0x0007(r23)
0019ecd0: 00000000 nop
0019ecd4: 30420080 andi r2,r2,0x0080
0019ecd8: 14400003 bne r2,r0,0x0019ece8             <Haste/Slow> if critical hp unit
0019ecdc: 3202000c andi r2,r16,0x000c				Check for Haste/Slow
0019ece0: 321000ce andi r16,r16,0x00ce				Remove Protect/Shell/Wall (Don't add Protect/Shell/Wall unless Critical)
0019ece4: 3202000c andi r2,r16,0x000c				Check for Haste/Slow
<Haste/Slow>
0019ece8: 10400013 beq r2,r0,0x0019ed38				<Confirm Status> if not adding Haste/Slow
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          	Branch to remove/not add Haste/Slow if 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          	<Confirm Status> if not sleep
0019ed14: 00000000 nop
0019ed18: 08067b4e j 0x0019ed38						<Confirm Status>
0019ed1c: 321000f3 andi r16,r16,0x00f3				Remove Haste/Slow
<Current Status 5>
<Faith/Reflect>
0019ed20: 92e20007 lbu r2,0x0007(r23)
0019ed24: 00000000 nop
0019ed28: 30420080 andi r2,r2,0x0080
0019ed2c: 14400002 bne r2,r0,0x0019ed38             <Confirm Status> if critical hp unit
0019ed30: 00000000 nop
0019ed34: 3210007d andi r16,r16,0x007d				Remove Faith and Reflect (Don't add Faith/Reflect unless critical)
<Confirm Status>
0019ed38: 1600006d bne r16,r0,0x0019eef0			Ability is adding a status
0019ed3c: 34020001 ori r2,r0,0x0001
<Status++>
0019ed40: 26940001 addiu r20,r20,0x0001				Next Status Block
0019ed44: 2a820005 slti r2,r20,0x0005				
0019ed48: 1440ff91 bne r2,r0,0x0019eb90				Loop until Current Status 5
0019ed4c: 03d41021 addu r2,r30,r20
</Add Status>
<Cancel Status>
0019ed50: 8fc2000c lw r2,0x000c(r30)
0019ed54: 00000000 nop
0019ed58: 30420020 andi r2,r2,0x0020
0019ed5c: 1040004e beq r2,r0,0x0019ee98          <Affect Stats> if not cancel status
0019ed60: 00000000 nop
0019ed64: 0000a021 addu r20,r0,r0
0019ed68: 03d41021 addu r2,r30,r20
0019ed6c: 02d41821 addu r3,r22,r20
0019ed70: 90500007 lbu r16,0x0007(r2)            load status infliction
0019ed74: 90620058 lbu r2,0x0058(r3)             load current status
0019ed78: 00000000 nop
0019ed7c: 02028024 and r16,r16,r2
0019ed80: 12000041 beq r16,r0,0x0019ee88         <Cancel++> if unit doesn't have statuses to be removed
0019ed84: 00000000 nop
0019ed88: 9062004e lbu r2,0x004e(r3)             load innate status
0019ed8c: 00000000 nop
0019ed90: 02021024 and r2,r16,r2
0019ed94: 02028026 xor r16,r16,r2
0019ed98: 1200003b beq r16,r0,0x0019ee88        <Cancel++> if unit's status is innate and cannot be removed
0019ed9c: 2a820003 slti r2,r20,0x0003
0019eda0: 14400019 bne r2,r0,0x0019ee08			<Cancel Status 1 - 3>
0019eda4: 34020001 ori r2,r0,0x0001
<Cancel Status 4 and 5>
0019eda8: 00009021 addu r18,r0,r0
0019edac: 0014a8c0 sll r21,r20,0x03				r21 = Cancel Status
0019edb0: 34070080 ori r7,r0,0x0080				r7 = 0x0080
0019edb4: 02479807 srav r19,r7,r18				r19 = 80 >> Current Status (0 - 4)			
0019edb8: 02131024 and r2,r16,r19
0019edbc: 1040000d beq r2,r0,0x0019edf4			<Next Status> if not Canceling that status
0019edc0: 00000000 nop
0019edc4: 8fa40010 lw r4,0x0010(r29)
0019edc8: 02c02821 addu r5,r22,r0
0019edcc: 02b28821 addu r17,r21,r18
0019edd0: 0c067bc9 jal 0x0019ef2				Check if Status Should/Can be Added
0019edd4: 02203021 addu r6,r17,r0				Check for [current status]
0019edd8: 10400005 beq r2,r0,0x0019edf0			Remove Cancel Status if status can't be removed/isn't there
0019eddc: 02c02021 addu r4,r22,r0				
0019ede0: 0c067bec jal 0x0019efb0				Check if Charm, Don't Act or Don't Move can be added/removed? before unit acts
0019ede4: 02202821 addu r5,r17,r0
0019ede8: 14400002 bne r2,r0,0x0019edf4			<Next Status> if all statuses, but especially Charm/Don't Act/Don't Move can be removed in time
0019edec: 00000000 nop
0019edf0: 02138026 xor r16,r16,r19				Remove Cancel Status if status can't be removed/isn't there/Can't be removed in time
<Next Status>
0019edf4: 26520001 addiu r18,r18,0x0001
0019edf8: 2a420008 slti r2,r18,0x0008
0019edfc: 1440ffed bne r2,r0,0x0019edb4			Go through all statuses
0019ee00: 34070080 ori r7,r0,0x0080
0019ee04: 34020001 ori r2,r0,0x0001
<Cancel Status 1 - 3>
0019ee08: 12820005 beq r20,r2,0x0019ee20		<Cancel Status 2>
0019ee0c: 34020002 ori r2,r0,0x0002
0019ee10: 12820014 beq r20,r2,0x0019ee64		<Cancel Status 3>
0019ee14: 32020002 andi r2,r16,0x0002
0019ee18: 08067ba0 j 0x0019ee80					<Confirm Cancel> (Nothing special for Cancel Status 1)
0019ee1c: 00000000 nop
<Cancel Status 2>
<Silence>
0019ee20: 32020008 andi r2,r16,0x0008
0019ee24: 10400007 beq r2,r0,0x0019ee44				<Blind> if ability doesn't cancel Silence
0019ee28: 32020020 andi r2,r16,0x0020				Check for Blind
0019ee2c: 92e2000c lbu r2,0x000c(r23)				Load Silenceable Ability Mod
0019ee30: 00000000 nop
0019ee34: 14400003 bne r2,r0,0x0019ee44             <Blind> if unit has any silenceable abilities
0019ee38: 32020020 andi r2,r16,0x0020				Check for Blind
0019ee3c: 3a100008 xori r16,r16,0x0008				Remove Silence
0019ee40: 32020020 andi r2,r16,0x0020				Check for Blind
<Blind>
0019ee44: 1040000e beq r2,r0,0x0019ee80				<Confirm Cancel> if not cancel Blind
0019ee48: 00000000 nop
0019ee4c: 92e2000d lbu r2,0x000d(r23) 				Load Evadable Ability Mod
0019ee50: 00000000 nop
0019ee54: 1440000a bne r2,r0,0x0019ee80             <Confirm Cancel> if unit has any evadeable abilities
0019ee58: 00000000 nop
0019ee5c: 08067ba0 j 0x0019ee80						<Confirm Cancel>
0019ee60: 3a100020 xori r16,r16,0x0020				Remove Blind
<Cancel Status 3>
0019ee64: 10400006 beq r2,r0,0x0019ee80				<Confirm Cancel> if no cancel Frog
0019ee68: 00000000 nop
0019ee6c: 92e20008 lbu r2,0x0008(r23)         		Load Enemy Flag     
0019ee70: 00000000 nop
0019ee74: 10400002 beq r2,r0,0x0019ee80             <Confirm Cancel> if ally
0019ee78: 00000000 nop
0019ee7c: 3a100002 xori r16,r16,0x0002				Remove Frog (Don't want to undo frog, now do we?)
<Confirm Cancel>
0019ee80: 1600001b bne r16,r0,0x0019eef0			Ability is canceling a status
0019ee84: 34020001 ori r2,r0,0x0001
<Cancel++>
0019ee88: 26940001 addiu r20,r20,0x0001				Next Cancel Status block
0019ee8c: 2a820005 slti r2,r20,0x0005
0019ee90: 1440ffb6 bne r2,r0,0x0019ed6c				Branch if Cancel Status 5
0019ee94: 03d41021 addu r2,r30,r20
</Cancel Status>
<Affect Stats>
0019ee98: 8fc2000c lw r2,0x000c(r30)                load usage flags
0019ee9c: 00000000 nop
0019eea0: 30420008 andi r2,r2,0x0008
0019eea4: 1040000e beq r2,r0,0x0019eee0             <Unequip> if not affecting 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             Branch to RNG if Praise
0019eeb8: 34020092 ori r2,r0,0x0092
0019eebc: 10620003 beq r3,r2,0x0019eecc             Branch to RNG if Accumulate
0019eec0: 34020096 ori r2,r0,0x0096
0019eec4: 1462000a bne r3,r2,0x0019eef0             Skip RNG if not Yell
0019eec8: 34020001 ori r2,r0,0x0001
0019eecc: 0c0088c3 jal 0x0002230		    Random Number Generator
0019eed0: 00000000 nop
0019eed4: 30420001 andi r2,r2,0x0001
0019eed8: 10400005 beq r2,r0,0x0019eef0             Use Praise, Accumulate, and Yell randomly (!)
0019eedc: 34020001 ori r2,r0,0x0001
<Unequip>
0019eee0: 8fc2000c lw r2,0x000c(r30)              
0019eee4: 00000000 nop
0019eee8: 30420004 andi r2,r2,0x0004              Check if ability is Unequip
0019eeec: 0002102b sltu r2,r0,r2                  Use Ability if true
<Exit>
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