Level up/down ability

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
No parameters

Returns r2 = 0x01 if there is Lv alteration special flag (malus or bonus)
        r2 = 0x00 if current action doesn't modify Unit Lv
---------------------------------------------------------------------------------
0018c85c: 3c028019 lui r2,0x8019            |
0018c860: 8c422d90 lw r2,0x2d90(r2)         |Target Current Action (TCA) data pointer
0018c864: 27bdffe8 addiu r29,r29,-0x0018    |
0018c868: afbf0010 sw r31,0x0010(r29)       |
0018c86c: 94430010 lhu r3,0x0010(r2)        |Load TCA Specials flags
0018c870: 00000000 nop                      |
0018c874: 30620080 andi r2,r3,0x0080        |Check for Lv Bonus
0018c878: 1040000c beq r2,r0,0x0018c8ac     #If Lv bonus special flag is ON
0018c87c: 30620100 andi r2,r3,0x0100        |Check for Lv Malus
0018c880: 3c028019 lui r2,0x8019                |
0018c884: 8c422d98 lw r2,0x2d98(r2)             |Target data pointer
0018c888: 00000000 nop                          |
0018c88c: 90420022 lbu r2,0x0022(r2)            |Load Target Lv
0018c890: 00000000 nop                          |
0018c894: 24430001 addiu r3,r2,0x0001           |r3 = Target Lv + 1
0018c898: 28620064 slti r2,r3,0x0064            |r2 = 0x01 if Target Lv < 100
0018c89c: 1440000e bne r2,r0,0x0018c8d8         #If Target new Lv is > 99 /Else branch and store r3 as new Lv
0018c8a0: 00002821 addu r5,r0,r0                |r5 = 0x00 (for Lv up routine)
0018c8a4: 08063236 j 0x0018c8d8                     >>jump and force unit Lv to 99
0018c8a8: 34030063 ori r3,r0,0x0063                 |r3 = 99
0018c8ac: 10400018 beq r2,r0,0x0018c910     #If Lv Malus special flag is ON /Else branch to END
0018c8b0: 00001021 addu r2,r0,r0            |r2 = 0x00
0018c8b4: 3c028019 lui r2,0x8019                |
0018c8b8: 8c422d98 lw r2,0x2d98(r2)             |Target data pointer
0018c8bc: 00000000 nop                          |
0018c8c0: 90420022 lbu r2,0x0022(r2)            |Load Target Lv
0018c8c4: 00000000 nop                          |
0018c8c8: 2443ffff addiu r3,r2,0xffff           |r3 = Target Lv - 1
0018c8cc: 1c600002 bgtz r3,0x0018c8d8           #If Target new Lv is < 1
0018c8d0: 34050001 ori r5,r0,0x0001             |r5 = 0x01
0018c8d4: 34030001 ori r3,r0,0x0001                 |Force r3 to 1 (Lv can't be 0)
0018c8d8: 3c028019 lui r2,0x8019            |
0018c8dc: 8c42f5fc lw r2,-0x0a04(r2)        |Load Action State  0x8018f5fc
0018c8e0: 00000000 nop                      |
0018c8e4: 1440000a bne r2,r0,0x0018c910     #If Action is been executed / Avoid if preview or AI simulation
0018c8e8: 34020001 ori r2,r0,0x0001         |r2 = 0x01
0018c8ec: 3c028019 lui r2,0x8019                |
0018c8f0: 8c422d98 lw r2,0x2d98(r2)             |Target data pointer
0018c8f4: 00000000 nop                          |
0018c8f8: a0430022 sb r3,0x0022(r2)             |Store new Lv
0018c8fc: 3c048019 lui r4,0x8019                |
0018c900: 8c842d98 lw r4,0x2d98(r4)             |r4 = Target data pointer
0018c904: 0c017684 jal 0x0005da10               |-->Level_Up_Section
0018c908: 00000000 nop                          |
0018c90c: 34020001 ori r2,r0,0x0001             |r2 = 0x01
0018c910: 8fbf0010 lw r31,0x0010(r29)       END
0018c914: 27bd0018 addiu r29,r29,0x0018
0018c918: 03e00008 jr r31
0018c91c: 00000000 nop

Return location

Battle.bin
0018c244: Attack_Finalisation_&_Reaction_Flagging