Difference between revisions of "AI Ability Data Setting"
Jump to navigation
Jump to search
m |
m (Link to Table) |
||
Line 47: | Line 47: | ||
0019592c: 3c018019 lui r1,0x8019 | 0019592c: 3c018019 lui r1,0x8019 | ||
00195930: 00220821 addu r1,r1,r2 | 00195930: 00220821 addu r1,r1,r2 | ||
− | 00195934: 8c223d48 lw r2,0x3d48(r1) Load Pointer for below | + | 00195934: 8c223d48 lw r2,0x3d48(r1) Load Pointer for below ([[BATTLE.BIN_Data_Tables#AI_Ability_Data_Setting_JumpAdr|Table details]]) |
00195938: 00000000 nop | 00195938: 00000000 nop | ||
0019593c: 00400008 jr r2 | 0019593c: 00400008 jr r2 |
Revision as of 19:53, 13 April 2023
AI Ability Data Setting 00195878: 27bdffc8 addiu r29,r29,0xffc8 0019587c: afb40020 sw r20,0x0020(r29) 00195880: 0080a021 addu r20,r4,r0 r20 = Unit's Move List 00195884: afb00010 sw r16,0x0010(r29) 00195888: 3c10801a lui r16,0x801a 0019588c: 2610f3c4 addiu r16,r16,0xf3c4 00195890: 02002021 addu r4,r16,r0 r4 = AI Data Pointer? 00195894: 34050014 ori r5,r0,0x0014 Limit = 0x14 (in bytes) 00195898: afbf0030 sw r31,0x0030(r29) 0019589c: afb7002c sw r23,0x002c(r29) 001958a0: afb60028 sw r22,0x0028(r29) 001958a4: afb50024 sw r21,0x0024(r29) 001958a8: afb3001c sw r19,0x001c(r29) 001958ac: afb20018 sw r18,0x0018(r29) 001958b0: 0c066ade jal 0x 0019ab78 Word Nulling 001958b4: afb10014 sw r17,0x0014(r29) 001958b8: 26040020 addiu r4,r16,0x0020 r4 = AI Data Pointer? + 0x20 001958bc: 0c066ade jal 0x 0019ab78 Word Nulling 001958c0: 34050004 ori r5,r0,0x0004 Limit = 4 (in bytes) 001958c4: 92820002 lbu r2,0x0002(r20) Load Skillset 001958c8: 00000000 nop 001958cc: a2020000 sb r2,0x0000(r16) Store Skillset 001958d0: 96830000 lhu r3,0x0000(r20) Load Ability/Unit ID 001958d4: 3c048019 lui r4,0x8019 001958d8: 248408cc addiu r4,r4,0x08cc 001958dc: 306303ff andi r3,r3,0x03ff r3 = Ability ID 001958e0: 00608821 addu r17,r3,r0 r17 = Ability ID 001958e4: 3c01801a lui r1,0x801a 001958e8: a423f3c6 sh r3,-0x0c3a(r1) Store Ability ID (why not use r16 + 2?) 001958ec: 96820000 lhu r2,0x0000(r20) Load Ability/Unit ID 001958f0: 92830002 lbu r3,0x0002(r20) Load Skillset 001958f4: 00021400 sll r2,r2,0x10 001958f8: 0002ae83 sra r21,r2,0x1a r21 = Unit's ID 001958fc: 001510c0 sll r2,r21,0x03 Unit's ID * 8 00195900: 00551023 subu r2,r2,r21 ID * 7 00195904: 00021180 sll r2,r2,0x06 ID * 1c0 00195908: 3c018006 lui r1,0x8006 0019590c: 00230821 addu r1,r1,r3 00195910: 90375cb4 lbu r23,0x5cb4(r1) Load Skillset's Action Menu 00195914: 00449021 addu r18,r2,r4 r18 = Unit's Data Pointer 00195918: 26e3ffff addiu r3,r23,0xffff r3 = Action Menu - 1 0019591c: 2c62000a sltiu r2,r3,0x000a 00195920: 104000b7 beq r2,r0,0x 00195c00 Branch if Action Menu - 1 >= a (Defend) 00195924: 0000b021 addu r22,r0,r0 r22 = 0 00195928: 00031080 sll r2,r3,0x02 Action Menu * 4 0019592c: 3c018019 lui r1,0x8019 00195930: 00220821 addu r1,r1,r2 00195934: 8c223d48 lw r2,0x3d48(r1) Load Pointer for below (Table details) 00195938: 00000000 nop 0019593c: 00400008 jr r2 00195940: 00000000 nop
*Attack* 00195944: 02151021 addu r2,r16,r21 00195948: 9042198c lbu r2,0x198c(r2) Load Unit's Battle ID 0019594c: 00000000 nop 00195950: 000210c0 sll r2,r2,0x03 ID * 8 00195954: 24421778 addiu r2,r2,0x1778 00195958: 02021821 addu r3,r16,r2 0019595c: 90620000 lbu r2,0x0000(r3) Load Weapon's Range 00195960: 00000000 nop 00195964: a2020004 sb r2,0x0004(r16) Store Ability's Range 00195968: 90620005 lbu r2,0x0005(r3) Load Weapon's Elements 0019596c: 00000000 nop 00195970: a2020010 sb r2,0x0010(r16) Store Ability's Elements 00195974: 90620004 lbu r2,0x0004(r3) Load Weapon ID 00195978: 00000000 nop 0019597c: a2020006 sb r2,0x0006(r16) Store Item Considered 00195980: 90620001 lbu r2,0x0001(r3) Load AI Behavior Flags 1 00195984: 00000000 nop 00195988: a202000c sb r2,0x000c(r16) Store AI Behavior Flags 1 0019598c: 90620002 lbu r2,0x0002(r3) Load AI Behavior Flags 2 00195990: 00000000 nop 00195994: a202000d sb r2,0x000d(r16) Store AI Behavior Flags 2 00195998: 90620003 lbu r2,0x0003(r3) Load AI Behavior Flags 3 0019599c: 00000000 nop 001959a0: a202000e sb r2,0x000e(r16) Store AI Behavior Flags 3 001959a4: 92820003 lbu r2,0x0003(r20) Load Usage Type? 001959a8: 00000000 nop 001959ac: a202000f sb r2,0x000f(r16) Store Usage Type? 001959b0: 34020009 ori r2,r0,0x0009 r2 = 9 001959b4: 16e200eb bne r23,r2,0x 00195d64 Branch if Action menu != Jump 001959b8: 2403fffe addiu r3,r0,0xfffe r3 = FFFE 001959bc: 8e02000c lw r2,0x000c(r16) Load AI Behavior Flags 1 001959c0: 00000000 nop 001959c4: 34420002 ori r2,r2,0x0002 Enable Target Enemies 001959c8: 00431024 and r2,r2,r3 Disable Target Allies 001959cc: 08065759 j 0x 00195d64 001959d0: ae02000c sw r2,0x000c(r16) Store new AI Behavior Flags 1
*Item Inventory* 001959d4: 2622fe90 addiu r2,r17,0xfe90 Item ID = Ability ID - 0x170 (potion) 001959d8: 00021840 sll r3,r2,0x01 Item ID * 2 001959dc: 00621821 addu r3,r3,r2 ID * 3 001959e0: 92420091 lbu r2,0x0091(r18) Load Unit's Support 3 001959e4: 3c018006 lui r1,0x8006 001959e8: 00230821 addu r1,r1,r3 001959ec: 90363f9a lbu r22,0x3f9a(r1) Load Item's Inflict Status ID 001959f0: 30420008 andi r2,r2,0x0008 001959f4: 10400004 beq r2,r0,0x 00195a08 Branch if Unit doesn't have Throw Item 001959f8: 34020001 ori r2,r0,0x0001 r2 = 1 001959fc: 9242003a lbu r2,0x003a(r18) Load Unit's Move 00195a00: 08065683 j 0x 00195a0c 00195a04: a2020004 sb r2,0x0004(r16) Store Range = Move 00195a08: a2020004 sb r2,0x0004(r16) Store Range = 1 00195a0c: a2000005 sb r0,0x0005(r16) Store AoE = 0 00195a10: 3c018006 lui r1,0x8006 00195a14: 00310821 addu r1,r1,r17 00195a18: 90220ea0 lbu r2,0x0ea0(r1) Load Item Used ID 00195a1c: 08065700 j 0x 00195c00 00195a20: a2020006 sb r2,0x0006(r16) Store Item Considered = Item Used ID
*Katana Inventory* 00195a24: 2622ffda addiu r2,r17,0xffda r2 = Katana ID 00195a28: 08065700 j 0x 00195c00 00195a2c: a2020006 sb r2,0x0006(r16) Store Item Considered = Katana ID
*Weapon Inventory* 00195a30: 2622ff86 addiu r2,r17,0xff86 r2 = Shuriken ID 00195a34: 2c420003 sltiu r2,r2,0x0003 00195a38: 14400005 bne r2,r0,0x 00195a50 Branch if Weapon isn't a Shuriken 00195a3c: 3402017e ori r2,r0,0x017e r2 = 0x17e (Throw Shuriken) 00195a40: 2622ff83 addiu r2,r17,0xff83 r2 = Ball ID 00195a44: 2c420003 sltiu r2,r2,0x0003 00195a48: 10400009 beq r2,r0,0x 00195a70 Branch if Weapon isn't a Ball 00195a4c: 34020189 ori r2,r0,0x0189 r2 = Throw Ball 00195a50: a6020002 sh r2,0x0002(r16) Store Ability ID = Throw Shuriken/Ball 00195a54: 001110c0 sll r2,r17,0x03 ID * 8 00195a58: a2110006 sb r17,0x0006(r16) Store Item Considered = Weapon ID 00195a5c: 3c018006 lui r1,0x8006 00195a60: 00220821 addu r1,r1,r2 00195a64: 90223abe lbu r2,0x3abe(r1) Load Weapon's Element 00195a68: 080656a0 j 0x 00195a80 00195a6c: a2020010 sb r2,0x0010(r16) Store Ability's Element 00195a70: 96020e14 lhu r2,0x0e14(r16) Load Chosen Throw ID? 00195a74: 92030e16 lbu r3,0x0e16(r16) Load Chosen Weapon ID? 00195a78: a6020002 sh r2,0x0002(r16) Store Ability ID = Chosen Throw ID? 00195a7c: a2030006 sb r3,0x0006(r16) Store Item Considered = Chosen Weapon ID? 00195a80: 9242003a lbu r2,0x003a(r18) Load Unit's Move 00195a84: 86110002 lh r17,0x0002(r16) Load Ability ID 00195a88: 08065700 j 0x 00195c00 00195a8c: a2020004 sb r2,0x0004(r16) Store Ability Range = Move
- Jump*
00195a90: 92020e2e lbu r2,0x0e2e(r16) Load ? 00195a94: 00000000 nop 00195a98: 16a2000e bne r21,r2,0x 00195ad4 Branch if ? != Unit's ID 00195a9c: 34020064 ori r2,r0,0x0064 r2 = 100 00195aa0: 8e0317f8 lw r3,0x17f8(r16) Load Target's? Pointer 00195aa4: 00000000 nop 00195aa8: 90640039 lbu r4,0x0039(r3) Load Target's? CT 00195aac: 90630038 lbu r3,0x0038(r3) Load Target's? SP 00195ab0: 00441023 subu r2,r2,r4 r2 = 100 - CT 00195ab4: 0043001a div r2,r3 (100 - CT) / SP 00195ab8: 00001012 mflo r2 r2 = (100 - CT) / SP 00195abc: 00000000 nop 00195ac0: 00021fc2 srl r3,r2,0x1f 00195ac4: 00431021 addu r2,r2,r3 00195ac8: 00021043 sra r2,r2,0x01 ((100 - CT) / SP) / 2 00195acc: 080656d7 j 0x 00195b5c 00195ad0: a2020001 sb r2,0x0001(r16) Store CT? = ((100 - CT) / SP) / 2 00195ad4: 92450039 lbu r5,0x0039(r18) Load Unit's CT 00195ad8: 00000000 nop 00195adc: 2ca20065 sltiu r2,r5,0x0065 00195ae0: 14400005 bne r2,r0,0x 00195af8 Branch if CT < 101 00195ae4: 34040064 ori r4,r0,0x0064 r4 = 100 00195ae8: a2000001 sb r0,0x0001(r16) Store CT? = 0 00195aec: 92420039 lbu r2,0x0039(r18) Load Unit's CT 00195af0: 080656cb j 0x 00195b2c 00195af4: 2444ff9c addiu r4,r2,0xff9c CT - 100 00195af8: 92430038 lbu r3,0x0038(r18) Load Unit's SP 00195afc: 00851023 subu r2,r4,r5 100 - CT 00195b00: 0043001a div r2,r3 (100 - CT) / SP 00195b04: 00001012 mflo r2 r2 = (100 - CT) / SP 00195b08: 00000000 nop 00195b0c: a2020001 sb r2,0x0001(r16) Store CT? = (100 - CT) / SP 00195b10: 92430039 lbu r3,0x0039(r18) Load Unit's CT 00195b14: 92420038 lbu r2,0x0038(r18) Load Unit's SP 00195b18: 00832023 subu r4,r4,r3 100 - CT 00195b1c: 0082001a div r4,r2 (100 - CT) / SP 00195b20: 00001810 mfhi r3 r3 = (100 - CT) / SP 00195b24: 00000000 nop 00195b28: 00432023 subu r4,r2,r3 SP - (100 - CT) / SP 00195b2c: 34020064 ori r2,r0,0x0064 r2 = 100 00195b30: 92430038 lbu r3,0x0038(r18) Load SP 00195b34: 00441023 subu r2,r2,r4 100 - (SP - (100 - CT) / SP) 00195b38: 0043001a div r2,r3 (100 - (SP - (100 - CT) / SP)) / SP 00195b3c: 00001012 mflo r2 r2 = " 00195b40: 00000000 nop 00195b44: 00021fc2 srl r3,r2,0x1f 00195b48: 00431021 addu r2,r2,r3 00195b4c: 92030001 lbu r3,0x0001(r16) Load CT? 00195b50: 00021043 sra r2,r2,0x01 ((100 - (SP - (100 - CT) / SP)) / SP) / 2 00195b54: 00621821 addu r3,r3,r2 CT? + " 00195b58: a2030001 sb r3,0x0001(r16) Store new CT? 00195b5c: 16200003 bne r17,r0,0x 00195b6c Branch if Ability ID != 0 00195b60: 2622fe76 addiu r2,r17,0xfe76 r2 = Ability ID - 0x18a (Level Jump 2) 00195b64: 080656df j 0x 00195b7c 00195b68: 34020001 ori r2,r0,0x0001 r2 = 1 00195b6c: 00021040 sll r2,r2,0x01 ID * 2 00195b70: 3c018006 lui r1,0x8006 00195b74: 00220821 addu r1,r1,r2 00195b78: 9022102c lbu r2,0x102c(r1) Load Jump's Range 00195b7c: 00000000 nop 00195b80: a2020004 sb r2,0x0004(r16) Store Range = Jump's Range 00195b84: 02151021 addu r2,r16,r21 00195b88: 9042198c lbu r2,0x198c(r2) Load Unit's Battle ID 00195b8c: 00000000 nop 00195b90: 000210c0 sll r2,r2,0x03 ID * 8 00195b94: 24421778 addiu r2,r2,0x1778 00195b98: 0806565d j 0x 00195974 00195b9c: 02021821 addu r3,r16,r2 r3 = Unit's Weapon? Attack Data
*Charge* 00195ba0: 2622fe6a addiu r2,r17,0xfe6a r2 = Ability ID - 0x196 (Charge + 1) 00195ba4: 00021040 sll r2,r2,0x01 ID * 2 00195ba8: 3c018006 lui r1,0x8006 00195bac: 00220821 addu r1,r1,r2 00195bb0: 90221044 lbu r2,0x1044(r1) Load Charge's CT 00195bb4: 08065651 j 0x 00195944 00195bb8: a2020001 sb r2,0x0001(r16) Store CT = Charge's CT
*Arithmeticks* 00195bbc: 340300ff ori r3,r0,0x00ff r3 = FF 00195bc0: 34040004 ori r4,r0,0x0004 Counter = 4 00195bc4: 26020004 addiu r2,r16,0x0004 00195bc8: a0430007 sb r3,0x0007(r2) Store Status Infliction = FF 00195bcc: 2484ffff addiu r4,r4,0xffff Counter -- 00195bd0: 0481fffd bgez r4,0x 00195bc8 Branch if Counter >= 0 00195bd4: 2442ffff addiu r2,r2,0xffff Pointer -- 00195bd8: 340200fc ori r2,r0,0x00fc r2 = FC 00195bdc: a202000c sb r2,0x000c(r16) Store AI Behavior = all but Target E/A 00195be0: 92820003 lbu r2,0x0003(r20) Load Usage Type? 00195be4: 00000000 nop 00195be8: a202000f sb r2,0x000f(r16) Store Usage Type? 00195bec: 8e02000c lw r2,0x000c(r16) Load AI Behavior Flags 00195bf0: 00000000 nop 00195bf4: 34428000 ori r2,r2,0x8000 Enable Ignore Range? 00195bf8: 08065759 j 0x 00195d64 00195bfc: ae02000c sw r2,0x000c(r16) Store new AI Behavior Flags
*Default* 00195c00: 2604000c addiu r4,r16,0x000c r4 = Pointer to AI Behavior Flags 00195c04: 001198c0 sll r19,r17,0x03 r19 = Ability ID * 8 00195c08: 3c058006 lui r5,0x8006 00195c0c: 24a5ebf4 addiu r5,r5,0xebf4 00195c10: 02652821 addu r5,r19,r5 r5 = Ability's AI Behavior Flags Pointer 00195c14: 0c066ac2 jal 0x 0019ab08 Transfer Halfword Values 00195c18: 34060004 ori r6,r0,0x0004 Limit = 4 00195c1c: 26e2ffff addiu r2,r23,0xffff r2 = Action Menu - 1 00195c20: 2c420002 sltiu r2,r2,0x0002 00195c24: 10400005 beq r2,r0,0x 00195c3c Branch if Action Menu != Item/Weapon Inv. 00195c28: 3c030040 lui r3,0x0040 00195c2c: 8e02000c lw r2,0x000c(r16) Load AI Behavior Flags 00195c30: 00000000 nop 00195c34: 00431025 or r2,r2,r3 Enable Direct Attack 00195c38: ae02000c sw r2,0x000c(r16) Store new AI Behavior Flags 00195c3c: 92820003 lbu r2,0x0003(r20) Load Usage Type? 00195c40: 00000000 nop 00195c44: a202000f sb r2,0x000f(r16) Store Usage Type? 00195c48: 2a220170 slti r2,r17,0x0170 00195c4c: 1040002f beq r2,r0,0x 00195d0c Branch if Ability is a Normal Ability 00195c50: 02711023 subu r2,r19,r17 r2 = Ability ID * 7 00195c54: 00021040 sll r2,r2,0x01 ID * 14 00195c58: 3c038006 lui r3,0x8006 00195c5c: 2463fbf0 addiu r3,r3,0xfbf0 00195c60: 00431821 addu r3,r2,r3 00195c64: 9062000c lbu r2,0x000c(r3) Load Ability's CT 00195c68: 9076000b lbu r22,0x000b(r3) Load Ability's Inflict Status 00195c6c: a2020001 sb r2,0x0001(r16) Store CT = Ability's CT 00195c70: 90620007 lbu r2,0x0007(r3) Load Ability's Element 00195c74: 00000000 nop 00195c78: a2020010 sb r2,0x0010(r16) Store Ability's Element 00195c7c: 9062000d lbu r2,0x000d(r3) Load Ability's MP Cost 00195c80: 00000000 nop 00195c84: a2020011 sb r2,0x0011(r16) Store Ability's MP Cost 00195c88: 92420090 lbu r2,0x0090(r18) Load Unit's Support set 2 00195c8c: 00000000 nop 00195c90: 30420080 andi r2,r2,0x0080 00195c94: 10400005 beq r2,r0,0x 00195cac Branch if Unit doesn't have Half of MP 00195c98: 00000000 nop 00195c9c: 92020011 lbu r2,0x0011(r16) Load MP Cost 00195ca0: 00000000 nop 00195ca4: 00021042 srl r2,r2,0x01 MP Cost / 2 00195ca8: a2020011 sb r2,0x0011(r16) Store new MP Cost 00195cac: 90620003 lbu r2,0x0003(r3) Load Ability's Flags 00195cb0: 00000000 nop 00195cb4: 30420020 andi r2,r2,0x0020 00195cb8: 10400009 beq r2,r0,0x 00195ce0 Branch if Ability isn't a Ranged Weapon 00195cbc: 02151021 addu r2,r16,r21 00195cc0: 9042198c lbu r2,0x198c(r2) Load Unit's Battle ID 00195cc4: 00000000 nop 00195cc8: 000210c0 sll r2,r2,0x03 ID * 8 00195ccc: 02021021 addu r2,r16,r2 00195cd0: 90421778 lbu r2,0x1778(r2) Load Unit's Weapon Range 00195cd4: a2000005 sb r0,0x0005(r16) Store AoE = 0 00195cd8: 0806573e j 0x 00195cf8 00195cdc: a2020004 sb r2,0x0004(r16) Store Ability's Range = Weapon Range 00195ce0: 90620000 lbu r2,0x0000(r3) Load Ability's Range 00195ce4: 00000000 nop 00195ce8: a2020004 sb r2,0x0004(r16) Store Range = Ability's Range 00195cec: 90620001 lbu r2,0x0001(r3) Load Ability's AoE 00195cf0: 00000000 nop 00195cf4: a2020005 sb r2,0x0005(r16) Store AoE = Ability's AoE 00195cf8: 90620005 lbu r2,0x0005(r3) Load Ability's Flags 3 00195cfc: 00000000 nop 00195d00: 30420004 andi r2,r2,0x0004 00195d04: 1440000f bne r2,r0,0x 00195d44 Branch if Ability has Persevere 00195d08: 26040007 addiu r4,r16,0x0007 r4 = Pointer to ? 00195d0c: 92430092 lbu r3,0x0092(r18) Load Unit's Support set 4 00195d10: 00000000 nop 00195d14: 30620080 andi r2,r3,0x0080 (supposed to be 0x08, Short Charge) 00195d18: 10400006 beq r2,r0,0x 00195d34 Branch if Unit doesn't have Monster Skill 00195d1c: 30620040 andi r2,r3,0x0040 00195d20: 92020001 lbu r2,0x0001(r16) Load CT 00195d24: 00000000 nop (supposed to add +1 to CT before dividing) 00195d28: 00021042 srl r2,r2,0x01 CT / 2 00195d2c: 08065750 j 0x 00195d40 00195d30: a2020001 sb r2,0x0001(r16) Store new CT 00195d34: 10400003 beq r2,r0,0x 00195d44 Branch if Unit doesn't have Defend 00195d38: 26040007 addiu r4,r16,0x0007 (supposed to be 0x04 Non-Charge) 00195d3c: a2000001 sb r0,0x0001(r16) CT = 0 00195d40: 26040007 addiu r4,r16,0x0007 r4 = Pointer to Inflicted Statuses 00195d44: 00162840 sll r5,r22,0x01 Inflict Status ID * 2 00195d48: 00b62821 addu r5,r5,r22 ID * 3 00195d4c: 00052840 sll r5,r5,0x01 ID * 6 00195d50: 3c028006 lui r2,0x8006 00195d54: 24423fc5 addiu r2,r2,0x3fc5 00195d58: 00a22821 addu r5,r5,r2 r5 = Pointer to Inflicted Statuses 00195d5c: 0c066ad2 jal 0x 0019ab48 Transfer Byte Values 00195d60: 34060005 ori r6,r0,0x0005 Limit = 5 00195d64: 8fbf0030 lw r31,0x0030(r29) 00195d68: 8fb7002c lw r23,0x002c(r29) 00195d6c: 8fb60028 lw r22,0x0028(r29) 00195d70: 8fb50024 lw r21,0x0024(r29) 00195d74: 8fb40020 lw r20,0x0020(r29) 00195d78: 8fb3001c lw r19,0x001c(r29) 00195d7c: 8fb20018 lw r18,0x0018(r29) 00195d80: 8fb10014 lw r17,0x0014(r29) 00195d84: 8fb00010 lw r16,0x0010(r29) 00195d88: 27bd0038 addiu r29,r29,0x0038 00195d8c: 03e00008 jr r31 00195d90: 00000000 nop