32 Dmg (Rdm(1…X)*(PA*3+Y)/2)

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
[32]
00189d74: 27bdffe8 addiu r29,r29,-0x0018    |
00189d78: afbf0010 sw r31,0x0010(r29)       |
00189d7c: 0c062144 jal 0x00188510           |-->Physical Evade Calculation If Abillity is evadeable roll Ability Evade byte against Ability base Hit - Returns r2
00189d80: 00000000 nop                      |
00189d84: 14400024 bne r2,r0,0x00189e18     #If Attack is not evaded
00189d88: 00000000 nop                          |
00189d8c: 0c061740 jal 0x00185d00               |-->Store PA and PA + Y / 2 Set XA = Attacker's PA and YA = (Attacker's PA + Ability Y)/2
00189d90: 00000000 nop                          |
00189d94: 0c061853 jal 0x0018614c               |-->Formula 32, 33, 34, 35 Attack Up and Martial Arts Increase XA if Attacker uses Attack Up or Martial art with elligible weapon
00189d98: 00000000 nop                          |
00189d9c: 0c0622b7 jal 0x00188adc               |-->Cluster of Physical Routines Modify XA (Attacker status, Target Status/Support, Compatibility)
00189da0: 00000000 nop                          |
00189da4: 0c06193e jal 0x001864f8               |-->Critical Hit Calculation If Critical Hit : Increase XA (+0% to +100%) Add Knockback (if possible)
00189da8: 00000000 nop                          |
00189dac: 0c061967 jal 0x0018659c               |-->XA + YA XA+YA becomes TCA HP damage (YA is processed via compatibility)
00189db0: 00000000 nop                          |
00189db4: 0c063ba8 jal 0x0018eea0               |-->Random Process, gives a number between 0-7fff Returns r2 between 0x00 and 0x7fff
00189db8: 00000000 nop                          |
00189dbc: 3c038019 lui r3,0x8019                |
00189dc0: 906338f9 lbu r3,0x38f9(r3)            |r3 = Current Ability used Ability X
00189dc4: 00000000 nop                          |
00189dc8: 00430018 mult r2,r3                   |Random * X
00189dcc: 3c058019 lui r5,0x8019                |
00189dd0: 24a538ea addiu r5,r5,0x38ea           |r5 = 0x801938ea pointer (Current Ability ?)       801938ea
00189dd4: 00001012 mflo r2                      |r2 = Random * X
00189dd8: 04410002 bgez r2,0x00189de4           #If Random * X < 0
00189ddc: 00000000 nop                              |
00189de0: 24427fff addiu r2,r2,0x7fff               |r2 = positive random * X
00189de4: 000213c3 sra r2,r2,0xf                |r2 = Random between 0 and X-1  (X * random / [max possible random +1])
00189de8: 3c048019 lui r4,0x8019                |
00189dec: 8c842d90 lw r4,0x2d90(r4)             |r4 = Target Current Action (TCA) data pointer
00189df0: 24420001 addiu r2,r2,0x0001           |r2 = Random between 1 and X
00189df4: a0a20000 sb r2,0x0000(r5)             |Store Random Dmg factor at 0x801938ea
00189df8: 90a20000 lbu r2,0x0000(r5)            |r2 = Random between 1 and X
00189dfc: 84830004 lh r3,0x0004(r4)             |r3 = TCA HP damage (XA+YA)
00189e00: 00000000 nop                          |
00189e04: 00620018 mult r3,r2                   |(XA + YA) * Random (1 to X)
00189e08: 34020080 ori r2,r0,0x0080             |r2 = 0x80
00189e0c: a0820025 sb r2,0x0025(r4)             |Set TCA Attack type to HP damage (disables other flags)
00189e10: 00001012 mflo r2                      |r2 = Damage = {1...X} * [PA + (PA + Y) / 2]
00189e14: a4820004 sh r2,0x0004(r4)             |Store Randomized damage
00189e18: 8fbf0010 lw r31,0x0010(r29)       END
00189e1c: 27bd0018 addiu r29,r29,0x0018
00189e20: 03e00008 jr r31
00189e24: 00000000 nop

Return location

Battle.bin
0018b97c - Pre Formula Setup