Difference between revisions of "Reaction Target/Hit Calculation"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with " Reaction Target/Hit Calculation 0017cacc: 27bdffd0 addiu r29,r29,0xffd0 0017cad0: 00a04021 addu r8,r5,r0 r8 = Stack Pointer 1 0017cad4: afb1001c sw r17,0x001c(r29) 0017c...")
 
m
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
+
  Set Targets number and targets ID list for most of reaction abilities (except counter abilities and auto potion - not supported here and flag 0x08 enabled)
Reaction Target/Hit Calculation
+
  ------------------------------------------------------------------------------
  0017cacc: 27bdffd0 addiu r29,r29,0xffd0
+
  Parameters: r5 = Attacker misc action data (misc 0x18c) r4 = Attacker ID
  0017cad0: 00a04021 addu r8,r5,r0 r8 = Stack Pointer 1
+
            r6 = Main ability inner stack pointer 1 (r29 0x28)
0017cad4: afb1001c sw r17,0x001c(r29)
+
            r7 = Main ability inner stack pointer 2 (r29 0x10)
0017cad8: 00c08821 addu r17,r6,r0 r17 = Stack Pointer 2
+
 
0017cadc: afb20020 sw r18,0x0020(r29)
+
  Returns :   r2 = 0x01 if reaction is reflect distribute or damage split (failed or not)
0017cae0: 00e09021 addu r18,r7,r0 r18 = Stack Pointer 3
+
            r2 = 0x01 if other reaction with flag 0x04 enabled
  0017cae4: 000410c0 sll r2,r4,0x03 ID * 8
+
            r2 = 0x00 if other reaction with flag 0x08 enabled
  0017cae8: 00441023 subu r2,r2,r4 ID * 7
+
0017caec: 00021180 sll r2,r2,0x06 ID * 448
+
  Store :    If Reflect : Target coordinates in misc attacker data 0x1c 0x1d 0x1e
  0017caf0: afb30024 sw r19,0x0024(r29)
+
            List of targets ID at previous routine r29 0x10
0017caf4: 3c138019 lui r19,0x8019
+
            Number of units hitted at previous routine r29 0x28
  0017caf8: 267308cc addiu r19,r19,0x08cc
+
  ------------------------------------------------------------------------------
0017cafc: 00533821 addu r7,r2,r19 r7 = Unit's Data Pointer
+
  0017cacc: 27bdffd0 addiu r29,r29,0xffd0    |
0017cb00: 3c038019 lui r3,0x8019
+
  0017cad0: 00a04021 addu r8,r5,r0            |{{f/adr|<nowiki>r8 = Attacker misc action data (misc 0x18c)</nowiki>}}
0017cb04: 84632d9c lh r3,0x2d9c(r3) Load Reaction ID
+
  0017cad4: afb1001c sw r17,0x001c(r29)       |
0017cb08: 340201bc ori r2,r0,0x01bc
+
  0017cad8: 00c08821 addu r17,r6,r0           |{{f/adr|<nowiki>r17 = Stack Pointer 1 </nowiki>}}
  0017cb0c: afbf0028 sw r31,0x0028(r29)
+
  0017cadc: afb20020 sw r18,0x0020(r29)      |
  0017cb10: 1062002a beq r3,r2,0x 0017cbbc Branch if ID = Distribute
+
  0017cae0: 00e09021 addu r18,r7,r0          |{{f/adr|<nowiki>r18 = Stack Pointer 2</nowiki>}}
  0017cb14: afb00018 sw r16,0x0018(r29)
+
  0017cae4: 000410c0 sll r2,r4,0x03          |{{f/std|<nowiki>r2 = Attacker ID *8</nowiki>}}
  0017cb18: 286201bd slti r2,r3,0x01bd
+
  0017cae8: 00441023 subu r2,r2,r4            |{{f/std|<nowiki>r2 = Attacker ID *7</nowiki>}}
0017cb1c: 10400005 beq r2,r0,0x 0017cb34 Branch if ID >= MP Switch
+
  0017caec: 00021180 sll r2,r2,0x06          |{{f/std|<nowiki>r2 = Attacker ID *448 - = 0x1c0 (size of units data)</nowiki>}}
  0017cb20: 340201b8 ori r2,r0,0x01b8
+
  0017caf0: afb30024 sw r19,0x0024(r29)       |
  0017cb24: 10620008 beq r3,r2,0x 0017cb48 Branch if ID = Reflect
+
  0017caf4: 3c138019 lui r19,0x8019          |
0017cb28: 00000000 nop
+
  0017caf8: 267308cc addiu r19,r19,0x08cc    |{{f/std|<nowiki>r19 = 0x801908cc (start of 1st unit data)</nowiki>}}
  0017cb2c: 0805f330 j 0x 0017ccc0
+
  0017cafc: 00533821 addu r7,r2,r19          |{{f/adr|<nowiki>r7 = Attacker data pointer</nowiki>}}
0017cb30: 00000000 nop
+
  0017cb00: 3c038019 lui r3,0x8019            |
0017cb34: 340201be ori r2,r0,0x01be
+
  0017cb04: 84632d9c lh r3,0x2d9c(r3)         |{{f/load|<nowiki>r3 = Reaction ID</nowiki>}}
  0017cb38: 10620051 beq r3,r2,0x 0017cc80 Branch if ID = Damage Split
+
  0017cb08: 340201bc ori r2,r0,0x01bc        |{{f/std|<nowiki>r2 = 0x01bc (distribute ability ID)</nowiki>}}
  0017cb3c: 00000000 nop
+
  0017cb0c: afbf0028 sw r31,0x0028(r29)      |
  0017cb40: 0805f330 j 0x 0017ccc0
+
  0017cb10: 1062002a beq r3,r2,0x0017cbbc    {{f/Cond|<nowiki>If Reaction ID <> Distribute</nowiki>}} /Else branch to {{f/loc|<nowiki>distribute section</nowiki>}}
  0017cb44: 00000000 nop
+
  0017cb14: afb00018 sw r16,0x0018(r29)            |{{f/store|<nowiki>  </nowiki>}}
*Reflect*
+
  0017cb18: 286201bd slti r2,r3,0x01bd            |{{f/std|<nowiki>r2 = 1 if reaction ID < 0x1bd (MP switch ID)</nowiki>}}
0017cb48: 90e4017a lbu r4,0x017a(r7) Load Target X
+
0017cb1c: 10400005 beq r2,r0,0x0017cb34          {{f/Cond|<nowiki>If reaction ID < MP switch</nowiki>}}
  0017cb4c: 00000000 nop
+
  0017cb20: 340201b8 ori r2,r0,0x01b8                  |{{f/std|<nowiki>r2 = 0x1b8 (reflect ID)</nowiki>}}
  0017cb50: a104001c sb r4,0x001c(r8) Store Target X
