Difference between revisions of "Store status,modified ENTD for current attack"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with "<font face='Courier New'> 0018e310: 27bdffd0 addiu r29,r29,0xffd0 0018e314: afb3001c sw r19,0x001c(r29) 0018e318: 00809821 addu r19,r4,r0 0018e31c: afb60028 sw r22,0x002...")
 
m
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
<font face='Courier New'>
+
-------------------------------------
   
+
Need : r4 = Target unit ID
 +
        r5 = 0x00 or ? used in [[Modify_Status_Inflictions]] (as r4)
 +
  -------------------------------------  [[#18e310Sum|Summary here]]
 
  0018e310: 27bdffd0 addiu r29,r29,0xffd0
 
  0018e310: 27bdffd0 addiu r29,r29,0xffd0
 
  0018e314: afb3001c sw r19,0x001c(r29)
 
  0018e314: afb3001c sw r19,0x001c(r29)
  0018e318: 00809821 addu r19,r4,r0
+
  0018e318: 00809821 addu r19,r4,r0               |r19 = r4 (Target unit ID)
 
  0018e31c: afb60028 sw r22,0x0028(r29)
 
  0018e31c: afb60028 sw r22,0x0028(r29)
  0018e320: 00a0b021 addu r22,r5,r0
+
  0018e320: 00a0b021 addu r22,r5,r0               |r22 = r5 (r0 from two jal investigated)
 
  0018e324: afb10014 sw r17,0x0014(r29)
 
  0018e324: afb10014 sw r17,0x0014(r29)
  0018e328: 00008821 addu r17,r0,r0
+
  0018e328: 00008821 addu r17,r0,r0               |r17 = 0x00 Status counter (counter from 0x00 to 0x27 = 40 loops)
 
  0018e32c: afb50024 sw r21,0x0024(r29)
 
  0018e32c: afb50024 sw r21,0x0024(r29)
  0018e330: 0000a821 addu r21,r0,r0
+
  0018e330: 0000a821 addu r21,r0,r0               |r21 = 0x00 (counter + 0x0010 each turn ?  )
 
  0018e334: afb40020 sw r20,0x0020(r29)
 
  0018e334: afb40020 sw r20,0x0020(r29)
 
  0018e338: 3c148006 lui r20,0x8006
 
  0018e338: 3c148006 lui r20,0x8006
  0018e33c: 26945def addiu r20,r20,0x5def load can't stack on flags 1
+
  0018e33c: 26945def addiu r20,r20,0x5def         |r20 = 1st status "can't stack on" flags 1
  0018e340: 001310c0 sll r2,r19,0x03
+
  0018e340: 001310c0 sll r2,r19,0x03               |r2 = Target ID * 8
  0018e344: 00531023 subu r2,r2,r19
+
  0018e344: 00531023 subu r2,r2,r19               |r2 = Target ID * 7
  0018e348: 00021180 sll r2,r2,0x06
+
  0018e348: 00021180 sll r2,r2,0x06               |r2 = Target ID * 448
 
  0018e34c: 3c038019 lui r3,0x8019
 
  0018e34c: 3c038019 lui r3,0x8019
  0018e350: 246308cc addiu r3,r3,0x08cc
+
  0018e350: 246308cc addiu r3,r3,0x08cc           |r3 = 0x801908cc (1st unit data pointer)
  0018e354: 00432021 addu r4,r2,r3
+
  0018e354: 00432021 addu r4,r2,r3                 |r4 = Target Data pointer
  0018e358: 2463018c addiu r3,r3,0x018c
+
  0018e358: 2463018c addiu r3,r3,0x018c           |r3 = 1st unit action data pointer
  0018e35c: 00431021 addu r2,r2,r3
+
  0018e35c: 00431021 addu r2,r2,r3                 |r2 = Target current action (TCA) data pointer
 
  0018e360: afbf002c sw r31,0x002c(r29)
 
  0018e360: afbf002c sw r31,0x002c(r29)
 
  0018e364: afb20018 sw r18,0x0018(r29)
 
  0018e364: afb20018 sw r18,0x0018(r29)
 
  0018e368: afb00010 sw r16,0x0010(r29)
 
  0018e368: afb00010 sw r16,0x0010(r29)
 
  0018e36c: 3c018019 lui r1,0x8019
 
  0018e36c: 3c018019 lui r1,0x8019
  0018e370: a03338c1 sb r19,0x38c1(r1) Store target ID
+
  0018e370: a03338c1 sb r19,0x38c1(r1)             |<span style="color:darkviolet">Store target ID in current ability section at 0x801938c1</span>
 
  0018e374: 3c018019 lui r1,0x8019
 
  0018e374: 3c018019 lui r1,0x8019
  0018e378: ac242d98 sw r4,0x2d98(r1) store target stats
+
  0018e378: ac242d98 sw r4,0x2d98(r1)             |<span style="color:darkviolet">Store Target data pointer in current ability section at 0x80192d98</span>
 
  0018e37c: 3c018019 lui r1,0x8019
 
  0018e37c: 3c018019 lui r1,0x8019
  0018e380: ac222d90 sw r2,0x2d90(r1) store target action data
+
  0018e380: ac222d90 sw r2,0x2d90(r1)             |<span style="color:darkviolet">Store TCA data pointer in current ability section at 0x80192d90</span>
  0018e384: 06210002 bgez r17,0x0018e390
+
  0018e384: 06210002 bgez r17,0x0018e390           '''@# LOOP 1  - If r17 < 0x00'''  / Branch if >= 0x00    (40 loops - 1 per statuses)  three counter r17 step 0x01 and r20,r21 step 0x10
  0018e388: 02201021 addu r2,r17,r0
+
  0018e388: 02201021 addu r2,r17,r0                   |r2 = r17 (0x00 to 0x27)
  0018e38c: 26220007 addiu r2,r17,0x0007
+
  0018e38c: 26220007 addiu r2,r17,0x0007                   |r2 = r17 + 0x0007 (? never true)
  0018e390: 000280c3 sra r16,r2,0x03
+
  0018e390: 000280c3 sra r16,r2,0x03                   |r16 = r2/8 (Status set offset - will be equal at 0x01 at the 9th loop : check all sets)
  0018e394: 32240007 andi r4,r17,0x0007
+
  0018e394: 32240007 andi r4,r17,0x0007               |r4 = 7 lasts nimbles of r17 (cycle from 0 to 7)
  0018e398: 34030080 ori r3,r0,0x0080
+
  0018e398: 34030080 ori r3,r0,0x0080                 |r3 = 0x80
  0018e39c: 3c028019 lui r2,0x8019
+
  0018e39c: 3c028019 lui r2,0x8019  
  0018e3a0: 8c422d90 lw r2,0x2d90(r2) load target action data
+
  0018e3a0: 8c422d90 lw r2,0x2d90(r2)                 |<span style="color:limegreen">r2 = TCA data pointer</span>
  0018e3a4: 00831807 srav r3,r3,r4
+
  0018e3a4: 00831807 srav r3,r3,r4                     |r3 = r3/2^r4 (r3 = 0x80 0x40 .... 0x01 - check all statuses from each set while looping)
  0018e3a8: 00501021 addu r2,r2,r16
+
  0018e3a8: 00501021 addu r2,r2,r16                   |r2 = r2 + r16 (TCA data pointer + status set offset (0x00 to 0x04 while looping))
  0018e3ac: 9042001b lbu r2,0x001b(r2) load attack status infliction 1
+
  0018e3ac: 9042001b lbu r2,0x001b(r2)                 |<span style="color:limegreen">r2 = CURRENT ATTACK STATUS INFLICTION 1 + set offset (0x001b to 0x001f)</span>
  0018e3b0: 00000000 nop
+
  0018e3b0: 00000000 nop
  0018e3b4: 00431024 and r2,r2,r3
+
  0018e3b4: 00431024 and r2,r2,r3                     |r2 = CHECKED STATUS from checked set (each statuses while looping)
  0018e3b8: 10400076 beq r2,r0,0x0018e594 branch if statii ??
+
  0018e3b8: 10400076 beq r2,r0,0x0018e594             '''#If  checked status is inflicted - current action 0x001b (r2 <> 0x00)''' / Else branch to |<span style="color:firebrick">next status</span>
  0018e3bc: 00609021 addu r18,r3,r0
+
  0018e3bc: 00609021 addu r18,r3,r0                       |r18 = r3 (0x80 to 0x0) = checked status byte
  0018e3c0: 00003821 addu r7,r0,r0
+
  0018e3c0: 00003821 addu r7,r0,r0                         |r7 = 0x00
  0018e3c4: 00002021 addu r4,r0,r0
+
  0018e3c4: 00002021 addu r4,r0,r0                         |r4 = 0x00 - Loop 2 counter
  0018e3c8: 3c068019 lui r6,0x8019
+
  0018e3c8: 3c068019 lui r6,0x8019  
  0018e3cc: 8cc62d98 lw r6,0x2d98(r6) load target stats
+
  0018e3cc: 8cc62d98 lw r6,0x2d98(r6)                     |<span style="color:limegreen">r6 = Target data pointer</span>
  0018e3d0: 02802821 addu r5,r20,r0
+
  0018e3d0: 02802821 addu r5,r20,r0                       |r5 = r20 ("status can't stack on" flag 1) - will increased by 0x0010 each loop (matching statuses table)
  0018e3d4: 00c41021 addu r2,r6,r4
+
  0018e3d4: 00c41021 addu r2,r6,r4                         '''@LOOP 2 ''' - r2 = Target data pointer + loop 2 offset // (5 loops)
  0018e3d8: 904201bb lbu r2,0x01bb(r2) load attack's status infliction list
+
  0018e3d8: 904201bb lbu r2,0x01bb(r2)                         |<span style="color:limegreen">r2 = TARGET INFLICTED STATUS LIST (0x01bb to 0x01bf while looping)</span>
  0018e3dc: 90a30000 lbu r3,0x0000(r5) load can't stack on flags
+
  0018e3dc: 90a30000 lbu r3,0x0000(r5)                         |<span style="color:limegreen">r3 = CHECKED STATUS "status can't stack on" flag 1 (to 5 while looping)</span>
  0018e3e0: 00000000 nop
+
  0018e3e0: 00000000 nop
  0018e3e4: 00431024 and r2,r2,r3
+
  0018e3e4: 00431024 and r2,r2,r3                             |r2 <> 0x00 if Checked status can't stack on some inflicted status from checked list
  0018e3e8: 1440002c bne r2,r0,0x0018e49c branch if statii can't stack?
+
  0018e3e8: 1440002c bne r2,r0,0x0018e49c                     |'''#If r2 = 0x00 - Checked status can stack on checked inflicted status list ''' / Else branch avoiding other checks
  0018e3ec: 24840001 addiu r4,r4,0x0001
+
  0018e3ec: 24840001 addiu r4,r4,0x0001                           |r4 = r4 + 0x01
  0018e3f0: 28820005 slti r2,r4,0x0005
+
  0018e3f0: 28820005 slti r2,r4,0x0005                             |r2 = 0x01 if r4 < 0x0005 (5 loops)
  0018e3f4: 1440fff7 bne r2,r0,0x0018e3d4 Check all statii
+
  0018e3f4: 1440fff7 bne r2,r0,0x0018e3d4                 '''> Loop while r2 <> 0x00'''
  0018e3f8: 24a50001 addiu r5,r5,0x0001
+
  0018e3f8: 24a50001 addiu r5,r5,0x0001                   |r5 = r5 + 0x0001 (next "can't stack on" byte)
  0018e3fc: 14e00065 bne r7,r0,0x0018e594
+
  0018e3fc: 14e00065 bne r7,r0,0x0018e594                 '''W #if r7 = 0x00 stay ''' Else branch to <span style="color:firebrick">next status</span>  (If checked status can't stack, the routine come back here with r7 = 0x01)
  0018e400: 00002021 addu r4,r0,r0
+
  0018e400: 00002021 addu r4,r0,r0                             |r4 = 0x00 (loop 3 counter)
  0018e404: 3c028006 lui r2,0x8006
+
  0018e404: 3c028006 lui r2,0x8006  
  0018e408: 24425dea addiu r2,r2,0x5dea r2 = status cancel's flags
+
  0018e408: 24425dea addiu r2,r2,0x5dea                       |r2 = 1st status cancel's flag 1
  0018e40c: 02a22821 addu r5,r21,r2
+
  0018e40c: 02a22821 addu r5,r21,r2                           |r5 = Checked status cancel's flags 1(r21 = counter with step 0x10)
  0018e410: 3c028019 lui r2,0x8019
+
  0018e410: 3c028019 lui r2,0x8019                         '''@ LOOP 3'''      (store the 5 cancel's status flag from checked status in action removal status)
  0018e414: 8c422d90 lw r2,0x2d90(r2) load target action
+
  0018e414: 8c422d90 lw r2,0x2d90(r2)                         |<span style="color:limegreen">r2 = TCA data pointer</span>
  0018e418: 90a30000 lbu r3,0x0000(r5)
+
  0018e418: 90a30000 lbu r3,0x0000(r5)                         |<span style="color:limegreen">r3 = Checked status cancel's flag 1 to 5 (while looping)</span>
  0018e41c: 00441021 addu r2,r2,r4
+
  0018e41c: 00441021 addu r2,r2,r4                             |r2 = TCA data pointer + offset (0x00 to 0x04)
  0018e420: 24840001 addiu r4,r4,0x0001
+
  0018e420: 24840001 addiu r4,r4,0x0001                       |r4 = r4 + 1
  0018e424: a0430020 sb r3,0x0020(r2) store attack status removal
+
  0018e424: a0430020 sb r3,0x0020(r2)                         |<span style="color:darkviolet">Store canceled status in TCA status removal (1 to 5 while looping)</span>
  0018e428: 28820005 slti r2,r4,0x0005
+
  0018e428: 28820005 slti r2,r4,0x0005                         |r2 = 0x01 while r4 < 0x05 (counter and offset for TCA's status removal 1 to 5)
  0018e42c: 1440fff8 bne r2,r0,0x0018e410 check all statii
+
  0018e42c: 1440fff8 bne r2,r0,0x0018e410                 '''> Loop while r2 <> 0x00 (5 cycles)'''
  0018e430: 24a50001 addiu r5,r5,0x0001
+
  0018e430: 24a50001 addiu r5,r5,0x0001                       |r5 = r5 + 1 (offset for checked status cancel's flags)
  0018e434: 0c0612c9 jal 0x00184b24 Validate status changes
+
  0018e434: 0c0612c9 jal 0x00184b24                       |-->[[Modify_Status_Inflictions|<span style="color:blue">Modify_Status_Inflictions</span>]] (Nullify somes statuses from current action infliction/removal bytes) return r2 = 0x00 if no statuses are inflicted
  0018e438: 02c02021 addu r4,r22,r0
+
  0018e438: 02c02021 addu r4,r22,r0                       |r4 = r22 ???? Inherited from previous routines (checked = 0x00)
  0018e43c: 0c063892 jal 0x0018e248 status infliction checks, transfer last used ability CT
+
  0018e43c: 0c063892 jal 0x0018e248                       |-->[[Inflicted_status_CT_setting,_xfer_last_used_CT|<span style="color:blue">Inflicted_status_CT_setting,_xfer_last_used_CT</span>]] - Check Unit 0x01ac (current action removing status) and update what's needed
  0018e440: 02602021 addu r4,r19,r0
+
  0018e440: 02602021 addu r4,r19,r0                       |r4 = r19 (Target ID)
 
  0018e444: 3c038019 lui r3,0x8019
 
  0018e444: 3c038019 lui r3,0x8019
  0018e448: 8c632d98 lw r3,0x2d98(r3) load target stats
+
  0018e448: 8c632d98 lw r3,0x2d98(r3)                     |<span style="color:limegreen">r3 = Target data pointer </span>
  0018e44c: 00000000 nop
+
  0018e44c: 00000000 nop
  0018e450: 00701821 addu r3,r3,r16
+
  0018e450: 00701821 addu r3,r3,r16                       |r3 = Target data pointer + status set offset (matching checked status)
  0018e454: 907001bb lbu r16,0x01bb(r3) load attack's status infliction list
+
  0018e454: 907001bb lbu r16,0x01bb(r3)                   |<span style="color:limegreen">r16 = Target status infliction list 1 to 5 (while looping - matching checked status)</span>
  0018e458: 02202821 addu r5,r17,r0
+
  0018e458: 02202821 addu r5,r17,r0                       |r5 = r17 (Loop1 counter : 0x00 to 0x27)
  0018e45c: 02121025 or r2,r16,r18
+
  0018e45c: 02121025 or r2,r16,r18                         |r2 = Target status infliction list 1 to 5 updated with checked status
  0018e460: a06201bb sb r2,0x01bb(r3) store modified list?
+
  0018e460: a06201bb sb r2,0x01bb(r3)                     |<span style="color:darkviolet">Store updated status infliction list (unit 0x01bb)</span>
  0018e464: 3c048019 lui r4,0x8019
+
  0018e464: 3c048019 lui r4,0x8019  
  0018e468: 8c842d98 lw r4,0x2d98(r4)
+
  0018e468: 8c842d98 lw r4,0x2d98(r4)                     |<span style="color:limegreen">r4 = Target data pointer</span>
  0018e46c: 0c0176dc jal 0x0005db70 Status CT setting
+
  0018e46c: 0c0176dc jal 0x0005db70                       |-->[[Status_CT_Setting|<span style="color:blue">Status_CT_Setting</span>]]  return r2 = 0x00 (0xffff if DS re-inflicted)
  0018e470: 00003021 addu r6,r0,r0
+
  0018e470: 00003021 addu r6,r0,r0                         |r6 = 0x00
  0018e474: 14400047 bne r2,r0,0x0018e594
+
  0018e474: 14400047 bne r2,r0,0x0018e594                 ''' #If r2 = 0x00 (from jal above)''' / Else branch to next <span style="color:firebrick">next status</span> (r2 = 0x00 if checked status is not death sentence being re-inflicted)
  0018e478: 02121024 and r2,r16,r18
+
  0018e478: 02121024 and r2,r16,r18                           |r2 <> 0x00 if Checked status is already in inflicted list
  0018e47c: 10400009 beq r2,r0,0x0018e4a4
+
  0018e47c: 10400009 beq r2,r0,0x0018e4a4                     '''#If r2 <> 0x00 ( if Checked status is already in inflicted list unit 0x01bb ) ''' / Else branch
  0018e480: 34020001 ori r2,r0,0x0001
+
  0018e480: 34020001 ori r2,r0,0x0001                             |r2 = 0x01
  0018e484: 12220007 beq r17,r2,0x0018e4a4
+
  0018e484: 12220007 beq r17,r2,0x0018e4a4                         '''#If Status is not crystal (LOOP1 counter <> 0x01 )'''  / Else branch
  0018e488: 34020010 ori r2,r0,0x0010
+
  0018e488: 34020010 ori r2,r0,0x0010                                 |r2 = 0x10
  0018e48c: 12220005 beq r17,r2,0x0018e4a4
+
  0018e48c: 12220005 beq r17,r2,0x0018e4a4                             '''#If status is not treasure (LOOP 1 counter <> 0x10)''' / Else branch           
  0018e490: 26240001 addiu r4,r17,0x0001
+
  0018e490: 26240001 addiu r4,r17,0x0001                                   |r4 = LOOP1 counter +1
  0018e494: 0806392b j 0x0018e4ac
+
  0018e494: 0806392b j 0x0018e4ac                                         |'''>> Jump (keeping r5 at 0x0002) to next jal'''
  0018e498: 34050002 ori r5,r0,0x0002
+
  0018e498: 34050002 ori r5,r0,0x0002                                     |r5 = 0x0002 (skip next jal - r5 = 2 if already inflicted and not crystal nor treasure)
  0018e49c: 080638ff j 0x0018e3fc
+
  0018e49c: 080638ff j 0x0018e3fc                                 '''''(( << Jump back '''to r7 check between loop2 and loop3 - Landing site of jump for checked status that "can't stack on" ))''
  0018e4a0: 34070001 ori r7,r0,0x0001
+
  0018e4a0: 34070001 ori r7,r0,0x0001                             ''((r7 = 0x01))  - those two lines are inserted here (island like - ronly reachable from 18e3e8)''
  0018e4a4: 26240001 addiu r4,r17,0x0001
+
  0018e4a4: 26240001 addiu r4,r17,0x0001                       |r4 = LOOP1 counter +1
  0018e4a8: 34050001 ori r5,r0,0x0001
+
  0018e4a8: 34050001 ori r5,r0,0x0001                         |r5 = 0x0001 (status is crystal or treasure or already in
  0018e4ac: 0c063a6f jal 0x0018e9bc Determine if status flags can be enabled
+
  0018e4ac: 0c063a6f jal 0x0018e9bc                           '''E#  E#  E#'''    -->[[Determine_if_Status_Flags_can_be_Enabled|<span style="color:blue">Determine_if_Status_Flags_can_be_Enabled</span>]]
  0018e4b0: 02603021 addu r6,r19,r0
+
  0018e4b0: 02603021 addu r6,r19,r0                           |r6 = Target ID
  0018e4b4: 34020013 ori r2,r0,0x0013
+
  0018e4b4: 34020013 ori r2,r0,0x0013                          |r2 = 0x0013
  0018e4b8: 16220005 bne r17,r2,0x0018e4d0
+
  0018e4b8: 16220005 bne r17,r2,0x0018e4d0                     '''# If Status X is transparent (loop1 counter = 0x13)'''
  0018e4bc: 34050009 ori r5,r0,0x0009
+
  0018e4bc: 34050009 ori r5,r0,0x0009                          |r5 = 0x0009
 
  0018e4c0: 3c028019 lui r2,0x8019
 
  0018e4c0: 3c028019 lui r2,0x8019
  0018e4c4: 8c422d98 lw r2,0x2d98(r2)
+
  0018e4c4: 8c422d98 lw r2,0x2d98(r2)                             |<span style="color:limegreen">r2 = Target data pointer</span>
  0018e4c8: 00000000 nop
+
  0018e4c8: 00000000 nop
  0018e4cc: a0400027 sb r0,0x0027(r2) store not units turn
+
  0018e4cc: a0400027 sb r0,0x0027(r2)                             |<span style="color:darkviolet">Store not target turn ?</span>
  0018e4d0: 12250003 beq r17,r5,0x0018e4e0
+
  0018e4d0: 12250003 beq r17,r5,0x0018e4e0                     '''# If Status X is not invite (loop counter <> 0x09)''' Branch if = 0x09
  0018e4d4: 34020022 ori r2,r0,0x0022
+
  0018e4d4: 34020022 ori r2,r0,0x0022                              |r2 = 0x0022
  0018e4d8: 16220021 bne r17,r2,0x0018e560
+
  0018e4d8: 16220021 bne r17,r2,0x0018e560                         |'''# If status is Charm (loop counter = 0x22)''' Else branch skipping team section
  0018e4dc: 00000000 nop
+
  0018e4dc: 00000000 nop
  0018e4e0: 3c048019 lui r4,0x8019
+
  0018e4e0: 3c048019 lui r4,0x8019                             '''E#'''  (if the code is here status X is invite or charm)
  0018e4e4: 8c842d98 lw r4,0x2d98(r4) load target stats
+
  0018e4e4: 8c842d98 lw r4,0x2d98(r4)                                 |<span style="color:limegreen">r4 = Target data pointer</span>
 
  0018e4e8: 3c028019 lui r2,0x8019
 
  0018e4e8: 3c028019 lui r2,0x8019
  0018e4ec: 8c422d94 lw r2,0x2d94(r2) load attacker stats
+
  0018e4ec: 8c422d94 lw r2,0x2d94(r2)                                 |<span style="color:limegreen">r2 = Attacker data pointer</span>
  0018e4f0: 90830005 lbu r3,0x0005(r4) load targets Team
+
  0018e4f0: 90830005 lbu r3,0x0005(r4)                                 |<span style="color:limegreen">r2 = Target ENTD flag</span>
  0018e4f4: 90420005 lbu r2,0x0005(r2) load team
+
  0018e4f4: 90420005 lbu r2,0x0005(r2)                                 |<span style="color:limegreen">r2 = Attacker ENTD flag</span>
  0018e4f8: 306300cf andi r3,r3,0x00cf check target always/random present + control/ramza/immortal flags
+
  0018e4f8: 306300cf andi r3,r3,0x00cf                                 |r3 = Target ENTD flag with team filter out
  0018e4fc: 30420030 andi r2,r2,0x0030 check attacker's team
+
  0018e4fc: 30420030 andi r2,r2,0x0030                                 |r2 = Attacker's team
  0018e500: 00628025 or r16,r3,r2 r16 = all present flags
+
  0018e500: 00628025 or r16,r3,r2                                     |r16 = Target ENTD flags + Attacker team
  0018e504: 16250016 bne r17,r5,0x0018e560
+
  0018e504: 16250016 bne r17,r5,0x0018e560                             |'''# If Status X is invite (branch if charm)'''
  0018e508: a0900005 sb r16,0x0005(r4) store flags in target
+
  0018e508: a0900005 sb r16,0x0005(r4)                                 |<span style="color:darkviolet">store Target ENTD flags (with new team)</span>
 
  0018e50c: 3c058019 lui r5,0x8019
 
  0018e50c: 3c058019 lui r5,0x8019
  0018e510: 8ca52d98 lw r5,0x2d98(r5) load target stats
+
  0018e510: 8ca52d98 lw r5,0x2d98(r5)                                     |<span style="color:limegreen">r5 = Target data pointer</span>
 
  0018e514: 3c028019 lui r2,0x8019
 
  0018e514: 3c028019 lui r2,0x8019
  0018e518: 8c422d94 lw r2,0x2d94(r2) load attacker stats
+
  0018e518: 8c422d94 lw r2,0x2d94(r2)                                     |<span style="color:limegreen">r2 = Attacker data pointer</span>
 
  0018e51c: 3c048019 lui r4,0x8019
 
  0018e51c: 3c048019 lui r4,0x8019
  0018e520: 8c842d90 lw r4,0x2d90(r4) load target action
+
  0018e520: 8c842d90 lw r4,0x2d90(r4)                                     |<span style="color:limegreen">r4 = Target current action data pointer</span>
  0018e524: 90a301ba lbu r3,0x01ba(r5) load modified ENTD flags
+
  0018e524: 90a301ba lbu r3,0x01ba(r5)                                     |<span style="color:limegreen">r3 = Target  modified ENTD flags</span>
  0018e528: 90420005 lbu r2,0x0005(r2) load attacker ENTD flags
+
  0018e528: 90420005 lbu r2,0x0005(r2)                                     |<span style="color:limegreen">r2 = Attacker ENTD flags</span>
  0018e52c: a480000e sh r0,0x000e(r4) store no reaction
+
  0018e52c: a480000e sh r0,0x000e(r4)                                     |<span style="color:darkviolet">Nullify target reaction</span>
  0018e530: 306300c7 andi r3,r3,0x00c7 remove control flag
+
  0018e530: 306300c7 andi r3,r3,0x00c7                                     |r3 = Target  modified ENTD flags with team and control filterd out
  0018e534: 30420030 andi r2,r2,0x0030
+
  0018e534: 30420030 andi r2,r2,0x0030                                     |r2 = Attacker team
  0018e538: 00628025 or r16,r3,r2
+
  0018e538: 00628025 or r16,r3,r2                                         |r16 = Target  modified ENTD flags without control and with attacker team
  0018e53c: a0b001ba sb r16,0x01ba(r5) store modified ENTD
+
  0018e53c: a0b001ba sb r16,0x01ba(r5)                                     |<span style="color:darkviolet">Store Target modified ENTD (switch team and lost control)</span>
 
  0018e540: 3c028019 lui r2,0x8019
 
  0018e540: 3c028019 lui r2,0x8019
  0018e544: 8c422d98 lw r2,0x2d98(r2) load target stats
+
  0018e544: 8c422d98 lw r2,0x2d98(r2)                                     |<span style="color:limegreen">r2 = Target data pointer</span>
  0018e548: 00000000 nop
+
  0018e548: 00000000 nop
  0018e54c: a04001b8 sb r0,0x01b8(r2) store no auto-battle
+
  0018e54c: a04001b8 sb r0,0x01b8(r2)                                     |<span style="color:darkviolet">Nullify target auto battle flag</span>
 
  0018e550: 3c028019 lui r2,0x8019
 
  0018e550: 3c028019 lui r2,0x8019
  0018e554: 8c422d98 lw r2,0x2d98(r2) load target stats
+
  0018e554: 8c422d98 lw r2,0x2d98(r2)                                     |<span style="color:limegreen">r2 = Target data pointer</span>
  0018e558: 00000000 nop
+
  0018e558: 00000000 nop
  0018e55c: a04001b9 sb r0,0x01b9(r2) store no main target
+
  0018e55c: a04001b9 sb r0,0x01b9(r2)                                     |<span style="color:darkviolet">Nullify target main target ID</span>
 
  0018e560: 3c028019 lui r2,0x8019
 
  0018e560: 3c028019 lui r2,0x8019
  0018e564: 8c422d98 lw r2,0x2d98(r2)
+
  0018e564: 8c422d98 lw r2,0x2d98(r2)                         |<span style="color:limegreen">r2 = Target data pointer</span>
  0018e568: 00000000 nop
+
  0018e568: 00000000 nop
  0018e56c: 904201ba lbu r2,0x01ba(r2) load modified ENTD
+
  0018e56c: 904201ba lbu r2,0x01ba(r2)                         |<span style="color:limegreen">r2 = Target  modified ENTD flags</span>
  0018e570: 00000000 nop
+
  0018e570: 00000000 nop
  0018e574: 30420030 andi r2,r2,0x0030
+
  0018e574: 30420030 andi r2,r2,0x0030                         |r2 = Target team
  0018e578: 14400006 bne r2,r0,0x0018e594 branch if unit = enemy
+
  0018e578: 14400006 bne r2,r0,0x0018e594                     |'''#If target team = 0x00 (player team)'''
  0018e57c: 2622ffff addiu r2,r17,0xffff
+
  0018e57c: 2622ffff addiu r2,r17,0xffff                           |r2 = Loop counter -1
  0018e580: 2c420002 sltiu r2,r2,0x0002
+
  0018e580: 2c420002 sltiu r2,r2,0x0002                           |r2 = 1 if statux X is Crystal or Death
  0018e584: 10400003 beq r2,r0,0x0018e594
+
  0018e584: 10400003 beq r2,r0,0x0018e594                         |'''If Statux X is crystal or death'''
  0018e588: 34020001 ori r2,r0,0x0001
+
  0018e588: 34020001 ori r2,r0,0x0001                                 |r2 = 0x01
 
  0018e58c: 3c018019 lui r1,0x8019
 
  0018e58c: 3c018019 lui r1,0x8019
  0018e590: a0223898 sb r2,0x3898(r1)
+
  0018e590: a0223898 sb r2,0x3898(r1)                                 |<span style="color:darkviolet">store 0x01 at 80193898 (?)</span>
  0018e594: 26b50010 addiu r21,r21,0x0010
+
  0018e594: 26b50010 addiu r21,r21,0x0010             |r21 + 0x10  Status table offset
  0018e598: 26310001 addiu r17,r17,0x0001
+
  0018e598: 26310001 addiu r17,r17,0x0001             |r17 + 0x01 Status counter
  0018e59c: 2a220028 slti r2,r17,0x0028
+
  0018e59c: 2a220028 slti r2,r17,0x0028               |Check counter limit (r2 = 0x00 if above)
  0018e5a0: 1440ff78 bne r2,r0,0x0018e384
+
  0018e5a0: 1440ff78 bne r2,r0,0x0018e384         '''>LOOP1'''
  0018e5a4: 26940010 addiu r20,r20,0x0010
+
  0018e5a4: 26940010 addiu r20,r20,0x0010             |r20 + 0x10 Status table offset
 
  0018e5a8: 3c048019 lui r4,0x8019
 
  0018e5a8: 3c048019 lui r4,0x8019
  0018e5ac: 8c842d98 lw r4,0x2d98(r4)
+
  0018e5ac: 8c842d98 lw r4,0x2d98(r4)                 |<span style="color:limegreen">r4 = Target pointer</span>
  0018e5b0: 0c0179d1 jal 0x0005e744 store current statuses in target
+
  0018e5b0: 0c0179d1 jal 0x0005e744                   |-->[[Store_Current_Statuses|<span style="color:blue">Store_Current_Statuses</span>]] Store Target 0x1bb + Innate target statuses (0x004e) in current target status (0x0058)
  0018e5b4: 00000000 nop
+
  0018e5b4: 00000000 nop
 
  0018e5b8: 8fbf002c lw r31,0x002c(r29)
 
  0018e5b8: 8fbf002c lw r31,0x002c(r29)
 
  0018e5bc: 8fb60028 lw r22,0x0028(r29)
 
  0018e5bc: 8fb60028 lw r22,0x0028(r29)
Line 182: Line 184:
 
  0018e5dc: 03e00008 jr r31
 
  0018e5dc: 03e00008 jr r31
 
  0018e5e0: 00000000 nop
 
  0018e5e0: 00000000 nop
</font>
+
 
 +
==Return location==
 +
0018e120: [[Post_Ability_Hardcoding%3F]]
 +
 
 +
==Summary==
 +
<span id="18e310Sum"></span>
 +
Check each status (loop1 40 cycles)
 +
If check status (status X) is not in Current action 0x001b (to 0x001f) go to next status
 +
  |If Status X can't stack on target inflicted status list (0x01bb to 0x01bf - through loop 2) go to next status (with a weird double jump)
 +
      |Add Every Statuses canceled by Status X in current action status removal (0x0020 to 0x0024)
 +
      |Call a few routine to process those new statuses removal [[Modify_Status_Inflictions]] [[Inflicted_status_CT_setting,_xfer_last_used_CT]]
 +
      |Update Target 0x01bb with status X
 +
      |[[Status_CT_Setting]]
 +
      |[[Determine_if_Status_Flags_can_be_Enabled]] with r5 = 0x01 (enable) or 0x02 (if already inflicted not crystal nor treasure status X - will skip the routine)
 +
      |If Status X is transparent : set unit 0x27 = 0x00 (not unit turn ?)
 +
      |If Status X is invite or charm : deal with team issues
 +
      |If Team is 0x00 (player team) and status X is crystal or dead : store 0x01 at 0x80193898 (? sprite related ? )
 +
[[Store_Current_Statuses]] store target 0x01bb and innate target statuses in current target statuses (0x058)

Latest revision as of 18:35, 5 July 2021

-------------------------------------
Need : r4 = Target unit ID
       r5 = 0x00 or ? used in Modify_Status_Inflictions (as r4)
-------------------------------------  Summary here
0018e310: 27bdffd0 addiu r29,r29,0xffd0
0018e314: afb3001c sw r19,0x001c(r29)
0018e318: 00809821 addu r19,r4,r0                |r19 = r4 (Target unit ID)
0018e31c: afb60028 sw r22,0x0028(r29)
0018e320: 00a0b021 addu r22,r5,r0                |r22 = r5 (r0 from two jal investigated)
0018e324: afb10014 sw r17,0x0014(r29)
0018e328: 00008821 addu r17,r0,r0                |r17 = 0x00 Status counter (counter from 0x00 to 0x27 = 40 loops)
0018e32c: afb50024 sw r21,0x0024(r29)
0018e330: 0000a821 addu r21,r0,r0                |r21 = 0x00 (counter + 0x0010 each turn ?  )
0018e334: afb40020 sw r20,0x0020(r29)
0018e338: 3c148006 lui r20,0x8006
0018e33c: 26945def addiu r20,r20,0x5def          |r20 = 1st status "can't stack on" flags 1
0018e340: 001310c0 sll r2,r19,0x03               |r2 = Target ID * 8
0018e344: 00531023 subu r2,r2,r19                |r2 = Target ID * 7
0018e348: 00021180 sll r2,r2,0x06                |r2 = Target ID * 448
0018e34c: 3c038019 lui r3,0x8019
0018e350: 246308cc addiu r3,r3,0x08cc            |r3 = 0x801908cc (1st unit data pointer)
0018e354: 00432021 addu r4,r2,r3                 |r4 = Target Data pointer
0018e358: 2463018c addiu r3,r3,0x018c            |r3 = 1st unit action data pointer
0018e35c: 00431021 addu r2,r2,r3                 |r2 = Target current action (TCA) data pointer
0018e360: afbf002c sw r31,0x002c(r29)
0018e364: afb20018 sw r18,0x0018(r29)
0018e368: afb00010 sw r16,0x0010(r29)
0018e36c: 3c018019 lui r1,0x8019
0018e370: a03338c1 sb r19,0x38c1(r1)             |Store target ID in current ability section at 0x801938c1
0018e374: 3c018019 lui r1,0x8019
0018e378: ac242d98 sw r4,0x2d98(r1)              |Store Target data pointer in current ability section at 0x80192d98
0018e37c: 3c018019 lui r1,0x8019
0018e380: ac222d90 sw r2,0x2d90(r1)              |Store TCA data pointer in current ability section at 0x80192d90
0018e384: 06210002 bgez r17,0x0018e390           @# LOOP 1  - If r17 < 0x00  / Branch if >= 0x00    (40 loops - 1 per statuses)  three counter r17 step 0x01 and r20,r21 step 0x10
0018e388: 02201021 addu r2,r17,r0                    |r2 = r17 (0x00 to 0x27)
0018e38c: 26220007 addiu r2,r17,0x0007                   |r2 = r17 + 0x0007 (? never true)
0018e390: 000280c3 sra r16,r2,0x03                   |r16 = r2/8 (Status set offset - will be equal at 0x01 at the 9th loop : check all sets)
0018e394: 32240007 andi r4,r17,0x0007                |r4 = 7 lasts nimbles of r17 (cycle from 0 to 7)
0018e398: 34030080 ori r3,r0,0x0080                  |r3 = 0x80
0018e39c: 3c028019 lui r2,0x8019 
0018e3a0: 8c422d90 lw r2,0x2d90(r2)                  |r2 = TCA data pointer
0018e3a4: 00831807 srav r3,r3,r4                     |r3 = r3/2^r4 (r3 = 0x80 0x40 .... 0x01 - check all statuses from each set while looping)
0018e3a8: 00501021 addu r2,r2,r16                    |r2 = r2 + r16 (TCA data pointer + status set offset (0x00 to 0x04 while looping))
0018e3ac: 9042001b lbu r2,0x001b(r2)                 |r2 = CURRENT ATTACK STATUS INFLICTION 1 + set offset (0x001b to 0x001f)
0018e3b0: 00000000 nop  
0018e3b4: 00431024 and r2,r2,r3                      |r2 = CHECKED STATUS from checked set (each statuses while looping)
0018e3b8: 10400076 beq r2,r0,0x0018e594              #If  checked status is inflicted - current action 0x001b (r2 <> 0x00) / Else branch to |next status
0018e3bc: 00609021 addu r18,r3,r0                        |r18 = r3 (0x80 to 0x0) = checked status byte 
0018e3c0: 00003821 addu r7,r0,r0                         |r7 = 0x00
0018e3c4: 00002021 addu r4,r0,r0                         |r4 = 0x00 - Loop 2 counter
0018e3c8: 3c068019 lui r6,0x8019 
0018e3cc: 8cc62d98 lw r6,0x2d98(r6)                      |r6 = Target data pointer
0018e3d0: 02802821 addu r5,r20,r0                        |r5 = r20 ("status can't stack on" flag 1) - will increased by 0x0010 each loop (matching statuses table)
0018e3d4: 00c41021 addu r2,r6,r4                         @LOOP 2  - r2 = Target data pointer + loop 2 offset // (5 loops)
0018e3d8: 904201bb lbu r2,0x01bb(r2)                         |r2 = TARGET INFLICTED STATUS LIST (0x01bb to 0x01bf while looping)
0018e3dc: 90a30000 lbu r3,0x0000(r5)                         |r3 = CHECKED STATUS "status can't stack on" flag 1 (to 5 while looping)
0018e3e0: 00000000 nop  
0018e3e4: 00431024 and r2,r2,r3                              |r2 <> 0x00 if Checked status can't stack on some inflicted status from checked list
0018e3e8: 1440002c bne r2,r0,0x0018e49c                      |#If r2 = 0x00 - Checked status can stack on checked inflicted status list  / Else branch avoiding other checks
0018e3ec: 24840001 addiu r4,r4,0x0001                            |r4 = r4 + 0x01
0018e3f0: 28820005 slti r2,r4,0x0005                             |r2 = 0x01 if r4 < 0x0005 (5 loops)
0018e3f4: 1440fff7 bne r2,r0,0x0018e3d4                  > Loop while r2 <> 0x00
0018e3f8: 24a50001 addiu r5,r5,0x0001                    |r5 = r5 + 0x0001 (next "can't stack on" byte)
0018e3fc: 14e00065 bne r7,r0,0x0018e594                  W #if r7 = 0x00 stay  Else branch to next status  (If checked status can't stack, the routine come back here with r7 = 0x01)
0018e400: 00002021 addu r4,r0,r0                             |r4 = 0x00 (loop 3 counter)
0018e404: 3c028006 lui r2,0x8006 
0018e408: 24425dea addiu r2,r2,0x5dea                        |r2 = 1st status cancel's flag 1
0018e40c: 02a22821 addu r5,r21,r2                            |r5 = Checked status cancel's flags 1(r21 = counter with step 0x10)
0018e410: 3c028019 lui r2,0x8019                         @ LOOP 3      (store the 5 cancel's status flag from checked status in action removal status) 
0018e414: 8c422d90 lw r2,0x2d90(r2)                          |r2 = TCA data pointer
0018e418: 90a30000 lbu r3,0x0000(r5)                         |r3 = Checked status cancel's flag 1 to 5 (while looping)
0018e41c: 00441021 addu r2,r2,r4                             |r2 = TCA data pointer + offset (0x00 to 0x04)
0018e420: 24840001 addiu r4,r4,0x0001                        |r4 = r4 + 1
0018e424: a0430020 sb r3,0x0020(r2)                          |Store canceled status in TCA status removal (1 to 5 while looping)
0018e428: 28820005 slti r2,r4,0x0005                         |r2 = 0x01 while r4 < 0x05 (counter and offset for TCA's status removal 1 to 5)
0018e42c: 1440fff8 bne r2,r0,0x0018e410                  > Loop while r2 <> 0x00 (5 cycles)
0018e430: 24a50001 addiu r5,r5,0x0001                        |r5 = r5 + 1 (offset for checked status cancel's flags)
0018e434: 0c0612c9 jal 0x00184b24                        |-->Modify_Status_Inflictions (Nullify somes statuses from current action infliction/removal bytes) return r2 = 0x00 if no statuses are inflicted
0018e438: 02c02021 addu r4,r22,r0                        |r4 = r22 ???? Inherited from previous routines (checked = 0x00)
0018e43c: 0c063892 jal 0x0018e248                        |-->Inflicted_status_CT_setting,_xfer_last_used_CT - Check Unit 0x01ac (current action removing status) and update what's needed
0018e440: 02602021 addu r4,r19,r0                        |r4 = r19 (Target ID)
0018e444: 3c038019 lui r3,0x8019
0018e448: 8c632d98 lw r3,0x2d98(r3)                      |r3 = Target data pointer 
0018e44c: 00000000 nop  
0018e450: 00701821 addu r3,r3,r16                        |r3 = Target data pointer + status set offset (matching checked status)
0018e454: 907001bb lbu r16,0x01bb(r3)                    |r16 = Target status infliction list 1 to 5 (while looping - matching checked status)
0018e458: 02202821 addu r5,r17,r0                        |r5 = r17 (Loop1 counter : 0x00 to 0x27)
0018e45c: 02121025 or r2,r16,r18                         |r2 = Target status infliction list 1 to 5 updated with checked status 
0018e460: a06201bb sb r2,0x01bb(r3)                      |Store updated status infliction list (unit 0x01bb)
0018e464: 3c048019 lui r4,0x8019 
0018e468: 8c842d98 lw r4,0x2d98(r4)                      |r4 = Target data pointer
0018e46c: 0c0176dc jal 0x0005db70                        |-->Status_CT_Setting  return r2 = 0x00 (0xffff if DS re-inflicted)
0018e470: 00003021 addu r6,r0,r0                         |r6 = 0x00
0018e474: 14400047 bne r2,r0,0x0018e594                   #If r2 = 0x00 (from jal above) / Else branch to next next status (r2 = 0x00 if checked status is not death sentence being re-inflicted)
0018e478: 02121024 and r2,r16,r18                            |r2 <> 0x00 if Checked status is already in inflicted list
0018e47c: 10400009 beq r2,r0,0x0018e4a4                      #If r2 <> 0x00 ( if Checked status is already in inflicted list unit 0x01bb )  / Else branch 
0018e480: 34020001 ori r2,r0,0x0001                              |r2 = 0x01
0018e484: 12220007 beq r17,r2,0x0018e4a4                         #If Status is not crystal (LOOP1 counter <> 0x01 )  / Else branch
0018e488: 34020010 ori r2,r0,0x0010                                  |r2 = 0x10
0018e48c: 12220005 beq r17,r2,0x0018e4a4                             #If status is not treasure (LOOP 1 counter <> 0x10) / Else branch            
0018e490: 26240001 addiu r4,r17,0x0001                                   |r4 = LOOP1 counter +1
0018e494: 0806392b j 0x0018e4ac                                          |>> Jump (keeping r5 at 0x0002) to next jal
0018e498: 34050002 ori r5,r0,0x0002                                      |r5 = 0x0002 (skip next jal - r5 = 2 if already inflicted and not crystal nor treasure)
0018e49c: 080638ff j 0x0018e3fc                                  (( << Jump back to r7 check between loop2 and loop3 - Landing site of jump for checked status that "can't stack on" ))
0018e4a0: 34070001 ori r7,r0,0x0001                              ((r7 = 0x01))  - those two lines are inserted here (island like - ronly reachable from 18e3e8)
0018e4a4: 26240001 addiu r4,r17,0x0001                       |r4 = LOOP1 counter +1 
0018e4a8: 34050001 ori r5,r0,0x0001                          |r5 = 0x0001 (status is crystal or treasure or already in 
0018e4ac: 0c063a6f jal 0x0018e9bc                            E#  E#  E#    -->Determine_if_Status_Flags_can_be_Enabled
0018e4b0: 02603021 addu r6,r19,r0                            |r6 = Target ID
0018e4b4: 34020013 ori r2,r0,0x0013                          |r2 = 0x0013
0018e4b8: 16220005 bne r17,r2,0x0018e4d0                     # If Status X is transparent (loop1 counter = 0x13)
0018e4bc: 34050009 ori r5,r0,0x0009                          |r5 = 0x0009
0018e4c0: 3c028019 lui r2,0x8019
0018e4c4: 8c422d98 lw r2,0x2d98(r2)                              |r2 = Target data pointer
0018e4c8: 00000000 nop  
0018e4cc: a0400027 sb r0,0x0027(r2)                              |Store not target turn ?
0018e4d0: 12250003 beq r17,r5,0x0018e4e0                     # If Status X is not invite (loop counter <> 0x09) Branch if = 0x09
0018e4d4: 34020022 ori r2,r0,0x0022                              |r2 = 0x0022
0018e4d8: 16220021 bne r17,r2,0x0018e560                         |# If status is Charm (loop counter = 0x22) Else branch skipping team section
0018e4dc: 00000000 nop  
0018e4e0: 3c048019 lui r4,0x8019                             E#  (if the code is here status X is invite or charm)
0018e4e4: 8c842d98 lw r4,0x2d98(r4)                                  |r4 = Target data pointer
0018e4e8: 3c028019 lui r2,0x8019
0018e4ec: 8c422d94 lw r2,0x2d94(r2)                                  |r2 = Attacker data pointer
0018e4f0: 90830005 lbu r3,0x0005(r4)                                 |r2 = Target ENTD flag
0018e4f4: 90420005 lbu r2,0x0005(r2)                                 |r2 = Attacker ENTD flag
0018e4f8: 306300cf andi r3,r3,0x00cf                                 |r3 = Target ENTD flag with team filter out
0018e4fc: 30420030 andi r2,r2,0x0030                                 |r2 = Attacker's team
0018e500: 00628025 or r16,r3,r2                                      |r16 = Target ENTD flags + Attacker team
0018e504: 16250016 bne r17,r5,0x0018e560                             |# If Status X is invite (branch if charm)
0018e508: a0900005 sb r16,0x0005(r4)                                 |store Target ENTD flags (with new team)
0018e50c: 3c058019 lui r5,0x8019
0018e510: 8ca52d98 lw r5,0x2d98(r5)                                      |r5 = Target data pointer
0018e514: 3c028019 lui r2,0x8019
0018e518: 8c422d94 lw r2,0x2d94(r2)                                      |r2 = Attacker data pointer
0018e51c: 3c048019 lui r4,0x8019
0018e520: 8c842d90 lw r4,0x2d90(r4)                                      |r4 = Target current action data pointer
0018e524: 90a301ba lbu r3,0x01ba(r5)                                     |r3 = Target  modified ENTD flags
0018e528: 90420005 lbu r2,0x0005(r2)                                     |r2 = Attacker ENTD flags
0018e52c: a480000e sh r0,0x000e(r4)                                      |Nullify target reaction
0018e530: 306300c7 andi r3,r3,0x00c7                                     |r3 = Target  modified ENTD flags with team and control filterd out
0018e534: 30420030 andi r2,r2,0x0030                                     |r2 = Attacker team
0018e538: 00628025 or r16,r3,r2                                          |r16 = Target  modified ENTD flags without control and with attacker team
0018e53c: a0b001ba sb r16,0x01ba(r5)                                     |Store Target modified ENTD (switch team and lost control)
0018e540: 3c028019 lui r2,0x8019
0018e544: 8c422d98 lw r2,0x2d98(r2)                                      |r2 = Target data pointer
0018e548: 00000000 nop  
0018e54c: a04001b8 sb r0,0x01b8(r2)                                      |Nullify target auto battle flag
0018e550: 3c028019 lui r2,0x8019
0018e554: 8c422d98 lw r2,0x2d98(r2)                                      |r2 = Target data pointer
0018e558: 00000000 nop  
0018e55c: a04001b9 sb r0,0x01b9(r2)                                      |Nullify target main target ID
0018e560: 3c028019 lui r2,0x8019
0018e564: 8c422d98 lw r2,0x2d98(r2)                          |r2 = Target data pointer
0018e568: 00000000 nop  
0018e56c: 904201ba lbu r2,0x01ba(r2)                         |r2 = Target  modified ENTD flags
0018e570: 00000000 nop  
0018e574: 30420030 andi r2,r2,0x0030                         |r2 = Target team
0018e578: 14400006 bne r2,r0,0x0018e594                      |#If target team = 0x00 (player team)
0018e57c: 2622ffff addiu r2,r17,0xffff                           |r2 = Loop counter -1
0018e580: 2c420002 sltiu r2,r2,0x0002                            |r2 = 1 if statux X is Crystal or Death
0018e584: 10400003 beq r2,r0,0x0018e594                          |If Statux X is crystal or death
0018e588: 34020001 ori r2,r0,0x0001                                  |r2 = 0x01
0018e58c: 3c018019 lui r1,0x8019
0018e590: a0223898 sb r2,0x3898(r1)                                  |store 0x01 at 80193898 (?)
0018e594: 26b50010 addiu r21,r21,0x0010              |r21 + 0x10  Status table offset
0018e598: 26310001 addiu r17,r17,0x0001              |r17 + 0x01 Status counter
0018e59c: 2a220028 slti r2,r17,0x0028                |Check counter limit (r2 = 0x00 if above)
0018e5a0: 1440ff78 bne r2,r0,0x0018e384          >LOOP1
0018e5a4: 26940010 addiu r20,r20,0x0010              |r20 + 0x10 Status table offset
0018e5a8: 3c048019 lui r4,0x8019
0018e5ac: 8c842d98 lw r4,0x2d98(r4)                  |r4 = Target pointer
0018e5b0: 0c0179d1 jal 0x0005e744                    |-->Store_Current_Statuses Store Target 0x1bb + Innate target statuses (0x004e) in current target status (0x0058)
0018e5b4: 00000000 nop  
0018e5b8: 8fbf002c lw r31,0x002c(r29)
0018e5bc: 8fb60028 lw r22,0x0028(r29)
0018e5c0: 8fb50024 lw r21,0x0024(r29)
0018e5c4: 8fb40020 lw r20,0x0020(r29)
0018e5c8: 8fb3001c lw r19,0x001c(r29)
0018e5cc: 8fb20018 lw r18,0x0018(r29)
0018e5d0: 8fb10014 lw r17,0x0014(r29)
0018e5d4: 8fb00010 lw r16,0x0010(r29)
0018e5d8: 27bd0030 addiu r29,r29,0x0030
0018e5dc: 03e00008 jr r31
0018e5e0: 00000000 nop

Return location

0018e120: Post_Ability_Hardcoding?

Summary


Check each status (loop1 40 cycles)
If check status (status X) is not in Current action 0x001b (to 0x001f) go to next status
  |If Status X can't stack on target inflicted status list (0x01bb to 0x01bf - through loop 2) go to next status (with a weird double jump)
      |Add Every Statuses canceled by Status X in current action status removal (0x0020 to 0x0024)
      |Call a few routine to process those new statuses removal Modify_Status_Inflictions Inflicted_status_CT_setting,_xfer_last_used_CT
      |Update Target 0x01bb with status X
      |Status_CT_Setting
      |Determine_if_Status_Flags_can_be_Enabled with r5 = 0x01 (enable) or 0x02 (if already inflicted not crystal nor treasure status X - will skip the routine)
      |If Status X is transparent : set unit 0x27 = 0x00 (not unit turn ?)
      |If Status X is invite or charm : deal with team issues
      |If Team is 0x00 (player team) and status X is crystal or dead : store 0x01 at 0x80193898 (? sprite related ? )
Store_Current_Statuses store target 0x01bb and innate target statuses in current target statuses (0x058)