Magic Attack Up routine

From Final Fantasy Hacktics Wiki
Revision as of 06:19, 11 April 2022 by Orkney (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
No Parameters - Returns Nothing

Increases Ability XA (+33%) if Attacker uses Magic Attack Up
---------------------------------------------------------------------------------
00186204: 3c028019 lui r2,0x8019            
00186208: 8c422d94 lw r2,0x2d94(r2)         |r4 = Attacker's data pointer Load Attacker's Stats
0018620c: 00000000 nop                      |
00186210: 90420090 lbu r2,0x0090(r2)        |r2 = Attacker's 2nd set of  Support abilities Load Attacker's 2nd set of Supports
00186214: 00000000 nop                      |
00186218: 30420004 andi r2,r2,0x0004        |r2 = 0x04 if Attacker uses Magic Attack Up
0018621c: 1040000b beq r2,r0,0x0018624c     #If Attacker uses Magic Attack Up #Branch if Attacker doesn't have Magic Attack Up
00186220: 3c025555 lui r2,0x5555                |
00186224: 3c048019 lui r4,0x8019                |
00186228: 248438ce addiu r4,r4,0x38ce           |r4 = Ability XA data pointer
0018622c: 84830000 lh r3,0x0000(r4)             |r3 = XA
00186230: 34425556 ori r2,r2,0x5556             |r2 = 0x55555556 (0,33 * 2^32) 0,333333333488554
00186234: 00031880 sll r3,r3,0x02               |XA * 4
00186238: 00620018 mult r3,r2                   |XA * 4 / 3 * 2^32
0018623c: 00031fc3 sra r3,r3,0x1f               |Prep rounding
00186240: 00001010 mfhi r2                      |r2 = XA * 4/3
00186244: 00431023 subu r2,r2,r3                |Eventually down round XA
00186248: a4820000 sh r2,0x0000(r4)             |Store new XA (133% of initial XA)
0018624c: 03e00008 jr r31                   END
00186250: 00000000 nop                      

Warning : this routine don't save r31 (and don't set his stack pointer) do not jal from here without resolving it

Return locations

Battle.bin
00188754: Magical_Support/Status/Compat
00188810: MA + X
00188868: Magical_XA_*_YA
001888a0: Hit For Golem
00188ff4: Formula 0e : Dmg (Y)% Hit F(MA+X)% 100% Status Hide Status
0018a508: Formula 51 : Hit (MA+X)%
0018a844: Formula 58 : Generic: Set Morbol: Hit(MA+X)%