Difference between revisions of "Calculate Final Hit %"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
Line 5: Line 5:
 
  00185820: afbf0018 sw r31,0x0018(r29)
 
  00185820: afbf0018 sw r31,0x0018(r29)
 
  00185824: afb10014 sw r17,0x0014(r29)
 
  00185824: afb10014 sw r17,0x0014(r29)
  00185828: 10400007 beq r2,r0,0x00185848 Branch if Not Attack?
+
  00185828: 10400007 beq r2,r0,0x00185848 Branch if Attack
 
  0018582c: afb00010 sw r16,0x0010(r29)
 
  0018582c: afb00010 sw r16,0x0010(r29)
 
  00185830: 3c028019 lui r2,0x8019
 
  00185830: 3c028019 lui r2,0x8019

Revision as of 12:21, 2 April 2013

Calculate Final Hit %
00185814: 3c028019 lui r2,0x8019
00185818: 944238d6 lhu r2,0x38d6(r2)		Load Used Ability ID
0018581c: 27bdffe0 addiu r29,r29,0xffe0
00185820: afbf0018 sw r31,0x0018(r29)
00185824: afb10014 sw r17,0x0014(r29)
00185828: 10400007 beq r2,r0,0x00185848		Branch if Attack
0018582c: afb00010 sw r16,0x0010(r29)
00185830: 3c028019 lui r2,0x8019
00185834: 904238f6 lbu r2,0x38f6(r2)		Load 4th set of Ability Flags
00185838: 00000000 nop
0018583c: 30420002 andi r2,r2,0x0002
00185840: 10400090 beq r2,r0,0x00185a84		Branch if Not Evadeable
00185844: 00000000 nop
00185848: 3c088019 lui r8,0x8019
0018584c: 910838dc lbu r8,0x38dc(r8)		Load Hit %
00185850: 3c038019 lui r3,0x8019
00185854: 906338de lbu r3,0x38de(r3)		Load Accessory Evade
00185858: 310500ff andi r5,r8,0x00ff
0018585c: 0065102b sltu r2,r3,r5
00185860: 10400013 beq r2,r0,0x001858b0		Branch if Accessory Evade >= Hit %
00185864: 01008021 addu r16,r8,r0
00185868: 3c048019 lui r4,0x8019
0018586c: 908438df lbu r4,0x38df(r4)		Load RH Evade
00185870: 00000000 nop
00185874: 0085102b sltu r2,r4,r5
00185878: 1040000d beq r2,r0,0x001858b0		Branch if RH Evade >= Hit %
0018587c: 00000000 nop
00185880: 3c068019 lui r6,0x8019
00185884: 90c638e0 lbu r6,0x38e0(r6)		Load LH Evade
00185888: 00000000 nop
0018588c: 00c5102b sltu r2,r6,r5
00185890: 10400007 beq r2,r0,0x001858b0		Branch if LH Evade >= Hit %
00185894: 00000000 nop
00185898: 3c078019 lui r7,0x8019
0018589c: 90e738e1 lbu r7,0x38e1(r7)		Load Class Evade
001858a0: 00000000 nop
001858a4: 00e5102b sltu r2,r7,r5
001858a8: 14400009 bne r2,r0,0x001858d0		Branch if Class Evade < Hit %
001858ac: 00a31023 subu r2,r5,r3		Base Hit - Accessory Evade
001858b0: 3c028019 lui r2,0x8019
001858b4: 8c422d90 lw r2,0x2d90(r2)		Load Current Action Data Pointer
001858b8: 00000000 nop
001858bc: a0400000 sb r0,0x0000(r2)		Attack Evaded
001858c0: 3c028019 lui r2,0x8019
001858c4: 8c422d90 lw r2,0x2d90(r2)		Load Current Action Data Pointer
001858c8: 08061675 j 0x001859d4
001858cc: a440002a sh r0,0x002a(r2)		Store Hit % = 0
001858d0: 00021840 sll r3,r2,0x01		Hit * 2
001858d4: 00621821 addu r3,r3,r2		Hit * 3
001858d8: 000318c0 sll r3,r3,0x03		Hit * 24
001858dc: 00621821 addu r3,r3,r2		Hit * 25
001858e0: 00031880 sll r3,r3,0x02		Hit * 100
001858e4: 0065001a div r3,r5			Modified Hit % / Original Hit %
001858e8: 00001812 mflo r3			Accessory Hit %
001858ec: 00a42023 subu r4,r5,r4		Original Hit % - RH Evade
001858f0: 00041040 sll r2,r4,0x01		Hit * 2
001858f4: 00441021 addu r2,r2,r4		Hit * 3
001858f8: 000210c0 sll r2,r2,0x03		Hit * 24
001858fc: 00441021 addu r2,r2,r4		Hit * 25
00185900: 00021080 sll r2,r2,0x02		Hit * 100
00185904: 0045001a div r2,r5			Modified Hit % / Original Hit %
00185908: 00001012 mflo r2			RH Hit %
0018590c: 00000000 nop
00185910: 00000000 nop
00185914: 00620018 mult r3,r2			Accessory Hit % * RH Hit %
00185918: 00a61823 subu r3,r5,r6		Original Hit - LH Evade
0018591c: 00031040 sll r2,r3,0x01		Hit * 2
00185920: 00431021 addu r2,r2,r3		Hit * 3
00185924: 000210c0 sll r2,r2,0x03		Hit * 24
00185928: 00002012 mflo r4			r4 = New Hit %
0018592c: 00431021 addu r2,r2,r3		Hit * 25
00185930: 00021080 sll r2,r2,0x02		Hit * 100
00185934: 0045001a div r2,r5			Modified Hit % / Original Hit %
00185938: 00001012 mflo r2			LH Hit %
0018593c: 00000000 nop
00185940: 00000000 nop
00185944: 00820018 mult r4,r2			New Hit % * LH Hit %
00185948: 00a71823 subu r3,r5,r7		Original Hit % - Class Evade
0018594c: 00031040 sll r2,r3,0x01		Hit * 2
00185950: 00431021 addu r2,r2,r3		Hit * 3
00185954: 000210c0 sll r2,r2,0x03		Hit * 24
00185958: 00002012 mflo r4			r4 = Newer Hit %
0018595c: 00431021 addu r2,r2,r3		Hit * 25
00185960: 00021080 sll r2,r2,0x02		Hit * 100
00185964: 0045001a div r2,r5			Modified Hit % / Original Hit %
00185968: 00001012 mflo r2			Class Hit %
0018596c: 00000000 nop
00185970: 00000000 nop
00185974: 00820018 mult r4,r2			Newer Hit % * Class Hit %
00185978: 00001812 mflo r3			r3 = Almost Final Hit %
0018597c: 3c02431b lui r2,0x431b
00185980: 3442de83 ori r2,r2,0xde83
00185984: 00620018 mult r3,r2			Almost Final Hit % * .262144
00185988: 3c058019 lui r5,0x8019
0018598c: 8ca52d90 lw r5,0x2d90(r5)		Load Current Action Data Pointer
00185990: 00000000 nop
00185994: 84a4002a lh r4,0x002a(r5)		Load Original Hit %
00185998: 00031fc3 sra r3,r3,0x1f
0018599c: 00001010 mfhi r2			r2 = Hit(1)%
001859a0: 00021483 sra r2,r2,0x12		Hit(1) % / 262144 (Hit % /  100000000)
001859a4: 00431023 subu r2,r2,r3
001859a8: 00440018 mult r2,r4			Hit(1) % * Origina Hit %
001859ac: 00001812 mflo r3			r3 = Hit(2)%
001859b0: 3c0251eb lui r2,0x51eb
001859b4: 3442851f ori r2,r2,0x851f
001859b8: 00620018 mult r3,r2			Hit(2) % * 0.32
001859bc: 00031fc3 sra r3,r3,0x1f
001859c0: 00001010 mfhi r2			r2 = Final Hit%
001859c4: 00021143 sra r2,r2,0x05		Final Hit % / 32 (Final Hit % =  Hit(2) % / 100)
001859c8: 00431023 subu r2,r2,r3
001859cc: a4a2002a sh r2,0x002a(r5)		Store Final Hit%
001859d0: 01008021 addu r16,r8,r0		r16 = Original Hit %
001859d4: 02002821 addu r5,r16,r0		r5 = Original Hit %
001859d8: 3c028019 lui r2,0x8019
001859dc: 8c422d98 lw r2,0x2d98(r2)		Load Target Data Pointer
001859e0: 3c048019 lui r4,0x8019
001859e4: 908438de lbu r4,0x38de(r4)		Load Accessory Evade
001859e8: 9047001c lbu r7,0x001c(r2)		Load Target's Accessory ID
001859ec: 0c061236 jal 0x001848d8		Attack Evaded Calculation
001859f0: 34060001 ori r6,r0,0x0001		Type = Accessory?
001859f4: 14400023 bne r2,r0,0x00185a84		Branch if Attack was evaded
001859f8: 341100ff ori r17,r0,0x00ff		r17 = 255
001859fc: 3c038019 lui r3,0x8019
00185a00: 8c632d98 lw r3,0x2d98(r3)		Load Target Data Pointer
00185a04: 00000000 nop
00185a08: 9067001d lbu r7,0x001d(r3)		Load Target's RH Weapon ID
00185a0c: 00000000 nop
00185a10: 30e200ff andi r2,r7,0x00ff
00185a14: 14510002 bne r2,r17,0x00185a20	Branch if RH has a weapon
00185a18: 02002821 addu r5,r16,r0		r5 = Original Hit %
00185a1c: 9067001e lbu r7,0x001e(r3)		Load Target's RH Shield ID
00185a20: 3c048019 lui r4,0x8019
00185a24: 908438df lbu r4,0x38df(r4)		Load RH Evade
00185a28: 0c061236 jal 0x001848d8		Attack Evaded Calculation
00185a2c: 34060002 ori r6,r0,0x0002		Type = RH Equip?
00185a30: 14400014 bne r2,r0,0x00185a84		Branch if Attack was evaded
00185a34: 00000000 nop
00185a38: 3c028019 lui r2,0x8019
00185a3c: 8c422d98 lw r2,0x2d98(r2)		Load Target Data Pointer
00185a40: 00000000 nop
00185a44: 9047001f lbu r7,0x001f(r2)		Load Target's LH Weapon ID
00185a48: 00000000 nop
00185a4c: 14f10002 bne r7,r17,0x00185a58	Branch if LH has a weapon
00185a50: 02002821 addu r5,r16,r0		r5 = Original Hit %
00185a54: 90470020 lbu r7,0x0020(r2)		Load Target's LH Shield
00185a58: 3c048019 lui r4,0x8019
00185a5c: 908438e0 lbu r4,0x38e0(r4)		Load LH Evade
00185a60: 0c061236 jal 0x001848d8		Attack Evaded Calculation
00185a64: 34060003 ori r6,r0,0x0003		Type = LH Equip?
00185a68: 14400006 bne r2,r0,0x00185a84		Branch if Attack was evaded
00185a6c: 02002821 addu r5,r16,r0		r5 = Original Hit %
00185a70: 3c048019 lui r4,0x8019
00185a74: 908438e1 lbu r4,0x38e1(r4)		Load Class Evade
00185a78: 34060004 ori r6,r0,0x0004		Type = Class Evade
00185a7c: 0c061236 jal 0x001848d8		Attack Evaded Calculation
00185a80: 340700ff ori r7,r0,0x00ff		r7 = 255 (no equipment possible here)
00185a84: 8fbf0018 lw r31,0x0018(r29)
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
00188490: Calculate Hit %