Difference between revisions of "MP Absorption"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m (Orkney moved page MP Recovery Routine to MP Absorption)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
  MP Absorb Routine (Longer then it needs to be?)
+
No Parameters - Returns Nothing
  0018746c: 3c028019 lui r2,0x8019
+
  00187470: 8c422d90 lw r2,0x2d90(r2) Current Action Data Pointer
+
Load Target Current Action (TCA) HP damage to use it as MP damage/recovery, then nullify HP damage.
  00187474: 27bdffe8 addiu r29,r29,0xffe8
+
- Set TCA MP damage and TCA attack type = MP damage
  00187478: afbf0010 sw r31,0x0010(r29)
+
- Set Attacker Current Action  (ACA) MP recovery and ACA Attack Type = MP recovery
  0018747c: 94440004 lhu r4,0x0004(r2) Load HP Damage
+
----------------------------------------------------------------------------------------------------------
  00187480: 34030020 ori r3,r0,0x0020
+
  0018746c: 3c028019 lui r2,0x8019           |
  00187484: a4400004 sh r0,0x0004(r2) Store HP Damage as 0
+
  00187470: 8c422d90 lw r2,0x2d90(r2)         |{{f/adr|<nowiki>r2 = Target Current Action (TCA) data pointer</nowiki>}}
  00187488: a0430025 sb r3,0x0025(r2) Store Attack Flag as MP Damage
+
  00187474: 27bdffe8 addiu r29,r29,-0x0018    |
  0018748c: 0c062e91 jal 0x0018ba44
+
  00187478: afbf0010 sw r31,0x0010(r29)       |
  00187490: a4440008 sh r4,0x0008(r2) Store HP Damage as MP Damage
+
  0018747c: 94440004 lhu r4,0x0004(r2)       |{{f/load|<nowiki>r4 = TCA HP damage</nowiki>}}
  00187494: 3c048019 lui r4,0x8019
+
  00187480: 34030020 ori r3,r0,0x0020         |{{f/std|<nowiki>r3 = 0x20</nowiki>}}
  00187498: 8c842d90 lw r4,0x2d90(r4) Current Action Data Pointer
+
  00187484: a4400004 sh r0,0x0004(r2)         |{{f/store|Nullify TCA HP damage}}
  0018749c: 00000000 nop
+
  00187488: a0430025 sb r3,0x0025(r2)         |{{f/store|<nowiki>Set TCA Attack Type = MP damage (disables other flags)</nowiki>}}
  001874a0: 90820000 lbu r2,0x0000(r4) Load Hit Flag
+
  0018748c: 0c062e91 jal 0x0018ba44           |{{f/jal|Set_some_data_for_current_attack|Set_some_data_for_current_attack}} Checks if Attack is valid before applying any changes to Attacker data
  001874a4: 00000000 nop
+
  00187490: a4440008 sh r4,0x0008(r2)         |{{f/store|<nowiki>Set TCA MP damage = Previous HP damage</nowiki>}}
  001874a8: 1040000c beq r2,r0,0x001874dc Branch if attack as evaded
+
  00187494: 3c048019 lui r4,0x8019           |
  001874ac: 00000000 nop
+
  00187498: 8c842d90 lw r4,0x2d90(r4)         |{{f/adr|<nowiki>r4 = TCA data pointer</nowiki>}}
  001874b0: 3c038019 lui r3,0x8019
+
  0018749c: 00000000 nop                     |
  001874b4: 8c632d8c lw r3,0x2d8c(r3)
+
  001874a0: 90820000 lbu r2,0x0000(r4)       |{{f/load|<nowiki>r2 = TCA hit flag</nowiki>}}
  001874b8: 94820008 lhu r2,0x0008(r4) Load MP Damage
+
  001874a4: 00000000 nop                     |
  001874bc: 00000000 nop
+
  001874a8: 1040000c beq r2,r0,0x001874dc     {{f/Cond|If Attack is not nullified}}
  001874c0: a462000a sh r2,0x000a(r3) Store MP Damage as MP Recovery?
+
  001874ac: 00000000 nop                         |
  001874c4: 34020010 ori r2,r0,0x0010 R2 = 10
+
  001874b0: 3c038019 lui r3,0x8019               |
  001874c8: a0620025 sb r2,0x0025(r3) Store Attack Flag as MP Recovery
+
  001874b4: 8c632d8c lw r3,0x2d8c(r3)             |{{f/adr|<nowiki>r3 = Attacker Current Action (ACA) data pointer</nowiki>}}
  001874cc: 3c038019 lui r3,0x8019
+
  001874b8: 94820008 lhu r2,0x0008(r4)           |{{f/load|<nowiki>r2 = TCA MP damage</nowiki>}}
  001874d0: 8c632d8c lw r3,0x2d8c(r3)
+
  001874bc: 00000000 nop                         |
  001874d4: 34020001 ori r2,r0,0x0001 R2 = 1
+
  001874c0: a462000a sh r2,0x000a(r3)             |{{f/store|<nowiki>Set ACA MP recovery  =TCA MP damage</nowiki>}}
  001874d8: a0620000 sb r2,0x0000(r3)
+
  001874c4: 34020010 ori r2,r0,0x0010             |{{f/std|<nowiki>r2 = 0x10 (MP recovery Attack type)</nowiki>}}
  001874dc: 8fbf0010 lw r31,0x0010(r29)
