Calculate MP% damage

From Final Fantasy Hacktics Wiki
Revision as of 19:20, 16 April 2022 by Orkney (talk | contribs)
Jump to navigation Jump to search
No Parameters - Returns Nothing

Set Target Current Action (TCA) MP damage = Target Max MP * Ability Y%
Set TCA attack Type = MP damage
----------------------------------------------------------------------------------------------
0018668c: 3c028019 lui r2,0x8019            |
00186690: 8c422d98 lw r2,0x2d98(r2)         |r2 = Target data pointer
00186694: 00000000 nop                      |
00186698: 9443002e lhu r3,0x002e(r2)        |r3 = Target max Mp
0018669c: 3c028019 lui r2,0x8019            |
001866a0: 904238fa lbu r2,0x38fa(r2)        |r2 = Current Ability used Ability Y  0x801938fa / 801938fa
001866a4: 00000000 nop                      |
001866a8: 00620018 mult r3,r2               |Max MP * Y max MP*Y
001866ac: 3c0351eb lui r3,0x51eb            |
001866b0: 00001012 mflo r2                  |r2 = Target's Max MP * Ability Y
001866b4: 3463851f ori r3,r3,0x851f         |r3 = 0x51eb851f  (0,32 * 2^32)
001866b8: 24420063 addiu r2,r2,0x0063       |r2 = Target's Max MP * Ability Y + 99 ( to round up the result/100)
001866bc: 00430018 mult r2,r3               |r2 = Max MP * Ability Y * 0,32*2^32
001866c0: 27bdfff8 addiu r29,r29,-0x0008    |
001866c4: 3c038019 lui r3,0x8019            |
001866c8: 8c632d90 lw r3,0x2d90(r3)         |r3 = Target Current Action (TCA) data pointer
001866cc: 34020020 ori r2,r0,0x0020         |r2 = 0x20 (MP damage attack type)
001866d0: a0620025 sb r2,0x0025(r3)         |Set TCA Action type to MP damage (disables other flags)
001866d4: 00001010 mfhi r2                  |r2 = Target Max MP * Ability Y * 32 /100
001866d8: 00021143 sra r2,r2,0x05           |r2 = Target Max MP * Ability Y /100    (r2/32)
001866dc: a4620008 sh r2,0x0008(r3)         |Set TCA MP damage to Max MP * Y%
001866e0: 27bd0008 addiu r29,r29,0x0008     |
001866e4: 03e00008 jr r31                   |
001866e8: 00000000 nop                      |

Return locations

Battle.bin
001890b4: Formula 0f : AbsMP (Y)% Hit F(MA+X)%
0018936c: Formula 1b : DmgMP (MA+Y)% Hit F(X)%
00189b10: Formula 2c : DmgMP (X)% Hit (PA+Y)%