Katana Break Chance

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
Break chances are WP%
- If weapon breaks : set Attacker current action special flag to 0x10
- If weapon do not break : set attacker special flag to 0x08

Notes : -Skip the routine if attacker is a mime ( hard coded mechanics )
        -Special flag 1 0x08 and special flag 2 0x10 overrides every other specials flags (1 and 2)  in Draw_out_routine_dealing_with_experience_gain - called after the end of preformula routine
        -Breaking a katana leads to special flag 1 0x10 (steal item) - but in Draw_out_routine_dealing_with_experience_gain it's special flag 2 0x10 which is checked (bug?)
-----------------------------------------------------------------------------------------------------
00187910: 3c028019 lui r2,0x8019            |
00187914: 8c422d94 lw r2,0x2d94(r2)         |r2 = Attacker data pointer
00187918: 27bdffe8 addiu r29,r29,-0x0018    |
0018791c: afbf0010 sw r31,0x0010(r29)       |
00187920: 90430003 lbu r3,0x0003(r2)        |r3 = Attacker's Job
00187924: 3402005d ori r2,r0,0x005d         |r2 = 0x5d (Mime job ID)
00187928: 10620023 beq r3,r2,0x001879b8     #If Attacker's Job is not Mime /Else branch to END            Mime check
0018792c: 34020001 ori r2,r0,0x0001              |r2 = 0x01
00187930: 3c038019 lui r3,0x8019                 |r3 = 0x80190000
00187934: 8c632d8c lw r3,0x2d8c(r3)              |r3 = Attacker Current Action pointer (ACA pointer)
00187938: 00000000 nop                           |
0018793c: a0620000 sb r2,0x0000(r3)              |Set ACA hit flag to 0x01 (Hit)
00187940: 3c028019 lui r2,0x8019                 |
00187944: 8c422d94 lw r2,0x2d94(r2)              |r2 = Attacker data pointer
00187948: 3c038019 lui r3,0x8019                 |
0018794c: 8c632d8c lw r3,0x2d8c(r3)              |r3 = Attacker Current Action pointer (ACA pointer)
00187950: 90420176 lbu r2,0x0176(r2)             |r2 = Attacker used Item
00187954: 00000000 nop                           |
00187958: a0620003 sb r2,0x0003(r3)              |Store used item as ACA item to break/use
0018795c: 3c038019 lui r3,0x8019                 |
00187960: 8c632d8c lw r3,0x2d8c(r3)              |r3 = Attacker Current Action pointer (ACA pointer)
00187964: 34020008 ori r2,r0,0x0008              |r2 = 0x08
00187968: a0620002 sb r2,0x0002(r3)              |Set ACA evade type = 0x08 (canceled)
0018796c: 3c028019 lui r2,0x8019                 |
00187970: 8c42f5fc lw r2,-0x0a04(r2)             |r2 = Action state
00187974: 00000000 nop                           |
00187978: 1440000b bne r2,r0,0x001879a8          #If Action state = 0x00 (executing) /Else branch to "broken" section
0018797c: 00000000 nop                               | 
00187980: 3c058019 lui r5,0x8019                     |r5 = 0x80190000
00187984: 90a53902 lbu r5,0x3902(r5)                 |r5 = Current Ability used weapon power
00187988: 0c017833 jal 0x0005e0cc                    |-->rollChance(R4,R5)  return r2 = 0x00 if random < break chance (= broken)
0018798c: 34040064 ori r4,r0,0x0064                  |r4 = 100 (break chance equals WP%)
00187990: 10400005 beq r2,r0,0x001879a8              #If Katana do not break
00187994: 34020008 ori r2,r0,0x0008                      |r2 = 0x08
00187998: 3c038019 lui r3,0x8019                         |
0018799c: 8c632d8c lw r3,0x2d8c(r3)                      |r3 = Attacker Current Action pointer (ACA pointer)
001879a0: 08061e6e j 0x001879b8                          >>jump to END
001879a4: a4620010 sh r2,0x0010(r3)                      |Store 0x08 as ACA special flag 01 (katana not broken)
001879a8: 3c038019 lui r3,0x8019                 #Else : katana is broken or Action is projected/AI processed
001879ac: 8c632d8c lw r3,0x2d8c(r3)                  |r3 = Attacker Current Action pointer (ACA pointer)
001879b0: 34021000 ori r2,r0,0x1000                  |r2 = 0x1000
001879b4: a4620010 sh r2,0x0010(r3)                  |Store 0x10 as ACA special action flag 1 (steal item ??)
001879b8: 8fbf0010 lw r31,0x0010(r29)       END
001879bc: 27bd0018 addiu r29,r29,0x0018     
001879c0: 03e00008 jr r31                   
001879c4: 00000000 nop

Return location

Battle.bin
001895d4: Formula 20 - Dmg (MA*Y)
00189604: Formula 21 - DmgMP (MA*Y)
00189664: Formula 22 - Hit (100%) Status
0018968c: Formula 23 - Heal (MA*Y)