Difference between revisions of "Perform reaction abilities"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m (notes, links and color)
m
Line 5: Line 5:
 
               rq : reflect is here, but reacting unit ID is stored in attacker data pointer before exiting the routine
 
               rq : reflect is here, but reacting unit ID is stored in attacker data pointer before exiting the routine
 
     = -0x01 if ability ID is > 0x1be (damage split)
 
     = -0x01 if ability ID is > 0x1be (damage split)
 
+
-------------------------------------------------------------------------------------------------------
 
  0018af2c: 27bdffe8 addiu r29,r29,0xffe8    |
 
  0018af2c: 27bdffe8 addiu r29,r29,0xffe8    |
 
  0018af30: afb00010 sw r16,0x0010(r29)      |
 
  0018af30: afb00010 sw r16,0x0010(r29)      |
Line 227: Line 227:
 
  0018b208: 8c632d90 lw r3,0x2d90(r3)              |{{f/adr|<nowiki>r3 = Target current action data pointer</nowiki>}}
 
  0018b208: 8c632d90 lw r3,0x2d90(r3)              |{{f/adr|<nowiki>r3 = Target current action data pointer</nowiki>}}
 
  0018b20c: 2402ffff addiu r2,r0,-0x0001          |{{f/std|<nowiki>r2 = -0x0001</nowiki>}}
 
  0018b20c: 2402ffff addiu r2,r0,-0x0001          |{{f/std|<nowiki>r2 = -0x0001</nowiki>}}
  0018b210: 08062c98 j 0x0018b260                  {{f/jump|<nowiki>jumps to very end if reaction fails </nowiki>}}
+
  0018b210: 08062c98 j 0x0018b260                  {{f/jump|<nowiki>jumps to end </nowiki>}}
 
  0018b214: a0600025 sb r0,0x0025(r3)              |{{f/store|<nowiki>Store target current action hit flag as miss</nowiki>}} {{f/std|<nowiki>(Talcall here, This jump is for reactions that trigger a counter-ability, like counter Magic, or Counter attack.)</nowiki>}}
 
  0018b214: a0600025 sb r0,0x0025(r3)              |{{f/store|<nowiki>Store target current action hit flag as miss</nowiki>}} {{f/std|<nowiki>(Talcall here, This jump is for reactions that trigger a counter-ability, like counter Magic, or Counter attack.)</nowiki>}}
 
    
 
    

Revision as of 21:44, 18 November 2021

Support some reaction abilities
returns r2 :
   = 0x01 if ability is supported (current action will be modified)
   = 0x00 if reaction flag as 0x01 is enabled but not 0x02
             rq : reflect is here, but reacting unit ID is stored in attacker data pointer before exiting the routine
   = -0x01 if ability ID is > 0x1be (damage split)
