Difference between revisions of "Magic Defense Up routine"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
 
Line 28: Line 28:
 
=== Return Locations ===
 
=== Return Locations ===
 
  '''Battle.bin'''
 
  '''Battle.bin'''
  00188764: [[Magical Support/Status/Compat]]
+
  0018875c: [[Magical Support/Status/Compat]]
  00189018: [[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]]
+
  00189010: [[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]]

Latest revision as of 06:21, 11 April 2022

No Parameters - Returns nothing

Decrease Ability XA (-33%) if Target uses Magic Defense Up
-------------------------------------------------------------------------------------------------
0018631c: 3c028019 lui r2,0x8019            
00186320: 8c422d98 lw r2,0x2d98(r2)         |r2 = Target data pointer
00186324: 00000000 nop                      |
00186328: 90420090 lbu r2,0x0090(r2)        |r2 = Target 2nd set of Support abilities
0018632c: 00000000 nop                      |
00186330: 30420002 andi r2,r2,0x0002        |r2 = 0x02 if Target uses Magic Defense Up
00186334: 1040000b beq r2,r0,0x00186364     #If Target uses Magic Defense Up
00186338: 3c025555 lui r2,0x5555                |
0018633c: 3c048019 lui r4,0x8019                |
00186340: 248438ce addiu r4,r4,0x38ce           |r4 = Current Ability XA pointer
00186344: 84830000 lh r3,0x0000(r4)             |r3 = Ability XA
00186348: 34425556 ori r2,r2,0x5556             |r2 = 0x55555556 (0,33 * 2^32)
0018634c: 00031840 sll r3,r3,0x01               |XA*2
00186350: 00620018 mult r3,r2                   |XA * 2/3 * 2^32
00186354: 00031fc3 sra r3,r3,0x1f               |r3 = Highest bit of r3 (should be 0x00)
00186358: 00001010 mfhi r2                      |r2 = XA * 2/3
0018635c: 00431023 subu r2,r2,r3                |XA *2/3 eventually down rounded
00186360: a4820000 sh r2,0x0000(r4)             |Store new XA (66% of initial XA)
00186364: 03e00008 jr r31                   END
00186368: 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
0018875c: Magical Support/Status/Compat
00189010: Formula 0E - Dmg (Y)% Hit F(MA+X)% 100% Status Hide Status