HP Absorption

From Final Fantasy Hacktics Wiki
(Redirected from HP Absorbtion)
Jump to navigation Jump to search
No Parameters - Returns Nothing

Target is not undead : Update Attacker Current Action (ACA) data (Healing Attacker matching the inflicted damage)
Target is undead : 
   - Update Target Current Action : switching HP damge and HP recovery, modify Attack type too
   - Update Attacker current Action : Returns the damage to the attacker

Attacker Current Action Hit flag/ HP damage or recovery / Attack Type are updated here
-------------------------------------------------------------------------------------------------------------------
00187248: 3c028019 lui r2,0x8019            |
0018724c: 8c422d98 lw r2,0x2d98(r2)         |r2 = Target data pointer Load Defender's Stats
00187250: 27bdffe8 addiu r29,r29,-0x0018    |
00187254: afbf0010 sw r31,0x0010(r29)       |
00187258: 90420058 lbu r2,0x0058(r2)        |r2 = Target 1st set of current status Load 1st set of Current Status
0018725c: 00000000 nop                      |
00187260: 30420010 andi r2,r2,0x0010        |r2 = 0x10 if Target is undead
00187264: 1040001e beq r2,r0,0x001872e0     #If Target is Undead
00187268: 00000000 nop                          |
0018726c: 0c062e91 jal 0x0018ba44               |-->Set some data for current attack Checks if Attack is valid before applying any changes to Attacker data
00187270: 00000000 nop                          |
00187274: 3c048019 lui r4,0x8019                |
00187278: 8c842d90 lw r4,0x2d90(r4)             |r4 = Target Current Action(TCA) data pointer
0018727c: 00000000 nop                          |
00187280: 90820000 lbu r2,0x0000(r4)            |r2 = TCA hit flag
00187284: 00000000 nop                          |
00187288: 1040002d beq r2,r0,0x00187340         #If Attack hits (not nullified by routine above) / Else Branch to END
0018728c: 00000000 nop                              |
00187290: 3c038019 lui r3,0x8019                    |
00187294: 8c632d8c lw r3,0x2d8c(r3)                 |r3 = Attacker Current Action (ACA) data pointer
00187298: 94820004 lhu r2,0x0004(r4)                |r2 = TCA HP damage amount
0018729c: 00000000 nop                              |
001872a0: a4620004 sh r2,0x0004(r3)                 |Store HP Damage into ACA (Attacker will be damaged)
001872a4: 34020080 ori r2,r0,0x0080                 |r2 = 0x80 (HP damage attack type)
001872a8: a0620025 sb r2,0x0025(r3)                 |Set ACA attack type to HP damage
001872ac: 3c038019 lui r3,0x8019                    |
001872b0: 8c632d8c lw r3,0x2d8c(r3)                 |r3 = ACA data pointer
001872b4: 34020001 ori r2,r0,0x0001                 |r2 = 0x01 
001872b8: a0620000 sb r2,0x0000(r3)                 |Set ACA hit flag to 0x01 (Attack is hited)
001872bc: 3c028019 lui r2,0x8019                    |
001872c0: 8c422d90 lw r2,0x2d90(r2)                 |r2 = TCA data pointer
001872c4: 00000000 nop                              |
001872c8: 94440004 lhu r4,0x0004(r2)                |r4 = TCA Hp damage Load HP Damage
001872cc: 34030040 ori r3,r0,0x0040                 |r3 = 0x40 (Hp recovery attack type)
001872d0: a4400004 sh r0,0x0004(r2)                 |Nullify TCA Hp damage
001872d4: a0430025 sb r3,0x0025(r2)                 |Store previous HP damage in TCA HP recovery
001872d8: 08061cd0 j 0x00187340                     >>jump to END
001872dc: a4440006 sh r4,0x0006(r2)                 |Set TCA Attack type to HP recovery
                                            #Else (Target is not Undead)
001872e0: 0c062e91 jal 0x0018ba44               |-->Set some data for current attack Checks if Attack is valid before applying any changes to Attacker data
001872e4: 00000000 nop                          |
001872e8: 3c048019 lui r4,0x8019                |
001872ec: 8c842d90 lw r4,0x2d90(r4)             |r2 = TCA data pointer
001872f0: 00000000 nop                          |
001872f4: 90820000 lbu r2,0x0000(r4)            |r2 = TCA hit flag
001872f8: 00000000 nop                          |
001872fc: 10400010 beq r2,r0,0x00187340         #If Attack hits (not nullified by routine above) / Else Branch to END
00187300: 00000000 nop                              |
00187304: 3c038019 lui r3,0x8019                    |
00187308: 8c632d8c lw r3,0x2d8c(r3)                 |r3 = ACA Data Pointer
0018730c: 94820004 lhu r2,0x0004(r4)                |r2 = TCA HP damage
00187310: 00000000 nop                              |
00187314: a4620006 sh r2,0x0006(r3)                 |Store TCA HP damage to ACA HP recovery
00187318: 34020040 ori r2,r0,0x0040                 |r2 = 0x40 (Hp recovery attack type)
0018731c: a0620025 sb r2,0x0025(r3)                 |Set ACA Attack type to HP recovery
00187320: 3c038019 lui r3,0x8019                    |
00187324: 8c632d8c lw r3,0x2d8c(r3)                 |r2 = ACA data pointer
00187328: 34020001 ori r2,r0,0x0001                 |r2 = 0x01
0018732c: a0620000 sb r2,0x0000(r3)                 |Set ACA hit flag to Hit
00187330: 3c038019 lui r3,0x8019                    |
00187334: 8c632d90 lw r3,0x2d90(r3)                 |r3 = TCA data pointer
00187338: 34020080 ori r2,r0,0x0080                 |r2 = 0x80
0018733c: a0620025 sb r2,0x0025(r3)                 |Set TCA attack type to HP damage
00187340: 8fbf0010 lw r31,0x0010(r29)       END         
00187344: 27bd0018 addiu r29,r29,0x0018            
00187348: 03e00008 jr r31                          
0018734c: 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
00188d2c: Formula 06 : AbsHP (Weapon)
00189114: Formula 10 : AbsHP (Y)% Hit F(MA+X)%
00189cc0: Formula 30 : AbsHP (PA*WP)
0018a238: Formula 47 : AbsHP (Y)% 100% Status
0018a410: Formula 4d : AbsHP (Y)% Hit (MA+X)%