-------------------------------------------------------------------------------------------------------
0018af2c: 27bdffe8 addiu r29,r29,0xffe8     |
0018af30: afb00010 sw r16,0x0010(r29)       |
0018af34: 34100001 ori r16,r0,0x0001        |r16 = 0x01 (for current action attack type - pseudo status change by default)
0018af38: 3c048019 lui r4,0x8019            |
0018af3c: 84842d9c lh r4,0x2d9c(r4)         |r4 = Current action : reaction ID
0018af40: 340201b8 ori r2,r0,0x01b8         |r2 = 0x1b8 (Reflect ID)
0018af44: 1482000c bne r4,r2,0x0018af78     #If Current reaction reaction is reflect
0018af48: afbf0014 sw r31,0x0014(r29)            | 
0018af4c: 3c028019 lui r2,0x8019                 | 
0018af50: 8c42f8c8 lw r2,-0x0738(r2)             |r2 = Acting unit ID
0018af54: 00000000 nop                           |
0018af58: 000218c0 sll r3,r2,0x03                |unit ID * 0x8
0018af5c: 00621823 subu r3,r3,r2                 |unit ID * 0x7
0018af60: 00031980 sll r3,r3,0x06                |unit ID * 0x1c0
0018af64: 3c028019 lui r2,0x8019                 |
0018af68: 244208cc addiu r2,r2,0x08cc            |r2 = 0x801908cc (unit data start)
0018af6c: 00621821 addu r3,r3,r2                 |r3 = 0x801908cc + ID * 0x1c0 (Reacting unit data pointer)
0018af70: 3c018019 lui r1,0x8019                 |
0018af74: ac232d94 sw r3,0x2d94(r1)              |Store (re)acting unit data pointer in attacker data pointer
0018af78: 3c018006 lui r1,0x8006                 |
0018af7c: 00240821 addu r1,r1,r4            |r1 = 0x8006 + Reaction ID
0018af80: 9022ea2a lbu r2,-0x15d6(r1)       |r2 = Reaction flag of used reaction -->Reaction_Flags
0018af84: 34030001 ori r3,r0,0x0001         |r3 = 0x1
0018af88: 30420003 andi r2,r2,0x0003        |if reaction flags have 0x1, or 0x2 set, return either (or both) values / Else 0x00
0018af8c: 104300b4 beq r2,r3,0x0018b260     #if reaction don't have the flag 0x01 without 0x02 /Else branch to end
0018af90: 00001021 addu r2,r0,r0            |r2 = 0x00
0018af94: 0c062b7d jal 0x0018adf4                |-->Action_data_nulling reset most of target and attacker current action data
0018af98: 00000000 nop                           |
0018af9c: 3c028019 lui r2,0x8019                 |
0018afa0: 94422d9c lhu r2,0x2d9c(r2)             |r2 = current action reaction ID
0018afa4: 00000000 nop                           |
0018afa8: 2442fe5a addiu r2,r2,-0x01a6           |reaction ID - 0x01a6 (A Save = 0x00 , Hamedo = 0x1f)  (will be refered as reaction number)
0018afac: 00021400 sll r2,r2,0x10                |
0018afb0: 00021c03 sra r3,r2,0x10                |r3 = reaction number Clear a potential upper part of r2 ? (r2 unchanged)
0018afb4: 2c620019 sltiu r2,r3,0x0019            |r2 = 0x01 if reaction is between A-Save and damage split
0018afb8: 10400092 beq r2,r0,0x0018b204          #if reaction is between A-Save and damage split #Else ?
0018afbc: 00031080 sll r2,r3,0x02                    |r2 = reactionID * 4
0018afc0: 3c018017 lui r1,0x8017                     |
0018afc4: 00220821 addu r1,r1,r2                     |r1 = 8017 + Reaction number
0018afc8: 8c22429c lw r2,0x429c(r1)                  |r2 = jump adress from table -->Reaction_abilities_return_adress_table
0018afcc: 00000000 nop                               |
0018afd0: 00400008 jr r2                             >>jump to case pointer
0018afd4: 00000000 nop                               |

                                            --- A-Save section ---
0018afd8: 3c038019 lui r3,0x8019                     | 
0018afdc: 8c632d90 lw r3,0x2d90(r3)                  |r3 = target current action data pointer
0018afe0: 34020081 ori r2,r0,0x0081                  |r2 = 0x81
0018afe4: 08062c86 j 0x0018b218                      >>jump to store attack type section
0018afe8: a0620014 sb r2,0x0014(r3)                  |store 0x81 in Target current action PA change (Bonus + 1 PA)

                                            --- MA-Save section ---
0018afec: 3c038019 lui r3,0x8019                     | 
0018aff0: 8c632d90 lw r3,0x2d90(r3)                  |r3 = target current action data pointer
0018aff4: 34020081 ori r2,r0,0x0081                  |r2 = 0x81
0018aff8: 08062c86 j 0x0018b218                      >>jump to store attack type section
0018affc: a0620015 sb r2,0x0015(r3)                  |store 0x81 in Target current action MA change (Bonus + 1 MA)

                                            --- Speed-Save section ---
0018b000: 3c038019 lui r3,0x8019                     | 
0018b004: 8c632d90 lw r3,0x2d90(r3)                  |r3 = target current action data pointer
0018b008: 34020081 ori r2,r0,0x0081                  |r2 = 0x81
0018b00c: 08062c86 j 0x0018b218                      >>jump to store attack type section
0018b010: a0620012 sb r2,0x0012(r3)                  |store 0x81 in Target current action speed change (Bonus + 1 speed)

                                            --- Sunken State---
0018b014: 00002021 addu r4,r0,r0                     |r4 = 0 (for status validation jal)
0018b018: 3c038019 lui r3,0x8019                     |
0018b01c: 8c632d90 lw r3,0x2d90(r3)                  |r3 = target current action data pointer
0018b020: 34020010 ori r2,r0,0x0010                  |r2 = 0x10 (sunken state flag)
0018b024: 08062c1c j 0x0018b070                      >>jump to end of regenerator section :  Status change validation
0018b028: a062001d sb r2,0x001d(r3)                  |Store transparent in target current action status infliction set 3

                                            ---  Caution ---
