Ability Usage Checks and MP Reduction
Jump to navigation
Jump to search
Ability Usage Checks and MP Reduction (Returns r2 below:) 8 - Depth 2+ Unit that can't act in the water 7 - Unable to React 6 - 5 - Frog charging non-Frog ability, Frog using Charge 4 - 3 - Unit doesn't have enough MP 2 - Silenced unit using a non-silence ability 1 - 0 - Menu Type != Default, Unit is a Mime, MP Successfully reduced (or skipped) 0017da20: 27bdffd8 addiu r29,r29,0xffd8 0017da24: afb00018 sw r16,0x0018(r29) 0017da28: 00808021 addu r16,r4,r0 r16 = Unit's Data Pointer 0017da2c: afbf0024 sw r31,0x0024(r29) 0017da30: afb20020 sw r18,0x0020(r29) 0017da34: afb1001c sw r17,0x001c(r29) 0017da38: 9202016f lbu r2,0x016f(r16) Load Unit's Used Skillset ID 0017da3c: 96110170 lhu r17,0x0170(r16) Load Unit's Used Ability ID 0017da40: 3c018006 lui r1,0x8006 0017da44: 00220821 addu r1,r1,r2 0017da48: 90325cb4 lbu r18,0x5cb4(r1) Load Skillset's Action Menu ID 0017da4c: 3c028019 lui r2,0x8019 0017da50: 8c42f5f0 lw r2,-0x0a10(r2) Load reaction/attack tpe 0017da54: 3c018019 lui r1,0x8019 0017da58: a02038eb sb r0,0x38eb(r1) Store MP Used = 0 0017da5c: 14400003 bne r2,r0,0x0017da6c Branch if AI Calculation Type != 0 0017da60: 00000000 nop 0017da64: 0c0179ea jal 0x0005e7a8 Enable/Disable Acting Statuses 0017da68: 340500ff ori r5,r0,0x00ff r5 = FF (Load Performing Flag for setting) 0017da6c: 0c0604c3 jal 0x0018130c Check if Unit can React 0017da70: 02002021 addu r4,r16,r0 r4 = Unit's Data Pointer 0017da74: 9203005c lbu r3,0x005c(r16) Load Unit's Current Statuses 5 0017da78: 00000000 nop 0017da7c: 30630004 andi r3,r3,0x0004 0017da80: 10600002 beq r3,r0,0x0017da8c Branch if Unit doesn't have Don't Act 0017da84: 00000000 nop 0017da88: 34020001 ori r2,r0,0x0001 r2 = 1 (would be this anyway, so useless check) 0017da8c: 14400047 bne r2,r0,0x0017dbac Branch if Unit can't react (also includes 0017da90: 24420006 addiu r2,r2,0x0006 Result += 6 (= 7 or 8 here) 0017da94: 9202005a lbu r2,0x005a(r16) Load Unit's Current Statuses 3 0017da98: 00000000 nop 0017da9c: 30420002 andi r2,r2,0x0002 0017daa0: 1040000e beq r2,r0,0x0017dadc Branch if Unit doesn't have Frog 0017daa4: 00111400 sll r2,r17,0x10 0017daa8: 00021c03 sra r3,r2,0x10 r3 = Used Ability ID 0017daac: 10600005 beq r3,r0,0x0017dac4 Branch if ID = 0 0017dab0: 3402016f ori r2,r0,0x016f 0017dab4: 10620003 beq r3,r2,0x0017dac4 Branch if ID = Attack 0017dab8: 3402001d ori r2,r0,0x001d 0017dabc: 1462003b bne r3,r2,0x0017dbac Branch if ID != Frog 0017dac0: 34020005 ori r2,r0,0x0005 r2 = 5 0017dac4: 324300ff andi r3,r18,0x00ff r3 = Skillset's Action Menu ID 0017dac8: 3402000a ori r2,r0,0x000a 0017dacc: 14620004 bne r3,r2,0x0017dae0 Branch if Menu ID != Charge 0017dad0: 2e220170 sltiu r2,r17,0x0170 0017dad4: 0805f6eb j 0x0017dbac 0017dad8: 34020005 ori r2,r0,0x0005 r2 = 5 0017dadc: 2e220170 sltiu r2,r17,0x0170 0017dae0: 10400031 beq r2,r0,0x0017dba8 Branch if Ability ID isn't legal 0017dae4: 00111400 sll r2,r17,0x10 0017dae8: 00021403 sra r2,r2,0x10 0017daec: 000218c0 sll r3,r2,0x03 ID * 8 0017daf0: 00621823 subu r3,r3,r2 ID * 7 0017daf4: 00031840 sll r3,r3,0x01 ID * 14 0017daf8: 3c028006 lui r2,0x8006 0017dafc: 2442fbf0 addiu r2,r2,0xfbf0 0017db00: 00622021 addu r4,r3,r2 r4 = Ability Data 2 Pointer 0017db04: 324300ff andi r3,r18,0x00ff 0017db08: 10600003 beq r3,r0,0x0017db18 Branch if Menu ID = Default 0017db0c: 34020006 ori r2,r0,0x0006 0017db10: 1462000b bne r3,r2,0x0017db40 Branch if Menu ID != Monster 0017db14: 00000000 nop 0017db18: 90820005 lbu r2,0x0005(r4) Load Ability Flags 3 0017db1c: 00000000 nop 0017db20: 30420020 andi r2,r2,0x0020 0017db24: 10400006 beq r2,r0,0x0017db40 Branch if Ability isn't Affected by Silence 0017db28: 00000000 nop 0017db2c: 92020059 lbu r2,0x0059(r16) Load Unit's Current Statuses 2 0017db30: 00000000 nop 0017db34: 30420008 andi r2,r2,0x0008 0017db38: 1440001c bne r2,r0,0x0017dbac Branch if Unit has Silence 0017db3c: 34020002 ori r2,r0,0x0002 r2 = 2 0017db40: 1640001a bne r18,r0,0x0017dbac Branch if Menu ID != Default 0017db44: 00001021 addu r2,r0,r0 r2 = 0 0017db48: 92030003 lbu r3,0x0003(r16) Load Unit's Job ID 0017db4c: 3402005d ori r2,r0,0x005d 0017db50: 10620016 beq r3,r2,0x0017dbac Branch if Job ID = Mime 0017db54: 00001021 addu r2,r0,r0 r2 = 0 0017db58: 92020090 lbu r2,0x0090(r16) Load Unit's Support 2 0017db5c: 9084000d lbu r4,0x000d(r4) Load Ability's MP Cost 0017db60: 30420080 andi r2,r2,0x0080 0017db64: 10400002 beq r2,r0,0x0017db70 Branch if Unit has Half MP 0017db68: 00000000 nop 0017db6c: 00042042 srl r4,r4,0x01 MP Cost / 2 0017db70: 3c018019 lui r1,0x8019 0017db74: a02438eb sb r4,0x38eb(r1) Store MP Used 0017db78: 8602002c lh r2,0x002c(r16) Load Unit's MP 0017db7c: 00000000 nop 0017db80: 00402821 addu r5,r2,r0 r5 = Unit's MP 0017db84: 0044102a slt r2,r2,r4 0017db88: 14400008 bne r2,r0,0x0017dbac Branch if MP < MP Used 0017db8c: 34020003 ori r2,r0,0x0003 r2 = 3 0017db90: 3c038019 lui r3,0x8019 0017db94: 8c63f5fc lw r3,-0x0a04(r3) Load ? 0017db98: 34020002 ori r2,r0,0x0002 r2 = 2 0017db9c: 10620002 beq r3,r2,0x0017dba8 Branch if ? = 2 0017dba0: 00a41023 subu r2,r5,r4 MP -= MP Used 0017dba4: a602002c sh r2,0x002c(r16) Store Unit's new MP 0017dba8: 00001021 addu r2,r0,r0 r2 = 0 0017dbac: 8fbf0024 lw r31,0x0024(r29) 0017dbb0: 8fb20020 lw r18,0x0020(r29) 0017dbb4: 8fb1001c lw r17,0x001c(r29) 0017dbb8: 8fb00018 lw r16,0x0018(r29) 0017dbbc: 27bd0028 addiu r29,r29,0x0028 0017dbc0: 03e00008 jr r31 0017dbc4: 00000000 nop