Difference between revisions of "Elemental Damage Modification"

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

Latest revision as of 20:17, 27 April 2022

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 Ability/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 Ability/Weapon's Element
00184ef0: 10400005 beq r2,r0,0x00184f08     #If Current Ability Ability/Weapon's 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 Ability/Weapon's 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 Ability/Weapon's Element 
00184f60: 1040000a beq r2,r0,0x00184f8c     #If Target is weak against Ability/Weapon's 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