Difference between revisions of "4B Heal (Rdm(1..9)) 100% Status"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m (Wrong indent.)
m
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
  [4b] Remove status and restore Rand(1..(X-1)) HP
 
  [4b] Remove status and restore Rand(1..(X-1)) HP
  0018a2ec: 27bdffe8 addiu r29,r29,0xffe8   
+
  0018a2ec: 27bdffe8 addiu r29,r29,-0x0018    |
  0018a2f0: afbf0010 sw r31,0x0010(r29)       
+
  0018a2f0: afbf0010 sw r31,0x0010(r29)      |
  0018a2f4: 0c062b37 jal 0x[[0018acdc]]           Add Status at 100%; must add or item fails.
+
  0018a2f4: 0c062b37 jal 0x0018acdc           |{{f/jal|Apply_Status_and_Check_Undead|Apply_Status_and_Check_Undead}} Nullify Action if Status infliction fails and Target is not undead - returns r2
  0018a2f8: 00000000 nop                       
+
  0018a2f8: 00000000 nop                      |
  0018a2fc: 10400024 beq r2,r0,0x0018a390     
+
  0018a2fc: 10400024 beq r2,r0,0x0018a390    {{f/Cond|If Status can be inflicted/removed}} /Else branch to  {{f/loc|END}}
  0018a300: 00000000 nop                    
+
  0018a300: 00000000 nop                         |
  0018a304: 3c048019 lui r4,0x8019          
+
0018a304: 3c048019 lui r4,0x8019               |
  0018a308: 8c842d98 lw r4,0x2d98(r4)        
+
0018a308: 8c842d98 lw r4,0x2d98(r4)             |{{f/adr|<nowiki>r4 = Target data pointer</nowiki>}}
  0018a30c: 00000000 nop                    
+
0018a30c: 00000000 nop                         |
  0018a310: 90820058 lbu r2,0x0058(r4)      
+
0018a310: 90820058 lbu r2,0x0058(r4)           |{{f/load|<nowiki>r2 = Target current statuses (1st set)</nowiki>}}
  0018a314: 00000000 nop                    
+
0018a314: 00000000 nop                         |
  IF r2 & 0x10 != 0:
+
0018a318: 30420010 andi r2,r2,0x0010           |{{f/std|<nowiki>r2 = 0x10 if Target is undead</nowiki>}}
  0018a318: 30420010 andi r2,r2,0x0010      
+
0018a31c: 10400006 beq r2,r0,0x0018a338         {{f/Cond|If Target is Undead}}
  0018a31c: 10400006 beq r2,r0,0x0018a338    
+
0018a320: 00000000 nop                             |
  0018a320: 00000000 nop                    
+
0018a324: 3c038019 lui r3,0x8019                   |
  THEN:
+
0018a328: 8c632d90 lw r3,0x2d90(r3)                 |{{f/adr|<nowiki>r3 = Target Current Action (TCA) data pointer</nowiki>}}
    0018a324: 3c038019 lui r3,0x8019           Run only if undead.
+
0018a32c: 94820028 lhu r2,0x0028(r4)               |{{f/load|<nowiki>r2 = Target Current HP</nowiki>}}
    0018a328: 8c632d90 lw r3,0x2d90(r3)        
