MP Absorption

From Final Fantasy Hacktics Wiki
(Redirected from MP Recovery Routine)
Jump to navigation Jump to search
No Parameters - Returns Nothing

Load Target Current Action (TCA) HP damage to use it as MP damage/recovery, then nullify HP damage.
- Set TCA MP damage and TCA attack type = MP damage
- Set Attacker Current Action  (ACA) MP recovery and ACA Attack Type = MP recovery
----------------------------------------------------------------------------------------------------------
0018746c: 3c028019 lui r2,0x8019            |
00187470: 8c422d90 lw r2,0x2d90(r2)         |r2 = Target Current Action (TCA) data pointer
00187474: 27bdffe8 addiu r29,r29,-0x0018    |
00187478: afbf0010 sw r31,0x0010(r29)       |
0018747c: 94440004 lhu r4,0x0004(r2)        |r4 = TCA HP damage
00187480: 34030020 ori r3,r0,0x0020         |r3 = 0x20
00187484: a4400004 sh r0,0x0004(r2)         |Nullify TCA HP damage
00187488: a0430025 sb r3,0x0025(r2)         |Set TCA Attack Type = MP damage (disables other flags)
0018748c: 0c062e91 jal 0x0018ba44           |-->Set_some_data_for_current_attack Checks if Attack is valid before applying any changes to Attacker data
00187490: a4440008 sh r4,0x0008(r2)         |Set TCA MP damage = Previous HP damage
00187494: 3c048019 lui r4,0x8019            |
00187498: 8c842d90 lw r4,0x2d90(r4)         |r4 = TCA data pointer
0018749c: 00000000 nop                      |
001874a0: 90820000 lbu r2,0x0000(r4)        |r2 = TCA hit flag
001874a4: 00000000 nop                      |
001874a8: 1040000c beq r2,r0,0x001874dc     #If Attack is not nullified
001874ac: 00000000 nop                          |
001874b0: 3c038019 lui r3,0x8019                |
001874b4: 8c632d8c lw r3,0x2d8c(r3)             |r3 = Attacker Current Action (ACA) data pointer
001874b8: 94820008 lhu r2,0x0008(r4)            |r2 = TCA MP damage
001874bc: 00000000 nop                          |
001874c0: a462000a sh r2,0x000a(r3)             |Set ACA MP recovery  =TCA MP damage
001874c4: 34020010 ori r2,r0,0x0010             |r2 = 0x10 (MP recovery Attack type)
001874c8: a0620025 sb r2,0x0025(r3)             |Set ACA attack type = MP recovery (disables others flags)
001874cc: 3c038019 lui r3,0x8019                |
001874d0: 8c632d8c lw r3,0x2d8c(r3)             |r3 = ACA data pointer
001874d4: 34020001 ori r2,r0,0x0001             |r2 = 0x01
001874d8: a0620000 sb r2,0x0000(r3)             |Set ACA Hit flag to Hit (0x01)
001874dc: 8fbf0010 lw r31,0x0010(r29)       END
001874e0: 27bd0018 addiu r29,r29,0x0018     
001874e4: 03e00008 jr r31                   
001874e8: 00000000 nop

Notes

This routine call Set some data for current attack which is normally called when formula returns in preformula set up routine.
It's used to nullify Action if target can't be hited (Status), and to cap HP and MP amount.
It seems to be used here before any changes to Attacker Current Action data, probably because this changes would not be nullified afterward

Return locations

Battle.bin
001890cc: Formula 0f : AbsMP (Y)% Hit F(MA+X)%
00189c80: Formula 2f : AbsMP (PA*WP)