Difference between revisions of "Critical Hit Calculation"
Jump to navigation
Jump to search
Line 3: | Line 3: | ||
001864fc: afbf0018 sw r31,0x0018(r29) | 001864fc: afbf0018 sw r31,0x0018(r29) | ||
00186500: 34040064 ori r4,r0,0x0064 r4 = 100 (creates random number from 0-99) | 00186500: 34040064 ori r4,r0,0x0064 r4 = 100 (creates random number from 0-99) | ||
− | 00186504: 0c063bb6 jal 0x0018eed8 Random Process (returns r2 = 0 or 1) | + | 00186504: 0c063bb6 jal 0x0018eed8 [[Random Process]] (returns r2 = 0 or 1) |
− | 00186508: 34050004 ori r5,r0,0x0004 r5 = 4 (critical hit chance of 4%) | + | 00186508: 34050004 ori r5,r0,0x0004 r5 = 4 (critical hit chance of 4/64, or 6.25%) |
0018650c: 14400012 bne r2,r0,0x00186558 Branch if Critical did not occur | 0018650c: 14400012 bne r2,r0,0x00186558 Branch if Critical did not occur | ||
00186510: 34030001 ori r3,r0,0x0001 r3 = 1 | 00186510: 34030001 ori r3,r0,0x0001 r3 = 1 | ||
00186514: 3c028019 lui r2,0x8019 | 00186514: 3c028019 lui r2,0x8019 | ||
00186518: 8c422d90 lw r2,0x2d90(r2) Load Current Action Data Pointer | 00186518: 8c422d90 lw r2,0x2d90(r2) Load Current Action Data Pointer | ||
− | 0018651c: 0c063ba8 jal 0x0018eea0 Random Process | + | 0018651c: 0c063ba8 jal 0x0018eea0 [[Random Process, gives a number between 0-7fff]] |
00186520: a0430001 sb r3,0x0001(r2) Store Critical Hit Flag | 00186520: a0430001 sb r3,0x0001(r2) Store Critical Hit Flag | ||
00186524: 3c048019 lui r4,0x8019 | 00186524: 3c048019 lui r4,0x8019 | ||
Line 22: | Line 22: | ||
00186548: 000213c3 sra r2,r2,0x0f XA * Random / 8000h | 00186548: 000213c3 sra r2,r2,0x0f XA * Random / 8000h | ||
0018654c: 00621021 addu r2,r3,r2 XA + XA * Random / 8000h (XA + Rand(0..(XA - 1))) | 0018654c: 00621021 addu r2,r3,r2 XA + XA * Random / 8000h (XA + Rand(0..(XA - 1))) | ||
− | 00186550: 0c0610fb jal 0x001843ec Knockback Calculation | + | 00186550: 0c0610fb jal 0x001843ec [[Knockback Calculation]] |
00186554: a4820000 sh r2,0x0000(r4) Store new XA | 00186554: a4820000 sh r2,0x0000(r4) Store new XA | ||
00186558: 8fbf0018 lw r31,0x0018(r29) | 00186558: 8fbf0018 lw r31,0x0018(r29) |
Revision as of 04:02, 27 May 2016
Critical Hit Calculation: 001864f8: 27bdffe0 addiu r29,r29,0xffe0 001864fc: afbf0018 sw r31,0x0018(r29) 00186500: 34040064 ori r4,r0,0x0064 r4 = 100 (creates random number from 0-99) 00186504: 0c063bb6 jal 0x0018eed8 Random Process (returns r2 = 0 or 1) 00186508: 34050004 ori r5,r0,0x0004 r5 = 4 (critical hit chance of 4/64, or 6.25%) 0018650c: 14400012 bne r2,r0,0x00186558 Branch if Critical did not occur 00186510: 34030001 ori r3,r0,0x0001 r3 = 1 00186514: 3c028019 lui r2,0x8019 00186518: 8c422d90 lw r2,0x2d90(r2) Load Current Action Data Pointer 0018651c: 0c063ba8 jal 0x0018eea0 Random Process, gives a number between 0-7fff 00186520: a0430001 sb r3,0x0001(r2) Store Critical Hit Flag 00186524: 3c048019 lui r4,0x8019 00186528: 248438ce addiu r4,r4,0x38ce 0018652c: 84830000 lh r3,0x0000(r4) Load XA 00186530: 00000000 nop 00186534: 00430018 mult r2,r3 XA * Random 00186538: 00001012 mflo r2 r2 = XA * Random 0018653c: 04410002 bgez r2,0x00186548 Branch if Random is >= 0 00186540: 00000000 nop 00186544: 24427fff addiu r2,r2,0x7fff XA * Random + 7FFF 00186548: 000213c3 sra r2,r2,0x0f XA * Random / 8000h 0018654c: 00621021 addu r2,r3,r2 XA + XA * Random / 8000h (XA + Rand(0..(XA - 1))) 00186550: 0c0610fb jal 0x001843ec Knockback Calculation 00186554: a4820000 sh r2,0x0000(r4) Store new XA 00186558: 8fbf0018 lw r31,0x0018(r29) 0018655c: 27bd0020 addiu r29,r29,0x0020 00186560: 03e00008 jr r31 00186564: 00000000 nop
Return Locations
- Battle.bin
001886b4: Weapon Damage Calculation 00189d08: 31 Dmg_((PA+Y)/2*PA) 00189da4: 32 Dmg_(Rdm(1…X)*(PA*3+Y))