Inflicted status CT setting, xfer last used CT

From Final Fantasy Hacktics Wiki
Revision as of 07:15, 19 October 2024 by Nyzer (talk | contribs) (→‎Return location)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Need r4 = Unit/Target ID
-------------------------------------
0018e248: 27bdffe0 addiu r29,r29,0xffe0
0018e24c: afb20018 sw r18,0x0018(r29)
0018e250: 00809021 addu r18,r4,r0                |r18 = r4 (target ID)
0018e254: 001210c0 sll r2,r18,0x03               |r2 = Target ID * 8
0018e258: 00521023 subu r2,r2,r18                |r2 = Target ID *7
0018e25c: 00021180 sll r2,r2,0x06                |r2 = Target ID * 448 ( = 0x01c0 size of unit data)
0018e260: 3c038019 lui r3,0x8019 
0018e264: 246308cc addiu r3,r3,0x08cc            |r3 = unit1 data pointer
0018e268: afb10014 sw r17,0x0014(r29)
0018e26c: 00438821 addu r17,r2,r3                |r17 = Target data pointer
0018e270: afb00010 sw r16,0x0010(r29)
0018e274: 00008021 addu r16,r0,r0                |r16 = 0x00 Loop counter (step 1)
0018e278: afbf001c sw r31,0x001c(r29) 
0018e27c: 06010002 bgez r16,0x0018e288           |@  # If r16 < 0x00 (never ?)  - 40 Cycles
0018e280: 02001021 addu r2,r16,r0                    |r2 = Loop counter
0018e284: 26020007 addiu r2,r16,0x0007                   |r2 = r16 + 0x0007
0018e288: 000210c3 sra r2,r2,0x03                    |r2 = Counter/8 - Status set offset (0x00 to 0x04 while looping)
0018e28c: 32040007 andi r4,r16,0x0007                |r4 = 0x00 to 0x07 while looping
0018e290: 34030080 ori r3,r0,0x0080                  |r3 = 0x80
0018e294: 02223821 addu r7,r17,r2                    |Target data pointer + status set offset
0018e298: 90e201ac lbu r2,0x01ac(r7)                 |r2 = target current action (TCA) Status Removal byte (1 to 5 while looping)
0018e29c: 00831807 srav r3,r3,r4                     |r3 = 0x80 to 0x01 while looping (allow to scan each statuses from one set)
0018e2a0: 00431024 and r2,r2,r3                      |r2 <> 0 if checked status is going to be removed
0018e2a4: 1040000d beq r2,r0,0x0018e2dc              |#If Checked status is in TCA status removal byte / Else branch to next loop
0018e2a8: 02202021 addu r4,r17,r0                        |r4 = Target data pointer
0018e2ac: 02002821 addu r5,r16,r0                        |r5 = Loop counter
0018e2b0: 34060001 ori r6,r0,0x0001                      |r6 = 0x01
0018e2b4: 90e201bb lbu r2,0x01bb(r7)                     |r2 = TCA inflicted status list (matching checked status)
0018e2b8: 00031827 nor r3,r0,r3                          |r3 = 0x7F to 0xFE (all bytes but the status checked)
0018e2bc: 00431024 and r2,r2,r3                          |r2 = update r2 without checked status (removed)
0018e2c0: 0c0176dc jal 0x0005db70                        |-->Status_CT_setting return r2 = 0x00 
0018e2c4: a0e201bb sb r2,0x01bb(r7)                      |update TCA Inflicted Status list without checked status
0018e2c8: 14400004 bne r2,r0,0x0018e2dc                  |#If r2 = 0x00 / Elsebranch to next loop
0018e2cc: 26040001 addiu r4,r16,0x0001                       |r4 = counter + 1
0018e2d0: 00002821 addu r5,r0,r0                             |r5 = 0
0018e2d4: 0c063a6f jal 0x0018e9bc                            |--> Determine_if_Status_Flags_can_be_Enabled
0018e2d8: 02403021 addu r6,r18,r0                            |r6 = Target ID
0018e2dc: 26100001 addiu r16,r16,0x0001              |r16 = r16 + 1
0018e2e0: 2a020028 slti r2,r16,0x0028                |r2 = 0x01 while r16 < 0x28 
0018e2e4: 1440ffe5 bne r2,r0,0x0018e27c          |> Loop 40 times (Check all Status Removal)
0018e2e8: 00000000
0018e2ec: 0c0179d1 jal 0x0005e744                |-->Store_Current_Statuses  Combine Target innate statuses and Unit 0x01bb and store them in target current status
0018e2f0: 02202021 addu r4,r17,r0                |r4 = target data pointer
0018e2f4: 8fbf001c lw r31,0x001c(r29)
0018e2f8: 8fb20018 lw r18,0x0018(r29)
0018e2fc: 8fb10014 lw r17,0x0014(r29)
0018e300: 8fb00010 lw r16,0x0010(r29)
0018e304: 27bd0020 addiu r29,r29,0x0020
0018e308: 03e00008 jr r31
0018e30c: 00000000


Return location

0018e114: Post_Ability_Hardcoding
0018e444: Store_status,modified_ENTD_for_current_attack

Summary

r4 = Unit ID
Loop checking all statuses one by one
    If status X is in Unit current unit action status removal byte ( Unit data 0x01ac to 0x01b0)
       Update Unit Status inflicted list 0x01bb to 0x01bf removing status X
       Status_CT_Setting Nullify CT of status X (if necessary)
       Determine_if_Status_Flags_can_be_Enabled Update Unit misc data status to add/remove (Unit X misc data 0x148 0x14C 0x150 0x154 )
Store_Current_Statuses Combine Target innate statuses and Unit 0x01bb (to 0x01bf) and store them in target current status