Difference between revisions of "Critical Hit Calculation"
Jump to navigation
Jump to search
m |
m |
||
Line 25: | Line 25: | ||
00186540: 00000000 nop | | 00186540: 00000000 nop | | ||
00186544: 24427fff addiu r2,r2,0x7fff |{{f/std|<nowiki>r2 = Positive Random * XA</nowiki>}} | 00186544: 24427fff addiu r2,r2,0x7fff |{{f/std|<nowiki>r2 = Positive Random * XA</nowiki>}} | ||
− | 00186548: 000213c3 sra r2,r2,0x0f |{{f/std|<nowiki>r2 = Random Between 0x00 and XA</nowiki>}} {{f/std| XA * Random / Maximum possible random (0x8000)}} | + | 00186548: 000213c3 sra r2,r2,0x0f |{{f/std|<nowiki>r2 = Random Between 0x00 and XA</nowiki>}} {{f/std| (XA * Random / Maximum possible random (0x8000))}} |
0018654c: 00621021 addu r2,r3,r2 |{{f/std|XA + Random (from 0x00 to XA)}} | 0018654c: 00621021 addu r2,r3,r2 |{{f/std|XA + Random (from 0x00 to XA)}} | ||
00186550: 0c0610fb jal 0x001843ec |{{f/jal|Knockback Calculation|Knockback Calculation}} Check Knockback usability - Set some flags if ok | 00186550: 0c0610fb jal 0x001843ec |{{f/jal|Knockback Calculation|Knockback Calculation}} Check Knockback usability - Set some flags if ok |
Latest revision as of 12:05, 3 April 2022
No Parameters - Returns nothing Roll critical Hit (4%) - If Successful : Increase XA (to a random from 100% to 200% of initial value) - Knock Target back if possible -------------------------------------------------------------------------------------- 001864f8: 27bdffe0 addiu r29,r29,-0x0020 | 001864fc: afbf0018 sw r31,0x0018(r29) | 00186500: 34040064 ori r4,r0,0x0064 |r4 = 0x64 (100) 00186504: 0c063bb6 jal 0x0018eed8 |-->Random Process Return r2 = 0x00 if Critical Hit 00186508: 34050004 ori r5,r0,0x0004 |r5 = 0x04 0018650c: 14400012 bne r2,r0,0x00186558 #If Critical Hit 00186510: 34030001 ori r3,r0,0x0001 |r3 = 0x01 r3 = 1 00186514: 3c028019 lui r2,0x8019 | 00186518: 8c422d90 lw r2,0x2d90(r2) |r2 = Target Current Action Data Pointer 0018651c: 0c063ba8 jal 0x0018eea0 |-->Random Process, gives a number between 0-7fff r2 = Value between 0x00 and 0x7fff 00186520: a0430001 sb r3,0x0001(r2) |Store Critical Hit Flag (TCA 0x01) 00186524: 3c048019 lui r4,0x8019 | 00186528: 248438ce addiu r4,r4,0x38ce |r4 = Ability XA pointer 0x80198ce / 801938ce 0018652c: 84830000 lh r3,0x0000(r4) |r3 = Ability XA 00186530: 00000000 nop | 00186534: 00430018 mult r2,r3 |XA * Random 00186538: 00001012 mflo r2 |r2 = XA * Random 0018653c: 04410002 bgez r2,0x00186548 #If Random*XA < 0x00 00186540: 00000000 nop | 00186544: 24427fff addiu r2,r2,0x7fff |r2 = Positive Random * XA 00186548: 000213c3 sra r2,r2,0x0f |r2 = Random Between 0x00 and XA (XA * Random / Maximum possible random (0x8000)) 0018654c: 00621021 addu r2,r3,r2 |XA + Random (from 0x00 to XA) 00186550: 0c0610fb jal 0x001843ec |-->Knockback Calculation Check Knockback usability - Set some flags if ok 00186554: a4820000 sh r2,0x0000(r4) |Store new XA (100% to 200% of Initial XA) 00186558: 8fbf0018 lw r31,0x0018(r29) END 0018655c: 27bd0020 addiu r29,r29,0x0020 00186560: 03e00008 jr r31 00186564: 00000000 nop
Return location
Battle.bin 001886bc: Damage_Calculation 00189d10: 31 Dmg_((PA+Y)/2*PA) 00189dac: 32 Dmg_(Rdm(1…X)*(PA*3+Y))