Reaction Target/Hit Calculation
Jump to navigation
Jump to search
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) 0017cad8: 00c08821 addu r17,r6,r0 r17 = Stack Pointer 2 0017cadc: afb20020 sw r18,0x0020(r29) 0017cae0: 00e09021 addu r18,r7,r0 r18 = Stack Pointer 3 0017cae4: 000410c0 sll r2,r4,0x03 ID * 8 0017cae8: 00441023 subu r2,r2,r4 ID * 7 0017caec: 00021180 sll r2,r2,0x06 ID * 448 0017caf0: afb30024 sw r19,0x0024(r29) 0017caf4: 3c138019 lui r19,0x8019 0017caf8: 267308cc addiu r19,r19,0x08cc 0017cafc: 00533821 addu r7,r2,r19 r7 = Unit's Data Pointer 0017cb00: 3c038019 lui r3,0x8019 0017cb04: 84632d9c lh r3,0x2d9c(r3) Load Reaction ID 0017cb08: 340201bc ori r2,r0,0x01bc 0017cb0c: afbf0028 sw r31,0x0028(r29) 0017cb10: 1062002a beq r3,r2,0x 0017cbbc Branch if ID = Distribute 0017cb14: afb00018 sw r16,0x0018(r29) 0017cb18: 286201bd slti r2,r3,0x01bd 0017cb1c: 10400005 beq r2,r0,0x 0017cb34 Branch if ID >= MP Switch 0017cb20: 340201b8 ori r2,r0,0x01b8 0017cb24: 10620008 beq r3,r2,0x 0017cb48 Branch if ID = Reflect 0017cb28: 00000000 nop 0017cb2c: 0805f330 j 0x 0017ccc0 0017cb30: 00000000 nop 0017cb34: 340201be ori r2,r0,0x01be 0017cb38: 10620051 beq r3,r2,0x 0017cc80 Branch if ID = Damage Split 0017cb3c: 00000000 nop 0017cb40: 0805f330 j 0x 0017ccc0 0017cb44: 00000000 nop
- Reflect*
0017cb48: 90e4017a lbu r4,0x017a(r7) Load Target X 0017cb4c: 00000000 nop 0017cb50: a104001c sb r4,0x001c(r8) Store Target X 0017cb54: 90e5017e lbu r5,0x017e(r7) Load Target Y 0017cb58: 00000000 nop 0017cb5c: a105001d sb r5,0x001d(r8) Store Target Y 0017cb60: 90e6017c lbu r6,0x017c(r7) Load Target's Map Level 0017cb64: 0c05f722 jal 0x0017dc88 Get ID of Unit if Tile is Targetable 0017cb68: a106001e sb r6,0x001e(r8) Store Target's Map Level 0017cb6c: 00408021 addu r16,r2,r0 r16 = Target ID 0017cb70: 06000062 bltz r16,0x 0017ccfc Branch if Target is invalid 0017cb74: 001010c0 sll r2,r16,0x03 ID * 8 0017cb78: 00501023 subu r2,r2,r16 ID * 7 0017cb7c: 00021180 sll r2,r2,0x06 ID * 448 0017cb80: 00532821 addu r5,r2,r19 r5 = Target's Data Pointer 0017cb84: 90a30182 lbu r3,0x0182(r5) Load Target's Mount Info 0017cb88: 00000000 nop 0017cb8c: 30620040 andi r2,r3,0x0040 0017cb90: 10400003 beq r2,r0,0x 0017cba0 Branch if Target is being Ridden 0017cb94: 02002021 addu r4,r16,r0 r4 = Target ID 0017cb98: 3070001f andi r16,r3,0x001f r16 = Rider ID 0017cb9c: 02002021 addu r4,r16,r0 r4 = Target ID (Rider) 0017cba0: 0c05ef74 jal 0x0017bdd0 Check if Unit can be Targeted 0017cba4: 27a50010 addiu r5,r29,0x0010 r5 = Stack Pointer + 0x10 0017cba8: 14400054 bne r2,r0,0x 0017ccfc Branch if Unit can't be targeted 0017cbac: 34020001 ori r2,r0,0x0001 r2 = 1 0017cbb0: ae220000 sw r2,0x0000(r17) Store #Targets = 1 0017cbb4: 0805f341 j 0x 0017cd04 0017cbb8: a2500000 sb r16,0x0000(r18) Store ID on Stack 3
- Distribute*
0017cbbc: 00008021 addu r16,r0,r0 Hit Counter = 0 0017cbc0: 00003021 addu r6,r0,r0 Counter = 0 0017cbc4: 340a00ff ori r10,r0,0x00ff r10 = FF 0017cbc8: 02604021 addu r8,r19,r0 r8 = Unit Data Pointer 0017cbcc: 90e20005 lbu r2,0x0005(r7) Load Acting Unit's ENTD Flags 0017cbd0: 02403821 addu r7,r18,r0 r7 = Stack 3 0017cbd4: 30490030 andi r9,r2,0x0030 r9 = Acting Unit's Team 0017cbd8: 10c40021 beq r6,r4,0x 0017cc60 Branch if Counter = Acting Unit's ID 0017cbdc: 01002821 addu r5,r8,r0 r5 = Unit Data Pointer 0017cbe0: 90a20001 lbu r2,0x0001(r5) Load Unit's ID 0017cbe4: 00000000 nop 0017cbe8: 104a001d beq r2,r10,0x 0017cc60 Branch if Unit doesn't exist 0017cbec: 00000000 nop 0017cbf0: 90a20182 lbu r2,0x0182(r5) Load Unit's Mount Info 0017cbf4: 00000000 nop 0017cbf8: 30420040 andi r2,r2,0x0040 0017cbfc: 14400018 bne r2,r0,0x 0017cc60 Branch if Unit is being ridden 0017cc00: 00000000 nop 0017cc04: 94a30028 lhu r3,0x0028(r5) Load Unit's Current HP 0017cc08: 94a2002a lhu r2,0x002a(r5) Load Unit's Max HP 0017cc0c: 00000000 nop 0017cc10: 10620013 beq r3,r2,0x 0017cc60 Branch if Max HP = Current HP 0017cc14: 00000000 nop 0017cc18: 90a20058 lbu r2,0x0058(r5) Load Unit's Current Statuses 1 0017cc1c: 00000000 nop 0017cc20: 30420064 andi r2,r2,0x0064 0017cc24: 1440000e bne r2,r0,0x 0017cc60 Branch if Unit is Jumping/Dead/Crystal 0017cc28: 00000000 nop 0017cc2c: 90a20059 lbu r2,0x0059(r5) Load Unit's Current Statuses 2 0017cc30: 00000000 nop 0017cc34: 30420081 andi r2,r2,0x0081 0017cc38: 14400009 bne r2,r0,0x 0017cc60 Branch if Unit is Treasure/Petrified 0017cc3c: 00000000 nop 0017cc40: 90a201ba lbu r2,0x01ba(r5) Load Unit's Modified ENTD Flags 0017cc44: 00000000 nop 0017cc48: 30420030 andi r2,r2,0x0030 0017cc4c: 14490004 bne r2,r9,0x 0017cc60 Branch if Modified Team != Acting Unit's Team 0017cc50: afa20010 sw r2,0x0010(r29) Store Unit's Team to Stack 0017cc54: a0e60000 sb r6,0x0000(r7) Store Counter to Stack 3 0017cc58: 24e70001 addiu r7,r7,0x0001 Stack 3 ++ 0017cc5c: 26100001 addiu r16,r16,0x0001 Hit Counter ++ 0017cc60: 24c60001 addiu r6,r6,0x0001 Counter ++ 0017cc64: 28c20015 slti r2,r6,0x0015 0017cc68: 1440ffdb bne r2,r0,0x 0017cbd8 Branch if Counter < 0x15 0017cc6c: 250801c0 addiu r8,r8,0x01c0 Pointer += 0x1c0 0017cc70: 3c018019 lui r1,0x8019 0017cc74: ac303878 sw r16,0x3878(r1) Store Hit Counter 0017cc78: 0805f340 j 0x 0017cd00 0017cc7c: ae300000 sw r16,0x0000(r17) Store #Targets = Hit Counter
- Damage Split*
0017cc80: 3c038019 lui r3,0x8019 0017cc84: 8c63f8c8 lw r3,-0x0738(r3) Load Acting Unit's ID 0017cc88: 00000000 nop 0017cc8c: 000310c0 sll r2,r3,0x03 ID * 8 0017cc90: 00431023 subu r2,r2,r3 ID * 7 0017cc94: 00021180 sll r2,r2,0x06 ID * 448 0017cc98: 00532821 addu r5,r2,r19 r5 = Unit's Data Pointer 0017cc9c: 90a30001 lbu r3,0x0001(r5) Load Unit's ID 0017cca0: 340200ff ori r2,r0,0x00ff 0017cca4: 10620015 beq r3,r2,0x 0017ccfc Branch if Unit doesn't exist 0017cca8: 34020001 ori r2,r0,0x0001 0017ccac: ae220000 sw r2,0x0000(r17) Store #Targets = 1 0017ccb0: 3c028019 lui r2,0x8019 0017ccb4: 9042f8c8 lbu r2,-0x0738(r2) Load Acting Unit's ID 0017ccb8: 0805f340 j 0x 0017cd00 0017ccbc: a2420000 sb r2,0x0000(r18) Store ID on Stack 3
- Other Reactions*
0017ccc0: 3c028019 lui r2,0x8019 0017ccc4: 84422d9c lh r2,0x2d9c(r2) Load Reaction ID 0017ccc8: 3c018006 lui r1,0x8006 0017cccc: 00220821 addu r1,r1,r2 0017ccd0: 9023ea2a lbu r3,-0x15d6(r1) Load ? Reaction Flags 0017ccd4: 00000000 nop 0017ccd8: 30620004 andi r2,r3,0x0004 0017ccdc: 10400004 beq r2,r0,0x 0017ccf0 Branch if ? doesn't have 0x4 0017cce0: 34020001 ori r2,r0,0x0001 r2 = 1
- ? has 0x4*
0017cce4: ae220000 sw r2,0x0000(r17) Store #Targets = 1 0017cce8: 0805f341 j 0x 0017cd04 0017ccec: a2440000 sb r4,0x0000(r18) Store ID on Stack 3 0017ccf0: 30620008 andi r2,r3,0x0008 0017ccf4: 14400003 bne r2,r0,0x 0017cd04 Branch if ? has 0x8 0017ccf8: 00001021 addu r2,r0,r0 r2 = 0
- ? doesn't have 0x8*
0017ccfc: ae200000 sw r0,0x0000(r17) Store $Targets = 0 0017cd00: 34020001 ori r2,r0,0x0001 r2 = 1 0017cd04: 8fbf0028 lw r31,0x0028(r29) 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