0018b02c: 00002021 addu r4,r0,r0                     |r4 = 0 (for status validation jal)
0018b030: 3c038019 lui r3,0x8019                     |
0018b034: 8c632d90 lw r3,0x2d90(r3)                  |r3 = target current action data pointer
0018b038: 34020002 ori r2,r0,0x0002                  |r2 = 02 (defending flag)
0018b03c: 08062c1c j 0x0018b070                      >>jump to end of regenerator section :  Status change validation
0018b040: a062001b sb r2,0x001b(r3)                  |Store defending in target current action status infliction set 1

                                            --- Dragon Spirit ---
0018b044: 00002021 addu r4,r0,r0                     |r4 = 0 (for status validation jal)
0018b048: 3c038019 lui r3,0x8019                     |
0018b04c: 8c632d90 lw r3,0x2d90(r3)                  |r3 = target current action data pointer
0018b050: 34020020 ori r2,r0,0x0020                  |r2 = 0x20 (reraise flag)
0018b054: 08062c1c j 0x0018b070                      >>jump to end of regenerator section :  Status change validation
0018b058: a062001d sb r2,0x001d(r3)                  |Store reraise in target current action status infliction set 3

                                            ---  Regenerator ---
0018b05c: 00002021 addu r4,r0,r0                     |r4 = 0 (for status validation jal)
0018b060: 3c038019 lui r3,0x8019                     |
0018b064: 8c632d90 lw r3,0x2d90(r3)                  |r3 = target current action data pointer
0018b068: 34020040 ori r2,r0,0x0040                  |r2 = 0x40 (regen flag)
0018b06c: a062001e sb r2,0x001e(r3)                  |Store regen in target current action status infliction set 4
0018b070: 0c0612c9 jal 0x00184b24                    |-->Modify_Status_Inflictions Multiples check - may result in no status infliction
0018b074: 00000000 nop                               |
0018b078: 10400067 beq r2,r0,0x0018b218              #If status infliction is ok /Else no status infliction : branch to to store attack type section
0018b07c: 00000000 nop                               |
0018b080: 08062c86 j 0x0018b218                          >>jump to store attack type section
0018b084: 34100008 ori r16,r0,0x0008                     |r16 = 0x08 (status change flag for current action attack type)

                                            --- Brave Up ---
0018b088: 3c038019 lui r3,0x8019                     | 
0018b08c: 8c632d90 lw r3,0x2d90(r3)                  |r3 = target current action data pointer
0018b090: 34020083 ori r2,r0,0x0083                  |r2 = 0x83
0018b094: 08062c86 j 0x0018b218                      >>jump to store attack type section
0018b098: a0620016 sb r2,0x0016(r3)                  |store 0x83 in Target current action brave change (Bonus + 3)

                                            ---  Faith Up ---
0018b09c: 3c038019 lui r3,0x8019                     | 
0018b0a0: 8c632d90 lw r3,0x2d90(r3)                  |r3 = target current action data pointer
0018b0a4: 34020083 ori r2,r0,0x0083                  |r2 = 0x83
0018b0a8: 08062c86 j 0x0018b218                      >>jump to store attack type section
0018b0ac: a0620017 sb r2,0x0017(r3)                  |store 0x83 in Target current action faith change (Bonus + 3)

                                            --- HP restore ---
0018b0b0: 3c038019 lui r3,0x8019                     | 
0018b0b4: 8c632d98 lw r3,0x2d98(r3)                  |r3 = target data pointer
0018b0b8: 34100040 ori r16,r0,0x0040                 |r16 = 0x40 (attack type will be HP recovery)
0018b0bc: 9462002a lhu r2,0x002a(r3)                 |r2 =  target Max HP
0018b0c0: 94630028 lhu r3,0x0028(r3)                 |r3 =  target HP
0018b0c4: 3c048019 lui r4,0x8019                     |
0018b0c8: 8c842d90 lw r4,0x2d90(r4)                  |r4 = target current action data pointer
0018b0cc: 00431023 subu r2,r2,r3                     |r2 = target missing HP
0018b0d0: 08062c86 j 0x0018b218                      >>jump to store attack type section
0018b0d4: a4820006 sh r2,0x0006(r4)                  |Store missing HP as Target current action HP recovery

                                            --- MP restore ---
0018b0d8: 3c038019 lui r3,0x8019                     | 
0018b0dc: 8c632d98 lw r3,0x2d98(r3)                  |r3 = target data pointer
0018b0e0: 34100010 ori r16,r0,0x0010                 |r16 = 0x10 (attack type will be MP recovery)
0018b0e4: 9462002e lhu r2,0x002e(r3)                 |r2 =  target Max MP
0018b0e8: 9463002c lhu r3,0x002c(r3)                 |r3 =  target current MP
0018b0ec: 3c048019 lui r4,0x8019                     |
0018b0f0: 8c842d90 lw r4,0x2d90(r4)                  |r4 = target current action data pointer
0018b0f4: 00431023 subu r2,r2,r3                     |r2 = target missing MP
0018b0f8: 08062c86 j 0x0018b218                      >>jump to store attack type section
0018b0fc: a482000a sh r2,0x000a(r4)                  |Store missing MP as Target current action MP recovery

                                            --- Critical quick  ---
