Difference between revisions of "Validate Status Changes"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
  00184b24: 00803821 addu r7,r4,r0
+
  '''00184b24 - 00184e3c  Alternative programmer annotations here : [[Modify_Status_Inflictions]] '''
  00184b28: 3c028019 lui r2,0x8019
+
   
  00184b2c: 8c422d98 lw r2,0x2d98(r2) target unit data
+
  Might remove some status from Target unit current action infliction/removal list : see [[#Notes|Notes]]
  00184b30: 00005021 addu r10,r0,r0
+
   
  00184b34: 90430005 lbu r3,0x0005(r2) load entd flags
+
  Parameters : r4 = input value
00184b38: 90420182 lbu r2,0x0182(r2) load mount info
+
                  - if = 0x00 : The whole routine is checked
00184b3c: 00000000 nop
+
                  - if <> 0x00 : Only ridder and removal section are checked
  00184b40: 30420080 andi r2,r2,0x0080
+
   
  00184b44: 1040000f beq r2,r0,0x 00184b84 branch if not riding a unit
+
  Returns : r2 = 0x00 if there is no more status to inflict or remove
  00184b48: 30680004 andi r8,r3,0x0004 immortal check
+
   
  00184b4c: 00003021 addu r6,r0,r0
+
  * TCA = Target Current Action
  00184b50: 3c038019 lui r3,0x8019
+
  -----------------------------------------------------------------------------------------
00184b54: 8c632d90 lw r3,0x2d90(r3) target current action
+
  00184b24: 00803821 addu r7,r4,r0            |{{f/std|<nowiki>r7 = Input Value</nowiki>}}
00184b58: 3c018019 lui r1,0x8019
+
00184b28: 3c028019 lui r2,0x8019            |
00184b5c: 00260821 addu r1,r1,r6
+
  00184b2c: 8c422d98 lw r2,0x2d98(r2)         |{{f/adr|<nowiki>r2 = Targeted Unit data pointer</nowiki>}}
00184b60: 9024f60c lbu r4,-0x09f4(r1) load ??
+
  00184b30: 00005021 addu r10,r0,r0           |{{f/std|<nowiki>r10 = 0x00 (used after status modification updates)</nowiki>}}
00184b64: 00661821 addu r3,r3,r6
+
  00184b34: 90430005 lbu r3,0x0005(r2)        |{{f/load|<nowiki>r3 = Targeted Unit ENTD flags</nowiki>}}
00184b68: 9062001b lbu r2,0x001b(r3) load status infliction 1?
+
  00184b38: 90420182 lbu r2,0x0182(r2)       |{{f/load|<nowiki>r2 = Targeted Unit Mount infos</nowiki>}}
00184b6c: 24c60001 addiu r6,r6,0x0001
+
  00184b3c: 00000000 nop                     |
  00184b70: 00441024 and r2,r2,r4
+
  00184b40: 30420080 andi r2,r2,0x0080        |{{f/std|<nowiki>r2 = 0x80 if Targeted Unit is ridding</nowiki>}}
  00184b74: a062001b sb r2,0x001b(r3)
+
  00184b44: 1040000f beq r2,r0,0x00184b84    {{f/Cond|If Targeted Unit is ridding a Unit}}
  00184b78: 28c20005 slti r2,r6,0x0005
+
00184b48: 30680004 andi r8,r3,0x0004        |{{f/std|<nowiki>r8 = 0x04 if Targeted Unit is immortal</nowiki>}}
00184b7c: 1440fff4 bne r2,r0,0x 00184b50 loop loads status inflictions?
+
  00184b4c: 00003021 addu r6,r0,r0               |{{f/std|<nowiki>r6 = 0x00</nowiki>}}
  00184b80: 00000000 nop
+
  00184b50: 3c038019 lui r3,0x8019               {{f/bloop|LOOP - update all TCA's status infliction set }} to be ridder allowed
00184b84: 3c048019 lui r4,0x8019
+
  00184b54: 8c632d90 lw r3,0x2d90(r3)                 |{{f/adr|<nowiki>r3 = TCA data pointer</nowiki>}}
  00184b88: 8c842d90 lw r4,0x2d90(r4)
+
  00184b58: 3c018019 lui r1,0x8019                    |
  00184b8c: 00000000 nop
+
  00184b5c: 00260821 addu r1,r1,r6                    |{{f/std|<nowiki>r1 = 0x80190000 + loop counter</nowiki>}}
  00184b90: 9083001d lbu r3,0x001d(r4) status infliction 3
+
00184b60: 9024f60c lbu r4,-0x09f4(r1)               |{{f/load|<nowiki>r4 = This iteration ridder allowed status set 1</nowiki>}}
00184b94: 00000000 nop
+
  00184b64: 00661821 addu r3,r3,r6                    |{{f/std|<nowiki>r3 = TCA data pointer + loop counter</nowiki>}}
00184b98: 30620002 andi r2,r3,0x0002
+
  00184b68: 9062001b lbu r2,0x001b(r3)                |{{f/load|<nowiki>r2 = This iteration TCA status infliction set</nowiki>}}
  00184b9c: 10400013 beq r2,r0,0x 00184bec inflict frog check?
+
  00184b6c: 24c60001 addiu r6,r6,0x0001              |{{f/std|<nowiki>r6 = loop counter +1 </nowiki>}}
  00184ba0: 00003021 addu r6,r0,r0
+
  00184b70: 00441024 and r2,r2,r4                    |{{f/std|<nowiki>r2 = This iteration status inflcition allowed for ridder</nowiki>}}
  00184ba4: 3c028019 lui r2,0x8019
+
  00184b74: a062001b sb r2,0x001b(r3)                 |{{f/store|Store updated TCA status infliction (this iteration set)}}
  00184ba8: 8c422d98 lw r2,0x2d98(r2) target data
+
  00184b78: 28c20005 slti r2,r6,0x0005                |{{f/std|<nowiki>r2 = 0x01 if loop counter < 0x05</nowiki>}}
  00184bac: 00000000 nop
+
  00184b7c: 1440fff4 bne r2,r0,0x00184b50        {{f/eloop|LOOP 5 times (all status sets)}}
  00184bb0: 9042005a lbu r2,0x005a(r2) load current status
+
  00184b80: 00000000 nop                             |
  00184bb4: 00000000 nop
+
  00184b84: 3c048019 lui r4,0x8019                    |
  00184bb8: 30420002 andi r2,r2,0x0002
+
00184b88: 8c842d90 lw r4,0x2d90(r4)         |{{f/adr|<nowiki>r4 = TCA data pointer</nowiki>}}
  00184bbc: 1040000b beq r2,r0,0x 00184bec branch if not frog
+
  00184b8c: 00000000 nop                     |
  00184bc0: 00000000 nop
+
  00184b90: 9083001d lbu r3,0x001d(r4)        |{{f/load|<nowiki>r3 = TCA status infliction 3</nowiki>}}
  00184bc4: 14e00009 bne r7,r0,0x 00184bec branch if not ?
+
00184b94: 00000000 nop                      |
00184bc8: 306200fd andi r2,r3,0x00fd
+
00184b98: 30620002 andi r2,r3,0x0002       |{{f/std|<nowiki>r2 = 0x02 if frog is going to be inflicted</nowiki>}}
00184bcc: a082001d sb r2,0x001d(r4) store status infliction
+
  00184b9c: 10400013 beq r2,r0,0x00184bec    {{f/Cond|If Frog is going to be inflicted}}  This section handles the frog toggle mechanic
  00184bd0: 3c038019 lui r3,0x8019
+
  00184ba0: 00003021 addu r6,r0,r0            |{{f/std|<nowiki>r6 = 0x00</nowiki>}}
  00184bd4: 8c632d90 lw r3,0x2d90(r3)
+
  00184ba4: 3c028019 lui r2,0x8019                |{{f/std|<nowiki>r2 = 0x80190000</nowiki>}}
  00184bd8: 00000000 nop
+
  00184ba8: 8c422d98 lw r2,0x2d98(r2)            |{{f/adr|<nowiki>r2 = Targeted Unit data pointer</nowiki>}}
  00184bdc: 90620022 lbu r2,0x0022(r3) status removal
+
  00184bac: 00000000 nop                         |
  00184be0: 00000000 nop
+
  00184bb0: 9042005a lbu r2,0x005a(r2)           |{{f/load|<nowiki>r2 = Targeted Unit current status 3</nowiki>}}
  00184be4: 34420002 ori r2,r2,0x0002 remove frog
+
  00184bb4: 00000000 nop                          |
  00184be8: a0620022 sb r2,0x0022(r3)
+
  00184bb8: 30420002 andi r2,r2,0x0002            |{{f/std|<nowiki>r2 = 0x02 if Targeted Unit is frogged</nowiki>}}
  00184bec: 14e00023 bne r7,r0,0x 00184c7c
+
00184bbc: 1040000b beq r2,r0,0x00184bec        {{f/Cond|If Targeted Unit is a frog}}
  00184bf0: 28c20003 slti r2,r6,0x0003
+
  00184bc0: 00000000 nop                             |
  00184bf4: 1040000a beq r2,r0,0x 00184c20
+
  00184bc4: 14e00009 bne r7,r0,0x00184bec            {{f/Cond|<nowiki>If Input Value = 0x00</nowiki>}}
  00184bf8: 00000000 nop
+
  00184bc8: 306200fd andi r2,r3,0x00fd                    |{{f/std|<nowiki>r2 = All TCA status infliction 3 without Frog</nowiki>}}
  00184bfc: 3c058019 lui r5,0x8019
+
  00184bcc: a082001d sb r2,0x001d(r4)                    |{{f/store|Store updated TCA's Status infliction 3}}
00184c00: 8ca52d90 lw r5,0x2d90(r5) action
+
  00184bd0: 3c038019 lui r3,0x8019                       |
  00184c04: 3c028019 lui r2,0x8019
+
  00184bd4: 8c632d90 lw r3,0x2d90(r3)                     |{{f/adr|<nowiki>r3 = TCA's data pointer</nowiki>}}
  00184c08: 8c422d98 lw r2,0x2d98(r2) data
+
  00184bd8: 00000000 nop                                  |
  00184c0c: 00000000 nop
+
  00184bdc: 90620022 lbu r2,0x0022(r3)                    |{{f/load|<nowiki>r2 = TCA status removal 3</nowiki>}}
  00184c10: 00461021 addu r2,r2,r6
+
  00184be0: 00000000 nop                                  |
  00184c14: 90430058 lbu r3,0x0058(r2) current status
+
  00184be4: 34420002 ori r2,r2,0x0002                    |{{f/std|<nowiki>r2 = TCA Status removal 3 with cancel frog enabled</nowiki>}}
  00184c18: 0806130f j 0x 00184c3c
+
  00184be8: a0620022 sb r2,0x0022(r3)                     |{{f/store|Store updated TCA's Status removal 3}}
00184c1c: 00a62821 addu r5,r5,r6
+
                                              '''@LOOP throught all status sets'''
  00184c20: 3c058019 lui r5,0x8019
+
  00184bec: 14e00023 bne r7,r0,0x00184c7c        {{f/Cond|<nowiki>If Input value = 0x00</nowiki>}}
  00184c24: 8ca52d90 lw r5,0x2d90(r5) target action
+
  00184bf0: 28c20003 slti r2,r6,0x0003                |{{f/std|<nowiki>r2 = 0x01 if loop counter < 0x03</nowiki>}}
  00184c28: 3c028019 lui r2,0x8019
+
  00184bf4: 1040000a beq r2,r0,0x00184c20            {{f/Cond|If This iteration set is 1 , 2 or 3 (Thoses don't have a CT)}}
  00184c2c: 8c422d98 lw r2,0x2d98(r2) target data
+
  00184bf8: 00000000 nop                                  |
  00184c30: 00a62821 addu r5,r5,r6
+
  00184bfc: 3c058019 lui r5,0x8019                        |
  00184c34: 00461021 addu r2,r2,r6
+
  00184c00: 8ca52d90 lw r5,0x2d90(r5)                     |{{f/adr|<nowiki>r5 = TCA data pointer</nowiki>}}
  00184c38: 9043004e lbu r3,0x004e(r2) innate status 1
+
  00184c04: 3c028019 lui r2,0x8019                       |
  00184c3c: 90440053 lbu r4,0x0053(r2) status immunities 1
+
  00184c08: 8c422d98 lw r2,0x2d98(r2)                     |{{f/adr|<nowiki>r2 = Targeted Unit data pointer</nowiki>}}
  00184c40: 90a2001b lbu r2,0x001b(r5) status infliction 1
+
  00184c0c: 00000000 nop                                  |
  00184c44: 00641827 nor r3,r3,r4
+
  00184c10: 00461021 addu r2,r2,r6                       |{{f/std|<nowiki>r2 = Targeted Unit data pointer + this iteration status set offset</nowiki>}}
  00184c48: 00431024 and r2,r2,r3
+
  00184c14: 90430058 lbu r3,0x0058(r2)                   |{{f/load|<nowiki>r3 = This iteration Targeted Unit current status</nowiki>}}
  00184c4c: 1100000b beq r8,r0,0x 00184c7c
+
00184c18: 0806130f j 0x00184c3c                        {{f/jump|jump after set 4-5 section}}
  00184c50: a0a2001b sb r2,0x001b(r5) store status infliction 1
+
  00184c1c: 00a62821 addu r5,r5,r6                       |
  00184c54: 3c028019 lui r2,0x8019
+
  00184c20: 3c058019 lui r5,0x8019                    {{f/Cond|Else (Status set 4 or 5)}} Status with a CT
  00184c58: 8c422d90 lw r2,0x2d90(r2) target action
+
  00184c24: 8ca52d90 lw r5,0x2d90(r5)                    |{{f/adr|<nowiki>r5 = TCA data pointer</nowiki>}}
  00184c5c: 3c018006 lui r1,0x8006
+
  00184c28: 3c028019 lui r2,0x8019                        |
  00184c60: 00260821 addu r1,r1,r6
+
  00184c2c: 8c422d98 lw r2,0x2d98(r2)                     |{{f/adr|<nowiki>r2 = Targeted Unit data pointer</nowiki>}}
  00184c64: 902362ee lbu r3,0x62ee(r1) load status checks
+
  00184c30: 00a62821 addu r5,r5,r6                        |{{f/std|<nowiki>r5 = TCA data pointer + this iteration offset</nowiki>}}
  00184c68: 00461021 addu r2,r2,r6
+
  00184c34: 00461021 addu r2,r2,r6                        |{{f/std|<nowiki>r2 = Targeted Unit data pointer + this iteration offset</nowiki>}}
  00184c6c: 9044001b lbu r4,0x001b(r2) laod status 1
+
  00184c38: 9043004e lbu r3,0x004e(r2)                   |{{f/load|<nowiki>r3 = This iteration Targeted Unit innate status</nowiki>}}
  00184c70: 00031827 nor r3,r0,r3
+
  00184c3c: 90440053 lbu r4,0x0053(r2)                |{{f/load|<nowiki>r4 = This iteration Targeted Unit immunities</nowiki>}}
  00184c74: 00832024 and r4,r4,r3
+
  00184c40: 90a2001b lbu r2,0x001b(r5)               |{{f/load|<nowiki>r2 = This iteration TCA status infliction set</nowiki>}}
  00184c78: a044001b sb r4,0x001b(r2) store status 1
+
  00184c44: 00641827 nor r3,r3,r4                    |{{f/std|<nowiki>r3 = This iteration Status that can be inflicted to the unit - not innate (always present) nor immune (not inflictable)</nowiki>}}
  00184c7c: 3c058019 lui r5,0x8019
+
  00184c48: 00431024 and r2,r2,r3                    |{{f/std|<nowiki>r2 = This iteration TCA status infliction with only inflictable statuses</nowiki>}}
00184c80: 8ca52d90 lw r5,0x2d90(r5) target action
+
  00184c4c: 1100000b beq r8,r0,0x00184c7c            {{f/Cond|If Targeted Unit is immortal}}
  00184c84: 3c048019 lui r4,0x8019
+
  00184c50: a0a2001b sb r2,0x001b(r5)                |{{f/store|Store this iteration updated status infliction}}
  00184c88: 8c842d98 lw r4,0x2d98(r4) target data
+
  00184c54: 3c028019 lui r2,0x8019                        |
  00184c8c: 00a62821 addu r5,r5,r6
+
  00184c58: 8c422d90 lw r2,0x2d90(r2)                    |{{f/adr|<nowiki>r5 = TCA data pointer</nowiki>}}
00184c90: 00862021 addu r4,r4,r6
+
  00184c5c: 3c018006 lui r1,0x8006                        |
  00184c94: 24c60001 addiu r6,r6,0x0001
+
  00184c60: 00260821 addu r1,r1,r6                        |{{f/std|<nowiki>r1 = 0x80060000 + this iteration offset</nowiki>}}
00184c98: 9083004e lbu r3,0x004e(r4) load status
+
  00184c64: 902362ee lbu r3,0x62ee(r1)                    |{{f/load|<nowiki>r3 = This iteration status not allowed on immortal unit</nowiki>}}
  00184c9c: 90a20020 lbu r2,0x0020(r5) load status infliction
+
  00184c68: 00461021 addu r2,r2,r6                        |{{f/std|<nowiki>r2 = T</nowiki>}}
  00184ca0: 908401bb lbu r4,0x01bb(r4)
+
  00184c6c: 9044001b lbu r4,0x001b(r2)                    |{{f/load|<nowiki>r4 = This iteration TCA status infliction set</nowiki>}}
  00184ca4: 00031827 nor r3,r0,r3
+
  00184c70: 00031827 nor r3,r0,r3                        |{{f/std|<nowiki>r3 = This iteration status allowed on immortal unit</nowiki>}}
  00184ca8: 00431024 and r2,r2,r3
+
  00184c74: 00832024 and r4,r4,r3                        |{{f/std|<nowiki>r4 = This iteration TCA status infliction set allowed on immortal unit</nowiki>}}
  00184cac: 00441024 and r2,r2,r4
+
  00184c78: a044001b sb r4,0x001b(r2)                    |{{f/store|Store updated Status infliction (ok for immortal)}}
  00184cb0: a0a20020 sb r2,0x0020(r5) store status
+
  00184c7c: 3c058019 lui r5,0x8019                |{{f/std|<nowiki>r5 = 0x80190000</nowiki>}}
  00184cb4: 28c20005 slti r2,r6,0x0005
+
  00184c80: 8ca52d90 lw r5,0x2d90(r5)            |{{f/adr|<nowiki>r5 = TCA data pointer</nowiki>}}
  00184cb8: 1440ffcc bne r2,r0,0x 00184bec
+
  00184c84: 3c048019 lui r4,0x8019               |
  00184cbc: 00000000 nop
+
  00184c88: 8c842d98 lw r4,0x2d98(r4)             |{{f/adr|<nowiki>r4 = Targeted Unit data pointer</nowiki>}}
  00184cc0: 14e00051 bne r7,r0,0x 00184e08
+
  00184c8c: 00a62821 addu r5,r5,r6               |{{f/std|<nowiki>r5 = TCA data pointer + this iteration offset</nowiki>}}
  00184cc4: 00003021 addu r6,r0,r0
+
  00184c90: 00862021 addu r4,r4,r6                |{{f/std|<nowiki>r4 = Targeted Unit data pointer + this iteration offset</nowiki>}}
  00184cc8: 340b0080 ori r11,r0,0x0080
+
  00184c94: 24c60001 addiu r6,r6,0x0001          |{{f/std|<nowiki>r6 = Loop counter + 0x01</nowiki>}}
  00184ccc: 3c098006 lui r9,0x8006
+
  00184c98: 9083004e lbu r3,0x004e(r4)            |{{f/load|<nowiki>r3 = This iteration Targeted Unit innate status</nowiki>}}
00184cd0: 25295def addiu r9,r9,0x5def
+
  00184c9c: 90a20020 lbu r2,0x0020(r5)            |{{f/load|<nowiki>r4 = This iteration TCA status removal set</nowiki>}}
  00184cd4: 04c10002 bgez r6,0x 00184ce0
+
  00184ca0: 908401bb lbu r4,0x01bb(r4)            |{{f/load|<nowiki>r3 = This iteration Targeted Unit inflicted status </nowiki>}}
  00184cd8: 00c01021 addu r2,r6,r0
+
  00184ca4: 00031827 nor r3,r0,r3                |{{f/std|<nowiki>r3 = This iteration set statuses not in the Targeted Unit Innate set (thoses which are removable)</nowiki>}}
  00184cdc: 24c2 0007 addiu r2,r6,0x 0007
+
  00184ca8: 00431024 and r2,r2,r3                |{{f/std|<nowiki>r2 = This iteration TCA status removal set that can be removed from Targeted Unit</nowiki>}}
  00184ce0: 000238c3 sra r7,r2,0x03
+
  00184cac: 00441024 and r2,r2,r4                |{{f/std|<nowiki>r2 = This iteration TCA status removal set that can be removed and that are on the target (so for example poison will not be removed from a non poisoned unit)</nowiki>}}
00184ce4: 3c028019 lui r2,0x8019
+
  00184cb0: a0a20020 sb r2,0x0020(r5)             |{{f/store|Store updated Status removal set}}
  00184ce8: 8c422d90 lw r2,0x2d90(r2)
+
  00184cb4: 28c20005 slti r2,r6,0x0005            |{{f/std|<nowiki>r2 = 0x01 if loop counter < 0x05</nowiki>}}
  00184cec: 30c3 0007 andi r3,r6,0x 0007
+
  00184cb8: 1440ffcc bne r2,r0,0x00184bec    {{f/eloop|Loop 5 times}}
  00184cf0: 00471021 addu r2,r2,r7
+
  00184cbc: 00000000 nop                          |
  00184cf4: 9042001b lbu r2,0x001b(r2)
+
00184cc0: 14e00051 bne r7,r0,0x0184e08      {{f/Cond|<nowiki>If Input value = 0x00</nowiki>}}
  00184cf8: 006b1807 srav r3,r11,r3
+
  00184cc4: 00003021 addu r6,r0,r0                |{{f/std|<nowiki>r6 = 0x00</nowiki>}}
  00184cfc: 00431024 and r2,r2,r3
+
  00184cc8: 340b0080 ori r11,r0,0x0080            |{{f/std|<nowiki>r11 = 0x80</nowiki>}}
  00184d00: 10400019 beq r2,r0,0x 00184d68
+
  00184ccc: 3c098006 lui r9,0x8006                |
  00184d04: 00000000 nop
+
  00184cd0: 25295def addiu r9,r9,0x5def          |{{f/adr|<nowiki>r9 = 0x80065de4 + 0x0b - 1st status "can't stack on" data pointer</nowiki>}}
00184d08: 00002821 addu r5,r0,r0
+
                                                '''@MAIN LOOP : loop through all statuses (40 times) - might remove status if Target has an incompatible status (can't stack on tables) '''                                     
  00184d0c: 00034027 nor r8,r0,r3
+
  00184cd4: 04c10002 bgez r6,0x00184ce0              {{f/Cond|If Status counter < 0x00 (never)}}
  00184d10: 01202021 addu r4,r9,r0
+
  00184cd8: 00c01021 addu r2,r6,r0                    |{{f/std|<nowiki>r2 = Main loop Status counter</nowiki>}}
  00184d14: 3c028019 lui r2,0x8019
+
  00184cdc: 24c20007 addiu r2,r6,0x0007                  |{{f/std|<nowiki>r2 = r6 + 0x07</nowiki>}}
  00184d18: 8c422d98 lw r2,0x2d98(r2)
+
  00184ce0: 000238c3 sra r7,r2,0x03                  |{{f/std|<nowiki>r7 = Status counter/8 = Main loop status set offset</nowiki>}}
  00184d1c: 90830000 lbu r3,0x0000(r4)
+
  00184ce4: 3c028019 lui r2,0x8019                    |
  00184d20: 00451021 addu r2,r2,r5
+
  00184ce8: 8c422d90 lw r2,0x2d90(r2)                 |{{f/adr|<nowiki>r2 = TCA data pointer</nowiki>}}
  00184d24: 90420058 lbu r2,0x0058(r2)
+
  00184cec: 30c30007 andi r3,r6,0x0007                |{{f/std|<nowiki>r3 = Reminder of Status counter /8 (Status position in his set)</nowiki>}}
00184d28: 00000000 nop
+
  00184cf0: 00471021 addu r2,r2,r7                    |{{f/std|<nowiki>r2 = TCA pointer + Main loop status set offset</nowiki>}}
00184d2c: 00431024 and r2,r2,r3
+
00184cf4: 9042001b lbu r2,0x001b(r2)                |{{f/load|<nowiki>r2 = Main loop iteration TCA status infliction </nowiki>}}
  00184d30: 10400009 beq r2,r0,0x 00184d58
+
  00184cf8: 006b1807 srav r3,r11,r3                  |{{f/std|<nowiki>r3 = Main loop iteration status bitmask</nowiki>}}
  00184d34: 24840001 addiu r4,r4,0x0001
+
  00184cfc: 00431024 and r2,r2,r3                    |{{f/std|r2 <> 0x00 if this iteration status is going to be inflicted}}
  00184d38: 3c038019 lui r3,0x8019
+
  00184d00: 10400019 beq r2,r0,0x00184d68            {{f/Cond|If this iteration status is going to be inflicted}}
  00184d3c: 8c632d90 lw r3,0x2d90(r3)
+
  00184d04: 00000000 nop                                  |
  00184d40: 00000000 nop
+
  00184d08: 00002821 addu r5,r0,r0                       |{{f/std|<nowiki>r5 = 0x00</nowiki>}}
  00184d44: 00671821 addu r3,r3,r7
+
  00184d0c: 00034027 nor r8,r0,r3                        |{{f/std|<nowiki>r8 = bitmask : Every status in this iteration status set without this iteration status</nowiki>}}
  00184d48: 9062001b lbu r2,0x001b(r3)
+
  00184d10: 01202021 addu r4,r9,r0                        |{{f/adr|<nowiki>r4 = Main loop iteration Status  Start of "Can't stack on" bytes</nowiki>}}
  00184d4c: 00000000 nop
+
  00184d14: 3c028019 lui r2,0x8019                        {{f/bloop|LOOP}} For Each main loop Status : checks the 5 sets of Target current status looking for statuses present in main loop status can't stack on list
  00184d50: 00481024 and r2,r2,r8
+
  00184d18: 8c422d98 lw r2,0x2d98(r2)                        |{{f/adr|<nowiki>r2 = Targeted Unit data pointer</nowiki>}}
  00184d54: a062001b sb r2,0x001b(r3)
+
  00184d1c: 90830000 lbu r3,0x0000(r4)                        |{{f/load|<nowiki>r3 = 2nd loop iteration "Can't stack On" set</nowiki>}}
  00184d58: 24a50001 addiu r5,r5,0x0001
+
  00184d20: 00451021 addu r2,r2,r5                            |{{f/std|<nowiki>r2 = Targeted Unit data pointer + 2nd loop offset</nowiki>}}
  00184d5c: 28a20005 slti r2,r5,0x0005
+
  00184d24: 90420058 lbu r2,0x0058(r2)                       |{{f/load|<nowiki>r2 = 2nd loop iteration Targeted Unit  current status set</nowiki>}}
00184d60: 1440ffec bne r2,r0,0x 00184d14
+
  00184d28: 00000000 nop                                      |
  00184d64: 00000000 nop
+
  00184d2c: 00431024 and r2,r2,r3                            |{{f/std|r2 <> 0x00 if Target has status(es) that prevent main loop status to be applied}}
00184d68: 24c60001 addiu r6,r6,0x0001
+
  00184d30: 10400009 beq r2,r0,0x00184d58                    {{f/Cond|If Target has status(es) preventing 1st loop Status from being applied}}
  00184d6c: 28c20028 slti r2,r6,0x0028
+
  00184d34: 24840001 addiu r4,r4,0x0001                      |{{f/std|<nowiki>r4 = "Can't stack on" table offset + 1</nowiki>}}
  00184d70: 1440ffd8 bne r2,r0,0x 00184cd4
+
  00184d38: 3c038019 lui r3,0x8019                                |{{f/std| }}
  00184d74: 25290010 addiu r9,r9,0x0010
+
  00184d3c: 8c632d90 lw r3,0x2d90(r3)                            |{{f/adr|<nowiki>r3 = TCA data pointer</nowiki>}}
  00184d78: 00003021 addu r6,r0,r0
+
  00184d40: 00000000 nop                                         |
  00184d7c: 34090080 ori r9,r0,0x0080
+
  00184d44: 00671821 addu r3,r3,r7                                |{{f/std|<nowiki>r3 = TCA data pointer + main loop Status set offset</nowiki>}}
00184d80: 3c088006 lui r8,0x8006
+
  00184d48: 9062001b lbu r2,0x001b(r3)                            |{{f/load|<nowiki>r2 = TCA 1st loop status infliction set</nowiki>}}
  00184d84: 25085dea addiu r8,r8,0x5dea
+
  00184d4c: 00000000 nop                                          |
  00184d88: 04c10002 bgez r6,0x 00184d94
+
  00184d50: 00481024 and r2,r2,r8                                |{{f/std|<nowiki>r2 = Main loop  TCA status infliction set without main loop status (removed)</nowiki>}}
00184d8c: 00c01021 addu r2,r6,r0
+
  00184d54: a062001b sb r2,0x001b(r3)                             |{{f/store|Store updated TCA status infliction}}
  00184d90: 24c2 0007 addiu r2,r6,0x 0007
+
  00184d58: 24a50001 addiu r5,r5,0x0001                      |{{f/std|<nowiki>r5 = 2nd loop counter +1 (Status set offset)</nowiki>}}
  00184d94: 000238c3 sra r7,r2,0x03
+
  00184d5c: 28a20005 slti r2,r5,0x0005                        |{{f/std|<nowiki>r2 = 0x01 if counter < 0x05</nowiki>}}
  00184d98: 3c028019 lui r2,0x8019
+
  00184d60: 1440ffec bne r2,r0,0x00184d14                {{f/eloop|Loop 5 times (each status set)}}
  00184d9c: 8c422d90 lw r2,0x2d90(r2)
+
  00184d64: 00000000 nop                                      |
  00184da0: 30c3 0007 andi r3,r6,0x 0007
+
  00184d68: 24c60001 addiu r6,r6,0x0001              |{{f/std|<nowiki>r6 = Status counter + 1</nowiki>}}
  00184da4: 00471021 addu r2,r2,r7
+
  00184d6c: 28c20028 slti r2,r6,0x0028                |{{f/std|<nowiki>r2 = 0x01 if 1st loop counter < 0x28</nowiki>}}
  00184da8: 9042001b lbu r2,0x001b(r2)
+
  00184d70: 1440ffd8 bne r2,r0,0x00184cd4        {{f/eloop|Loop 40 times (every status)}}
  00184dac: 00691807 srav r3,r9,r3
+
  00184d74: 25290010 addiu r9,r9,0x0010              |{{f/std|<nowiki>r9 = Status data offset + 0x10</nowiki>}}
  00184db0: 00431024 and r2,r2,r3
+
  00184d78: 00003021 addu r6,r0,r0                |{{f/std|<nowiki>r6 = 0x00</nowiki>}}
  00184db4: 1040000f beq r2,r0,0x 00184df4
+
  00184d7c: 34090080 ori r9,r0,0x0080            |{{f/std|<nowiki>r9 = 0x80</nowiki>}}
  00184db8: 00000000 nop
+
  00184d80: 3c088006 lui r8,0x8006                |
  00184dbc: 00002821 addu r5,r0,r0
+
  00184d84: 25085dea addiu r8,r8,0x5dea          |{{f/std|<nowiki>r8 = 0x80065de4 + 0x06 -  1st Status Cancel list data pointer</nowiki>}}
  00184dc0: 01003821 addu r7,r8,r0
+
                                                '''@MAIN LOOP : loop through all statuses - Checks if the infliction of the status will remove some status that are in theTCA infliction list (cancels tables)'''                                       
  00184dc4: 3c048019 lui r4,0x8019
+
  00184d88: 04c10002 bgez r6,0x00184d94              {{f/Cond|If Status counter < 0x00 (never)}}
  00184dc8: 8c842d90 lw r4,0x2d90(r4)
+
  00184d8c: 00c01021 addu r2,r6,r0                    |{{f/std|<nowiki>r2 = Status counter</nowiki>}}
  00184dcc: 90e30000 lbu r3,0x0000(r7)
+
  00184d90: 24c20007 addiu r2,r6,0x 0007                  |{{f/std|<nowiki>r2 = Status counter +0x07</nowiki>}}
  00184dd0: 00852021 addu r4,r4,r5
+
  00184d94: 000238c3 sra r7,r2,0x03                  |{{f/std|<nowiki>r7 = Main loop status set offset = Status counter/8</nowiki>}}
  00184dd4: 24a50001 addiu r5,r5,0x0001
+
  00184d98: 3c028019 lui r2,0x8019                    |
  00184dd8: 9082001b lbu r2,0x001b(r4)
+
  00184d9c: 8c422d90 lw r2,0x2d90(r2)                |{{f/adr|<nowiki>r2 = TCA data pointer</nowiki>}}
  00184ddc: 00031827 nor r3,r0,r3
+
  00184da0: 30c30007 andi r3,r6,0x0007                |{{f/std|<nowiki>r3 = Reminder of Status counter /8 (Status position in his set)</nowiki>}}
  00184de0: 00431024 and r2,r2,r3
+
  00184da4: 00471021 addu r2,r2,r7                    |{{f/std|<nowiki>r2 = TCA pointer + Main loop status set offset</nowiki>}}
  00184de4: a082001b sb r2,0x001b(r4)
+
  00184da8: 9042001b lbu r2,0x001b(r2)                |{{f/load|<nowiki>r2 = Main loop iteration TCA status infliction </nowiki>}}
00184de8: 28a20005 slti r2,r5,0x0005
+
  00184dac: 00691807 srav r3,r9,r3                    |{{f/std|<nowiki>r3 = Main loop iteration status bitmask</nowiki>}}
  00184dec: 1440fff5 bne r2,r0,0x 00184dc4
+
  00184db0: 00431024 and r2,r2,r3                    |{{f/std|r2 <> 0x00 if this iteration status is going to be inflicted}}
  00184df0: 24e70001 addiu r7,r7,0x0001
+
  00184db4: 1040000f beq r2,r0,0x00184df4            {{f/Cond|If Status is going to be inflicted}}
  00184df4: 24c60001 addiu r6,r6,0x0001
+
  00184db8: 00000000 nop                                  |
  00184df8: 28c20028 slti r2,r6,0x0028
+
  00184dbc: 00002821 addu r5,r0,r0                        |{{f/std|<nowiki>r5 = 0x00</nowiki>}}
  00184dfc: 1440ffe2 bne r2,r0,0x 00184d88
+
  00184dc0: 01003821 addu r7,r8,r0                       |{{f/std|<nowiki>r7 = Main Status 1st set of "Cancels table"</nowiki>}}
  00184e00: 25080010 addiu r8,r8,0x0010
+
  00184dc4: 3c048019 lui r4,0x8019                       {{f/bloop|LOOP (5 sets of statuses)}}
00184e04: 00003021 addu r6,r0,r0
+
  00184dc8: 8c842d90 lw r4,0x2d90(r4)                         |{{f/adr|<nowiki>r4 = TCA data pointer</nowiki>}}
  00184e08: 3c048019 lui r4,0x8019
+
  00184dcc: 90e30000 lbu r3,0x0000(r7)                        |{{f/load|<nowiki>r3 = 2nd loop iteration Cancels table set</nowiki>}}
  00184e0c: 8c842d90 lw r4,0x2d90(r4)
+
  00184dd0: 00852021 addu r4,r4,r5                            |{{f/std|<nowiki>r4 = TCA data pointer + 2nd loop iteration status set offset</nowiki>}}
00184e10: 00000000 nop
+
  00184dd4: 24a50001 addiu r5,r5,0x0001                      |{{f/std|<nowiki>r5 = 2nd loop counter + 1</nowiki>}}
00184e14: 00861821 addu r3,r4,r6
+
  00184dd8: 9082001b lbu r2,0x001b(r4)                       |{{f/load|<nowiki>r2 = 2nd loop iteration's TCA status infliction set</nowiki>}}
  00184e18: 24c60001 addiu r6,r6,0x0001
+
  00184ddc: 00031827 nor r3,r0,r3                             |{{f/std|<nowiki>r3 = 2nd loop iteration Status that are not in the "cancels" table</nowiki>}}
  00184e1c: 9062001b lbu r2,0x001b(r3)
+
  00184de0: 00431024 and r2,r2,r3                            |{{f/std|<nowiki>r2 = 2nd loop iteration's TCA status infliction set</nowiki>}}
  00184e20: 90630020 lbu r3,0x0020(r3)
+
  00184de4: a082001b sb r2,0x001b(r4)                         |{{f/store|Store TCA status infliction set without the statuses that might be canceled by another status in the infliction list}}
  00184e24: 01421021 addu r2,r10,r2
+
  00184de8: 28a20005 slti r2,r5,0x0005                        |{{f/std|<nowiki>r2 = 0x01 if loop counter < 0x05</nowiki>}}
  00184e28: 00435021 addu r10,r2,r3
+
  00184dec: 1440fff5 bne r2,r0,0x00184dc4                {{f/eloop|loop while counter < 0x05}}
  00184e2c: 28c20005 slti r2,r6,0x0005
+
  00184df0: 24e70001 addiu r7,r7,0x0001                      |{{f/std|<nowiki>r7 = "Cancels" table counter + 1</nowiki>}}
  00184e30: 1440fff7 bne r2,r0,0x 00184e10
+
  00184df4: 24c60001 addiu r6,r6,0x0001              |{{f/std|<nowiki>r6 = Main loop status counter + 1</nowiki>}}
00184e34: 00000000 nop
+
  00184df8: 28c20028 slti r2,r6,0x0028                |{{f/std|<nowiki>r2 = 0x01 if main loop counter < 0x28</nowiki>}}
  00184e38: 03e00008 jr r31
+
  00184dfc: 1440ffe2 bne r2,r0,0x00184d88        {{f/eloop|Loop 40 times (every status)}}
  00184e3c: 01401021 addu r2,r10,r0
+
00184e00: 25080010 addiu r8,r8,0x0010              |{{f/std|<nowiki>r8 = Main  loop status data offset (+0x10 each iteration)</nowiki>}}
  00184e40: 3c028019 lui r2,0x8019
+
00184e04: 00003021 addu r6,r0,r0                |{{f/std|<nowiki>r6 = 0x00</nowiki>}}
  00184e44: 8c422d90 lw r2,0x2d90(r2)
+
00184e08: 3c048019 lui r4,0x8019                |
  00184e48: 27bdffe8 addiu r29,r29,0xffe8
+
00184e0c: 8c842d90 lw r4,0x2d90(r4)        |{{f/adr|<nowiki>r4 = TCA data pointer</nowiki>}}
  00184e4c: afbf0010 sw r31,0x0010(r29)
+
00184e10: 00000000 nop                      {{f/bloop|LOOP through every TCA infliction and removal byte checking if there's still something to do}}
00184e50: a0400000 sb r0,0x0000(r2)
+
00184e14: 00861821 addu r3,r4,r6                |{{f/std|<nowiki>r3 = TCA data pointer + loop offset</nowiki>}}
  00184e54: 3c038019 lui r3,0x8019
+
00184e18: 24c60001 addiu r6,r6,0x0001          |{{f/std|<nowiki>r6 = loop counter +1</nowiki>}}
  00184e58: 8c632d90 lw r3,0x2d90(r3)
+
00184e1c: 9062001b lbu r2,0x001b(r3)            |{{f/load|<nowiki>r2 = This iteration status infliction set</nowiki>}}
  00184e5c: 34020005 ori r2,r0,0x0005
+
00184e20: 90630020 lbu r3,0x0020(r3)            |{{f/load|<nowiki>r3 = This iteration status removal set</nowiki>}}
00184e60: a0620002 sb r2,0x0002(r3) Store nullified evasion
+
00184e24: 01421021 addu r2,r10,r2              |{{f/std|r2 <> 0x00 if something is inflicted}}
  00184e64: 3c028019 lui r2,0x8019
+
00184e28: 00435021 addu r10,r2,r3              |{{f/std|r10 <> 0x00 if something is inflicted or removed}}
00184e68: 8c422d90 lw r2,0x2d90(r2) target action data
+
00184e2c: 28c20005 slti r2,r6,0x0005            |{{f/std|<nowiki>r2 = 0x01 if counter < 0x05</nowiki>}}
  00184e6c: a4600004 sh r0,0x0004(r3) Store 0 HP damage
+
00184e30: 1440fff7 bne r2,r0,0x00184e10    {{f/eloop|Loop 5 times}}
  00184e70: a460002a sh r0,0x002a(r3) Store 0 hit% (display?)
+
00184e34: 00000000 nop                          |
  00184e74: a4600010 sh r0,0x0010(r3) store steal item
+
00184e38: 03e00008 jr r31                      |
  00184e78: 0c062f3c jal 0x 0018bcf0 Nullification
+
00184e3c: 01401021 addu r2,r10,r0          |{{f/std|Returns r2 <> 0x00 if something is inflicted/removed}}
  00184e7c: a0400025 sb r0,0x0025(r2) Store 0 into attack type
+
=== Notes ===
  00184e80: 0c062f4d jal 0x 0018bd34 Nullify steal item?
+
  00184e84: 00000000 nop
+
If Unit is ridding : remove incompatible statuses from TCA infliction list
  00184e88: 8fbf0010 lw r31,0x0010(r29)
+
  00184e8c: 27bd 0018 addiu r29,r29,0x 0018
+
Handles Frog toggle mechanics (frog units or unfrog frogs)
  00184e90: 03e00008 jr r31
+
00184e94: 00000000 nop
+
Update TCA status infliction list removing :
 
+
  - Target Innates status (no need to inflict)
 
+
  - Target current status that never ends (sets 1,2 and 3)  (no need to inflict)
== Return Locations ==
+
  - Target Immunity (can't be inflicted)
 
+
  - If Target is immortal, removes incompatible status
  00180070: [[Set target for mounted unit, move find item/trap]]
+
 
  00187054: [[Ability Elemental?]] Apply Elemental - Glain
+
Update TCA status removal list removing :
00187e64: [[Formula 01 - 06 Aftermath]]
+
  - Target Innate status (cannot be removed)
001881fc: [[38 (100%)]]
+
  - Status that are not on target (no need to remove)
0018b070: [[Perform reaction abilities]]
+
0018c4c8: [[Main Reaction Routine - performs ability effects]]
+
Update TCA status infliction list (again) removing
0018d9d4: [[Process Expiring Statuses]]
+
  - Every status that can not stack on a status present on the target
0018db70: [[Poison Marsh Routine]]
+
  - Every status that should ben canceled by another status in the infliction list
  0018dca4: [[Traps Routine]]
+
  (done in the Status order from set - 1st is crystal last is death sentence )
  0018dccc: ^^
+
 
0018e104: [[Post Ability Hardcoding?]]
+
Returns r2 <> 0x00 if something is inflicted/removed
  0018e434: [[Store status,modified ENTD for current attack]]
+
=== Return locations ===
 +
'''Battle.bin'''
 +
00180078: [[Set target for mounted unit, move find item/trap]]
 +
0018705c: [[Ability Elemental?]]
 +
00187e6c: [[Formula 01 - 06 Aftermath]]
 +
00188204: [[38 (100%)]]
 +
0018b078: [[Perform reaction abilities]]
 +
0018c4d0: [[Attack_Finalisation_%26_Reaction_Flagging]]
 +
0018d9dc: [[Process Expiring Statuses]]
 +
0018db78: [[Poison Marsh Routine]]
 +
  0018dcac: [[Traps Routine]]
 +
  0018dcd4: [[Traps Routine]]
 +
  0018e10c: [[Post Ability Hardcoding?]]
 +
  0018e43c: [[Store status,modified ENTD for current attack]]

Latest revision as of 13:12, 25 November 2022

00184b24 - 00184e3c  Alternative programmer annotations here :  Modify_Status_Inflictions 

Might remove some status from Target unit current action infliction/removal list : see Notes

Parameters : r4 = input value
                  - if = 0x00 : The whole routine is checked
                  - if <> 0x00 : Only ridder and removal section are checked

Returns : r2 = 0x00 if there is no more status to inflict or remove 

* TCA = Target Current Action
-----------------------------------------------------------------------------------------
00184b24: 00803821 addu r7,r4,r0            |r7 = Input Value
00184b28: 3c028019 lui r2,0x8019            |
00184b2c: 8c422d98 lw r2,0x2d98(r2)         |r2 = Targeted Unit data pointer
00184b30: 00005021 addu r10,r0,r0           |r10 = 0x00 (used after status modification updates)
00184b34: 90430005 lbu r3,0x0005(r2)        |r3 = Targeted Unit ENTD flags
00184b38: 90420182 lbu r2,0x0182(r2)        |r2 = Targeted Unit Mount infos
00184b3c: 00000000 nop                      |
00184b40: 30420080 andi r2,r2,0x0080        |r2 = 0x80 if Targeted Unit is ridding
00184b44: 1040000f beq r2,r0,0x00184b84     #If Targeted Unit is ridding a Unit
00184b48: 30680004 andi r8,r3,0x0004        |r8 = 0x04 if Targeted Unit is immortal
00184b4c: 00003021 addu r6,r0,r0                |r6 = 0x00
00184b50: 3c038019 lui r3,0x8019                @LOOP - update all TCA's status infliction set  to be ridder allowed
00184b54: 8c632d90 lw r3,0x2d90(r3)                 |r3 = TCA data pointer
00184b58: 3c018019 lui r1,0x8019                    |
00184b5c: 00260821 addu r1,r1,r6                    |r1 = 0x80190000 + loop counter
00184b60: 9024f60c lbu r4,-0x09f4(r1)               |r4 = This iteration ridder allowed status set 1
00184b64: 00661821 addu r3,r3,r6                    |r3 = TCA data pointer + loop counter
00184b68: 9062001b lbu r2,0x001b(r3)                |r2 = This iteration TCA status infliction set
00184b6c: 24c60001 addiu r6,r6,0x0001               |r6 = loop counter +1 
00184b70: 00441024 and r2,r2,r4                     |r2 = This iteration status inflcition allowed for ridder
00184b74: a062001b sb r2,0x001b(r3)                 |Store updated TCA status infliction (this iteration set)
00184b78: 28c20005 slti r2,r6,0x0005                |r2 = 0x01 if loop counter < 0x05
00184b7c: 1440fff4 bne r2,r0,0x00184b50         Λ LOOP 5 times (all status sets)
00184b80: 00000000 nop                              |
00184b84: 3c048019 lui r4,0x8019                    |
00184b88: 8c842d90 lw r4,0x2d90(r4)         |r4 = TCA data pointer
00184b8c: 00000000 nop                      |
00184b90: 9083001d lbu r3,0x001d(r4)        |r3 = TCA status infliction 3
00184b94: 00000000 nop                      |
00184b98: 30620002 andi r2,r3,0x0002        |r2 = 0x02 if frog is going to be inflicted
00184b9c: 10400013 beq r2,r0,0x00184bec     #If Frog is going to be inflicted  This section handles the frog toggle mechanic
00184ba0: 00003021 addu r6,r0,r0            |r6 = 0x00
00184ba4: 3c028019 lui r2,0x8019                |r2 = 0x80190000
00184ba8: 8c422d98 lw r2,0x2d98(r2)             |r2 = Targeted Unit data pointer
00184bac: 00000000 nop                          |
00184bb0: 9042005a lbu r2,0x005a(r2)            |r2 = Targeted Unit current status 3
00184bb4: 00000000 nop                          |
00184bb8: 30420002 andi r2,r2,0x0002            |r2 = 0x02 if Targeted Unit is frogged
00184bbc: 1040000b beq r2,r0,0x00184bec         #If Targeted Unit is a frog
00184bc0: 00000000 nop                              |
00184bc4: 14e00009 bne r7,r0,0x00184bec             #If Input Value = 0x00
00184bc8: 306200fd andi r2,r3,0x00fd                    |r2 = All TCA status infliction 3 without Frog
00184bcc: a082001d sb r2,0x001d(r4)                     |Store updated TCA's Status infliction 3
00184bd0: 3c038019 lui r3,0x8019                        |
00184bd4: 8c632d90 lw r3,0x2d90(r3)                     |r3 = TCA's data pointer
00184bd8: 00000000 nop                                  |
00184bdc: 90620022 lbu r2,0x0022(r3)                    |r2 = TCA status removal 3
00184be0: 00000000 nop                                  |
00184be4: 34420002 ori r2,r2,0x0002                     |r2 = TCA Status removal 3 with cancel frog enabled
00184be8: a0620022 sb r2,0x0022(r3)                     |Store updated TCA's Status removal 3
                                             @LOOP throught all status sets
00184bec: 14e00023 bne r7,r0,0x00184c7c         #If Input value = 0x00
00184bf0: 28c20003 slti r2,r6,0x0003                |r2 = 0x01 if loop counter < 0x03
00184bf4: 1040000a beq r2,r0,0x00184c20             #If This iteration set is 1 , 2 or 3 (Thoses don't have a CT)
00184bf8: 00000000 nop                                  |
00184bfc: 3c058019 lui r5,0x8019                        |
00184c00: 8ca52d90 lw r5,0x2d90(r5)                     |r5 = TCA data pointer
00184c04: 3c028019 lui r2,0x8019                        |
00184c08: 8c422d98 lw r2,0x2d98(r2)                     |r2 = Targeted Unit data pointer
00184c0c: 00000000 nop                                  |
00184c10: 00461021 addu r2,r2,r6                        |r2 = Targeted Unit data pointer + this iteration status set offset
00184c14: 90430058 lbu r3,0x0058(r2)                    |r3 = This iteration Targeted Unit current status
00184c18: 0806130f j 0x00184c3c                         >>jump after set 4-5 section
00184c1c: 00a62821 addu r5,r5,r6                        |
00184c20: 3c058019 lui r5,0x8019                    #Else (Status set 4 or 5) Status with a CT
00184c24: 8ca52d90 lw r5,0x2d90(r5)                     |r5 = TCA data pointer
00184c28: 3c028019 lui r2,0x8019                        |
00184c2c: 8c422d98 lw r2,0x2d98(r2)                     |r2 = Targeted Unit data pointer
00184c30: 00a62821 addu r5,r5,r6                        |r5 = TCA data pointer + this iteration offset
00184c34: 00461021 addu r2,r2,r6                        |r2 = Targeted Unit data pointer + this iteration offset
00184c38: 9043004e lbu r3,0x004e(r2)                    |r3 = This iteration Targeted Unit innate status
00184c3c: 90440053 lbu r4,0x0053(r2)                |r4 = This iteration Targeted Unit immunities
00184c40: 90a2001b lbu r2,0x001b(r5)                |r2 = This iteration TCA status infliction set
00184c44: 00641827 nor r3,r3,r4                     |r3 = This iteration Status that can be inflicted to the unit - not innate (always present) nor immune (not inflictable)
00184c48: 00431024 and r2,r2,r3                     |r2 = This iteration TCA status infliction with only inflictable statuses
00184c4c: 1100000b beq r8,r0,0x00184c7c             #If Targeted Unit is immortal
00184c50: a0a2001b sb r2,0x001b(r5)                 |Store this iteration updated status infliction
00184c54: 3c028019 lui r2,0x8019                        |
00184c58: 8c422d90 lw r2,0x2d90(r2)                     |r5 = TCA data pointer
00184c5c: 3c018006 lui r1,0x8006                        |
00184c60: 00260821 addu r1,r1,r6                        |r1 = 0x80060000 + this iteration offset
00184c64: 902362ee lbu r3,0x62ee(r1)                    |r3 = This iteration status not allowed on immortal unit
00184c68: 00461021 addu r2,r2,r6                        |r2 = T
00184c6c: 9044001b lbu r4,0x001b(r2)                    |r4 = This iteration TCA status infliction set
00184c70: 00031827 nor r3,r0,r3                         |r3 = This iteration status allowed on immortal unit
00184c74: 00832024 and r4,r4,r3                         |r4 = This iteration TCA status infliction set allowed on immortal unit
00184c78: a044001b sb r4,0x001b(r2)                     |Store updated Status infliction (ok for immortal)
00184c7c: 3c058019 lui r5,0x8019                |r5 = 0x80190000
00184c80: 8ca52d90 lw r5,0x2d90(r5)             |r5 = TCA data pointer
00184c84: 3c048019 lui r4,0x8019                |
00184c88: 8c842d98 lw r4,0x2d98(r4)             |r4 = Targeted Unit data pointer
00184c8c: 00a62821 addu r5,r5,r6                |r5 = TCA data pointer + this iteration offset
00184c90: 00862021 addu r4,r4,r6                |r4 = Targeted Unit data pointer + this iteration offset
00184c94: 24c60001 addiu r6,r6,0x0001           |r6 = Loop counter + 0x01
00184c98: 9083004e lbu r3,0x004e(r4)            |r3 = This iteration Targeted Unit innate status
00184c9c: 90a20020 lbu r2,0x0020(r5)            |r4 = This iteration TCA status removal set
00184ca0: 908401bb lbu r4,0x01bb(r4)            |r3 = This iteration Targeted Unit inflicted status 
00184ca4: 00031827 nor r3,r0,r3                 |r3 = This iteration set statuses not in the Targeted Unit Innate set (thoses which  are removable)
00184ca8: 00431024 and r2,r2,r3                 |r2 = This iteration TCA status removal set that can be removed from Targeted Unit
00184cac: 00441024 and r2,r2,r4                 |r2 = This iteration TCA status removal set that can be removed and that are on the target (so for example poison will not be removed from a non poisoned unit)
00184cb0: a0a20020 sb r2,0x0020(r5)             |Store updated Status removal set
00184cb4: 28c20005 slti r2,r6,0x0005            |r2 = 0x01 if loop counter < 0x05
00184cb8: 1440ffcc bne r2,r0,0x00184bec     Λ Loop 5 times
00184cbc: 00000000 nop                          |
00184cc0: 14e00051 bne r7,r0,0x0184e08      #If Input value = 0x00
00184cc4: 00003021 addu r6,r0,r0                |r6 = 0x00
00184cc8: 340b0080 ori r11,r0,0x0080            |r11 = 0x80
00184ccc: 3c098006 lui r9,0x8006                |
00184cd0: 25295def addiu r9,r9,0x5def           |r9 = 0x80065de4 + 0x0b - 1st status "can't stack on" data pointer
                                                @MAIN LOOP : loop through all statuses (40 times) - might remove status if Target has an incompatible status (can't stack on tables)                                        
00184cd4: 04c10002 bgez r6,0x00184ce0               #If Status counter < 0x00 (never)
00184cd8: 00c01021 addu r2,r6,r0                    |r2 = Main loop Status counter
00184cdc: 24c20007 addiu r2,r6,0x0007                   |r2 = r6 + 0x07
00184ce0: 000238c3 sra r7,r2,0x03                   |r7 = Status counter/8 = Main loop status set offset
00184ce4: 3c028019 lui r2,0x8019                    |
00184ce8: 8c422d90 lw r2,0x2d90(r2)                 |r2 = TCA data pointer
00184cec: 30c30007 andi r3,r6,0x0007                |r3 = Reminder of Status counter /8 (Status position in his set)
00184cf0: 00471021 addu r2,r2,r7                    |r2 = TCA pointer + Main loop status set offset
00184cf4: 9042001b lbu r2,0x001b(r2)                |r2 = Main loop iteration TCA status infliction 
00184cf8: 006b1807 srav r3,r11,r3                   |r3 = Main loop iteration status bitmask
00184cfc: 00431024 and r2,r2,r3                     |r2 <> 0x00 if this iteration status is going to be inflicted
00184d00: 10400019 beq r2,r0,0x00184d68             #If this iteration status is going to be inflicted
00184d04: 00000000 nop                                  |
00184d08: 00002821 addu r5,r0,r0                        |r5 = 0x00
00184d0c: 00034027 nor r8,r0,r3                         |r8 = bitmask : Every status in this iteration status set without this iteration status
00184d10: 01202021 addu r4,r9,r0                        |r4 = Main loop iteration Status  Start of "Can't stack on" bytes
00184d14: 3c028019 lui r2,0x8019                        @LOOP For Each main loop Status : checks the 5 sets of Target current status looking for statuses present in main loop status can't stack on list
00184d18: 8c422d98 lw r2,0x2d98(r2)                         |r2 = Targeted Unit data pointer
00184d1c: 90830000 lbu r3,0x0000(r4)                        |r3 = 2nd loop iteration "Can't stack On" set
00184d20: 00451021 addu r2,r2,r5                            |r2 = Targeted Unit data pointer + 2nd loop offset
00184d24: 90420058 lbu r2,0x0058(r2)                        |r2 = 2nd loop iteration Targeted Unit  current status set
00184d28: 00000000 nop                                      |
00184d2c: 00431024 and r2,r2,r3                             |r2 <> 0x00 if Target has status(es) that prevent main loop status to be applied
00184d30: 10400009 beq r2,r0,0x00184d58                     #If Target has status(es) preventing 1st loop Status from being applied
00184d34: 24840001 addiu r4,r4,0x0001                       |r4 = "Can't stack on" table offset + 1
00184d38: 3c038019 lui r3,0x8019                                | 
00184d3c: 8c632d90 lw r3,0x2d90(r3)                             |r3 = TCA data pointer
00184d40: 00000000 nop                                          |
00184d44: 00671821 addu r3,r3,r7                                |r3 = TCA data pointer + main loop Status set offset
00184d48: 9062001b lbu r2,0x001b(r3)                            |r2 = TCA 1st loop status infliction set
00184d4c: 00000000 nop                                          |
00184d50: 00481024 and r2,r2,r8                                 |r2 = Main loop  TCA status infliction set without main loop status (removed)
00184d54: a062001b sb r2,0x001b(r3)                             |Store updated TCA status infliction
00184d58: 24a50001 addiu r5,r5,0x0001                       |r5 = 2nd loop counter +1 (Status set offset)
00184d5c: 28a20005 slti r2,r5,0x0005                        |r2 = 0x01 if counter < 0x05
00184d60: 1440ffec bne r2,r0,0x00184d14                 Λ Loop 5 times (each status set)
00184d64: 00000000 nop                                      |
00184d68: 24c60001 addiu r6,r6,0x0001               |r6 = Status counter + 1
00184d6c: 28c20028 slti r2,r6,0x0028                |r2 = 0x01 if 1st loop counter < 0x28
00184d70: 1440ffd8 bne r2,r0,0x00184cd4         Λ Loop 40 times (every status)
00184d74: 25290010 addiu r9,r9,0x0010               |r9 = Status data offset + 0x10
00184d78: 00003021 addu r6,r0,r0                |r6 = 0x00
00184d7c: 34090080 ori r9,r0,0x0080             |r9 = 0x80
00184d80: 3c088006 lui r8,0x8006                |
00184d84: 25085dea addiu r8,r8,0x5dea           |r8 = 0x80065de4 + 0x06 -  1st Status Cancel list data pointer
                                                @MAIN LOOP : loop through all statuses - Checks if the infliction of the status will remove some status that are in theTCA infliction list (cancels tables)                                         
00184d88: 04c10002 bgez r6,0x00184d94               #If Status counter < 0x00 (never)
00184d8c: 00c01021 addu r2,r6,r0                    |r2 = Status counter
00184d90: 24c20007 addiu r2,r6,0x 0007                  |r2 = Status counter +0x07
00184d94: 000238c3 sra r7,r2,0x03                   |r7 = Main loop status set offset = Status counter/8
00184d98: 3c028019 lui r2,0x8019                    |
00184d9c: 8c422d90 lw r2,0x2d90(r2)                 |r2 = TCA data pointer
00184da0: 30c30007 andi r3,r6,0x0007                |r3 = Reminder of Status counter /8 (Status position in his set)
00184da4: 00471021 addu r2,r2,r7                    |r2 = TCA pointer + Main loop status set offset
00184da8: 9042001b lbu r2,0x001b(r2)                |r2 = Main loop iteration TCA status infliction 
00184dac: 00691807 srav r3,r9,r3                    |r3 = Main loop iteration status bitmask
00184db0: 00431024 and r2,r2,r3                     |r2 <> 0x00 if this iteration status is going to be inflicted
00184db4: 1040000f beq r2,r0,0x00184df4             #If Status is going to be inflicted
00184db8: 00000000 nop                                  |
00184dbc: 00002821 addu r5,r0,r0                        |r5 = 0x00
00184dc0: 01003821 addu r7,r8,r0                        |r7 = Main Status 1st set of "Cancels table"
00184dc4: 3c048019 lui r4,0x8019                        @LOOP (5 sets of statuses)
00184dc8: 8c842d90 lw r4,0x2d90(r4)                         |r4 = TCA data pointer
00184dcc: 90e30000 lbu r3,0x0000(r7)                        |r3 = 2nd loop iteration Cancels table set
00184dd0: 00852021 addu r4,r4,r5                            |r4 = TCA data pointer + 2nd loop iteration status set offset
00184dd4: 24a50001 addiu r5,r5,0x0001                       |r5 = 2nd loop counter + 1
00184dd8: 9082001b lbu r2,0x001b(r4)                        |r2 = 2nd loop iteration's TCA status infliction set
00184ddc: 00031827 nor r3,r0,r3                             |r3 = 2nd loop iteration Status that are not in the "cancels" table
00184de0: 00431024 and r2,r2,r3                             |r2 = 2nd loop iteration's TCA status infliction set
00184de4: a082001b sb r2,0x001b(r4)                         |Store TCA status infliction set without the statuses that might be canceled by another status in the infliction list
00184de8: 28a20005 slti r2,r5,0x0005                        |r2 = 0x01 if loop counter < 0x05
00184dec: 1440fff5 bne r2,r0,0x00184dc4                 Λ loop while counter < 0x05
00184df0: 24e70001 addiu r7,r7,0x0001                       |r7 = "Cancels" table counter + 1
00184df4: 24c60001 addiu r6,r6,0x0001               |r6 = Main loop status counter + 1
00184df8: 28c20028 slti r2,r6,0x0028                |r2 = 0x01 if main loop counter < 0x28
00184dfc: 1440ffe2 bne r2,r0,0x00184d88         Λ Loop 40 times (every status)
00184e00: 25080010 addiu r8,r8,0x0010               |r8 = Main  loop status data offset (+0x10 each iteration)
00184e04: 00003021 addu r6,r0,r0                |r6 = 0x00
00184e08: 3c048019 lui r4,0x8019                |
00184e0c: 8c842d90 lw r4,0x2d90(r4)         |r4 = TCA data pointer
00184e10: 00000000 nop                      @LOOP through every TCA infliction and removal byte checking if there's still something to do
00184e14: 00861821 addu r3,r4,r6                |r3 = TCA data pointer + loop offset
00184e18: 24c60001 addiu r6,r6,0x0001           |r6 = loop counter +1
00184e1c: 9062001b lbu r2,0x001b(r3)            |r2 = This iteration status infliction set
00184e20: 90630020 lbu r3,0x0020(r3)            |r3 = This iteration status removal set
00184e24: 01421021 addu r2,r10,r2               |r2 <> 0x00 if something is inflicted
00184e28: 00435021 addu r10,r2,r3               |r10 <> 0x00 if something is inflicted or removed
00184e2c: 28c20005 slti r2,r6,0x0005            |r2 = 0x01 if counter < 0x05
00184e30: 1440fff7 bne r2,r0,0x00184e10     Λ Loop 5 times
00184e34: 00000000 nop                          |
00184e38: 03e00008 jr r31                       |
00184e3c: 01401021 addu r2,r10,r0           |Returns r2 <> 0x00 if something is inflicted/removed

Notes

If Unit is ridding : remove incompatible statuses from TCA infliction list

Handles Frog toggle mechanics (frog units or unfrog frogs)

Update TCA status infliction list removing :
  - Target Innates status (no need to inflict)
  - Target current status that never ends (sets 1,2 and 3)  (no need to inflict)
  - Target Immunity (can't be inflicted)
  - If Target is immortal, removes incompatible status
 
Update TCA status removal list removing :
  - Target Innate status (cannot be removed)
  - Status that are not on target (no need to remove)

Update TCA status infliction list (again) removing
  - Every status that can not stack on a status present on the target
  - Every status that should ben canceled by another status in the infliction list
  (done in the Status order from set - 1st is crystal last is death sentence )
  
Returns r2 <> 0x00 if something is inflicted/removed

Return locations

Battle.bin
00180078: Set target for mounted unit, move find item/trap
0018705c: Ability Elemental?
00187e6c: Formula 01 - 06 Aftermath
00188204: 38 (100%)
0018b078: Perform reaction abilities
0018c4d0: Attack_Finalisation_&_Reaction_Flagging
0018d9dc: Process Expiring Statuses
0018db78: Poison Marsh Routine
0018dcac: Traps Routine
0018dcd4: Traps Routine
0018e10c: Post Ability Hardcoding?
0018e43c: Store status,modified ENTD for current attack