Difference between revisions of "Magic Attack Up routine"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
  Magic Attack Up
+
  No Parameters - Returns Nothing
  00186204: 3c028019 lui r2,0x8019
+
  00186208: 8c422d94 lw r2,0x2d94(r2) Load Attacker's Stats
+
Increases Ability XA (+33%) if Attacker uses Magic Attack Up
  0018620c: 00000000 nop
+
---------------------------------------------------------------------------------
  00186210: 90420090 lbu r2,0x0090(r2) Load Attacker's 2nd set of Supports
+
  00186204: 3c028019 lui r2,0x8019          
  00186214: 00000000 nop
+
  00186208: 8c422d94 lw r2,0x2d94(r2)         |{{f/adr|<nowiki>r4 = Attacker's data pointer</nowiki>}} {{f/adr|Load Attacker's Stats}}
  00186218: 30420004 andi r2,r2,0x0004
+
  0018620c: 00000000 nop                     |
  0018621c: 1040000b beq r2,r0,0x0018624c Branch if Attacker doesn't have Magic Attack Up
+
  00186210: 90420090 lbu r2,0x0090(r2)       |{{f/load|<nowiki>r2 = Attacker's 2nd set of  Support abilities</nowiki>}} {{f/load|Load Attacker's 2nd set of Supports}}
  00186220: 3c025555 lui r2,0x5555
+
  00186214: 00000000 nop                     |
  00186224: 3c048019 lui r4,0x8019
+
  00186218: 30420004 andi r2,r2,0x0004       |{{f/std|<nowiki>r2 = 0x04 if Attacker uses Magic Attack Up</nowiki>}}
  00186228: 248438ce addiu r4,r4,0x38ce
+
  0018621c: 1040000b beq r2,r0,0x0018624c     {{f/Cond|If Attacker uses Magic Attack Up}} {{f/Cond|Branch if Attacker doesn't have Magic Attack Up}}
  0018622c: 84830000 lh r3,0x0000(r4) Load XA
+
  00186220: 3c025555 lui r2,0x5555               |
  00186230: 34425556 ori r2,r2,0x5556 R2 = 55555556
+
  00186224: 3c048019 lui r4,0x8019               |
  00186234: 00031880 sll r3,r3,0x02 XA * 4
+
  00186228: 248438ce addiu r4,r4,0x38ce           |{{f/adr|<nowiki>r4 = Ability XA data pointer</nowiki>}}
  00186238: 00620018 mult r3,r2 XA * 4 / 3
+
  0018622c: 84830000 lh r3,0x0000(r4)             |{{f/load|<nowiki>r3 = XA</nowiki>}}
  0018623c: 00031fc3 sra r3,r3,0x1f
+
  00186230: 34425556 ori r2,r2,0x5556             |{{f/std|<nowiki>r2 = 0x55555556 (0,33 * 2^32)</nowiki>}} {{f/std|0,333333333488554}}
  00186240: 00001010 mfhi r2 Move to R2
+
  00186234: 00031880 sll r3,r3,0x02               |{{f/std|XA * 4}}
  00186244: 00431023 subu r2,r2,r3
+
  00186238: 00620018 mult r3,r2                   |{{f/std|XA * 4 / 3 * 2^32}}
  00186248: a4820000 sh r2,0x0000(r4) Store new XA
+
  0018623c: 00031fc3 sra r3,r3,0x1f               |{{f/std|Prep rounding}}
  0018624c: 03e00008 jr r31
+
  00186240: 00001010 mfhi r2                     |{{f/std|<nowiki>r2 = XA * 4/3</nowiki>}}
  00186250: 00000000 nop
+
  00186244: 00431023 subu r2,r2,r3               |{{f/std|Eventually down round XA}}
 
+
  00186248: a4820000 sh r2,0x0000(r4)             |{{f/store|Store new XA (133% of initial XA)}}
 
+
  0018624c: 03e00008 jr r31                   END
== Return Locations ==
+
  00186250: 00000000 nop                    
 
+
*Battle.bin
+
Warning : this routine don't save r31 (and don't set his stack pointer) do not jal from here without resolving it
  0018874c: [[Magical Support/Status/Compat]]
+
=== Return locations ===
  00188808: [[MA + X]]
+
'''Battle.bin'''
  00188860: [[Magical XA * YA]]
+
  00188754: [[Magical_Support/Status/Compat]]
  00188898: [[Truth/Formula 5E-5F Magical damage]]
+
  00188810: [[MA_%2B_X|MA + X]]
  00188fec: [[0E Dmg_(Y)% Hit_F(MA+X)% 100% Status Hide Status]]
+
  00188868: [[Magical_XA_*_YA]]
  0018a500: [[51 Hit_(MA+X)%]]
+
  001888a0: [[00188888_-_00188960|Hit For Golem]]
  0018a83c: [[58 Generic: Set_Morbol: Hit(MA+X)%]]
+
  00188ff4: [[0E_Dmg_(Y)%25_Hit_F(MA%2BX)%25_100%25_Status_Hide_Status|Formula 0e : Dmg (Y)% Hit F(MA+X)% 100% Status Hide Status]]
 +
  0018a508: [[51_Hit_(MA%2BX)%25|Formula 51 : Hit (MA+X)%]]
 +
  0018a844: [[58_Generic:_Set_Morbol:_Hit(MA%2BX)%25|Formula 58 : Generic: Set Morbol: Hit(MA+X)%]]

Latest revision as of 06:19, 11 April 2022

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)%