Steal/Break/Might Sword Hard Coding
Jump to navigation
Jump to search
-- Steal/Break/Might Sword Hard Coded routine --
No Parameters Returns r2 = 0x00 if Item is broken/Stolen / Else -0x01 (no Item, Monster, wrong Ability) Choose the item to break/steal from the ability ID (Hard coded) - Set Target current Action Remove item flag (TCA 0x19) - Store item to remove ID in TCA 0x03 Note : if two weapons are equiped the better one will be broken (based on weapon enemy level) -------------------------------------------------------------------------------------------------------------- 001879c8: 3c038019 lui r3,0x8019 | 001879cc: 8c632d90 lw r3,0x2d90(r3) |r3 = Target current action (TCA) 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 = Current Ability used Ability ID 0x801938d6 / 801938d6 00187a00: 00000000 nop | --- Remove HELMET section --- 00187a04: 10620005 beq r3,r2,0x00187a1c # If used Ability is not 0x8A (head break) 00187a08: 340200a1 ori r2,r0,0x00a1 |r2 = 0xa1 (blastar punch ID) 00187a0c: 10620003 beq r3,r2,0x00187a1c # If used 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 | 00187a20: 8c422d98 lw r2,0x2d98(r2) |r2 = Target data pointer 00187a24: 00000000 nop | 00187a28: 9043001a lbu r3,0x001a(r2) |r3 = Target's Helmet ID 00187a2c: 340200ff ori r2,r0,0x00ff |r2 = 0x0ff 00187a30: 10620095 beq r3,r2,0x00187c88 #If Helmet exists (ID <> 0xff) /Else branch to Fail section 00187a34: 34020080 ori r2,r0,0x0080 |r2 = 0x80 (Removed helmet flag) 00187a38: 3c038019 lui r3,0x8019 | 00187a3c: 8c632d90 lw r3,0x2d90(r3) |r3 = Target current action (TCA) data pointer 00187a40: 00000000 nop | 00187a44: a0620019 sb r2,0x0019(r3) |Set TCA remove item flag to 0x80 (remove helmet) 00187a48: 3c028019 lui r2,0x8019 | 00187a4c: 8c422d98 lw r2,0x2d98(r2) |r2 = Target data pointer 00187a50: 3c048019 lui r4,0x8019 | 00187a54: 8c842d90 lw r4,0x2d90(r4) |r4 = TCA data pointer 00187a58: 9043001a lbu r3,0x001a(r2) |r3 = Target's Helmet ID 00187a5c: 08061f20 j 0x00187c80 >>Jump to Store Broken/Stolen Item 00187a60: 00001021 addu r2,r0,r0 |r2 = 0x00 (returned as item removal is sucessfull) --- Remove ARMOR section --- 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 | 00187a80: 8c422d98 lw r2,0x2d98(r2) |r2 = Target data pointer 00187a84: 00000000 nop | 00187a88: 9043001b lbu r3,0x001b(r2) |r3 = Target's armor ID 00187a8c: 340200ff ori r2,r0,0x00ff |r2 = 0x0ff 00187a90: 1062007d beq r3,r2,0x00187c88 # If Armor Exists (Armor ID <> 0xFF) /Else branch to Fail section 00187a94: 34020040 ori r2,r0,0x0040 |r2 = 0x40 (Remove Armor flag) 00187a98: 3c038019 lui r3,0x8019 | 00187a9c: 8c632d90 lw r3,0x2d90(r3) |r3 = Target current action (TCA) data pointer 00187aa0: 00000000 nop | 00187aa4: a0620019 sb r2,0x0019(r3) |Set TCA remove item flag to 0x40 (remove Armor) 00187aa8: 3c028019 lui r2,0x8019 | 00187aac: 8c422d98 lw r2,0x2d98(r2) |r2 = Target data pointer 00187ab0: 3c048019 lui r4,0x8019 | 00187ab4: 8c842d90 lw r4,0x2d90(r4) |r4 = TCA data pointer 00187ab8: 9043001b lbu r3,0x001b(r2) |r3 = Target's Armor ID 00187abc: 08061f20 j 0x00187c80 >>Jump to Store Broken/Stolen Item 00187ac0: 00001021 addu r2,r0,r0 |r2 = 0x00 (returned as item removal is sucessfull) --- Remove SHIELD section --- 00187ac4: 10620003 beq r3,r2,0x00187ad4 # if ability is not shield Break (0x8c) 00187ac8: 34020070 ori r2,r0,0x0070 |r2 = 0x70 (steal shield) 00187acc: 1462001f bne r3,r2,0x00187b4c # if ability is steal shield /Else branch 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 = 0x0ff 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 (Remove Right Hand Shield flag) 00187ae4: 3c038019 lui r3,0x8019 | 00187ae8: 8c632d90 lw r3,0x2d90(r3) |r3 = TCA data pointer 00187aec: 00000000 nop | 00187af0: a0620019 sb r2,0x0019(r3) |Set TCA remove item flag to 0x08 (RH 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= TCA data pointer 00187b04: 9043001e lbu r3,0x001e(r2) |r3 = RH Shield ID 00187b08: 08061f20 j 0x00187c80 >>Jump to Store Broken/Stolen Item 00187b0c: 00001021 addu r2,r0,r0 |r2 = 0x00 (returned as item removal is sucessfull) 00187b10: 90820020 lbu r2,0x0020(r4) |r2 = left hand (LH) shield ID 00187b14: 00000000 nop | 00187b18: 1043005b beq r2,r3,0x00187c88 #If Target left hand shield exist (ID <> 0xFF) /Else branch to Fail section 00187b1c: 34020002 ori r2,r0,0x0002 |r2 = 0x02 (Remove Left Hand Shield flag) 00187b20: 3c038019 lui r3,0x8019 | 00187b24: 8c632d90 lw r3,0x2d90(r3) |r3 = TCA data pointer 00187b28: 00000000 nop | 00187b2c: a0620019 sb r2,0x0019(r3) |Set TCA remove item flag to 0x02 (LH 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= TCA data pointer 00187b40: 90430020 lbu r3,0x0020(r2) |r3 = LH Shield ID 00187b44: 08061f20 j 0x00187c80 >>Jump to Store Broken/Stolen Item 00187b48: 00001021 addu r2,r0,r0 |r2 = 0x00 (returned as item removal is sucessfull) --- Remove ACCESSORY section --- 00187b4c: 10620003 beq r3,r2,0x00187b5c #If ability is not Icewolf bite (0xa3) 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's Accessory ID 00187b60: 340200ff ori r2,r0,0x00ff |r2 =0x0ff 00187b64: 10620048 beq r3,r2,0x00187c88 # If accessory exists /Else branch to Fail section 00187b68: 34020020 ori r2,r0,0x0020 |r2 = 0x20 (remove accessory flag) 00187b6c: 3c038019 lui r3,0x8019 | 00187b70: 8c632d90 lw r3,0x2d90(r3) |r3 = TCA data pointer 00187b74: 00000000 nop | 00187b78: a0620019 sb r2,0x0019(r3) |Set TCA remove item flag to 0x20 (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 = TCA data pointer 00187b8c: 9043001c lbu r3,0x001c(r2) |r3 = Target's Accessory ID (for display) 00187b90: 08061f20 j 0x00187c80 >>Jump to Store Broken/Stolen Item 00187b94: 00001021 addu r2,r0,r0 |r2 = 0x00 (returned as item removal is sucessfull) --- Remove WEAPON section --- 00187b98: 10620006 beq r3,r2,0x00187bb4 # If ability is not weapon break (0x8D) 00187b9c: 2405ffff addiu r5,r0,-0x0001 |r5 =-0x01 (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 | 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 = 0x0ff 00187bc8: 10670007 beq r3,r7,0x00187be8 # If Target right hand weapon exist /Else branch to left hand section 00187bcc: 2404ffff addiu r4,r0,-0x0001 |r4 = -0x0001 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 = RH Weapon enemy level 80062eb8 + 0x02 + Weapon offset 00187be8: 90c3001f lbu r3,0x001f(r6) |r3 = Target left hand weapon ID 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 = LH weapon enemy level 00187c0c: 2402ffff addiu r2,r0,-0x0001 |r2 = -0x01 00187c10: 14820003 bne r4,r2,0x00187c20 # If r4 = -0x01 (No RH weapon) 00187c14: 00000000 nop | 00187c18: 10a4001b beq r5,r4,0x00187c88 #If LH Weapon Exists (r5 <> -0x01) /Else branch to pre-End (r4 = r5 = -0x01 : target has no weapon it's a fail) 00187c1c: 00000000 nop | 00187c20: 0085102a slt r2,r4,r5 #E | r2 = 0x01 if RH weapon Lv < LH weapon Lv 00187c24: 1440000c bne r2,r0,0x00187c58 #If RH Weapon Lv > LH weapon Lv 00187c28: 34020004 ori r2,r0,0x0004 |r2 = 0x04 (remove LH weapon flag) 00187c2c: 3c038019 lui r3,0x8019 | 00187c30: 8c632d90 lw r3,0x2d90(r3) |r3 = TCA data pointer 00187c34: 34020010 ori r2,r0,0x0010 |r2 = 0x10 (remove RH weapon flag) 00187c38: a0620019 sb r2,0x0019(r3) |Set TCA remove item flag to 0x10 (RH 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 00187c50: 08061f20 j 0x00187c80 >>Jump to Store Broken/Stolen Item 00187c54: 00001021 addu r2,r0,r0 |r2 = 0x00 (returned as item removal is sucessfull) 00187c58: 3c038019 lui r3,0x8019 # Else : LH Weapon ID > RH weapon ID 00187c5c: 8c632d90 lw r3,0x2d90(r3) |r3 = TCA data pointer 00187c60: 00000000 nop | 00187c64: a0620019 sb r2,0x0019(r3) |Set TCA remove item flag to 0x04 (LH 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) --- SUCCESS --- 00187c80: 08061f26 j 0x00187c98 >>jump to End 00187c84: a0830003 sb r3,0x0003(r4) |Store Broken/Stolen Item ID in TCA 0x03 (Item to remove) --- FAIL --- 00187c88: 3c038019 lui r3,0x8019 |>j landing site off all fails 00187c8c: 8c632d90 lw r3,0x2d90(r3) |r3 = TCA data pointer 00187c90: 2402ffff addiu r2,r0,-0x0001 |r2 = -0x0001 00187c94: a0600019 sb r0,0x0019(r3) |Store 0x00 in TCA removed item (set to 0xFE at the start of the routine) 00187c98: 03e00008 jr r31 END 00187c9c: 00000000 nop
Hard coded mechanics
Item to break/steal is tied to Ability ID. Any other ability will end with a fail. - Steal Helmet 0x6e Helmet - Steal Armor 0x6f Armor - Steal Shield 0x70 Shield - Steal Weapon 0x71 Weapon - Steal Accessory 0x72 Accessory - Head Break 0x8a Helmet - Armor Break 0x8b Armor - Shield Break 0x8c Shield - Weapon Break 0x8d Weapon - Blastar Punch 0xa1 Helmet - Shellbust Stab 0xa0 Armor - Hellcry Punch 0xa2 Weapon - Icewolf Bite 0xa3 Accessory
Return locations
Battle.bin 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)