+
  001874c8: a0620025 sb r2,0x0025(r3)             |{{f/store|<nowiki>Set ACA attack type = MP recovery (disables others flags)</nowiki>}}
  001874e0: 27bd0018 addiu r29,r29,0x0018
+
  001874cc: 3c038019 lui r3,0x8019               |
  001874e4: 03e00008 jr r31
+
  001874d0: 8c632d8c lw r3,0x2d8c(r3)             |{{f/adr|<nowiki>r3 = ACA data pointer</nowiki>}}
 +
  001874d4: 34020001 ori r2,r0,0x0001             |{{f/std|<nowiki>r2 = 0x01</nowiki>}}
 +
  001874d8: a0620000 sb r2,0x0000(r3)             |{{f/store|Set ACA Hit flag to Hit (0x01)}}
 +
  001874dc: 8fbf0010 lw r31,0x0010(r29)       END
 +
  001874e0: 27bd0018 addiu r29,r29,0x0018    
 +
  001874e4: 03e00008 jr r31                  
 
  001874e8: 00000000 nop
 
  001874e8: 00000000 nop
 +
=== Notes ===
 +
This routine call [[Set some data for current attack]] which is normally called when formula returns in preformula set up routine.
 +
It's used to nullify Action if target can't be hited (Status), and to cap HP and MP amount.
 +
It seems to be used here before any changes to Attacker Current Action data, probably because this changes would not be nullified afterward
  
 
+
=== Return locations ===
== Return Locations ==
+
'''Battle.bin'''
 
+
001890cc: [[0F_AbsMP_(Y)%25_Hit_F(MA%2BX)%25|Formula 0f : AbsMP (Y)% Hit F(MA+X)%]]
001890c4: [[0F AbsMP_(Y)% Hit_F(MA+X)%]]
+
00189c80: [[2F_AbsMP_(PA*WP)|Formula 2f : AbsMP (PA*WP)]]

Latest revision as of 19:40, 16 April 2022

No Parameters - Returns Nothing

Load Target Current Action (TCA) HP damage to use it as MP damage/recovery, then nullify HP damage.
- Set TCA MP damage and TCA attack type = MP damage
- Set Attacker Current Action  (ACA) MP recovery and ACA Attack Type = MP recovery
----------------------------------------------------------------------------------------------------------
0018746c: 3c028019 lui r2,0x8019            |
00187470: 8c422d90 lw r2,0x2d90(r2)         |r2 = Target Current Action (TCA) data pointer
00187474: 27bdffe8 addiu r29,r29,-0x0018    |
00187478: afbf0010 sw r31,0x0010(r29)       |
0018747c: 94440004 lhu r4,0x0004(r2)        |r4 = TCA HP damage
00187480: 34030020 ori r3,r0,0x0020         |r3 = 0x20
00187484: a4400004 sh r0,0x0004(r2)         |Nullify TCA HP damage
00187488: a0430025 sb r3,0x0025(r2)         |Set TCA Attack Type = MP damage (disables other flags)
0018748c: 0c062e91 jal 0x0018ba44           |-->Set_some_data_for_current_attack Checks if Attack is valid before applying any changes to Attacker data
00187490: a4440008 sh r4,0x0008(r2)         |Set TCA MP damage = Previous HP damage
00187494: 3c048019 lui r4,0x8019            |
00187498: 8c842d90 lw r4,0x2d90(r4)         |r4 = TCA data pointer
0018749c: 00000000 nop                      |
001874a0: 90820000 lbu r2,0x0000(r4)        |r2 = TCA hit flag
001874a4: 00000000 nop                      |
001874a8: 1040000c beq r2,r0,0x001874dc     #If Attack is not nullified
001874ac: 00000000 nop                          |
001874b0: 3c038019 lui r3,0x8019                |
001874b4: 8c632d8c lw r3,0x2d8c(r3)             |r3 = Attacker Current Action (ACA) data pointer
001874b8: 94820008 lhu r2,0x0008(r4)            |r2 = TCA MP damage
001874bc: 00000000 nop                          |
001874c0: a462000a sh r2,0x000a(r3)             |Set ACA MP recovery  =TCA MP damage
001874c4: 34020010 ori r2,r0,0x0010             |r2 = 0x10 (MP recovery Attack type)
001874c8: a0620025 sb r2,0x0025(r3)             |Set ACA attack type = MP recovery (disables others flags)
001874cc: 3c038019 lui r3,0x8019                |
001874d0: 8c632d8c lw r3,0x2d8c(r3)             |r3 = ACA data pointer
001874d4: 34020001 ori r2,r0,0x0001             |r2 = 0x01
001874d8: a0620000 sb r2,0x0000(r3)             |Set ACA Hit flag to Hit (0x01)
001874dc: 8fbf0010 lw r31,0x0010(r29)       END
001874e0: 27bd0018 addiu r29,r29,0x0018     
001874e4: 03e00008 jr r31                   
001874e8: 00000000 nop

Notes

This routine call Set some data for current attack which is normally called when formula returns in preformula set up routine.
It's used to nullify Action if target can't be hited (Status), and to cap HP and MP amount.
It seems to be used here before any changes to Attacker Current Action data, probably because this changes would not be nullified afterward

Return locations

Battle.bin
001890cc: Formula 0f : AbsMP (Y)% Hit F(MA+X)%
00189c80: Formula 2f : AbsMP (PA*WP)