Difference between revisions of "Katana Break Chance"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Expanding.)
m
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
  Katana Break Chance:  
+
  Break chances are WP%
  00187910: 3c028019 lui r2,0x8019
+
- If weapon breaks : set Attacker current action special flag to 0x10
  00187914: 8c422d94 lw r2,0x2d94(r2) Load Attacker's Stats
+
- If weapon do not break : set attacker special flag to 0x08
  00187918: 27bdffe8 addiu r29,r29,0xffe8
+
  0018791c: afbf0010 sw r31,0x0010(r29)
+
Notes : -Skip the routine if attacker is a mime ( hard coded mechanics )
  00187920: 90430003 lbu r3,0x0003(r2) Load Attacker's Job
+
        -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
  00187924: 3402005d ori r2,r0,0x005d r2 = 5d
+
        -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?)
  00187928: 10620023 beq r3,r2,0x001879b8 Branch to the end if Attack is Mime (to prevent them from breaking the katana)
+
-----------------------------------------------------------------------------------------------------
  0018792c: 34020001 ori r2,r0,0x0001 R2 = 1
+
  00187910: 3c028019 lui r2,0x8019           |
  00187930: 3c038019 lui r3,0x8019
+
  00187914: 8c422d94 lw r2,0x2d94(r2)         |{{f/adr|<nowiki>r2 = Attacker data pointer</nowiki>}}
  00187934: 8c632d8c lw r3,0x2d8c(r3) Load Attacker Current Action Data  Pointer
+
  00187918: 27bdffe8 addiu r29,r29,-0x0018    |
  00187938: 00000000 nop
+
  0018791c: afbf0010 sw r31,0x0010(r29)       |
  0018793c: a0620000 sb r2,0x0000(r3)