+
0018a330: 080628e2 j 0x0018a388                     {{f/jump|jumps to}} {{f/loc| Undead Reversal section}} '''with HP damage = Current HP
    0018a32c: 94820028 lhu r2,0x0028(r4)       Load Target curHP
+
0018a334: 00000000 nop
    0018a330: 080628e2 j 0x0018a388             Skip to damage if undead
+
                                                &{{f/Cond|Else : Target is not Undead}}
    0018a334: 00000000 nop                    
+
0018a338: 0c063ba8 jal 0x0018eea0              |{{f/jal|Random_Process,_gives_a_number_between_0-7fff|Random_Process,_gives_a_number_between_0-7fff}} Returns r2 (0x00 to 0x7fff)
  ELSE:
+
0018a33c: 00000000 nop                         |
    0018a338: 0c063ba8 jal 0x[[0018eea0]]          Load RN between 0 and 1
+
0018a340: 3c038019 lui r3,0x8019               |
    0018a33c: 00000000 nop                    
+
0018a344: 906338db lbu r3,0x38db(r3)           |{{f/load|<nowiki>r3 = Used Item ID</nowiki>}}
    0018a340: 3c038019 lui r3,0x8019          
+
0018a348: 00000000 nop                         |
    0018a344: 906338db lbu r3,0x38db(r3)       Load item used
+
0018a34c: 00032040 sll r4,r3,0x01               |{{f/std|Item ID * 2}}
    0018a348: 00000000 nop                    
+
0018a350: 00832021 addu r4,r4,r3               |{{f/std|Item ID * 3}}
    0018a34c: 00032040 sll r4,r3,0x01           Item ID * 2
+
0018a354: 3c018006 lui r1,0x8006               |
    0018a350: 00832021 addu r4,r4,r3           ID * 3
+
0018a358: 00240821 addu r1,r1,r4               |{{f/std|<nowiki>r1 = 0x8006000 + Item Offset for secondary data table</nowiki>}}
    0018a354: 3c018006 lui r1,0x8006          
+
0018a35c: 90233f99 lbu r3,0x3f99(r1)           |{{f/load|<nowiki>r3 = Used Item Z value</nowiki>}} {{f/std| 0x80063f98 + 0x01 + Item Offset}}
    0018a358: 00240821 addu r1,r1,r4          
+
0018a360: 00000000 nop                         |
    0018a35c: 90233f99 lbu r3,0x3f99(r1)       Load Z
+
0018a364: 00430018 mult r2,r3                   |{{f/std|Random * Z}}
    0018a360: 00000000 nop                    
+
0018a368: 3c038019 lui r3,0x8019               |
    0018a364: 00430018 mult r2,r3              
+
0018a36c: 8c632d90 lw r3,0x2d90(r3)             |{{f/adr|<nowiki>r3 = Target Current Action (TCA) data pointer</nowiki>}}
    0018a368: 3c038019 lui r3,0x8019          
+
0018a370: 00001012 mflo r2                     |{{f/std|<nowiki>r2 = Z * Random</nowiki>}}
    0018a36c: 8c632d90 lw r3,0x2d90(r3)        
+
0018a374: 04410002 bgez r2,0x0018a380           {{f/Cond|If r2 < 0}}
    0018a370: 00001012 mflo r2                 Load Z * RN
+
0018a378: 00000000 nop                             |
    0018a374: 04410002 bgez r2,0x0018a380      
+
0018a37c: 24427fff addiu r2,r2,0x7fff               |{{f/std|make r2 positive  -  (changes rounding result for negative numbers)}}
    0018a378: 00000000 nop                    
+
0018a380: 000213c3 sra r2,r2,0x0f               |{{f/std|<nowiki>r2 = Random between 0 and Z-1</nowiki>}}
      0018a37c: 24427fff addiu r2,r2,0x7fff      
+
0018a384: 24420001 addiu r2,r2,0x0001           |{{f/std|<nowiki>r2 = Random between 1 and Z</nowiki>}}
    0018a380: 000213c3 sra r2,r2,0x0f          
+
0018a388: 0c061cd4 jal 0x00187350              |{{f/jal|Undead Reversal|Undead Reversal}} Switch HP damage to HP recovery if Target isn't undead / Else Nullify 0x80193860 (cancel death)
    0018a384: 24420001 addiu r2,r2,0x0001      
+
0018a38c: a4620004 sh r2,0x0004(r3)             |{{f/store|Store as HP Damage (Changed to healing by above routine)}}
  0018a388: 0c061cd4 jal 0x[[00187350]]          Undead Reversal
+
  0018a390: 8fbf0010 lw r31,0x0010(r29)      END
  0018a38c: a4620004 sh r2,0x0004(r3)         Store as HP Damage (Changed to healing by above routine)
+
  0018a394: 27bd0018 addiu r29,r29,0x0018
RETURN:
+
  0018a398: 03e00008 jr r31
  0018a390: 8fbf0010 lw r31,0x0010(r29)       
 
  0018a394: 27bd0018 addiu r29,r29,0x0018    
 
  0018a398: 03e00008 jr r31                  
 
 
  0018a39c: 00000000 nop
 
  0018a39c: 00000000 nop
 +
=== Return location ===
 +
'''Battle.bin'''
 +
0018b97c - [[Pre Formula Setup (FDC)|Pre Formula Setup]]

Latest revision as of 05:04, 14 June 2022

[4b] Remove status and restore Rand(1..(X-1)) HP
0018a2ec: 27bdffe8 addiu r29,r29,-0x0018    |
0018a2f0: afbf0010 sw r31,0x0010(r29)       |
0018a2f4: 0c062b37 jal 0x0018acdc           |-->Apply_Status_and_Check_Undead Nullify Action if Status infliction fails and Target is not undead - returns r2
0018a2f8: 00000000 nop                      |
0018a2fc: 10400024 beq r2,r0,0x0018a390     #If Status can be inflicted/removed /Else branch to  END
0018a300: 00000000 nop                          |
0018a304: 3c048019 lui r4,0x8019                |
0018a308: 8c842d98 lw r4,0x2d98(r4)             |r4 = Target data pointer
0018a30c: 00000000 nop                          |
0018a310: 90820058 lbu r2,0x0058(r4)            |r2 = Target current statuses (1st set)
0018a314: 00000000 nop                          |
0018a318: 30420010 andi r2,r2,0x0010            |r2 = 0x10 if Target is undead
0018a31c: 10400006 beq r2,r0,0x0018a338         #If Target is Undead
0018a320: 00000000 nop                              |
0018a324: 3c038019 lui r3,0x8019                    |
0018a328: 8c632d90 lw r3,0x2d90(r3)                 |r3 = Target Current Action (TCA) data pointer
0018a32c: 94820028 lhu r2,0x0028(r4)                |r2 = Target Current HP
0018a330: 080628e2 j 0x0018a388                     >>jumps to  Undead Reversal section with HP damage = Current HP
0018a334: 00000000 nop
                                                &#Else : Target is not Undead
0018a338: 0c063ba8 jal 0x0018eea0               |-->Random_Process,_gives_a_number_between_0-7fff Returns r2 (0x00 to 0x7fff)
0018a33c: 00000000 nop                          |
0018a340: 3c038019 lui r3,0x8019                |
0018a344: 906338db lbu r3,0x38db(r3)            |r3 = Used Item ID
0018a348: 00000000 nop                          |
0018a34c: 00032040 sll r4,r3,0x01               |Item ID * 2
0018a350: 00832021 addu r4,r4,r3                |Item ID * 3
0018a354: 3c018006 lui r1,0x8006                |
0018a358: 00240821 addu r1,r1,r4                |r1 = 0x8006000 + Item Offset for secondary data table
0018a35c: 90233f99 lbu r3,0x3f99(r1)            |r3 = Used Item Z value  0x80063f98 + 0x01 + Item Offset
0018a360: 00000000 nop                          |
0018a364: 00430018 mult r2,r3                   |Random * Z
0018a368: 3c038019 lui r3,0x8019                |
0018a36c: 8c632d90 lw r3,0x2d90(r3)             |r3 = Target Current Action (TCA) data pointer
0018a370: 00001012 mflo r2                      |r2 = Z * Random
0018a374: 04410002 bgez r2,0x0018a380           #If r2 < 0
0018a378: 00000000 nop                              |
0018a37c: 24427fff addiu r2,r2,0x7fff               |make r2 positive  -  (changes rounding result for negative numbers)
0018a380: 000213c3 sra r2,r2,0x0f               |r2 = Random between 0 and Z-1
0018a384: 24420001 addiu r2,r2,0x0001           |r2 = Random between 1 and Z
0018a388: 0c061cd4 jal 0x00187350               |-->Undead Reversal Switch HP damage to HP recovery if Target isn't undead / Else Nullify 0x80193860 (cancel death)
0018a38c: a4620004 sh r2,0x0004(r3)             |Store as HP Damage (Changed to healing by above routine)
0018a390: 8fbf0010 lw r31,0x0010(r29)       END
0018a394: 27bd0018 addiu r29,r29,0x0018
0018a398: 03e00008 jr r31
0018a39c: 00000000 nop

Return location

Battle.bin
0018b97c - Pre Formula Setup