Difference between revisions of "Calculate Final Hit %"
Jump to navigation
Jump to search
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | No Parameters - Returns nothing | |
− | + | ||
− | + | '''If Ability flag [Evadeable] is Off : skip the whole routine''' | |
− | + | This routine Will set the value of the displayed Hit% | |
− | + | - Forced to 0x00 if Any Current Ability Evade data is greater than base hit value | |
− | + | - If Attack might succeed : Hit% is calculated in the central math section | |
− | + | Last part of the routine Roll Each Evade type against Current Ability Base Hit (That's why halving base Hit = doubling all evasion type (cf Defend mechanics)) | |
− | + | '''Update Target current action 0x2a (Hit%) and if Evaded then update Target current action 0x00 (Hit flag) 0x02 (Evade Type) and 0x03 (Used Item for evasion)''' | |
− | + | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
− | + | 00185814: 3c028019 lui r2,0x8019 | | |
− | + | 00185818: 944238d6 lhu r2,0x38d6(r2) |{{f/load|<nowiki>r2 = Current Ability : used Ability ID</nowiki>}} {{f/std| 0x801938d6}} | |
− | + | 0018581c: 27bdffe0 addiu r29,r29,-0x020 | | |
− | + | 00185820: afbf0018 sw r31,0x0018(r29) | | |
− | + | 00185824: afb10014 sw r17,0x0014(r29) | | |
− | + | 00185828: 10400007 beq r2,r0,0x00185848 {{f/Cond|If used Ability is not a standard Attack}} | |
− | + | 0018582c: afb00010 sw r16,0x0010(r29) | | |
− | + | 00185830: 3c028019 lui r2,0x8019 | | |
− | + | 00185834: 904238f6 lbu r2,0x38f6(r2) |{{f/load|<nowiki>r2 = Current Ability flags 4</nowiki>}} {{f/std| 0x801938f6}} | |
− | + | 00185838: 00000000 nop | | |
− | + | 0018583c: 30420002 andi r2,r2,0x0002 |{{f/std|<nowiki>r2 = 0x02 if Ability is Evadable</nowiki>}} | |
− | + | 00185840: 10400090 beq r2,r0,0x00185a84 {{f/Cond|Branch to }} {{f/loc|END}} '''if Ability is not Evadable''' | |
− | + | 00185844: 00000000 nop | |
− | + | 00185848: 3c088019 lui r8,0x8019 |{{f/std|}} | |
− | + | 0018584c: 910838dc lbu r8,0x38dc(r8) |{{f/load|<nowiki>r8 = Current ability base Hit</nowiki>}} {{f/std| 0x801938dc}} | |
− | + | 00185850: 3c038019 lui r3,0x8019 | | |
− | + | 00185854: 906338de lbu r3,0x38de(r3) |{{f/load|<nowiki>r3 = Current Ability Accessory Evade</nowiki>}} {{f/std| 0x801938de}} | |
− | + | 00185858: 310500ff andi r5,r8,0x00ff |{{f/std|<nowiki>r5 = Base Hit (byte)</nowiki>}} | |
− | + | 0018585c: 0065102b sltu r2,r3,r5 |{{f/std|<nowiki>r2 = 0x01 if Accessory Evade < Base Hit</nowiki>}} | |
− | + | 00185860: 10400013 beq r2,r0,0x001858b0 {{f/Cond|If Base Hit > Accessory Evade}} /Else branch (Attack Evaded without maths) | |
− | + | 00185864: 01008021 addu r16,r8,r0 |{{f/std|<nowiki>r16 = Base Hit % (Keep original value)</nowiki>}} | |
− | + | 00185868: 3c048019 lui r4,0x8019 |{{f/std|}} | |
− | + | 0018586c: 908438df lbu r4,0x38df(r4) |{{f/load|<nowiki>r4 = Current Ability Right Hand Evade</nowiki>}} {{f/std| 0x801938df}} | |
− | + | 00185870: 00000000 nop | | |
− | + | 00185874: 0085102b sltu r2,r4,r5 |{{f/std|<nowiki>r2 = 0x01 if Right Hand Evade < Base Hit</nowiki>}} | |
− | + | 00185878: 1040000d beq r2,r0,0x001858b0 {{f/Cond|If Base Hit > Right Hand Evade}} /Else branch (Attack Evaded without maths) | |
− | + | 0018587c: 00000000 nop |{{f/std|}} | |
− | + | 00185880: 3c068019 lui r6,0x8019 |{{f/std|}} | |
− | + | 00185884: 90c638e0 lbu r6,0x38e0(r6) |{{f/load|<nowiki>r6 = Current Ability Left Hand Evade</nowiki>}} {{f/std| 0x801938e0}} | |
− | + | 00185888: 00000000 nop | | |
− | + | 0018588c: 00c5102b sltu r2,r6,r5 |{{f/std|<nowiki>r2 = 0x01 if Left Hand Evade < Base Hit</nowiki>}} | |
− | + | 00185890: 10400007 beq r2,r0,0x001858b0 {{f/Cond|If Base Hit > Left Hand Evade}} /Else branch (Attack Evaded without maths) | |
− | + | 00185894: 00000000 nop |{{f/std|}} | |
− | + | 00185898: 3c078019 lui r7,0x8019 |{{f/std|}} | |
− | + | 0018589c: 90e738e1 lbu r7,0x38e1(r7) |{{f/load|<nowiki>r7 = Current Ability Class Evade</nowiki>}} {{f/std| 0x801938e1}} | |
− | + | 001858a0: 00000000 nop | | |
− | + | 001858a4: 00e5102b sltu r2,r7,r5 |{{f/std|<nowiki>r2 = 0x01 If Class Evade < Base Hit</nowiki>}} | |
− | + | 001858a8: 14400009 bne r2,r0,0x001858d0 {{f/Cond|If Class Evade > Base Hit}} /Else Avoid is Evaded section | |
− | + | 001858ac: 00a31023 subu r2,r5,r3 |{{f/std|<nowiki>r2 = Base Hit - Accessory Evade</nowiki>}} | |
− | + | 001858b0: 3c028019 lui r2,0x8019 {{f/Cond|E }} {{f/Cond|E }} {{f/Cond|E }} | | |
− | + | 001858b4: 8c422d90 lw r2,0x2d90(r2) |{{f/adr|<nowiki>r2 = Target Current action data pointer</nowiki>}} | |
− | + | 001858b8: 00000000 nop | | |
− | + | 001858bc: a0400000 sb r0,0x0000(r2) |{{f/store|Store 0x00 in Target Current action hit flag (miss)}} | |
− | + | 001858c0: 3c028019 lui r2,0x8019 | | |
− | + | 001858c4: 8c422d90 lw r2,0x2d90(r2) |{{f/adr|<nowiki>r2 = Target Current action data pointer</nowiki>}} | |
− | + | 001858c8: 08061675 j 0x001859d4 {{f/jump|jump After display section}} | |
− | + | 001858cc: a440002a sh r0,0x002a(r2) |{{f/store|<nowiki>Store Target Current action Hit% = 0</nowiki>}} | |
− | + | {{f/Cond|Else (Attacks might succeed) - keep going}} | |
− | + | ||
− | + | {{f/loc| --- Display Hit% Section ---}} | |
− | + | 001858d0: 00021840 sll r3,r2,0x01 |{{f/std|<nowiki>r2 = Reduced Hit *2 (Base Hit - Accessory Evade)</nowiki>}} {{f/std|<nowiki>Base Hit = 80</nowiki>}} | |
− | + | 001858d4: 00621821 addu r3,r3,r2 |{{f/std|Reduced Hit *3}} {{f/std|<nowiki>Acc Evade = 20</nowiki>}} | |
− | + | 001858d8: 000318c0 sll r3,r3,0x03 |{{f/std|Reduced Hit * 24}} | |
− | + | 001858dc: 00621821 addu r3,r3,r2 |{{f/std|Reduced Hit * 25}} | |
− | + | 001858e0: 00031880 sll r3,r3,0x02 |{{f/std|<nowiki>r3 = Reduced Hit *100</nowiki>}} | |
− | + | 001858e4: 0065001a div r3,r5 |{{f/std|(Accessory Reduced Hit *100)/Base Hit ( % of remaining Hit after Accessory Evade)}} | |
− | + | 001858e8: 00001812 mflo r3 |{{f/std|<nowiki>r3 = % Of base Hit remaining</nowiki>}} | |
− | + | 001858ec: 00a42023 subu r4,r5,r4 |{{f/std|<nowiki>r4 = Base Hit - Right Hand Evade</nowiki>}} | |
− | + | 001858f0: 00041040 sll r2,r4,0x01 |{{f/std|Reduced Hit *2}} | |
− | + | 001858f4: 00441021 addu r2,r2,r4 |{{f/std|Reduced Hit *3}} | |
− | + | 001858f8: 000210c0 sll r2,r2,0x03 |{{f/std|Reduced Hit * 24}} | |
− | + | 001858fc: 00441021 addu r2,r2,r4 |{{f/std|Reduced Hit * 25}} | |
− | + | 00185900: 00021080 sll r2,r2,0x02 |{{f/std|<nowiki>r2 = Reduced Hit *100</nowiki>}} | |
− | + | 00185904: 0045001a div r2,r5 |{{f/std|(Right Hand Reduced Hit *100)/Base Hit ( % of remaining Hit after Right Hand Evade)}} | |
− | + | 00185908: 00001012 mflo r2 |{{f/std|<nowiki>r2 = Right Hand % of Remaining Base Hit</nowiki>}} | |
− | + | 0018590c: 00000000 nop | | |
− | + | 00185910: 00000000 nop | | |
− | + | 00185914: 00620018 mult r3,r2 |{{f/std|Accessory Remaing Hit% * Right Hand Remaining Hit%}} | |
− | + | 00185918: 00a61823 subu r3,r5,r6 |{{f/std|<nowiki>r3 = Base Hit - Left Hand Evade</nowiki>}} | |
− | + | 0018591c: 00031040 sll r2,r3,0x01 |{{f/std|Reduced Hit *2}} | |
− | + | 00185920: 00431021 addu r2,r2,r3 |{{f/std|Reduced Hit *3}} | |
− | + | 00185924: 000210c0 sll r2,r2,0x03 |{{f/std|Reduced Hit * 24}} | |
− | + | 00185928: 00002012 mflo r4 |r4 = Current Remaining % of Base (After Accessory and Right Hand Evade) * 100 | |
− | + | 0018592c: 00431021 addu r2,r2,r3 |{{f/std|Reduced Hit * 25}} | |
− | + | 00185930: 00021080 sll r2,r2,0x02 |{{f/std|<nowiki>r2 = Reduced Hit *100</nowiki>}} | |
− | + | 00185934: 0045001a div r2,r5 |{{f/std|(Left Hand Reduced Hit *100)/Base Hit ( % of remaining Hit after Left Hand Evade)}} | |
− | + | 00185938: 00001012 mflo r2 |{{f/std|<nowiki>r2 = Left Hand % Of base Hit remaining</nowiki>}} | |
− | + | 0018593c: 00000000 nop | | |
− | + | 00185940: 00000000 nop | | |
− | + | 00185944: 00820018 mult r4,r2 |{{f/std|Current Remaing Hit% *100 * Left Hand Remaining Hit%}} | |
− | + | 00185948: 00a71823 subu r3,r5,r7 |{{f/std|<nowiki>r3 = Base Hit % - Class Evade</nowiki>}} | |
− | + | 0018594c: 00031040 sll r2,r3,0x01 |{{f/std|Reduced Hit *2}} | |
− | + | 00185950: 00431021 addu r2,r2,r3 |{{f/std|Reduced Hit *3}} | |
− | + | 00185954: 000210c0 sll r2,r2,0x03 |{{f/std|Reduced Hit * 24}} | |
− | + | 00185958: 00002012 mflo r4 |r4 = Current Remaining % of Base (After Accessory, Right Hand and Left Hand Evade) * 10000 | |
− | + | 0018595c: 00431021 addu r2,r2,r3 |{{f/std|Reduced Hit * 25}} | |
− | + | 00185960: 00021080 sll r2,r2,0x02 |{{f/std|<nowiki>r2 = Reduced Hit *100</nowiki>}} | |
− | + | 00185964: 0045001a div r2,r5 |{{f/std|(Classe Evade Reduced Hit *100)/Base Hit ( % of remaining Hit after Class Evade)}} | |
− | + | 00185968: 00001012 mflo r2 |{{f/std|<nowiki>r2 = Class Evade % Of base Hit remaining</nowiki>}} | |
− | + | 0018596c: 00000000 nop | | |
− | + | 00185970: 00000000 nop | | |
− | + | 00185974: 00820018 mult r4,r2 |{{f/std|Current Remaing Hit% * Class Evade Remaining Hit% * 1000000}} | |
− | + | 00185978: 00001812 mflo r3 |r3 = Current Remaining % of Base (After Accessory, Right Hand, Left Hand and Class Evade) *1000000 | |
− | + | 0018597c: 3c02431b lui r2,0x431b | | |
− | + | 00185980: 3442de83 ori r2,r2,0xde83 |{{f/std|<nowiki>r2 = 0x431bde83 (0,262144 * 2^32)</nowiki>}} | |
− | + | 00185984: 00620018 mult r3,r2 |{{f/std|Current Remaining %of base Hit * 2^32*0,262144*1000000}} | |
− | + | 00185988: 3c058019 lui r5,0x8019 | | |
− | + | 0018598c: 8ca52d90 lw r5,0x2d90(r5) |{{f/adr|<nowiki>r5 = Target Current action data pointer</nowiki>}} | |
− | + | 00185990: 00000000 nop | | |
− | + | 00185994: 84a4002a lh r4,0x002a(r5) |{{f/load|<nowiki>r4 = Target Current action Hit% (Set to 100 during PreFormla Set Up)</nowiki>}} | |
− | + | 00185998: 00031fc3 sra r3,r3,0x1f |{{f/std|<nowiki>r3 = 1st bit of Current Remaining % of base hit (should be 0x00)</nowiki>}} | |
− | + | 0018599c: 00001010 mfhi r2 |{{f/std|<nowiki>r2 = [Remaining % of Base Hit] *262144</nowiki>}} | |
− | + | 001859a0: 00021483 sra r2,r2,0x12 |{{f/std|<nowiki>r2 = [Remaining % of Base Hit] (2^18 = 262144)</nowiki>}} | |
− | + | 001859a4: 00431023 subu r2,r2,r3 |{{f/std|<nowiki>r2 = [Remaining % of Base Hit] -0x00</nowiki>}} | |
− | + | 001859a8: 00440018 mult r2,r4 |{{f/std|[Remaining % of Base Hit] * [Base Hit]}} | |
− | + | 001859ac: 00001812 mflo r3 |{{f/std|<nowiki>r3 = [Remaining % of Base Hit] * [Base Hit]</nowiki>}} | |
− | + | 001859b0: 3c0251eb lui r2,0x51eb | | |
− | + | 001859b4: 3442851f ori r2,r2,0x851f |{{f/std|<nowiki>r2 = 0x51eb851f * 0,32*2^32</nowiki>}} | |
− | + | 001859b8: 00620018 mult r3,r2 |{{f/std|[Remaining % of Base Hit] * [Base Hit] * 0,32 * 2^32}} | |
− | + | 001859bc: 00031fc3 sra r3,r3,0x1f |{{f/std|<nowiki>r3 = 1st bit of [Remaining % of Base Hit] * [Base Hit]</nowiki>}} | |
− | + | 001859c0: 00001010 mfhi r2 |{{f/std|<nowiki>r2 = [Remaining % of Base Hit] * [Base Hit] * 32/100</nowiki>}} | |
− | + | 001859c4: 00021143 sra r2,r2,0x05 |{{f/std|<nowiki>r2 = [Remaining % of Base Hit] * [Base Hit] /100 = Final Hit</nowiki>}} | |
− | + | 001859c8: 00431023 subu r2,r2,r3 | | |
− | + | 001859cc: a4a2002a sh r2,0x002a(r5) |{{f/store|Store Final Hit% in Target Current Action 0x2a (Hit%)}} | |
− | + | 001859d0: 01008021 addu r16,r8,r0 |{{f/std|<nowiki>r16 = Original Hit %</nowiki>}} | |
− | + | ||
− | + | {{f/loc| ---Roll Evasion Section ---}} | |
− | + | 001859d4: 02002821 addu r5,r16,r0 |r5 = Current Ability Base Hit | |
− | + | 001859d8: 3c028019 lui r2,0x8019 | | |
− | + | 001859dc: 8c422d98 lw r2,0x2d98(r2) |{{f/adr|<nowiki>r2 = Target Current action data pointer</nowiki>}} | |
− | + | 001859e0: 3c048019 lui r4,0x8019 | | |
− | + | 001859e4: 908438de lbu r4,0x38de(r4) |{{f/load|<nowiki>r4 = Accessory Evade</nowiki>}} | |
− | + | 001859e8: 9047001c lbu r7,0x001c(r2) |{{f/load|<nowiki>r7 = Target Accessory ID</nowiki>}} | |
− | + | 001859ec: 0c061236 jal 0x001848d8 |{{f/jal|Attack_Evaded_Calculations|Attack_Evaded_Calculations}} If Attack is Evaded r2 = 0x01 (Hit flag is set to 0x00) | |
− | + | 001859f0: 34060001 ori r6,r0,0x0001 |{{f/std|<nowiki>r6 = 0x01 (Accessory Evade Flag)</nowiki>}} | |
− | + | 001859f4: 14400023 bne r2,r0,0x00185a84 {{f/Cond|If Attack Hits}} /Else if Attack is Evaded, branch to {{f/loc|END}} | |
− | + | 001859f8: 341100ff ori r17,r0,0x00ff |{{f/std|<nowiki>r17 = 0x0ff</nowiki>}} | |
− | + | 001859fc: 3c038019 lui r3,0x8019 |{{f/std|}} | |
− | + | 00185a00: 8c632d98 lw r3,0x2d98(r3) |{{f/adr|<nowiki>r3 = Target Data pointer</nowiki>}} | |
− | + | 00185a04: 00000000 nop | | |
− | + | 00185a08: 9067001d lbu r7,0x001d(r3) |{{f/load|<nowiki>r7 = Target Right Hand Weapon ID</nowiki>}} | |
− | + | 00185a0c: 00000000 nop | | |
− | + | 00185a10: 30e200ff andi r2,r7,0x00ff |{{f/std|<nowiki>r2 = Right Hand Weapon ID (byte)</nowiki>}} | |
− | + | 00185a14: 14510002 bne r2,r17,0x00185a20 {{f/Cond|<nowiki>If Right Hand Weapon ID = 0x0ff (don't exist)</nowiki>}} | |
− | + | 00185a18: 02002821 addu r5,r16,r0 |{{f/std|<nowiki>r5 = Current Ability Base Hit</nowiki>}} | |
− | + | 00185a1c: 9067001e lbu r7,0x001e(r3) |{{f/load|<nowiki>r7 = Target Right Hand Shield</nowiki>}} | |
− | + | 00185a20: 3c048019 lui r4,0x8019 |{{f/std|}} | |
− | + | 00185a24: 908438df lbu r4,0x38df(r4) |{{f/load|<nowiki>r4 = Current Ability Right Hand Evade</nowiki>}} {{f/std| 0x801938df }} | |
− | + | 00185a28: 0c061236 jal 0x001848d8 |{{f/jal|Attack_Evaded_Calculations|Attack_Evaded_Calculations}} If Attack is Evaded r2 = 0x01 (Hit flag is set to 0x00) | |
− | + | 00185a2c: 34060002 ori r6,r0,0x0002 |{{f/std|<nowiki>r6 = 0x02 (Right Hand Evade flag)</nowiki>}} | |
− | + | 00185a30: 14400014 bne r2,r0,0x00185a84 {{f/Cond|If Attack Hits}} /Else if Attack is Evaded, branch to {{f/loc|END}} | |
− | + | 00185a34: 00000000 nop |{{f/std|}} | |
− | + | 00185a38: 3c028019 lui r2,0x8019 |{{f/std|}} | |
− | + | 00185a3c: 8c422d98 lw r2,0x2d98(r2) |{{f/adr|<nowiki>r2 = Target Data pointer</nowiki>}} | |
− | + | 00185a40: 00000000 nop | | |
− | + | 00185a44: 9047001f lbu r7,0x001f(r2) |{{f/load|<nowiki>r7 = Target Left Hand Weapon</nowiki>}} | |
− | + | 00185a48: 00000000 nop | | |
− | + | 00185a4c: 14f10002 bne r7,r17,0x00185a58 {{f/Cond|<nowiki>If Left Hand Weapon ID = 0x0ff (don't exist)</nowiki>}} | |
− | + | 00185a50: 02002821 addu r5,r16,r0 |{{f/std|<nowiki>r5 = Current Ability Base Hit</nowiki>}} | |
− | + | 00185a54: 90470020 lbu r7,0x0020(r2) |{{f/load|<nowiki>r7 = Target Left Hand Shield</nowiki>}} | |
− | + | 00185a58: 3c048019 lui r4,0x8019 |{{f/std|}} | |
− | + | 00185a5c: 908438e0 lbu r4,0x38e0(r4) |{{f/load|<nowiki>r4 = Current Ability Left Hand Evade</nowiki>}} {{f/std| 0x801938e0}} | |
− | 00185a8c: 8fb00010 lw r16,0x0010(r29) | + | 00185a60: 0c061236 jal 0x001848d8 |{{f/jal|Attack_Evaded_Calculations|Attack_Evaded_Calculations}} If Attack is Evaded r2 = 0x01 (Hit flag is set to 0x00) |
− | 00185a90: 27bd0020 addiu r29,r29,0x0020 | + | 00185a64: 34060003 ori r6,r0,0x0003 |{{f/std|<nowiki>r6 = 0x03 (Left Hand Evade flag)</nowiki>}} |
− | 00185a94: 03e00008 jr r31 | + | 00185a68: 14400006 bne r2,r0,0x00185a84 {{f/Cond|If Attack Hits}} /Else if Attack is Evaded, branch to {{f/loc|END}} |
− | 00185a98: 00000000 nop | + | 00185a6c: 02002821 addu r5,r16,r0 |{{f/std|<nowiki>r5 = Current Ability Base Hit</nowiki>}} |
− | + | 00185a70: 3c048019 lui r4,0x8019 | | |
− | + | 00185a74: 908438e1 lbu r4,0x38e1(r4) |{{f/load|<nowiki>r4 = Current Ability Class Evade</nowiki>}} {{f/std|0x801938e1}} | |
− | == Return Locations == | + | 00185a78: 34060004 ori r6,r0,0x0004 |{{f/std|<nowiki>r6 = 0x04 (Classe Evade flag)</nowiki>}} |
− | + | 00185a7c: 0c061236 jal 0x001848d8 |{{f/jal|Attack_Evaded_Calculations|Attack_Evaded_Calculations}} If Attack is Evaded r2 = 0x01 (Hit flag is set to 0x00) | |
− | + | 00185a80: 340700ff ori r7,r0,0x00ff |{{f/std|<nowiki>r7 = 0x0ff( No Item ID)</nowiki>}} | |
− | + | 00185a84: 8fbf0018 lw r31,0x0018(r29) END | |
− | + | 00185a88: 8fb10014 lw r17,0x0014(r29) | |
+ | 00185a8c: 8fb00010 lw r16,0x0010(r29) | ||
+ | 00185a90: 27bd0020 addiu r29,r29,0x0020 | ||
+ | 00185a94: 03e00008 jr r31 | ||
+ | 00185a98: 00000000 nop | ||
+ | === Return Locations === | ||
+ | '''Battle.bin''' | ||
+ | 00188498: [[Calculate Hit %]] |
Latest revision as of 12:24, 14 April 2022
No Parameters - Returns nothing If Ability flag [Evadeable] is Off : skip the whole routine This routine Will set the value of the displayed Hit% - Forced to 0x00 if Any Current Ability Evade data is greater than base hit value - If Attack might succeed : Hit% is calculated in the central math section Last part of the routine Roll Each Evade type against Current Ability Base Hit (That's why halving base Hit = doubling all evasion type (cf Defend mechanics)) Update Target current action 0x2a (Hit%) and if Evaded then update Target current action 0x00 (Hit flag) 0x02 (Evade Type) and 0x03 (Used Item for evasion) ------------------------------------------------------------------------------------------------------------------------------------------------------------------- 00185814: 3c028019 lui r2,0x8019 | 00185818: 944238d6 lhu r2,0x38d6(r2) |r2 = Current Ability : used Ability ID 0x801938d6 0018581c: 27bdffe0 addiu r29,r29,-0x020 | 00185820: afbf0018 sw r31,0x0018(r29) | 00185824: afb10014 sw r17,0x0014(r29) | 00185828: 10400007 beq r2,r0,0x00185848 #If used Ability is not a standard Attack 0018582c: afb00010 sw r16,0x0010(r29) | 00185830: 3c028019 lui r2,0x8019 | 00185834: 904238f6 lbu r2,0x38f6(r2) |r2 = Current Ability flags 4 0x801938f6 00185838: 00000000 nop | 0018583c: 30420002 andi r2,r2,0x0002 |r2 = 0x02 if Ability is Evadable 00185840: 10400090 beq r2,r0,0x00185a84 #Branch to END if Ability is not Evadable 00185844: 00000000 nop 00185848: 3c088019 lui r8,0x8019 | 0018584c: 910838dc lbu r8,0x38dc(r8) |r8 = Current ability base Hit 0x801938dc 00185850: 3c038019 lui r3,0x8019 | 00185854: 906338de lbu r3,0x38de(r3) |r3 = Current Ability Accessory Evade 0x801938de 00185858: 310500ff andi r5,r8,0x00ff |r5 = Base Hit (byte) 0018585c: 0065102b sltu r2,r3,r5 |r2 = 0x01 if Accessory Evade < Base Hit 00185860: 10400013 beq r2,r0,0x001858b0 #If Base Hit > Accessory Evade /Else branch (Attack Evaded without maths) 00185864: 01008021 addu r16,r8,r0 |r16 = Base Hit % (Keep original value) 00185868: 3c048019 lui r4,0x8019 | 0018586c: 908438df lbu r4,0x38df(r4) |r4 = Current Ability Right Hand Evade 0x801938df 00185870: 00000000 nop | 00185874: 0085102b sltu r2,r4,r5 |r2 = 0x01 if Right Hand Evade < Base Hit 00185878: 1040000d beq r2,r0,0x001858b0 #If Base Hit > Right Hand Evade /Else branch (Attack Evaded without maths) 0018587c: 00000000 nop | 00185880: 3c068019 lui r6,0x8019 | 00185884: 90c638e0 lbu r6,0x38e0(r6) |r6 = Current Ability Left Hand Evade 0x801938e0 00185888: 00000000 nop | 0018588c: 00c5102b sltu r2,r6,r5 |r2 = 0x01 if Left Hand Evade < Base Hit 00185890: 10400007 beq r2,r0,0x001858b0 #If Base Hit > Left Hand Evade /Else branch (Attack Evaded without maths) 00185894: 00000000 nop | 00185898: 3c078019 lui r7,0x8019 | 0018589c: 90e738e1 lbu r7,0x38e1(r7) |r7 = Current Ability Class Evade 0x801938e1 001858a0: 00000000 nop | 001858a4: 00e5102b sltu r2,r7,r5 |r2 = 0x01 If Class Evade < Base Hit 001858a8: 14400009 bne r2,r0,0x001858d0 #If Class Evade > Base Hit /Else Avoid is Evaded section 001858ac: 00a31023 subu r2,r5,r3 |r2 = Base Hit - Accessory Evade 001858b0: 3c028019 lui r2,0x8019 #E #E #E | 001858b4: 8c422d90 lw r2,0x2d90(r2) |r2 = Target Current action data pointer 001858b8: 00000000 nop | 001858bc: a0400000 sb r0,0x0000(r2) |Store 0x00 in Target Current action hit flag (miss) 001858c0: 3c028019 lui r2,0x8019 | 001858c4: 8c422d90 lw r2,0x2d90(r2) |r2 = Target Current action data pointer 001858c8: 08061675 j 0x001859d4 >>jump After display section 001858cc: a440002a sh r0,0x002a(r2) |Store Target Current action Hit% = 0 #Else (Attacks might succeed) - keep going --- Display Hit% Section --- 001858d0: 00021840 sll r3,r2,0x01 |r2 = Reduced Hit *2 (Base Hit - Accessory Evade) Base Hit = 80 001858d4: 00621821 addu r3,r3,r2 |Reduced Hit *3 Acc Evade = 20 001858d8: 000318c0 sll r3,r3,0x03 |Reduced Hit * 24 001858dc: 00621821 addu r3,r3,r2 |Reduced Hit * 25 001858e0: 00031880 sll r3,r3,0x02 |r3 = Reduced Hit *100 001858e4: 0065001a div r3,r5 |(Accessory Reduced Hit *100)/Base Hit ( % of remaining Hit after Accessory Evade) 001858e8: 00001812 mflo r3 |r3 = % Of base Hit remaining 001858ec: 00a42023 subu r4,r5,r4 |r4 = Base Hit - Right Hand Evade 001858f0: 00041040 sll r2,r4,0x01 |Reduced Hit *2 001858f4: 00441021 addu r2,r2,r4 |Reduced Hit *3 001858f8: 000210c0 sll r2,r2,0x03 |Reduced Hit * 24 001858fc: 00441021 addu r2,r2,r4 |Reduced Hit * 25 00185900: 00021080 sll r2,r2,0x02 |r2 = Reduced Hit *100 00185904: 0045001a div r2,r5 |(Right Hand Reduced Hit *100)/Base Hit ( % of remaining Hit after Right Hand Evade) 00185908: 00001012 mflo r2 |r2 = Right Hand % of Remaining Base Hit 0018590c: 00000000 nop | 00185910: 00000000 nop | 00185914: 00620018 mult r3,r2 |Accessory Remaing Hit% * Right Hand Remaining Hit% 00185918: 00a61823 subu r3,r5,r6 |r3 = Base Hit - Left Hand Evade 0018591c: 00031040 sll r2,r3,0x01 |Reduced Hit *2 00185920: 00431021 addu r2,r2,r3 |Reduced Hit *3 00185924: 000210c0 sll r2,r2,0x03 |Reduced Hit * 24 00185928: 00002012 mflo r4 |r4 = Current Remaining % of Base (After Accessory and Right Hand Evade) * 100 0018592c: 00431021 addu r2,r2,r3 |Reduced Hit * 25 00185930: 00021080 sll r2,r2,0x02 |r2 = Reduced Hit *100 00185934: 0045001a div r2,r5 |(Left Hand Reduced Hit *100)/Base Hit ( % of remaining Hit after Left Hand Evade) 00185938: 00001012 mflo r2 |r2 = Left Hand % Of base Hit remaining 0018593c: 00000000 nop | 00185940: 00000000 nop | 00185944: 00820018 mult r4,r2 |Current Remaing Hit% *100 * Left Hand Remaining Hit% 00185948: 00a71823 subu r3,r5,r7 |r3 = Base Hit % - Class Evade 0018594c: 00031040 sll r2,r3,0x01 |Reduced Hit *2 00185950: 00431021 addu r2,r2,r3 |Reduced Hit *3 00185954: 000210c0 sll r2,r2,0x03 |Reduced Hit * 24 00185958: 00002012 mflo r4 |r4 = Current Remaining % of Base (After Accessory, Right Hand and Left Hand Evade) * 10000 0018595c: 00431021 addu r2,r2,r3 |Reduced Hit * 25 00185960: 00021080 sll r2,r2,0x02 |r2 = Reduced Hit *100 00185964: 0045001a div r2,r5 |(Classe Evade Reduced Hit *100)/Base Hit ( % of remaining Hit after Class Evade) 00185968: 00001012 mflo r2 |r2 = Class Evade % Of base Hit remaining 0018596c: 00000000 nop | 00185970: 00000000 nop | 00185974: 00820018 mult r4,r2 |Current Remaing Hit% * Class Evade Remaining Hit% * 1000000 00185978: 00001812 mflo r3 |r3 = Current Remaining % of Base (After Accessory, Right Hand, Left Hand and Class Evade) *1000000 0018597c: 3c02431b lui r2,0x431b | 00185980: 3442de83 ori r2,r2,0xde83 |r2 = 0x431bde83 (0,262144 * 2^32) 00185984: 00620018 mult r3,r2 |Current Remaining %of base Hit * 2^32*0,262144*1000000 00185988: 3c058019 lui r5,0x8019 | 0018598c: 8ca52d90 lw r5,0x2d90(r5) |r5 = Target Current action data pointer 00185990: 00000000 nop | 00185994: 84a4002a lh r4,0x002a(r5) |r4 = Target Current action Hit% (Set to 100 during PreFormla Set Up) 00185998: 00031fc3 sra r3,r3,0x1f |r3 = 1st bit of Current Remaining % of base hit (should be 0x00) 0018599c: 00001010 mfhi r2 |r2 = [Remaining % of Base Hit] *262144 001859a0: 00021483 sra r2,r2,0x12 |r2 = [Remaining % of Base Hit] (2^18 = 262144) 001859a4: 00431023 subu r2,r2,r3 |r2 = [Remaining % of Base Hit] -0x00 001859a8: 00440018 mult r2,r4 |[Remaining % of Base Hit] * [Base Hit] 001859ac: 00001812 mflo r3 |r3 = [Remaining % of Base Hit] * [Base Hit] 001859b0: 3c0251eb lui r2,0x51eb | 001859b4: 3442851f ori r2,r2,0x851f |r2 = 0x51eb851f * 0,32*2^32 001859b8: 00620018 mult r3,r2 |[Remaining % of Base Hit] * [Base Hit] * 0,32 * 2^32 001859bc: 00031fc3 sra r3,r3,0x1f |r3 = 1st bit of [Remaining % of Base Hit] * [Base Hit] 001859c0: 00001010 mfhi r2 |r2 = [Remaining % of Base Hit] * [Base Hit] * 32/100 001859c4: 00021143 sra r2,r2,0x05 |r2 = [Remaining % of Base Hit] * [Base Hit] /100 = Final Hit 001859c8: 00431023 subu r2,r2,r3 | 001859cc: a4a2002a sh r2,0x002a(r5) |Store Final Hit% in Target Current Action 0x2a (Hit%) 001859d0: 01008021 addu r16,r8,r0 |r16 = Original Hit % ---Roll Evasion Section --- 001859d4: 02002821 addu r5,r16,r0 |r5 = Current Ability Base Hit 001859d8: 3c028019 lui r2,0x8019 | 001859dc: 8c422d98 lw r2,0x2d98(r2) |r2 = Target Current action data pointer 001859e0: 3c048019 lui r4,0x8019 | 001859e4: 908438de lbu r4,0x38de(r4) |r4 = Accessory Evade 001859e8: 9047001c lbu r7,0x001c(r2) |r7 = Target Accessory ID 001859ec: 0c061236 jal 0x001848d8 |-->Attack_Evaded_Calculations If Attack is Evaded r2 = 0x01 (Hit flag is set to 0x00) 001859f0: 34060001 ori r6,r0,0x0001 |r6 = 0x01 (Accessory Evade Flag) 001859f4: 14400023 bne r2,r0,0x00185a84 #If Attack Hits /Else if Attack is Evaded, branch to END 001859f8: 341100ff ori r17,r0,0x00ff |r17 = 0x0ff 001859fc: 3c038019 lui r3,0x8019 | 00185a00: 8c632d98 lw r3,0x2d98(r3) |r3 = Target Data pointer 00185a04: 00000000 nop | 00185a08: 9067001d lbu r7,0x001d(r3) |r7 = Target Right Hand Weapon ID 00185a0c: 00000000 nop | 00185a10: 30e200ff andi r2,r7,0x00ff |r2 = Right Hand Weapon ID (byte) 00185a14: 14510002 bne r2,r17,0x00185a20 #If Right Hand Weapon ID = 0x0ff (don't exist) 00185a18: 02002821 addu r5,r16,r0 |r5 = Current Ability Base Hit 00185a1c: 9067001e lbu r7,0x001e(r3) |r7 = Target Right Hand Shield 00185a20: 3c048019 lui r4,0x8019 | 00185a24: 908438df lbu r4,0x38df(r4) |r4 = Current Ability Right Hand Evade 0x801938df 00185a28: 0c061236 jal 0x001848d8 |-->Attack_Evaded_Calculations If Attack is Evaded r2 = 0x01 (Hit flag is set to 0x00) 00185a2c: 34060002 ori r6,r0,0x0002 |r6 = 0x02 (Right Hand Evade flag) 00185a30: 14400014 bne r2,r0,0x00185a84 #If Attack Hits /Else if Attack is Evaded, branch to END 00185a34: 00000000 nop | 00185a38: 3c028019 lui r2,0x8019 | 00185a3c: 8c422d98 lw r2,0x2d98(r2) |r2 = Target Data pointer 00185a40: 00000000 nop | 00185a44: 9047001f lbu r7,0x001f(r2) |r7 = Target Left Hand Weapon 00185a48: 00000000 nop | 00185a4c: 14f10002 bne r7,r17,0x00185a58 #If Left Hand Weapon ID = 0x0ff (don't exist) 00185a50: 02002821 addu r5,r16,r0 |r5 = Current Ability Base Hit 00185a54: 90470020 lbu r7,0x0020(r2) |r7 = Target Left Hand Shield 00185a58: 3c048019 lui r4,0x8019 | 00185a5c: 908438e0 lbu r4,0x38e0(r4) |r4 = Current Ability Left Hand Evade 0x801938e0 00185a60: 0c061236 jal 0x001848d8 |-->Attack_Evaded_Calculations If Attack is Evaded r2 = 0x01 (Hit flag is set to 0x00) 00185a64: 34060003 ori r6,r0,0x0003 |r6 = 0x03 (Left Hand Evade flag) 00185a68: 14400006 bne r2,r0,0x00185a84 #If Attack Hits /Else if Attack is Evaded, branch to END 00185a6c: 02002821 addu r5,r16,r0 |r5 = Current Ability Base Hit 00185a70: 3c048019 lui r4,0x8019 | 00185a74: 908438e1 lbu r4,0x38e1(r4) |r4 = Current Ability Class Evade 0x801938e1 00185a78: 34060004 ori r6,r0,0x0004 |r6 = 0x04 (Classe Evade flag) 00185a7c: 0c061236 jal 0x001848d8 |-->Attack_Evaded_Calculations If Attack is Evaded r2 = 0x01 (Hit flag is set to 0x00) 00185a80: 340700ff ori r7,r0,0x00ff |r7 = 0x0ff( No Item ID) 00185a84: 8fbf0018 lw r31,0x0018(r29) END 00185a88: 8fb10014 lw r17,0x0014(r29) 00185a8c: 8fb00010 lw r16,0x0010(r29) 00185a90: 27bd0020 addiu r29,r29,0x0020 00185a94: 03e00008 jr r31 00185a98: 00000000 nop
Return Locations
Battle.bin 00188498: Calculate Hit %