+
  00187920: 90430003 lbu r3,0x0003(r2)       |{{f/load|<nowiki>r3 = Attacker's Job</nowiki>}}
  00187940: 3c028019 lui r2,0x8019
+
  00187924: 3402005d ori r2,r0,0x005d         |{{f/std|<nowiki>r2 = 0x5d (Mime job ID)</nowiki>}}
  00187944: 8c422d94 lw r2,0x2d94(r2) Load Attacker's Stats
+
  00187928: 10620023 beq r3,r2,0x001879b8     {{f/Cond|<nowiki>If Attacker's Job is not Mime</nowiki>}} /Else branch to {{f/loc|<nowiki>END</nowiki>}}            {{f/std|Mime check}}
  00187948: 3c038019 lui r3,0x8019
+
  0018792c: 34020001 ori r2,r0,0x0001             |{{f/std|<nowiki>r2 = 0x01</nowiki>}}
  0018794c: 8c632d8c lw r3,0x2d8c(r3) Load Attacker Current Action Data  Pointer
+
  00187930: 3c038019 lui r3,0x8019                 |{{f/std|<nowiki>r3 = 0x80190000</nowiki>}}
  00187950: 90420176 lbu r2,0x0176(r2)
+
  00187934: 8c632d8c lw r3,0x2d8c(r3)             |{{f/adr|<nowiki>r3 = Attacker Current Action pointer (ACA pointer)</nowiki>}}
  00187954: 00000000 nop
+
  00187938: 00000000 nop                           |
  00187958: a0620003 sb r2,0x0003(r3)
+
  0018793c: a0620000 sb r2,0x0000(r3)             |{{f/store|<nowiki>Set ACA hit flag to 0x01 (Hit)</nowiki>}}
  0018795c: 3c038019 lui r3,0x8019
+
  00187940: 3c028019 lui r2,0x8019                 |
  00187960: 8c632d8c lw r3,0x2d8c(r3) Load Attacker Current Action Data  Pointer
+
  00187944: 8c422d94 lw r2,0x2d94(r2)             |{{f/adr|<nowiki>r2 = Attacker data pointer</nowiki>}}
  00187964: 34020008 ori r2,r0,0x0008 R2 = 8
+
  00187948: 3c038019 lui r3,0x8019                 |
  00187968: a0620002 sb r2,0x0002(r3)
+
  0018794c: 8c632d8c lw r3,0x2d8c(r3)             |{{f/adr|<nowiki>r3 = Attacker Current Action pointer (ACA pointer)</nowiki>}}
  0018796c: 3c028019 lui r2,0x8019
+
  00187950: 90420176 lbu r2,0x0176(r2)             |{{f/load|<nowiki>r2 = Attacker used Item</nowiki>}}
  00187970: 8c42f5fc lw r2,-0x0a04(r2)
+
  00187954: 00000000 nop                           |
  00187974: 00000000 nop
+
  00187958: a0620003 sb r2,0x0003(r3)             |{{f/store|<nowiki>Store used item as ACA item to break/use</nowiki>}}
  00187978: 1440000b bne r2,r0,0x001879a8
+
  0018795c: 3c038019 lui r3,0x8019                 |
  0018797c: 00000000 nop
+
  00187960: 8c632d8c lw r3,0x2d8c(r3)             |{{f/adr|<nowiki>r3 = Attacker Current Action pointer (ACA pointer)</nowiki>}}
  00187980: 3c058019 lui r5,0x8019
+
  00187964: 34020008 ori r2,r0,0x0008             |{{f/std|<nowiki>r2 = 0x08</nowiki>}}
  00187984: 90a53902 lbu r5,0x3902(r5) R5 = Weapon Power
+
  00187968: a0620002 sb r2,0x0002(r3)             |{{f/store|<nowiki>Set ACA evade type = 0x08 (canceled)</nowiki>}}
  00187988: 0c017833 jal 0x0005e0cc R2 = [[Check if Random is greater/equal to Chance|rollChance(R4,R5)]]
+
  0018796c: 3c028019 lui r2,0x8019                 |
  0018798c: 34040064 ori r4,r0,0x0064 R4 = 100 (break chance equals WP%)
+
  00187970: 8c42f5fc lw r2,-0x0a04(r2)             |{{f/adr|<nowiki>r2 = Action state</nowiki>}}
  00187990: 10400005 beq r2,r0,0x001879a8 Branch on R2
+
  00187974: 00000000 nop                           |
  Case R2 != 0: Not broken
+
  00187978: 1440000b bne r2,r0,0x001879a8         {{f/Cond|<nowiki>If Action state = 0x00 (executing)</nowiki>}} /Else branch to "broken" section
  00187994: 34020008 ori r2,r0,0x0008 r2 = 8
+
  0018797c: 00000000 nop                               |{{f/std|<nowiki> </nowiki>}}
  00187998: 3c038019 lui r3,0x8019
+
  00187980: 3c058019 lui r5,0x8019                     |{{f/std|<nowiki>r5 = 0x80190000</nowiki>}}
  0018799c: 8c632d8c lw r3,0x2d8c(r3) Load Attacker Current Action Data Pointer
+
  00187984: 90a53902 lbu r5,0x3902(r5)                 |{{f/load|<nowiki>r5 = Current Ability used weapon power</nowiki>}}
  001879a0: 08061e6e j 0x001879b8
+
  00187988: 0c017833 jal 0x0005e0cc                   |{{f/jal|Check if Random is greater/equal to Chance|rollChance(R4,R5)}}  return r2 = 0x00 if random < break chance (= broken)
  001879a4: a4620010 sh r2,0x0010(r3) Action->SpecialFlags = 8 (Put katana back)
+
  0018798c: 34040064 ori r4,r0,0x0064                 |{{f/std|<nowiki>r4 = 100 (break chance equals WP%)</nowiki>}}
  Case R2 == 0: Broken
+
  00187990: 10400005 beq r2,r0,0x001879a8             {{f/Cond|<nowiki>If Katana do not break</nowiki>}}
  001879a8: 3c038019 lui r3,0x8019
+
  00187994: 34020008 ori r2,r0,0x0008                     |{{f/std|<nowiki>r2 = 0x08</nowiki>}}
  001879ac: 8c632d8c lw r3,0x2d8c(r3) Load Attacker Current Action Data Pointer
+
00187998: 3c038019 lui r3,0x8019                         |
  001879b0: 34021000 ori r2,r0,0x1000
+
0018799c: 8c632d8c lw r3,0x2d8c(r3)                     |{{f/adr|<nowiki>r3 = Attacker Current Action pointer (ACA pointer)</nowiki>}}
  001879b4: a4620010 sh r2,0x0010(r3) Action->SpecialFlags = 0x1000 (Show "Broken")
+
001879a0: 08061e6e j 0x001879b8                         {{f/jump|<nowiki>jump to </nowiki>{{f/loc|<nowiki>END</nowiki>}}<nowiki></nowiki>}}
  001879b8: 8fbf0010 lw r31,0x0010(r29)
+
001879a4: a4620010 sh r2,0x0010(r3)                     |{{f/store|<nowiki>Store 0x08 as ACA special flag 01 (katana not broken)</nowiki>}}
  001879bc: 27bd0018 addiu r29,r29,0x0018
+
  001879a8: 3c038019 lui r3,0x8019                 {{f/Cond|<nowiki>Else : katana is broken or Action is projected/AI processed</nowiki>}}
  001879c0: 03e00008 jr r31
+
001879ac: 8c632d8c lw r3,0x2d8c(r3)                 |{{f/adr|<nowiki>r3 = Attacker Current Action pointer (ACA pointer)</nowiki>}}
 +
001879b0: 34021000 ori r2,r0,0x1000                 |{{f/std|<nowiki>r2 = 0x1000</nowiki>}}
 +
001879b4: a4620010 sh r2,0x0010(r3)                 |{{f/store|<nowiki>Store 0x10 as ACA special action flag 1 (steal item ??)</nowiki>}}
 +
  001879b8: 8fbf0010 lw r31,0x0010(r29)       END
 +
  001879bc: 27bd0018 addiu r29,r29,0x0018    
 +
  001879c0: 03e00008 jr r31                  
 
  001879c4: 00000000 nop
 
  001879c4: 00000000 nop
 +
=== Return location ===
 +
'''Battle.bin'''
 +
001895d4: [[20_Dmg_(MA*Y)|Formula 20 - Dmg (MA*Y)]]
 +
00189604: [[21_DmgMP_(MA*Y)|Formula 21 - DmgMP (MA*Y)]]
 +
00189664: [[22_Hit_(100%25)_Status|Formula 22 - Hit (100%) Status]]
 +
0018968c: [[23_Heal_(MA*Y)|Formula 23 - Heal (MA*Y)]]

Latest revision as of 06:28, 24 November 2022

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)