0018b100: 3c038019 lui r3,0x8019                     | 
0018b104: 8c632d90 lw r3,0x2d90(r3)                  |r3 = target current action data pointer
0018b108: 340200ff ori r2,r0,0x00ff                  |r2 = 0xff (will be CT100)
0018b10c: 08062c86 j 0x0018b218                      >>jump to store attack type section
0018b110: a0620013 sb r2,0x0013(r3)                  |store Target current action CT change  =  CT100

                                            --- Meatbone slash  ---
0018b114: 3c028019 lui r2,0x8019                     | 
0018b118: 8c422d94 lw r2,0x2d94(r2)                  |r2 = Attacker data pointer
0018b11c: 3c038019 lui r3,0x8019                     |
0018b120: 8c632d90 lw r3,0x2d90(r3)                  |r3 = Target current action data pointer
0018b124: 9442002a lhu r2,0x002a(r2)                 |r2 = Attacker max HP
0018b128: 34100080 ori r16,r0,0x0080                 |r16 = 0x80 (attack type will be HP damage)
0018b12c: 08062c86 j 0x0018b218                      >>jump to store attack type section
0018b130: a4620004 sh r2,0x0004(r3)                  |Store attacker max HP as Target current action HP damage

                                            --- Absorb used MP  ---
0018b134: 3c028019 lui r2,0x8019                     | 
0018b138: 8c422d90 lw r2,0x2d90(r2)                  |r2 = Target current action data pointer
0018b13c: 00000000 nop                               |
0018b140: 94430026 lhu r3,0x0026(r2)                 |r3 = Target last attack received
0018b144: 34100010 ori r16,r0,0x0010                 |r16 = 0x10 (attack type will be MP recovery)
0018b148: 08062c86 j 0x0018b218                      >>jump to store attack type section
0018b14c: a443000a sh r3,0x000a(r2)                  |store last attack received as target current action MP recovery ? (is this value transformed by another routine?)

                                            ---  Gilgame heart  ---
0018b150: 3c038019 lui r3,0x8019                     | 
0018b154: 8c632d90 lw r3,0x2d90(r3)                  |r3 = Target current action data pointer
0018b158: 00000000 nop                               |
0018b15c: 94620026 lhu r2,0x0026(r3)                 |r2 = Target last attack received
0018b160: 08062c86 j 0x0018b218                      >>jump to store attack type section
0018b164: a462000c sh r2,0x000c(r3)                  |store last attack received as  target current action  gil stolen/lost ? (is this value transformed by another routine?)

                                            ---  Distribute ---
