Formula 01 - 06 Aftermath

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
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   0x00187e9c 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)