Formula 32, 33, 34, 35 Attack Up and Martial Arts

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search

Formula 32, 33, 34, 35 Attack Up and Martial Arts (No Two Hands, also is stupid.)

No Parameters - Returns Nothing

Increase XA (+33%) if Attacker uses Attack Up
Increase XA (+50%) if Attacker uses Martial Art
Note : could be cumulative
---------------------------------------------------------------------------------
0018614c: 3c028019 lui r2,0x8019            |
00186150: 8c422d94 lw r2,0x2d94(r2)         |r2 = Attacker data pointer
00186154: 00000000 nop                      |
00186158: 90420090 lbu r2,0x0090(r2)        |r2 = Attacker's support abilities (2nd set)
0018615c: 00000000 nop                      |
00186160: 30420010 andi r2,r2,0x0010        |r2 = 0x10 if Attacker uses Attack Up
00186164: 1040000b beq r2,r0,0x00186194     #If Attacker uses Attack Up
00186168: 3c025555 lui r2,0x5555                |
0018616c: 3c048019 lui r4,0x8019                |
00186170: 248438ce addiu r4,r4,0x38ce           |r4 = Current Ability XA pointer ( 0x801938ce)
00186174: 84830000 lh r3,0x0000(r4)             |r3 = Current Ability XA
00186178: 34425556 ori r2,r2,0x5556             |r2 = 0x555555556    (0,33*2^32)
0018617c: 00031880 sll r3,r3,0x02               |XA * 4
00186180: 00620018 mult r3,r2                   |XA * 4* 0,32*2^32
00186184: 00031fc3 sra r3,r3,0x1f               |r3 = highest bit of r3 (should be 0)
00186188: 00001010 mfhi r2                      |r2 = XA * 4/3
0018618c: 00431023 subu r2,r2,r3                |rounded down
00186190: a4820000 sh r2,0x0000(r4)             |Store Updated XA (133% of previous XA)
00186194: 3c038019 lui r3,0x8019            |
00186198: 906338d8 lbu r3,0x38d8(r3)        |r3 = Current Ability used Weapon ID
0018619c: 3c048019 lui r4,0x8019            |
001861a0: 8c842d94 lw r4,0x2d94(r4)         |r4 = Attacker data pointer
001861a4: 00031040 sll r2,r3,0x01           |Weapon ID * 2
001861a8: 00431021 addu r2,r2,r3            |Weapon ID * 3
001861ac: 00021080 sll r2,r2,0x02           |Weapon ID * 12 (Item data offset)
001861b0: 90830091 lbu r3,0x0091(r4)        |r3 = Attacker's support abilities (3rd set)
001861b4: 3c018006 lui r1,0x8006            |
001861b8: 00220821 addu r1,r1,r2            |80060000 + Weapon offset
001861bc: 90222ebd lbu r2,0x2ebd(r1)        |r2 = used Weapon Type   80062eb8 + 0x05 + Item offset
001861c0: 30630020 andi r3,r3,0x0020        |r3 = 0x20 if Attacker uses Martial Art
001861c4: 1060000d beq r3,r0,0x001861fc     #If Attacker uses Martial Art
001861c8: 00000000 nop                          |
001861cc: 1440000b bne r2,r0,0x001861fc         #If Used weapon type is 0x00 (fist)
001861d0: 00000000 nop                              |
001861d4: 3c028019 lui r2,0x8019                    |
001861d8: 844238ce lh r2,0x38ce(r2)                 |r2 = Ability XA
001861dc: 00000000 nop                              |
001861e0: 00021840 sll r3,r2,0x01                   |XA * 2
001861e4: 00621821 addu r3,r3,r2                    |XA * 3
001861e8: 000317c2 srl r2,r3,0x1f                   |r2 = highest bit of r3 (should be 0)
001861ec: 00621821 addu r3,r3,r2                    |rounded up
001861f0: 00031843 sra r3,r3,0x01                   |XA *3 / 2
001861f4: 3c018019 lui r1,0x8019                    |
001861f8: a42338ce sh r3,0x38ce(r1)                 |Store Updated XA (150% of previous XA)
001861fc: 03e00008 jr r31                   END
00186200: 00000000 nop

Return Locations

Battle.bin
00188b24: Physical Routine for Hit % abilities
00189898: 28 StealExp_(Lowest of TarCurExp & SP+Y) Hit_(SP+X)%
00189d00: 31 Dmg_((PA+Y)/2*PA)
00189d9c: 32 Dmg_(Rdm(1…X)*(PA*3+Y))
00189e40: 33 Hit_(PA+X)%
00189eac: 34 Heal_(PA*Y) HealMP_(PA*Y/2)
00189f20: 35 Heal_(Y)% Hit_(PA+X)%
00189fac: 37 Dmg_(Rdm(1…Y)*PA)