Difference between revisions of "Pre Formula Setup (FDC)"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with " Pre Formula Setup (FDC) 0018b34c: 27bdffc8 addiu r29,r29,0xffc8 0018b350: afb00028 sw r16,0x0028(r29) 0018b354: 00a08021 addu r16,r5,r0 0018b358: 27a50010 addiu r5,r29,0x...")
 
Line 1: Line 1:
 
  Pre Formula Setup (FDC)
 
  Pre Formula Setup (FDC)
0018b34c: 27bdffc8 addiu r29,r29,0xffc8
+
  0018b34c: 27bdffc8 addiu r29,r29,0xffc8
  0018b350: afb00028 sw r16,0x0028(r29)
+
  0018b350: afb00028 sw r16,0x0028(r29)
  0018b354: 00a08021 addu r16,r5,r0
+
  0018b354: 00a08021 addu r16,r5,r0
  0018b358: 27a50010 addiu r5,r29,0x0010
+
  0018b358: 27a50010 addiu r5,r29,0x0010
  0018b35c: afbf0034 sw r31,0x0034(r29)
+
  0018b35c: afbf0034 sw r31,0x0034(r29)
  0018b360: afb20030 sw r18,0x0030(r29)
+
  0018b360: afb20030 sw r18,0x0030(r29)
  0018b364: 0c01788b jal 0x0005e22c
+
  0018b364: 0c01788b jal 0x0005e22c Transfer Target ID
  0018b368: afb1002c sw r17,0x002c(r29)
+
  0018b368: afb1002c sw r17,0x002c(r29)
  0018b36c: 3c018019 lui r1,0x8019
+
  0018b36c: 3c018019 lui r1,0x8019
  0018b370: a03038c1 sb r16,0x38c1(r1) Store ID of the defending unit.
+
  0018b370: a03038c1 sb r16,0x38c1(r1) Store ID of the defending unit
  0018b374: 321000ff andi r16,r16,0x00ff
+
  0018b374: 321000ff andi r16,r16,0x00ff
  0018b378: 001010c0 sll r2,r16,0x03
+
  0018b378: 001010c0 sll r2,r16,0x03
  0018b37c: 00501023 subu r2,r2,r16
+
  0018b37c: 00501023 subu r2,r2,r16
  0018b380: 00021180 sll r2,r2,0x06
+
  0018b380: 00021180 sll r2,r2,0x06
  0018b384: 3c048019 lui r4,0x8019
+
  0018b384: 3c048019 lui r4,0x8019
  0018b388: 248408cc addiu r4,r4,0x08cc
+
  0018b388: 248408cc addiu r4,r4,0x08cc Load Unit Data
  0018b38c: 00441821 addu r3,r2,r4
+
  0018b38c: 00441821 addu r3,r2,r4
  0018b390: 3c018019 lui r1,0x8019
+
  0018b390: 3c018019 lui r1,0x8019
  0018b394: ac232d98 sw r3,0x2d98(r1) Store pointer of the defending unit.
+
  0018b394: ac232d98 sw r3,0x2d98(r1) Store Defender's Data
  0018b398: 2483018c addiu r3,r4,0x018c
+
  0018b398: 2483018c addiu r3,r4,0x018c
  0018b39c: 00431021 addu r2,r2,r3
+
  0018b39c: 00431021 addu r2,r2,r3
  0018b3a0: 93a30010 lbu r3,0x0010(r29)
+
  0018b3a0: 93a30010 lbu r3,0x0010(r29)
  0018b3a4: 3c018019 lui r1,0x8019
+
  0018b3a4: 3c018019 lui r1,0x8019
  0018b3a8: ac222d90 sw r2,0x2d90(r1) Store pointer2 of defending unit
+
  0018b3a8: ac222d90 sw r2,0x2d90(r1) Store Defender's Current Action Data
  0018b3ac: 3c028019 lui r2,0x8019
+
  0018b3ac: 3c028019 lui r2,0x8019
  0018b3b0: 244238c0 addiu r2,r2,0x38c0
+
  0018b3b0: 244238c0 addiu r2,r2,0x38c0 Load Attacker's Unit ID
  0018b3b4: 3c018019 lui r1,0x8019
+
  0018b3b4: 3c018019 lui r1,0x8019
  0018b3b8: a020390e sb r0,0x390e(r1) Store 0 into ability formula?
+
  0018b3b8: a020390e sb r0,0x390e(r1) Store formula as 0x00
  0018b3bc: a0430000 sb r3,0x0000(r2) Store ID of the attacking unit.
+
  0018b3bc: a0430000 sb r3,0x0000(r2) Store ID of the attacking unit
  0018b3c0: 90430000 lbu r3,0x0000(r2)
+
  0018b3c0: 90430000 lbu r3,0x0000(r2)
  0018b3c4: 3c028019 lui r2,0x8019
+
  0018b3c4: 3c028019 lui r2,0x8019
  0018b3c8: 24422da0 addiu r2,r2,0x2da0
+
  0018b3c8: 24422da0 addiu r2,r2,0x2da0
  0018b3cc: 3c018019 lui r1,0x8019
+
  0018b3cc: 3c018019 lui r1,0x8019
  0018b3d0: ac222d8c sw r2,0x2d8c(r1) Stores 192da0 into Pointer2 of attacking unit?!
+
  0018b3d0: ac222d8c sw r2,0x2d8c(r1) Store Attacker's Current Action Data
  0018b3d4: 000310c0 sll r2,r3,0x03
+
  0018b3d4: 000310c0 sll r2,r3,0x03
  0018b3d8: 00431023 subu r2,r2,r3
+
  0018b3d8: 00431023 subu r2,r2,r3
  0018b3dc: 00021180 sll r2,r2,0x06
+
  0018b3dc: 00021180 sll r2,r2,0x06
  0018b3e0: 3c038019 lui r3,0x8019
+
  0018b3e0: 3c038019 lui r3,0x8019
  0018b3e4: 8c63f5f0 lw r3,-0x0a10(r3)
+
  0018b3e4: 8c63f5f0 lw r3,-0x0a10(r3)
  0018b3e8: 00441021 addu r2,r2,r4
+
  0018b3e8: 00441021 addu r2,r2,r4
  0018b3ec: 3c018019 lui r1,0x8019
+
  0018b3ec: 3c018019 lui r1,0x8019
  0018b3f0: ac222d94 sw r2,0x2d94(r1) Store pointer of attacking unit
+
  0018b3f0: ac222d94 sw r2,0x2d94(r1) Store Attacker's Data
  0018b3f4: 10600009 beq r3,r0,0x 0018b41c If Reaction did not activate, GOTO ???
+
  0018b3f4: 10600009 beq r3,r0,0x0018b41c
  0018b3f8: 00000000 nop
+
  0018b3f8: 00000000 nop
  0018b3fc: 0c062bcb jal 0x 0018af2c ELSE, setup Reaction
+
  0018b3fc: 0c062bcb jal 0x0018af2c Load Reaction Table
  0018b400: 00000000 nop
+
  0018b400: 00000000 nop
  0018b404: 10400005 beq r2,r0,0x 0018b41c If reaction failed, GOTO ???
+
  0018b404: 10400005 beq r2,r0,0x0018b41c Branch if Reaction failed
  0018b408: 00000000 nop
+
  0018b408: 00000000 nop
  0018b40c: 0c062c9d jal 0x 0018b274 Store correct weapon ID, modified by action menu ID (this should be deleted anyways)
+
  0018b40c: 0c062c9d jal 0x0018b274 Store correct weapon ID, modified by action menu ID
  0018b410: 27a40010 addiu r4,r29,0x0010
+
  0018b410: 27a40010 addiu r4,r29,0x0010
  0018b414: 08062e77 j 0x 0018b9dc GOTO END
+
  0018b414: 08062e77 j 0x0018b9dc Goto End
  0018b418: 00001021 addu r2,r0,r0
+
  0018b418: 00001021 addu r2,r0,r0 r2 = 0
  0018b41c: 3c028019 lui r2,0x8019
+
  0018b41c: 3c028019 lui r2,0x8019
  0018b420: 904238ed lbu r2,0x38ed(r2)
+
  0018b420: 904238ed lbu r2,0x38ed(r2) Load ???
  0018b424: 00000000 nop
+
  0018b424: 00000000 nop
  0018b428: 30420080 andi r2,r2,0x0080
+
  0018b428: 30420080 andi r2,r2,0x0080
  0018b42c: 10400005 beq r2,r0,0x 0018b444 If NOT Crystal/Treasure Box/Please Eat(?), GOTO normal attack
+
  0018b42c: 10400005 beq r2,r0,0x0018b444 Branch if 0x801938ed does not have 0x80 active
  0018b430: 00000000 nop
+
  0018b430: 00000000 nop
  0018b434: 0c062b8f jal 0x 0018ae3c fall damage? (?)
+
  0018b434: 0c062b8f jal 0x0018ae3c Fall Damage???
  0018b438: 00000000 nop
+
  0018b438: 00000000 nop
  0018b43c: 08062e77 j 0x 0018b9dc GOTO END
+
  0018b43c: 08062e77 j 0x0018b9dc Jump to end
  0018b440: 00001021 addu r2,r0,r0
+
  0018b440: 00001021 addu r2,r0,r0 r2 = 0x00
  0018b444: 3c048019 lui r4,0x8019
+
  0018b444: 3c048019 lui r4,0x8019
  0018b448: 8c842d98 lw r4,0x2d98(r4)
+
  0018b448: 8c842d98 lw r4,0x2d98(r4) Load Defender's Data
  0018b44c: 0c060428 jal 0x 001810a0
+
  0018b44c: 0c060428 jal 0x001810a0 Unit map location?
  0018b450: 00000000 nop
+
  0018b450: 00000000 nop
  0018b454: 000210c0 sll r2,r2,0x03
+
  0018b454: 000210c0 sll r2,r2,0x03
  0018b458: 3c018019 lui r1,0x8019
+
  0018b458: 3c018019 lui r1,0x8019
  0018b45c: 00220821 addu r1,r1,r2
+
  0018b45c: 00220821 addu r1,r1,r2
  0018b460: 9022f8cc lbu r2,-0x0734(r1)
+
  0018b460: 9022f8cc lbu r2,-0x0734(r1) Load Tile Data
  0018b464: 3c038019 lui r3,0x8019
+
  0018b464: 3c038019 lui r3,0x8019
  0018b468: 906338c3 lbu r3,0x38c3(r3)
+
  0018b468: 906338c3 lbu r3,0x38c3(r3) Load Weapon Hand (0 = R, 1 = L)
  0018b46c: 3042003f andi r2,r2,0x003f
+
  0018b46c: 3042003f andi r2,r2,0x003f
  0018b470: 3c018019 lui r1,0x8019
+
  0018b470: 3c018019 lui r1,0x8019
  0018b474: a02238cd sb r2,0x38cd(r1) Store terrain type into 1938cd.
+
  0018b474: a02238cd sb r2,0x38cd(r1) Store terrain type
  0018b478: 14600005 bne r3,r0,0x 0018b490
+
  0018b478: 14600005 bne r3,r0,0x0018b490 Branch if Weapon is in left hand
  0018b47c: 00000000 nop
+
  0018b47c: 00000000 nop
  0018b480: 3c078019 lui r7,0x8019
+
  0018b480: 3c078019 lui r7,0x8019
  0018b484: 90e738c4 lbu r7,0x38c4(r7)
+
  0018b484: 90e738c4 lbu r7,0x38c4(r7) Load Right Arm Equip ID
  0018b488: 08062d26 j 0x 0018b498
+
  0018b488: 08062d26 j 0x0018b498
  0018b48c: 00000000 nop
+
  0018b48c: 00000000 nop
  0018b490: 3c078019 lui r7,0x8019
+
  0018b490: 3c078019 lui r7,0x8019
  0018b494: 90e738c5 lbu r7,0x38c5(r7)
