Set EXP Stolen

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
No Parameters - Returns Nothing

Calculate Stolen Xp = Attacker's Speed + Ability Y
 - Stolen Xp is Capped at 100
 - Stolen Xp is Capped at Target Current Xp (no loss of Lv - This make the first cap useless no ?)

If Stolen Xp > 0 
 - Set Both Action type as pseudo status (disable other flags)
 - Set Attacker Action 0x28 = Stolen Xp and Hit flag to HIT
 - Set Target Action 0x28 = Stolen Xp + 0x80 flag ON (Malus probably)
--------------------------------------------------------------------------------------------
00186814: 3c028019 lui r2,0x8019            |
00186818: 8c422d94 lw r2,0x2d94(r2)         |r2 = Attacker data pointer
0018681c: 3c038019 lui r3,0x8019            |
00186820: 906338fa lbu r3,0x38fa(r3)        |r3 = Current Ability used Ability Y
00186824: 27bdffe8 addiu r29,r29,-0x0018    |
00186828: afbf0010 sw r31,0x0010(r29)       |
0018682c: 90420038 lbu r2,0x0038(r2)        |r2 = Attacker's Speed
00186830: 00000000 nop                      |
00186834: 00431021 addu r2,r2,r3            |r2 = Speed + Ability Y
00186838: 00402821 addu r5,r2,r0            |r5 = Speed + Ability Y
0018683c: 30a200ff andi r2,r5,0x00ff        |r2 = Stolen Xp  (Speed + Ability Y (byte only))
00186840: 2c420065 sltiu r2,r2,0x0065       |r2 = 0x01 If Stolen Xp <= 100
00186844: 14400002 bne r2,r0,0x00186850     #If Stolen Xp > 100
00186848: 00000000 nop                          |
0018684c: 34050064 ori r5,r0,0x0064             |r5 = 0x64 (Stolen Xp capped to 100)
00186850: 3c028019 lui r2,0x8019            |
00186854: 8c422d98 lw r2,0x2d98(r2)         |r2 = Target data pointer
00186858: 00000000 nop                      |
0018685c: 90430021 lbu r3,0x0021(r2)        |r3 = Target's Xp
00186860: 30a200ff andi r2,r5,0x00ff        |r2 = Stolen Xp (Capped)
00186864: 0062102b sltu r2,r3,r2            |r2 = 0x01 If Stolen Xp > Target Xp
00186868: 10400003 beq r2,r0,0x00186878     #If Stolen Xp > Target Xp
0018686c: 30a200ff andi r2,r5,0x00ff        |r2 = Stolen Xp (Capped)
00186870: 00602821 addu r5,r3,r0                |r5 = Target Xp
00186874: 30a200ff andi r2,r5,0x00ff            |r2 = Stolen Xp (byte capped at  Target Xp)
00186878: 14400005 bne r2,r0,0x00186890     #If Stolen Xp = 0x00
0018687c: 34030001 ori r3,r0,0x0001         |r3 = 0x01
00186880: 0c0610c3 jal 0x0018430c               |-->Force_Attack_Miss Hit Flag = Miss Hit% = 0 - Evade type = 0x07
00186884: 00000000 nop                          |
00186888: 08061a38 j 0x001868e0                 >>jump to  END
0018688c: 00000000 nop                          |
00186890: 3c028019 lui r2,0x8019            #Else : Stolen Xp > 0x00
00186894: 8c422d8c lw r2,0x2d8c(r2)         |r2 = Attacker Current Action (ACA) Data Pointer
00186898: 00000000 nop                      |
0018689c: a0450028 sb r5,0x0028(r2)         |Set ACA Xp Gain = Stolen Xp
001868a0: 3c028019 lui r2,0x8019            |
001868a4: 8c422d8c lw r2,0x2d8c(r2)         |r2 = ACA Data Pointer
001868a8: 00000000 nop                      |
001868ac: a0430000 sb r3,0x0000(r2)         |Set ACA hit flag to HIT
001868b0: 3c028019 lui r2,0x8019            |
001868b4: 8c422d8c lw r2,0x2d8c(r2)         |r2 = ACA Data Pointer
001868b8: 00000000 nop                      |
001868bc: a0430025 sb r3,0x0025(r2)         |Set ACA attack type to pseudo status change disables other flags
001868c0: 3c048019 lui r4,0x8019            |
001868c4: 8c842d90 lw r4,0x2d90(r4)         |r4 = Target Current Action (TCA) data pointer
001868c8: 24a20080 addiu r2,r5,0x0080       |r2 = Capped Stolen Xp (<0x64) + 0x80 (Malus flag probably)
001868cc: a0820028 sb r2,0x0028(r4)         |Set TCA Xp loss = Stolen Xp
001868d0: 3c028019 lui r2,0x8019            |
001868d4: 8c422d90 lw r2,0x2d90(r2)         |r4 = Target Current Action (TCA) data pointer
001868d8: 00000000 nop                      |
001868dc: a0430025 sb r3,0x0025(r2)         |Set TCA attack type to pseudo status change disables other flags
001868e0: 8fbf0010 lw r31,0x0010(r29)       
001868e4: 27bd0018 addiu r29,r29,0x0018     
001868e8: 03e00008 jr r31
001868ec: 00000000 nop

Return locations

Battle.bin
00189900: 28_StealExp_(Lowest_of_TarCurExp_&_SP+Y)_Hit_(SP+X)%