Steal/Break/Might Sword Hard Coding

From Final Fantasy Hacktics Wiki
Revision as of 11:36, 8 November 2021 by Orkney (talk | contribs) (color)
Jump to navigation Jump to search
-- Steal/Break/Might Sword HardCoded routine --
Choose the item to break from the ability ID
Note : if two weapons are equiped the better one will be broken (based on weapon enemy level)
return r2 = 0x00 if there's an item to remove, else r2 = 0xFFFF
------------------------------------------------------------

001879c8: 3c038019 lui r3,0x8019            |
001879cc: 8c632d90 lw r3,0x2d90(r3)         |r3 = Target current action data pointer
001879d0: 340200fe ori r2,r0,0x00fe         |
001879d4: a0620019 sb r2,0x0019(r3)         |Store 0xFE as remove equipment (everything removed ?)
001879d8: 3c048019 lui r4,0x8019            |
001879dc: 8c842d98 lw r4,0x2d98(r4)         |r4 = Target data location
001879e0: 00000000 nop                      |
001879e4: 90820006 lbu r2,0x0006(r4)        |r2 = Target gender
001879e8: 00000000 nop                      |
001879ec: 30420020 andi r2,r2,0x0020        |r2 = 0x20 if target is a monster, else 0x00
001879f0: 144000a5 bne r2,r0,0x00187c88     # If target is not a monster /Else branch to near End (fail section)
001879f4: 3402008a ori r2,r0,0x008a              |r2 = 0x8a (head break ID)
001879f8: 3c038019 lui r3,0x8019                 |
001879fc: 946338d6 lhu r3,0x38d6(r3)             |r3 = used Ability ID
00187a00: 00000000 nop                           |
00187a04: 10620005 beq r3,r2,0x00187a1c          # If Ability is not 0x8A (head break)
00187a08: 340200a1 ori r2,r0,0x00a1                  |r2 = 0xA1 (blastar punch ID)
00187a0c: 10620003 beq r3,r2,0x00187a1c              # If Ability is not Blastar punch 
00187a10: 3402006e ori r2,r0,0x006e                      |r2 = 0x6E (steal helmet)
00187a14: 14620013 bne r3,r2,0x00187a64                  #If ability is steal helmet  /Else branch to armor section
00187a18: 3402008b ori r2,r0,0x008b                      |r2 = 0x8b (armor break ID)
00187a1c: 3c028019 lui r2,0x8019                 #E  #E  |(section for helmet removal)
00187a20: 8c422d98 lw r2,0x2d98(r2)                          |r2 = Target data location
00187a24: 00000000 nop                                       |
00187a28: 9043001a lbu r3,0x001a(r2)                         |r3 = Helmet ID
00187a2c: 340200ff ori r2,r0,0x00ff                          |
00187a30: 10620095 beq r3,r2,0x00187c88                      #If Helmet ID <> 0xFF (nothing)   /Else branch to near End (fail section)
00187a34: 34020080 ori r2,r0,0x0080                              |r2 = x80
00187a38: 3c038019 lui r3,0x8019                                 |
00187a3c: 8c632d90 lw r3,0x2d90(r3)                              |r3 = Target current action data pointer
00187a40: 00000000 nop                                           |
00187a44: a0620019 sb r2,0x0019(r3)                              |store 0x80 as removed equiment (helmet)
00187a48: 3c028019 lui r2,0x8019                                 |
00187a4c: 8c422d98 lw r2,0x2d98(r2)                              |r2 = Target data location
00187a50: 3c048019 lui r4,0x8019                                 |
00187a54: 8c842d90 lw r4,0x2d90(r4)                              |r4 = Target current action data pointer
00187a58: 9043001a lbu r3,0x001a(r2)                             |r3 = Helmet ID
00187a5c: 08061f20 j 0x00187c80                                  >> Jump to pre End (success)
00187a60: 00001021 addu r2,r0,r0                                 |r2 = 0x00 (item removal is sucessfull)
00187a64: 10620005 beq r3,r2,0x00187a7c          # if ability is not Armor Break (0x8b)
00187a68: 340200a0 ori r2,r0,0x00a0                  |r2 = 0xA0 (shellbust stab)
00187a6c: 10620003 beq r3,r2,0x00187a7c              # if ability is not shellbust stab
00187a70: 3402006f ori r2,r0,0x006f                      |r2 = 0x6f (Steal Armor)
00187a74: 14620013 bne r3,r2,0x00187ac4                  # if Ability is steal armor  / Else branch to shield section
00187a78: 3402008c ori r2,r0,0x008c                      |r2 = 0x8c (shield break ID)
00187a7c: 3c028019 lui r2,0x8019                 #E  #E  |(section for armor removal)
00187a80: 8c422d98 lw r2,0x2d98(r2)                          |r2 = Target data location
00187a84: 00000000 nop                                       |
00187a88: 9043001b lbu r3,0x001b(r2)                         |r3 = Target armor ID
00187a8c: 340200ff ori r2,r0,0x00ff                          |r2 = 0xFF
00187a90: 1062007d beq r3,r2,0x00187c88                      # If armor Exist (Armor ID <> 0xFF)    /Else branch to near End (fail section)
00187a94: 34020040 ori r2,r0,0x0040                              |r2 = 0x40
00187a98: 3c038019 lui r3,0x8019                                 |
00187a9c: 8c632d90 lw r3,0x2d90(r3)                              |r3 = Target current action data pointer
00187aa0: 00000000 nop                                           |
00187aa4: a0620019 sb r2,0x0019(r3)                              |store 0x40 as removed equiment (Armor)
00187aa8: 3c028019 lui r2,0x8019                                 |
00187aac: 8c422d98 lw r2,0x2d98(r2)                              |r2 = Target data location
00187ab0: 3c048019 lui r4,0x8019                                 |
00187ab4: 8c842d90 lw r4,0x2d90(r4)                              |r4 = Target current action data pointer
00187ab8: 9043001b lbu r3,0x001b(r2)                             |r3 = Armor ID (for display)
00187abc: 08061f20 j 0x00187c80                                  >> Jump to pre End (success)
00187ac0: 00001021 addu r2,r0,r0                                 |r2 = 0x00 (item removal is sucessfull)
00187ac4: 10620003 beq r3,r2,0x00187ad4          # if ability is not shield Break (0x8b)
00187ac8: 34020070 ori r2,r0,0x0070                  |r2 = 0x70 (shellbust stab)
00187acc: 1462001f bne r3,r2,0x00187b4c              # if ability is steal shield  /(Else go to accessory section)
00187ad0: 340200a3 ori r2,r0,0x00a3                  |r2 = 0x00a3 (Icewolf ID)
00187ad4: 9083001e lbu r3,0x001e(r4)             #E  |r3 = Target right hand shield
00187ad8: 340200ff ori r2,r0,0x00ff                      |r2 = 0xFF
00187adc: 1062000c beq r3,r2,0x00187b10                  #If Target right hand shield exist (ID <> 0xFF)   /Else branch to left shield section
00187ae0: 34020008 ori r2,r0,0x0008                          |r2 = 0x08
00187ae4: 3c038019 lui r3,0x8019                             |
00187ae8: 8c632d90 lw r3,0x2d90(r3)                          |r3 = Target current action data pointer
00187aec: 00000000 nop                                       |
00187af0: a0620019 sb r2,0x0019(r3)                          |store 0x08 in Action removed item (right hand shield)
00187af4: 3c028019 lui r2,0x8019                             |
00187af8: 8c422d98 lw r2,0x2d98(r2)                          |r2 = Target data pointer
00187afc: 3c048019 lui r4,0x8019                             |
00187b00: 8c842d90 lw r4,0x2d90(r4)                          |r4 = Target current action data pointer
00187b04: 9043001e lbu r3,0x001e(r2)                         |r3 = Shield ID (for display)
00187b08: 08061f20 j 0x00187c80                              >> Jump to pre End (success)
00187b0c: 00001021 addu r2,r0,r0                             |r2 = 0x00 (item removal is sucessfull)
00187b10: 90820020 lbu r2,0x0020(r4)                     |r2 = left hand shield ID
00187b14: 00000000 nop                                   |
00187b18: 1043005b beq r2,r3,0x00187c88                  #If Target left hand shield exist (ID <> 0xFF)   /Else branch to near End (fail section)
00187b1c: 34020002 ori r2,r0,0x0002                          |r2 = 0x02
00187b20: 3c038019 lui r3,0x8019                             |
00187b24: 8c632d90 lw r3,0x2d90(r3)                          |r3 = Target current action data pointer
00187b28: 00000000 nop                                       |
00187b2c: a0620019 sb r2,0x0019(r3)                          |store 0x02 in Action removed item (left hand shield)
00187b30: 3c028019 lui r2,0x8019                             |
00187b34: 8c422d98 lw r2,0x2d98(r2)                          |r2 = Target data pointer
00187b38: 3c048019 lui r4,0x8019                             |
00187b3c: 8c842d90 lw r4,0x2d90(r4)                          |r4 = Target current action data pointer
00187b40: 90430020 lbu r3,0x0020(r2)                         |r3 = Shield ID (for display)
00187b44: 08061f20 j 0x00187c80                              >> Jump to pre End (success)
00187b48: 00001021 addu r2,r0,r0                             |r2 = 0x00 (item removal is sucessfull)
00187b4c: 10620003 beq r3,r2,0x00187b5c          #If ability is not Icewolf bite
00187b50: 34020072 ori r2,r0,0x0072                  |r2 = 0x72
00187b54: 14620010 bne r3,r2,0x00187b98              #If ability is steal accessory   /Else branch to weapon section
00187b58: 3402008d ori r2,r0,0x008d                  |r2 = 0x8d (weapon break ID)
00187b5c: 9083001c lbu r3,0x001c(r4)             #E  |r3 = Target accessory ID
00187b60: 340200ff ori r2,r0,0x00ff                      |r2 =0xFF
00187b64: 10620048 beq r3,r2,0x00187c88                  # If accessory exist  /Else branch to near End (fail section)
00187b68: 34020020 ori r2,r0,0x0020                          |r2 = 0x20
00187b6c: 3c038019 lui r3,0x8019                             |
00187b70: 8c632d90 lw r3,0x2d90(r3)                          |r3 = Target current action data pointer
00187b74: 00000000 nop                                       |
00187b78: a0620019 sb r2,0x0019(r3)                          |store 0x20 in Action removed item (accessory)
00187b7c: 3c028019 lui r2,0x8019                             |
00187b80: 8c422d98 lw r2,0x2d98(r2)                          |r2 = Target data pointer
00187b84: 3c048019 lui r4,0x8019                             |
00187b88: 8c842d90 lw r4,0x2d90(r4)                          |r4 = Target current action data pointer
00187b8c: 9043001c lbu r3,0x001c(r2)                         |r3 = Accessory ID (for display)
00187b90: 08061f20 j 0x00187c80                              >> Jump to pre End (success)
00187b94: 00001021 addu r2,r0,r0                             |r2 = 0x00 (item removal is sucessfull)
00187b98: 10620006 beq r3,r2,0x00187bb4          # If ability is not weapon break (0x8D)
00187b9c: 2405ffff addiu r5,r0,0xffff            |r5 = 0xFFFF (for later purpose -  r5 will become left hand weapon enemy level if target has a left hand weapon)
00187ba0: 340200a2 ori r2,r0,0x00a2                  |r2 = 0xA2 (Hellcry punch ID)
00187ba4: 10620003 beq r3,r2,0x00187bb4              # if ability is not Hellcry Punch 
00187ba8: 34020071 ori r2,r0,0x0071                      |r2 = 0x71 (Steal weapon iD)
00187bac: 14620036 bne r3,r2,0x00187c88                  #If ability is steal wepon  /Else branch to near End (fail section-no hardcoded ability found)
00187bb0: 00000000 nop                                   |
00187bb4: 3c068019 lui r6,0x8019                 #E  #E  |(Wepon removal section)
00187bb8: 8cc62d98 lw r6,0x2d98(r6)                          |r6 = Target data pointer
00187bbc: 00000000 nop                                       |
00187bc0: 90c3001d lbu r3,0x001d(r6)                         |r3 = Target right hand weapon ID
00187bc4: 340700ff ori r7,r0,0x00ff                          |r7 = 0xFF
00187bc8: 10670007 beq r3,r7,0x00187be8                      # If Target right hand weapon exist   /Else branch to left hand section
00187bcc: 2404ffff addiu r4,r0,0xffff                        |r4 = 0xFFFF 
00187bd0: 00031040 sll r2,r3,0x01                                |r2 = weapon ID * 2
00187bd4: 00431021 addu r2,r2,r3                                 |r2 = weapon ID * 3
00187bd8: 00021080 sll r2,r2,0x02                                |r2 = weapon ID * 12
00187bdc: 3c018006 lui r1,0x8006                                 |
00187be0: 00220821 addu r1,r1,r2                                 |r1 = 0x8006 XXXX (weapon ID *12)
00187be4: 90242eba lbu r4,0x2eba(r1)                             |r4 = right hand Weapon enemy level
00187be8: 90c3001f lbu r3,0x001f(r6)                         |r3 = Target left hand weapon
00187bec: 00000000 nop                                       |
00187bf0: 10670006 beq r3,r7,0x00187c0c                      # if target left hand weapon exist   /Else branch to weapon resolution section
00187bf4: 00031040 sll r2,r3,0x01                                |r2 = weapon ID * 2
00187bf8: 00431021 addu r2,r2,r3                                 |r2 = weapon ID * 3
00187bfc: 00021080 sll r2,r2,0x02                                |r2 = weapon ID * 12
00187c00: 3c018006 lui r1,0x8006                                 |
00187c04: 00220821 addu r1,r1,r2                                 |r1 = 0x8006 XXXX (weapon ID *12)
00187c08: 90252eba lbu r5,0x2eba(r1)                             |r5 = left hand weapon enemy level
00187c0c: 2402ffff addiu r2,r0,0xffff                        |r2 = 0xFFFF
00187c10: 14820003 bne r4,r2,0x00187c20                      # If r4 = 0xFFFF
00187c14: 00000000 nop                                       |
00187c18: 10a4001b beq r5,r4,0x00187c88                          #If r5 <> 0xFFFF  /Else branch to pre-End  (r4 = r5 = 0xFFFF : target has no weapon it's a fail)
00187c1c: 00000000 nop                                           |
00187c20: 0085102a slt r2,r4,r5                              |r2 = 1 if right hand weapon enemy level is < at left hand weapon enemy level (else 0)
00187c24: 1440000c bne r2,r0,0x00187c58                      # If left hand weapon enemy level > right hand's one
00187c28: 34020004 ori r2,r0,0x0004                          |r2 = 0x0004  (for action removed weapon data : 0x04 = left hand weapon)
00187c2c: 3c038019 lui r3,0x8019                             |
00187c30: 8c632d90 lw r3,0x2d90(r3)                              |r3 = Target current action data pointer
00187c34: 34020010 ori r2,r0,0x0010                              |r2 = 0x10
00187c38: a0620019 sb r2,0x0019(r3)                              |store 0x10 in action removed equipment (right hand weapon)
00187c3c: 3c028019 lui r2,0x8019                                 |
00187c40: 8c422d98 lw r2,0x2d98(r2)                              |r2 = Target data pointer
00187c44: 3c048019 lui r4,0x8019                                 |
00187c48: 8c842d90 lw r4,0x2d90(r4)                              |r4 = Target current action data pointer
00187c4c: 9043001d lbu r3,0x001d(r2)                             |r3 = Right hand weapon ID (for display)
00187c50: 08061f20 j 0x00187c80                                  >> Jump to pre End (success)
00187c54: 00001021 addu r2,r0,r0                                 |r2 = 0x00 (item removal is sucessfull)
00187c58: 3c038019 lui r3,0x8019                             # Else If left hand weapon enemy level < right hand's one
00187c5c: 8c632d90 lw r3,0x2d90(r3)                              |r3 = Target current action data pointer
00187c60: 00000000 nop                                           |
00187c64: a0620019 sb r2,0x0019(r3)                              |store 0x04 in action removed equipment (left hand weapon)
00187c68: 3c028019 lui r2,0x8019                                 |
00187c6c: 8c422d98 lw r2,0x2d98(r2)                              |r2 = Target data pointer
00187c70: 3c048019 lui r4,0x8019                                 |
00187c74: 8c842d90 lw r4,0x2d90(r4)                              |r4 = Target current action data pointer
00187c78: 9043001f lbu r3,0x001f(r2)                             |r3 = Left hand weapon ID (for display)
00187c7c: 00001021 addu r2,r0,r0                                 |r2 = 0x00 (item removal is sucessfull)
00187c80: 08061f26 j 0x00187c98                              >>L >> jump to End (landing site of all successfull removal)
00187c84: a0830003 sb r3,0x0003(r4)                              |Store item ID in current action"item to remove"
00187c88: 3c038019 lui r3,0x8019                         >>L |Landing site of all fails
00187c8c: 8c632d90 lw r3,0x2d90(r3)                      |r3 = Target current action data pointer
00187c90: 2402ffff addiu r2,r0,0xffff                    |r2 = 0xFFFF
00187c94: a0600019 sb r0,0x0019(r3)                      |store 0x00 in action removed item (set to 0xFE at the start of the routine)
00187c98: 03e00008 jr r31                                |
00187c9c: 00000000 nop                                   |

Return locations

001896fc: Formula 25 - Equipped: Break Hit (PA+WP+X)%
001897a4: Formula 26 - Equipped: Steal Hit (SP+X)%
00189bb4: Formula 2E - Equipped:Break Dmg (PA*WP)