Difference between revisions of "MP Switch Usability"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
 
Line 1: Line 1:
  MP Switch Usability:
+
  Checks MP switch usability, roll Brave% if succesfull, add HP dmg to MP dmg (max is 999)
  0018d1b8: 3c028019 lui r2,0x8019    
+
  0018d1bc: 8c422d90 lw r2,0x2d90(r2)     Current Action Data Pointer
+
TCA = Targeted Unit Current Action
  0018d1c0: 27bdffe8 addiu r29,r29,0xffe8     
+
------------------------------------------------------------------------------------------------------
  0018d1c4: afbf0010 sw r31,0x0010(r29)    
+
  0018d1b8: 3c028019 lui r2,0x8019           |
  0018d1c8: 84420004 lh r2,0x0004(r2)     HP Damage
+
  0018d1bc: 8c422d90 lw r2,0x2d90(r2)         |{{f/adr|<nowiki>r2 = TCA data pointer</nowiki>}}
  0018d1cc: 00000000 nop          
+
  0018d1c0: 27bdffe8 addiu r29,r29,-0x0018    |
  0018d1d0: 10400031 beq r2,r0,0x0018d298     Branch if no damage was dealt
+
  0018d1c4: afbf0010 sw r31,0x0010(r29)       |
  0018d1d4: 00000000 nop          
+
  0018d1c8: 84420004 lh r2,0x0004(r2)         |{{f/load|<nowiki>r2 = TCA HP damage</nowiki>}}
  0018d1d8: 3c048019 lui r4,0x8019    
+
  0018d1cc: 00000000 nop                     |
  0018d1dc: 8c842d98 lw r4,0x2d98(r4)     Load Defender's Stats
+
  0018d1d0: 10400031 beq r2,r0,0x0018d298     {{f/Cond|If TCA HP damage not null}} /Else branch to  {{f/loc|END}}
  0018d1e0: 00000000 nop          
+
  0018d1d4: 00000000 nop                         |{{f/std|}}
  0018d1e4: 9482002c lhu r2,0x002c(r4)     Load Current MP
+
  0018d1d8: 3c048019 lui r4,0x8019               |{{f/std|}}
  0018d1e8: 00000000 nop          
+
  0018d1dc: 8c842d98 lw r4,0x2d98(r4)             |{{f/adr|<nowiki>r4 = Targeted Unit data pointer</nowiki>}}
  0018d1ec: 1040002a beq r2,r0,0x0018d298     Branch if no MP
+
  0018d1e0: 00000000 nop                         |
  0018d1f0: 00000000 nop          
