Calculate Accuracy for Magical Spells

From Final Fantasy Hacktics Wiki
Revision as of 19:05, 16 April 2022 by Orkney (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Calculate Accuracy for Magical Spells (No elemental boost)

No Parameters
 
Returns r2 = 0x00 if Attack hits / Else 0x01

Set Ability XA and YA, modify XA with Support/Status/Compatibility
Set HP damage as XA+YA, modify HP damage with Faith and use it as Hit%
----------------------------------------------------------------------------------
001889cc: 27bdffe8 addiu r29,r29,-0x0018    
001889d0: afbf0010 sw r31,0x0010(r29)       |
001889d4: 0c061760 jal 0x00185d80           |-->Store MA and X Set Ability XA = Attacker's MA and YA = used Ability X
001889d8: 00000000 nop                      |
001889dc: 0c0621d1 jal 0x00188744           |-->Magical Support/Status/Compat Modify Ability XA (Support Abilities, Status, Compatibility)
001889e0: 00000000 nop                      |
001889e4: 0c061967 jal 0x0018659c           |-->Set XA + YA for Status Formulas (Stupid section) XA+YA becomes TCA HP damage (YA is processed via compatibility)
001889e8: 00000000 nop                      |
001889ec: 0c061c54 jal 0x00187150           |-->Faith Calculation HP damage becomes Base HP damage * Target faith/100 * Attacker faith/100
001889f0: 00000000 nop                      |
001889f4: 0c061d44 jal 0x00187510           |-->Uses_HP_damage_as_Action_hit% HP damage becomes Hit% - Roll Hit% vs random (0 to 100), Set Action hit flag to miss if it fails
001889f8: 00000000 nop                      |
001889fc: 3c028019 lui r2,0x8019            |
00188a00: 8c422d90 lw r2,0x2d90(r2)         |r2 = Target Current action (TCA) data pointer
00188a04: 00000000 nop                      |
00188a08: 90420000 lbu r2,0x0000(r2)        |r2 = TCA hit flag
00188a0c: 00000000 nop                      |
00188a10: 2c420001 sltiu r2,r2,0x0001       |r2 = 0x01 if Attack miss / Else 0x00
00188a14: 8fbf0010 lw r31,0x0010(r29)       |
00188a18: 27bd0018 addiu r29,r29,0x0018     
00188a1c: 03e00008 jr r31                   
00188a20: 00000000 nop

Return locations

Battle.bin
001890a4: Formula 0F - AbsMP (Y)% Hit F(MA+X)%
001890fc: Formula 10 - AbsHP (Y)% Hit F(MA+X)%
001891cc: Formula 15 - Set CT00 Hit F(MA+X)%
00189224: Formula 16 - DmgMP (TarCurMP) Hit F(MA+X)%
0018927c: Formula 17 - Dmg (TarCurHP-1) Hit F(MA+X)%