Difference between revisions of "Formula 01 - 06 Aftermath"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
m (Notes Formatting, return location)
Line 1: Line 1:
 
  Formula 01 - 06 Aftermath (Contains Poach and Secret Hunt)
 
  Formula 01 - 06 Aftermath (Contains Poach and Secret Hunt)
  00187ca0: 3c068019 lui r6,0x8019
+
  -------------------------------------------------------------------------
00187ca4: 8cc62d90 lw r6,0x2d90(r6) Load Target Current Action Data Pointer
+
  Target being male or female avoid the routine
00187ca8: 27bdffe8 addiu r29,r29,0xffe8
+
- POACH : Check for killing blow (no golem, target not already or petrified, not immortal) - And target has a monster ID Job (0x5E to 0x8D)
00187cac: afbf0010 sw r31,0x0010(r29)
+
  - TRAIN : Check Target is critical - inflict invite (if possible [[Modify_Status_Inflictions]])
  00187cb0: 90c20025 lbu r2,0x0025(r6) Load Attack Flag
+
  -------------------------------------------------------------------------
  00187cb4: 00000000 nop
+
  00187ca0: 3c068019 lui r6,0x8019            |
  00187cb8: 30420080 andi r2,r2,0x0080 If Attack Flag contains 'HP Damage,' return true
+
  00187ca4: 8cc62d90 lw r6,0x2d90(r6)         |{{f/adr|<nowiki>r6 = Target Current Action Data Pointer</nowiki>}}
00187cbc: 10400079 beq r2,r0,0x00187ea4 Branch if Attack Flag is HP Damage
+
00187ca8: 27bdffe8 addiu r29,r29,0xffe8    |
00187cc0: 00000000 nop
+
  00187cac: afbf0010 sw r31,0x0010(r29)       |
00187cc4: 3c058019 lui r5,0x8019
+
  00187cb0: 90c20025 lbu r2,0x0025(r6)        |{{f/load|<nowiki>r2 = Target current action attack type</nowiki>}}
00187cc8: 8ca52d98 lw r5,0x2d98(r5) Load Target Statistics Data Pointer
+
  00187cb4: 00000000 nop                     |
  00187ccc: 84c20004 lh r2,0x0004(r6) Load HP Damage
+
  00187cb8: 30420080 andi r2,r2,0x0080        |{{f/std|<nowiki>r2 = 0x80 if attack type contains HP dmg</nowiki>}}
  00187cd0: 94a30028 lhu r3,0x0028(r5) Load Defender's Current HP
+
00187cbc: 10400079 beq r2,r0,0x00187ea4     {{f/Cond|<nowiki>if Target current action inflict HP dmg</nowiki>}} /Else branch to {{f/loc|<nowiki>End</nowiki>}}
  00187cd4: 84c40006 lh r4,0x0006(r6) Load HP Recovery
+
  00187cc0: 00000000 nop                          |{{f/std|<nowiki> </nowiki>}}
  00187cd8: 00621823 subu r3,r3,r2 New HP = Current HP - HP Damage
+
  00187cc4: 3c058019 lui r5,0x8019                |{{f/std|<nowiki> </nowiki>}}
  00187cdc: 90a20006 lbu r2,0x0006(r5) Load Gender of Target
+
00187cc8: 8ca52d98 lw r5,0x2d98(r5)             |{{f/adr|<nowiki>r5 = Target data pointer</nowiki>}}
00187ce0: 00000000 nop
+
  00187ccc: 84c20004 lh r2,0x0004(r6)              |{{f/load|<nowiki>r2 = TCA HP dmg amount</nowiki>}}
  00187ce4: 304200c0 andi r2,r2,0x00c0 If Male or Female, return true
+
00187cd0: 94a30028 lhu r3,0x0028(r5)            |{{f/load|<nowiki>r3 = Target HP</nowiki>}}
00187ce8: 1440006e bne r2,r0,0x00187ea4 Branch if unit is not 'Male/Female'
+
  00187cd4: 84c40006 lh r4,0x0006(r6)              |{{f/load|<nowiki>r4 = TCA HP recovery</nowiki>}}
  00187cec: 00642021 addu r4,r3,r4 Final HP = New HP + HP recovery
+
00187cd8: 00621823 subu r3,r3,r2                 |{{f/std|<nowiki>r3 = Target HP - HP dmg</nowiki>}}
  00187cf0: 90a201ba lbu r2,0x01ba(r5) Load Target Team (could load from r6 + 0x2e)
+
  00187cdc: 90a20006 lbu r2,0x0006(r5)            |{{f/load|<nowiki>r2 = Target gender</nowiki>}}
  00187cf4: 00000000 nop
+
  00187ce0: 00000000 nop                          |
00187cf8: 30420030 andi r2,r2,0x0030 If target team = green, return 0x30; Light blue, 0x20, Red, 0x10, Blue, 0x0
+
00187ce4: 304200c0 andi r2,r2,0x00c0            |{{f/std|<nowiki>r2 <> 0x00 if Target is male or female</nowiki>}}
  00187cfc: 000210c2 srl r2,r2,0x03 Green r2 = 0x6, LB = 0x4, R = 0x2, B = 0x0
+
  00187ce8: 1440006e bne r2,r0,0x00187ea4          {{f/Cond|<nowiki>If Target is a monster (neither male nor female)</nowiki>}} /If target is human (male or female) branch to {{f/loc|<nowiki>End</nowiki>}}
  00187d00: 3c018019 lui r1,0x8019
