Elemental Damage Modification

From Final Fantasy Hacktics Wiki
Revision as of 20:15, 27 April 2022 by Orkney (talk | contribs)
Jump to navigation Jump to search
Parameters : r4 = Current Ability Weapon Element (0x80193904) or used Ability element

Returns Nothing

If One element is absorbed : enabled TCA special flag 2 0x04
If One element is nullified : Set TCA to miss and skip everything else (no damage , nothing...)
                              Set TCA Evade type to 0x05
If One element is Halved : TCA HP damage is halved
If One element is a weakness : TCA HP damage is doubled
                               Enabled TCA special flag 2 0x08
----------------------------------------------------------------------------------------------
00184e98: 3c028019 lui r2,0x8019            |
00184e9c: 8c422d98 lw r2,0x2d98(r2)         |r2 = Target Data Pointer
00184ea0: 27bdffe8 addiu r29,r29,-0x0018    |
00184ea4: afbf0010 sw r31,0x0010(r29)       |
00184ea8: 9042006d lbu r2,0x006d(r2)        |r2 =  Target's Elemental Absorption
00184eac: 00802821 addu r5,r4,r0            |r5 = Current Ability Weapon's Element  0x80193904 / 80193904
00184eb0: 00451024 and r2,r2,r5             |r2 <> 0x00 If Target absorbs Weapon's Element
00184eb4: 10400008 beq r2,r0,0x00184ed8     #If Current Ability Weapon's Element is absorbed
00184eb8: 00000000 nop                          |
00184ebc: 3c038019 lui r3,0x8019                |
00184ec0: 8c632d90 lw r3,0x2d90(r3)             |r3 = Target Current action (TCA) data pointer
00184ec4: 00000000 nop                          |
00184ec8: 94620010 lhu r2,0x0010(r3)            |r2 = TCA specials flags 1 et 2
00184ecc: 00000000 nop                          |
00184ed0: 34420400 ori r2,r2,0x0400             |r2 = Special flag 2 with 0x04 enabled (Absorption)
00184ed4: a4620010 sh r2,0x0010(r3)             |Store TCA special flags with Absorption enabled Store ?
00184ed8: 3c038019 lui r3,0x8019            |
00184edc: 8c632d98 lw r3,0x2d98(r3)         |r3 = Target data pointer
00184ee0: 00000000 nop                      |
00184ee4: 9062006e lbu r2,0x006e(r3)        |r2 = Target's Elemental  Nullification
00184ee8: 00000000 nop                      |
00184eec: 00451024 and r2,r2,r5             |r2 <> 0x00 If Target nullify Weapon's Element
00184ef0: 10400005 beq r2,r0,0x00184f08     #If Current Ability Weapon's Element is Nullified
00184ef4: 00000000 nop                          |
00184ef8: 0c061390 jal 0x00184e40               |-->Elemental_Nullification Clear Some TCA flag - TCA will miss
00184efc: 00000000 nop                          |
00184f00: 080613e3 j 0x00184f8c                 >>jump to END
00184f04: 00000000 nop                          |
                                            #Else (Element not nullified)
00184f08: 9062006f lbu r2,0x006f(r3)        |r2 = Target's Elemental Halving
00184f0c: 00000000 nop                      |
00184f10: 00451024 and r2,r2,r5             |r2 <> 0x00 If Weapon Element is halved
00184f14: 1040000c beq r2,r0,0x00184f48     #If Current Ability Weapon's Element is Halved
00184f18: 00000000 nop                          |
00184f1c: 3c028019 lui r2,0x8019                |
00184f20: 8c422d90 lw r2,0x2d90(r2)             |Load Current Action Data Pointer
00184f24: 00000000 nop                          |
00184f28: 94430004 lhu r3,0x0004(r2)            |r3 = TCA HP Damage
00184f2c: 00000000 nop                          |
00184f30: 00031c00 sll r3,r3,0x10               |r3 = HP Damage shifted in upper registery
00184f34: 00032403 sra r4,r3,0x10               |r4 = HP Damage (halfword)
00184f38: 00031fc2 srl r3,r3,0x1f               |r3 = Higher bit of HP Damage (for rounding up)
00184f3c: 00832021 addu r4,r4,r3                |r4 = HP Damage (+ 0 or +1)
00184f40: 00042043 sra r4,r4,0x01               |r4 = HP Damage / 2
00184f44: a4440004 sh r4,0x0004(r2)             |Store Halved HP Damage
00184f48: 3c028019 lui r2,0x8019            |
00184f4c: 8c422d98 lw r2,0x2d98(r2)         |r2 = Target Data Pointer
00184f50: 00000000 nop                      |
00184f54: 90420070 lbu r2,0x0070(r2)        |r2 = Target's Elemental Weakness
00184f58: 00000000 nop                      |
00184f5c: 00451024 and r2,r2,r5             |r2 <> 0x00 if Target is weak against Weapon Element 
00184f60: 1040000a beq r2,r0,0x00184f8c     #If Target is weak against Weapon Element 
00184f64: 00000000 nop                          |
00184f68: 3c028019 lui r2,0x8019                |
00184f6c: 8c422d90 lw r2,0x2d90(r2)             |r2 = TCA Data Pointer
00184f70: 00000000 nop                          |
00184f74: 94430010 lhu r3,0x0010(r2)            |r3 = Current action special Flags 1 and 2
00184f78: 84440004 lh r4,0x0004(r2)             |r4 = TCA HP Damage
00184f7c: 34630800 ori r3,r3,0x0800             |Enable Target Weakness flag (TCA special flag 2 0x08)
00184f80: 00042040 sll r4,r4,0x01               |HP Damage * 2
00184f84: a4430010 sh r3,0x0010(r2)             |Store TCA special flags with Weakness flag enabled (special flag 2 0x08)
00184f88: a4440004 sh r4,0x0004(r2)             |Store doubled HP damage
00184f8c: 8fbf0010 lw r31,0x0010(r29)       END
00184f90: 27bd0018 addiu r29,r29,0x0018     
00184f94: 03e00008 jr r31                   
00184f98: 00000000 nop

Return locations

Battle.bin
00186fe8: Elemental Damage Modification (Prep)
001870e8: Ability Elemental?  Apply Elemental - Glain