Difference between revisions of "Validate Status Changes"
Jump to navigation
Jump to search
m |
|||
Line 242: | Line 242: | ||
00188204: [[38 (100%)]] | 00188204: [[38 (100%)]] | ||
0018b078: [[Perform reaction abilities]] | 0018b078: [[Perform reaction abilities]] | ||
− | 0018c4d0: [[ | + | 0018c4d0: [[Attack_Finalisation_%26_Reaction_Flagging]] |
0018d9dc: [[Process Expiring Statuses]] | 0018d9dc: [[Process Expiring Statuses]] | ||
0018db78: [[Poison Marsh Routine]] | 0018db78: [[Poison Marsh Routine]] |
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