Weapon Guard Usability

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
Weapon Guard Usability (more likely : Check if unit can evade, since it used in abandon too)
- requires r4 = Target's Data Pointer
- returns r2 = 0x00 if unit can evade, 0x01 if can not, 0x02 if underwater (no evasion either)
----------------------------------------------------------------------------------------------------
0018130c: 27bdffe8 addiu r29,r29,0xffe8     |
00181310: afb00010 sw r16,0x0010(r29)       |
00181314: 00808021 addu r16,r4,r0           |r16 = Target's Data Pointer
00181318: afbf0014 sw r31,0x0014(r29)       |
0018131c: 9202005c lbu r2,0x005c(r16)       |r2 = Target 5th set of statuses  /5th set of statuses
00181320: 00000000 nop                      |
00181324: 30420004 andi r2,r2,0x0004        |r2 = 0x04 if target has don't act - else 0x00
00181328: 14400020 bne r2,r0,0x001813ac     #If target can act /Else Target has Don't Act - branch to end (r2 = 0x01)
0018132c: 34020001 ori r2,r0,0x0001         |r2 = 0x01
00181330: 92020182 lbu r2,0x0182(r16)            |r2 = target mount info /Mount Info
00181334: 00000000 nop                           |
00181338: 30420040 andi r2,r2,0x0040             |r2 = 0x40 
0018133c: 1440001b bne r2,r0,0x001813ac          #If target is not being ridden /Else Target is being ridden Branch to end (r2 = 0x01)
00181340: 34020001 ori r2,r0,0x0001              |r2 = 1
00181344: 0c060428 jal 0x001810a0                    |-->Map Location Calculation Return r2 = Tile ID
00181348: 02002021 addu r4,r16,r0                    |r4 = Target data pointer
0018134c: 000210c0 sll r2,r2,0x03                    |Tile ID * 8 (tile offset in tile data table)
00181350: 3c018019 lui r1,0x8019                     |
00181354: 00220821 addu r1,r1,r2                     |r1 = 8019 + Tiles offset
00181358: 9022f8cf lbu r2,-0x0731(r1)                |r2 = Targt tile Depht + height/2  0x8018F8CC + 0x03  + tile ID*8
0018135c: 00000000 nop                               |
00181360: 00021142 srl r2,r2,0x05                    |r2 = tiles depht
00181364: 28420002 slti r2,r2,0x0002                 |r2 = 0x01 if depht is 0 or 1
00181368: 14400010 bne r2,r0,0x001813ac              #If Depht >= 2 /Else Depth <= 1 Branch to end (r2 = 0x00)
0018136c: 00001021 addu r2,r0,r0                     |r2 = 0x00
00181370: 9202005a lbu r2,0x005a(r16)                    |r3 = Target 3rd set of statuses /3rd set of statuses
00181374: 00000000 nop                                   |
00181378: 30420046 andi r2,r2,0x0046                     |r2 <> 0x00 if target has either chicken, frog or float
0018137c: 1440000b bne r2,r0,0x001813ac                  #If r2 = 0x00 (target don't have chicken, frog or float) /Else Branch to end (r2 = 0x00)
00181380: 00001021 addu r2,r0,r0                         |r2 = 0x00
00181384: 92020095 lbu r2,0x0095(r16)                        |r2 = target third set of mouvement skill
00181388: 00000000 nop                                       |
0018138c: 304200c8 andi r2,r2,0x00c8                         |r2 <> 0x00 if Branch if Target has Move in/Walk on Water/Float
00181390: 14400006 bne r2,r0,0x001813ac                      #If Target is underwater /Else Target has Move in/Walk on Water/Float - Branch to end (r2 = 0x00)
00181394: 00001021 addu r2,r0,r0                             |r2 = 0x00
00181398: 92020182 lbu r2,0x0182(r16)                            |r2 = target mount info /Mount Info
0018139c: 00000000 nop                                           |
001813a0: 30420080 andi r2,r2,0x0080                             |r2 = 0x80 if target is ridding a unit - Else 0x00
001813a4: 2c420001 sltiu r2,r2,0x0001                            |r2 = 0x01 if not riding a unit - Else 0x00
001813a8: 00021040 sll r2,r2,0x01                                |r2 = 0x02 if not riding a unit  - r2 = 0x00 if riding (can evade attack)
001813ac: 8fbf0014 lw r31,0x0014(r29)                            
001813b0: 8fb00010 lw r16,0x0010(r29)                            
001813b4: 27bd0018 addiu r29,r29,0x0018                          
001813b8: 03e00008 jr r31                                        
001813bc: 00000000 nop                                           


Return Locations

BATTLE.bin
00140534: - Routine at 1404cc
00140b4c: - 00140b04_-_00140cd0
00140d30: - Ability_selected_routine
0017da74: - MP Cost (Half of MP) Section  Duplicated Ability_Usage_Checks_and_MP_Reduction
0017e1f4: - Main_reaction_routine?
00181280: - Player Control Routine?
00183d24: - Able to move/act checks (Menu?)
00184fc8: - Equipment Evasion Setting (Physical)
00185394: - Abandon_Calculation
0018c954: - Check_if_unit_can_react_1
0018caa0: - 'Reflect', Blade Grasp, and Arrow Guard