Math Skill Targeting
Jump to navigation
Jump to search
Math Skill Targeting (For the AI)
0019bbbc: 27bdffd0 addiu r29,r29,0xffd0 0019bbc0: afbf002c sw r31,0x002c(r29) 0019bbc4: afb20028 sw r18,0x0028(r29) 0019bbc8: afb10024 sw r17,0x0024(r29) 0019bbcc: afb00020 sw r16,0x0020(r29) 0019bbd0: 3c058019 lui r5,0x8019 0019bbd4: 24a53dd4 addiu r5,r5,0x3dd4 Load AI Targeting Code Pointers? 0019bbd8: 88a20003 lwl r2,0x0003(r5) Transfer Values from 193dd4 0019bbdc: 98a20000 lwr r2,0x0000(r5) 0019bbe0: 88a30007 lwl r3,0x0007(r5) 0019bbe4: 98a30004 lwr r3,0x0004(r5) 0019bbe8: 80a40008 lb r4,0x0008(r5) 0019bbec: aba20013 swl r2,0x0013(r29) 0019bbf0: bba20010 swr r2,0x0010(r29) 0019bbf4: aba30017 swl r3,0x0017(r29) 0019bbf8: bba30014 swr r3,0x0014(r29) 0019bbfc: a3a40018 sb r4,0x0018(r29) 0019bc00: 80a20009 lb r2,0x0009(r5) 0019bc04: 00000000 nop 0019bc08: a3a20019 sb r2,0x0019(r29) 0019bc0c: 3c02801a lui r2,0x801a 0019bc10: 90420d7b lbu r2,0x0d7b(r2) Load Action Taken 0019bc14: 3c11801a lui r17,0x801a 0019bc18: 2631f3c4 addiu r17,r17,0xf3c4 0019bc1c: 1440008e bne r2,r0,0x0019be58 Branch if Action = Taken? 0019bc20: 00000000 nop 0019bc24: 0c066d3d jal 0x0019b4f4 AI Depth/Elemental/Monster Skill Check 0019bc28: 26240e30 addiu r4,r17,0x0e30 0019bc2c: 14400003 bne r2,r0,0x0019bc3c Branch if Caster is not in Deep Water 0019bc30: 34020001 ori r2,r0,0x0001 0019bc34: 08066fc4 j 0x0019bf10 Exit 0019bc38: 00001021 addu r2,r0,r0 Return 0 0019bc3c: 3c01801a lui r1,0x801a 0019bc40: a022f3d8 sb r2,-0x0c28(r1) 0x14 = True 0019bc44: 3c01801a lui r1,0x801a 0019bc48: ac20f39c sw r0,-0x0c64(r1) Initialize Skillset Counter
<Skillset Counter Loop> 0019bc4c: 3c02801a lui r2,0x801a 0019bc50: 8c42f39c lw r2,-0x0c64(r2) Load Skillset Counter 0019bc54: 3c01801a lui r1,0x801a 0019bc58: 00220821 addu r1,r1,r2 0019bc5c: 9024f360 lbu r4,-0x0ca0(r1) Load 0x64 0019bc60: 3c01801a lui r1,0x801a 0019bc64: ac24f3a4 sw r4,-0x0c5c(r1) Save to Calculator Type Ability ID 0019bc68: 0c01698e jal 0x0005a638 Store Skillset's Abilities 0019bc6c: 34050001 ori r5,r0,0x0001 Check for abilities 0019bc70: 3c01801a lui r1,0x801a 0019bc74: ac22f3a8 sw r2,-0x0c58(r1) Save Temp Ability List Pointer 0019bc78: 3c01801a lui r1,0x801a 0019bc7c: ac20f3a0 sw r0,-0x0c60(r1) Initialize Ability Counter
<Ability Loop> 0019bc80: 3c02801a lui r2,0x801a 0019bc84: 8c42f3a0 lw r2,-0x0c60(r2) Load Ability Counter 0019bc88: 3c03801a lui r3,0x801a 0019bc8c: 8c63f3a8 lw r3,-0x0c58(r3) Load Temp Ability List Pointer 0019bc90: 00021040 sll r2,r2,0x01 0019bc94: 00431021 addu r2,r2,r3 Get Unit's Temp Ability List 0019bc98: 90420000 lbu r2,0x0000(r2) Load (Ability ID?) 0019bc9c: 00000000 nop 0019bca0: a2220edd sb r2,0x0edd(r17) Save Ability Current ID to Ability ID (Math) 0019bca4: 92230edd lbu r3,0x0edd(r17) Load Ability ID (Math) 0019bca8: 00000000 nop 0019bcac: 10600083 beq r3,r0,0x0019bebc Branch if Ability ID = 0 0019bcb0: 000310c0 sll r2,r3,0x03 0019bcb4: 00431023 subu r2,r2,r3 0019bcb8: 00021040 sll r2,r2,0x01 0019bcbc: 3c018006 lui r1,0x8006 0019bcc0: 00220821 addu r1,r1,r2 0019bcc4: 9022fbf5 lbu r2,-0x040b(r1) Load Ability Data Flag 0019bcc8: 00000000 nop 0019bccc: 30420040 andi r2,r2,0x0040 0019bcd0: 1040007a beq r2,r0,0x0019bebc Next Ability? if not Math Skill 0019bcd4: 00000000 nop
0019bcd8: 92240e2e lbu r4,0x0e2e(r17) Load Acting Unit ID 0019bcdc: 3c05801a lui r5,0x801a 0019bce0: 8ca5f3a4 lw r5,-0x0c5c(r5) Load Calculator Type Ability ID 0019bce4: 3c06801a lui r6,0x801a 0019bce8: 8cc6f3a0 lw r6,-0x0c60(r6) Load Ability Counter 0019bcec: 0c066a94 jal 0x0019aa50 Check if ability is known 0019bcf0: 00000000 nop 0019bcf4: 10400071 beq r2,r0,0x0019bebc Next Ability if Ability is not known 0019bcf8: 00000000 nop
<Skillset Loop> 0019bcfc: 27b00010 addiu r16,r29,0x0010 0019bd00: 27b2001a addiu r18,r29,0x001a
0019bd04: 92230edd lbu r3,0x0edd(r17) Load Ability ID (Math) 0019bd08: 92020000 lbu r2,0x0000(r16) Load Ability ID from ? 0019bd0c: 00000000 nop 0019bd10: 14620008 bne r3,r2,0x0019bd34 Branch if not the same 0019bd14: 26100001 addiu r16,r16,0x0001 0019bd18: 92240e2e lbu r4,0x0e2e(r17) Load Acting Unit ID? 0019bd1c: 3c06801a lui r6,0x801a 0019bd20: 8cc6f3a0 lw r6,-0x0c60(r6) Load Ability Counter 0019bd24: 3c05801a lui r5,0x801a 0019bd28: 8ca5f3a4 lw r5,-0x0c5c(r5) Load Calculator Type Ability ID 0019bd2c: 0c066a94 jal 0x0019aa50 Check if ability is known 0019bd30: 24c60001 addiu r6,r6,0x0001 0019bd34: 0212102a slt r2,r16,r18 0019bd38: 1440fff2 bne r2,r0,0x0019bd04 Loop ? times 0019bd3c: 2624000c addiu r4,r17,0x000c
0019bd40: 34060004 ori r6,r0,0x0004 0019bd44: 92220edd lbu r2,0x0edd(r17) Load Ability ID (Math) 0019bd48: 3c058006 lui r5,0x8006 0019bd4c: 24a5ebf4 addiu r5,r5,0xebf4 Load Ability Data 1 (AI Data) 0019bd50: 000210c0 sll r2,r2,0x03 0019bd54: 0c066ac2 jal 0x0019ab08 Transfer Halfword Values 0019bd58: 00452821 addu r5,r2,r5
0019bd5c: 92230edd lbu r3,0x0edd(r17) Ability ID (Math) 0019bd60: 26240007 addiu r4,r17,0x0007 0019bd64: 000310c0 sll r2,r3,0x03 0019bd68: 00431023 subu r2,r2,r3 0019bd6c: 00021040 sll r2,r2,0x01 0019bd70: 3c018006 lui r1,0x8006 0019bd74: 00220821 addu r1,r1,r2 0019bd78: 9022fbfb lbu r2,-0x0405(r1) Load Inflict Status 0019bd7c: 34060005 ori r6,r0,0x0005 0019bd80: 00022840 sll r5,r2,0x01 0019bd84: 00a22821 addu r5,r5,r2 0019bd88: 00052840 sll r5,r5,0x01 0019bd8c: 3c028006 lui r2,0x8006 0019bd90: 24423fc5 addiu r2,r2,0x3fc5 0019bd94: 0c066ad2 jal 0x0019ab48 Transfer Halfword Values 0019bd98: 00a22821 addu r5,r5,r2
0019bd9c: 92240edd lbu r4,0x0edd(r17) Load Ability ID (Math) 0019bda0: 92230edd lbu r3,0x0edd(r17) Load Ability ID (Math) 0019bda4: 34020080 ori r2,r0,0x0080 0019bda8: a222000f sb r2,0x000f(r17) Save Usable by AI to AI Ability Flags 0019bdac: 000310c0 sll r2,r3,0x03 0019bdb0: 00431023 subu r2,r2,r3 0019bdb4: 00021040 sll r2,r2,0x01 0019bdb8: a624001e sh r4,0x001e(r17) Save to Last Attack Used 0019bdbc: 3c018006 lui r1,0x8006 0019bdc0: 00220821 addu r1,r1,r2 0019bdc4: 9022fbf7 lbu r2,-0x0409(r1) Load Element 0019bdc8: 00002021 addu r4,r0,r0 0019bdcc: a2220010 sb r2,0x0010(r17) Save Element
0019bdd0: 02241021 addu r2,r17,r4 0019bdd4: 90430c78 lbu r3,0x0c78(r2) Load isTargetable 0019bdd8: 24840001 addiu r4,r4,0x0001 Unit Counter++ 0019bddc: a0430c8d sb r3,0x0c8d(r2) Save to isTargetable 0019bde0: 28820015 slti r2,r4,0x0015 0019bde4: 1440fffb bne r2,r0,0x0019bdd4 Do for all units 0019bde8: 02241021 addu r2,r17,r4
0019bdec: 0c067950 jal 0x0019e540 Check if ability can effect any units 0019bdf0: 00000000 nop 0019bdf4: 10400031 beq r2,r0,0x0019bebc Next Ability if no units can be effected by this ability 0019bdf8: 00000000 nop 0019bdfc: a2200ede sb r0,0x0ede(r17) 0019be00: 92240e2e lbu r4,0x0e2e(r17) Load Acting Unit's ID 0019be04: 92250000 lbu r5,0x0000(r17) Load Skillset 0019be08: 92260ede lbu r6,0x0ede(r17) Load Calc Type Counter 0019be0c: 0c066a94 jal 0x0019aa50 Check if ability is known 0019be10: 00000000 nop 0019be14: 1040001e beq r2,r0,0x0019be90 <Calc Type Counter> if not known 0019be18: 34020004 ori r2,r0,0x0004 0019be1c: 92230ede lbu r3,0x0ede(r17) Load Calc Type Counter 0019be20: a2220edf sb r2,0x0edf(r17) Save 4 for Calc Multiplier Counter 0019be24: 2463019e addiu r3,r3,0x019e Set Ability ID to Calc Abilities 0019be28: a6230020 sh r3,0x0020(r17) Save Calc Type Counter + 0x019e to Calculator Type Ability ID 0019be2c: 92240e2e lbu r4,0x0e2e(r17) Load Acting Unit's ID 0019be30: 92250000 lbu r5,0x0000(r17) Load Skillset 0019be34: 92260edf lbu r6,0x0edf(r17) Load Calc Multiplier Counter 0019be38: 0c066a94 jal 0x0019aa50 Load Known Ability Flag 0019be3c: 00000000 nop 0019be40: 1040000a beq r2,r0,0x0019be6c <Calc Multiplier Counter> if Ability is not known 0019be44: 00000000 nop 0019be48: 92220edf lbu r2,0x0edf(r17) Load Calc Multiplier Counter 0019be4c: 00000000 nop 0019be50: 2442019e addiu r2,r2,0x019e 0019be54: a6220022 sh r2,0x0022(r17) Save to Calculator Multiplier Ability ID 0019be58: 0c0674c2 jal 0x0019d308 Initialize and Check Priority on Ability 0019be5c: 00000000 nop 0019be60: 2403ffff addiu r3,r0,0xffff 0019be64: 1043002a beq r2,r3,0x0019bf10 Exit if game needs to animate frame 0019be68: 2402ffff addiu r2,r0,0xffff <Calc Multiplier Counter> 0019be6c: 92220edf lbu r2,0x0edf(r17) Load Calc Multiplier Counter 0019be70: 00000000 nop 0019be74: 24420001 addiu r2,r2,0x0001 0019be78: a2220edf sb r2,0x0edf(r17) Calc Multiplier Counter++ 0019be7c: 92220edf lbu r2,0x0edf(r17) 0019be80: 00000000 nop 0019be84: 2c420008 sltiu r2,r2,0x0008 (Calc Multiplier is intialized to 4) 0019be88: 1440ffe8 bne r2,r0,0x0019be2c Branch back until all Multipliers have been solved for 0019be8c: 00000000 nop <Calc Type Counter> 0019be90: 92220ede lbu r2,0x0ede(r17) Load Calc Type Counter 0019be94: 00000000 nop 0019be98: 24420001 addiu r2,r2,0x0001 0019be9c: a2220ede sb r2,0x0ede(r17) Calc Type Counter++ 0019bea0: 92220ede lbu r2,0x0ede(r17) 0019bea4: 00000000 nop 0019bea8: 2c420004 sltiu r2,r2,0x0004 0019beac: 1440ffd4 bne r2,r0,0x0019be00 Branch back until all Types have been solved for 0019beb0: 00000000 nop 0019beb4: 0c065bf1 jal 0x00196fc4 Compare and Set Highest Priority Ability 0019beb8: 00000000 nop
0019bebc: 3c02801a lui r2,0x801a 0019bec0: 8c42f3a0 lw r2,-0x0c60(r2) Load Ability Counter 0019bec4: 00000000 nop 0019bec8: 24420001 addiu r2,r2,0x0001 Ability++ 0019becc: 3c01801a lui r1,0x801a 0019bed0: ac22f3a0 sw r2,-0x0c60(r1) Next Ability 0019bed4: 28420010 slti r2,r2,0x0010 0019bed8: 1440ff69 bne r2,r0,0x0019bc80 Do for all Abilities in the current skillset 0019bedc: 00000000 nop </Ability Loop>
0019bee0: 3c02801a lui r2,0x801a 0019bee4: 8c42f39c lw r2,-0x0c64(r2) Load Skillset? 0019bee8: 00000000 nop 0019beec: 24420001 addiu r2,r2,0x0001 Skillset++ 0019bef0: 3c01801a lui r1,0x801a 0019bef4: ac22f39c sw r2,-0x0c64(r1) Next Skillset 0019bef8: 28420004 slti r2,r2,0x0004 0019befc: 1440ff53 bne r2,r0,0x0019bc4c Loop for all 4 Mathable Skillsets 0019bf00: 00000000 nop </Skillset Loop>
0019bf04: 0c067c96 jal 0x0019f258 Transfer Results to Ability Bank 0019bf08: 26240e30 addiu r4,r17,0x0e30 0019bf0c: 00001021 addu r2,r0,r0 Return 0 0019bf10: 8fbf002c lw r31,0x002c(r29) 0019bf14: 8fb20028 lw r18,0x0028(r29) 0019bf18: 8fb10024 lw r17,0x0024(r29) 0019bf1c: 8fb00020 lw r16,0x0020(r29) 0019bf20: 27bd0030 addiu r29,r29,0x0030 0019bf24: 03e00008 jr r31 0019bf28: 00000000 nop