+
  00187cec: 00642021 addu r4,r3,r4                    |{{f/std|<nowiki>r4 = Target post attack HP (initial HP - HP dmg + HP recovery)</nowiki>}}
  00187d04: 00220821 addu r1,r1,r2         Loads Location (+0x0a0c) of Team's respective Golem HP
+
  00187cf0: 90a201ba lbu r2,0x01ba(r5)                |{{f/load|<nowiki>r2 = Target ENTD flags (deal with team)</nowiki>}}
  00187d08: 9422f5f4 lhu r2,-0x0a0c(r1) Loads Golem HP
+
  00187cf4: 00000000 nop                               |
  00187d0c: 00000000 nop
+
  00187cf8: 30420030 andi r2,r2,0x0030                |{{f/std|<nowiki>If target team = green, return 0x30/ Light blue, 0x20/ Red, 0x10/ Blue, 0x0</nowiki>}}
00187d10: 10400007 beq r2,r0,0x00187d30 Branch if Golem HP = 0
+
  00187cfc: 000210c2 srl r2,r2,0x03                    |{{f/std|<nowiki>Green r2 = 0x6, LB = 0x4, R = 0x2, B = 0x0</nowiki>}}
  00187d14: 00000000 nop
+
  00187d00: 3c018019 lui r1,0x8019                    |
00187d18: 3c028019 lui r2,0x8019
+
  00187d04: 00220821 addu r1,r1,r2                    |{{f/std|<nowiki>r1 = 8019 0000 + Offset depending of team</nowiki>}}
00187d1c: 904238f5 lbu r2,0x38f5(r2) Load 3rd set of Ability Flags
+
00187d08: 9422f5f4 lhu r2,-0x0a0c(r1)               |{{f/load|<nowiki>r2 = Golem team HP amount</nowiki>}}
  00187d20: 00000000 nop
+
  00187d0c: 00000000 nop                               |
  00187d24: 30420008 andi r2,r2,0x0008 Checks if Attack can be absorbed by golem (Normal Attack flag)
+
  00187d10: 10400007 beq r2,r0,0x00187d30              {{f/Cond|<nowiki>If Team golem has HP</nowiki>}} /Else branch after golem section
  00187d28: 1440005e bne r2,r0,0x00187ea4 Branch if 'Normal Attack' Flag is active
+
  00187d14: 00000000 nop                                   |{{f/std|<nowiki> </nowiki>}}
  00187d2c: 00000000 nop
+
  00187d18: 3c028019 lui r2,0x8019                        |{{f/std|<nowiki> </nowiki>}}
  00187d30: 94a20058 lhu r2,0x0058(r5) Load 1st set of Target Current Status
+
00187d1c: 904238f5 lbu r2,0x38f5(r2)                     |{{f/load|<nowiki>r2 = current ability 3rd set of Ability Flags</nowiki>}}
  00187d34: 00000000 nop
+
  00187d20: 00000000 nop                                   |
  00187d38: 30428020 andi r2,r2,0x8020
+
  00187d24: 30420008 andi r2,r2,0x0008                    |{{f/std|<nowiki>r2 = 0x08 if normal attack is enabled</nowiki>}}
00187d3c: 14400059 bne r2,r0,0x00187ea4 Branches if target is already dead
+
  00187d28: 1440005e bne r2,r0,0x00187ea4                 {{f/Cond|<nowiki>if attack is not a normal attack - continue</nowiki>}} /Else branch to {{f/loc|<nowiki>End</nowiki>}} (HP dmg will be absorbed)
  00187d40: 00000000 nop
+
  00187d2c: 00000000 nop                                       |{{f/std|<nowiki> </nowiki>}}
  00187d44: 90a2005b lbu r2,0x005b(r5) Load 4th set of Target Current Status
+
  00187d30: 94a20058 lhu r2,0x0058(r5)                |{{f/load|<nowiki>r2 = Target 1st and 2nd sets of statuses</nowiki>}}
  00187d48: 00000000 nop
+
  00187d34: 00000000 nop                               |
  00187d4c: 30420001 andi r2,r2,0x0001 Checks for wall; Effectively never returns true
+
  00187d38: 30428020 andi r2,r2,0x8020                |{{f/std|<nowiki>r2 <> 0x00 if target is dead or petrified</nowiki>}}
  00187d50: 14400054 bne r2,r0,0x00187ea4 Branch if Unit already has Wall
+
  00187d3c: 14400059 bne r2,r0,0x00187ea4              {{f/Cond|<nowiki>If target is neither dead or petrified</nowiki>}} /Else branch to {{f/loc|<nowiki>End</nowiki>}}
  00187d54: 00000000 nop
+
  00187d40: 00000000 nop                                  |{{f/std|<nowiki> </nowiki>}}
  00187d58: 18800006 blez r4,0x00187d74 Branch if Final HP <= 0
+
  00187d44: 90a2005b lbu r2,0x005b(r5)                    |{{f/load|<nowiki>r2 = Target 4rd set of statuses</nowiki>}}
  00187d5c: 00000000 nop
+
  00187d48: 00000000 nop                                   |
  00187d60: 90c2001b lbu r2,0x001b(r6) Load 1st set of Status Infliction
