Difference between revisions of "Faith Calculation"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Added some notes for ??? lines)
Line 55: Line 55:
 
  00187224: 3c0268db lui r2,0x68db R2 = 68db0000
 
  00187224: 3c0268db lui r2,0x68db R2 = 68db0000
 
  00187228: 34428bad ori r2,r2,0x8bad R2 = 68db8bad
 
  00187228: 34428bad ori r2,r2,0x8bad R2 = 68db8bad
  0018722c: 00620018 mult r3,r2 HP Damage * Defender's Faith * Attacker's Faith * 68db8bad (or /10000)
+
  0018722c: 00620018 mult r3,r2 HP Damage * Defender's Faith * Attacker's Faith * 68db8bad <del>(or /10000)</del> (Glain: 68db8bad = 4096/10000)
 
  00187230: 00031fc3 sra r3,r3,0x1f ???
 
  00187230: 00031fc3 sra r3,r3,0x1f ???
 
  00187234: 00001010 mfhi r2 Move Hi to R2
 
  00187234: 00001010 mfhi r2 Move Hi to R2
  00187238: 00021303 sra r2,r2,0x0c ???
+
  00187238: 00021303 sra r2,r2,0x0c <del>???</del> (Glain: Divide by 4096), so overall: Damage * Def Faith * Att Faith * (4096/10000) / 4096 = (Damage * Def Faith * Att Faith) / 10000
 
  0018723c: 00431023 subu r2,r2,r3 ???
 
  0018723c: 00431023 subu r2,r2,r3 ???
 
  00187240: 03e00008 jr r31
 
  00187240: 03e00008 jr r31

Revision as of 04:27, 1 June 2013

Faith Calculation:
00187150: 3c028019 lui r2,0x8019		
00187154: 8c422d94 lw r2,0x2d94(r2)		Load Attacker's Status
00187158: 00000000 nop				
0018715c: 9042005c lbu r2,0x005c(r2)		Load Attacker's 5th set of Status
00187160: 00000000 nop				
00187164: 30420080 andi r2,r2,0x0080		
00187168: 10400003 beq r2,r0,0x00187178		Branch if Attacker doesn't have  Faith Status
0018716c: 34020064 ori r2,r0,0x0064		r2 = 100
00187170: 3c018019 lui r1,0x8019		
00187174: a02238d3 sb r2,0x38d3(r1)		Store Faith as 100
00187178: 3c028019 lui r2,0x8019		
0018717c: 8c422d94 lw r2,0x2d94(r2)		Load Attacker's Stats
00187180: 00000000 nop				
00187184: 9042005c lbu r2,0x005c(r2)		Load Attacker's 5th set of Status
00187188: 00000000 nop
0018718c: 30420040 andi r2,r2,0x0040			
00187190: 10400003 beq r2,r0,0x001871a0		Branch if Attacker doesn't have   Innocent
00187194: 00000000 nop				
00187198: 3c018019 lui r1,0x8019		
0018719c: a02038d3 sb r0,0x38d3(r1)		Store Attacker's Faith as 0
001871a0: 3c028019 lui r2,0x8019		
001871a4: 8c422d98 lw r2,0x2d98(r2)		Load Defender's Stats
001871a8: 00000000 nop				
001871ac: 9042005c lbu r2,0x005c(r2)		Load Defender's 5th set of Status
001871b0: 00000000 nop				
001871b4: 30420080 andi r2,r2,0x0080		
001871b8: 10400003 beq r2,r0,0x001871c8		Branch if Defender doesn't have  Faith
001871bc: 34020064 ori r2,r0,0x0064		R2 = 100
001871c0: 3c018019 lui r1,0x8019		
001871c4: a02238d2 sb r2,0x38d2(r1)		Store Defender's Faith as 100
001871c8: 3c028019 lui r2,0x8019		
001871cc: 8c422d98 lw r2,0x2d98(r2)		Load Defender's Stats
001871d0: 00000000 nop				
001871d4: 9042005c lbu r2,0x005c(r2)		Load Defender's 5th set of Status
001871d8: 00000000 nop				
001871dc: 30420040 andi r2,r2,0x0040		
001871e0: 10400003 beq r2,r0,0x001871f0		Branch if Defender doesn't have  Innocent
001871e4: 00000000 nop				
001871e8: 3c018019 lui r1,0x8019		
001871ec: a02038d2 sb r0,0x38d2(r1)		Store Defender's Faith as 0
001871f0: 3c048019 lui r4,0x8019		
001871f4: 8c842d90 lw r4,0x2d90(r4)		Current Action Data Pointer
001871f8: 3c028019 lui r2,0x8019		
001871fc: 904238d2 lbu r2,0x38d2(r2)		Load Defender's Faith
00187200: 84830004 lh r3,0x0004(r4)		Load HP Damage (Reverse Undead comes after this to change it to Healing)
00187204: 00000000 nop				
00187208: 00620018 mult r3,r2			HP Damage * Defender's Faith
0018720c: 00001812 mflo r3			Move to R3
00187210: 3c028019 lui r2,0x8019		
00187214: 904238d3 lbu r2,0x38d3(r2)		Load Attacker's Faith
00187218: 00000000 nop				
0018721c: 00620018 mult r3,r2			HP Damage * Defender's Faith * Attacker's Faith
00187220: 00001812 mflo r3			Move to R3
00187224: 3c0268db lui r2,0x68db		R2 = 68db0000
00187228: 34428bad ori r2,r2,0x8bad		R2 = 68db8bad
0018722c: 00620018 mult r3,r2			HP Damage * Defender's Faith * Attacker's Faith * 68db8bad (or /10000) (Glain: 68db8bad = 4096/10000)
00187230: 00031fc3 sra r3,r3,0x1f		???
00187234: 00001010 mfhi r2			Move Hi to R2
00187238: 00021303 sra r2,r2,0x0c		??? (Glain: Divide by 4096), so overall: Damage * Def Faith * Att Faith * (4096/10000) / 4096 = (Damage * Def Faith * Att Faith) / 10000
0018723c: 00431023 subu r2,r2,r3		???
00187240: 03e00008 jr r31			
00187244: a4820004 sh r2,0x0004(r4)		Store new HP Damage


Return Locations

  • Battle.bin
00188820: MA + X
001889ec: Calculate Accuracy for Magical Spells 
00188a4c: Calculate Accuracy for Magical
00188c7c: 04 Magic Gun
00188dc4: 08 Dmg_F(MA*Y)
00188f18: 0C Heal_F(MA*Y)
00189028: 0E Dmg_(Y)% Hit_F(MA+X)% 100% Status Hide Status
001892e4: 1A Hit_F(MA+Y)% // -PA/MA/SP_(X)