Difference between revisions of "Attack Finalisation & Reaction Flagging"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
m
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
  Main Reaction Routine (carries out a ton of functions)
+
  Finalize attacking, set final hp/mp/stats/status change, check for golem, statuses caused by changing unit stats, if valid for exp/jp earning,
0018be08: 27bdffc8 addiu r29,r29,0xffc8
+
  flag valid target reactions
0018be0c: afb20030 sw r18,0x0030(r29)
+
  See [[#FinalizeShort|Summary]]
0018be10: 00809021 addu r18,r4,r0              r18 = target ID
+
  ------------------------------------------------------------------------------------------------------------
0018be14: afb00028 sw r16,0x0028(r29)
+
  Parameters : r4 = Targeted Unit ID
0018be18: 00008021 addu r16,r0,r0
 
0018be1c: 2a420015 slti r2,r18,0x0015
 
0018be20: afbf0034 sw r31,0x0034(r29)
 
0018be24: 10400013 beq r2,r0,0x0018be74        branch if invalid ID
 
0018be28: afb1002c sw r17,0x002c(r29)
 
  0018be2c: 001218c0 sll r3,r18,0x03
 
  0018be30: 00721823 subu r3,r3,r18
 
  0018be34: 00031980 sll r3,r3,0x06
 
  0018be38: 3c028019 lui r2,0x8019
 
0018be3c: 244208cc addiu r2,r2,0x08cc Target Unit Data
 
0018be40: 00622021 addu r4,r3,r2
 
0018be44: 2442018c addiu r2,r2,0x018c
 
0018be48: 00622821 addu r5,r3,r2
 
0018be4c: 3c018019 lui r1,0x8019
 
0018be50: a03238c1 sb r18,0x38c1(r1) store target unit ID
 
0018be54: 3c018019 lui r1,0x8019
 
0018be58: ac242d98 sw r4,0x2d98(r1) store target data pointer
 
0018be5c: 3c018019 lui r1,0x8019
 
0018be60: ac252d90 sw r5,0x2d90(r1) store target action pointer
 
0018be64: 90830001 lbu r3,0x0001(r4)
 
0018be68: 340200ff ori r2,r0,0x00ff
 
0018be6c: 14620003 bne r3,r2,0x0018be7c        branch if target exists
 
0018be70: 00000000 nop
 
0018be74: 08063199 j 0x0018c664
 
0018be78: 2402ffff addiu r2,r0,0xffff
 
 
   
 
   
  0018be7c: 90820058 lbu r2,0x0058(r4) Load First Set of Current Status
+
  Returns r2 = -0x01 if killing blow or crystal on a riding unit
  0018be80: 00000000 nop
+
        r2 = 0x00 in any other case
  0018be84: 30420020 andi r2,r2,0x0020
+
------------------------------------------------------------------------------------------------------------
  0018be88: 1040000f beq r2,r0,0x0018bec8     Branch if unit is not dead?
+
0018be08: 27bdffc8 addiu r29,r29,-0x0038    |
  0018be8c: 00000000 nop
+
0018be0c: afb20030 sw r18,0x0030(r29)      |
  0018be90: 90a2001b lbu r2,0x001b(r5) status infliction 1
+
0018be10: 00809021 addu r18,r4,r0          |{{f/std|<nowiki>r18 = Targeted Unit ID</nowiki>}}
  0018be94: 00000000 nop
+
0018be14: afb00028 sw r16,0x0028(r29)       |
  0018be98: 30420040 andi r2,r2,0x0040
+
  0018be18: 00008021 addu r16,r0,r0          |{{f/std|<nowiki>r16 = 0x00 (Action flag for Xp routine)</nowiki>}}
  0018be9c: 14400006 bne r2,r0,0x0018beb8     branch if crystal inflicted
+
  0018be1c: 2a420015 slti r2,r18,0x0015      |{{f/std|<nowiki>r2 = 0x01 If Targeted Unit ID < 0x15</nowiki>}}
  0018bea0: 02402021 addu r4,r18,r0
+
0018be20: afbf0034 sw r31,0x0034(r29)      |
  0018bea4: 90a2001c lbu r2,0x001c(r5) status infliction 2
+
  0018be24: 10400013 beq r2,r0,0x0018be74    {{f/Cond|If Targeted Unit ID is valid (< 0x15)}} /Else Branch to
  0018bea8: 00000000 nop
+
  0018be28: afb1002c sw r17,0x002c(r29)          |
  0018beac: 30420001 andi r2,r2,0x0001
+
  0018be2c: 001218c0 sll r3,r18,0x03              |{{f/std|ID * 8}}
  0018beb0: 10400005 beq r2,r0,0x0018bec8     branch if treasure inflicted
+
  0018be30: 00721823 subu r3,r3,r18              |{{f/std|ID * 7}}
  0018beb4: 00000000 nop
+
  0018be34: 00031980 sll r3,r3,0x06              |{{f/std|ID * 0x1c0 (Unit Data offset)}}
  0018beb8: 0c06381f jal 0x0018e07c [[Post Ability Hardcoding?]]
+
0018be38: 3c028019 lui r2,0x8019                |
  0018bebc: 00002821 addu r5,r0,r0
+
  0018be3c: 244208cc addiu r2,r2,0x08cc          |{{f/std|<nowiki>r2 = 0x801908cc (Start of unit data pointer)</nowiki>}}
  0018bec0: 08063199 j 0x0018c664 jump to end
+
  0018be40: 00622021 addu r4,r3,r2                |{{f/adr|<nowiki>r4 = Targeted Unit Data pointer</nowiki>}}
  0018bec4: 00001021 addu r2,r0,r0
+
  0018be44: 2442018c addiu r2,r2,0x018c          |{{f/std|<nowiki>r2 = 0x801908cc + 0x18c (Unit 0x00 current action data pointer)</nowiki>}}
 +
0018be48: 00622821 addu r5,r3,r2                |{{f/adr|<nowiki>r5 = Targeted Unit current action data pointer </nowiki>}}
 +
  0018be4c: 3c018019 lui r1,0x8019                |
 +
  0018be50: a03238c1 sb r18,0x38c1(r1)            |{{f/store|Store Targeted Unit ID at current ability 0x801938c1 (Target Unit ID)}} {{f/std| 801938c1}}
 +
0018be54: 3c018019 lui r1,0x8019                |
 +
  0018be58: ac242d98 sw r4,0x2d98(r1)            |{{f/store|Store Targeted Unit data pointer at 0x80192d98}}
 +
0018be5c: 3c018019 lui r1,0x8019                |
 +
  0018be60: ac252d90 sw r5,0x2d90(r1)            |{{f/store|Store Targeted Unit Current action data pointer at 0x80192d90}}
 +
  0018be64: 90830001 lbu r3,0x0001(r4)            |{{f/load|<nowiki>r3 = Targeted Unit ID</nowiki>}} {{f/std|<nowiki> This ID may be = 0xff if unit doesn't exists anymore</nowiki>}}
 +
  0018be68: 340200ff ori r2,r0,0x00ff            |{{f/std|<nowiki>r2 = 0x0ff</nowiki>}}
 +
0018be6c: 14620003 bne r3,r2,0x0018be7c        {{f/Cond|If Targeted Unit ID doesn't exists anymore}}
 +
0018be70: 00000000 nop                              |
 +
  0018be74: 08063199 j 0x0018c664             {{f/Cond|E    }} {{f/jump|Jump to }} {{f/loc| END }}  r2 = -0x01
 +
  0018be78: 2402ffff addiu r2,r0,-0x01                |{{f/std|<nowiki>r2 = -0x01</nowiki>}}
 
   
 
   
  0018bec8: 3c028019 lui r2,0x8019
+
          {{f/loc|Unit ID is Valid and Unit Exists}}
  0018becc: 8c42f5f0 lw r2,-0x0a10(r2)
+
  0018be7c: 90820058 lbu r2,0x0058(r4)        |{{f/load|<nowiki>r2 = Targeted Unit 1st set of current status</nowiki>}}
  0018bed0: 00000000 nop
+
0018be80: 00000000 nop                      |
  0018bed4: 14400005 bne r2,r0,0x0018beec        Branch if reacting
+
  0018be84: 30420020 andi r2,r2,0x0020        |{{f/std|<nowiki>r2 = 0x20 if Targeted Unit is dead</nowiki>}}
  0018bed8: 34020001 ori r2,r0,0x0001
+
0018be88: 1040000f beq r2,r0,0x0018bec8    {{f/Cond|If Targeted  Unit is Dead}}
  0018bedc: 3c038019 lui r3,0x8019
+
0018be8c: 00000000 nop                          |
  0018bee0: 8c632d98 lw r3,0x2d98(r3) Load Defender's Data
+
0018be90: 90a2001b lbu r2,0x001b(r5)            |{{f/load|<nowiki>r2 = Targeted Unit current action Status infliction 1</nowiki>}}
  0018bee4: 00000000 nop
+
  0018be94: 00000000 nop                         |
  0018bee8: a0620189 sb r2,0x0189(r3) store defender hit by ability?
+
  0018be98: 30420040 andi r2,r2,0x0040            |{{f/std|<nowiki>r2 = 0x40 if Crystal is inflicted</nowiki>}}
 +
  0018be9c: 14400006 bne r2,r0,0x0018beb8        {{f/Cond|If Crystal is not going to be inflicted}}
 +
  0018bea0: 02402021 addu r4,r18,r0              |{{f/std|<nowiki>r4 = Targeted Unit ID</nowiki>}}
 +
  0018bea4: 90a2001c lbu r2,0x001c(r5)               |{{f/load|<nowiki>r2 = Targeted Unit current action Status infliction 2</nowiki>}}
 +
  0018bea8: 00000000 nop                             |
 +
0018beac: 30420001 andi r2,r2,0x0001                |{{f/std|<nowiki>r2 = 0x01 if Treasure is inflicted</nowiki>}}
 +
  0018beb0: 10400005 beq r2,r0,0x0018bec8            {{f/Cond|If Treasure is going to be inflicted}}
 +
0018beb4: 00000000 nop                                  |
 +
0018beb8: 0c06381f jal 0x0018e07c              {{f/Cond|E }}    | {{f/jal|Post Ability Hardcoding?|Post Ability Hardcoding?}} Resolve status infliction
 +
0018bebc: 00002821 addu r5,r0,r0                        |{{f/std|<nowiki>r5 = 0x00</nowiki>}}
 +
0018bec0: 08063199 j 0x0018c664                        {{f/jump|Jump to }} {{f/loc| END }}  r2 = 0x00
 +
0018bec4: 00001021 addu r2,r0,r0                        |{{f/std|<nowiki>r2 = 0x00</nowiki>}}
 
   
 
   
0018beec: 0c0632c0 jal 0x0018cb00 [[Sunken State, Caution, Dragon Spirit, etc. usability]]
+
          {{f/loc|Unit not Dead, or dead but not going to be crystalized / treasurized}}
0018bef0: 00000000 nop
+
0018bec8: 3c028019 lui r2,0x8019                        |
0018bef4: 3c058019 lui r5,0x8019
+
0018becc: 8c42f5f0 lw r2,-0x0a10(r2)        |{{f/load|<nowiki>r2 = Type of action</nowiki>}} {{f/std| 8018f5f0}}
0018bef8: 8ca52d90 lw r5,0x2d90(r5) Load Defender's Current Action Data
+
0018bed0: 00000000 nop                      |
0018befc: 00000000 nop
+
0018bed4: 14400005 bne r2,r0,0x0018beec    {{f/Cond|<nowiki>If This is not a reaction (  0x8018f5f0 = 0x00 )</nowiki>}}
0018bf00: 84a3000e lh r3,0x000e(r5) Load Reaction ID
+
0018bed8: 34020001 ori r2,r0,0x0001            |{{f/std|<nowiki>r2 = 0x01</nowiki>}}
0018bf04: 340201c2 ori r2,r0,0x01c2
+
0018bedc: 3c038019 lui r3,0x8019                |
0018bf08: 14620006 bne r3,r2,0x0018bf24 Branch if Reaction ID isn't Catch
+
0018bee0: 8c632d98 lw r3,0x2d98(r3)            |{{f/adr|<nowiki>r3 = Targeted Unit data pointer</nowiki>}}
0018bf0c: 00000000 nop
+
0018bee4: 00000000 nop                          |
+
0018bee8: a0620189 sb r2,0x0189(r3)            |{{f/store|<nowiki>Set Targeted Unit 0x189 = 0x01 (Turn ended)</nowiki>}} {{f/std| Unit 0x189}}
0018bf10: 3c048019 lui r4,0x8019
+
0018beec: 0c0632c0 jal 0x0018cb00          |{{f/jal|Sunken_State,_Caution,_Dragon_Spirit,_counters,_absorbs_usability|Sunken_State,_Caution,_Dragon_Spirit,_counters,_absorbs_usability}} Roll one of thoses reaction abilities if enabled
0018bf14: 8c842d98 lw r4,0x2d98(r4) Load Target Data
+
0018bef0: 00000000 nop                      |(If Succesful store ability ID in TCA 0x0e - And info at TCA 0x26  aka Unit 0x19a and unit 0x1b2)
0018bf18: 90a50026 lbu r5,0x0026(r5) Load Last Attack?
+
0018bef4: 3c058019 lui r5,0x8019            |
0018bf1c: 0c063a7a jal 0x0018e9e8 [[Item quantity increment for steal/break?|Store Caught Item in Inventory]]
+
0018bef8: 8ca52d90 lw r5,0x2d90(r5)        |{{f/adr|<nowiki>r5 = TCA data pointer</nowiki>}}
0018bf20: 00000000 nop
+
0018befc: 00000000 nop                      |
+
0018bf00: 84a3000e lh r3,0x000e(r5)        |{{f/load|<nowiki>r3 = TCA Reaction Ability ID</nowiki>}}
0018bf24: 3c048019 lui r4,0x8019
+
0018bf04: 340201c2 ori r2,r0,0x01c2        |{{f/std|<nowiki>r2 = 0x1c2</nowiki>}}
0018bf28: 8c842d90 lw r4,0x2d90(r4) Load Defender's Current Action Data
+
0018bf08: 14620006 bne r3,r2,0x0018bf24    {{f/Cond|If Targeted Unit reaction is Catch}}
0018bf2c: 00000000 nop
+
0018bf0c: 00000000 nop                          |{{f/std|}}
0018bf30: 90820000 lbu r2,0x0000(r4) Load Hit Flag
+
 
0018bf34: 00000000 nop
 
0018bf38: 104001ca beq r2,r0,0x0018c664 Branch if Attack Missed
 
0018bf3c: 00001021 addu r2,r0,r0
 
 
0018bf40: 94830010 lhu r3,0x0010(r4) load special flags
 
0018bf44: 00000000 nop
 
0018bf48: 30628000 andi r2,r3,0x8000 Reducing golem amount?
 
0018bf4c: 10400013 beq r2,r0,0x0018bf9c branch if not reducing golem HP
 
0018bf50: 30620001 andi r2,r3,0x0001 Summoning golem flag
 
0018bf54: 3c028019 lui r2,0x8019
 
0018bf58: 8c422d98 lw r2,0x2d98(r2) Load Defender's Data
 
0018bf5c: 00000000 nop
 
0018bf60: 904201ba lbu r2,0x01ba(r2) modified ENTD flags
 
0018bf64: 3c038019 lui r3,0x8019
 
0018bf68: 2463f5f4 addiu r3,r3,0xf5f4
 
0018bf6c: 30420030 andi r2,r2,0x0030 enemy team check
 
0018bf70: 000210c2 srl r2,r2,0x03
 
0018bf74: 00432821 addu r5,r2,r3
 
0018bf78: 94a30000 lhu r3,0x0000(r5) Load Golem HP
 
0018bf7c: 84820004 lh r2,0x0004(r4) Load HP Damage
 
 
  0018c668: 8fb20030 lw r18,0x0030(r29)
 
  0018c668: 8fb20030 lw r18,0x0030(r29)
 
  0018c66c: 8fb1002c lw r17,0x002c(r29)
 
  0018c66c: 8fb1002c lw r17,0x002c(r29)
Line 572: Line 560:
 
  0018c674: 27bd0038 addiu r29,r29,0x0038
 
  0018c674: 27bd0038 addiu r29,r29,0x0038
 
  0018c678: 03e00008 jr r31
 
  0018c678: 03e00008 jr r31
  0018c67c: 00000000 no
+
  0018c67c: 00000000 nop
 
+
=== Notes ===
 
+
  - If Target is Dead and about to get crystalized or treasurized : <span id="FinalizeShort"></span>
== Return Locations ==
+
            '''finalize status infliction and exit routine'''
 +
 
 +
  - if 0x8018f5f0 = 0x00 set Target 0x189 to 0x01 (what for ?)
 +
 
 +
  - Check Sunken state, Caution, Dragon spirit, Brave Up, Face Up, Counter Tackle, Counter Flood, Absorb MP, Counter, Counter Magic.. via dedicated routine (one only)
 +
  - Check for Catch and deals with inventory with catched item
 +
  - Golem Mechanics :
 +
          - if special flag 0x8000 is ON reduce Golem HP
 +
          - if special flag 0x0001 is ON enable Team golem
 +
  - Check MP switch, Distribute, Damage split via dedicated routine (one only)
 +
  - Set updated Target minimum HP and MP to 0
 +
  - Cap updated Target HP and MP to Maximum HP and MP
 +
  - Deals with Stat alteration (Speed, CT, PA,MA, Brave, Faith)
 +
  - Finalize Stealing and breaking:
 +
        - check for special flag 0x0010 and 0x0004
 +
        - Unequip Target (update stats)
 +
        - Increase inventory if stolen
 +
  - Refund katana if not broken (special flag 0x0008)
 +
  - Store stolen gil if any
 +
  - Apply stolen Xp gain (+/- Lv Up)
 +
  - Seems to resolve a Jp bonus mechanics(on TCA 0x29) and deals with Job lv gain
 +
  - Apply Lv Up (special flag 0x0080) or Lv down (special flags 0x0100)
 +
  - Run Poach and update inventory (special flag 0x0020)
 +
  - Check for morbol (special flag 0x0002) and prep morbolization (supress a bunch of status data)
 +
  - If dealing a killing blow :
 +
        -delete all action status infliction/removal and inflict dead only
 +
        -finalize status and '''deal with xp gain and exit'''
 +
  - Else :
 +
        - Check if Target becomes critical and update Target current action (TCA) status infliction
 +
        - If Target is not critical, add critical in TCA status removal
 +
        - If Target Brave is < 10 update TCA status infliction with chicken
 +
        - If Target Brave is >= 10 Add Chicken to TCA status removal
 +
        - If Action deals HP damage :
 +
                  - Add Transparent to TCA status removal
 +
                  - Add Confusion to TCA status removal
 +
        - If Action inflict KnockBack
 +
                  - Add Charge to TCA status removal is Target is charging via Charge skillset         
 +
        - Finalize Status infliction/removal
 +
        - Determine if action fail / hit / kill and go to Attackers earned xp routine
 +
        - [[PA_Save,_MA_Save,_Speed_Save_Regenerator,_HP_Restore,_MP_Restore,_Critical_Quick,_Meatbone_Slash,_Auto_Potion,_Gilgame_Heart_check]]
  
  00070f6c: [[In between turn events]]
+
=== Return location ===
  0007201c: [[Main Post Movement]]
+
'''Battle.bin'''
  00073c3c: [[Set some target coordinates/attacker animation, others]]
+
  00070f44: [[In between turn events]]
  00076724: [[00076658 - 00076918]]
+
  00070f74: [[In between turn events]]
  0018d784: [[Store target stats pointer data]]
+
00072024: [[Main Post Movement]]
  0018df6c: [[Prep gained exp/jp/level/job level]]
+
  00072228: [[Main_Post_Movement]]
  0019d5d0: [[AI Act phase handling (in between turn, end of turn, etc.)]]
+
00073c44: [[Set some target coordinates/attacker animation, others]]
 +
  0007672c: [[00076658 - 00076918|Learn from crystal related]]
 +
  0018d78c: [[Store target stats pointer data]]
 +
  0018df74: [[Prep gained exp/jp/level/job level]]
 +
  0019d5d8: [[AI Act phase handling (in between turn, end of turn, etc.)]]
 +
0019df24: [[AI_ability_processing]]

Latest revision as of 12:55, 25 November 2022

Finalize attacking, set final hp/mp/stats/status change, check for golem, statuses caused by changing unit stats, if valid for exp/jp earning,
flag valid target reactions
See Summary 
------------------------------------------------------------------------------------------------------------
Parameters : r4 = Targeted Unit ID

Returns r2 = -0x01 if killing blow or crystal on a riding unit
        r2 = 0x00 in any other case
------------------------------------------------------------------------------------------------------------
0018be08: 27bdffc8 addiu r29,r29,-0x0038    |
0018be0c: afb20030 sw r18,0x0030(r29)       |
0018be10: 00809021 addu r18,r4,r0           |r18 = Targeted Unit ID
0018be14: afb00028 sw r16,0x0028(r29)       |
0018be18: 00008021 addu r16,r0,r0           |r16 = 0x00 (Action flag for Xp routine)
0018be1c: 2a420015 slti r2,r18,0x0015       |r2 = 0x01 If Targeted Unit ID < 0x15
0018be20: afbf0034 sw r31,0x0034(r29)       |
0018be24: 10400013 beq r2,r0,0x0018be74     #If Targeted Unit ID is valid (< 0x15) /Else Branch to 
0018be28: afb1002c sw r17,0x002c(r29)           |
0018be2c: 001218c0 sll r3,r18,0x03              |ID * 8
0018be30: 00721823 subu r3,r3,r18               |ID * 7
0018be34: 00031980 sll r3,r3,0x06               |ID * 0x1c0 (Unit Data offset)
0018be38: 3c028019 lui r2,0x8019                |
0018be3c: 244208cc addiu r2,r2,0x08cc           |r2 = 0x801908cc (Start of unit data pointer)
0018be40: 00622021 addu r4,r3,r2                |r4 = Targeted Unit Data pointer
0018be44: 2442018c addiu r2,r2,0x018c           |r2 = 0x801908cc + 0x18c (Unit 0x00 current action data pointer)
0018be48: 00622821 addu r5,r3,r2                |r5 = Targeted Unit current action data pointer 
0018be4c: 3c018019 lui r1,0x8019                |
0018be50: a03238c1 sb r18,0x38c1(r1)            |Store Targeted Unit ID at current ability 0x801938c1 (Target Unit ID)  801938c1
0018be54: 3c018019 lui r1,0x8019                |
0018be58: ac242d98 sw r4,0x2d98(r1)             |Store Targeted Unit data pointer at 0x80192d98
0018be5c: 3c018019 lui r1,0x8019                |
0018be60: ac252d90 sw r5,0x2d90(r1)             |Store Targeted Unit Current action data pointer at 0x80192d90
0018be64: 90830001 lbu r3,0x0001(r4)            |r3 = Targeted Unit ID  This ID may be = 0xff if unit doesn't exists anymore
0018be68: 340200ff ori r2,r0,0x00ff             |r2 = 0x0ff
0018be6c: 14620003 bne r3,r2,0x0018be7c         #If Targeted Unit ID doesn't exists anymore
0018be70: 00000000 nop                              |
0018be74: 08063199 j 0x0018c664             #E      >>Jump to   END   r2 = -0x01
0018be78: 2402ffff addiu r2,r0,-0x01                |r2 = -0x01

         Unit ID is Valid and Unit Exists
0018be7c: 90820058 lbu r2,0x0058(r4)        |r2 = Targeted Unit 1st set of current status
0018be80: 00000000 nop                      |
0018be84: 30420020 andi r2,r2,0x0020        |r2 = 0x20 if Targeted Unit is dead
0018be88: 1040000f beq r2,r0,0x0018bec8     #If Targeted  Unit is Dead
0018be8c: 00000000 nop                          |
0018be90: 90a2001b lbu r2,0x001b(r5)            |r2 = Targeted Unit current action Status infliction 1
0018be94: 00000000 nop                          |
0018be98: 30420040 andi r2,r2,0x0040            |r2 = 0x40 if Crystal is inflicted
0018be9c: 14400006 bne r2,r0,0x0018beb8         #If Crystal is not going to be inflicted
0018bea0: 02402021 addu r4,r18,r0               |r4 = Targeted Unit ID
0018bea4: 90a2001c lbu r2,0x001c(r5)                |r2 = Targeted Unit current action Status infliction 2
0018bea8: 00000000 nop                              |
0018beac: 30420001 andi r2,r2,0x0001                |r2 = 0x01 if Treasure is inflicted
0018beb0: 10400005 beq r2,r0,0x0018bec8             #If Treasure is going to be inflicted
0018beb4: 00000000 nop                                  |
0018beb8: 0c06381f jal 0x0018e07c               #E      | -->Post Ability Hardcoding? Resolve status infliction
0018bebc: 00002821 addu r5,r0,r0                        |r5 = 0x00
0018bec0: 08063199 j 0x0018c664                         >>Jump to   END   r2 = 0x00
0018bec4: 00001021 addu r2,r0,r0                        |r2 = 0x00

         Unit not Dead, or dead but not going to be crystalized / treasurized
0018bec8: 3c028019 lui r2,0x8019                        |
0018becc: 8c42f5f0 lw r2,-0x0a10(r2)        |r2 = Type of action  8018f5f0
0018bed0: 00000000 nop                      |
0018bed4: 14400005 bne r2,r0,0x0018beec     #If This is not a reaction (  0x8018f5f0 = 0x00 )
0018bed8: 34020001 ori r2,r0,0x0001             |r2 = 0x01
0018bedc: 3c038019 lui r3,0x8019                |
0018bee0: 8c632d98 lw r3,0x2d98(r3)             |r3 = Targeted Unit data pointer
0018bee4: 00000000 nop                          |
0018bee8: a0620189 sb r2,0x0189(r3)             |Set Targeted Unit 0x189 = 0x01 (Turn ended)  Unit 0x189
0018beec: 0c0632c0 jal 0x0018cb00           |-->Sunken_State,_Caution,_Dragon_Spirit,_counters,_absorbs_usability Roll one of thoses reaction abilities if enabled
0018bef0: 00000000 nop                      |(If Succesful store ability ID in TCA 0x0e - And info at TCA 0x26  aka Unit 0x19a and unit 0x1b2)
0018bef4: 3c058019 lui r5,0x8019            |
0018bef8: 8ca52d90 lw r5,0x2d90(r5)         |r5 = TCA data pointer
0018befc: 00000000 nop                      |
0018bf00: 84a3000e lh r3,0x000e(r5)         |r3 = TCA Reaction Ability ID
0018bf04: 340201c2 ori r2,r0,0x01c2         |r2 = 0x1c2
0018bf08: 14620006 bne r3,r2,0x0018bf24     #If Targeted Unit reaction is Catch
0018bf0c: 00000000 nop                          |
0018bf10: 3c048019 lui r4,0x8019                |
0018bf14: 8c842d98 lw r4,0x2d98(r4)             |r4 = Targeted Unit data pointer
0018bf18: 90a50026 lbu r5,0x0026(r5)            |r5 = TCA reaction info (catched item ID)
0018bf1c: 0c063a7a jal 0x0018e9e8               |-->Store Caught Item in Inventory
0018bf20: 00000000 nop                          |
0018bf24: 3c048019 lui r4,0x8019            |r4 = 0x80190000
0018bf28: 8c842d90 lw r4,0x2d90(r4)         |r4 = TCA data pointer
0018bf2c: 00000000 nop                      |
0018bf30: 90820000 lbu r2,0x0000(r4)        |r2 = TCA hit flag
0018bf34: 00000000 nop                      |
0018bf38: 104001ca beq r2,r0,0x0018c664     #If Attack do not miss /Else branch to END (r2 = 0x00)
0018bf3c: 00001021 addu r2,r0,r0            |r2 = 0x00
0018bf40: 94830010 lhu r3,0x0010(r4)            |r3 = TCA specials flags
0018bf44: 00000000 nop                          |
0018bf48: 30628000 andi r2,r3,0x8000            |r2 = 0x80 if flag reducing golem amount is enabled
0018bf4c: 10400013 beq r2,r0,0x0018bf9c         #If Attacks triggers Golem
0018bf50: 30620001 andi r2,r3,0x0001            |r2 = Summon golem flag
0018bf54: 3c028019 lui r2,0x8019                    |
0018bf58: 8c422d98 lw r2,0x2d98(r2)                 |r2 = Targeted Unit Data Pointer
0018bf5c: 00000000 nop                              |
0018bf60: 904201ba lbu r2,0x01ba(r2)                |r2 = Modified ENTD flags
0018bf64: 3c038019 lui r3,0x8019                    |
0018bf68: 2463f5f4 addiu r3,r3,-0x0a0c              |r3 = 0x8018f5f4  Team golem amounts
0018bf6c: 30420030 andi r2,r2,0x0030                |r2 = Team ID
0018bf70: 000210c2 srl r2,r2,0x03                   |r2 = Team ID /8
0018bf74: 00432821 addu r5,r2,r3                    |r5 = 0x8018f5f4 + Team offset
0018bf78: 94a30000 lhu r3,0x0000(r5)                |r3 = Team Golem HP
0018bf7c: 84820004 lh r2,0x0004(r4)                 |r2 = TCA HP dmg
0018bf80: 00000000 nop                              |
0018bf84: 00628823 subu r17,r3,r2                   |r17 = New Golem HP
0018bf88: 06210002 bgez r17,0x0018bf94              #If New Golem HP < 0
0018bf8c: 00001021 addu r2,r0,r0                    |r2 = 0x00
0018bf90: 00008821 addu r17,r0,r0                       |Golem HP = 0
0018bf94: 08063199 j 0x0018c664                     >>jump to END with r2 = 0x00
0018bf98: a4b10000 sh r17,0x0000(r5)                |store new Golem HP
0018bf9c: 1040000b beq r2,r0,0x0018bfcc         #If Action is summon golem
0018bfa0: 00000000 nop                              |
0018bfa4: 3c028019 lui r2,0x8019                    |
0018bfa8: 8c422d98 lw r2,0x2d98(r2)                 |r2 = Targeted Unit Data Pointer
0018bfac: 34100001 ori r16,r0,0x0001                |r16 = 0x01
0018bfb0: 90430005 lbu r3,0x0005(r2)                |r3 = Targeted Unit ENTD flags
0018bfb4: 9442002a lhu r2,0x002a(r2)                |r2 = Targeted Unit Max HP
0018bfb8: 30630030 andi r3,r3,0x0030                |r3 = Targeted Unit Team
0018bfbc: 000318c2 srl r3,r3,0x03                   |r3 = Team ID / 8
0018bfc0: 3c018019 lui r1,0x8019                    |
0018bfc4: 00230821 addu r1,r1,r3                    |r1 = 0x80190000 + Team's golem offset
0018bfc8: a422f5f4 sh r2,-0x0a0c(r1)                |Store Targeted Unit Max HP as Team's Golem HP 8018f5f4 + Team offset
0018bfcc: 0c06330d jal 0x0018cc34               |-->MP Switch, Distribute, and Damage Split usability Check and Roll one of those if enabled
0018bfd0: 00000000 nop                          |
0018bfd4: 3c058019 lui r5,0x8019                |
0018bfd8: 8ca52d98 lw r5,0x2d98(r5)             |r5 = Targeted Unit Data pointer
0018bfdc: 3c048019 lui r4,0x8019                |
0018bfe0: 8c842d90 lw r4,0x2d90(r4)             |r4 = TCA data pointer
0018bfe4: 94a70028 lhu r7,0x0028(r5)            |r7 = Targeted Unit current HP
0018bfe8: 84820004 lh r2,0x0004(r4)             |r2 = TCA HP damage
0018bfec: 84830006 lh r3,0x0006(r4)             |r3 = TCA HP recovery
0018bff0: 00e21023 subu r2,r7,r2                |r2 = Targeted Unit Current HP - HP damage
0018bff4: 00438821 addu r17,r2,r3               |r17 = Targeted Unit Current HP - HP damage + HP recovery
0018bff8: 06210002 bgez r17,0x0018c004          #If Targeted Unit new HP < 0
0018bffc: 00000000 nop                              |
0018c000: 00008821 addu r17,r0,r0                   |r17 = 0x00
0018c004: 94a3002a lhu r3,0x002a(r5)            |r3 = Targeted Unit Max HP
0018c008: 00000000 nop                          |
0018c00c: 0071102a slt r2,r3,r17                |r2 = 0x01 If Targeted Unit max HP < New HP
0018c010: 10400002 beq r2,r0,0x0018c01c         #If Targeted Unit is overhealed
0018c014: 00000000 nop                              |
0018c018: 00608821 addu r17,r3,r0                   |r17 = Targeted Unit max HP
0018c01c: 94a6002c lhu r6,0x002c(r5)            |r6 = Targeted Unit Current MP
0018c020: 84820008 lh r2,0x0008(r4)             |r2 = TCA MP damage
0018c024: 8483000a lh r3,0x000a(r4)             |r3 = TCA MP recovery
0018c028: 00c21023 subu r2,r6,r2                |r2 = Current MP - MP damage
0018c02c: 00431821 addu r3,r2,r3                |r3 = New MP (Damaged MP + MP recovery)
0018c030: 04610002 bgez r3,0x0018c03c           #If Targeted Unit new MP < 0
0018c034: 00000000 nop                              |
0018c038: 00001821 addu r3,r0,r0                    |r3 = 0x00 (new MP)
0018c03c: 94a4002e lhu r4,0x002e(r5)            |r4 = Targeted Unit Max MP
0018c040: 00000000 nop                          |
0018c044: 0083102a slt r2,r4,r3                 |r2 = 0x01 If Targeted Unit max MP < new MP
0018c048: 10400002 beq r2,r0,0x0018c054         #If Targeted Unit MP is overhealed
0018c04c: 00000000 nop                              |
0018c050: 00801821 addu r3,r4,r0                    |r3 = Max MP (new MP)
0018c054: 14f10003 bne r7,r17,0x0018c064        #If There is no HP modification (Current HP = New HP) /Else branch (set r16 = 0x01)
0018c058: 00000000 nop                              |
0018c05c: 10c30003 beq r6,r3,0x0018c06c             #If There is MP modification /Else Branch (keeps r16 = 0x00)
0018c060: 34060032 ori r6,r0,0x0032                 |r6 = 0x32 (speed cap)
0018c064: 34100001 ori r16,r0,0x0001            #E      | r16 = 0x01
0018c068: 34060032 ori r6,r0,0x0032                     |r6 = 0x32 (speed cap)
0018c06c: 3c058019 lui r5,0x8019                |
0018c070: 8ca52d98 lw r5,0x2d98(r5)             |r5 = Targeted Unit data pointer
0018c074: 3c028019 lui r2,0x8019                |
0018c078: 8c422d90 lw r2,0x2d90(r2)             |r2 = TCA data pointer
0018c07c: 34070001 ori r7,r0,0x0001             |r7 = 0x01 (minimum allowed speed value)
0018c080: a4b10028 sh r17,0x0028(r5)            |Store Targeted Unit new HP as Current HP
0018c084: a4a3002c sh r3,0x002c(r5)             |Store Targeted Unit new MP as Current MP
0018c088: 90440012 lbu r4,0x0012(r2)            |r4 = TCA Speed Change
0018c08c: 0c06355c jal 0x0018d570               |-->Stat_Increment/Decrement Return r2 = 0x01 if speed has been changed
0018c090: 24a50032 addiu r5,r5,0x0032           |r5 = Targeted Unit data pointer + 0x32  Raw speed data pointer
0018c094: 02028025 or r16,r16,r2                |r16 = 0x00 if nothing is done yet (HP, MP, Speed, Golem)
0018c098: 340600ff ori r6,r0,0x00ff             |r6 = 0x0ff (max CT value)
0018c09c: 00003821 addu r7,r0,r0                |r7 = 0x00 (min CT value)
0018c0a0: 3c028019 lui r2,0x8019                |
0018c0a4: 8c422d90 lw r2,0x2d90(r2)             |r2 = TCA data pointer
0018c0a8: 3c058019 lui r5,0x8019                |
0018c0ac: 8ca52d98 lw r5,0x2d98(r5)             |r5 = Targeted Unit data pointer
0018c0b0: 90440013 lbu r4,0x0013(r2)            |r4 = TCA CT change
0018c0b4: 0c06355c jal 0x0018d570               |-->Stat Increment/Decrement Returns r2 = 0x01 if CT has been changed
0018c0b8: 24a50039 addiu r5,r5,0x0039           |r5 = Targeted Unit CT data pointer
0018c0bc: 02028025 or r16,r16,r2                |r16 <> 0x00 if something has been done
0018c0c0: 34060063 ori r6,r0,0x0063             |r6 = 0x63 (PA max Cap)
0018c0c4: 34070001 ori r7,r0,0x0001             |r7 = 0x01 (PA minimum value)
0018c0c8: 3c028019 lui r2,0x8019                |
0018c0cc: 8c422d90 lw r2,0x2d90(r2)             |r2 = TCA data pointer
0018c0d0: 3c058019 lui r5,0x8019                |
0018c0d4: 8ca52d98 lw r5,0x2d98(r5)             |r5 = Targeted Unit data pointer
0018c0d8: 90440014 lbu r4,0x0014(r2)            |r4 = TCA PA change
0018c0dc: 0c06355c jal 0x0018d570               |-->Stat Increment/Decrement Returns r2 = 0x01 if PA has been changed
0018c0e0: 24a50030 addiu r5,r5,0x0030           |r5 = Targeted Unit raw PA data pointer
0018c0e4: 02028025 or r16,r16,r2                |r16 <> 0x00 if something has been done
0018c0e8: 34060063 ori r6,r0,0x0063             |r6 = 0x63 (MA max Cap)
0018c0ec: 34070001 ori r7,r0,0x0001             |r7 = 0x01 (MA minimum value)
0018c0f0: 3c028019 lui r2,0x8019                |
0018c0f4: 8c422d90 lw r2,0x2d90(r2)             |r2 = TCA data pointer
0018c0f8: 3c058019 lui r5,0x8019                |
0018c0fc: 8ca52d98 lw r5,0x2d98(r5)             |r5 = Targeted Unit data pointer
0018c100: 90440015 lbu r4,0x0015(r2)            |r4 = TCA MA change
0018c104: 0c06355c jal 0x0018d570               |-->Stat Increment/Decrement Returns r2 = 0x01 if MA has been changed
0018c108: 24a50031 addiu r5,r5,0x0031           |r5 = Targeted Unit raw PA data pointer
0018c10c: 02028025 or r16,r16,r2                |r16 <> 0x00 if something has been done
0018c110: 34060064 ori r6,r0,0x0064             |r6 = 0x64 (Brave cap)
0018c114: 3c038019 lui r3,0x8019                |
0018c118: 8c632d98 lw r3,0x2d98(r3)             |r3 = Targeted Unit data pointer
0018c11c: 3c028019 lui r2,0x8019                |
0018c120: 8c422d90 lw r2,0x2d90(r2)             |r2 = TCA data pointer
0018c124: 24650024 addiu r5,r3,0x0024           |r5 = Targeted Unit brave data pointer
0018c128: 90670182 lbu r7,0x0182(r3)            |r7 = Targeted Unit Mount Info
0018c12c: 90440016 lbu r4,0x0016(r2)            |r4 = TCA brave change
0018c130: 000739c2 srl r7,r7,0x07               |r7 = 0x01 if Targeted Unit is ridding a Unit
0018c134: 00073823 subu r7,r0,r7                |r7 = -0x01 if Targeted Unit is riding
0018c138: 0c06355c jal 0x0018d570               |-->Stat Increment/Decrement Returns r2 = 0x01 if Brave has been changed
0018c13c: 30e7000a andi r7,r7,0x000a            |r7 = Allowed minimum brave value (10 if riding (no chicken ?) - 0 if not riding)
0018c140: 02028025 or r16,r16,r2                |r16 <> 0x00 if something has been done
0018c144: 34060064 ori r6,r0,0x0064             |r6 = 0x64 (Faith Cap)
0018c148: 00003821 addu r7,r0,r0                |r7 = 0x00 (Faith minimum value)
0018c14c: 3c028019 lui r2,0x8019                |
0018c150: 8c422d90 lw r2,0x2d90(r2)             |r2 = TCA data pointer
0018c154: 3c058019 lui r5,0x8019                |
0018c158: 8ca52d98 lw r5,0x2d98(r5)             |r5 = Targeted Unit data pointer
0018c15c: 90440017 lbu r4,0x0017(r2)            |r4 = TCA Faith change
0018c160: 0c06355c jal 0x0018d570               |-->Stat Increment/Decrement Returns r2 = 0x01 if Faith has been changed
0018c164: 24a50026 addiu r5,r5,0x0026           |r5 = Targeted Unit Faith data pointer
0018c168: 0c0634f0 jal 0x0018d3c0               |-->Steal Routine
0018c16c: 02028025 or r16,r16,r2                |r16 <> 0x00 if something has been done
0018c170: 3c038019 lui r3,0x8019                |
0018c174: 8c632d90 lw r3,0x2d90(r3)             |r3 = Target Current Action (TCA) data pointer
0018c178: 00000000 nop                          |
0018c17c: 94630010 lhu r3,0x0010(r3)            |r3 = TCA specials flags
0018c180: 00000000 nop                          |
0018c184: 30630008 andi r3,r3,0x0008            |r3 = 0x08 if Special flag katana not broken is ON
0018c188: 10600007 beq r3,r0,0x0018c1a8         #If Katana don't break
0018c18c: 02028025 or r16,r16,r2                |r16 <> 0x00 if something has been done in steal routine
0018c190: 3c048019 lui r4,0x8019                    |
0018c194: 8c842d98 lw r4,0x2d98(r4)                 |r4 = Target data pointer
0018c198: 00000000 nop                              |
0018c19c: 90850176 lbu r5,0x0176(r4)                |r5 = Target used Item (? Not used in routine below)
0018c1a0: 0c063a7a jal 0x0018e9e8                   |-->Item quantity increment for steal/break? Refund katana
0018c1a4: 00000000 nop                              |
0018c1a8: 3c038019 lui r3,0x8019                |
0018c1ac: 8c632d90 lw r3,0x2d90(r3)             |r3 = Target Current Action (TCA) data pointer
0018c1b0: 00000000 nop                          |
0018c1b4: 8462000c lh r2,0x000c(r3)             |r2 = Gil modification
0018c1b8: 00000000 nop                          |
0018c1bc: 14400005 bne r2,r0,0x0018c1d4         #If No Gil modification
0018c1c0: 00000000 nop                              |
0018c1c4: 90620028 lbu r2,0x0028(r3)                |r2 = stolen/gain exp
0018c1c8: 00000000 nop                              |
0018c1cc: 10400002 beq r2,r0,0x0018c1d8             #If there's an Xp modification
0018c1d0: 00000000 nop                                  |
0018c1d4: 36100001 ori r16,r16,0x0001           #E      | Something is done enabled
0018c1d8: 3c028019 lui r2,0x8019                |
0018c1dc: 8c422d90 lw r2,0x2d90(r2)             |r2 = Target Current Action (TCA) data pointer
0018c1e0: 3c048019 lui r4,0x8019                |
0018c1e4: 8c842d98 lw r4,0x2d98(r4)             |r4 = Target data pointer
0018c1e8: 8445000c lh r5,0x000c(r2)             |r5 = Gil Amount
0018c1ec: 0c063aa6 jal 0x0018ea98               |-->Add price of item / 4 to total gil Store stolen gil
0018c1f0: 00003021 addu r6,r0,r0                |r6 = 0x00 (No Item ID, jump to Gil)
0018c1f4: 3c028019 lui r2,0x8019                |
0018c1f8: 8c422d90 lw r2,0x2d90(r2)             |r2 = Target Current Action (TCA) data pointer
0018c1fc: 3c048019 lui r4,0x8019                |
0018c200: 8c842d98 lw r4,0x2d98(r4)             |r4 = Target data pointer
0018c204: 90450028 lbu r5,0x0028(r2)            |r5 = TCA stolen Xp
0018c208: 0c063ad4 jal 0x0018eb50               |-->Apply Exp gain / Level up
0018c20c: 00000000 nop                          |
0018c210: 3c028019 lui r2,0x8019                |
0018c214: 8c422d90 lw r2,0x2d90(r2)             |r2 = Target Current Action (TCA) data pointer
0018c218: 00000000 nop                          |
0018c21c: 90420029 lbu r2,0x0029(r2)            |r2 = TCA ? (stolen Jp ?)
0018c220: 00000000 nop                          |
0018c224: 10400005 beq r2,r0,0x0018c23c         #if TCA 0x29 is not null
0018c228: 00000000 nop                              |
0018c22c: 3c048019 lui r4,0x8019                    |
0018c230: 8c842d98 lw r4,0x2d98(r4)                 |r4 = Target data pointer
0018c234: 0c0637fe jal 0x0018dff8                   |-->Main Reaction subroutine - ENTD/ID stuff Deals with Job Lv gain
0018c238: 00000000 nop                              |
0018c23c: 0c063217 jal 0x0018c85c               |-->Level up/down ability Deals with Lv up/down special flags
0018c240: 00000000 nop                          |
0018c244: 0c0631a0 jal 0x0018c680               |-->Poach Inventory Routine Check special flag 0x20 and run poach
0018c248: 02028025 or r16,r16,r2                |r16 <> 0x00 if something has been done in Lv up/down routine
0018c24c: 3c038019 lui r3,0x8019                |
0018c250: 8c632d90 lw r3,0x2d90(r3)             |Target Current Action (TCA) data pointer
0018c254: 00000000 nop                          |
0018c258: 94630010 lhu r3,0x0010(r3)            |load special flags (marlboro)
0018c25c: 00000000 nop                          |
0018c260: 30630002 andi r3,r3,0x0002            |murbol morph check
0018c264: 1060000a beq r3,r0,0x0018c290         #If Target will be morbolized
0018c268: 02028025 or r16,r16,r2                |r16 <> 0x00 if something has been done in Poach routine
0018c26c: 3c028019 lui r2,0x8019                    |
0018c270: 8c42f5fc lw r2,-0x0a04(r2)                |Load Action state 0x8018f5fc
0018c274: 00000000 nop                              |
0018c278: 14400005 bne r2,r0,0x0018c290             #If the action is being executed
0018c27c: 36100001 ori r16,r16,0x0001               |r16 <> 0x01 if something has been done in morbol section
0018c280: 3c048019 lui r4,0x8019                        |
0018c284: 8c842d98 lw r4,0x2d98(r4)                     |Target data pointer
0018c288: 0c0603d0 jal 0x00180f40                       |-->00180f40 - 00180fe0  Morbolization prep
0018c28c: 00000000 nop                                  |
0018c290: 16200028 bne r17,r0,0x0018c334        #If Updated Target HP = 0
0018c294: 00000000 nop                              |
0018c298: 3c028019 lui r2,0x8019                    |
0018c29c: 8c422d98 lw r2,0x2d98(r2)                 |Target data pointer
0018c2a0: 00000000 nop                              |
0018c2a4: 94420058 lhu r2,0x0058(r2)                |Load Target current status 1 and 2
0018c2a8: 00000000 nop                              |
0018c2ac: 30420160 andi r2,r2,0x0160                |Crystal, Dead, Treasure check
0018c2b0: 14400020 bne r2,r0,0x0018c334             #If Target is not dead, crystalized nor treasure (yet)
0018c2b4: 00000000 nop                                  |
0018c2b8: 3c048019 lui r4,0x8019                        |
0018c2bc: 8c842d90 lw r4,0x2d90(r4)                     |Target Current Action (TCA) data pointer
0018c2c0: 0c062f75 jal 0x0018bdd4                       |-->Null Some Status Data Nullify all TCA status infliction and removal and 0x80193860 to 64
0018c2c4: 00000000 nop                                  |
0018c2c8: 02402021 addu r4,r18,r0                       |r4 = Targeted Unit ID
0018c2cc: 34050001 ori r5,r0,0x0001                     |r5 = 0x01
0018c2d0: 3c028019 lui r2,0x8019                        |
0018c2d4: 8c422d90 lw r2,0x2d90(r2)                     |r2 = Target Current Action (TCA) data pointer
0018c2d8: 34030020 ori r3,r0,0x0020                     |r3 = 0x20 (death status flag)
0018c2dc: 0c06381f jal 0x0018e07c                       |-->Post Ability Hardcoding? Remove status canceled by new status infliction
0018c2e0: a043001b sb r3,0x001b(r2)                     |Inflict Dead on target
0018c2e4: 3c028019 lui r2,0x8019                        |
0018c2e8: 8c42f5fc lw r2,-0x0a04(r2)                    |r2 = Action state  8019f5fd
0018c2ec: 00000000 nop                                  |
0018c2f0: 14400008 bne r2,r0,0x0018c314                 #If Action is being executed
0018c2f4: 00000000 nop                                      |
0018c2f8: 3c038019 lui r3,0x8019                            |
0018c2fc: 8c632d98 lw r3,0x2d98(r3)                         |r3 = Target data pointer
0018c300: 00000000 nop                                      |
0018c304: 9062015c lbu r2,0x015c(r3)                        |r2 = Unit Death count (in this battle)
0018c308: 00000000 nop                                      |
0018c30c: 24420001 addiu r2,r2,0x0001                       |Death counter + 1
0018c310: a062015c sb r2,0x015c(r3)                         |Update death counter
0018c314: 0c063588 jal 0x0018d620                           |-->Attacker's Earned Experience Update earned xp with (keeps higher amount)
0018c318: 34040002 ori r4,r0,0x0002                         |r4 = 0x02 (Target dead flag for above routine)
0018c31c: 3c028019 lui r2,0x8019                            |
0018c320: 8c422d98 lw r2,0x2d98(r2)                         |Target data pointer
0018c324: 00000000 nop                                      |
0018c328: 90420182 lbu r2,0x0182(r2)                        |Load Target mount info
0018c32c: 08063198 j 0x0018c660                             >>jump to  END 
0018c330: 000211c2 srl r2,r2,0x07                           |r2 = 0x01 if Unit was riding
                                                #Else : Not delivering a killing blow
0018c334: 3c028019 lui r2,0x8019                |
0018c338: 8c422d98 lw r2,0x2d98(r2)             |Target data pointer
0018c33c: 3c03cccc lui r3,0xcccc                |r3 = 0xcccc0000
0018c340: 9442002a lhu r2,0x002a(r2)            |Load Target Max HP
0018c344: 3463cccd ori r3,r3,0xcccd             |r3 = 0xcccccccd (0,8 * 2^32)
0018c348: 00430019 multu r2,r3                  |
0018c34c: 00001010 mfhi r2                      |r2 = 0,8 * Target Max HP
0018c350: 00021082 srl r2,r2,0x02               |r2 = 0,2 * Target Max HP
0018c354: 3042ffff andi r2,r2,0xffff            |Keeping r2 as an halfword
0018c358: 0051102a slt r2,r2,r17                |Check if Target is critical (Updated HP < 20% of Max HP)
0018c35c: 14400009 bne r2,r0,0x0018c384         #If Target becomes critical
0018c360: 00000000 nop                              |
0018c364: 3c038019 lui r3,0x8019                    |
0018c368: 8c632d90 lw r3,0x2d90(r3)                 |Target Current Action (TCA) data pointer
0018c36c: 00000000 nop                              |
0018c370: 9062001d lbu r2,0x001d(r3)                |Load TCA Status infliction set 3
0018c374: 00000000 nop                              |
0018c378: 34420001 ori r2,r2,0x0001                 |Update Status set 3 flags with critical flag
0018c37c: 080630e8 j 0x0018c3a0                     >>Jump and Avoid cancel critical section
0018c380: a062001d sb r2,0x001d(r3)                 |Update TCA to inflict critical
                                                #Else : Target is not becoming critical
0018c384: 3c038019 lui r3,0x8019                    |
0018c388: 8c632d90 lw r3,0x2d90(r3)                 |Target data pointer
0018c38c: 00000000 nop                              |
0018c390: 90620022 lbu r2,0x0022(r3)                |Load TCA Status removal set 3
0018c394: 00000000 nop                              |
0018c398: 34420001 ori r2,r2,0x0001                 |Update Status set 3 flags with critical flag
0018c39c: a0620022 sb r2,0x0022(r3)                 |Update TCA to remove critical
0018c3a0: 3c028019 lui r2,0x8019                |
0018c3a4: 8c422d98 lw r2,0x2d98(r2)             |Target data pointer
0018c3a8: 00000000 nop                          |
0018c3ac: 90420024 lbu r2,0x0024(r2)            |Load Target current Brave
0018c3b0: 00000000 nop                          |
0018c3b4: 2c42000a sltiu r2,r2,0x000a           |Check if Brave < 10
0018c3b8: 10400009 beq r2,r0,0x0018c3e0         #If Target Brave is < 10
0018c3bc: 00000000 nop                              |
0018c3c0: 3c038019 lui r3,0x8019                    |
0018c3c4: 8c632d90 lw r3,0x2d90(r3)                 |Target Current Action (TCA) data pointer
0018c3c8: 00000000 nop                              |
0018c3cc: 9062001d lbu r2,0x001d(r3)                |Load TCA 3rd set of status infliction
0018c3d0: 00000000 nop                              |
0018c3d4: 34420004 ori r2,r2,0x0004                 |Update Status set 3 with chicken flag
0018c3d8: 080630ff j 0x0018c3fc                     >>Jump to avoid cancel chicken section
0018c3dc: a062001d sb r2,0x001d(r3)                 |Update TCA to inflict chicken
                                                #Else : Target Brave is more than 10
0018c3e0: 3c038019 lui r3,0x8019                    |
0018c3e4: 8c632d90 lw r3,0x2d90(r3)                 |Target Current Action (TCA) data pointer
0018c3e8: 00000000 nop                              |
0018c3ec: 90620022 lbu r2,0x0022(r3)                |Load TCA 3rd set of status removal
0018c3f0: 00000000 nop                              |
0018c3f4: 34420004 ori r2,r2,0x0004                 |Update Status set 3 with chicken flag
0018c3f8: a0620022 sb r2,0x0022(r3)                 |Update TCA to remove chicken
0018c3fc: 3c038019 lui r3,0x8019                |
0018c400: 8c632d90 lw r3,0x2d90(r3)             |Target Current Action (TCA) data pointer
0018c404: 00000000 nop                          |
0018c408: 90620025 lbu r2,0x0025(r3)            |Load TCA attack type
0018c40c: 00000000 nop                          |
0018c410: 30420080 andi r2,r2,0x0080            |HP damage check
0018c414: 10400013 beq r2,r0,0x0018c464         #If TCA deals HP damage
0018c418: 00000000 nop                              |
0018c41c: 90620024 lbu r2,0x0024(r3)                |Load TCA 5th set of status removal
0018c420: 00000000 nop                              |
0018c424: 34420030 ori r2,r2,0x0030                 |Update status set 5 with Charm and Sleep
0018c428: a0620024 sb r2,0x0024(r3)                 |Update TCA to remove charm and sleep
0018c42c: 3c038019 lui r3,0x8019                    |
0018c430: 8c632d90 lw r3,0x2d90(r3)                 |Target Current Action (TCA) data pointer
0018c434: 00000000 nop                              |
0018c438: 90620022 lbu r2,0x0022(r3)                |Load TCA 3rd set of status removal
0018c43c: 00000000 nop                              |
0018c440: 34420010 ori r2,r2,0x0010                 |Update Status set 3 with transparent flag
0018c444: a0620022 sb r2,0x0022(r3)                 |Update TCA to remove transparent
0018c448: 3c038019 lui r3,0x8019                    |
0018c44c: 8c632d90 lw r3,0x2d90(r3)                 |Target Current Action (TCA) data pointer
0018c450: 00000000 nop                              |
0018c454: 90620021 lbu r2,0x0021(r3)                |Load TCA 2nd set of status removal
0018c458: 00000000 nop                              |
0018c45c: 34420010 ori r2,r2,0x0010                 |Update Status set 2 with confusion flag
0018c460: a0620021 sb r2,0x0021(r3)                 |Update TCA to remove confusion
0018c464: 3c028019 lui r2,0x8019                |
0018c468: 8c422d90 lw r2,0x2d90(r2)             |Target Current Action (TCA) data pointer
0018c46c: 00000000 nop                          |
0018c470: 94420010 lhu r2,0x0010(r2)            |Load TCA specials flags
0018c474: 00000000 nop                          |
0018c478: 30424000 andi r2,r2,0x4000            |Check KB flag
0018c47c: 10400012 beq r2,r0,0x0018c4c8         #If TCA inflict KnockBack
0018c480: 00000000 nop                              |
0018c484: 3c048019 lui r4,0x8019                    |
0018c488: 8c842d98 lw r4,0x2d98(r4)                 |Target data pointer
0018c48c: 0c06005e jal 0x00180178                   |-->Remove charging status/ability CT Returns r2 = 0x01 if unit is charging via charge skillset
0018c490: 00002821 addu r5,r0,r0                    |r5 = 0
0018c494: 1040000c beq r2,r0,0x0018c4c8             #If Unit is charging via charge skillset
0018c498: 00000000 nop                                  |
0018c49c: 3c038019 lui r3,0x8019                        |
0018c4a0: 8c632d90 lw r3,0x2d90(r3)                     |Target Current Action (TCA) data pointer
0018c4a4: 00000000 nop                                  |
0018c4a8: 90620020 lbu r2,0x0020(r3)                    |Load TCA 1st set of status romeval
0018c4ac: 00000000 nop                                  |
0018c4b0: 34420008 ori r2,r2,0x0008                     |update status set 1 with charging
0018c4b4: a0620020 sb r2,0x0020(r3)                     |Updta TCA to remove charging
0018c4b8: 3c038019 lui r3,0x8019                        |
0018c4bc: 8c632d98 lw r3,0x2d98(r3)                 |target data Target data pointer
0018c4c0: 340200ff ori r2,r0,0x00ff                 |ff r2 = 0x0ff
0018c4c4: a062015d sb r2,0x015d(r3)                     |Store Target current ability CT to 0x0ff (No CT) 
0018c4c8: 0c0612c9 jal 0x00184b24               |-->Validate Status Changes Update TCA infliction and removal bytes (based on immunities, innate status immortality …)
0018c4cc: 00002021 addu r4,r0,r0                |r4 = 0x00 (preset value for routine above)
0018c4d0: 00002021 addu r4,r0,r0                |r4 = 0x00
0018c4d4: 27a30010 addiu r3,r29,0x0010          |r3 = stack pointer 0x10
0018c4d8: 3c028019 lui r2,0x8019                @LOOP through all status set
0018c4dc: 8c422d98 lw r2,0x2d98(r2)                 |Target data pointer
0018c4e0: 00000000 nop                              |
0018c4e4: 00441021 addu r2,r2,r4                    |r2 = Target data pointer + loop offset
0018c4e8: 90420058 lbu r2,0x0058(r2)                |Load this iteration target current status set
0018c4ec: 24840001 addiu r4,r4,0x0001               |counter + 1
0018c4f0: a0620000 sb r2,0x0000(r3)                 |Store Target current status on stack 0x10 + loop offset
0018c4f4: 28820005 slti r2,r4,0x0005                |check for loop limit
0018c4f8: 1440fff7 bne r2,r0,0x0018c4d8         Λ Loop 5 times
0018c4fc: 24630001 addiu r3,r3,0x0001               |Increase stack offset
0018c500: 00002021 addu r4,r0,r0                |r4 = 0x00
0018c504: 27a30018 addiu r3,r29,0x0018          |r3 = Stack 0x18 pointer
0018c508: 3c028019 lui r2,0x8019                @LOOP through all status CT
0018c50c: 8c422d98 lw r2,0x2d98(r2)                 |Target data pointer
0018c510: 00000000 nop                              |
0018c514: 00441021 addu r2,r2,r4                    |r2 = Target data pointer + loop counter
0018c518: 9042005d lbu r2,0x005d(r2)                |Load this iteration Target's status CT
0018c51c: 24840001 addiu r4,r4,0x0001               |counter + 1
0018c520: a0620000 sb r2,0x0000(r3)                 |Store this iteration status CT on stack 0x18 + loop counter
0018c524: 28820010 slti r2,r4,0x0010                |check loop's limit
0018c528: 1440fff7 bne r2,r0,0x0018c508         Λ Loop 16 times
0018c52c: 24630001 addiu r3,r3,0x0001               |Increase stack offset
0018c530: 02402021 addu r4,r18,r0                   |
0018c534: 0c06381f jal 0x0018e07c               |-->Post Ability Hardcoding? Update TCA status infliction/removal
0018c538: 00002821 addu r5,r0,r0                |r5 = 0x00
0018c53c: 3c038019 lui r3,0x8019                |
0018c540: 8c632d98 lw r3,0x2d98(r3)             |r3 = Target data pointer
0018c544: 00000000 nop                          |
0018c548: 90620058 lbu r2,0x0058(r3)            |Load Target 1st set of current status
0018c54c: 00000000 nop                          |
0018c550: 30420020 andi r2,r2,0x0020            |Check for death
0018c554: 10400014 beq r2,r0,0x0018c5a8         #If Unit is Dead
0018c558: 00002021 addu r4,r0,r0                    |r4 = 0
0018c55c: 93a20010 lbu r2,0x0010(r29)               |load Target 1st set of current status from stack
0018c560: 00000000 nop                              |
0018c564: 30420020 andi r2,r2,0x0020                |check death
0018c568: 1440000f bne r2,r0,0x0018c5a8             #If Unit was not dead before the routine above
0018c56c: 00000000 nop                                  |
0018c570: 3c028019 lui r2,0x8019                        |
0018c574: 8c42f5fc lw r2,-0x0a04(r2)                    |Load Action state
0018c578: 00000000 nop                                  |
0018c57c: 14400023 bne r2,r0,0x0018c60c                 #If Action is being executed /Else branch to Xp routine with killing blow flag (r16)
0018c580: 34100002 ori r16,r0,0x0002                    |r16 = 02
0018c584: 9062015c lbu r2,0x015c(r3)                        |Load unit death counter
0018c588: 00000000 nop                                      |
0018c58c: 24420001 addiu r2,r2,0x0001                       |Death counter + 0x01
0018c590: 08063183 j 0x0018c60c                             >>jump to Xp routine with r16 = 0x02 (killing blow)
0018c594: a062015c sb r2,0x015c(r3)                         |Store death counter
                                                        --- Shitty backbranch stuff ---
                                                            *New Status inflicted section
0018c598: 08063176 j 0x0018c5d8                                 >>Jump to check refreshed CT (exiting status loop)
0018c59c: 34100001 ori r16,r0,0x0001                            |r16 = 0x01 (successful attack)
                                                            *Refreshed CT section
0018c5a0: 08063183 j 0x0018c60c                                 >>Jump to xp routine
0018c5a4: 34100001 ori r16,r0,0x0001                            |r16 = 0x01 (successful attack)
                                                #Else : not a killing blow Check if there's a status infliction/removal or a refreshed status CT to check if attack is successfull
0018c5a8: 3c068019 lui r6,0x8019                    |
0018c5ac: 8cc62d98 lw r6,0x2d98(r6)                 |Target data pointer
0018c5b0: 27a50010 addiu r5,r29,0x0010              |r5 = Stack 0x10 
0018c5b4: 00c41021 addu r2,r6,r4                    @LOOP Target data pointer + loop offset
0018c5b8: 90430058 lbu r3,0x0058(r2)                    |Load this iteration unit current status
0018c5bc: 90a20000 lbu r2,0x0000(r5)                    |Load this iteration unit current status (from stack)
0018c5c0: 00000000 nop                                  |
0018c5c4: 1462fff4 bne r3,r2,0x0018c598                 #Branch backward if Current status from stack <>  current status from unit (new status infliction)
0018c5c8: 24840001 addiu r4,r4,0x0001                   |counter + 1
0018c5cc: 28820005 slti r2,r4,0x0005                    |Check loop's limit
0018c5d0: 1440fff8 bne r2,r0,0x0018c5b4             Λ Loop 5 times (all status set)
0018c5d4: 24a50001 addiu r5,r5,0x0001                   |Increase stack 0x10 offset
0018c5d8: 00002021 addu r4,r0,r0                    |r4 = 0x00
0018c5dc: 3c068019 lui r6,0x8019                    |
0018c5e0: 8cc62d98 lw r6,0x2d98(r6)                 |Target data pointer
0018c5e4: 27a50018 addiu r5,r29,0x0018              |r5 = Stack 0x18 (contains status CT)
0018c5e8: 00c41021 addu r2,r6,r4                    @Loop r2 = Target data pointer + loop offset
0018c5ec: 9043005d lbu r3,0x005d(r2)                    |Load this iteration status CT (from unit)
0018c5f0: 90a20000 lbu r2,0x0000(r5)                    |Load this iteration status CT (from stack)
0018c5f4: 00000000 nop                                  |
0018c5f8: 1462ffe9 bne r3,r2,0x0018c5a0                 #Branch backward if not same CT (refreshed)
0018c5fc: 24840001 addiu r4,r4,0x0001                   |counter + 1
0018c600: 28820010 slti r2,r4,0x0010                    |check loop's limit
0018c604: 1440fff8 bne r2,r0,0x0018c5e8             Λ Loop 16 times (all target status CT)
0018c608: 24a50001 addiu r5,r5,0x0001                   |Increase stack offset
0018c60c: 0c063588 jal 0x0018d620               |-->Attacker's Earned Experience
0018c610: 02002021 addu r4,r16,r0               |r4 =0x00 (nothing happened) 0x01 (successfull attack) or 0x02 (killing blow) 
0018c614: 12000005 beq r16,r0,0x0018c62c        #If something happened in this Action
0018c618: 34020002 ori r2,r0,0x0002                 |r2 = 02
0018c61c: 3c038019 lui r3,0x8019                    |
0018c620: 8c632d98 lw r3,0x2d98(r3)                 |Target data pointer
0018c624: 00000000 nop                              |
0018c628: a0620189 sb r2,0x0189(r3)                 |Store Target Hit by ability flag  Unit 0x189
0018c62c: 0c063336 jal 0x0018ccd8               |-->PA_Save,_MA_Save,_Speed_Save_Regenerator,_HP_Restore,_MP_Restore,_Critical_Quick,_Meatbone_Slash,_Auto_Potion,_Gilgame_Heart_check
0018c630: 00000000 nop                          |
0018c634: 3c048019 lui r4,0x8019                |
0018c638: 8c842d98 lw r4,0x2d98(r4)             |Target data pointer
0018c63c: 00000000 nop                          |
0018c640: 90830058 lbu r3,0x0058(r4)            |Load Target 1st set of Current status
0018c644: 00000000 nop                          |
0018c648: 30630060 andi r3,r3,0x0060            |Check for Crystal and death
0018c64c: 10600005 beq r3,r0,0x0018c664         #If Target has crystal or death
0018c650: 00001021 addu r2,r0,r0                |r2 = 0x00
0018c654: 90820182 lbu r2,0x0182(r4)                |Load target Mount flag
0018c658: 00000000 nop                              |
0018c65c: 000211c2 srl r2,r2,0x07                   |r2 = 0x01 if Target is ridding
0018c660: 00021023 subu r2,r0,r2                    |r2 = -0x01 if Target is riding
0018c664: 8fbf0034 lw r31,0x0034(r29)       END
0018c668: 8fb20030 lw r18,0x0030(r29)
0018c66c: 8fb1002c lw r17,0x002c(r29)
0018c670: 8fb00028 lw r16,0x0028(r29)
0018c674: 27bd0038 addiu r29,r29,0x0038
0018c678: 03e00008 jr r31
0018c67c: 00000000 nop

Notes

  - If Target is Dead and about to get crystalized or treasurized : 
            finalize status infliction and exit routine
 
  - if 0x8018f5f0 = 0x00 set Target 0x189 to 0x01 (what for ?)
  
  - Check Sunken state, Caution, Dragon spirit, Brave Up, Face Up, Counter Tackle, Counter Flood, Absorb MP, Counter, Counter Magic.. via dedicated routine (one only)
  - Check for Catch and deals with inventory with catched item
  - Golem Mechanics :
          - if special flag 0x8000 is ON reduce Golem HP
          - if special flag 0x0001 is ON enable Team golem
  - Check MP switch, Distribute, Damage split via dedicated routine (one only)
  - Set updated Target minimum HP and MP to 0
  - Cap updated Target HP and MP to Maximum HP and MP
  - Deals with Stat alteration (Speed, CT, PA,MA, Brave, Faith)
  - Finalize Stealing and breaking:
       - check for special flag 0x0010 and 0x0004
       - Unequip Target (update stats)
       - Increase inventory if stolen
  - Refund katana if not broken (special flag 0x0008)
  - Store stolen gil if any
  - Apply stolen Xp gain (+/- Lv Up)
  - Seems to resolve a Jp bonus mechanics(on TCA 0x29) and deals with Job lv gain
  - Apply Lv Up (special flag 0x0080) or Lv down (special flags 0x0100)
  - Run Poach and update inventory (special flag 0x0020)
  - Check for morbol (special flag 0x0002) and prep morbolization (supress a bunch of status data)
  - If dealing a killing blow :
        -delete all action status infliction/removal and inflict dead only
        -finalize status and deal with xp gain and exit
  - Else :
        - Check if Target becomes critical and update Target current action (TCA) status infliction
        - If Target is not critical, add critical in TCA status removal
        - If Target Brave is < 10 update TCA status infliction with chicken
        - If Target Brave is >= 10 Add Chicken to TCA status removal
        - If Action deals HP damage :
                 - Add Transparent to TCA status removal
                 - Add Confusion to TCA status removal
        - If Action inflict KnockBack
                 - Add Charge to TCA status removal is Target is charging via Charge skillset          
        - Finalize Status infliction/removal
        - Determine if action fail / hit / kill and go to Attackers earned xp routine
        - PA_Save,_MA_Save,_Speed_Save_Regenerator,_HP_Restore,_MP_Restore,_Critical_Quick,_Meatbone_Slash,_Auto_Potion,_Gilgame_Heart_check

Return location

Battle.bin
00070f44: In between turn events
00070f74: In between turn events
00072024: Main Post Movement
00072228: Main_Post_Movement
00073c44: Set some target coordinates/attacker animation, others
0007672c: Learn from crystal related
0018d78c: Store target stats pointer data
0018df74: Prep gained exp/jp/level/job level
0019d5d8: AI Act phase handling (in between turn, end of turn, etc.)
0019df24: AI_ability_processing