+
  0017cb24: 10620008 beq r3,r2,0x0017cb48              {{f/Cond|<nowiki>If Reaction ID <> reflect</nowiki>}} /Else branch to {{f/loc|<nowiki>reflect section</nowiki>}}
  0017cb54: 90e5017e lbu r5,0x017e(r7) Load Target Y
+
  0017cb28: 00000000 nop                                   |{{f/std|<nowiki>  </nowiki>}}
  0017cb58: 00000000 nop
+
  0017cb2c: 0805f330 j 0x0017ccc0                          {{f/jump|<nowiki>Jump to Other reaction section</nowiki>}}
  0017cb5c: a105001d sb r5,0x001d(r8) Store Target Y
+
0017cb30: 00000000 nop                                  |
  0017cb60: 90e6017c lbu r6,0x017c(r7) Load Target's Map Level
+
  0017cb34: 340201be ori r2,r0,0x01be              {{f/Cond|<nowiki>Else - Reaction >= MP switch</nowiki>}} {{f/std|<nowiki>r2 = 0x1be (Damage split ID)</nowiki>}}
  0017cb64: 0c05f722 jal 0x0017dc88 Get ID of Unit if Tile is Targetable
+
  0017cb38: 10620051 beq r3,r2,0x0017cc80          {{f/Cond|<nowiki>If reaction ID <> Damage split</nowiki>}} / Else branch to {{f/loc|<nowiki>Damage split section</nowiki>}}
  0017cb68: a106001e sb r6,0x001e(r8) Store Target's Map Level
+
  0017cb3c: 00000000 nop                              |{{f/std|<nowiki> </nowiki>}}
0017cb6c: 00408021 addu r16,r2,r0 r16 = Target ID
+
  0017cb40: 0805f330 j 0x0017ccc0                      {{f/jump|<nowiki>Jump to </nowiki>{{f/loc|<nowiki>Other reaction section</nowiki>}}<nowiki></nowiki>}}
  0017cb70: 06000062 bltz r16,0x 0017ccfc Branch if Target is invalid
+
  0017cb44: 00000000 nop                              |
0017cb74: 001010c0 sll r2,r16,0x03 ID * 8
+
  0017cb78: 00501023 subu r2,r2,r16 ID * 7
+
                                            {{f/com|--- REFLECT SECTION ---}}
0017cb7c: 00021180 sll r2,r2,0x06 ID * 448
+
  0017cb48: 90e4017a lbu r4,0x017a(r7)        |{{f/load|<nowiki>r4 = Attacker current action (ACA) Target tile X (position)</nowiki>}}
  0017cb80: 00532821 addu r5,r2,r19 r5 = Target's Data Pointer
+
0017cb4c: 00000000 nop                      |
  0017cb84: 90a30182 lbu r3,0x0182(r5) Load Target's Mount Info
+
  0017cb50: a104001c sb r4,0x001c(r8)        |{{f/store|<nowiki>Store ACA Target tile pos. X in Attacker misc. Current action tile pos. X</nowiki>}}
  0017cb88: 00000000 nop
+
  0017cb54: 90e5017e lbu r5,0x017e(r7)       |{{f/load|<nowiki>r5 = Attacker current action (ACA) Target tile Y (position)</nowiki>}}
  0017cb8c: 30620040 andi r2,r3,0x0040
+
  0017cb58: 00000000 nop                      |
  0017cb90: 10400003 beq r2,r0,0x 0017cba0 Branch if Target is being Ridden
+
  0017cb5c: a105001d sb r5,0x001d(r8)         |{{f/store|<nowiki>Store ACA Target tile pos. Y in Attacker misc. Current action tile pos. Y</nowiki>}}
  0017cb94: 02002021 addu r4,r16,r0 r4 = Target ID
+
  0017cb60: 90e6017c lbu r6,0x017c(r7)        |{{f/load|<nowiki>r6 = Attacker current action (ACA) Target tile elevation</nowiki>}}
  0017cb98: 3070001f andi r16,r3,0x001f r16 = Rider ID
+
  0017cb64: 0c05f722 jal 0x0017dc88          |{{f/jal|Get_ID_of_Unit_if_Tile_is_Targetable|<nowiki>Get_ID_of_Unit_if_Tile_is_Targetable</nowiki>}} retruns r2 = Unit ID if Theres a unit at coordinates / Else r2 < 0x00
  0017cb9c: 02002021 addu r4,r16,r0 r4 = Target ID (Rider)