0018b168: 3c038019 lui r3,0x8019                     | 
0018b16c: 8c633878 lw r3,0x3878(r3)                  |r3 = Targets hit counter
0018b170: 00000000 nop                               |
0018b174: 1060000c beq r3,r0,0x0018b1a8              #If number of targets hit <> 0x00
0018b178: 00000000 nop                                   | 
0018b17c: 3c028019 lui r2,0x8019                         | 
0018b180: 8c422d94 lw r2,0x2d94(r2)                      |r2 = Attacker data pointer
0018b184: 00000000 nop                                   |
0018b188: 944201b2 lhu r2,0x01b2(r2)                     |r2 = attacker last attack received
0018b18c: 00000000 nop                                   |
0018b190: 00431021 addu r2,r2,r3                         |r2 = last attack received + targets hit counter
0018b194: 2442ffff addiu r2,r2,-0x0001                   |r2 = last attack received + targets hit counter -1 (it's a way to round up the fraction of heal ?)
0018b198: 0043001a div r2,r3                             |r2 / number of targets
0018b19c: 00001812 mflo r3                               |r3 =(last attack received + targets hit counter -1)/targets hit counter
0018b1a0: 08062c6b j 0x0018b1ac                          >>jump keeping r3 value
0018b1a4: 00000000 nop                                   |
0018b1a8: 00001821 addu r3,r0,r0                     #E r3 = 0x00
0018b1ac: 3c028019 lui r2,0x8019                     |
0018b1b0: 8c422d90 lw r2,0x2d90(r2)                  |r2 = Target current action data pointer
0018b1b4: 34100040 ori r16,r0,0x0040                 |r16 = 0x40 (attack type will be HP recovery)
0018b1b8: 08062c86 j 0x0018b218                      >>jump to store attack type section
0018b1bc: a4430006 sh r3,0x0006(r2)                  |store r3 as target current action hp recovery

                                            ---  Damage Split ---
0018b1c0: 3c028019 lui r2,0x8019                     | 
0018b1c4: 8c422d94 lw r2,0x2d94(r2)                  |r2 = Attacker data pointer
0018b1c8: 3c048019 lui r4,0x8019                     |
0018b1cc: 8c842d90 lw r4,0x2d90(r4)                  |r4 = Target current action data pointer
0018b1d0: 3c038019 lui r3,0x8019                     |
0018b1d4: 8c632d8c lw r3,0x2d8c(r3)                  |r3 = Attacker current action data pointer
0018b1d8: 944201b2 lhu r2,0x01b2(r2)                 |r2 = attacker last attack received
0018b1dc: 34100080 ori r16,r0,0x0080                 |r16 = 0x80 (attack type will be HP damage)
0018b1e0: a4820004 sh r2,0x0004(r4)                  |store last attack received as target current action HP damage
0018b1e4: a4620006 sh r2,0x0006(r3)                  |store last attack received as attacker current action HP recovery
0018b1e8: 34020040 ori r2,r0,0x0040                  |r2 = 0x40
0018b1ec: a0620025 sb r2,0x0025(r3)                  |Store Attacker current action attack type as HP recovery
0018b1f0: 3c038019 lui r3,0x8019                     |
0018b1f4: 8c632d8c lw r3,0x2d8c(r3)                  |r3 = Attacker current action data pointer
0018b1f8: 34020001 ori r2,r0,0x0001                  |r2 = 0x01
0018b1fc: 08062c86 j 0x0018b218                      >>jump to store attack type section
0018b200: a0620000 sb r2,0x0000(r3)                  |Store Attacker current action hit flag as hit

                                            -- Post Damage split reaction abilities--
0018b204: 3c038019 lui r3,0x8019                 | 
0018b208: 8c632d90 lw r3,0x2d90(r3)              |r3 = Target current action data pointer
0018b20c: 2402ffff addiu r2,r0,-0x0001           |r2 = -0x0001
0018b210: 08062c98 j 0x0018b260                  >>jumps to end  
0018b214: a0600025 sb r0,0x0025(r3)              |Store target current action hit flag as miss (Talcall here, This jump is for reactions that trigger a counter-ability, like counter Magic, or Counter attack.)
 
                                            -- Store attack type section --
0018b218: 3c028019 lui r2,0x8019                 | 
0018b21c: 8c422d90 lw r2,0x2d90(r2)              |r2 = target current action data pointer
0018b220: 0c062e91 jal 0x0018ba44                |-->Set_some_data_for_current_attack  Check target status (targetable ?), cap HP and MP to 999, deals with killing blows and golem
0018b224: a0500025 sb r16,0x0025(r2)             |store target current action attack type (depend of sections above)
0018b228: 3c038019 lui r3,0x8019                 |
0018b22c: 8c632d90 lw r3,0x2d90(r3)              |r3 = target current action data pointer
0018b230: 00000000 nop                           |
0018b234: 94620010 lhu r2,0x0010(r3)             |r2 = Target current action specials flags
0018b238: 00000000 nop                           |
0018b23c: 10400005 beq r2,r0,0x0018b254          #If there is a special flag enabled /Else branch to almost end
0018b240: 00000000 nop                               | 
0018b244: 90620025 lbu r2,0x0025(r3)                 |r2 = Target current action attack type
0018b248: 00000000 nop                               | 
0018b24c: 34420001 ori r2,r2,0x0001                  |Update r2 with 0x01 enabled
0018b250: a0620025 sb r2,0x0025(r3)                  |store updated attack type with pseudo status flags enabled
0018b254: 3c018019 lui r1,0x8019                     |
0018b258: a42038c6 sh r0,0x38c6(r1)              |Clear current ability reaction ID
0018b25c: 34020001 ori r2,r0,0x0001              |r2 = 0x1
0018b260: 8fbf0014 lw r31,0x0014(r29)            |(landing site of jump for abilities not supported b this routine)
0018b264: 8fb00010 lw r16,0x0010(r29)            |
0018b268: 27bd0018 addiu r29,r29,0x0018          
0018b26c: 03e00008 jr r31                        
0018b270: 00000000 nop                          

Return locations

0018b404: Pre_Formula_Setup_(FDC)