1F Dmg ((100-CasF)*(100-TarF)*(MA+Y)*MA/2)

From Final Fantasy Hacktics Wiki
Revision as of 19:31, 18 April 2022 by Orkney (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Hard coded mechanics : This formula is a multi Hit formula. Number of hits = random  from 1 to Ability X   (See here : line 0017d5e0)

This formula contains an "Anti-Faith" alteration of damage, but faith maximize the outcome and innocent nullify it (as for regular faith influenced magic)
----------------------------------------------------------------------------------------------------------------------------------------------------------------
00189464: 27bdffe8 addiu r29,r29,0xffe8     |
00189468: afbf0010 sw r31,0x0010(r29)       |
0018946c: 0c06216e jal 0x001885b8           |-->Magic Evasion If Abillity is evadeable roll Ability Evade byte against Ability base Hit
00189470: 00000000 nop                      |
00189474: 1440004f bne r2,r0,0x001895b4     #If not evaded /Branch to end 
00189478: 00000000 nop                           |
0018947c: 0c061730 jal 0x00185cc0                |-->Base XA and YA for MA + Y / 2 Set XA =MA  and YA = (MA+Y)/2
00189480: 00000000 nop                           |
00189484: 0c0617ff jal 0x00185ffc                |-->Elemental_Strengthen  XA + 25% if used Ability Element is strengthened
00189488: 00000000 nop                           |
0018948c: 0c0621d1 jal 0x188744                  |-->Magical Support/Status/Compat Modify Ability XA (Support Abilities, Status, Compatibility)
00189490: 00000000 nop                           |
00189494: 0c0621df jal 0x0018877c                |-->Elemental XA*YA Turns XA * YA in HP damage / Modify Damage based on Elements / Returns r2 = 0x00 if Attack hits
00189498: 00000000 nop                           |
0018949c: 14400045 bne r2,r0,0x001895b4          #If not nullified /Else branch to end (r2 = 1 si hit = 0 from Elemental XA*YA)
001894a0: 00000000 nop                               |
001894a4: 3c028019 lui r2,0x8019                     |
001894a8: 8c422d94 lw r2,0x2d94(r2)                  |r2 = attacker data pointer
001894ac: 00000000 nop                               |
001894b0: 9042005c lbu r2,0x005c(r2)                 |r2 = 5th set of attacker current statuses
001894b4: 00000000 nop                               |
001894b8: 30420080 andi r2,r2,0x0080                 |r2 = 0x80 if attacker has faith/Else 0x00
001894bc: 10400003 beq r2,r0,0x001894cc              #If Attacker has faith 
001894c0: 00000000 nop                                   |
001894c4: 3c018019 lui r1,0x8019                         |
001894c8: a02038d3 sb r0,0x38d3(r1)                      |Set attacker effective faith to 0
001894cc: 3c028019 lui r2,0x8019                         |
001894d0: 8c422d94 lw r2,0x2d94(r2)                  |r2 =  attacker data pointer
001894d4: 00000000 nop                               |
001894d8: 9042005c lbu r2,0x005c(r2)                 |r2 =  5th set of attacker current statuses
001894dc: 00000000 nop                               |
001894e0: 30420040 andi r2,r2,0x0040                 |r2 = 0x40 if attacker has innocent
001894e4: 10400003 beq r2,r0,0x001894f4              #If attacker has innoncent
001894e8: 34020064 ori r2,r0,0x0064                      |r2 = 100
001894ec: 3c018019 lui r1,0x8019                         |
001894f0: a02238d3 sb r2,0x38d3(r1)                      |Set attacker effective faith to 100
001894f4: 3c028019 lui r2,0x8019                         |
001894f8: 8c422d98 lw r2,0x2d98(r2)                  |r2 =  target data pointer
001894fc: 00000000 nop                               |
00189500: 9042005c lbu r2,0x005c(r2)                 |r2 =  target 5th set of current statuses
00189504: 00000000 nop                               |
00189508: 30420080 andi r2,r2,0x0080                 |r2 = 0x80 if target has faith
0018950c: 10400003 beq r2,r0,0x0018951c              #If target has faith
00189510: 00000000 nop                                   |
00189514: 3c018019 lui r1,0x8019                         |
00189518: a02038d2 sb r0,0x38d2(r1)                      |Store target effective faith = 0
0018951c: 3c028019 lui r2,0x8019                         |
00189520: 8c422d98 lw r2,0x2d98(r2)                  |r2 = target data pointer
00189524: 00000000 nop                               |
00189528: 9042005c lbu r2,0x005c(r2)                 |r2 = target 5th set of current statuses
0018952c: 00000000 nop                               |
00189530: 30420040 andi r2,r2,0x0040                 |r2 = 0x40 if target has innocent
00189534: 10400004 beq r2,r0,0x189548                #If target has innoncent
00189538: 34030064 ori r3,r0,0x0064                  |r3 = 100
0018953c: 34020064 ori r2,r0,0x0064                      |r2 = 100
00189540: 3c018019 lui r1,0x8019                         |
00189544: a02238d2 sb r2,0x38d2(r1)                      |Store target effective faith = 100
00189548: 3c058019 lui r5,0x8019                         |
0018954c: 8ca52d90 lw r5,0x2d90(r5)                  |r5 = Target current action data pointer
00189550: 3c028019 lui r2,0x8019                     |
00189554: 904238d2 lbu r2,0x38d2(r2)                 |r2 = Target effective faith
00189558: 84a40004 lh r4,0x0004(r5)                  |r4 = TCA HP Dmg
0018955c: 00621023 subu r2,r3,r2                     |r2 = 100 - Target faith
00189560: 00820018 mult  r4,r2                       |TCA HP Dmg * (100 - Target Faith)
00189564: 3c028019 lui r2,0x8019                     |
00189568: 904238d3 lbu r2,0x38d3(r2)                 |r2 = Effective attacker faith
0018956c: 00002012 mflo r4                           |r4 =  TCA HP Dmg * (100 - Target Faith)
00189570: 00621823 subu r3,r3,r2                     |r3 = 100 - Att. Faith
00189574: 00000000 nop                               |
00189578: 00830018 mult r4,r3                        |
0018957c: 00001812 mflo r3                           |r3 = HP Dmg * (100 - Tar Faith) * (100 - Att faith)
00189580: 3c0268db lui r2,0x68db                     |
00189584: 34428bad ori r2,r2,0x8bad                  |r2 = 0,4096*2^32
00189588: 00620018 mult r3,r2                        |
0018958c: 00031fc3 sra r3,r3,0x1f                    |r3 = r3/2^31 
00189590: 00001010 mfhi r2                           |r2 = HP Dmg * (100 - Tar Faith) * (100 - Att faith) *4096/10000
00189594: 00021303 sra r2,r2,0x0c                    |r2 = r2/4096  ( = HP Dmg * (100 - Tar Faith) * (100 - Att faith)/10000
00189598: 00431023 subu r2,r2,r3                     |rounding stuff
0018959c: 0c0621c7 jal 0x0018871c                    |-->Elemental Absorb and status roll Turns HP damage into recovery (if element is absorbed) / returns r2 = 0x00 if proc is triggered
001895a0: a4a20004 sh r2,0x0004(r5)                  |Store Target current action HP Dmg
001895a4: 14400003 bne r2,r0,0x001895b4              #If status proc succeed
001895a8: 00000000 nop                                   |
001895ac: 0c061fad jal 0x00187eb4                        |-->Apply status (to action) Add Ability status - if successful update TCA Attack type
001895b0: 00000000 nop                                   |
001895b4: 8fbf0010 lw r31,0x0010(r29)       
001895b8: 27bd0018 addiu r29,r29,0x0018     
001895bc: 03e00008 jr r31                   
001895c0: 00000000 nop

Return location

Battle.bin
0018b97c - Pre Formula Setup