04 Magic Gun

From Final Fantasy Hacktics Wiki
(Redirected from 00188c24 - 00188c98)
Jump to navigation Jump to search
Chooses and casts a Magic Ability :
- Fire if gun element is Fire (Tier is random : 60% Fire 1 / 30% Fire 2 / 10% Fire 3)
- Bolt if element is thunder
- Ice if element is Ice (in fact, Ice if not fire nor thunder)

Weapon Power is used instead of Attacker's Magic Attack
Cast Ability is unevadable
-------------------------------------------------------------------------------------------
00188c24: 27bdffe8 addiu r29,r29,-0x0018    
00188c28: afbf0010 sw r31,0x0010(r29)       
00188c2c: 0c061dcc jal 0x00187730           |-->Magic Gun Ability Decision  Weapon Element determines type of spell, Tier is randomly chosen
00188c30: 00000000 nop                      |
00188c34: 3c028019 lui r2,0x8019            |
00188c38: 90423902 lbu r2,0x3902(r2)        |r2 = Current Ability Weapon Power          0x80193902 / 80193902
00188c3c: 3c038019 lui r3,0x8019            |
00188c40: 906338fa lbu r3,0x38fa(r3)        |r3 = Current Ability : Ability Y         0x801938fa / 801938fa
00188c44: 3c018019 lui r1,0x8019            |
00188c48: a42238ce sh r2,0x38ce(r1)         |Store WP as Ability XA
00188c4c: 3c018019 lui r1,0x8019            |
00188c50: a42338d0 sh r3,0x38d0(r1)         |Store Ability Y as YA
00188c54: 0c0617e0 jal 0x00185f80           |-->Charge Calculation   Add Power Charge to XA
00188c58: 00000000 nop                      |
00188c5c: 0c0617e9 jal 0x00185fa4           |-->Weapon Element Strengthen XA + 25% if Weapon Element is strengthened
00188c60: 00000000 nop                      |
00188c64: 0c0621d1 jal 0x00188744           |-->Magical Support/Status/Compat Modify Ability XA (Status / Support / Compatibility)
00188c68: 00000000 nop                      |
00188c6c: 0c0621df jal 0x0018877c           |-->Elemental XA * YA Turns XA and YA in HP damage / Modify Damage based on Elements / Returns r2 = 0x00 if Attack hits
00188c70: 00000000 nop                      |
00188c74: 14400005 bne r2,r0,0x00188c8c     #If Attack hits
00188c78: 00000000 nop                          |
00188c7c: 0c061c54 jal 0x00187150               |-->Faith Calculation Damage becomes Damage*Target Faith/100 * Attacker Faith/100
00188c80: 00000000 nop                          |
00188c84: 0c061c3f jal 0x001870fc               |-->Elemental Absorption HP damage might becomes HP recovery - Changes Attack Type from 0x80 to 0x40 (HP recovery)
00188c88: 00000000 nop                          |
00188c8c: 8fbf0010 lw r31,0x0010(r29)       END
00188c90: 27bd0018 addiu r29,r29,0x0018     
00188c94: 03e00008 jr r31                   
00188c98: 00000000 nop                      

Return location

Battle.bin
 8018b97c - Pre Formula Setup