Apply Status and Check Undead

From Final Fantasy Hacktics Wiki
Revision as of 19:45, 20 August 2021 by Orkney (talk | contribs) (return link)
Jump to navigation Jump to search
#   ROUTINE: APPLY STATUS AND CHECK UNDEAD
#       Applies status to the current action.  Returns 1 if the status was applied, or if the target is undead.  
#       Otherwise, nullifies the action and returns 0.
#       Returns:
#           r2 =    1, if status successfully applied, or target is undead
#                   0, otherwise

8018acdc: 27bdffe8 addiu r29,r29,-0x0018
8018ace0: afbf0010 sw r31,0x0010(r29)
8018ace4: 0c061fad jal 0x80187eb4               #   Apply status (to action) - (Preserve hit status, evade type, hit %)
8018ace8: 00000000 nop
8018acec: 3c028019 lui r2,0x8019
8018acf0: 8c422d90 lw r2,0x2d90(r2)             #   Action
8018acf4: 00000000 nop
8018acf8: 90420025 lbu r2,0x0025(r2)            #   Action.DisplayType
8018acfc: 00000000 nop
8018ad00: 30420008 andi r2,r2,0x0008            
8018ad04: 14400010 bne r2,r0,0x8018ad48         #   if ((Action.DisplayType & TYPE_STATUS) != 0) return 1;      // If status was applied, return 1 (success)
8018ad08: 34020001 ori r2,r0,0x0001
8018ad0c: 3c028019 lui r2,0x8019
8018ad10: 8c422d98 lw r2,0x2d98(r2)             #   Target
8018ad14: 00000000 nop
8018ad18: 90420058 lbu r2,0x0058(r2)            #   Target.CurrentStatus1
8018ad1c: 00000000 nop
8018ad20: 30420010 andi r2,r2,0x0010            
8018ad24: 14400008 bne r2,r0,0x8018ad48         #   if (Target.CurrentStatus1 & STATUS_UNDEAD) return 1;        // If target is undead, return 1 (success)
8018ad28: 34020001 ori r2,r0,0x0001
8018ad2c: 0c061390 jal 0x80184e40               #   Nullify Action ();
8018ad30: 00000000 nop
8018ad34: 00001021 addu r2,r0,r0                
8018ad38: 3c048019 lui r4,0x8019
8018ad3c: 8c842d90 lw r4,0x2d90(r4)             #   Action
8018ad40: 34030007 ori r3,r0,0x0007
8018ad44: a0830002 sb r3,0x0002(r4)             #   Action.EvadeType = 7
8018ad48: 8fbf0010 lw r31,0x0010(r29)           #   return 0;
8018ad4c: 27bd0018 addiu r29,r29,0x0018
8018ad50: 03e00008 jr r31
8018ad54: 00000000 nop
Return Locations
80188f68: Formula 0D - Heal (Y)% Hit F(MA+X)%