Calculate HP% damage

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

Set Target Current Action (TCA) HP damage to [Ability Y]% of [Target Max HP]  (Y is loaded from 0x801938fa)                                           
Enable HP damage in TCA Attack Type (preserves previous flags)
---------------------------------------------------------------------------------------------
00186624: 3c028019 lui r2,0x8019           
00186628: 8c422d98 lw r2,0x2d98(r2)         |r2 = Target data pointer
0018662c: 00000000 nop                      |
00186630: 9443002a lhu r3,0x002a(r2)        |r3 = Target's max HP
00186634: 3c028019 lui r2,0x8019            |
00186638: 904238fa lbu r2,0x38fa(r2)        |r2 = Current Ability used Ability Y
0018663c: 00000000 nop                      |
00186640: 00620018 mult r3,r2               |Target Max HP * Ability Y
00186644: 3c0351eb lui r3,0x51eb            |
00186648: 00001012 mflo r2                  |r2 = Max HP * Ability Y
0018664c: 3463851f ori r3,r3,0x851f         |r3 = 0x51eb851f (= 0,32 * 2^32)
00186650: 24420063 addiu r2,r2,0x0063       |r2 = Max HP * Ability Y + 99 (rouding process)
00186654: 00430018 mult r2,r3               |(Max HP * Ability Y + 99)* 0,32*2^32
00186658: 3c038019 lui r3,0x8019            |
0018665c: 8c632d90 lw r3,0x2d90(r3)         |r3 = Target Current Action (TCA) data pointer
00186660: 00000000 nop                      |
00186664: 90620025 lbu r2,0x0025(r3)        |r2 = TCA Attack type
00186668: 27bdfff8 addiu r29,r29,-0x0008    |
0018666c: 34420080 ori r2,r2,0x0080         |r2 = Attack type enhanced with HP damage
00186670: a0620025 sb r2,0x0025(r3)         |Store Updated Attack Type (HP damage flag is ON)
00186674: 00001010 mfhi r2                  |r2 = (Max HP * Ability Y + 99)* 32/100
00186678: 00021143 sra r2,r2,0x05           |r2 = Max HP * Ability Y/100 (rounded up)
0018667c: a4620004 sh r2,0x0004(r3)         |Store HP Damage (Y% of Max HP)
00186680: 27bd0008 addiu r29,r29,0x0008     
00186684: 03e00008 jr r31                   
00186688: 00000000 nop                      

Return Locations

Battle.bin
00188e24: 09 Dmg_(Y/100)% Hit_F(MA+X)%
00188f78: 0D Heal_(Y)% Hit_F(MA+X)%
0018906c: 0E Dmg_(Y)% Hit_F(MA+X)% 100% Status Hide Status
0018910c: 10 AbsHP_(Y)% Hit_F(MA+X)%
00189f6c: 35 Heal_(Y)% Hit_(PA+X)%
0018a230: 47 AbsHP_(Y)% 100% Status
0018a408: 4D AbsHP_(Y)% Hit_(MA+X)% 
0018a614: 53 Dmg_(X)% Hit_(MA+X)%