+
  0018b494: 90e738c5 lbu r7,0x38c5(r7) Load Left Arm Equip ID
  0018b498: 93a30011 lbu r3,0x0011(r29) Load equipment ID type
+
  0018b498: 93a30011 lbu r3,0x0011(r29) Load equipment ID type
  0018b49c: 34020013 ori r2,r0,0x0013
+
  0018b49c: 34020013 ori r2,r0,0x0013 r2 = 0x13
  0018b4a0: 14620004 bne r3,r2,0x 0018b4b4 If not shields, r2 is weapon ID
+
  0018b4a0: 14620004 bne r3,r2,0x0018b4b4 If not a Shield, r2 is Weapon ID
  0018b4a4: 30e200ff andi r2,r7,0x00ff
+
  0018b4a4: 30e200ff andi r2,r7,0x00ff
  0018b4a8: 93a7 0018 lbu r7,0x 0018(r29)
+
  0018b4a8: 93a70018 lbu r7,0x0018(r29)
  0018b4ac: 00000000 nop
+
  0018b4ac: 00000000 nop
  0018b4b0: 30e200ff andi r2,r7,0x00ff ELSE, r2 = 0xFF
+
  0018b4b0: 30e200ff andi r2,r7,0x00ff
  0018b4b4: 2c420080 sltiu r2,r2,0x0080
+
  0018b4b4: 2c420080 sltiu r2,r2,0x0080
  0018b4b8: 14400002 bne r2,r0,0x 0018b4c4
+
  0018b4b8: 14400002 bne r2,r0,0x0018b4c4
  0018b4bc: 00000000 nop
+
  0018b4bc: 00000000 nop
  0018b4c0: 00003821 addu r7,r0,r0 If equipment type was shields, weapon ID = 0
+
  0018b4c0: 00003821 addu r7,r0,r0 If equipment was a shield, Weapon ID = 0
  0018b4c4: 97a30012 lhu r3,0x0012(r29)
+
  0018b4c4: 97a30012 lhu r3,0x0012(r29)
  0018b4c8: 3c108019 lui r16,0x8019
+
  0018b4c8: 3c108019 lui r16,0x8019
  0018b4cc: 261038d8 addiu r16,r16,0x38d8
+
  0018b4cc: 261038d8 addiu r16,r16,0x38d8 Load Spell Proc Ability ID
  0018b4d0: a2070000 sb r7,0x0000(r16) Store weapon ID.
+
  0018b4d0: a2070000 sb r7,0x0000(r16) Store Weapon ID
  0018b4d4: 3c018019 lui r1,0x8019
+
  0018b4d4: 3c018019 lui r1,0x8019
  0018b4d8: a42338d6 sh r3,0x38d6(r1) Store used ability ID.
+
  0018b4d8: a42338d6 sh r3,0x38d6(r1) Store Used Ability ID
  0018b4dc: 3c028019 lui r2,0x8019
+
  0018b4dc: 3c028019 lui r2,0x8019
  0018b4e0: 944238d6 lhu r2,0x38d6(r2)
+
  0018b4e0: 944238d6 lhu r2,0x38d6(r2) Load Used Ability ID
  0018b4e4: 3c018019 lui r1,0x8019
+
  0018b4e4: 3c018019 lui r1,0x8019
  0018b4e8: a02038d9 sb r0,0x38d9(r1) Set 2H to false.
+
  0018b4e8: a02038d9 sb r0,0x38d9(r1) Store Two Hands as inactive
  0018b4ec: 2c420171 sltiu r2,r2,0x0171
