Difference between revisions of "Equipment Evasion Setting (Magical)"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
 
Line 1: Line 1:
  Equipment Evasion Setting (Magical):
+
  No Parameters - Returns Nothing
  001851c4: 3c048019 lui r4,0x8019
+
  001851c8: 8c842d98 lw r4,0x2d98(r4) Load Target Data Pointer
+
First Nullify Current Ability Evasion bytes and set Ability base hit to 100
  001851cc: 34020064 ori r2,r0,0x0064 r2 = 100
+
Then if Target is not a monster set the Evasion value
  001851d0: 3c018019 lui r1,0x8019
+
  - 0x801938de : Target's Accessory M-Ev
  001851d4: a02238dc sb r2,0x38dc(r1) Base Hit Rate = 100
+
  - 0x801938df : Target's Right Hand shield M-Ev
  001851d8: 3c018019 lui r1,0x8019
+
  - 0x801938e0 : Target's Left Hand shield M-Ev
  001851dc: a02038de sb r0,0x38de(r1) Accessory Evade = 0
+
 
  001851e0: 3c018019 lui r1,0x8019
+
Note : unlike [[Equipment_Evasion_Setting_(Physical)]] routine
  001851e4: a02038df sb r0,0x38df(r1) Weapon Evade = 0
+
  - Class Evade is not checked
  001851e8: 3c018019 lui r1,0x8019
+
  - Since weapon do not have M-Ev they are not checked either
  001851ec: a02038e0 sb r0,0x38e0(r1) Shield Evade = 0
+
----------------------------------------------------------------------------------
  001851f0: 3c018019 lui r1,0x8019
+
  001851c4: 3c048019 lui r4,0x8019           |
  001851f4: a02038e1 sb r0,0x38e1(r1) Store Class Evade = 0
+
  001851c8: 8c842d98 lw r4,0x2d98(r4)         |{{f/adr|<nowiki>r4 = Target Data Pointer</nowiki>}}
  001851f8: 90820006 lbu r2,0x0006(r4) Load Defender's Gender  
+
  001851cc: 34020064 ori r2,r0,0x0064         |{{f/std|<nowiki>r2 = 100</nowiki>}}
  001851fc: 00000000 nop
+
  001851d0: 3c018019 lui r1,0x8019           |
  00185200: 30420020 andi r2,r2,0x0020
+
  001851d4: a02238dc sb r2,0x38dc(r1)         |{{f/store|Set Current Ability base hit to 100}} {{f/std|          0x801938dc / 801938dc}}
  00185204: 14400035 bne r2,r0,0x001852dc Branch if a Monster
+
  001851d8: 3c018019 lui r1,0x8019           |
  00185208: 00000000 nop
+
  001851dc: a02038de sb r0,0x38de(r1)         |{{f/store|Clear Ability Accessory Evade byte}} {{f/std|          0x801938de / 801938de}}
  0018520c: 9082001c lbu r2,0x001c(r4) Load Defender's Accessory
+
  001851e0: 3c018019 lui r1,0x8019           |
  00185210: 3c058006 lui r5,0x8006
+
  001851e4: a02038df sb r0,0x38df(r1)         |{{f/store|Clear Ability Right Hand Evade byte}} {{f/std|          0x801938df / 801938df}}
  00185214: 24a52eb8 addiu r5,r5,0x2eb8
+
  001851e8: 3c018019 lui r1,0x8019           |
  00185218: 00021840 sll r3,r2,0x01
+
  001851ec: a02038e0 sb r0,0x38e0(r1)         |{{f/store|Clear Ability Left Hand Evade byte}} {{f/std|          0x801938e0 / 801938e0}}
  0018521c: 00621821 addu r3,r3,r2
+
  001851f0: 3c018019 lui r1,0x8019           |
  00185220: 00031880 sll r3,r3,0x02
+
  001851f4: a02038e1 sb r0,0x38e1(r1)         |{{f/store|Clear Ability Class Evade byte}} {{f/std|          0x801938e1 / 801938e1}}
  00185224: 00651821 addu r3,r3,r5
