Poison and Regen

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
BATTLE.BIN :  - Poison and Regen
------------------------------------------------------------------------------------------
Parameter : r4 = Pointer to unit battle data (801908cc)
Return : r2 = 0x80 if unit is poisoned (damage attack type)
         r2 = 0x40 if unit has regen (heal attack type)
         r2 = 0x00 if nothing happens here
------------------------------------------------------------------------------------------
0018d7c8: 27bdffe8 addiu r29,r29,-0x0018     |
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            |Preserve unit data pointer
0018d7dc: 1440001d bne r2,r0,0x0018d854      #If unit has Crystal,  Dead, Jump, Petrify or Treasure : branch to  END return 0x00
0018d7e0: 00001021 addu r2,r0,r0             |
0018d7e4: 0c063681 jal 0x0018da04            |-->Set_Action_Target_Variables Set  80192d90 and 80192d98 and initialize data
0018d7e8: 02002021 addu r4,r16,r0            |Send unit data pointer
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      #If Unit is poisoned
0018d7fc: 00000000 nop                           |
0018d800: 9602002a lhu r2,0x002a(r16)            |Unit Max HP
0018d804: 3c038019 lui r3,0x8019                 |
0018d808: 8c632d90 lw r3,0x2d90(r3)              |Current Action Data Pointer
0018d80c: 000210c2 srl r2,r2,0x03                |Max HP / 8
0018d810: a4620004 sh r2,0x0004(r3)              |Store Max HP/8 as HP Damage
0018d814: 08063610 j 0x0018d840                  >>Avoid regen and jump to store attack type
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)            |Unit 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 and return 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

BATTLE.BIN
 00182ea4: AI_End_of_turn,_in_between_turn,_etc.