+
  0017cb68: a106001e sb r6,0x001e(r8)        |{{f/store|<nowiki>Store ACA Target tile elevation in Attacker misc. Current action tile elevation</nowiki>}} {{f/store|<nowiki>Store Target's Map Level</nowiki>}}
  0017cba0: 0c05ef74 jal 0x0017bdd0 Check if Unit can be Targeted
+
  0017cb6c: 00408021 addu r16,r2,r0          |{{f/std|<nowiki>r16 = Target ID (or -0x01 if no units or -0x02 if coordinates are invalid)</nowiki>}}
  0017cba4: 27a50010 addiu r5,r29,0x0010 r5 = Stack Pointer + 0x10
+
  0017cb70: 06000062 bltz r16,0x0017ccfc      {{f/Cond|<nowiki>If Target is valid</nowiki>}} /Else jump to {{f/loc|<nowiki>near end</nowiki>}} setting 0x00 on stack pointer 1 (hit counter) - r2 will be set to 0x01
  0017cba8: 14400054 bne r2,r0,0x 0017ccfc Branch if Unit can't be targeted
+
  0017cb74: 001010c0 sll r2,r16,0x03              |{{f/std|<nowiki>ID * 8</nowiki>}}
  0017cbac: 34020001 ori r2,r0,0x0001 r2 = 1
+
  0017cb78: 00501023 subu r2,r2,r16                |{{f/std|<nowiki>ID * 7</nowiki>}}
  0017cbb0: ae220000 sw r2,0x0000(r17) Store #Targets = 1
+
  0017cb7c: 00021180 sll r2,r2,0x06                |{{f/std|<nowiki>ID * 448 (0x1c0)</nowiki>}}
  0017cbb4: 0805f341 j 0x 0017cd04
+
  0017cb80: 00532821 addu r5,r2,r19                |{{f/adr|<nowiki>r5 = Target's Data Pointer</nowiki>}}
  0017cbb8: a2500000 sb r16,0x0000(r18) Store ID on Stack 3
+
  0017cb84: 90a30182 lbu r3,0x0182(r5)            |{{f/load|<nowiki>r3 = Target mount info</nowiki>}}
*Distribute*
+
0017cb88: 00000000 nop                           |
  0017cbbc: 00008021 addu r16,r0,r0 Hit Counter = 0
+
  0017cb8c: 30620040 andi r2,r3,0x0040            |{{f/std|<nowiki>r2 = 0x40 if target is been ridden / Else 0x00</nowiki>}}
0017cbc0: 00003021 addu r6,r0,r0 Counter = 0
+
  0017cb90: 10400003 beq r2,r0,0x0017cba0          {{f/Cond|<nowiki>If target is being ridden</nowiki>}} /Else branch with r4 = Target ID
  0017cbc4: 340a00ff ori r10,r0,0x00ff r10 = FF
+
  0017cb94: 02002021 addu r4,r16,r0                |{{f/std|<nowiki>r4 = Target ID</nowiki>}}
  0017cbc8: 02604021 addu r8,r19,r0 r8 = Unit Data Pointer
+
  0017cb98: 3070001f andi r16,r3,0x001f                |{{f/std|<nowiki>r16 = Target Rider ID</nowiki>}}
  0017cbcc: 90e20005 lbu r2,0x0005(r7) Load Acting Unit's ENTD Flags
+
  0017cb9c: 02002021 addu r4,r16,r0                    |{{f/std|<nowiki>r4 = Target Rider ID</nowiki>}}
  0017cbd0: 02403821 addu r7,r18,r0 r7 = Stack 3
+
  0017cba0: 0c05ef74 jal 0x0017bdd0                |{{f/jal|Check_if_Unit_can_be_Targeted|<nowiki>Check_if_Unit_can_be_Targeted</nowiki>}} -returns r2 = 0x00 if unit can be targeted (else 0x01)
  0017cbd4: 30490030 andi r9,r2,0x0030 r9 = Acting Unit's Team
+
  0017cba4: 27a50010 addiu r5,r29,0x0010          |{{f/adr|<nowiki>r5 = Stack pointer for above jal </nowiki>}} (routine will store here Target Tile ID - no use here ?)
  0017cbd8: 10c40021 beq r6,r4,0x 0017cc60 Branch if Counter = Acting Unit's ID
+
  0017cba8: 14400054 bne r2,r0,0x0017ccfc          {{f/Cond|<nowiki>If Unit can be targeted</nowiki>}} /Else jump to {{f/loc|<nowiki>near end</nowiki>}} setting 0x00 on stack pointer 1 (hit counter) - r2 will be set to 0x01
  0017cbdc: 01002821 addu r5,r8,r0 r5 = Unit Data Pointer
+
  0017cbac: 34020001 ori r2,r0,0x0001                  |{{f/std|<nowiki>r2 = 0x01</nowiki>}}
  0017cbe0: 90a20001 lbu r2,0x0001(r5) Load Unit's ID
+
  0017cbb0: ae220000 sw r2,0x0000(r17)                |{{f/store|<nowiki>Store 0x01 at stack pointer 1 (number of target ?)</nowiki>}}
  0017cbe4: 00000000 nop
+
  0017cbb4: 0805f341 j 0x0017cd04                      {{f/jump|<nowiki>Jump to </nowiki>{{f/loc|<nowiki>End</nowiki>}}<nowiki> - r2 set to 0x01</nowiki>}}
  0017cbe8: 104a001d beq r2,r10,0x 0017cc60 Branch if Unit doesn't exist
+
0017cbb8: a2500000 sb r16,0x0000(r18)               |{{f/store|<nowiki>Store unit ID on previous routine stack pointer 2</nowiki>}}
  0017cbec: 00000000 nop
+
   
0017cbf0: 90a20182 lbu r2,0x0182(r5) Load Unit's Mount Info
+
                                            {{f/com|--- Distribute section ---}}
  0017cbf4: 00000000 nop
+
  0017cbbc: 00008021 addu r16,r0,r0          |{{f/std|<nowiki>r16 = 0x00 (will be hit counter)</nowiki>}}
0017cbf8: 30420040 andi r2,r2,0x0040
+
  0017cbc0: 00003021 addu r6,r0,r0            |{{f/std|<nowiki>r6 = 0x00 (will be routine counter)</nowiki>}}
  0017cbfc: 14400018 bne r2,r0,0x 0017cc60 Branch if Unit is being ridden
+
  0017cbc4: 340a00ff ori r10,r0,0x00ff        |{{f/std|<nowiki>r10 = 0xff</nowiki>}}
  0017cc00: 00000000 nop
+
  0017cbc8: 02604021 addu r8,r19,r0          |{{f/adr|<nowiki>r8 = 1st Unit Data Pointer (0x801908cc)</nowiki>}}
  0017cc04: 94a30028 lhu r3,0x0028(r5) Load Unit's Current HP
+
  0017cbcc: 90e20005 lbu r2,0x0005(r7)       |{{f/load|<nowiki>r2 = Attacker ENTD flags</nowiki>}}
  0017cc08: 94a2002a lhu r2,0x002a(r5) Load Unit's Max HP
+
  0017cbd0: 02403821 addu r7,r18,r0          |{{f/adr|<nowiki>r7 = Stack pointer 2 (list of units targeted (ID))</nowiki>}}
  0017cc0c: 00000000 nop
+
  0017cbd4: 30490030 andi r9,r2,0x0030        |{{f/std|<nowiki>r9 = Attacker Unit's Team (filtered from ENTD byte)</nowiki>}}
0017cc10: 10620013 beq r3,r2,0x 0017cc60 Branch if Max HP = Current HP
+
0017cbd8: 10c40021 beq r6,r4,0x0017cc60    {{f/bloop|<nowiki>LOOP </nowiki>}} {{f/Cond|<nowiki>If Counter <> acting unit ID</nowiki>}} /Else branch to {{f/loc|<nowiki>next loop</nowiki>}} iteration {{f/std|<nowiki>Check all units</nowiki>}}
0017cc14: 00000000 nop
+
  0017cbdc: 01002821 addu r5,r8,r0                     |{{f/std|<nowiki>r5 = Unit Data Pointer (r8 gains 0x1c0 each loop iteration)</nowiki>}}
  0017cc18: 90a20058 lbu r2,0x0058(r5) Load Unit's Current Statuses 1
+
  0017cbe0: 90a20001 lbu r2,0x0001(r5)                |{{f/load|<nowiki>r2 = Unit's ID</nowiki>}}
0017cc1c: 00000000 nop
+
  0017cbe4: 00000000 nop                              |
0017cc20: 30420064 andi r2,r2,0x0064
+
  0017cbe8: 104a001d beq r2,r10,0x0017cc60            {{f/Cond|<nowiki>If Unit's ID <> 0xff (unit exists)</nowiki>}} /Else branch to {{f/loc|<nowiki>next loop</nowiki>}} iteration
  0017cc24: 1440000e bne r2,r0,0x 0017cc60 Branch if Unit is Jumping/Dead/Crystal
+
  0017cbec: 00000000 nop                                  |{{f/std|<nowiki> </nowiki>}}
  0017cc28: 00000000 nop
+
  0017cbf0: 90a20182 lbu r2,0x0182(r5)                     |{{f/load|<nowiki>r2 = Unit's Mount info</nowiki>}}
0017cc2c: 90a20059 lbu r2,0x0059(r5) Load Unit's Current Statuses 2
+
0017cbf4: 00000000 nop                                  |
  0017cc30: 00000000 nop
+
  0017cbf8: 30420040 andi r2,r2,0x0040                    |{{f/std|<nowiki>r2 = 0x40 if unit is being ridden</nowiki>}}
  0017cc34: 30420081 andi r2,r2,0x0081
+
  0017cbfc: 14400018 bne r2,r0,0x0017cc60                  {{f/Cond|<nowiki>If Unit is not ridden (?)</nowiki>}} /Else branch to {{f/loc|<nowiki>next loop</nowiki>}} iteration
  0017cc38: 14400009 bne r2,r0,0x 0017cc60 Branch if Unit is Treasure/Petrified
+
  0017cc00: 00000000 nop                                       |{{f/std|<nowiki> </nowiki>}}
  0017cc3c: 00000000 nop
+
  0017cc04: 94a30028 lhu r3,0x0028(r5)                        |{{f/load|<nowiki>r3 = Unit's Current HP</nowiki>}}
0017cc40: 90a201ba lbu r2,0x01ba(r5) Load Unit's Modified ENTD Flags
+
  0017cc08: 94a2002a lhu r2,0x002a(r5)                        |{{f/load|<nowiki>r2 =  Unit's Max HP</nowiki>}}
  0017cc44: 00000000 nop
+
0017cc0c: 00000000 nop                                      |
0017cc48: 30420030 andi r2,r2,0x0030
+
  0017cc10: 10620013 beq r3,r2,0x0017cc60                      {{f/Cond|<nowiki>If Unit is not at Max HP</nowiki>}} /Else branch to {{f/loc|<nowiki>next loop</nowiki>}} iteration
  0017cc4c: 14490004 bne r2,r9,0x 0017cc60 Branch if Modified Team != Acting Unit's Team
+
0017cc14: 00000000 nop                                          |{{f/std|<nowiki> </nowiki>}}
0017cc50: afa20010 sw r2,0x0010(r29) Store Unit's Team to Stack
+
  0017cc18: 90a20058 lbu r2,0x0058(r5)                             |{{f/load|<nowiki>r2 = Unit's Current Statuses 1</nowiki>}}
  0017cc54: a0e60000 sb r6,0x0000(r7) Store Counter to Stack 3
+
  0017cc1c: 00000000 nop                                          |
  0017cc58: 24e70001 addiu r7,r7,0x0001 Stack 3 ++
+
  0017cc20: 30420064 andi r2,r2,0x0064                            |{{f/std|<nowiki>r2 <> 0x00 if unit has dead, crystal or is jumping</nowiki>}}
  0017cc5c: 26100001 addiu r16,r16,0x0001 Hit Counter ++
+
  0017cc24: 1440000e bne r2,r0,0x0017cc60                          {{f/Cond|<nowiki>If Unit has neither dead, crystal nor jump</nowiki>}} /Else branch to {{f/loc|<nowiki>next loop</nowiki>}} iteration
0017cc60: 24c60001 addiu r6,r6,0x0001 Counter ++
+
  0017cc28: 00000000 nop                                              |{{f/std|<nowiki> </nowiki>}}
0017cc64: 28c20015 slti r2,r6,0x0015
+
  0017cc2c: 90a20059 lbu r2,0x0059(r5)                                |{{f/load|<nowiki>r2 Unit's Current Statuses 2</nowiki>}}
  0017cc68: 1440ffdb bne r2,r0,0x 0017cbd8 Branch if Counter < 0x15
+
  0017cc30: 00000000 nop                                                  |{{f/std|<nowiki> </nowiki>}}
  0017cc6c: 250801c0 addiu r8,r8,0x01c0 Pointer += 0x1c0
+
  0017cc34: 30420081 andi r2,r2,0x0081                                    |{{f/std|<nowiki>r2 <> 0x00 if unit has petrify or treasure</nowiki>}}
  0017cc70: 3c018019 lui r1,0x8019
+
  0017cc38: 14400009 bne r2,r0,0x0017cc60                                  {{f/Cond|<nowiki>If unit has neither petrify nor treasure</nowiki>}} /Else branch to {{f/loc|<nowiki>next loop</nowiki>}} iteration
  0017cc74: ac303878 sw r16,0x3878(r1) Store Hit Counter
+
  0017cc3c: 00000000 nop                                                      |{{f/std|<nowiki> </nowiki>}}
  0017cc78: 0805f340 j 0x 0017cd00
+
  0017cc40: 90a201ba lbu r2,0x01ba(r5)                                        |{{f/load|<nowiki>r2 = Unit's modified ENTD flags ( 0x1ba )</nowiki>}}
  0017cc7c: ae300000 sw r16,0x0000(r17) Store #Targets = Hit Counter
+
  0017cc44: 00000000 nop                                                       |
*Damage Split*
+
  0017cc48: 30420030 andi r2,r2,0x0030                                        |{{f/std|<nowiki>r2 = Unit's team</nowiki>}}
  0017cc80: 3c038019 lui r3,0x8019
+
  0017cc4c: 14490004 bne r2,r9,0x0017cc60                                      {{f/Cond|<nowiki>If unit's team = attacker team</nowiki>}} /Else branch to {{f/loc|<nowiki>next loop</nowiki>}} iteration
  0017cc84: 8c63f8c8 lw r3,-0x0738(r3) Load Acting Unit's ID
+
  0017cc50: afa20010 sw r2,0x0010(r29)                                        |{{f/store|<nowiki>Store unit team to stack (r29 0x10) (why ? It's unused…)</nowiki>}}
  0017cc88: 00000000 nop
+
  0017cc54: a0e60000 sb r6,0x0000(r7)                                             |{{f/store|<nowiki>Store counter (= unit ID) in stack pointer 2 + offset</nowiki>}} {{f/std|<nowiki> (each time a unit is stored, r7 gain 0x01)</nowiki>}}
  0017cc8c: 000310c0 sll r2,r3,0x03 ID * 8
+
  0017cc58: 24e70001 addiu r7,r7,0x0001                                            |{{f/adr|<nowiki>r7 = Stack pointer + 0x01</nowiki>}}
0017cc90: 00431023 subu r2,r2,r3 ID * 7
+
  0017cc5c: 26100001 addiu r16,r16,0x0001                                          |{{f/std|<nowiki>r16 = Hit counter + 0x01 (number of unit stored in r7)</nowiki>}}
  0017cc94: 00021180 sll r2,r2,0x06 ID * 448
+
  0017cc60: 24c60001 addiu r6,r6,0x0001            |{{f/std|<nowiki>r6 = Loop counter + 0x01</nowiki>}}
  0017cc98: 00532821 addu r5,r2,r19 r5 = Unit's Data Pointer
+
  0017cc64: 28c20015 slti r2,r6,0x0015            |{{f/std|<nowiki>r2 = 0x01 if loop counter < 0x15</nowiki>}}
  0017cc9c: 90a30001 lbu r3,0x0001(r5) Load Unit's ID
+
  0017cc68: 1440ffdb bne r2,r0,0x0017cbd8    {{f/eloop|<nowiki>Loop while counter < 0x15</nowiki>}}
  0017cca0: 340200ff ori r2,r0,0x00ff
+
  0017cc6c: 250801c0 addiu r8,r8,0x01c0            |{{f/adr|<nowiki>r8 = Unit data pointer += 0x1c0 </nowiki>}} {{f/std|<nowiki>(used in loop)</nowiki>}}
  0017cca4: 10620015 beq r3,r2,0x 0017ccfc Branch if Unit doesn't exist
+
0017cc70: 3c018019 lui r1,0x8019            |{{f/std|<nowiki> </nowiki>}}
  0017cca8: 34020001 ori r2,r0,0x0001
+
0017cc74: ac303878 sw r16,0x3878(r1)        |{{f/store|<nowiki>Store number of units hitted at 0x80193878</nowiki>}}
0017ccac: ae220000 sw r2,0x0000(r17) Store #Targets = 1
+
0017cc78: 0805f340 j 0x0017cd00            {{f/jump|<nowiki>Jump to </nowiki>{{f/loc|<nowiki>End</nowiki>}}<nowiki> </nowiki>}} r2 will be set to 0x01
  0017ccb0: 3c028019 lui r2,0x8019
+
0017cc7c: ae300000 sw r16,0x0000(r17)      |{{f/store|<nowiki>Store number of units hitted on stack pointer 1</nowiki>}}
  0017ccb4: 9042f8c8 lbu r2,-0x0738(r2) Load Acting Unit's ID
+
  0017ccb8: 0805f340 j 0x 0017cd00
+
                                            {{f/com|--- Damage split section ---}}
  0017ccbc: a2420000 sb r2,0x0000(r18) Store ID on Stack 3
+
0017cc80: 3c038019 lui r3,0x8019            |
*Other Reactions*
+
0017cc84: 8c63f8c8 lw r3,-0x0738(r3)        |{{f/adr|<nowiki>r3 =  Acting Unit's ID</nowiki>}}
0017ccc0: 3c028019 lui r2,0x8019
+
0017cc88: 00000000 nop                      |
  0017ccc4: 84422d9c lh r2,0x2d9c(r2) Load Reaction ID
+
0017cc8c: 000310c0 sll r2,r3,0x03          |{{f/std|<nowiki>r2 =  Acting Unit's ID *8</nowiki>}} {{f/std|<nowiki>ID * 8</nowiki>}}
0017ccc8: 3c018006 lui r1,0x8006
+
0017cc90: 00431023 subu r2,r2,r3            |{{f/std|<nowiki>r2 =  Acting Unit's ID *7</nowiki>}} {{f/std|<nowiki>ID * 7</nowiki>}}
  0017cccc: 00220821 addu r1,r1,r2
+
0017cc94: 00021180 sll r2,r2,0x06          |{{f/std|<nowiki>r2 =  Acting Unit's ID *448</nowiki>}} {{f/std|<nowiki>ID * 448</nowiki>}}
  0017ccd0: 9023ea2a lbu r3,-0x15d6(r1) Load ? Reaction Flags
+
0017cc98: 00532821 addu r5,r2,r19          |{{f/adr|<nowiki>r5 = Acting Unit's Data Pointer</nowiki>}} {{f/std|<nowiki>r5 = Unit's Data Pointer</nowiki>}}
  0017ccd4: 00000000 nop
+
0017cc9c: 90a30001 lbu r3,0x0001(r5)        |{{f/load|<nowiki>r3 = Acting unit ID (?)</nowiki>}} {{f/load|<nowiki>Load Unit's ID</nowiki>}}
  0017ccd8: 30620004 andi r2,r3,0x0004
+
0017cca0: 340200ff ori r2,r0,0x00ff        |{{f/std|<nowiki>r2 = 0xff</nowiki>}}
  0017ccdc: 10400004 beq r2,r0,0x 0017ccf0 Branch if ? doesn't have 0x4
+
0017cca4: 10620015 beq r3,r2,0x0017ccfc    {{f/Cond|<nowiki>If acting unit exists</nowiki>}} /Else jump to {{f/loc|<nowiki>near end</nowiki>}} setting 0x00 on stack pointer 1 (hit counter) - r2 will be set to 0x01
  0017cce0: 34020001 ori r2,r0,0x0001 r2 = 1
+
0017cca8: 34020001 ori r2,r0,0x0001              |{{f/std|<nowiki>r2 = 0x01</nowiki>}}
*? has 0x4*
+
0017ccac: ae220000 sw r2,0x0000(r17)            |{{f/store|<nowiki>Store 0x01 on stack pointer 1 (1 unit hit)</nowiki>}}
  0017cce4: ae220000 sw r2,0x0000(r17) Store #Targets = 1
+
0017ccb0: 3c028019 lui r2,0x8019                |
0017cce8: 0805f341 j 0x 0017cd04
+
0017ccb4: 9042f8c8 lbu r2,-0x0738(r2)            |{{f/load|<nowiki>r2 = Acting unit ID</nowiki>}}
  0017ccec: a2440000 sb r4,0x0000(r18) Store ID on Stack 3
+
0017ccb8: 0805f340 j 0x0017cd00                  {{f/jump|<nowiki>Jump to </nowiki>{{f/loc|<nowiki>End</nowiki>}}<nowiki> </nowiki>}} r2 will be set to 0x01
  0017ccf0: 30620008 andi r2,r3,0x0008
+
0017ccbc: a2420000 sb r2,0x0000(r18)            |{{f/store|<nowiki>Store Acting unit ID on Stack 2 (hitted unit ID list)</nowiki>}}
0017ccf4: 14400003 bne r2,r0,0x 0017cd04 Branch if ? has 0x8
+
  0017ccf8: 00001021 addu r2,r0,r0 r2 = 0
+
                                            {{f/com|--- Other Reactions ---}}
*? doesn't have 0x8*
+
0017ccc0: 3c028019 lui r2,0x8019            |
  0017ccfc: ae200000 sw r0,0x0000(r17) Store $Targets = 0
+
0017ccc4: 84422d9c lh r2,0x2d9c(r2)        |{{f/load|<nowiki>r2 = Reaction ID</nowiki>}}
  0017cd00: 34020001 ori r2,r0,0x0001 r2 = 1
+
0017ccc8: 3c018006 lui r1,0x8006            |
  0017cd04: 8fbf0028 lw r31,0x0028(r29)
+
0017cccc: 00220821 addu r1,r1,r2            |
  0017cd08: 8fb30024 lw r19,0x0024(r29)
+
0017ccd0: 9023ea2a lbu r3,-0x15d6(r1)      |{{f/load|<nowiki>r3 = Reaction Flags</nowiki>}} {{f/jal|Reaction_Flags|<nowiki>Reaction_Flags</nowiki>}}
  0017cd0c: 8fb20020 lw r18,0x0020(r29)
+
0017ccd4: 00000000 nop                      |
  0017cd10: 8fb1001c lw r17,0x001c(r29)
+
0017ccd8: 30620004 andi r2,r3,0x0004        |{{f/std|<nowiki>r2 = 0x04 if this flag is enabled (target self ?)</nowiki>}}
  0017cd14: 8fb00018 lw r16,0x0018(r29)
+
0017ccdc: 10400004 beq r2,r0,0x0017ccf0    {{f/Cond|<nowiki>If self targetting is enabled</nowiki>}} /Else skip {{f/Cond|<nowiki>Branch if ? doesn't have 0x4</nowiki>}}
  0017cd18: 27bd0030 addiu r29,r29,0x0030
+
0017cce0: 34020001 ori r2,r0,0x0001              |{{f/std|<nowiki>r2 = 0x01</nowiki>}}
  0017cd1c: 03e00008 jr r31
+
0017cce4: ae220000 sw r2,0x0000(r17)            |{{f/store|<nowiki>Store 0x01 on stack pointer 1 (1 unit hit)</nowiki>}} {{f/store|<nowiki>Store #Targets = 1</nowiki>}}
 +
0017cce8: 0805f341 j 0x0017cd04                  {{f/jump|<nowiki>Jump to </nowiki>{{f/loc|<nowiki>End</nowiki>}}<nowiki> </nowiki>}} r2 will is set to 0x01
 +
0017ccec: a2440000 sb r4,0x0000(r18)            |{{f/store|<nowiki>Store Attacker ID on Stack 2 (hitted unit ID)</nowiki>}} {{f/store|<nowiki>Store ID on Stack 3</nowiki>}}
 +
0017ccf0: 30620008 andi r2,r3,0x0008        |{{f/std|<nowiki>r2 = 0x08 is enabled (counter ?)</nowiki>}}
 +
0017ccf4: 14400003 bne r2,r0,0x0017cd04    {{f/Cond|<nowiki>If 0x08 isn't enabled</nowiki>}} / Else Branch to end with r2 = 0x00 (and nothing stored on stack pointer 1)
 +
0017ccf8: 00001021 addu r2,r0,r0            |{{f/std|<nowiki>r2 = 0x00</nowiki>}}
 +
0017ccfc: ae200000 sw r0,0x0000(r17)            |{{f/store|<nowiki>Store 0x00 on stack pointer 1 (0 units hitted)</nowiki>}}
 +
0017cd00: 34020001 ori r2,r0,0x0001              |{{f/std|<nowiki>r2 = 0x01</nowiki>}}
 +
0017cd04: 8fbf0028 lw r31,0x0028(r29)      {{f/Cond|<nowiki>END</nowiki>}}
 +
  0017cd08: 8fb30024 lw r19,0x0024(r29)      
 +
  0017cd0c: 8fb20020 lw r18,0x0020(r29)      
 +
  0017cd10: 8fb1001c lw r17,0x001c(r29)      
 +
  0017cd14: 8fb00018 lw r16,0x0018(r29)      
 +
  0017cd18: 27bd0030 addiu r29,r29,0x0030    
 +
  0017cd1c: 03e00008 jr r31                  
 
  0017cd20: 00000000 nop
 
  0017cd20: 00000000 nop
 +
===Return location===
 +
0017cf34: [[Main_ability_loading_routine%3F]]

Latest revision as of 20:49, 5 December 2021

Set Targets number and targets ID list for most of reaction abilities (except counter abilities and auto potion - not supported here and flag 0x08 enabled)
------------------------------------------------------------------------------
Parameters: r5 = Attacker misc action data (misc 0x18c) r4 = Attacker ID	
            r6 = Main ability inner stack pointer 1 (r29 0x28)	
            r7 = Main ability inner stack pointer 2 (r29 0x10) 
 	
Returns :   r2 = 0x01 if reaction is reflect distribute or damage split (failed or not) 	
            r2 = 0x01 if other reaction with flag 0x04 enabled	
            r2 = 0x00 if other reaction with flag 0x08 enabled
	
Store :     If Reflect : Target coordinates in misc attacker data 0x1c 0x1d 0x1e 
            List of targets ID at previous routine r29 0x10
            Number of units hitted at previous routine r29 0x28
------------------------------------------------------------------------------
0017cacc: 27bdffd0 addiu r29,r29,0xffd0     |
0017cad0: 00a04021 addu r8,r5,r0            |r8 = Attacker misc action data (misc 0x18c)
0017cad4: afb1001c sw r17,0x001c(r29)       |
0017cad8: 00c08821 addu r17,r6,r0           |r17 = Stack Pointer 1 
0017cadc: afb20020 sw r18,0x0020(r29)       |
0017cae0: 00e09021 addu r18,r7,r0           |r18 = Stack Pointer 2
0017cae4: 000410c0 sll r2,r4,0x03           |r2 = Attacker ID *8
0017cae8: 00441023 subu r2,r2,r4            |r2 = Attacker ID *7
0017caec: 00021180 sll r2,r2,0x06           |r2 = Attacker ID *448  - = 0x1c0 (size of units data)
0017caf0: afb30024 sw r19,0x0024(r29)       |
0017caf4: 3c138019 lui r19,0x8019           |
0017caf8: 267308cc addiu r19,r19,0x08cc     |r19 = 0x801908cc (start of 1st unit data)
0017cafc: 00533821 addu r7,r2,r19           |r7 = Attacker data pointer
0017cb00: 3c038019 lui r3,0x8019            |
0017cb04: 84632d9c lh r3,0x2d9c(r3)         |r3 = Reaction ID
0017cb08: 340201bc ori r2,r0,0x01bc         |r2 = 0x01bc (distribute ability ID)
0017cb0c: afbf0028 sw r31,0x0028(r29)       |
0017cb10: 1062002a beq r3,r2,0x0017cbbc     #If Reaction ID <> Distribute /Else branch to distribute section
0017cb14: afb00018 sw r16,0x0018(r29)            |  
0017cb18: 286201bd slti r2,r3,0x01bd             |r2 = 1 if reaction ID < 0x1bd (MP switch ID)
0017cb1c: 10400005 beq r2,r0,0x0017cb34          #If reaction ID < MP switch
0017cb20: 340201b8 ori r2,r0,0x01b8                  |r2 = 0x1b8 (reflect ID)
0017cb24: 10620008 beq r3,r2,0x0017cb48              #If Reaction ID <> reflect /Else branch to reflect section
0017cb28: 00000000 nop                                   |  
0017cb2c: 0805f330 j 0x0017ccc0                          >>Jump to Other reaction section
0017cb30: 00000000 nop                                   |
0017cb34: 340201be ori r2,r0,0x01be              #Else - Reaction >= MP switch r2 = 0x1be (Damage split ID)
0017cb38: 10620051 beq r3,r2,0x0017cc80          #If reaction ID <> Damage split / Else branch to Damage split section
0017cb3c: 00000000 nop                               |  
0017cb40: 0805f330 j 0x0017ccc0                      >>Jump to Other reaction section
0017cb44: 00000000 nop                               |

                                            --- REFLECT SECTION ---
0017cb48: 90e4017a lbu r4,0x017a(r7)        |r4 = Attacker current action (ACA) Target tile X (position)
0017cb4c: 00000000 nop                      |
0017cb50: a104001c sb r4,0x001c(r8)         |Store ACA Target tile pos. X in Attacker misc. Current action tile pos. X
0017cb54: 90e5017e lbu r5,0x017e(r7)        |r5 = Attacker current action (ACA) Target tile Y (position)
0017cb58: 00000000 nop                      |
0017cb5c: a105001d sb r5,0x001d(r8)         |Store ACA Target tile pos. Y in Attacker misc. Current action tile pos. Y
0017cb60: 90e6017c lbu r6,0x017c(r7)        |r6 = Attacker current action (ACA) Target tile elevation
0017cb64: 0c05f722 jal 0x0017dc88           |-->Get_ID_of_Unit_if_Tile_is_Targetable retruns r2 = Unit ID if Theres a unit at coordinates / Else r2 < 0x00
0017cb68: a106001e sb r6,0x001e(r8)         |Store ACA Target tile elevation in Attacker misc. Current action tile elevation Store Target's Map Level
0017cb6c: 00408021 addu r16,r2,r0           |r16 = Target ID (or -0x01 if no units or -0x02 if coordinates are invalid)
0017cb70: 06000062 bltz r16,0x0017ccfc      #If Target is valid /Else jump to near end setting 0x00 on stack pointer 1 (hit counter) - r2 will be set to 0x01
0017cb74: 001010c0 sll r2,r16,0x03               |ID * 8
0017cb78: 00501023 subu r2,r2,r16                |ID * 7
0017cb7c: 00021180 sll r2,r2,0x06                |ID * 448 (0x1c0)
0017cb80: 00532821 addu r5,r2,r19                |r5 = Target's Data Pointer
0017cb84: 90a30182 lbu r3,0x0182(r5)             |r3 = Target mount info
0017cb88: 00000000 nop                           |
0017cb8c: 30620040 andi r2,r3,0x0040             |r2 = 0x40 if target is been ridden / Else 0x00
0017cb90: 10400003 beq r2,r0,0x0017cba0          #If target is being ridden /Else branch with r4 = Target ID
0017cb94: 02002021 addu r4,r16,r0                |r4 = Target ID
0017cb98: 3070001f andi r16,r3,0x001f                |r16 = Target Rider ID
0017cb9c: 02002021 addu r4,r16,r0                    |r4 = Target Rider ID
0017cba0: 0c05ef74 jal 0x0017bdd0                |-->Check_if_Unit_can_be_Targeted -returns r2 = 0x00 if unit can be targeted (else 0x01)
0017cba4: 27a50010 addiu r5,r29,0x0010           |r5 = Stack pointer for above jal  (routine will store here Target Tile ID - no use here ?)
0017cba8: 14400054 bne r2,r0,0x0017ccfc          #If Unit can be targeted /Else jump to near end setting 0x00 on stack pointer 1 (hit counter) - r2 will be set to 0x01
0017cbac: 34020001 ori r2,r0,0x0001                  |r2 = 0x01
0017cbb0: ae220000 sw r2,0x0000(r17)                 |Store 0x01 at stack pointer 1 (number of target ?)
0017cbb4: 0805f341 j 0x0017cd04                      >>Jump to End - r2 set to 0x01
0017cbb8: a2500000 sb r16,0x0000(r18)                |Store unit ID  on previous routine stack pointer 2

                                            --- Distribute section ---
0017cbbc: 00008021 addu r16,r0,r0           |r16 = 0x00 (will be hit counter)
0017cbc0: 00003021 addu r6,r0,r0            |r6 = 0x00 (will be routine counter)
0017cbc4: 340a00ff ori r10,r0,0x00ff        |r10 = 0xff
0017cbc8: 02604021 addu r8,r19,r0           |r8 = 1st Unit Data Pointer (0x801908cc)
0017cbcc: 90e20005 lbu r2,0x0005(r7)        |r2 = Attacker ENTD flags
0017cbd0: 02403821 addu r7,r18,r0           |r7 = Stack pointer 2 (list of units targeted (ID))
0017cbd4: 30490030 andi r9,r2,0x0030        |r9 = Attacker Unit's Team (filtered from ENTD byte)
0017cbd8: 10c40021 beq r6,r4,0x0017cc60     @LOOP  #If Counter <> acting unit ID /Else branch to next loop iteration Check all units
0017cbdc: 01002821 addu r5,r8,r0                     |r5 = Unit Data Pointer (r8 gains 0x1c0 each loop iteration)
0017cbe0: 90a20001 lbu r2,0x0001(r5)                 |r2 = Unit's ID
0017cbe4: 00000000 nop                               |
0017cbe8: 104a001d beq r2,r10,0x0017cc60             #If Unit's ID <> 0xff (unit exists) /Else branch to next loop iteration
0017cbec: 00000000 nop                                   | 
0017cbf0: 90a20182 lbu r2,0x0182(r5)                     |r2 = Unit's Mount info
0017cbf4: 00000000 nop                                   |
0017cbf8: 30420040 andi r2,r2,0x0040                     |r2 = 0x40 if unit is being ridden
0017cbfc: 14400018 bne r2,r0,0x0017cc60                  #If Unit is not ridden (?) /Else branch to next loop iteration
0017cc00: 00000000 nop                                       | 
0017cc04: 94a30028 lhu r3,0x0028(r5)                         |r3 = Unit's Current HP
0017cc08: 94a2002a lhu r2,0x002a(r5)                         |r2 =  Unit's Max HP
0017cc0c: 00000000 nop                                       |
0017cc10: 10620013 beq r3,r2,0x0017cc60                      #If Unit is not at Max HP /Else branch to next loop iteration
0017cc14: 00000000 nop                                           | 
0017cc18: 90a20058 lbu r2,0x0058(r5)                             |r2 = Unit's Current Statuses 1
0017cc1c: 00000000 nop                                           |
0017cc20: 30420064 andi r2,r2,0x0064                             |r2 <> 0x00 if unit has dead, crystal or is jumping
0017cc24: 1440000e bne r2,r0,0x0017cc60                          #If Unit has neither dead, crystal nor jump /Else branch to next loop iteration
0017cc28: 00000000 nop                                               | 
0017cc2c: 90a20059 lbu r2,0x0059(r5)                                 |r2 =  Unit's Current Statuses 2
0017cc30: 00000000 nop                                                   | 
0017cc34: 30420081 andi r2,r2,0x0081                                     |r2 <> 0x00 if unit has petrify or treasure
0017cc38: 14400009 bne r2,r0,0x0017cc60                                  #If unit has neither petrify nor treasure /Else branch to next loop iteration
0017cc3c: 00000000 nop                                                       | 
0017cc40: 90a201ba lbu r2,0x01ba(r5)                                         |r2 = Unit's modified ENTD flags ( 0x1ba )
0017cc44: 00000000 nop                                                       |
0017cc48: 30420030 andi r2,r2,0x0030                                         |r2 = Unit's team
0017cc4c: 14490004 bne r2,r9,0x0017cc60                                      #If unit's team = attacker team /Else branch to next loop iteration
0017cc50: afa20010 sw r2,0x0010(r29)                                         |Store unit team to stack (r29 0x10) (why ? It's unused…)
0017cc54: a0e60000 sb r6,0x0000(r7)                                              |Store counter (= unit ID) in stack pointer 2 + offset  (each time a unit is stored, r7 gain 0x01)
0017cc58: 24e70001 addiu r7,r7,0x0001                                            |r7 = Stack pointer + 0x01
0017cc5c: 26100001 addiu r16,r16,0x0001                                          |r16 = Hit counter + 0x01 (number of unit stored in r7)
0017cc60: 24c60001 addiu r6,r6,0x0001            |r6 = Loop counter + 0x01
0017cc64: 28c20015 slti r2,r6,0x0015             |r2 = 0x01 if loop counter < 0x15
0017cc68: 1440ffdb bne r2,r0,0x0017cbd8     Λ Loop while counter < 0x15
0017cc6c: 250801c0 addiu r8,r8,0x01c0            |r8 = Unit data pointer += 0x1c0  (used in loop)
0017cc70: 3c018019 lui r1,0x8019            | 
0017cc74: ac303878 sw r16,0x3878(r1)        |Store number of units hitted at 0x80193878
0017cc78: 0805f340 j 0x0017cd00             >>Jump to End  r2 will be set to 0x01
0017cc7c: ae300000 sw r16,0x0000(r17)       |Store number of units hitted on stack pointer 1

                                            --- Damage split section ---
0017cc80: 3c038019 lui r3,0x8019            |
0017cc84: 8c63f8c8 lw r3,-0x0738(r3)        |r3 =  Acting Unit's ID
0017cc88: 00000000 nop                      |
0017cc8c: 000310c0 sll r2,r3,0x03           |r2 =  Acting Unit's ID *8 ID * 8
0017cc90: 00431023 subu r2,r2,r3            |r2 =  Acting Unit's ID *7 ID * 7
0017cc94: 00021180 sll r2,r2,0x06           |r2 =  Acting Unit's ID *448 ID * 448
0017cc98: 00532821 addu r5,r2,r19           |r5 = Acting Unit's Data Pointer r5 = Unit's Data Pointer
0017cc9c: 90a30001 lbu r3,0x0001(r5)        |r3 = Acting unit ID (?) Load Unit's ID
0017cca0: 340200ff ori r2,r0,0x00ff         |r2 = 0xff
0017cca4: 10620015 beq r3,r2,0x0017ccfc     #If acting unit exists /Else jump to near end setting 0x00 on stack pointer 1 (hit counter) - r2 will be set to 0x01
0017cca8: 34020001 ori r2,r0,0x0001              |r2 = 0x01
0017ccac: ae220000 sw r2,0x0000(r17)             |Store 0x01 on stack pointer 1 (1 unit hit)
0017ccb0: 3c028019 lui r2,0x8019                 |
0017ccb4: 9042f8c8 lbu r2,-0x0738(r2)            |r2 = Acting unit ID
0017ccb8: 0805f340 j 0x0017cd00                  >>Jump to End  r2 will be set to 0x01
0017ccbc: a2420000 sb r2,0x0000(r18)             |Store Acting unit ID on Stack 2 (hitted unit ID list)

                                            --- Other Reactions ---
0017ccc0: 3c028019 lui r2,0x8019            |
0017ccc4: 84422d9c lh r2,0x2d9c(r2)         |r2 = Reaction ID
0017ccc8: 3c018006 lui r1,0x8006            |
0017cccc: 00220821 addu r1,r1,r2            |
0017ccd0: 9023ea2a lbu r3,-0x15d6(r1)       |r3 = Reaction Flags -->Reaction_Flags
0017ccd4: 00000000 nop                      |
0017ccd8: 30620004 andi r2,r3,0x0004        |r2 = 0x04 if this flag is enabled (target self ?)
0017ccdc: 10400004 beq r2,r0,0x0017ccf0     #If self targetting is enabled /Else skip #Branch if ? doesn't have 0x4
0017cce0: 34020001 ori r2,r0,0x0001              |r2 = 0x01 
0017cce4: ae220000 sw r2,0x0000(r17)             |Store 0x01 on stack pointer 1 (1 unit hit) Store #Targets = 1
0017cce8: 0805f341 j 0x0017cd04                  >>Jump to End  r2 will is set to 0x01
0017ccec: a2440000 sb r4,0x0000(r18)             |Store Attacker ID on Stack 2 (hitted unit ID) Store ID on Stack 3
0017ccf0: 30620008 andi r2,r3,0x0008        |r2 = 0x08 is enabled (counter ?)
0017ccf4: 14400003 bne r2,r0,0x0017cd04     #If 0x08 isn't enabled / Else Branch to end with r2 = 0x00 (and nothing stored on stack pointer 1)
0017ccf8: 00001021 addu r2,r0,r0            |r2 = 0x00
0017ccfc: ae200000 sw r0,0x0000(r17)             |Store 0x00 on stack pointer 1 (0 units hitted)
0017cd00: 34020001 ori r2,r0,0x0001              |r2 = 0x01
0017cd04: 8fbf0028 lw r31,0x0028(r29)       #END
0017cd08: 8fb30024 lw r19,0x0024(r29)       
0017cd0c: 8fb20020 lw r18,0x0020(r29)       
0017cd10: 8fb1001c lw r17,0x001c(r29)       
0017cd14: 8fb00018 lw r16,0x0018(r29)       
0017cd18: 27bd0030 addiu r29,r29,0x0030     
0017cd1c: 03e00008 jr r31                   
0017cd20: 00000000 nop

Return location

0017cf34: Main_ability_loading_routine?