+
  0018d1e4: 9482002c lhu r2,0x002c(r4)           |{{f/load|<nowiki>r2 = Targeted Unit's MP</nowiki>}}
  0018d1f4: 0c0634e1 jal 0x0018d384     [[Chance to React]]
+
  0018d1e8: 00000000 nop                         |
  0018d1f8: 00000000 nop          
+
  0018d1ec: 1040002a beq r2,r0,0x0018d298         {{f/Cond|If Targeted Unit's MP > 0x00}} /Else branch to  {{f/loc|END}}
  0018d1fc: 14400026 bne r2,r0,0x0018d298     Branch if did not react
+
  0018d1f0: 00000000 nop                             |
  0018d200: 00000000 nop          
+
  0018d1f4: 0c0634e1 jal 0x0018d384                   |{{f/jal|Chance to React|Chance to React}} Returns r2 = 0x00 if Reacting (Br% chances)
  0018d204: 3c028019 lui r2,0x8019    
+
  0018d1f8: 00000000 nop                             |
  0018d208: 8c42f5fc lw r2,-0x0a04(r2)     ???
+
  0018d1fc: 14400026 bne r2,r0,0x0018d298             {{f/Cond|If Targeted Unit is reacting}} /Else branch to  {{f/loc|END}}
  0018d20c: 00000000 nop          
+
  0018d200: 00000000 nop                                 |{{f/std|}}
  0018d210: 14400021 bne r2,r0,0x0018d298    
+
  0018d204: 3c028019 lui r2,0x8019                       |{{f/std|}}
  0018d214: 00000000 nop          
+
  0018d208: 8c42f5fc lw r2,-0x0a04(r2)                   |{{f/adr|<nowiki>r2 = Action State</nowiki>}} {{f/std|0x8018f5fc}}
  0018d218: 3c048019 lui r4,0x8019    
+
  0018d20c: 00000000 nop                                 |
  0018d21c: 8c842d90 lw r4,0x2d90(r4)     Current Action Data Pointer
+
  0018d210: 14400021 bne r2,r0,0x0018d298                 {{f/Cond|If Action is beeing executed}} /Else branch to  {{f/loc|END}}
  0018d220: 00000000 nop          
+
  0018d214: 00000000 nop                                     |{{f/std|}}
  0018d224: 94820008 lhu r2,0x0008(r4)     Load MP Damage
+
  0018d218: 3c048019 lui r4,0x8019                           |
  0018d228: 94830004 lhu r3,0x0004(r4)     Load HP Damage
+
  0018d21c: 8c842d90 lw r4,0x2d90(r4)                         |{{f/adr|<nowiki>r4 = TCA data pointer</nowiki>}}
  0018d22c: 00000000 nop          
+
  0018d220: 00000000 nop                                     |
  0018d230: 00431021 addu r2,r2,r3    
+
  0018d224: 94820008 lhu r2,0x0008(r4)                       |{{f/load|<nowiki>r2 = TCA MP damage</nowiki>}}
  0018d234: a4820008 sh r2,0x0008(r4)     Store as MP Damage
+
  0018d228: 94830004 lhu r3,0x0004(r4)                       |{{f/load|<nowiki>r3 = TCA HP damage</nowiki>}}
  0018d238: 00021400 sll r2,r2,0x10    
+
  0018d22c: 00000000 nop                                     |
  0018d23c: 00021403 sra r2,r2,0x10    
+
  0018d230: 00431021 addu r2,r2,r3                           |{{f/std|<nowiki>r2 = New MP damage</nowiki>}}
  0018d240: 284203e8 slti r2,r2,0x03e8    
+
  0018d234: a4820008 sh r2,0x0008(r4)                         |{{f/store|Store New MP damage (initial MP dmg + HP dmg)}}
  0018d244: 14400002 bne r2,r0,0x0018d250    
+
  0018d238: 00021400 sll r2,r2,0x10                           |
  0018d248: 340203e7 ori r2,r0,0x03e7    
+
  0018d23c: 00021403 sra r2,r2,0x10                           |{{f/std|<nowiki>r2 = New MP dmg (upper register cleared)</nowiki>}}
  0018d24c: a4820008 sh r2,0x0008(r4)     Store as MP Damage
+
  0018d240: 284203e8 slti r2,r2,0x03e8                       |{{f/std|<nowiki>r2 = 0x01 if New MP damage < 1000</nowiki>}}
  0018d250: 3c038019 lui r3,0x8019    
+
  0018d244: 14400002 bne r2,r0,0x0018d250                     {{f/Cond|If New MP damage is > 1000}}
  0018d254: 8c632d90 lw r3,0x2d90(r3)     Current Action Data Pointer
+
  0018d248: 340203e7 ori r2,r0,0x03e7                             |{{f/std|<nowiki>r2 = 999</nowiki>}}
  0018d258: 00000000 nop          
+
  0018d24c: a4820008 sh r2,0x0008(r4)                             |{{f/store|Store 999 as new MP damage}}
  0018d25c: 90620025 lbu r2,0x0025(r3)     Attack Flags
+
  0018d250: 3c038019 lui r3,0x8019                           |{{f/std|}}
  0018d260: 00000000 nop          
+
  0018d254: 8c632d90 lw r3,0x2d90(r3)                         |{{f/adr|<nowiki>r3 = TCA data pointer</nowiki>}}
  0018d264: 3042007f andi r2,r2,0x007f    
+
  0018d258: 00000000 nop                                     |
  0018d268: a0620025 sb r2,0x0025(r3)     Store
+
  0018d25c: 90620025 lbu r2,0x0025(r3)                       |{{f/load|<nowiki>r2 =  TCA Attack's type</nowiki>}}
  0018d26c: 3c048019 lui r4,0x8019    
+
  0018d260: 00000000 nop                                     |
  0018d270: 8c842d90 lw r4,0x2d90(r4)     Current Action Data Pointer
+
  0018d264: 3042007f andi r2,r2,0x007f                       |{{f/std|<nowiki>r2 = Every Attack types but HP damage</nowiki>}}
  0018d274: a4600004 sh r0,0x0004(r3)     0 HP Damage
+
  0018d268: a0620025 sb r2,0x0025(r3)                         |{{f/store|Store attack type without HP damage }}
  0018d278: 90820025 lbu r2,0x0025(r4)    
+
  0018d26c: 3c048019 lui r4,0x8019                           |
  0018d27c: 00000000 nop          
+
  0018d270: 8c842d90 lw r4,0x2d90(r4)                         |{{f/adr|<nowiki>r4 = TCA data pointer</nowiki>}}
  0018d280: 34420020 ori r2,r2,0x0020    
+
  0018d274: a4600004 sh r0,0x0004(r3)                         |{{f/store|Nullify HP damage}}
  0018d284: a0820025 sb r2,0x0025(r4)     Store Attack Flag as MP Damage
+
  0018d278: 90820025 lbu r2,0x0025(r4)                       |{{f/load|<nowiki>r2 = TCA attack type</nowiki>}}
  0018d288: 3c038019 lui r3,0x8019    
+
  0018d27c: 00000000 nop                                     |
  0018d28c: 8c632d90 lw r3,0x2d90(r3)     Current Action Data Pointer
+
  0018d280: 34420020 ori r2,r2,0x0020                         |{{f/std|<nowiki>r2 = TCA attack type with MP damage enabled (0x20)</nowiki>}}
  0018d290: 340201bd ori r2,r0,0x01bd    
+
  0018d284: a0820025 sb r2,0x0025(r4)                         |{{f/store|Store attack type with MP damage}}
  0018d294: a462000e sh r2,0x000e(r3)     Reaction ID
+
  0018d288: 3c038019 lui r3,0x8019                           |
  0018d298: 8fbf0010 lw r31,0x0010(r29)
+
  0018d28c: 8c632d90 lw r3,0x2d90(r3)                         |{{f/adr|<nowiki>r3 = TCA data pointer</nowiki>}}
  0018d29c: 27bd0018 addiu r29,r29,0x0018
+
  0018d290: 340201bd ori r2,r0,0x01bd                         |{{f/std|<nowiki>r2 = 0x1bd (MP switch ability ID)</nowiki>}}
  0018d2a0: 03e00008 jr r31
+
  0018d294: a462000e sh r2,0x000e(r3)                         |{{f/store|Store MP Switch ID in TCA 0x0e (Unit's 0x19a)}}
 +
  0018d298: 8fbf0010 lw r31,0x0010(r29)         '''END'''             
 +
  0018d29c: 27bd0018 addiu r29,r29,0x0018                    
 +
  0018d2a0: 03e00008 jr r31                                  
 
  0018d2a4: 00000000 nop
 
  0018d2a4: 00000000 nop
 +
=== Return locations ===
 +
'''Battle.bin'''
 +
0018cc8c: [[MP_Switch,_Distribute,_and_Damage_Split_usability]]

Latest revision as of 20:41, 16 March 2022

Checks MP switch usability, roll Brave% if succesfull, add HP dmg to MP dmg (max is 999)

TCA = Targeted Unit Current Action
------------------------------------------------------------------------------------------------------
0018d1b8: 3c028019 lui r2,0x8019            |
0018d1bc: 8c422d90 lw r2,0x2d90(r2)         |r2 = TCA data pointer
0018d1c0: 27bdffe8 addiu r29,r29,-0x0018    |
0018d1c4: afbf0010 sw r31,0x0010(r29)       |
0018d1c8: 84420004 lh r2,0x0004(r2)         |r2 = TCA HP damage
0018d1cc: 00000000 nop                      |
0018d1d0: 10400031 beq r2,r0,0x0018d298     #If TCA HP damage not null /Else branch to  END
0018d1d4: 00000000 nop                          |
0018d1d8: 3c048019 lui r4,0x8019                |
0018d1dc: 8c842d98 lw r4,0x2d98(r4)             |r4 = Targeted Unit data pointer
0018d1e0: 00000000 nop                          |
0018d1e4: 9482002c lhu r2,0x002c(r4)            |r2 = Targeted Unit's MP
0018d1e8: 00000000 nop                          |
0018d1ec: 1040002a beq r2,r0,0x0018d298         #If Targeted Unit's MP > 0x00 /Else branch to  END
0018d1f0: 00000000 nop                              |
0018d1f4: 0c0634e1 jal 0x0018d384                   |-->Chance to React Returns r2 = 0x00 if Reacting (Br% chances)
0018d1f8: 00000000 nop                              |
0018d1fc: 14400026 bne r2,r0,0x0018d298             #If Targeted Unit is reacting /Else branch to  END
0018d200: 00000000 nop                                  |
0018d204: 3c028019 lui r2,0x8019                        |
0018d208: 8c42f5fc lw r2,-0x0a04(r2)                    |r2 = Action State 0x8018f5fc
0018d20c: 00000000 nop                                  |
0018d210: 14400021 bne r2,r0,0x0018d298                 #If Action is beeing executed /Else branch to  END
0018d214: 00000000 nop                                      |
0018d218: 3c048019 lui r4,0x8019                            |
0018d21c: 8c842d90 lw r4,0x2d90(r4)                         |r4 = TCA data pointer
0018d220: 00000000 nop                                      |
0018d224: 94820008 lhu r2,0x0008(r4)                        |r2 = TCA MP damage
0018d228: 94830004 lhu r3,0x0004(r4)                        |r3 = TCA HP damage
0018d22c: 00000000 nop                                      |
0018d230: 00431021 addu r2,r2,r3                            |r2 = New MP damage
0018d234: a4820008 sh r2,0x0008(r4)                         |Store New MP damage (initial MP dmg + HP dmg)
0018d238: 00021400 sll r2,r2,0x10                           |
0018d23c: 00021403 sra r2,r2,0x10                           |r2 = New MP dmg (upper register cleared)
0018d240: 284203e8 slti r2,r2,0x03e8                        |r2 = 0x01 if New MP damage < 1000
0018d244: 14400002 bne r2,r0,0x0018d250                     #If New MP damage is > 1000
0018d248: 340203e7 ori r2,r0,0x03e7                             |r2 = 999
0018d24c: a4820008 sh r2,0x0008(r4)                             |Store 999 as new MP damage
0018d250: 3c038019 lui r3,0x8019                            |
0018d254: 8c632d90 lw r3,0x2d90(r3)                         |r3 = TCA data pointer
0018d258: 00000000 nop                                      |
0018d25c: 90620025 lbu r2,0x0025(r3)                        |r2 =  TCA Attack's type
0018d260: 00000000 nop                                      |
0018d264: 3042007f andi r2,r2,0x007f                        |r2 = Every Attack types but HP damage
0018d268: a0620025 sb r2,0x0025(r3)                         |Store attack type without HP damage 
0018d26c: 3c048019 lui r4,0x8019                            |
0018d270: 8c842d90 lw r4,0x2d90(r4)                         |r4 = TCA data pointer
0018d274: a4600004 sh r0,0x0004(r3)                         |Nullify HP damage
0018d278: 90820025 lbu r2,0x0025(r4)                        |r2 = TCA attack type
0018d27c: 00000000 nop                                      |
0018d280: 34420020 ori r2,r2,0x0020                         |r2 = TCA attack type with MP damage enabled (0x20)
0018d284: a0820025 sb r2,0x0025(r4)                         |Store attack type with MP damage
0018d288: 3c038019 lui r3,0x8019                            |
0018d28c: 8c632d90 lw r3,0x2d90(r3)                         |r3 = TCA data pointer
0018d290: 340201bd ori r2,r0,0x01bd                         |r2 = 0x1bd (MP switch ability ID)
0018d294: a462000e sh r2,0x000e(r3)                         |Store MP Switch ID in TCA 0x0e (Unit's 0x19a)
0018d298: 8fbf0010 lw r31,0x0010(r29)         END              
0018d29c: 27bd0018 addiu r29,r29,0x0018                     
0018d2a0: 03e00008 jr r31                                   
0018d2a4: 00000000 nop

Return locations

Battle.bin
0018cc8c: MP_Switch,_Distribute,_and_Damage_Split_usability