Difference between revisions of "Conditional Status Proc Roll (19%) Inner Routine"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m (note)
m
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
  00187690: 3c028019 lui r2,0x8019
+
  80187690: 3c028019 lui r2,0x8019
  00187694: 8c42f5fc lw r2,-0x0a04(r2)                   (see notes)
+
  80187694: 8c42f5fc lw r2,-0x0a04(r2)               #  actionState
  00187698: 27bdffe8 addiu r29,r29,0xffe8
+
  80187698: 27bdffe8 addiu r29,r29,-0x0018
  0018769c: 1440000d bne r2,r0,0x001876d4         # if (mem_word[0x8018f5fc] != 0)
+
  8018769c: 1440000d bne r2,r0,0x801876d4
  001876a0: afbf0010 sw r31,0x0010(r29) # return;
+
  801876a0: afbf0010 sw r31,0x0010(r29)
  001876a4: 34040064 ori r4,r0,0x0064
+
                                                    #   if (actionState == 0) {                        // Action executing
  001876a8: 0c017833 jal 0x0005e0cc # [[0005e0cc]] Random Roll (0-99) Threshold = 0x13/0x64 = 19/100
+
  801876a4: 34040064 ori r4,r0,0x0064
  001876ac: 34050013 ori r5,r0,0x0013
+
  801876a8: 0c017833 jal 0x8005e0cc                  #       rollResult = [[Pass/Fail Roll]] (100, 19);      // Roll (0-99) and return 0 if result < 19 (19% chance)
  001876b0: 14400008 bne r2,r0,0x001876d4 # if (Under)
+
  801876ac: 34050013 ori r5,r0,0x0013
  001876b4: 00000000 nop # {
+
  801876b0: 14400008 bne r2,r0,0x801876d4            #       if (rollResult != 0) {                      // Roll was under 19 (19% chance)
  001876b8: 3c038019 lui r3,0x8019 #
+
  801876b4: 00000000 nop
  001876bc: 8c632d90 lw r3,0x2d90(r3)
+
  801876b8: 3c038019 lui r3,0x8019
  001876c0: 00000000 nop
+
  801876bc: 8c632d90 lw r3,0x2d90(r3)                 #          action
  001876c4: 94620010 lhu r2,0x0010(r3)
+
  801876c0: 00000000 nop
  001876c8: 00000000 nop
+
  801876c4: 94620010 lhu r2,0x0010(r3)                #          action.0x10                            // (halfword)
  001876cc: 34420200 ori r2,r2,0x0200 # (Set status proc to true)? -- *(&action + 0x11) |= 0x02;
+
  801876c8: 00000000 nop
  001876d0: a4620010 sh r2,0x0010(r3) # }
+
  801876cc: 34420200 ori r2,r2,0x0200                 #           action.0x10 | 0x200
  001876d4: 8fbf0010 lw r31,0x0010(r29)
+
  801876d0: a4620010 sh r2,0x0010(r3)                 #          action.0x10 = action.0x10 | 0x200      // Flags status proc?
  001876d8: 27bd0018 addiu r29,r29,0x0018
+
                                                    #       }
  001876dc: 03e00008 jr r31 # return;
+
                                                    #  }
  001876e0: 00000000 nop
+
  801876d4: 8fbf0010 lw r31,0x0010(r29)
 
+
  801876d8: 27bd0018 addiu r29,r29,0x0018
*Notes
+
  801876dc: 03e00008 jr r31
  8018f5fc word seems to be set to 0 when real action is taken - set to 2 and then back to previous value in some checking routine - set to 1 and then back in some AI routine
+
  801876e0: 00000000 nop
 +
=== Notes ===
 +
  '''If Action is being executed''' ( 0x8018f5fc = 0x00)
 +
    {{f/jal|Pass/Fail Roll |Pass/Fail Roll }} Returns r2 = 0x00 if Proc is ok (random between 0-100 is < 19)
 +
    '''If Proc is triggered''' ( Random < 19% )
 +
        |{{f/store|Enable Target Current Action Special flag 2 0x02 (preserves other flags)}}
 +
=== Return Location ===
 +
801884d0: [[Conditional Status Proc Roll (19%25)]]

Latest revision as of 19:04, 5 April 2022

80187690: 3c028019 lui r2,0x8019
80187694: 8c42f5fc lw r2,-0x0a04(r2)                #   actionState
80187698: 27bdffe8 addiu r29,r29,-0x0018
8018769c: 1440000d bne r2,r0,0x801876d4
801876a0: afbf0010 sw r31,0x0010(r29)
                                                    #   if (actionState == 0) {                         // Action executing
801876a4: 34040064 ori r4,r0,0x0064
801876a8: 0c017833 jal 0x8005e0cc                   #       rollResult = Pass/Fail Roll (100, 19);      // Roll (0-99) and return 0 if result < 19 (19% chance)
801876ac: 34050013 ori r5,r0,0x0013
801876b0: 14400008 bne r2,r0,0x801876d4             #       if (rollResult != 0) {                      // Roll was under 19 (19% chance)
801876b4: 00000000 nop
801876b8: 3c038019 lui r3,0x8019
801876bc: 8c632d90 lw r3,0x2d90(r3)                 #           action
801876c0: 00000000 nop
801876c4: 94620010 lhu r2,0x0010(r3)                #           action.0x10                             // (halfword)
801876c8: 00000000 nop
801876cc: 34420200 ori r2,r2,0x0200                 #           action.0x10 | 0x200
801876d0: a4620010 sh r2,0x0010(r3)                 #           action.0x10 = action.0x10 | 0x200       // Flags status proc?
                                                    #       }
                                                    #   }
801876d4: 8fbf0010 lw r31,0x0010(r29)
801876d8: 27bd0018 addiu r29,r29,0x0018
801876dc: 03e00008 jr r31
801876e0: 00000000 nop

Notes

If Action is being executed ( 0x8018f5fc = 0x00)
    -->Pass/Fail Roll  Returns r2 = 0x00 if Proc is ok (random between 0-100 is < 19)
    If Proc is triggered ( Random < 19% )
        |Enable Target Current Action Special flag 2 0x02 (preserves other flags)

Return Location

801884d0: Conditional Status Proc Roll (19%)