+
  00187d4c: 30420001 andi r2,r2,0x0001                    |{{f/std|<nowiki>r2 = 0x01 if target has wall</nowiki>}}
  00187d64: 00000000 nop
+
  00187d50: 14400054 bne r2,r0,0x00187ea4                  {{f/Cond|<nowiki>If target don't have Wall</nowiki>}} /If Walled branch to {{f/loc|<nowiki>End</nowiki>}}
00187d68: 30420020 andi r2,r2,0x0020
+
  00187d54: 00000000 nop                                      |{{f/std|<nowiki> </nowiki>}}
  00187d6c: 10400021 beq r2,r0,0x00187df4 Branch if unit is not dead after attack
+
  00187d58: 18800006 blez r4,0x00187d74                        {{f/Cond|<nowiki>If target post-attack HP is > 0</nowiki>}} /Else branch to killing blow section
  00187d70: 00000000 nop
+
  00187d5c: 00000000 nop                                           |{{f/std|<nowiki> </nowiki>}}
00187d74: 3c028019 lui r2,0x8019
+
  00187d60: 90c2001b lbu r2,0x001b(r6)                            |{{f/load|<nowiki>r2 =  TCA 1st set of inflicted status</nowiki>}}
00187d78: 8c422d94 lw r2,0x2d94(r2) Load Attacker Statistics Data pointer
+
00187d64: 00000000 nop                                          |
  00187d7c: 00000000 nop
+
  00187d68: 30420020 andi r2,r2,0x0020                            |{{f/std|<nowiki>r2 = 0x20 if dead is inflicted</nowiki>}}
  00187d80: 90420091 lbu r2,0x0091(r2) Load 3rd set of Support
+
  00187d6c: 10400021 beq r2,r0,0x00187df4                          {{f/Cond|<nowiki>If dead is inflicited - continue toward killing blow section</nowiki>}} /Else branch to {{f/loc|<nowiki>End</nowiki>}} (no killing blow)
  00187d84: 00000000 nop
+
  00187d70: 00000000 nop                                           |
00187d88: 30420040 andi r2,r2,0x0040
+
  00187d74: 3c028019 lui r2,0x8019                            |{{f/std|<nowiki> </nowiki>}}
  00187d8c: 10400019 beq r2,r0,0x00187df4 Branch if support is not 'Secret  Hunt'
+
  00187d78: 8c422d94 lw r2,0x2d94(r2)                          |{{f/adr|<nowiki>r2 = Attacker data pointer</nowiki>}}
  00187d90: 00000000 nop
+
  00187d7c: 00000000 nop                                       |
00187d94: 90a20005 lbu r2,0x0005(r5) Load Target Team
+
  00187d80: 90420091 lbu r2,0x0091(r2)                         |{{f/load|<nowiki>r2 = attacker 3rd set of support</nowiki>}}
  00187d98: 00000000 nop
+
  00187d84: 00000000 nop                                       |
  00187d9c: 30420004 andi r2,r2,0x0004
+
  00187d88: 30420040 andi r2,r2,0x0040                        |{{f/std|<nowiki>r2 = 0x40 if secret hunt is used</nowiki>}}
  00187da0: 14400014 bne r2,r0,0x00187df4 Branch if unit has 'Immortal' Flag
+
  00187d8c: 10400019 beq r2,r0,0x00187df4                      {{f/Cond|<nowiki>If secret hunt is used</nowiki>}} /Else branch after secret hunt section
  00187da4: 00000000 nop
+
  00187d90: 00000000 nop                                           |{{f/std|<nowiki> </nowiki>}}
00187da8: 90a20003 lbu r2,0x0003(r5) Load Job ID
+
  00187d94: 90a20005 lbu r2,0x0005(r5)                            |{{f/load|<nowiki>r2 = Target ENTD flag</nowiki>}}
  00187dac: 00000000 nop
+
  00187d98: 00000000 nop                                           |
  00187db0: 2442ffa2 addiu r2,r2,0xffa2 Job ID - 5D
+
  00187d9c: 30420004 andi r2,r2,0x0004                            |{{f/std|<nowiki>r2= 0x04 if target is immortal</nowiki>}}
  00187db4: 2c420030 sltiu r2,r2,0x0030
+
  00187da0: 14400014 bne r2,r0,0x00187df4                          {{f/Cond|<nowiki>Branch if unit has 'Immortal' Flag</nowiki>}} /Else branch after secret hunt section
00187db8: 1040003a beq r2,r0,0x00187ea4 Branch if Job ID is 5D or lower or  if Job ID is over 8D
+
  00187da4: 00000000 nop                                              |{{f/std|<nowiki> </nowiki>}}
  00187dbc: 00000000 nop
+
  00187da8: 90a20003 lbu r2,0x0003(r5)                                 |{{f/load|<nowiki>r2 = Target current job ID</nowiki>}}
  00187dc0: 0c062f4d jal 0x0018bd34 [[Remove_Knockback_Flag]]  (ex :[[?Nullify steal item?]])
+
  00187dac: 00000000 nop                                               |
  00187dc4: 00000000 nop
+
  00187db0: 2442ffa2 addiu r2,r2,-0x005e                              |{{f/std|<nowiki>Job ID - 0x5e</nowiki>}}
00187dc8: 0c062f3c jal 0x0018bcf0 [[Called by Nullify Action]]
+
  00187db4: 2c420030 sltiu r2,r2,0x0030                                |{{f/std|<nowiki>r2 = 0x01 if job is between 0x05e (1st moster : chocobo) and 0x08D (last monster job : tiamat)</nowiki>}}
00187dcc: 00000000 nop
+
  00187db8: 1040003a beq r2,r0,0x00187ea4                              {{f/Cond|<nowiki>If target has a monster job</nowiki>}} /Else branch to {{f/loc|<nowiki>End</nowiki>}}
  00187dd0: 3c028019 lui r2,0x8019
+
  00187dbc: 00000000 nop                                                  |{{f/std|<nowiki> </nowiki>}}
  00187dd4: 8c422d90 lw r2,0x2d90(r2) Load Target Current Action Data Pointer
+
  00187dc0: 0c062f4d jal 0x0018bd34                                        |{{f/jal|Remove_Knockback_Flag (ex :?Nullify steal item?)|<nowiki>Remove_Knockback_Flag (ex :?Nullify steal item?)</nowiki>}}
  00187dd8: 00000000 nop
+
  00187dc4: 00000000 nop                                                   |
  00187ddc: 94430010 lhu r3,0x0010(r2) Load 1st set of Special Flags inflicted
+
  00187dc8: 0c062f3c jal 0x0018bcf0                                        |{{f/jal|Called by Nullify Action|<nowiki>Called by Nullify Action</nowiki>}}
  00187de0: 00000000 nop
+
  00187dcc: 00000000 nop                                                   |
  00187de4: 34630020 ori r3,r3,0x0020 Adds poached to special flags
+
  00187dd0: 3c028019 lui r2,0x8019                                        |
00187de8: a4430010 sh r3,0x0010(r2) Stores new special flag
+
00187dd4: 8c422d90 lw r2,0x2d90(r2)                                     |{{f/adr|<nowiki>r2 = Target current action data pointer</nowiki>}}
  00187dec: 08061fa7 j 0x00187e9c
+
  00187dd8: 00000000 nop                                                   |
00187df0: 34020006 ori r2,r0,0x0006 R2 = 0x6
+
  00187ddc: 94430010 lhu r3,0x0010(r2)                                    |{{f/load|<nowiki>r3 = TCA specials flags 1 and 2</nowiki>}}
00187df4: 1880002b blez r4,0x00187ea4 Branch if Final HP <= 0
+
00187de0: 00000000 nop                                                  |
  00187df8: 3c03cccc lui r3,0xcccc prepares Critical Health Check
+
  00187de4: 34630020 ori r3,r3,0x0020                                      |{{f/std|<nowiki>r3 = specials flags halfword updated with 0x0020 (poached)</nowiki>}}
  00187dfc: 3c028019 lui r2,0x8019
+
  00187de8: a4430010 sh r3,0x0010(r2)                                      |{{f/store|<nowiki>Store specials flags with poached enabled</nowiki>}}
00187e00: 8c422d98 lw r2,0x2d98(r2) Load Target Statistics Data Pointer
+
  00187dec: 08061fa7 j 0x00187e9c                                          {{f/jump|<nowiki>jump to </nowiki>{{f/loc|<nowiki>0x8019390e section</nowiki>}}<nowiki> (with r2 = 0x06)</nowiki>}}
  00187e04: 00000000 nop
+
  00187df0: 34020006 ori r2,r0,0x0006                                      |{{f/std|<nowiki>r2 = 0x06</nowiki>}}
  00187e08: 9442002a lhu r2,0x002a(r2) Load Target Max HP
+
  00187df4: 1880002b blez r4,0x00187ea4                        {{f/Cond|<nowiki>Else IF target post-attack HP is > 0 (target not poached) </nowiki>}} /Branch to End if killing blow (avoid train section)
  00187e0c: 3463cccd ori r3,r3,0xcccd R3 = 0xcccccccd (effectively 4/5 in this routine)
+
  00187df8: 3c03cccc lui r3,0xcccc                                |{{f/std|<nowiki>r3 = 0xcccc0000</nowiki>}} {{f/std|<nowiki>(prepares Critical Health Check)</nowiki>}}
  00187e10: 00430019 multu r2,r3 Multiplies Target Max HP by 4/5 (part 1. this gives 0x0000#### in the HI register, where #### is max health multiplied by 4/5, and 0xccccccc$ in LO, more often than not, $ has no particular meaning)
+
00187dfc: 3c028019 lui r2,0x8019                                |
  00187e14: 00001010 mfhi r2 Max HP * 4/5
+
  00187e00: 8c422d98 lw r2,0x2d98(r2)                             |{{f/adr|<nowiki>r2 = Tagret data pointer</nowiki>}}
  00187e18: 00021082 srl r2,r2,0x02 Max HP * 1/5
+
  00187e04: 00000000 nop                                           |
  00187e1c: 3042ffff andi r2,r2,0xffff Removes stray data from final 4 bytes
+
  00187e08: 9442002a lhu r2,0x002a(r2)                             |{{f/load|<nowiki>r2 = Target Max HP</nowiki>}}
  00187e20: 0044102a slt r2,r2,r4 If Final health is less than Critical health, return true
+
  00187e0c: 3463cccd ori r3,r3,0xcccd                              |{{f/std|<nowiki>r3 = 0xcccccccd (0,8 * 2^32)</nowiki>}}
  00187e24: 1440001f bne r2,r0,0x00187ea4 Branches if final health is not less than critical
+
  00187e10: 00430019 multu r2,r3                                   |{{f/std|<nowiki>Target max HP * 0,8 * 2^32</nowiki>}}
00187e28: 00000000 nop
+
  00187e14: 00001010 mfhi r2                                       |{{f/std|<nowiki>r2 = Target max HP * 0,8 (from high part of the multiplication result)</nowiki>}} [[R3000_instruction_set#InstructionMult|See here]]
  00187e2c: 3c028019 lui r2,0x8019
+
  00187e18: 00021082 srl r2,r2,0x02                                |{{f/std|<nowiki>r2 = Target max HP * 0,2</nowiki>}}
00187e30: 8c422d94 lw r2,0x2d94(r2) Load Attacker Statistics Data Pointer
+
  00187e1c: 3042ffff andi r2,r2,0xffff                            |{{f/std|<nowiki>r2 = last halfword of r2 (security ?) - so it's still Target max HP * 0,2</nowiki>}}
  00187e34: 00000000 nop
+
00187e20: 0044102a slt r2,r2,r4                                  |{{f/std|<nowiki>r2 = 0x01 if Target max HP * 0,2 < Target post-attack HP (r2 = 0x00 if target is critical)</nowiki>}}
  00187e38: 90420091 lbu r2,0x0091(r2) Load 3rd set of Attacker Support
+
00187e24: 1440001f bne r2,r0,0x00187ea4                          {{f/Cond|<nowiki>If target is critical</nowiki>}} /Branch to !! End !! if Target HP not critical
  00187e3c: 00000000 nop
+
00187e28: 00000000 nop                                              |{{f/std|<nowiki> </nowiki>}}
  00187e40: 30420080 andi r2,r2,0x0080
+
00187e2c: 3c028019 lui r2,0x8019                                    |{{f/std|<nowiki> </nowiki>}}
  00187e44: 10400017 beq r2,r0,0x00187ea4 Branch if train not equipped
+
00187e30: 8c422d94 lw r2,0x2d94(r2)                                  |{{f/adr|<nowiki>r2 = Attacker data pointer</nowiki>}}
  00187e48: 00002021 addu r4,r0,r0 r4 = 0x0
+
00187e34: 00000000 nop                                              |
  00187e4c: 3c038019 lui r3,0x8019
+
00187e38: 90420091 lbu r2,0x0091(r2)                                |{{f/load|<nowiki>r3 = Attacker 3rd set of support ability</nowiki>}}
  00187e50: 8c632d90 lw r3,0x2d90(r3) Loads Target Current Action Data Pointer
+
00187e3c: 00000000 nop                                              |
  00187e54: 00000000 nop
+
00187e40: 30420080 andi r2,r2,0x0080                                |{{f/std|<nowiki>r2 = 0x80 if train is equipped</nowiki>}}
  00187e58: 9062001c lbu r2,0x001c(r3) Loads Status Infliction on target
+
00187e44: 10400017 beq r2,r0,0x00187ea4                              {{f/Cond|<nowiki>If Attacker use Train support ability</nowiki>}} /Else branch to {{f/loc|<nowiki>End</nowiki>}}
  00187e5c: 00000000 nop
+
00187e48: 00002021 addu r4,r0,r0                                        |{{f/std|<nowiki>r4 = 0x00</nowiki>}}
00187e60: 34420040 ori r2,r2,0x0040 Adds Invite to list of Statuses
+
00187e4c: 3c038019 lui r3,0x8019                                        |
  00187e64: 0c0612c9 jal 0x00184b24 [[Validate Status Changes]]
+
00187e50: 8c632d90 lw r3,0x2d90(r3)                                      |{{f/adr|<nowiki>r3 = Target current action data pointer</nowiki>}}
00187e68: a062001c sb r2,0x001c(r3) Saves new value of inflicted statuses
+
00187e54: 00000000 nop                                                  |
00187e6c: 1040000d beq r2,r0,0x00187ea4 Branch if Status change not valid
+
00187e58: 9062001c lbu r2,0x001c(r3)                                    |{{f/load|<nowiki>r2 = TCA 2nd set of infilcted stauts</nowiki>}}
  00187e70: 00000000 nop
+
00187e5c: 00000000 nop                                                  |
  00187e74: 3c048019 lui r4,0x8019
+
00187e60: 34420040 ori r2,r2,0x0040                                      |{{f/std|<nowiki>r2 = Update 2nd set of inflicted status with Invite</nowiki>}}
00187e78: 8c842d90 lw r4,0x2d90(r4) Loads Target Current Action Data Pointer
+
00187e64: 0c0612c9 jal 0x00184b24                                        |{{f/jal|Validate Status Changes|<nowiki>Validate Status Changes</nowiki>}}  Lots of check - may result in no status infliction (r2 = 0x00)
  00187e7c: 00000000 nop
+
00187e68: a062001c sb r2,0x001c(r3)                                      |{{f/store|<nowiki>Store 2nd set of inflicted statuses updated with invite</nowiki>}}
00187e80: 94820010 lhu r2,0x0010(r4) loads Special Flags Inflicted on Target
+
00187e6c: 1040000d beq r2,r0,0x00187ea4                                  {{f/Cond|<nowiki>If invite is inflicted</nowiki>}} /Else branch to {{f/loc|<nowiki>End</nowiki>}} (invited not inflicted)
  00187e84: 90830025 lbu r3,0x0025(r4) Loads Attack Type
+
00187e70: 00000000 nop                                                      |{{f/std|<nowiki> </nowiki>}}
  00187e88: 34420040 ori r2,r2,0x0040 Adds switch team to Special Flags Inflicted
+
00187e74: 3c048019 lui r4,0x8019                                            |{{f/std|<nowiki> </nowiki>}}
  00187e8c: 34630008 ori r3,r3,0x0008 Adds Status Change to Attack Type
+
00187e78: 8c842d90 lw r4,0x2d90(r4)                                          |{{f/adr|<nowiki>r4 = Target current action data pointer</nowiki>}}
00187e90: a4820010 sh r2,0x0010(r4) Saves new Special flag
+
00187e7c: 00000000 nop                                                      |
  00187e94: 34020009 ori r2,r0,0x0009 r2 = 0x9
+
00187e80: 94820010 lhu r2,0x0010(r4)                                        |{{f/load|<nowiki>r2 = TCA specials flags</nowiki>}}
00187e98: a0830025 sb r3,0x0025(r4) Saves new attack type
+
00187e84: 90830025 lbu r3,0x0025(r4)                                        |{{f/load|<nowiki>r3 = TCA attack type</nowiki>}}
00187e9c: 3c018019 lui r1,0x8019
+
00187e88: 34420040 ori r2,r2,0x0040                                          |{{f/std|<nowiki>r2 = TCA specials flags updated with switch team</nowiki>}}
00187ea0: a022390e sb r2,0x390e(r1) Store 0x6 (if poached)/Store 0x9 (if Trained) at Location 0x8019390e (AI flag?)
+
00187e8c: 34630008 ori r3,r3,0x0008                                          |{{f/std|<nowiki>r3 = TCA attack type updated wtih pseudo-status</nowiki>}}
  00187ea4: 8fbf0010 lw r31,0x0010(r29)
+
00187e90: a4820010 sh r2,0x0010(r4)                                          |{{f/store|<nowiki>Store TCA specials flags with switch team enabled</nowiki>}}
  00187ea8: 27bd0018 addiu r29,r29,0x0018
+
00187e94: 34020009 ori r2,r0,0x0009                                          |{{f/std|<nowiki>r2 = 0x09 (will be stored at 0x8019390e)</nowiki>}}
  00187eac: 03e00008 jr r31
+
00187e98: a0830025 sb r3,0x0025(r4)                                          |{{f/store|<nowiki>Store TCA attack type with pseudo-stauts change enabled</nowiki>}}
 +
00187e9c: 3c018019 lui r1,0x8019                                            |
 +
00187ea0: a022390e sb r2,0x390e(r1)                                         |{{f/store|<nowiki>Store 0x6 (if poached)/Store 0x9 (if Trained) at 0x8019390e </nowiki>}}  Landing site of successful poach
 +
  00187ea4: 8fbf0010 lw r31,0x0010(r29)       |End
 +
  00187ea8: 27bd0018 addiu r29,r29,0x0018    
 +
  00187eac: 03e00008 jr r31                  
 
  00187eb0: 00000000 nop
 
  00187eb0: 00000000 nop
 +
===Return Locations===
 +
0018b990: Pre_Formula_Setup_(FDC)

Revision as of 20:52, 30 November 2021

Formula 01 - 06 Aftermath (Contains Poach and Secret Hunt)
-------------------------------------------------------------------------
Target being male or female avoid the routine
- POACH : Check for killing blow (no golem, target not already or petrified, not immortal) - And target has a monster ID Job (0x5E to 0x8D)
- TRAIN : Check Target is critical - inflict invite (if possible Modify_Status_Inflictions)
-------------------------------------------------------------------------
00187ca0: 3c068019 lui r6,0x8019            |
00187ca4: 8cc62d90 lw r6,0x2d90(r6)         |r6 = Target Current Action Data Pointer
00187ca8: 27bdffe8 addiu r29,r29,0xffe8     |
00187cac: afbf0010 sw r31,0x0010(r29)       |
00187cb0: 90c20025 lbu r2,0x0025(r6)        |r2 = Target current action attack type
00187cb4: 00000000 nop                      |
00187cb8: 30420080 andi r2,r2,0x0080        |r2 = 0x80 if attack type contains HP dmg
00187cbc: 10400079 beq r2,r0,0x00187ea4     #if Target current action inflict HP dmg /Else branch to End
00187cc0: 00000000 nop                           | 
00187cc4: 3c058019 lui r5,0x8019                 | 
00187cc8: 8ca52d98 lw r5,0x2d98(r5)              |r5 = Target data pointer
00187ccc: 84c20004 lh r2,0x0004(r6)              |r2 = TCA HP dmg amount
00187cd0: 94a30028 lhu r3,0x0028(r5)             |r3 = Target HP
00187cd4: 84c40006 lh r4,0x0006(r6)              |r4 = TCA HP recovery
00187cd8: 00621823 subu r3,r3,r2                 |r3 = Target HP - HP dmg
00187cdc: 90a20006 lbu r2,0x0006(r5)             |r2 = Target gender
00187ce0: 00000000 nop                           |
00187ce4: 304200c0 andi r2,r2,0x00c0             |r2 <> 0x00 if Target is male or female
00187ce8: 1440006e bne r2,r0,0x00187ea4          #If Target is a monster (neither male nor female) /If target is human (male or female) branch to End
00187cec: 00642021 addu r4,r3,r4                     |r4 = Target post attack HP (initial HP - HP dmg + HP recovery)
00187cf0: 90a201ba lbu r2,0x01ba(r5)                 |r2 = Target ENTD flags (deal with team)
00187cf4: 00000000 nop                               |
00187cf8: 30420030 andi r2,r2,0x0030                 |If target team = green, return 0x30/ Light blue, 0x20/ Red, 0x10/ Blue, 0x0
00187cfc: 000210c2 srl r2,r2,0x03                    |Green r2 = 0x6, LB = 0x4, R = 0x2, B = 0x0
00187d00: 3c018019 lui r1,0x8019                     |
00187d04: 00220821 addu r1,r1,r2                     |r1 = 8019 0000 + Offset depending of team
00187d08: 9422f5f4 lhu r2,-0x0a0c(r1)                |r2 = Golem team HP amount
00187d0c: 00000000 nop                               |
00187d10: 10400007 beq r2,r0,0x00187d30              #If Team golem has HP /Else branch after golem section
00187d14: 00000000 nop                                   | 
00187d18: 3c028019 lui r2,0x8019                         | 
00187d1c: 904238f5 lbu r2,0x38f5(r2)                     |r2 = current ability 3rd set of Ability Flags
00187d20: 00000000 nop                                   |
00187d24: 30420008 andi r2,r2,0x0008                     |r2 = 0x08 if normal attack is enabled
00187d28: 1440005e bne r2,r0,0x00187ea4                  #if attack is not a normal attack - continue /Else branch to End (HP dmg will be absorbed)
00187d2c: 00000000 nop                                       | 
00187d30: 94a20058 lhu r2,0x0058(r5)                 |r2 = Target 1st and 2nd sets of statuses
00187d34: 00000000 nop                               |
00187d38: 30428020 andi r2,r2,0x8020                 |r2 <> 0x00 if target is dead or petrified
00187d3c: 14400059 bne r2,r0,0x00187ea4              #If target is neither dead or petrified /Else branch to End
00187d40: 00000000 nop                                   | 
00187d44: 90a2005b lbu r2,0x005b(r5)                     |r2 = Target 4rd set of statuses
00187d48: 00000000 nop                                   |
00187d4c: 30420001 andi r2,r2,0x0001                     |r2 = 0x01 if target has wall
00187d50: 14400054 bne r2,r0,0x00187ea4                  #If target don't have Wall /If Walled branch to End
00187d54: 00000000 nop                                       | 
00187d58: 18800006 blez r4,0x00187d74                        #If target post-attack HP is > 0 /Else branch to killing blow section
00187d5c: 00000000 nop                                           | 
00187d60: 90c2001b lbu r2,0x001b(r6)                             |r2 =  TCA 1st set of inflicted status
00187d64: 00000000 nop                                           |
00187d68: 30420020 andi r2,r2,0x0020                             |r2 = 0x20 if dead is inflicted
00187d6c: 10400021 beq r2,r0,0x00187df4                          #If dead is inflicited - continue toward killing blow section /Else branch to End (no killing blow)
00187d70: 00000000 nop                                           |
00187d74: 3c028019 lui r2,0x8019                             | 
00187d78: 8c422d94 lw r2,0x2d94(r2)                          |r2 = Attacker data pointer
00187d7c: 00000000 nop                                       |
00187d80: 90420091 lbu r2,0x0091(r2)                         |r2 = attacker 3rd set of support
00187d84: 00000000 nop                                       |
00187d88: 30420040 andi r2,r2,0x0040                         |r2 = 0x40 if secret hunt is used
00187d8c: 10400019 beq r2,r0,0x00187df4                      #If secret hunt is used /Else branch after secret hunt section
00187d90: 00000000 nop                                           | 
00187d94: 90a20005 lbu r2,0x0005(r5)                             |r2 = Target ENTD flag
00187d98: 00000000 nop                                           |
00187d9c: 30420004 andi r2,r2,0x0004                             |r2= 0x04 if target is immortal
00187da0: 14400014 bne r2,r0,0x00187df4                          #Branch if unit has 'Immortal' Flag /Else branch after secret hunt section
00187da4: 00000000 nop                                               | 
00187da8: 90a20003 lbu r2,0x0003(r5)                                 |r2 = Target current job ID
00187dac: 00000000 nop                                               |
00187db0: 2442ffa2 addiu r2,r2,-0x005e                               |Job ID - 0x5e
00187db4: 2c420030 sltiu r2,r2,0x0030                                |r2 = 0x01 if job is between 0x05e (1st moster : chocobo) and 0x08D (last monster job : tiamat)
00187db8: 1040003a beq r2,r0,0x00187ea4                              #If target has a monster job /Else branch to End 
00187dbc: 00000000 nop                                                   | 
00187dc0: 0c062f4d jal 0x0018bd34                                        |-->Remove_Knockback_Flag  (ex :?Nullify steal item?)
00187dc4: 00000000 nop                                                   |
00187dc8: 0c062f3c jal 0x0018bcf0                                        |-->Called by Nullify Action
00187dcc: 00000000 nop                                                   |
00187dd0: 3c028019 lui r2,0x8019                                         |
00187dd4: 8c422d90 lw r2,0x2d90(r2)                                      |r2 = Target current action data pointer
00187dd8: 00000000 nop                                                   |
00187ddc: 94430010 lhu r3,0x0010(r2)                                     |r3 = TCA specials flags 1 and 2
00187de0: 00000000 nop                                                   |
00187de4: 34630020 ori r3,r3,0x0020                                      |r3 = specials flags halfword updated with 0x0020 (poached)
00187de8: a4430010 sh r3,0x0010(r2)                                      |Store specials flags with poached enabled
00187dec: 08061fa7 j 0x00187e9c                                          >>jump to  0x8019390e section (with r2 = 0x06)
00187df0: 34020006 ori r2,r0,0x0006                                      |r2 = 0x06
00187df4: 1880002b blez r4,0x00187ea4                        #Else IF target post-attack HP is > 0 (target not poached)  /Branch to End if killing blow (avoid train section)
00187df8: 3c03cccc lui r3,0xcccc                                 |r3 = 0xcccc0000 (prepares Critical Health Check)
00187dfc: 3c028019 lui r2,0x8019                                 |
00187e00: 8c422d98 lw r2,0x2d98(r2)                              |r2 = Tagret data pointer
00187e04: 00000000 nop                                           |
00187e08: 9442002a lhu r2,0x002a(r2)                             |r2 = Target Max HP
00187e0c: 3463cccd ori r3,r3,0xcccd                              |r3 = 0xcccccccd (0,8 * 2^32)
00187e10: 00430019 multu r2,r3                                   |Target max HP * 0,8 * 2^32
00187e14: 00001010 mfhi r2                                       |r2 = Target max HP * 0,8 (from high part of the multiplication result) See here
00187e18: 00021082 srl r2,r2,0x02                                |r2 = Target max HP * 0,2
00187e1c: 3042ffff andi r2,r2,0xffff                             |r2 = last halfword of r2 (security ?) - so it's still Target max HP * 0,2
00187e20: 0044102a slt r2,r2,r4                                  |r2 = 0x01 if Target max HP * 0,2 < Target post-attack HP (r2 = 0x00 if target is critical)
00187e24: 1440001f bne r2,r0,0x00187ea4                          #If target is critical /Branch to !! End !! if Target HP not critical
00187e28: 00000000 nop                                               | 
00187e2c: 3c028019 lui r2,0x8019                                     | 
00187e30: 8c422d94 lw r2,0x2d94(r2)                                  |r2 = Attacker data pointer
00187e34: 00000000 nop                                               |
00187e38: 90420091 lbu r2,0x0091(r2)                                 |r3 = Attacker 3rd set of support ability
00187e3c: 00000000 nop                                               |
00187e40: 30420080 andi r2,r2,0x0080                                 |r2 = 0x80 if train is equipped
00187e44: 10400017 beq r2,r0,0x00187ea4                              #If Attacker use Train support ability /Else branch to End 
00187e48: 00002021 addu r4,r0,r0                                         |r4 = 0x00
00187e4c: 3c038019 lui r3,0x8019                                         |
00187e50: 8c632d90 lw r3,0x2d90(r3)                                      |r3 = Target current action data pointer
00187e54: 00000000 nop                                                   |
00187e58: 9062001c lbu r2,0x001c(r3)                                     |r2 = TCA 2nd set of infilcted stauts
00187e5c: 00000000 nop                                                   |
00187e60: 34420040 ori r2,r2,0x0040                                      |r2 = Update 2nd set of inflicted status with Invite
00187e64: 0c0612c9 jal 0x00184b24                                        |-->Validate Status Changes   Lots of check - may result in no status infliction (r2 = 0x00)
00187e68: a062001c sb r2,0x001c(r3)                                      |Store 2nd set of inflicted statuses updated with invite
00187e6c: 1040000d beq r2,r0,0x00187ea4                                  #If invite is inflicted /Else branch to End (invited not inflicted)
00187e70: 00000000 nop                                                       | 
00187e74: 3c048019 lui r4,0x8019                                             | 
00187e78: 8c842d90 lw r4,0x2d90(r4)                                          |r4 = Target current action data pointer
00187e7c: 00000000 nop                                                       |
00187e80: 94820010 lhu r2,0x0010(r4)                                         |r2 = TCA specials flags
00187e84: 90830025 lbu r3,0x0025(r4)                                         |r3 = TCA attack type
00187e88: 34420040 ori r2,r2,0x0040                                          |r2 = TCA specials flags updated with switch team
00187e8c: 34630008 ori r3,r3,0x0008                                          |r3 = TCA attack type updated wtih pseudo-status
00187e90: a4820010 sh r2,0x0010(r4)                                          |Store TCA specials flags with switch team enabled
00187e94: 34020009 ori r2,r0,0x0009                                          |r2 = 0x09 (will be stored at 0x8019390e)
00187e98: a0830025 sb r3,0x0025(r4)                                          |Store TCA attack type with pseudo-stauts change enabled
00187e9c: 3c018019 lui r1,0x8019                                             |
00187ea0: a022390e sb r2,0x390e(r1)                                          |Store 0x6 (if poached)/Store 0x9 (if Trained) at 0x8019390e   Landing site of successful poach
00187ea4: 8fbf0010 lw r31,0x0010(r29)       |End
00187ea8: 27bd0018 addiu r29,r29,0x0018     
00187eac: 03e00008 jr r31                   
00187eb0: 00000000 nop

Return Locations

0018b990: Pre_Formula_Setup_(FDC)