+
  0018b4ec: 2c420171 sltiu r2,r2,0x0171
  0018b4f0: 14400002 bne r2,r0,0x 0018b4fc If Move ID < Hi-Potion (shouldn't this be potion?), GOTO get ability pointer.
+
  0018b4f0: 14400002 bne r2,r0,0x0018b4fc If Move ID < Hi-Potion, go get ability pointer
  0018b4f4: 2605 0018 addiu r5,r16,0x 0018
+
  0018b4f4: 26050018 addiu r5,r16,0x0018
  0018b4f8: 00 001821 addu r3,r0,r0 ELSE, load the pointer of first attack.
+
  0018b4f8: 00001821 addu r3,r0,r0 Else load the pointer of first attack
  0018b4fc: 000320c0 sll r4,r3,0x03
+
  0018b4fc: 000320c0 sll r4,r3,0x03 Used Ability ID * 8
  0018b500: 00832023 subu r4,r4,r3
+
  0018b500: 00832023 subu r4,r4,r3 Used Ability ID * 7
  0018b504: 00042040 sll r4,r4,0x01
+
  0018b504: 00042040 sll r4,r4,0x01 Used Ability ID * 14
  0018b508: 3c028006 lui r2,0x8006
+
  0018b508: 3c028006 lui r2,0x8006
  0018b50c: 2442fbf0 addiu r2,r2,0xfbf0
+
  0018b50c: 2442fbf0 addiu r2,r2,0xfbf0 Load Ability Data
  0018b510: 00822021 addu r4,r4,r2
+
  0018b510: 00822021 addu r4,r4,r2 Get Used Ability ID Data
  0018b514: 3406000e ori r6,r0,0x000e
+
  0018b514: 3406000e ori r6,r0,0x000e r6 = 0x0e
  0018b518: 30e200ff andi r2,r7,0x00ff
+
  0018b518: 30e200ff andi r2,r7,0x00ff Transfer Weapon ID to r2
  0018b51c: 000210c0 sll r2,r2,0x03 r2 = weapon ID * 8
+
  0018b51c: 000210c0 sll r2,r2,0x03 Weapon ID * 8
  0018b520: 3c038006 lui r3,0x8006
+
  0018b520: 3c038006 lui r3,0x8006
  0018b524: 24633ab8 addiu r3,r3,0x3ab8
+
  0018b524: 24633ab8 addiu r3,r3,0x3ab8 Load Weapon Secondary Data
  0018b528: 0c017895 jal 0x0005e254 Store ability data into 0x1938f0-d
+
  0018b528: 0c017895 jal 0x0005e254 Store ability data into 0x1938f0
  0018b52c: 00438821 addu r17,r2,r3 r17 = pointer of weapon
+
  0018b52c: 00438821 addu r17,r2,r3 0x80063ab8 + Weapon ID * 8
  0018b530: 02202021 addu r4,r17,r0
+
  0018b530: 02202021 addu r4,r17,r0 r4 = 0x80063ab8 + Weapon ID * 8
  0018b534: 26050026 addiu r5,r16,0x0026
+
  0018b534: 26050026 addiu r5,r16,0x0026
  0018b538: 0c017895 jal 0x0005e254 Store weapon data into 0x1938fe-905
+
  0018b538: 0c017895 jal 0x0005e254 Store Weapon Data into 0x1938fe-905
  0018b53c: 34060008 ori r6,r0,0x0008
+
  0018b53c: 34060008 ori r6,r0,0x0008 r6 = 0x08
  0018b540: 92240007 lbu r4,0x0007(r17)
+
  0018b540: 92240007 lbu r4,0x0007(r17) Load Inflict Status/Cast Spell ID from Weapon
  0018b544: 3c038019 lui r3,0x8019
+
  0018b544: 3c038019 lui r3,0x8019
  0018b548: 8c632d94 lw r3,0x2d94(r3)
+
  0018b548: 8c632d94 lw r3,0x2d94(r3) Load Attacker Data
  0018b54c: 34020001 ori r2,r0,0x0001
+
  0018b54c: 34020001 ori r2,r0,0x0001 R2 = 1
  0018b550: 3c018019 lui r1,0x8019
+
  0018b550: 3c018019 lui r1,0x8019
  0018b554: a02038e4 sb r0,0x38e4(r1) Default Charge (on charged attacks) = 0
+
  0018b554: a02038e4 sb r0,0x38e4(r1) Store Charge Power as 0?
  0018b558: 3c018019 lui r1,0x8019
+
  0018b558: 3c018019 lui r1,0x8019
  0018b55c: a02238e5 sb r2,0x38e5(r1) Default formula = 01
+
  0018b55c: a02238e5 sb r2,0x38e5(r1) Store Ability Formula
  0018b560: 3c018019 lui r1,0x8019
+
  0018b560: 3c018019 lui r1,0x8019
  0018b564: a02438da sb r4,0x38da(r1) Store weapon proc
+
  0018b564: a02438da sb r4,0x38da(r1) Store Weapon Proc
  0018b568: 90620026 lbu r2,0x0026(r3)
+
  0018b568: 90620026 lbu r2,0x0026(r3) Load Attacker's Faith
  0018b56c: 3c038019 lui r3,0x8019
+
  0018b56c: 3c038019 lui r3,0x8019
  0018b570: 8c632d98 lw r3,0x2d98(r3)
+
  0018b570: 8c632d98 lw r3,0x2d98(r3) Load Defender Data
  0018b574: 3c018019 lui r1,0x8019
+
  0018b574: 3c018019 lui r1,0x8019
  0018b578: a02238d3 sb r2,0x38d3(r1) Store faith of attacker (never used)
+
  0018b578: a02238d3 sb r2,0x38d3(r1) Store Attacker's Faith
  0018b57c: 90620026 lbu r2,0x0026(r3)
+
  0018b57c: 90620026 lbu r2,0x0026(r3) Load Defender's Faith
  0018b580: 3c018019 lui r1,0x8019
+
  0018b580: 3c018019 lui r1,0x8019
  0018b584: a02238d2 sb r2,0x38d2(r1) Store faith of defender (never used)
+
  0018b584: a02238d2 sb r2,0x38d2(r1) Store Defender's Faith
  0018b588: 0c062b7d jal 0x 0018adf4 Clear micro-unit RAM (this code in SCUS is terribly inefficient), but set attack type = psuedo-status, hit = true, and base accuracy = 100%
+
  0018b588: 0c062b7d jal 0x0018adf4 Clear Data?
  0018b58c: 00000000 nop
+
  0018b58c: 00000000 nop
  0018b590: 93a20011 lbu r2,0x0011(r29)
+
  0018b590: 93a20011 lbu r2,0x0011(r29)
  0018b594: 3c038019 lui r3,0x8019
+
  0018b594: 3c038019 lui r3,0x8019
  0018b598: 946338c8 lhu r3,0x38c8(r3) r3 = 0x1 if spell proc is true, and 0x0 otherwise
+
  0018b598: 946338c8 lhu r3,0x38c8(r3) r3 = 0x1 if spell proc is true, and 0x0 otherwise
  0018b59c: 3c018019 lui r1,0x8019
+
  0018b59c: 3c018019 lui r1,0x8019
  0018b5a0: a02238d4 sb r2,0x38d4(r1) Store Action Menu # (put a read on this location to find hard-coded WTF)
+
  0018b5a0: a02238d4 sb r2,0x38d4(r1) Store Action Menu ID (put a read on this location to find hard-coded???)
  0018b5a4: 304200ff andi r2,r2,0x00ff
+
  0018b5a4: 304200ff andi r2,r2,0x00ff
  0018b5a8: 3c018006 lui r1,0x8006
+
  0018b5a8: 3c018006 lui r1,0x8006
  0018b5ac: 00220821 addu r1,r1,r2
+
  0018b5ac: 00220821 addu r1,r1,r2
  0018b5b0: 90325cb4 lbu r18,0x5cb4(r1) r18 = Action Menu ID
+
  0018b5b0: 90325cb4 lbu r18,0x5cb4(r1) Load Action Menu into r18
  0018b5b4: 10600009 beq r3,r0,0x 0018b5dc
+
  0018b5b4: 10600009 beq r3,r0,0x0018b5dc Branch if Weapon Proc failed
  0018b5b8: 00000000 nop
+
  0018b5b8: 00000000 nop
  0018b5bc: 3c028019 lui r2,0x8019
+
  0018b5bc: 3c028019 lui r2,0x8019
  0018b5c0: 944238c6 lhu r2,0x38c6(r2)
+
  0018b5c0: 944238c6 lhu r2,0x38c6(r2) Load ???
  0018b5c4: 00000000 nop
+
  0018b5c4: 00000000 nop
  0018b5c8: a7a20012 sh r2,0x0012(r29) If Spell proc is true, store proc ID as used ability ID (temporary)
+
  0018b5c8: a7a20012 sh r2,0x0012(r29) If Spell proc is true, store proc ID as used ability ID (temporary)
  0018b5cc: 3c018019 lui r1,0x8019
+
  0018b5cc: 3c018019 lui r1,0x8019
  0018b5d0: a42238d6 sh r2,0x38d6(r1) Store proc ID as used ability ID (unit RAM)
+
  0018b5d0: a42238d6 sh r2,0x38d6(r1) Store Spell Proc ID as Used Ability ID
  0018b5d4: 08062d79 j 0x 0018b5e4
+
  0018b5d4: 08062d79 j 0x0018b5e4
  0018b5d8: 00009021 addu r18,r0,r0 Ignore action menu ID.
+
  0018b5d8: 00009021 addu r18,r0,r0 Clear Action Menu ID
  0018b5dc: 3c018019 lui r1,0x8019
+
  0018b5dc: 3c018019 lui r1,0x8019
  0018b5e0: a42038c6 sh r0,0x38c6(r1) If Spell proc is false, proc ID = 0.
+
  0018b5e0: a42038c6 sh r0,0x38c6(r1) Store ??? as 0x00
  0018b5e4: 87a30012 lh r3,0x0012(r29)
+
  0018b5e4: 87a30012 lh r3,0x0012(r29)
  0018b5e8: 3c028006 lui r2,0x8006
+
  0018b5e8: 3c028006 lui r2,0x8006
  0018b5ec: 2442ebf0 addiu r2,r2,0xebf0
+
  0018b5ec: 2442ebf0 addiu r2,r2,0xebf0 Load first set of Ability Data
  0018b5f0: 000318c0 sll r3,r3,0x03 Load AI pointer of used ability
+
  0018b5f0: 000318c0 sll r3,r3,0x03 r3 * 8
  0018b5f4: 00621821 addu r3,r3,r2
+
  0018b5f4: 00621821 addu r3,r3,r2 0x8006ebf0 + r3 * 8
  0018b5f8: 90620004 lbu r2,0x0004(r3)
+
  0018b5f8: 90620004 lbu r2,0x0004(r3) Load first set of AI Flags
  0018b5fc: 3c048019 lui r4,0x8019
+
  0018b5fc: 3c048019 lui r4,0x8019
  0018b600: 8c842d90 lw r4,0x2d90(r4)
+
  0018b600: 8c842d90 lw r4,0x2d90(r4) Load Defender Current Action Data
  0018b604: 30420003 andi r2,r2,0x0003
+
  0018b604: 30420003 andi r2,r2,0x0003
  0018b608: a082 0018 sb r2,0x 0018(r4) Store target enemy/self flags into byte 0x18 of target's micro-unit RAM
+
  0018b608: a0820018 sb r2,0x0018(r4) Store Abilities AI Target Enemies/Allies into 0x18 of Current Action Data
  0018b60c: 90620007 lbu r2,0x0007(r3)
+
  0018b60c: 90620007 lbu r2,0x0007(r3) Load fourth set of AI Flags?
  0018b610: 00000000 nop
+
  0018b610: 00000000 nop
  0018b614: 30420001 andi r2,r2,0x0001
+
  0018b614: 30420001 andi r2,r2,0x0001
  0018b618: 10400009 beq r2,r0,0x 0018b640
+
  0018b618: 10400009 beq r2,r0,0x0018b640 Branch if bit 0x01 is not active
  0018b61c: 324300ff andi r3,r18,0x00ff
+
  0018b61c: 324300ff andi r3,r18,0x00ff Load Action Menu ID into r3
  0018b620: 3c038019 lui r3,0x8019
+
  0018b620: 3c038019 lui r3,0x8019
  0018b624: 8c632d90 lw r3,0x2d90(r3)
+
  0018b624: 8c632d90 lw r3,0x2d90(r3) Load Defender Current Action Data
  0018b628: 00000000 nop
+
  0018b628: 00000000 nop
  0018b62c: 9062 0018 lbu r2,0x 0018(r3)
+
  0018b62c: 90620018 lbu r2,0x0018(r3) Load byte 0x18
  0018b630: 00000000 nop
+
  0018b630: 00000000 nop
  0018b634: 24420080 addiu r2,r2,0x0080
+
  0018b634: 24420080 addiu r2,r2,0x0080
  0018b638: a062 0018 sb r2,0x 0018(r3) If animate on miss, store animate on miss flag as bit 8 into byte 0x18 of target's micro-unit RAM
+
  0018b638: a0620018 sb r2,0x0018(r3) If animate on miss, store animate on miss flag as bit 8 into byte 0x18
  0018b63c: 324300ff andi r3,r18,0x00ff
+
  0018b63c: 324300ff andi r3,r18,0x00ff Load Action Menu ID into r3
  0018b640: 34020007 ori r2,r0,0x0007
+
  0018b640: 34020007 ori r2,r0,0x0007 r2 0x07
  0018b644: 14620006 bne r3,r2,0x 0018b660 Branch if Action Menu Type isn't Draw Out
+
  0018b644: 14620006 bne r3,r2,0x0018b660 Branch if Action Menu ID = Draw Out
  0018b648: 2c62000b sltiu r2,r3,0x000b
+
  0018b648: 2c62000b sltiu r2,r3,0x000b
  0018b64c: 93a2 0018 lbu r2,0x 0018(r29)
+
  0018b64c: 93a20018 lbu r2,0x0018(r29)
  0018b650: 00000000 nop
+
  0018b650: 00000000 nop
  0018b654: 24420026 addiu r2,r2,0x0026
+
  0018b654: 24420026 addiu r2,r2,0x0026
  0018b658: a7a20012 sh r2,0x0012(r29) If Draw Out, store weapon ID of katana as used ability ID (temp).
+
  0018b658: a7a20012 sh r2,0x0012(r29)
0018b65c: 2c62000b sltiu r2,r3,0x000b
+
0018b65c: 2c62000b sltiu r2,r3,0x000b
  0018b660: 10400095 beq r2,r0,0x 0018b8b8 Branch if Action Menu Type is defend/equip change; weapon formula = 0x01
+
  0018b660: 10400095 beq r2,r0,0x0018b8b8 Branch if Action Menu Type is defend or equip change; weapon formula = 0x01
  0018b664: 00031080 sll r2,r3,0x02
+
  0018b664: 00031080 sll r2,r3,0x02
  0018b668: 3c018017 lui r1,0x8017
+
  0018b668: 3c018017 lui r1,0x8017
  0018b66c: 00220821 addu r1,r1,r2
+
  0018b66c: 00220821 addu r1,r1,r2
  0018b670: 8c224344 lw r2,0x4344(r1)
+
  0018b670: 8c224344 lw r2,0x4344(r1) Load ??? Table
  0018b674: 00000000 nop
+
  0018b674: 00000000 nop
  0018b678: 00400008 jr r2
+
  0018b678: 00400008 jr r2
  0018b67c: 00000000 nop
+
  0018b67c: 00000000 nop
  0018b680: 3c048019 lui r4,0x8019
+
  0018b680: 3c048019 lui r4,0x8019
  0018b684: 8c842d94 lw r4,0x2d94(r4)
+
  0018b684: 8c842d94 lw r4,0x2d94(r4) Load Attacker Data
  0018b688: 0c05fcb6 jal 0x0017f2d8 ELEMENTAL terrain to skill hard-coding
+
  0018b688: 0c05fcb6 jal 0x0017f2d8 ELEMENTAL terrain to skill hard-coding
  0018b68c: 00000000 nop
+
  0018b68c: 00000000 nop
  0018b690: a7a20012 sh r2,0x0012(r29)
+
  0018b690: a7a20012 sh r2,0x0012(r29)
  0018b694: 87a20012 lh r2,0x0012(r29)
+
  0018b694: 87a20012 lh r2,0x0012(r29)
  0018b698: 00000000 nop
+
  0018b698: 00000000 nop
  0018b69c: 28420171 slti r2,r2,0x0171
+
  0018b69c: 28420171 slti r2,r2,0x0171
  0018b6a0: 10400086 beq r2,r0,0x 0018b8bc Branch if Move ID >= Hi-Potion (shouldn't this be potion?) to get formula address, using the basic attack formula
+
  0018b6a0: 10400086 beq r2,r0,0x0018b8bc Branch if Ability ID > 171 (Hi-Potion? Not Potion?)
  0018b6a4: 34100001 ori r16,r0,0x0001
+
  0018b6a4: 34100001 ori r16,r0,0x0001 r16 = 0x01
  0018b6a8: 3c028019 lui r2,0x8019
+
  0018b6a8: 3c028019 lui r2,0x8019
  0018b6ac: 8c422d94 lw r2,0x2d94(r2)
+
  0018b6ac: 8c422d94 lw r2,0x2d94(r2) Load Attacker Data
  0018b6b0: 00000000 nop
+
  0018b6b0: 00000000 nop
  0018b6b4: 9042005a lbu r2,0x005a(r2)
+
  0018b6b4: 9042005a lbu r2,0x005a(r2) Load third set of Current Status
  0018b6b8: 00000000 nop
+
  0018b6b8: 00000000 nop
  0018b6bc: 30420002 andi r2,r2,0x0002
+
  0018b6bc: 30420002 andi r2,r2,0x0002
  0018b6c0: 1040000d beq r2,r0,0x 0018b6f8 Branch if not frogged
+
  0018b6c0: 1040000d beq r2,r0,0x0018b6f8 Branch if unit is not a frog
  0018b6c4: 00000000 nop
+
  0018b6c4: 00000000 nop
  0018b6c8: 3c058019 lui r5,0x8019
+
  0018b6c8: 3c058019 lui r5,0x8019
  0018b6cc: 24a538c8 addiu r5,r5,0x38c8
+
  0018b6cc: 24a538c8 addiu r5,r5,0x38c8 Load Spell Proc Ability ID
  0018b6d0: 94a20000 lhu r2,0x0000(r5)
+
  0018b6d0: 94a20000 lhu r2,0x0000(r5) Load Spell Proc Ability ID into r2
  0018b6d4: 00000000 nop
+
  0018b6d4: 00000000 nop
  0018b6d8: 14400007 bne r2,r0,0x 0018b6f8 Branch if spell proc is true (but I don't recall frogged holy lance users doing normal damage, so frog probably overrides this byte; check is redundant)
+
  0018b6d8: 14400007 bne r2,r0,0x0018b6f8 Branch if spell proc is true (Check is redundant)
  0018b6dc: 24a50036 addiu r5,r5,0x0036
+
  0018b6dc: 24a50036 addiu r5,r5,0x0036 0x801938c8 + 0x36
  0018b6e0: 3c018019 lui r1,0x8019
+
  0018b6e0: 3c018019 lui r1,0x8019
  0018b6e4: a02038d8 sb r0,0x38d8(r1) If frogged and no spell proc, weapon ID = 0.
+
  0018b6e4: a02038d8 sb r0,0x38d8(r1) If frogged and no spell proc, store Used Weapon ID as 0x00
  0018b6e8: 3c048006 lui r4,0x8006
+
  0018b6e8: 3c048006 lui r4,0x8006
  0018b6ec: 24843ab8 addiu r4,r4,0x3ab8
+
  0018b6ec: 24843ab8 addiu r4,r4,0x3ab8 Load Weapon Secondary Data
  0018b6f0: 0c017895 jal 0x0005e254 Store data for the null weapon (fists) into 0x1938fe-905
+
  0018b6f0: 0c017895 jal 0x0005e254 Store data for the null weapon (fists) into 0x801938fe - 0x80193905
  0018b6f4: 34060008 ori r6,r0,0x0008
+
  0018b6f4: 34060008 ori r6,r0,0x0008 r6 = 0x08 (limit)
  0018b6f8: 3c058019 lui r5,0x8019
+
  0018b6f8: 3c058019 lui r5,0x8019
  0018b6fc: 24a538f0 addiu r5,r5,0x38f0
+
  0018b6fc: 24a538f0 addiu r5,r5,0x38f0 Load Ability Range
  0018b700: 87a20012 lh r2,0x0012(r29)
+
  0018b700: 87a20012 lh r2,0x0012(r29) Load Used Ability ID?
  0018b704: 3406000e ori r6,r0,0x000e
+
  0018b704: 3406000e ori r6,r0,0x000e r6 = 0x0e (limit for 0x8018b720)
  0018b708: 000280c0 sll r16,r2,0x03
+
  0018b708: 000280c0 sll r16,r2,0x03 ID * 8
  0018b70c: 02028023 subu r16,r16,r2
+
  0018b70c: 02028023 subu r16,r16,r2 ID * 7
  0018b710: 00108040 sll r16,r16,0x01
+
  0018b710: 00108040 sll r16,r16,0x01 ID * 14
  0018b714: 3c028006 lui r2,0x8006
+
  0018b714: 3c028006 lui r2,0x8006
  0018b718: 2442fbf0 addiu r2,r2,0xfbf0
+
  0018b718: 2442fbf0 addiu r2,r2,0xfbf0
  0018b71c: 02028021 addu r16,r16,r2
+
  0018b71c: 02028021 addu r16,r16,r2 0x8006fbf0 + ID * 14
  0018b720: 0c017895 jal 0x0005e254 Store ability data into 0x1938f0-d (but didn't we already do this?)
+
  0018b720: 0c017895 jal 0x0005e254 Store ability data into 0x801938f0 - 0x801938fd
  0018b724: 02002021 addu r4,r16,r0
+
  0018b724: 02002021 addu r4,r16,r0 Load 0x8006fbf0 + ID * 14 into r4
  0018b728: 9202000b lbu r2,0x000b(r16)
+
  0018b728: 9202000b lbu r2,0x000b(r16) Load Inflict Status ID
  0018b72c: 3c018019 lui r1,0x8019
+
  0018b72c: 3c018019 lui r1,0x8019
  0018b730: a02238da sb r2,0x38da(r1) Store status proc from spell
+
  0018b730: a02238da sb r2,0x38da(r1) Store status proc from spell
  0018b734: 3c028019 lui r2,0x8019
+
  0018b734: 3c028019 lui r2,0x8019
  0018b738: 904238f3 lbu r2,0x38f3(r2)
+
  0018b738: 904238f3 lbu r2,0x38f3(r2) Load first set of Ability Flags
  0018b73c: 92100008 lbu r16,0x0008(r16)
+
  0018b73c: 92100008 lbu r16,0x0008(r16) Load Ability Formula
  0018b740: 30420024 andi r2,r2,0x0024
+
  0018b740: 30420024 andi r2,r2,0x0024
  0018b744: 1440005e bne r2,r0,0x 0018b8c0 Branch if ranged weapon or weapon strike to get formula address, using the spell's formula
+
  0018b744: 1440005e bne r2,r0,0x0018b8c0 Branch if ranged weapon or weapon strike to get formula address, using the spell's formula
 
  0018b748: 320200ff andi r2,r16,0x00ff
 
  0018b748: 320200ff andi r2,r16,0x00ff
  0018b74c: 324300ff andi r3,r18,0x00ff
+
  0018b74c: 324300ff andi r3,r18,0x00ff Load Action Menu into r3
  0018b750: 34020007 ori r2,r0,0x0007
+
  0018b750: 34020007 ori r2,r0,0x0007 r2 = 0x07
  0018b754: 1062005a beq r3,r2,0x 0018b8c0 Branch if Draw Out to get formula address, using the spell's formula
+
  0018b754: 1062005a beq r3,r2,0x0018b8c0 Branch if Action Menu = Draw Out
  0018b758: 320200ff andi r2,r16,0x00ff
+
  0018b758: 320200ff andi r2,r16,0x00ff Load Ability Formula into r16
  0018b75c: 3c018019 lui r1,0x8019
+
  0018b75c: 3c018019 lui r1,0x8019
  0018b760: a02038d8 sb r0,0x38d8(r1) If not, Used Weapon ID = 0
+
  0018b760: a02038d8 sb r0,0x38d8(r1) Store Used Weapon ID as 0x00
  0018b764: 08062e2f j 0x 0018b8bc Jump to get formula address, using the spell's formula [but WP = 0]
+
  0018b764: 08062e2f j 0x0018b8bc
  0018b768: 00000000 nop
+
  0018b768: 00000000 nop
  0018b76c: 93a7 0018 lbu r7,0x 0018(r29)
+
  0018b76c: 93a70018 lbu r7,0x0018(r29)
 
  0018b770: 00000000 nop
 
  0018b770: 00000000 nop
  0018b774: 2ce200f0 sltiu r2,r7,0x00f0
+
  0018b774: 2ce200f0 sltiu r2,r7,0x00f0
  0018b778: 14400050 bne r2,r0,0x 0018b8bc Branch if ITEM was not used
+
  0018b778: 14400050 bne r2,r0,0x0018b8bc Branch if ITEM command not used
  0018b77c: 34100001 ori r16,r0,0x0001
+
  0018b77c: 34100001 ori r16,r0,0x0001 r16 = 0x01
  0018b780: 3c048019 lui r4,0x8019
+
  0018b780: 3c048019 lui r4,0x8019
  0018b784: 248438d8 addiu r4,r4,0x38d8
+
  0018b784: 248438d8 addiu r4,r4,0x38d8 Load Used Weapon ID
  0018b788: a0870000 sb r7,0x0000(r4) If ITEM was used, store item ID as Used Weapon ID.
+
  0018b788: a0870000 sb r7,0x0000(r4) Load Used Weapon ID into r7
  0018b78c: 24e70010 addiu r7,r7,0x0010
+
  0018b78c: 24e70010 addiu r7,r7,0x0010 Used Weapon ID + 0x10
  0018b790: 2484 0018 addiu r4,r4,0x 0018
+
  0018b790: 24840018 addiu r4,r4,0x0018 Used Weapon ID + 0x18
  0018b794: 30e200ff andi r2,r7,0x00ff
+
  0018b794: 30e200ff andi r2,r7,0x00ff Move Used Weapon ID + 0x10 into R2
  0018b798: 00028040 sll r16,r2,0x01
+
  0018b798: 00028040 sll r16,r2,0x01 ID * 2
  0018b79c: 02028021 addu r16,r16,r2
+
  0018b79c: 02028021 addu r16,r16,r2 ID * 3
  0018b7a0: 3c028006 lui r2,0x8006
+
  0018b7a0: 3c028006 lui r2,0x8006
  0018b7a4: 24423f98 addiu r2,r2,0x3f98
+
  0018b7a4: 24423f98 addiu r2,r2,0x3f98 Load Item Secondary Data (For ITEM)
  0018b7a8: 02028021 addu r16,r16,r2
+
  0018b7a8: 02028021 addu r16,r16,r2 Item Data + ID * 3
  0018b7ac: 3c018019 lui r1,0x8019
+
  0018b7ac: 3c018019 lui r1,0x8019
  0018b7b0: a02738db sb r7,0x38db(r1) Store item used as Conusmable ID (which is simply item ID - 0xF0)
+
  0018b7b0: a02738db sb r7,0x38db(r1) Store Consumed Item ID
  0018b7b4: 92020002 lbu r2,0x0002(r16)
+
  0018b7b4: 92020002 lbu r2,0x0002(r16) Load Item's inflicted Status
  0018b7b8: 3c018019 lui r1,0x8019
+
  0018b7b8: 3c018019 lui r1,0x8019
  0018b7bc: a02238da sb r2,0x38da(r1) Store status proc of item
+
  0018b7bc: a02238da sb r2,0x38da(r1) Store status proc of item
  0018b7c0: 0c017991 jal 0x0005e644 Set to zero ability data from 0x1938f0-d (I'm assuming ability range is then later determined)
+
  0018b7c0: 0c017991 jal 0x0005e644 Null Data
  0018b7c4: 3405000e ori r5,r0,0x000e
+
  0018b7c4: 3405000e ori r5,r0,0x000e r5 = 0x0e (limit)
  0018b7c8: 92100000 lbu r16,0x0000(r16)
+
  0018b7c8: 92100000 lbu r16,0x0000(r16)
  0018b7cc: 08062e30 j 0x 0018b8c0 If ITEM, get formula address of item formula.
+
  0018b7cc: 08062e30 j 0x0018b8c0 If ITEM command, get formula address of item formula
  0018b7d0: 320200ff andi r2,r16,0x00ff
+
  0018b7d0: 320200ff andi r2,r16,0x00ff
  0018b7d4: 08062e2f j 0x 0018b8bc If THROW, get formula address with formula = 0x63
+
  0018b7d4: 08062e2f j 0x0018b8bc If THROW command, get formula address with formula = 0x63
  0018b7d8: 34100063 ori r16,r0,0x0063
+
  0018b7d8: 34100063 ori r16,r0,0x0063
  0018b7dc: 08062e2f j 0x 0018b8bc If JUMP, get formula address with formula = 0x64
+
  0018b7dc: 08062e2f j 0x0018b8bc If JUMP command, get formula address with formula = 0x64
  0018b7e0: 34100064 ori r16,r0,0x0064
+
  0018b7e0: 34100064 ori r16,r0,0x0064
 
  0018b7e4: 97a30012 lhu r3,0x0012(r29)
 
  0018b7e4: 97a30012 lhu r3,0x0012(r29)
 
  0018b7e8: 00000000 nop
 
  0018b7e8: 00000000 nop
 
  0018b7ec: 2462fe6a addiu r2,r3,0xfe6a
 
  0018b7ec: 2462fe6a addiu r2,r3,0xfe6a
 
  0018b7f0: 2c420008 sltiu r2,r2,0x0008
 
  0018b7f0: 2c420008 sltiu r2,r2,0x0008
  0018b7f4: 14400003 bne r2,r0,0x 0018b804 Branch if skill is CHARGE (where does CHARGE decide to always use formula 05?)
+
  0018b7f4: 14400003 bne r2,r0,0x0018b804 Branch if skill is CHARGE (where does CHARGE decide to always use formula 05?)
  0018b7f8: 00031040 sll r2,r3,0x01
+
  0018b7f8: 00031040 sll r2,r3,0x01
  0018b7fc: 34030196 ori r3,r0,0x0196 ELSE, default to Charge +1 (if I change this a bit, should be possible to make Charge accept Charge +X attacks and normal attacks)
+
  0018b7fc: 34030196 ori r3,r0,0x0196 default to Charge +1
  0018b800: 00031040 sll r2,r3,0x01
+
  0018b800: 00031040 sll r2,r3,0x01
  0018b804: 3c018006 lui r1,0x8006
+
  0018b804: 3c018006 lui r1,0x8006
  0018b808: 00220821 addu r1,r1,r2
+
  0018b808: 00220821 addu r1,r1,r2
  0018b80c: 90220d19 lbu r2,0x0d19(r1)
+
  0018b80c: 90220d19 lbu r2,0x0d19(r1) Load Charge Power boost
  0018b810: 3c018019 lui r1,0x8019
+
  0018b810: 3c018019 lui r1,0x8019
  0018b814: a02238e4 sb r2,0x38e4(r1) Store charge power boost
+
  0018b814: a02238e4 sb r2,0x38e4(r1) Store Charge Power boost
  0018b818: 3c028019 lui r2,0x8019
+
  0018b818: 3c028019 lui r2,0x8019
  0018b81c: 904238ff lbu r2,0x38ff(r2)
+
  0018b81c: 904238ff lbu r2,0x38ff(r2) Load Weapon Characteristics
  0018b820: 92300002 lbu r16,0x0002(r17)
+
  0018b820: 92300002 lbu r16,0x0002(r17)
  0018b824: 30420004 andi r2,r2,0x0004
+
  0018b824: 30420004 andi r2,r2,0x0004
  0018b828: 10400025 beq r2,r0,0x 0018b8c0 If weapon can't be 2H, get formula address with formula = weapon formula
+
  0018b828: 10400025 beq r2,r0,0x0018b8c0 Branch if 2h is not active
  0018b82c: 320200ff andi r2,r16,0x00ff
+
  0018b82c: 320200ff andi r2,r16,0x00ff
  0018b830: 3c038019 lui r3,0x8019
+
  0018b830: 3c038019 lui r3,0x8019
  0018b834: 8c632d94 lw r3,0x2d94(r3)
+
  0018b834: 8c632d94 lw r3,0x2d94(r3) Load Attacker's Data
  0018b838: 00000000 nop
+
  0018b838: 00000000 nop
  0018b83c: 90620091 lbu r2,0x0091(r3)
+
  0018b83c: 90620091 lbu r2,0x0091(r3) Load third set of support
  0018b840: 00000000 nop
+
  0018b840: 00000000 nop
  0018b844: 30420002 andi r2,r2,0x0002
+
  0018b844: 30420002 andi r2,r2,0x0002
  0018b848: 1040001c beq r2,r0,0x 0018b8bc If 2H support is not used, get formula address with formula = weapon formula
+
  0018b848: 1040001c beq r2,r0,0x0018b8bc Branch if not using Two Hands
  0018b84c: 340200ff ori r2,r0,0x00ff
+
  0018b84c: 340200ff ori r2,r0,0x00ff r2 = 0xff
  0018b850: 9064001d lbu r4,0x001d(r3)
+
  0018b850: 9064001d lbu r4,0x001d(r3) Load Right Hand Weapon
  0018b854: 00000000 nop
+
  0018b854: 00000000 nop
  0018b858: 14820009 bne r4,r2,0x 0018b880 Branch to ??? if 2H is an active support but RH weapon exists
+
  0018b858: 14820009 bne r4,r2,0x0018b880
  0018b85c: 00000000 nop
+
  0018b85c: 00000000 nop
  0018b860: 9062001e lbu r2,0x001e(r3)
+
  0018b860: 9062001e lbu r2,0x001e(r3) Load Left Hand Weapon
 
  0018b864: 00000000 nop
 
  0018b864: 00000000 nop
  0018b868: 14440005 bne r2,r4,0x 0018b880 Branch to ??? if 2H is an active support but RH shield exists (no...this should cause auto-void)
+
  0018b868: 14440005 bne r2,r4,0x0018b880
  0018b86c: 34020001 ori r2,r0,0x0001
+
  0018b86c: 34020001 ori r2,r0,0x0001
  0018b870: 3c018019 lui r1,0x8019
+
  0018b870: 3c018019 lui r1,0x8019
  0018b874: a02238d9 sb r2,0x38d9(r1) ELSE, set 2H flag as true.
+
  0018b874: a02238d9 sb r2,0x38d9(r1) Store Two Hands as active
  0018b878: 3c038019 lui r3,0x8019
+
  0018b878: 3c038019 lui r3,0x8019
  0018b87c: 8c632d94 lw r3,0x2d94(r3)
+
  0018b87c: 8c632d94 lw r3,0x2d94(r3) Load Attacker's Data
  0018b880: 00000000 nop
+
  0018b880: 00000000 nop
  0018b884: 9064001f lbu r4,0x001f(r3)
+
  0018b884: 9064001f lbu r4,0x001f(r3) Load Left Hand Weapon
  0018b888: 340200ff ori r2,r0,0x00ff
+
  0018b888: 340200ff ori r2,r0,0x00ff
  0018b88c: 1482000c bne r4,r2,0x 0018b8c0 Branch to get formula address using weapon formula if 2H is an active support and LH weapon exists
+
  0018b88c: 1482000c bne r4,r2,0x0018b8c0 Branch if Left Hand Weapon Does exist
  0018b890: 320200ff andi r2,r16,0x00ff
+
  0018b890: 320200ff andi r2,r16,0x00ff
  0018b894: 90620020 lbu r2,0x0020(r3)
+
  0018b894: 90620020 lbu r2,0x0020(r3) Load Right Hand Weapon
  0018b898: 00000000 nop
+
  0018b898: 00000000 nop
  0018b89c: 14440008 bne r2,r4,0x 0018b8c0 Branch to get formula address using weapon formula if 2H is an active support and LH shield exists
+
  0018b89c: 14440008 bne r2,r4,0x0018b8c0 Branch if Right Hand Weaon does exist
  0018b8a0: 320200ff andi r2,r16,0x00ff
+
  0018b8a0: 320200ff andi r2,r16,0x00ff
  0018b8a4: 34020001 ori r2,r0,0x0001
+
  0018b8a4: 34020001 ori r2,r0,0x0001
  0018b8a8: 3c018019 lui r1,0x8019
+
  0018b8a8: 3c018019 lui r1,0x8019
  0018b8ac: a02238d9 sb r2,0x38d9(r1) ELSE, set 2H flag as true and get formula address using weapon formula
+
  0018b8ac: a02238d9 sb r2,0x38d9(r1) Store Two Hands as active
  0018b8b0: 08062e30 j 0x 0018b8c0
+
  0018b8b0: 08062e30 j 0x0018b8c0
  0018b8b4: 320200ff andi r2,r16,0x00ff
+
  0018b8b4: 320200ff andi r2,r16,0x00ff Load Ability formula into r2
  0018b8b8: 34100001 ori r16,r0,0x0001
+
  0018b8b8: 34100001 ori r16,r0,0x0001
  0018b8bc: 320200ff andi r2,r16,0x00ff
+
  0018b8bc: 320200ff andi r2,r16,0x00ff Load Ability formula into r2
  0018b8c0: 3c018019 lui r1,0x8019
+
  0018b8c0: 3c018019 lui r1,0x8019
  0018b8c4: a42038c8 sh r0,0x38c8(r1) Turn off spell proc (obviously, this would make no sense unless this routine is run twice, first by the regular attack, and then by the spell proc)
+
  0018b8c4: a42038c8 sh r0,0x38c8(r1) Store Spell Proc Ability ID as 0x00
  0018b8c8: 3c018019 lui r1,0x8019
+
  0018b8c8: 3c018019 lui r1,0x8019
  0018b8cc: a02038ed sb r0,0x38ed(r1) Zero byte 0x1938ed (but this byte is always either zero....or above 0x80, in which this code gets skipped...WTF?)
+
  0018b8cc: a02038ed sb r0,0x38ed(r1) Zero byte 0x1938ed (but this byte is always either zero or above 0x80, in which this code gets skipped??)
  0018b8d0: 10400003 beq r2,r0,0x 0018b8e0
+
  0018b8d0: 10400003 beq r2,r0,0x0018b8e0
  0018b8d4: 2c420065 sltiu r2,r2,0x0065
+
  0018b8d4: 2c420065 sltiu r2,r2,0x0065
  0018b8d8: 14400002 bne r2,r0,0x 0018b8e4 If formula is from 0x01 to 0x64, GOTO calculate offset
+
  0018b8d8: 14400002 bne r2,r0,0x0018b8e4 If formula is from 0x01 to 0x64, GOTO calculate offset
 
  0018b8dc: 00000000 nop
 
  0018b8dc: 00000000 nop
  0018b8e0: 34100001 ori r16,r0,0x0001 ELSE, formula is hard-coded to 0x01
+
  0018b8e0: 34100001 ori r16,r0,0x0001 r16 = 0x01
  0018b8e4: 3c058019 lui r5,0x8019
+
  0018b8e4: 3c058019 lui r5,0x8019
  0018b8e8: 24a538da addiu r5,r5,0x38da
+
  0018b8e8: 24a538da addiu r5,r5,0x38da Load Weapon Proc
  0018b8ec: 90a70000 lbu r7,0x0000(r5) r7 = Spell Proc ID
+
  0018b8ec: 90a70000 lbu r7,0x0000(r5) Load Weapon Proc into r7
  0018b8f0: 321100ff andi r17,r16,0x00ff r17 = Formula ID
+
  0018b8f0: 321100ff andi r17,r16,0x00ff Load Weapon type into r17
  0018b8f4: 34020003 ori r2,r0,0x0003
+
  0018b8f4: 34020003 ori r2,r0,0x0003 r2 = 0x03
  0018b8f8: 16220002 bne r17,r2,0x 0018b904 If formula isn't Guns, GOTO ???
+
  0018b8f8: 16220002 bne r17,r2,0x0018b904 Branch if Weapon is Gun?
  0018b8fc: 24a5002c addiu r5,r5,0x002c
+
  0018b8fc: 24a5002c addiu r5,r5,0x002c 0x801938da + 2c
  0018b900: 00003821 addu r7,r0,r0 If formula is guns, spell proc ID = 0
+
  0018b900: 00003821 addu r7,r0,r0 Clear Weapon Proc ID
  0018b904: 30e200ff andi r2,r7,0x00ff
+
  0018b904: 30e200ff andi r2,r7,0x00ff Load Weapon Proc ID into r2
  0018b908: 00022040 sll r4,r2,0x01
+
  0018b908: 00022040 sll r4,r2,0x01 ID * 2
  0018b90c: 00822021 addu r4,r4,r2
+
  0018b90c: 00822021 addu r4,r4,r2 ID * 3
  0018b910: 00042040 sll r4,r4,0x01
+
  0018b910: 00042040 sll r4,r4,0x01 ID * 6
  0018b914: 3c028006 lui r2,0x8006
+
  0018b914: 3c028006 lui r2,0x8006
  0018b918: 24423fc4 addiu r2,r2,0x3fc4
+
  0018b918: 24423fc4 addiu r2,r2,0x3fc4 Load Inflict Status
  0018b91c: 00822021 addu r4,r4,r2
+
  0018b91c: 00822021 addu r4,r4,r2
  0018b920: 0c017895 jal 0x0005e254 Store status proc type and statii to 0x193906-0B
+
  0018b920: 0c017895 jal 0x0005e254 Store Status information at 0x80193906 - 0x8019390b
  0018b924: 34060006 ori r6,r0,0x0006
+
  0018b924: 34060006 ori r6,r0,0x0006 r6 = 0x06 (limit for above)
  0018b928: 0c062e7e jal 0x 0018b9f8 Write status cured to 0x193860-64
+
  0018b928: 0c062e7e jal 0x0018b9f8 Status Removal
  0018b92c: 00000000 nop
+
  0018b92c: 00000000 nop
  0018b930: 3c018019 lui r1,0x8019
+
  0018b930: 3c018019 lui r1,0x8019
  0018b934: a03038e5 sb r16,0x38e5(r1) Store formula ID.
+
  0018b934: a03038e5 sb r16,0x38e5(r1) Store Ability ID
  0018b938: 0c063279 jal 0x 0018c9e4 Hard-coded stuff (Reflect status triggers the "unused" reaction Reflect, Blade Grasp/Arrow Guard modify accuracy, spell/status proc is nulled by specials...)
+
  0018b938: 0c063279 jal 0x0018c9e4 Blade Grasp, Arrow Guard Check
  0018b93c: 00000000 nop
+
  0018b93c: 00000000 nop
  0018b940: 3c028019 lui r2,0x8019
+
  0018b940: 3c028019 lui r2,0x8019
  0018b944: 8c422d90 lw r2,0x2d90(r2)
+
  0018b944: 8c422d90 lw r2,0x2d90(r2) Load Defender Current Action Data
  0018b948: 00000000 nop
+
  0018b948: 00000000 nop
  0018b94c: 90420000 lbu r2,0x0000(r2)
+
  0018b94c: 90420000 lbu r2,0x0000(r2) Load Hit Flag
  0018b950: 00000000 nop
+
  0018b950: 00000000 nop
  0018b954: 14400003 bne r2,r0,0x 0018b964 Branch to get formula address if attack hits.
+
  0018b954: 14400003 bne r2,r0,0x0018b964 Branch if attack hit
  0018b958: 00111080 sll r2,r17,0x02
+
  0018b958: 00111080 sll r2,r17,0x02
  0018b95c: 08062e77 j 0x 0018b9dc If miss, GOTO ???
+
  0018b95c: 08062e77 j 0x0018b9dc Jump to end if Attack Missed
  0018b960: 34020001 ori r2,r0,0x0001
+
  0018b960: 34020001 ori r2,r0,0x0001 r2 = 0x01
  0018b964: 3c018019 lui r1,0x8019
+
  0018b964: 3c018019 lui r1,0x8019
  0018b968: 00220821 addu r1,r1,r2
+
  0018b968: 00220821 addu r1,r1,r2
  0018b96c: 8c22f610 lw r2,-0x09f0(r1)
+
  0018b96c: 8c22f610 lw r2,-0x09f0(r1) Load Formula Table
  0018b970: 00000000 nop
+
  0018b970: 00000000 nop
  0018b974: 0040f809 jalr r2,r31 Jump to Formula Routine
+
  0018b974: 0040f809 jalr r2,r31
(unfinished)
+
0018b978: 00000000 nop
 +
0018b97c: 2e220007 sltiu r2,r17,0x0007
 +
0018b980: 10400004 beq r2,r0,0x0018b994 Branch in Formula > 0x06
 +
0018b984: 34020064 ori r2,r0,0x0064 r2 = 0x64
 +
0018b988: 0c061f28 jal 0x00187ca0 Formula 01 - 06 Aftermath
 +
0018b98c: 00000000 nop
 +
0018b990: 34020064 ori r2,r0,0x0064 r2 = 0x64
 +
0018b994: 16220003 bne r17,r2,0x0018b9a4 Branch if Formula ID =/= 0x64
 +
0018b998: 00000000 nop
 +
0018b99c: 3c018019 lui r1,0x8019
 +
0018b9a0: a02038d8 sb r0,0x38d8(r1) Load Used Weapon ID
 +
0018b9a4: 0c062e91 jal 0x0018ba44
 +
0018b9a8: 00000000 nop
 +
0018b9ac: 3c038019 lui r3,0x8019
 +
0018b9b0: 8c632d90 lw r3,0x2d90(r3) Load Defender Current Action Data
 +
0018b9b4: 00000000 nop
 +
0018b9b8: 94620010 lhu r2,0x0010(r3) Load Special Action Flags
 +
0018b9bc: 00000000 nop
 +
0018b9c0: 10400006 beq r2,r0,0x0018b9dc Branch if no Special Flags are active
 +
0018b9c4: 00001021 addu r2,r0,r0 r2 = 0x00 (why are we setting r2 to 0 if we're branch if its already 0?)
 +
0018b9c8: 90620025 lbu r2,0x0025(r3) Load attack-type
 +
0018b9cc: 00000000 nop
 +
0018b9d0: 34420001 ori r2,r2,0x0001 r2 = 0x01
 +
0018b9d4: a0620025 sb r2,0x0025(r3) Store attack-type as Pseudo-Status change
 +
0018b9d8: 00001021 addu r2,r0,r0 r2 = 0x00
 +
0018b9dc: 8fbf0034 lw r31,0x0034(r29)
 +
0018b9e0: 8fb20030 lw r18,0x0030(r29)
 +
0018b9e4: 8fb1002c lw r17,0x002c(r29)
 +
0018b9e8: 8fb00028 lw r16,0x0028(r29)
 +
0018b9ec: 27bd0038 addiu r29,r29,0x0038
 +
0018b9f0: 03e00008 jr r31
 +
0018b9f4: 00000000 nop

Revision as of 17:42, 24 February 2012

Pre Formula Setup (FDC)
 0018b34c: 27bdffc8 addiu r29,r29,0xffc8		
0018b350: afb00028 sw r16,0x0028(r29)		
0018b354: 00a08021 addu r16,r5,r0		
0018b358: 27a50010 addiu r5,r29,0x0010		
0018b35c: afbf0034 sw r31,0x0034(r29)		
0018b360: afb20030 sw r18,0x0030(r29)		
0018b364: 0c01788b jal 0x0005e22c		Transfer Target ID
0018b368: afb1002c sw r17,0x002c(r29)		
0018b36c: 3c018019 lui r1,0x8019		
0018b370: a03038c1 sb r16,0x38c1(r1)		Store ID of the defending unit
0018b374: 321000ff andi r16,r16,0x00ff		
0018b378: 001010c0 sll r2,r16,0x03		
0018b37c: 00501023 subu r2,r2,r16		
0018b380: 00021180 sll r2,r2,0x06		
0018b384: 3c048019 lui r4,0x8019		
0018b388: 248408cc addiu r4,r4,0x08cc		Load Unit Data
0018b38c: 00441821 addu r3,r2,r4		
0018b390: 3c018019 lui r1,0x8019		
0018b394: ac232d98 sw r3,0x2d98(r1)		Store Defender's Data
0018b398: 2483018c addiu r3,r4,0x018c		
0018b39c: 00431021 addu r2,r2,r3		
0018b3a0: 93a30010 lbu r3,0x0010(r29)		
0018b3a4: 3c018019 lui r1,0x8019		
0018b3a8: ac222d90 sw r2,0x2d90(r1)		Store Defender's Current Action Data
0018b3ac: 3c028019 lui r2,0x8019		
0018b3b0: 244238c0 addiu r2,r2,0x38c0		Load Attacker's Unit ID
0018b3b4: 3c018019 lui r1,0x8019		
0018b3b8: a020390e sb r0,0x390e(r1)		Store formula as 0x00
0018b3bc: a0430000 sb r3,0x0000(r2)		Store ID of the attacking unit
0018b3c0: 90430000 lbu r3,0x0000(r2)		
0018b3c4: 3c028019 lui r2,0x8019		
0018b3c8: 24422da0 addiu r2,r2,0x2da0		
0018b3cc: 3c018019 lui r1,0x8019		
0018b3d0: ac222d8c sw r2,0x2d8c(r1)		Store Attacker's Current Action Data
0018b3d4: 000310c0 sll r2,r3,0x03		
0018b3d8: 00431023 subu r2,r2,r3		
0018b3dc: 00021180 sll r2,r2,0x06		
0018b3e0: 3c038019 lui r3,0x8019		
0018b3e4: 8c63f5f0 lw r3,-0x0a10(r3)		
0018b3e8: 00441021 addu r2,r2,r4		
0018b3ec: 3c018019 lui r1,0x8019		
0018b3f0: ac222d94 sw r2,0x2d94(r1)		Store Attacker's Data
0018b3f4: 10600009 beq r3,r0,0x0018b41c		
0018b3f8: 00000000 nop				
0018b3fc: 0c062bcb jal 0x0018af2c		Load Reaction Table
0018b400: 00000000 nop				
0018b404: 10400005 beq r2,r0,0x0018b41c		Branch if Reaction failed
0018b408: 00000000 nop				
0018b40c: 0c062c9d jal 0x0018b274		Store correct weapon ID, modified by action menu ID
0018b410: 27a40010 addiu r4,r29,0x0010		
0018b414: 08062e77 j 0x0018b9dc			Goto End
0018b418: 00001021 addu r2,r0,r0		r2 = 0
0018b41c: 3c028019 lui r2,0x8019		
0018b420: 904238ed lbu r2,0x38ed(r2)		Load ???
0018b424: 00000000 nop				
0018b428: 30420080 andi r2,r2,0x0080		
0018b42c: 10400005 beq r2,r0,0x0018b444		Branch if 0x801938ed does not have 0x80 active
0018b430: 00000000 nop				
0018b434: 0c062b8f jal 0x0018ae3c		Fall Damage???
0018b438: 00000000 nop				
0018b43c: 08062e77 j 0x0018b9dc			Jump to end
0018b440: 00001021 addu r2,r0,r0		r2 = 0x00
0018b444: 3c048019 lui r4,0x8019		
0018b448: 8c842d98 lw r4,0x2d98(r4)		Load Defender's Data
0018b44c: 0c060428 jal 0x001810a0		Unit map location?
0018b450: 00000000 nop				
0018b454: 000210c0 sll r2,r2,0x03		
0018b458: 3c018019 lui r1,0x8019		
0018b45c: 00220821 addu r1,r1,r2		
0018b460: 9022f8cc lbu r2,-0x0734(r1)		Load Tile Data
0018b464: 3c038019 lui r3,0x8019		
0018b468: 906338c3 lbu r3,0x38c3(r3)		Load Weapon Hand (0 = R, 1 = L)
0018b46c: 3042003f andi r2,r2,0x003f		
0018b470: 3c018019 lui r1,0x8019		
0018b474: a02238cd sb r2,0x38cd(r1)		Store terrain type
0018b478: 14600005 bne r3,r0,0x0018b490		Branch if Weapon is in left hand
0018b47c: 00000000 nop				
0018b480: 3c078019 lui r7,0x8019		
0018b484: 90e738c4 lbu r7,0x38c4(r7)		Load Right Arm Equip ID
0018b488: 08062d26 j 0x0018b498			
0018b48c: 00000000 nop				
0018b490: 3c078019 lui r7,0x8019		
0018b494: 90e738c5 lbu r7,0x38c5(r7)		Load Left Arm Equip ID
0018b498: 93a30011 lbu r3,0x0011(r29)		Load equipment ID type
0018b49c: 34020013 ori r2,r0,0x0013		r2 = 0x13
0018b4a0: 14620004 bne r3,r2,0x0018b4b4		If not a Shield, r2 is Weapon ID
0018b4a4: 30e200ff andi r2,r7,0x00ff		
0018b4a8: 93a70018 lbu r7,0x0018(r29)		
0018b4ac: 00000000 nop				
0018b4b0: 30e200ff andi r2,r7,0x00ff		
0018b4b4: 2c420080 sltiu r2,r2,0x0080		
0018b4b8: 14400002 bne r2,r0,0x0018b4c4		
0018b4bc: 00000000 nop				
0018b4c0: 00003821 addu r7,r0,r0		If equipment was a shield, Weapon ID = 0
0018b4c4: 97a30012 lhu r3,0x0012(r29)		
0018b4c8: 3c108019 lui r16,0x8019		
0018b4cc: 261038d8 addiu r16,r16,0x38d8		Load Spell Proc Ability ID
0018b4d0: a2070000 sb r7,0x0000(r16)		Store Weapon ID
0018b4d4: 3c018019 lui r1,0x8019		
0018b4d8: a42338d6 sh r3,0x38d6(r1)		Store Used Ability ID
0018b4dc: 3c028019 lui r2,0x8019		
0018b4e0: 944238d6 lhu r2,0x38d6(r2)		Load Used Ability ID
0018b4e4: 3c018019 lui r1,0x8019		
0018b4e8: a02038d9 sb r0,0x38d9(r1)		Store Two Hands as inactive
0018b4ec: 2c420171 sltiu r2,r2,0x0171		
0018b4f0: 14400002 bne r2,r0,0x0018b4fc		If Move ID < Hi-Potion, go get ability pointer
0018b4f4: 26050018 addiu r5,r16,0x0018		
0018b4f8: 00001821 addu r3,r0,r0		Else load the pointer of first attack
0018b4fc: 000320c0 sll r4,r3,0x03		Used Ability ID * 8
0018b500: 00832023 subu r4,r4,r3		Used Ability ID * 7
0018b504: 00042040 sll r4,r4,0x01		Used Ability ID * 14
0018b508: 3c028006 lui r2,0x8006		
0018b50c: 2442fbf0 addiu r2,r2,0xfbf0		Load Ability Data
0018b510: 00822021 addu r4,r4,r2		Get Used Ability ID Data
0018b514: 3406000e ori r6,r0,0x000e		r6 = 0x0e
0018b518: 30e200ff andi r2,r7,0x00ff		Transfer Weapon ID to r2
0018b51c: 000210c0 sll r2,r2,0x03		Weapon ID * 8
0018b520: 3c038006 lui r3,0x8006		
0018b524: 24633ab8 addiu r3,r3,0x3ab8		Load Weapon Secondary Data
0018b528: 0c017895 jal 0x0005e254		Store ability data into 0x1938f0
0018b52c: 00438821 addu r17,r2,r3		0x80063ab8 + Weapon ID * 8
0018b530: 02202021 addu r4,r17,r0		r4 = 0x80063ab8 + Weapon ID * 8
0018b534: 26050026 addiu r5,r16,0x0026		
0018b538: 0c017895 jal 0x0005e254		Store Weapon Data into 0x1938fe-905
0018b53c: 34060008 ori r6,r0,0x0008		r6 = 0x08
0018b540: 92240007 lbu r4,0x0007(r17)		Load Inflict Status/Cast Spell ID from Weapon
0018b544: 3c038019 lui r3,0x8019		
0018b548: 8c632d94 lw r3,0x2d94(r3)		Load Attacker Data
0018b54c: 34020001 ori r2,r0,0x0001		R2 = 1
0018b550: 3c018019 lui r1,0x8019		
0018b554: a02038e4 sb r0,0x38e4(r1)		Store Charge Power as 0?
0018b558: 3c018019 lui r1,0x8019		
0018b55c: a02238e5 sb r2,0x38e5(r1)		Store Ability Formula
0018b560: 3c018019 lui r1,0x8019		
0018b564: a02438da sb r4,0x38da(r1)		Store Weapon Proc
0018b568: 90620026 lbu r2,0x0026(r3)		Load Attacker's Faith
0018b56c: 3c038019 lui r3,0x8019		
0018b570: 8c632d98 lw r3,0x2d98(r3)		Load Defender Data
0018b574: 3c018019 lui r1,0x8019		
0018b578: a02238d3 sb r2,0x38d3(r1)		Store Attacker's Faith
0018b57c: 90620026 lbu r2,0x0026(r3)		Load Defender's Faith
0018b580: 3c018019 lui r1,0x8019		
0018b584: a02238d2 sb r2,0x38d2(r1)		Store Defender's Faith
0018b588: 0c062b7d jal 0x0018adf4		Clear Data?
0018b58c: 00000000 nop				
0018b590: 93a20011 lbu r2,0x0011(r29)		
0018b594: 3c038019 lui r3,0x8019		
0018b598: 946338c8 lhu r3,0x38c8(r3)		r3 = 0x1 if spell proc is true, and 0x0 otherwise
0018b59c: 3c018019 lui r1,0x8019		
0018b5a0: a02238d4 sb r2,0x38d4(r1)		Store Action Menu ID (put a read on this location to find hard-coded???)
0018b5a4: 304200ff andi r2,r2,0x00ff		
0018b5a8: 3c018006 lui r1,0x8006		
0018b5ac: 00220821 addu r1,r1,r2		
0018b5b0: 90325cb4 lbu r18,0x5cb4(r1)		Load Action Menu into r18
0018b5b4: 10600009 beq r3,r0,0x0018b5dc		Branch if Weapon Proc failed
0018b5b8: 00000000 nop				
0018b5bc: 3c028019 lui r2,0x8019		
0018b5c0: 944238c6 lhu r2,0x38c6(r2)		Load ???
0018b5c4: 00000000 nop				
0018b5c8: a7a20012 sh r2,0x0012(r29)		If Spell proc is true, store proc ID as used ability ID (temporary)
0018b5cc: 3c018019 lui r1,0x8019		
0018b5d0: a42238d6 sh r2,0x38d6(r1)		Store Spell Proc ID as Used Ability ID
0018b5d4: 08062d79 j 0x0018b5e4			
0018b5d8: 00009021 addu r18,r0,r0		Clear Action Menu ID
0018b5dc: 3c018019 lui r1,0x8019		
0018b5e0: a42038c6 sh r0,0x38c6(r1)		Store ??? as 0x00
0018b5e4: 87a30012 lh r3,0x0012(r29)		
0018b5e8: 3c028006 lui r2,0x8006		
0018b5ec: 2442ebf0 addiu r2,r2,0xebf0		Load first set of Ability Data 
0018b5f0: 000318c0 sll r3,r3,0x03		r3 * 8
0018b5f4: 00621821 addu r3,r3,r2		0x8006ebf0 + r3 * 8
0018b5f8: 90620004 lbu r2,0x0004(r3)		Load first set of AI Flags
0018b5fc: 3c048019 lui r4,0x8019		
0018b600: 8c842d90 lw r4,0x2d90(r4)		Load Defender Current Action Data
0018b604: 30420003 andi r2,r2,0x0003		
0018b608: a0820018 sb r2,0x0018(r4)		Store Abilities AI Target Enemies/Allies into 0x18 of Current Action Data
0018b60c: 90620007 lbu r2,0x0007(r3)		Load fourth set of AI Flags?
0018b610: 00000000 nop				
0018b614: 30420001 andi r2,r2,0x0001		
0018b618: 10400009 beq r2,r0,0x0018b640		Branch if bit 0x01 is not active
0018b61c: 324300ff andi r3,r18,0x00ff		Load Action Menu ID into r3
0018b620: 3c038019 lui r3,0x8019		
0018b624: 8c632d90 lw r3,0x2d90(r3)		Load Defender Current Action Data
0018b628: 00000000 nop				
0018b62c: 90620018 lbu r2,0x0018(r3)		Load byte 0x18
0018b630: 00000000 nop				
0018b634: 24420080 addiu r2,r2,0x0080		
0018b638: a0620018 sb r2,0x0018(r3)		If animate on miss, store animate on miss flag as bit 8 into byte 0x18
0018b63c: 324300ff andi r3,r18,0x00ff		Load Action Menu ID into r3
0018b640: 34020007 ori r2,r0,0x0007		r2 0x07
0018b644: 14620006 bne r3,r2,0x0018b660		Branch if Action Menu ID = Draw Out
0018b648: 2c62000b sltiu r2,r3,0x000b		
0018b64c: 93a20018 lbu r2,0x0018(r29)		
0018b650: 00000000 nop				
0018b654: 24420026 addiu r2,r2,0x0026		
0018b658: a7a20012 sh r2,0x0012(r29)		
0018b65c: 2c62000b sltiu r2,r3,0x000b		
0018b660: 10400095 beq r2,r0,0x0018b8b8		Branch if Action Menu Type is defend or equip change; weapon formula = 0x01
0018b664: 00031080 sll r2,r3,0x02		
0018b668: 3c018017 lui r1,0x8017		
0018b66c: 00220821 addu r1,r1,r2		
0018b670: 8c224344 lw r2,0x4344(r1)		Load ??? Table
0018b674: 00000000 nop				
0018b678: 00400008 jr r2			
0018b67c: 00000000 nop				
0018b680: 3c048019 lui r4,0x8019		
0018b684: 8c842d94 lw r4,0x2d94(r4)		Load Attacker Data
0018b688: 0c05fcb6 jal 0x0017f2d8		ELEMENTAL terrain to skill hard-coding
0018b68c: 00000000 nop				
0018b690: a7a20012 sh r2,0x0012(r29)		
0018b694: 87a20012 lh r2,0x0012(r29)		
0018b698: 00000000 nop				
0018b69c: 28420171 slti r2,r2,0x0171		
0018b6a0: 10400086 beq r2,r0,0x0018b8bc		Branch if Ability ID > 171 (Hi-Potion? Not Potion?)
0018b6a4: 34100001 ori r16,r0,0x0001		r16 = 0x01
0018b6a8: 3c028019 lui r2,0x8019		
0018b6ac: 8c422d94 lw r2,0x2d94(r2)		Load Attacker Data
0018b6b0: 00000000 nop				
0018b6b4: 9042005a lbu r2,0x005a(r2)		Load third set of Current Status
0018b6b8: 00000000 nop				
0018b6bc: 30420002 andi r2,r2,0x0002		
0018b6c0: 1040000d beq r2,r0,0x0018b6f8		Branch if unit is not a frog
0018b6c4: 00000000 nop				
0018b6c8: 3c058019 lui r5,0x8019		
0018b6cc: 24a538c8 addiu r5,r5,0x38c8		Load Spell Proc Ability ID
0018b6d0: 94a20000 lhu r2,0x0000(r5)		Load Spell Proc Ability ID into r2
0018b6d4: 00000000 nop				
0018b6d8: 14400007 bne r2,r0,0x0018b6f8		Branch if spell proc is true (Check is redundant)
0018b6dc: 24a50036 addiu r5,r5,0x0036		0x801938c8 + 0x36
0018b6e0: 3c018019 lui r1,0x8019		
0018b6e4: a02038d8 sb r0,0x38d8(r1)		If frogged and no spell proc, store Used Weapon ID as 0x00
0018b6e8: 3c048006 lui r4,0x8006		
0018b6ec: 24843ab8 addiu r4,r4,0x3ab8		Load Weapon Secondary Data
0018b6f0: 0c017895 jal 0x0005e254		Store data for the null weapon (fists) into 0x801938fe - 0x80193905
0018b6f4: 34060008 ori r6,r0,0x0008		r6 = 0x08 (limit)
0018b6f8: 3c058019 lui r5,0x8019		
0018b6fc: 24a538f0 addiu r5,r5,0x38f0		Load Ability Range
0018b700: 87a20012 lh r2,0x0012(r29)		Load Used Ability ID?
0018b704: 3406000e ori r6,r0,0x000e		r6 = 0x0e (limit for 0x8018b720)
0018b708: 000280c0 sll r16,r2,0x03		ID * 8
0018b70c: 02028023 subu r16,r16,r2		ID * 7
0018b710: 00108040 sll r16,r16,0x01		ID * 14
0018b714: 3c028006 lui r2,0x8006		
0018b718: 2442fbf0 addiu r2,r2,0xfbf0		
0018b71c: 02028021 addu r16,r16,r2		0x8006fbf0 + ID * 14
0018b720: 0c017895 jal 0x0005e254		Store ability data into 0x801938f0 - 0x801938fd
0018b724: 02002021 addu r4,r16,r0		Load 0x8006fbf0 + ID * 14 into r4
0018b728: 9202000b lbu r2,0x000b(r16)		Load Inflict Status ID
0018b72c: 3c018019 lui r1,0x8019		
0018b730: a02238da sb r2,0x38da(r1)		Store status proc from spell
0018b734: 3c028019 lui r2,0x8019		
0018b738: 904238f3 lbu r2,0x38f3(r2)		Load first set of Ability Flags
0018b73c: 92100008 lbu r16,0x0008(r16)		Load Ability Formula
0018b740: 30420024 andi r2,r2,0x0024		
0018b744: 1440005e bne r2,r0,0x0018b8c0		Branch if ranged weapon or weapon strike to get formula address, using the spell's formula
0018b748: 320200ff andi r2,r16,0x00ff
0018b74c: 324300ff andi r3,r18,0x00ff		Load Action Menu into r3
0018b750: 34020007 ori r2,r0,0x0007		r2 = 0x07
0018b754: 1062005a beq r3,r2,0x0018b8c0		Branch if Action Menu = Draw Out
0018b758: 320200ff andi r2,r16,0x00ff		Load Ability Formula into r16
0018b75c: 3c018019 lui r1,0x8019		
0018b760: a02038d8 sb r0,0x38d8(r1)		Store Used Weapon ID as 0x00
0018b764: 08062e2f j 0x0018b8bc			
0018b768: 00000000 nop				
0018b76c: 93a70018 lbu r7,0x0018(r29)		
0018b770: 00000000 nop
0018b774: 2ce200f0 sltiu r2,r7,0x00f0		
0018b778: 14400050 bne r2,r0,0x0018b8bc		Branch if ITEM command not used
0018b77c: 34100001 ori r16,r0,0x0001		r16 = 0x01
0018b780: 3c048019 lui r4,0x8019		
0018b784: 248438d8 addiu r4,r4,0x38d8		Load Used Weapon ID
0018b788: a0870000 sb r7,0x0000(r4)		Load Used Weapon ID into r7
0018b78c: 24e70010 addiu r7,r7,0x0010		Used Weapon ID + 0x10
0018b790: 24840018 addiu r4,r4,0x0018		Used Weapon ID + 0x18
0018b794: 30e200ff andi r2,r7,0x00ff		Move Used Weapon ID + 0x10 into R2
0018b798: 00028040 sll r16,r2,0x01		ID * 2
0018b79c: 02028021 addu r16,r16,r2		ID * 3
0018b7a0: 3c028006 lui r2,0x8006		
0018b7a4: 24423f98 addiu r2,r2,0x3f98		Load Item Secondary Data (For ITEM)
0018b7a8: 02028021 addu r16,r16,r2		Item Data + ID * 3
0018b7ac: 3c018019 lui r1,0x8019		
0018b7b0: a02738db sb r7,0x38db(r1)		Store Consumed Item ID
0018b7b4: 92020002 lbu r2,0x0002(r16)		Load Item's inflicted Status
0018b7b8: 3c018019 lui r1,0x8019		
0018b7bc: a02238da sb r2,0x38da(r1)		Store status proc of item
0018b7c0: 0c017991 jal 0x0005e644		Null Data
0018b7c4: 3405000e ori r5,r0,0x000e		r5 = 0x0e (limit)
0018b7c8: 92100000 lbu r16,0x0000(r16)		
0018b7cc: 08062e30 j 0x0018b8c0			If ITEM command, get formula address of item formula
0018b7d0: 320200ff andi r2,r16,0x00ff		
0018b7d4: 08062e2f j 0x0018b8bc			If THROW command, get formula address with formula = 0x63
0018b7d8: 34100063 ori r16,r0,0x0063		
0018b7dc: 08062e2f j 0x0018b8bc			If JUMP command, get formula address with formula = 0x64
0018b7e0: 34100064 ori r16,r0,0x0064		
0018b7e4: 97a30012 lhu r3,0x0012(r29)
0018b7e8: 00000000 nop
0018b7ec: 2462fe6a addiu r2,r3,0xfe6a
0018b7f0: 2c420008 sltiu r2,r2,0x0008
0018b7f4: 14400003 bne r2,r0,0x0018b804		Branch if skill is CHARGE (where does CHARGE decide to always use formula 05?)
0018b7f8: 00031040 sll r2,r3,0x01		
0018b7fc: 34030196 ori r3,r0,0x0196		default to Charge +1
0018b800: 00031040 sll r2,r3,0x01		
0018b804: 3c018006 lui r1,0x8006		
0018b808: 00220821 addu r1,r1,r2		
0018b80c: 90220d19 lbu r2,0x0d19(r1)		Load Charge Power boost
0018b810: 3c018019 lui r1,0x8019		
0018b814: a02238e4 sb r2,0x38e4(r1)		Store Charge Power boost
0018b818: 3c028019 lui r2,0x8019		
0018b81c: 904238ff lbu r2,0x38ff(r2)		Load Weapon Characteristics
0018b820: 92300002 lbu r16,0x0002(r17)		
0018b824: 30420004 andi r2,r2,0x0004		
0018b828: 10400025 beq r2,r0,0x0018b8c0		Branch if 2h is not active
0018b82c: 320200ff andi r2,r16,0x00ff		
0018b830: 3c038019 lui r3,0x8019		
0018b834: 8c632d94 lw r3,0x2d94(r3)		Load Attacker's Data
0018b838: 00000000 nop				
0018b83c: 90620091 lbu r2,0x0091(r3)		Load third set of support
0018b840: 00000000 nop				
0018b844: 30420002 andi r2,r2,0x0002		
0018b848: 1040001c beq r2,r0,0x0018b8bc		Branch if not using Two Hands
0018b84c: 340200ff ori r2,r0,0x00ff		r2 = 0xff
0018b850: 9064001d lbu r4,0x001d(r3)		Load Right Hand Weapon
0018b854: 00000000 nop				
0018b858: 14820009 bne r4,r2,0x0018b880		
0018b85c: 00000000 nop				
0018b860: 9062001e lbu r2,0x001e(r3)		Load Left Hand Weapon
0018b864: 00000000 nop
0018b868: 14440005 bne r2,r4,0x0018b880		
0018b86c: 34020001 ori r2,r0,0x0001		
0018b870: 3c018019 lui r1,0x8019		
0018b874: a02238d9 sb r2,0x38d9(r1)		Store Two Hands as active
0018b878: 3c038019 lui r3,0x8019		
0018b87c: 8c632d94 lw r3,0x2d94(r3)		Load Attacker's Data
0018b880: 00000000 nop				
0018b884: 9064001f lbu r4,0x001f(r3)		Load Left Hand Weapon
0018b888: 340200ff ori r2,r0,0x00ff		
0018b88c: 1482000c bne r4,r2,0x0018b8c0		Branch if Left Hand Weapon Does exist
0018b890: 320200ff andi r2,r16,0x00ff		
0018b894: 90620020 lbu r2,0x0020(r3)		Load Right Hand Weapon
0018b898: 00000000 nop				
0018b89c: 14440008 bne r2,r4,0x0018b8c0		Branch if Right Hand Weaon does exist
0018b8a0: 320200ff andi r2,r16,0x00ff		
0018b8a4: 34020001 ori r2,r0,0x0001		
0018b8a8: 3c018019 lui r1,0x8019		
0018b8ac: a02238d9 sb r2,0x38d9(r1)		Store Two Hands as active
0018b8b0: 08062e30 j 0x0018b8c0			
0018b8b4: 320200ff andi r2,r16,0x00ff		Load Ability formula into r2
0018b8b8: 34100001 ori r16,r0,0x0001		
0018b8bc: 320200ff andi r2,r16,0x00ff		Load Ability formula into r2
0018b8c0: 3c018019 lui r1,0x8019		
0018b8c4: a42038c8 sh r0,0x38c8(r1)		Store Spell Proc Ability ID as 0x00
0018b8c8: 3c018019 lui r1,0x8019		
0018b8cc: a02038ed sb r0,0x38ed(r1)		Zero byte 0x1938ed (but this byte is always either zero or above 0x80, in which this code gets skipped??)
0018b8d0: 10400003 beq r2,r0,0x0018b8e0		
0018b8d4: 2c420065 sltiu r2,r2,0x0065		
0018b8d8: 14400002 bne r2,r0,0x0018b8e4		If formula is from 0x01 to 0x64, GOTO calculate offset
0018b8dc: 00000000 nop
0018b8e0: 34100001 ori r16,r0,0x0001		r16 = 0x01
0018b8e4: 3c058019 lui r5,0x8019		
0018b8e8: 24a538da addiu r5,r5,0x38da		Load Weapon Proc
0018b8ec: 90a70000 lbu r7,0x0000(r5)		Load Weapon Proc into r7
0018b8f0: 321100ff andi r17,r16,0x00ff		Load Weapon type into r17
0018b8f4: 34020003 ori r2,r0,0x0003		r2 = 0x03
0018b8f8: 16220002 bne r17,r2,0x0018b904	Branch if Weapon is Gun?
0018b8fc: 24a5002c addiu r5,r5,0x002c		0x801938da + 2c
0018b900: 00003821 addu r7,r0,r0		Clear Weapon Proc ID
0018b904: 30e200ff andi r2,r7,0x00ff		Load Weapon Proc ID into r2
0018b908: 00022040 sll r4,r2,0x01		ID * 2
0018b90c: 00822021 addu r4,r4,r2		ID * 3
0018b910: 00042040 sll r4,r4,0x01		ID * 6
0018b914: 3c028006 lui r2,0x8006		
0018b918: 24423fc4 addiu r2,r2,0x3fc4		Load Inflict Status
0018b91c: 00822021 addu r4,r4,r2		
0018b920: 0c017895 jal 0x0005e254		Store Status information at 0x80193906 - 0x8019390b
0018b924: 34060006 ori r6,r0,0x0006		r6 = 0x06 (limit for above)
0018b928: 0c062e7e jal 0x0018b9f8		Status Removal 
0018b92c: 00000000 nop				
0018b930: 3c018019 lui r1,0x8019		
0018b934: a03038e5 sb r16,0x38e5(r1)		Store Ability ID
0018b938: 0c063279 jal 0x0018c9e4		Blade Grasp, Arrow Guard Check
0018b93c: 00000000 nop				
0018b940: 3c028019 lui r2,0x8019		
0018b944: 8c422d90 lw r2,0x2d90(r2)		Load Defender Current Action Data
0018b948: 00000000 nop				
0018b94c: 90420000 lbu r2,0x0000(r2)		Load Hit Flag
0018b950: 00000000 nop				
0018b954: 14400003 bne r2,r0,0x0018b964		Branch if attack hit
0018b958: 00111080 sll r2,r17,0x02		
0018b95c: 08062e77 j 0x0018b9dc			Jump to end if Attack Missed
0018b960: 34020001 ori r2,r0,0x0001		r2 = 0x01
0018b964: 3c018019 lui r1,0x8019		
0018b968: 00220821 addu r1,r1,r2		
0018b96c: 8c22f610 lw r2,-0x09f0(r1)		Load Formula Table
0018b970: 00000000 nop				
0018b974: 0040f809 jalr r2,r31			
0018b978: 00000000 nop				
0018b97c: 2e220007 sltiu r2,r17,0x0007		
0018b980: 10400004 beq r2,r0,0x0018b994		Branch in Formula > 0x06
0018b984: 34020064 ori r2,r0,0x0064		r2 = 0x64
0018b988: 0c061f28 jal 0x00187ca0		Formula 01 - 06 Aftermath
0018b98c: 00000000 nop				
0018b990: 34020064 ori r2,r0,0x0064		r2 = 0x64
0018b994: 16220003 bne r17,r2,0x0018b9a4	Branch if Formula ID =/= 0x64
0018b998: 00000000 nop				
0018b99c: 3c018019 lui r1,0x8019		
0018b9a0: a02038d8 sb r0,0x38d8(r1)		Load Used Weapon ID
0018b9a4: 0c062e91 jal 0x0018ba44		
0018b9a8: 00000000 nop				
0018b9ac: 3c038019 lui r3,0x8019		
0018b9b0: 8c632d90 lw r3,0x2d90(r3)		Load Defender Current Action Data
0018b9b4: 00000000 nop
0018b9b8: 94620010 lhu r2,0x0010(r3)		Load Special Action Flags
0018b9bc: 00000000 nop				
0018b9c0: 10400006 beq r2,r0,0x0018b9dc		Branch if no Special Flags are active
0018b9c4: 00001021 addu r2,r0,r0		r2 = 0x00 (why are we setting r2 to 0 if we're branch if its already 0?)
0018b9c8: 90620025 lbu r2,0x0025(r3)		Load attack-type
0018b9cc: 00000000 nop				
0018b9d0: 34420001 ori r2,r2,0x0001		r2 = 0x01
0018b9d4: a0620025 sb r2,0x0025(r3)		Store attack-type as Pseudo-Status change
0018b9d8: 00001021 addu r2,r0,r0		r2 = 0x00
0018b9dc: 8fbf0034 lw r31,0x0034(r29)		
0018b9e0: 8fb20030 lw r18,0x0030(r29)		
0018b9e4: 8fb1002c lw r17,0x002c(r29)		
0018b9e8: 8fb00028 lw r16,0x0028(r29)		
0018b9ec: 27bd0038 addiu r29,r29,0x0038		
0018b9f0: 03e00008 jr r31			
0018b9f4: 00000000 nop