Ability Elemental?

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
No Parameters - Returns Nothing

Modify Target Current Action HP damage based on Ability element (0x801938f7)
- Fire + Oil : - should be HP Dmg * 2 but not working in vanilla (XA is doubled instead of HP damage)
               - Remove Oil from Target (if not Innate)
- Earth + Float : - Nullify Earth damage (If Target is ridding, float is checked on ridden unit)
                  - Set Evade type to 0x07
- Checks for Absorption/Nullification/Halved/Weakness in Elemental_Damage_Modification
-------------------------------------------------------------------------------------------------
00186ff8: 3c028019 lui r2,0x8019            |
00186ffc: 8c422d98 lw r2,0x2d98(r2)         |r2 = Target data pointer
00187000: 27bdffe8 addiu r29,r29,-0x0018    |
00187004: afbf0014 sw r31,0x0014(r29)       |
00187008: afb00010 sw r16,0x0010(r29)       |
0018700c: 9042005a lbu r2,0x005a(r2)        |r2 = 3rd Set of Target current statuses
00187010: 3c108019 lui r16,0x8019           |
00187014: 921038f7 lbu r16,0x38f7(r16)      |r16 = Current Ability : Abilitiy Element  0x801938f7 / 801938f7
00187018: 30420080 andi r2,r2,0x0080        |r2 = 0x80 if Target has Oil
0018701c: 10400015 beq r2,r0,0x00187074     #If Target has Oil
00187020: 32020080 andi r2,r16,0x0080           |r2 = 0x80 If Ability Element is Fire
00187024: 10400013 beq r2,r0,0x00187074         #If Ability Element is Fire
00187028: 00002021 addu r4,r0,r0                |r4 = 0x00
0018702c: 3c028019 lui r2,0x8019                    |
00187030: 844238ce lh r2,0x38ce(r2)                 |r2 = Current Ability XA  0x801938ce / 801938ce
00187034: 3c038019 lui r3,0x8019                    |
00187038: 8c632d90 lw r3,0x2d90(r3)                 |r3 = Target Current Action (TCA) data pointer
0018703c: 00021040 sll r2,r2,0x01                   |XA * 2
00187040: 3c018019 lui r1,0x8019                    |
00187044: a42238ce sh r2,0x38ce(r1)                 |Store doubled XA   !! XA will not be used : this is the vanilla Oil bug. To fix it, TCA HP/MP damage should be doubled)
00187048: 90620022 lbu r2,0x0022(r3)                |r2 = TCA 3rd set of Status removal
0018704c: 00000000 nop                              |
00187050: 34420080 ori r2,r2,0x0080                 |Update r2 with oil removal
00187054: 0c0612c9 jal 0x00184b24                   |-->Modify_Status_Inflictions Checks if Oil can be removed (Not innate)
00187058: a0620022 sb r2,0x0022(r3)                 |Store Updated TCA 3rd set of Status removal
0018705c: 10400005 beq r2,r0,0x00187074             #If There's still something to remove
00187060: 34020008 ori r2,r0,0x0008                     |r2 = 0x08 (Status change flag)
00187064: 3c038019 lui r3,0x8019                        |
00187068: 8c632d90 lw r3,0x2d90(r3)                     |r3 = Target Current Action (TCA) data pointer
0018706c: 00000000 nop                                  |
00187070: a0620025 sb r2,0x0025(r3)                     |Update TCA Attack type (0x25) with Status change flag (0x08)
00187074: 3c038019 lui r3,0x8019            |
00187078: 8c632d98 lw r3,0x2d98(r3)         |r3 = Target data pointer
0018707c: 00000000 nop                      |
00187080: 90640182 lbu r4,0x0182(r3)        |r4 = Target mount infos
00187084: 00000000 nop                      |
00187088: 30820080 andi r2,r4,0x0080        |r2 = 0x0080 if target is riding
0018708c: 10400007 beq r2,r0,0x001870ac     #If Target is riding
00187090: 3082001f andi r2,r4,0x001f            |r2 = ID of ridden unit
00187094: 000218c0 sll r3,r2,0x03               |Ridden ID * 8
00187098: 00621823 subu r3,r3,r2                |Ridden ID * 7
0018709c: 00031980 sll r3,r3,0x06               |Ridden ID * 448 (0x1c0 size of unit data)
001870a0: 3c028019 lui r2,0x8019                |
001870a4: 244208cc addiu r2,r2,0x08cc           |r2 = Start of unit data pointer
001870a8: 00621821 addu r3,r3,r2                |r3 = Ridden Unit's Data pointer (instead of target data pointer)
001870ac: 9062005a lbu r2,0x005a(r3)        |r2 = 3rd Set of Target current statuses
001870b0: 00000000 nop                      |
001870b4: 30420040 andi r2,r2,0x0040        |r2 = 0x0040 if Target has float
001870b8: 10400009 beq r2,r0,0x001870e0     #If Target (or ridden unit) has float
001870bc: 32020008 andi r2,r16,0x0008           |r2 = 0x08 If Ability element is earth
001870c0: 10400007 beq r2,r0,0x001870e0         #If Ability element is Earth
001870c4: 00000000 nop                              |
001870c8: 0c061390 jal 0x00184e40                   |-->Elemental Nullification  Clear Some TCA flag - TCA will miss
001870cc: 00000000 nop                              |
001870d0: 3c038019 lui r3,0x8019                    |
001870d4: 8c632d90 lw r3,0x2d90(r3)                 |r3 =TCA Data Pointer
001870d8: 34020007 ori r2,r0,0x0007                 |r2 = 0x07
001870dc: a0620002 sb r2,0x0002(r3)                 |Set Target Current Action Evade Type to 0x07 
001870e0: 0c0613a6 jal 0x00184e98           |-->Elemental Damage Modification Modify HP damage if Weakness/Halve - Enable absorption flags - Nullify Action if canceled
001870e4: 02002021 addu r4,r16,r0           |r4 = Ability Element
001870e8: 8fbf0014 lw r31,0x0014(r29)       END
001870ec: 8fb00010 lw r16,0x0010(r29)       
001870f0: 27bd0018 addiu r29,r29,0x0018     
001870f4: 03e00008 jr r31                   
001870f8: 00000000 nop

Return locations

Battle.bin
0018879c: Elemental XA * YA
00188e34: 09 Dmg_(Y/100)% Hit_F(MA+X)%
00189d28: 31 Dmg_((PA+Y)/2*PA)
0018a624: 53 Dmg_(X)% Hit_(MA+X)%