Poison and Regen

From Final Fantasy Hacktics Wiki
Revision as of 05:32, 24 July 2023 by RetroTypes (talk | contribs)
Jump to navigation Jump to search
#Parameters:
    #r4 = Unit data pointer

#Returns:
    #r2 = Attack Type flag value in Current Action Data (checked later in parent routine)
        #unchanged if unit is not taking damage or healing
        #0x40 if unit is being healed
        #0x80 if unit is taking damage
0018d7c8: 27bdffe8 addiu r29,r29,0xffe8		
0018d7cc: afb00010 sw r16,0x0010(r29)		
0018d7d0: afbf0014 sw r31,0x0014(r29)		
0018d7d4: 0c063691 jal 0x0018da44			Crystal, Dead, Jump, Petrify, Treasure check
0018d7d8: 00808021 addu r16,r4,r0	 	
0018d7dc: 1440001d bne r2,r0,0x0018d854			Branch to end if unit has Crystal,  Dead, Jump, Petrify or Treasure
0018d7e0: 00001021 addu r2,r0,r0		r2 = 0
0018d7e4: 0c063681 jal 0x0018da04			Target pointers
0018d7e8: 02002021 addu r4,r16,r0		
0018d7ec: 9203005b lbu r3,0x005b(r16)		Load Attacker's 4th set of Current  status
0018d7f0: 00000000 nop				
0018d7f4: 30620080 andi r2,r3,0x0080		
0018d7f8: 10400008 beq r2,r0,0x0018d81c			Branch if unit isn't Poisoned
0018d7fc: 00000000 nop				
0018d800: 9602002a lhu r2,0x002a(r16)		Load Max HP
0018d804: 3c038019 lui r3,0x8019		
0018d808: 8c632d90 lw r3,0x2d90(r3)		Load Current Action Data Pointer
0018d80c: 000210c2 srl r2,r2,0x03		Max HP / 8
0018d810: a4620004 sh r2,0x0004(r3)		Store has HP Damage
0018d814: 08063610 j 0x0018d840			
0018d818: 34020080 ori r2,r0,0x0080		Attack Flag (Damage)
0018d81c: 30620040 andi r2,r3,0x0040		
0018d820: 10400008 beq r2,r0,0x0018d844			Branch if unit doesn't have Regen
0018d824: 00000000 nop				
0018d828: 9602002a lhu r2,0x002a(r16)		Load Max HP
0018d82c: 3c038019 lui r3,0x8019		
0018d830: 8c632d90 lw r3,0x2d90(r3)		Load Current Action Data Pointer
0018d834: 000210c2 srl r2,r2,0x03		Max HP / 8
0018d838: a4620006 sh r2,0x0006(r3)		Store has Healing
0018d83c: 34020040 ori r2,r0,0x0040		Attack Flag (Heal)
0018d840: a0620025 sb r2,0x0025(r3)		Store Attack Flag
0018d844: 3c028019 lui r2,0x8019		
0018d848: 8c422d90 lw r2,0x2d90(r2)		Load Current Action Data Pointer
0018d84c: 00000000 nop				
0018d850: 90420025 lbu r2,0x0025(r2)		Load Attack Flag
0018d854: 8fbf0014 lw r31,0x0014(r29)		
0018d858: 8fb00010 lw r16,0x0010(r29)		
0018d85c: 27bd0018 addiu r29,r29,0x0018		
0018d860: 03e00008 jr r31			Return to Routine
0018d864: 00000000 nop     

Return Locations

00182e9c: In between turn control routine