+
  001851f8: 90820006 lbu r2,0x0006(r4)       |{{f/load|<nowiki>r2 = Target's Gender</nowiki>}}
  00185228: 90620003 lbu r2,0x0003(r3) Load Equipped Item's Item Type
+
  001851fc: 00000000 nop                     |
  0018522c: 00000000 nop
+
  00185200: 30420020 andi r2,r2,0x0020       |{{f/std|<nowiki>r2 = 0x20 if Target is a monster</nowiki>}}
  00185230: 30420008 andi r2,r2,0x0008
+
  00185204: 14400035 bne r2,r0,0x001852dc     {{f/Cond|If Target is not a monster}} / If target is a monster, branch to {{f/Cond|{{f/loc|END}}}}
  00185234: 10400009 beq r2,r0,0x0018525c Branch if Accessory isn't an  accessory
+
  00185208: 00000000 nop                         |
  00185238: 00000000 nop
+
  0018520c: 9082001c lbu r2,0x001c(r4)           |{{f/load|<nowiki>r2 = Target Accessory's</nowiki>}}
  0018523c: 90620004 lbu r2,0x0004(r3) Load Accessory's Second Table ID
+
  00185210: 3c058006 lui r5,0x8006               |
  00185240: 00000000 nop
+
  00185214: 24a52eb8 addiu r5,r5,0x2eb8           |{{f/std|<nowiki>r5 = 0x80062eb8 (start of item's data)</nowiki>}}
  00185244: 00021040 sll r2,r2,0x01
+
  00185218: 00021840 sll r3,r2,0x01               |{{f/std|Accessory ID * 2}}
  00185248: 3c018006 lui r1,0x8006
+
  0018521c: 00621821 addu r3,r3,r2               |{{f/std|Accessory ID * 3}}
  0018524c: 00220821 addu r1,r1,r2
+
  00185220: 00031880 sll r3,r3,0x02               |{{f/std|Accessory ID * 12 (Accessory offset in Item data)}}
  00185250: 90223f59 lbu r2,0x3f59(r1) Load Accessory Magic Evade
+
  00185224: 00651821 addu r3,r3,r5               |{{f/adr|<nowiki>r3 = Target's Accessory data pointer</nowiki>}}
  00185254: 3c018019 lui r1,0x8019
+
  00185228: 90620003 lbu r2,0x0003(r3)           |{{f/load|<nowiki>r2 = Target's Accessory Type</nowiki>}}
  00185258: a02238de sb r2,0x38de(r1)
+
  0018522c: 00000000 nop                         |
  0018525c: 9082001e lbu r2,0x001e(r4) Load Right Hand Shield
+
  00185230: 30420008 andi r2,r2,0x0008           |{{f/std|<nowiki>r2 = 0x08 if Accessory type is [Accessory]</nowiki>}}
  00185260: 00000000 nop
+
  00185234: 10400009 beq r2,r0,0x0018525c         {{f/Cond|If Target's Accessory is Valid}} /Else branch to Right Hand section
  00185264: 00021840 sll r3,r2,0x01
+
  00185238: 00000000 nop                             |
  00185268: 00621821 addu r3,r3,r2
+
  0018523c: 90620004 lbu r2,0x0004(r3)               |{{f/load|<nowiki>r2 = Target's Accessory 2nd Table ID</nowiki>}}
  0018526c: 00031880 sll r3,r3,0x02
+
  00185240: 00000000 nop                             |
  00185270: 00651821 addu r3,r3,r5
+
  00185244: 00021040 sll r2,r2,0x01                   |{{f/std|<nowiki>r2 =  Target Accessory 2nd table offset</nowiki>}}
  00185274: 90620003 lbu r2,0x0003(r3) Load Equipped Item's Item Type
+
  00185248: 3c018006 lui r1,0x8006                   |
  00185278: 90630004 lbu r3,0x0004(r3) Load Item's Second Table
+
  0018524c: 00220821 addu r1,r1,r2                   |{{f/std|<nowiki>r1 = 0x800600XX (XX = Target Accessory offset)</nowiki>}}
  0018527c: 30420040 andi r2,r2,0x0040
+
  00185250: 90223f59 lbu r2,0x3f59(r1)               |{{f/load|<nowiki>r2 = Target's Accessory Magic Evade</nowiki>}} {{f/std|      0x80063f58 + 0x01 + Accessory offset}}
  00185280: 10400006 beq r2,r0,0x0018529c Branch if Equipped Item isn't a  Shield
+
  00185254: 3c018019 lui r1,0x8019                   |
  00185284: 00031040 sll r2,r3,0x01
+
  00185258: a02238de sb r2,0x38de(r1)                 |{{f/store|Store Target's Accessory Magic Evasion in Ability Accessory Evasion (0x801938de)}}
  00185288: 3c018006 lui r1,0x8006
+
  0018525c: 9082001e lbu r2,0x001e(r4)           |{{f/load|<nowiki>r2 = Target's Right Hand (RH) shield ID</nowiki>}}
  0018528c: 00220821 addu r1,r1,r2
+
  00185260: 00000000 nop                         |
  00185290: 90223eb9 lbu r2,0x3eb9(r1) Load Shield's Magical Evade
+
  00185264: 00021840 sll r3,r2,0x01               |{{f/std|RH shield ID *2}}
  00185294: 3c018019 lui r1,0x8019
+
  00185268: 00621821 addu r3,r3,r2               |{{f/std|RH shield ID *3}}
  00185298: a02238df sb r2,0x38df(r1)
+
  0018526c: 00031880 sll r3,r3,0x02               |{{f/std|RH shield ID *12}}
  0018529c: 90820020 lbu r2,0x0020(r4) Load Left Hand Shield
+
  00185270: 00651821 addu r3,r3,r5               |{{f/adr|<nowiki>r3 = RH shield data pointer</nowiki>}}
  001852a0: 00000000 nop
+
  00185274: 90620003 lbu r2,0x0003(r3)           |{{f/load|<nowiki>r2 = RH shield Item Type</nowiki>}}
  001852a4: 00021840 sll r3,r2,0x01
+
  00185278: 90630004 lbu r3,0x0004(r3)           |{{f/load|<nowiki>r3 = RH shield 2nd Table ID</nowiki>}}
  001852a8: 00621821 addu r3,r3,r2
+
  0018527c: 30420040 andi r2,r2,0x0040           |{{f/std|<nowiki>r2 = 0x40 if RH shield Type is [Shield]</nowiki>}}
  001852ac: 00031880 sll r3,r3,0x02
+
  00185280: 10400006 beq r2,r0,0x0018529c         {{f/Cond|If Target's RH shield is valid}} /Else branch to left hand section
  001852b0: 00651821 addu r3,r3,r5
+
  00185284: 00031040 sll r2,r3,0x01                   |{{f/std|<nowiki>r2 = RH shield 2nd Table offset</nowiki>}}
  001852b4: 90620003 lbu r2,0x0003(r3) Load Equipped Item's Item Type
+
  00185288: 3c018006 lui r1,0x8006                   |
  001852b8: 90630004 lbu r3,0x0004(r3) Load Item's Second Table
+
  0018528c: 00220821 addu r1,r1,r2                   |{{f/std|<nowiki>r1 = 0x800600xx (xx = RH shield offset)</nowiki>}}
  001852bc: 30420040 andi r2,r2,0x0040
+
  00185290: 90223eb9 lbu r2,0x3eb9(r1)               |{{f/load|<nowiki>r2 = RH shield Magic evasion</nowiki>}} {{f/std|      0x80063eb8 + 0x01 + Shield offset}}
  001852c0: 10400006 beq r2,r0,0x001852dc Branch if equipped item is not a Shield
+
  00185294: 3c018019 lui r1,0x8019                   |
  001852c4: 00031040 sll r2,r3,0x01
+
  00185298: a02238df sb r2,0x38df(r1)                 |{{f/store|Store RH shield Magic Evasion in Current Ability Right Hand evasion (0x801938df)}}
  001852c8: 3c018006 lui r1,0x8006
+
  0018529c: 90820020 lbu r2,0x0020(r4)           |{{f/load|<nowiki>r2 = Target's Left Hand (LH) shield ID</nowiki>}}
  001852cc: 00220821 addu r1,r1,r2
+
  001852a0: 00000000 nop                         |
  001852d0: 90223eb9 lbu r2,0x3eb9(r1) Load Shield's Magical Evade
+
  001852a4: 00021840 sll r3,r2,0x01               |{{f/std|LH shield ID *2}}
  001852d4: 3c018019 lui r1,0x8019
+
  001852a8: 00621821 addu r3,r3,r2               |{{f/std|LH shield ID *3}}
  001852d8: a02238e0 sb r2,0x38e0(r1)
+
  001852ac: 00031880 sll r3,r3,0x02               |{{f/std|LH shield ID *12}}
  001852dc: 03e00008 jr r31
+
  001852b0: 00651821 addu r3,r3,r5               |{{f/adr|<nowiki>r3 = LH shield data pointer</nowiki>}}
  001852e0: 00000000 nop
+
  001852b4: 90620003 lbu r2,0x0003(r3)           |{{f/load|<nowiki>r2 = LH shield Item Type</nowiki>}}
 
+
  001852b8: 90630004 lbu r3,0x0004(r3)           |{{f/load|<nowiki>r3 = LH shield 2nd Table ID</nowiki>}}
 
+
  001852bc: 30420040 andi r2,r2,0x0040           |{{f/std|<nowiki>r2 = 0x40 if LH shield Type is [Shield]</nowiki>}}
== Return Locations ==
+
  001852c0: 10400006 beq r2,r0,0x001852dc         {{f/Cond|If Target's LH shield is valid}}
 
+
  001852c4: 00031040 sll r2,r3,0x01                   |{{f/std|<nowiki>r2 = LH shield 2nd Table offset</nowiki>}}
  001885c0: [[Magical Evade Calculation]]
+
  001852c8: 3c018006 lui r1,0x8006                   |
 +
  001852cc: 00220821 addu r1,r1,r2                   |{{f/std|<nowiki>r1 = 0x800600xx (xx = LH shield offset)</nowiki>}}
 +
  001852d0: 90223eb9 lbu r2,0x3eb9(r1)               |{{f/load|<nowiki>r2 = LH shield Magic evasion</nowiki>}} {{f/std|      0x80063eb8 + 0x01 + Shield offset}}
 +
  001852d4: 3c018019 lui r1,0x8019                   |
 +
  001852d8: a02238e0 sb r2,0x38e0(r1)                 |{{f/store|Store LH shield Magic Evasion in Current Ability Left Hand evasion (0x801938e0)}}
 +
  001852dc: 03e00008 jr r31                       END
 +
  001852e0: 00000000 nop                        
 +
=== Return Locations ===
 +
'''Battle.bin'''
 +
  001885c8: [[Magical Evade Calculation]]

Latest revision as of 20:13, 12 April 2022

No Parameters - Returns Nothing

First Nullify Current Ability Evasion bytes and set Ability base hit to 100
Then if Target is not a monster set the Evasion value
 - 0x801938de : Target's Accessory M-Ev
 - 0x801938df : Target's Right Hand shield M-Ev
 - 0x801938e0 : Target's Left Hand shield M-Ev
 
Note : unlike Equipment_Evasion_Setting_(Physical) routine
 - Class Evade is not checked
 - Since weapon do not have M-Ev they are not checked either 
----------------------------------------------------------------------------------
001851c4: 3c048019 lui r4,0x8019            |
001851c8: 8c842d98 lw r4,0x2d98(r4)         |r4 = Target Data Pointer
001851cc: 34020064 ori r2,r0,0x0064         |r2 = 100
001851d0: 3c018019 lui r1,0x8019            |
001851d4: a02238dc sb r2,0x38dc(r1)         |Set Current Ability base hit to 100           0x801938dc / 801938dc
001851d8: 3c018019 lui r1,0x8019            |
001851dc: a02038de sb r0,0x38de(r1)         |Clear Ability Accessory Evade byte           0x801938de / 801938de
001851e0: 3c018019 lui r1,0x8019            |
001851e4: a02038df sb r0,0x38df(r1)         |Clear Ability Right Hand Evade byte           0x801938df / 801938df
001851e8: 3c018019 lui r1,0x8019            |
001851ec: a02038e0 sb r0,0x38e0(r1)         |Clear Ability Left Hand Evade byte           0x801938e0 / 801938e0
001851f0: 3c018019 lui r1,0x8019            |
001851f4: a02038e1 sb r0,0x38e1(r1)         |Clear Ability Class Evade byte           0x801938e1 / 801938e1
001851f8: 90820006 lbu r2,0x0006(r4)        |r2 = Target's Gender
001851fc: 00000000 nop                      |
00185200: 30420020 andi r2,r2,0x0020        |r2 = 0x20 if Target is a monster
00185204: 14400035 bne r2,r0,0x001852dc     #If Target is not a monster' / If target is a monster, branch to #END'
00185208: 00000000 nop                          |
0018520c: 9082001c lbu r2,0x001c(r4)            |r2 = Target Accessory's
00185210: 3c058006 lui r5,0x8006                |
00185214: 24a52eb8 addiu r5,r5,0x2eb8           |r5 = 0x80062eb8 (start of item's data)
00185218: 00021840 sll r3,r2,0x01               |Accessory ID * 2
0018521c: 00621821 addu r3,r3,r2                |Accessory ID * 3
00185220: 00031880 sll r3,r3,0x02               |Accessory ID * 12 (Accessory offset in Item data)
00185224: 00651821 addu r3,r3,r5                |r3 = Target's Accessory data pointer
00185228: 90620003 lbu r2,0x0003(r3)            |r2 = Target's Accessory Type
0018522c: 00000000 nop                          |
00185230: 30420008 andi r2,r2,0x0008            |r2 = 0x08 if Accessory type is [Accessory]
00185234: 10400009 beq r2,r0,0x0018525c         #If Target's Accessory is Valid /Else branch to Right Hand section
00185238: 00000000 nop                              |
0018523c: 90620004 lbu r2,0x0004(r3)                |r2 = Target's Accessory 2nd Table ID
00185240: 00000000 nop                              |
00185244: 00021040 sll r2,r2,0x01                   |r2 =  Target Accessory 2nd table offset
00185248: 3c018006 lui r1,0x8006                    |
0018524c: 00220821 addu r1,r1,r2                    |r1 = 0x800600XX (XX = Target Accessory offset)
00185250: 90223f59 lbu r2,0x3f59(r1)                |r2 = Target's Accessory Magic Evade       0x80063f58 + 0x01 + Accessory offset
00185254: 3c018019 lui r1,0x8019                    |
00185258: a02238de sb r2,0x38de(r1)                 |Store Target's Accessory Magic Evasion in Ability Accessory Evasion (0x801938de)
0018525c: 9082001e lbu r2,0x001e(r4)            |r2 = Target's Right Hand (RH) shield ID
00185260: 00000000 nop                          |
00185264: 00021840 sll r3,r2,0x01               |RH shield ID *2
00185268: 00621821 addu r3,r3,r2                |RH shield ID *3
0018526c: 00031880 sll r3,r3,0x02               |RH shield ID *12
00185270: 00651821 addu r3,r3,r5                |r3 = RH shield data pointer
00185274: 90620003 lbu r2,0x0003(r3)            |r2 = RH shield Item Type
00185278: 90630004 lbu r3,0x0004(r3)            |r3 = RH shield 2nd Table ID
0018527c: 30420040 andi r2,r2,0x0040            |r2 = 0x40 if RH shield Type is [Shield]
00185280: 10400006 beq r2,r0,0x0018529c         #If Target's RH shield is valid /Else branch to left hand section
00185284: 00031040 sll r2,r3,0x01                   |r2 = RH shield 2nd Table offset
00185288: 3c018006 lui r1,0x8006                    |
0018528c: 00220821 addu r1,r1,r2                    |r1 = 0x800600xx (xx = RH shield offset)
00185290: 90223eb9 lbu r2,0x3eb9(r1)                |r2 = RH shield Magic evasion       0x80063eb8 + 0x01 + Shield offset
00185294: 3c018019 lui r1,0x8019                    |
00185298: a02238df sb r2,0x38df(r1)                 |Store RH shield Magic Evasion in Current Ability Right Hand evasion (0x801938df)
0018529c: 90820020 lbu r2,0x0020(r4)            |r2 = Target's Left Hand (LH) shield ID
001852a0: 00000000 nop                          |
001852a4: 00021840 sll r3,r2,0x01               |LH shield ID *2
001852a8: 00621821 addu r3,r3,r2                |LH shield ID *3
001852ac: 00031880 sll r3,r3,0x02               |LH shield ID *12
001852b0: 00651821 addu r3,r3,r5                |r3 = LH shield data pointer
001852b4: 90620003 lbu r2,0x0003(r3)            |r2 = LH shield Item Type
001852b8: 90630004 lbu r3,0x0004(r3)            |r3 = LH shield 2nd Table ID
001852bc: 30420040 andi r2,r2,0x0040            |r2 = 0x40 if LH shield Type is [Shield]
001852c0: 10400006 beq r2,r0,0x001852dc         #If Target's LH shield is valid
001852c4: 00031040 sll r2,r3,0x01                   |r2 = LH shield 2nd Table offset
001852c8: 3c018006 lui r1,0x8006                    |
001852cc: 00220821 addu r1,r1,r2                    |r1 = 0x800600xx (xx = LH shield offset)
001852d0: 90223eb9 lbu r2,0x3eb9(r1)                |r2 = LH shield Magic evasion       0x80063eb8 + 0x01 + Shield offset
001852d4: 3c018019 lui r1,0x8019                    |
001852d8: a02238e0 sb r2,0x38e0(r1)                 |Store LH shield Magic Evasion in Current Ability Left Hand evasion (0x801938e0)
001852dc: 03e00008 jr r31                       END
001852e0: 00000000 nop                          

Return Locations

Battle.bin
001885c8: Magical Evade Calculation