Difference between revisions of "Protect Allies - Auto Battle (001984ec)"
Jump to navigation
Jump to search
m (Dokurider moved page 001984ec - 00198818 to Protect Allies - Auto Battle (001984ec): Naming and documentation) |
(Added missing section that got eaten somehow.) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | Description: | |
− | + | Documentation is not complete yet. | |
+ | This is the AI routine responsible for evaluating who needs healing and status curing. | ||
+ | |||
+ | Referenced In: | ||
+ | [[Auto Battle Handling]] | ||
+ | |||
+ | Routines Used: | ||
+ | [[Find Peril Most Unit (00198b04)]] | ||
+ | [[001982d8 - 001984e8|Decide where to move to]] | ||
+ | [[0019630c - 00196388|Find and Invert Priority]] | ||
+ | [[0019881c - 00198b00|Evaluate Cancel Status Ability]] | ||
+ | [[set current ability CT/status change|Set/Remove Charging]] | ||
+ | [[Find which units are active?|Find Active Unit]] | ||
+ | [[Chose Move from Move List?|Decide if AI will choose ability]] | ||
+ | [[001970bc - 001971b4|Randomly Transfer Data]] | ||
+ | [[00199498 - 001994f4|Reset Ability Choice Data?]] | ||
+ | |||
001984ec: 3c02801a lui r2,0x801a | 001984ec: 3c02801a lui r2,0x801a | ||
001984f0: 8c420bbc lw r2,0x0bbc(r2) | 001984f0: 8c420bbc lw r2,0x0bbc(r2) | ||
Line 15: | Line 31: | ||
0019851c: a3a40011 sb r4,0x0011(r29) | 0019851c: a3a40011 sb r4,0x0011(r29) | ||
00198520: a3a50012 sb r5,0x0012(r29) | 00198520: a3a50012 sb r5,0x0012(r29) | ||
− | 00198524: 905001b9 lbu r16,0x01b9(r2) | + | 00198524: 905001b9 lbu r16,0x01b9(r2) Load Main Target |
00198528: 3c02801a lui r2,0x801a | 00198528: 3c02801a lui r2,0x801a | ||
0019852c: 90420d7b lbu r2,0x0d7b(r2) | 0019852c: 90420d7b lbu r2,0x0d7b(r2) | ||
Line 23: | Line 39: | ||
0019853c: 00000000 nop | 0019853c: 00000000 nop | ||
00198540: 3c03801a lui r3,0x801a | 00198540: 3c03801a lui r3,0x801a | ||
− | 00198544: 90630032 lbu r3,0x0032(r3) | + | 00198544: 90630032 lbu r3,0x0032(r3) Load Decision Byte |
00198548: 00000000 nop | 00198548: 00000000 nop | ||
0019854c: 2c620008 sltiu r2,r3,0x0008 | 0019854c: 2c620008 sltiu r2,r3,0x0008 | ||
− | 00198550: 1040009b beq r2,r0,0x001987c0 | + | 00198550: 1040009b beq r2,r0,0x001987c0 Branch if Decision > 7 |
+ | |||
00198554: 00031080 sll r2,r3,0x02 | 00198554: 00031080 sll r2,r3,0x02 | ||
00198558: 3c018019 lui r1,0x8019 | 00198558: 3c018019 lui r1,0x8019 | ||
Line 34: | Line 51: | ||
00198568: 00400008 jr r2 | 00198568: 00400008 jr r2 | ||
0019856c: 00000000 nop | 0019856c: 00000000 nop | ||
+ | |||
+ | 0: 80198578 | ||
+ | 1: 801985f8 | ||
+ | 2: 8019870c | ||
+ | 3: 80198748 | ||
+ | 4: 80198788 | ||
+ | 5: 801987c0 | ||
+ | 6: 801987c0 | ||
+ | 7: 801986a0 | ||
+ | |||
+ | <Usage not set> | ||
00198570: 3c01801a lui r1,0x801a | 00198570: 3c01801a lui r1,0x801a | ||
00198574: a02001f1 sb r0,0x01f1(r1) | 00198574: a02001f1 sb r0,0x01f1(r1) | ||
− | 00198578: 0c066672 jal 0x001999c8 | + | |
+ | <0> (Initialize Priority) | ||
+ | 00198578: 0c066672 jal 0x001999c8 Initialize Targeting Priorities of all units | ||
0019857c: 00000000 nop | 0019857c: 00000000 nop | ||
00198580: 2403ffff addiu r3,r0,0xffff | 00198580: 2403ffff addiu r3,r0,0xffff | ||
− | 00198584: 14430008 bne r2,r3,0x001985a8 | + | 00198584: 14430008 bne r2,r3,0x001985a8 Branch if it failed |
00198588: 00101100 sll r2,r16,0x04 | 00198588: 00101100 sll r2,r16,0x04 | ||
− | 0019858c: a2200c6e sb r0,0x0c6e(r17) | + | 0019858c: a2200c6e sb r0,0x0c6e(r17) Next Decision = 0 |
− | 00198590: 08066201 j 0x00198804 | + | 00198590: 08066201 j 0x00198804 Exit and return -1 |
00198594: 2402ffff addiu r2,r0,0xffff | 00198594: 2402ffff addiu r2,r0,0xffff | ||
+ | |||
+ | <sub 7> (Peril Jump) | ||
00198598: 3c01801a lui r1,0x801a | 00198598: 3c01801a lui r1,0x801a | ||
0019859c: ac22f37c sw r2,-0x0c84(r1) | 0019859c: ac22f37c sw r2,-0x0c84(r1) | ||
− | 001985a0: 08066177 j 0x001985dc | + | 001985a0: 08066177 j 0x001985dc Jump to Peril Routine |
001985a4: 00000000 nop | 001985a4: 00000000 nop | ||
+ | |||
001985a8: 02221821 addu r3,r17,r2 | 001985a8: 02221821 addu r3,r17,r2 | ||
001985ac: 3c01801a lui r1,0x801a | 001985ac: 3c01801a lui r1,0x801a | ||
001985b0: ac20f37c sw r0,-0x0c84(r1) | 001985b0: ac20f37c sw r0,-0x0c84(r1) | ||
− | 001985b4: 90621833 lbu r2,0x1833(r3) | + | 001985b4: 90621833 lbu r2,0x1833(r3) AI Targeting Flags |
001985b8: 00000000 nop | 001985b8: 00000000 nop | ||
− | 001985bc: 00021102 srl r2,r2,0x04 | + | 001985bc: 00021102 srl r2,r2,0x04 Remove the 08 flag and below |
001985c0: 30420001 andi r2,r2,0x0001 | 001985c0: 30420001 andi r2,r2,0x0001 | ||
− | 001985c4: 14400005 bne r2,r0,0x001985dc | + | 001985c4: 14400005 bne r2,r0,0x001985dc Branch if unit can't be targeted |
001985c8: 00000000 nop | 001985c8: 00000000 nop | ||
− | 001985cc: 90621834 lbu r2,0x1834(r3) | + | |
+ | 001985cc: 90621834 lbu r2,0x1834(r3) Load Enemy Flag | ||
001985d0: 00000000 nop | 001985d0: 00000000 nop | ||
− | 001985d4: 10400006 beq r2,r0,0x001985f0 | + | 001985d4: 10400006 beq r2,r0,0x001985f0 Branch if Ally |
001985d8: 00000000 nop | 001985d8: 00000000 nop | ||
− | 001985dc: 0c0662c1 jal 0x00198b04 | + | 001985dc: 0c0662c1 jal 0x00198b04 Find the unit in highest peril |
001985e0: 00000000 nop | 001985e0: 00000000 nop | ||
− | 001985e4: 8e2217f8 lw r2,0x17f8(r17) | + | 001985e4: 8e2217f8 lw r2,0x17f8(r17) Acting Unit's Data Pointer |
001985e8: 00000000 nop | 001985e8: 00000000 nop | ||
− | 001985ec: 905001b9 lbu r16,0x01b9(r2) | + | 001985ec: 905001b9 lbu r16,0x01b9(r2) Load Main Target |
− | 001985f0: 0c065243 jal 0x0019490c | + | 001985f0: 0c065243 jal 0x0019490c Store main target ID and focus on target flag |
001985f4: 02002021 addu r4,r16,r0 | 001985f4: 02002021 addu r4,r16,r0 | ||
− | 001985f8: 0c0660b6 jal 0x001982d8 | + | |
+ | <1> | ||
+ | 001985f8: 0c0660b6 jal 0x001982d8 Decide where to move to | ||
001985fc: 00000000 nop | 001985fc: 00000000 nop | ||
00198600: 2403ffff addiu r3,r0,0xffff | 00198600: 2403ffff addiu r3,r0,0xffff | ||
− | 00198604: 10430079 beq r2,r3,0x001987ec | + | 00198604: 10430079 beq r2,r3,0x001987ec Save Decision and Return -1 if no decision to move was made |
− | 00198608: 34020001 ori r2,r0,0x0001 | + | 00198608: 34020001 ori r2,r0,0x0001 Next Decision = 01 |
0019860c: 34020002 ori r2,r0,0x0002 | 0019860c: 34020002 ori r2,r0,0x0002 | ||
− | 00198610: 0c0658c3 jal 0x0019630c | + | 00198610: 0c0658c3 jal 0x0019630c Find and Invert Priority |
− | 00198614: a2220e2d sb r2,0x0e2d(r17) | + | 00198614: a2220e2d sb r2,0x0e2d(r17) Ability Decided = True |
00198618: 3c02801a lui r2,0x801a | 00198618: 3c02801a lui r2,0x801a | ||
0019861c: 8c42f37c lw r2,-0x0c84(r2) | 0019861c: 8c42f37c lw r2,-0x0c84(r2) | ||
00198620: 00000000 nop | 00198620: 00000000 nop | ||
00198624: 14400037 bne r2,r0,0x00198704 | 00198624: 14400037 bne r2,r0,0x00198704 | ||
− | 00198628: a2200e2d sb r0,0x0e2d(r17) | + | 00198628: a2200e2d sb r0,0x0e2d(r17) Ability Decided = False |
+ | |||
0019862c: 00101100 sll r2,r16,0x04 | 0019862c: 00101100 sll r2,r16,0x04 | ||
00198630: 02221021 addu r2,r17,r2 | 00198630: 02221021 addu r2,r17,r2 | ||
− | 00198634: 90421833 lbu r2,0x1833(r2) | + | 00198634: 90421833 lbu r2,0x1833(r2) AI Targeting Flags |
00198638: 00000000 nop | 00198638: 00000000 nop | ||
− | 0019863c: 00021182 srl r2,r2,0x06 | + | 0019863c: 00021182 srl r2,r2,0x06 Remove the 20 flag and below |
00198640: 30420001 andi r2,r2,0x0001 | 00198640: 30420001 andi r2,r2,0x0001 | ||
− | 00198644: 14400030 bne r2,r0,0x00198708 | + | 00198644: 14400030 bne r2,r0,0x00198708 Save ?, then <2> if Dead Unit with Reraise |
00198648: 34020001 ori r2,r0,0x0001 | 00198648: 34020001 ori r2,r0,0x0001 | ||
+ | |||
0019864c: 3c01801a lui r1,0x801a | 0019864c: 3c01801a lui r1,0x801a | ||
− | 00198650: ac20f380 sw r0,-0x0c80(r1) | + | 00198650: ac20f380 sw r0,-0x0c80(r1) Clear ? |
− | 00198654: 001018c0 sll r3,r16,0x03 | + | 00198654: 001018c0 sll r3,r16,0x03 Target ID * 8 |
− | 00198658: 00701823 subu r3,r3,r16 | + | |
+ | <Status Loop> | ||
+ | 00198658: 00701823 subu r3,r3,r16 Target ID * 7 | ||
0019865c: 3c02801a lui r2,0x801a | 0019865c: 3c02801a lui r2,0x801a | ||
− | 00198660: 8c42f380 lw r2,-0x0c80(r2) | + | 00198660: 8c42f380 lw r2,-0x0c80(r2) Load ? Counter |
− | 00198664: 00031980 sll r3,r3,0x06 | + | 00198664: 00031980 sll r3,r3,0x06 Target ID * 1c0 |
− | 00198668: 03a21021 addu r2,r29,r2 | + | 00198668: 03a21021 addu r2,r29,r2 ? + Stack Pointer |
− | 0019866c: 90440010 lbu r4,0x0010(r2) | + | 0019866c: 90440010 lbu r4,0x0010(r2) r4 = Status ID? |
00198670: 3c028019 lui r2,0x8019 | 00198670: 3c028019 lui r2,0x8019 | ||
− | 00198674: 24420924 addiu r2,r2,0x0924 | + | 00198674: 24420924 addiu r2,r2,0x0924 Point to Current Status |
− | 00198678: 00621821 addu r3,r3,r2 | + | 00198678: 00621821 addu r3,r3,r2 Point to Main Target's Current Status |
0019867c: 34020080 ori r2,r0,0x0080 | 0019867c: 34020080 ori r2,r0,0x0080 | ||
− | 00198680: 000428c2 srl r5,r4,0x03 | + | 00198680: 000428c2 srl r5,r4,0x03 r5 = Status ID / 8 |
− | 00198684: 00651821 addu r3,r3,r5 | + | 00198684: 00651821 addu r3,r3,r5 r3 = Status ID + Current Status Pointer |
− | 00198688: 30840007 andi r4,r4,0x0007 | + | 00198688: 30840007 andi r4,r4,0x0007 r4 = Status Position Slot Flag |
− | 0019868c: 90630000 lbu r3,0x0000(r3) | + | 0019868c: 90630000 lbu r3,0x0000(r3) Load Target Current Status |
− | 00198690: 00821007 srav r2,r2,r4 | + | 00198690: 00821007 srav r2,r2,r4 80 / (1 - 7) = (1 - 80) |
00198694: 00621824 and r3,r3,r2 | 00198694: 00621824 and r3,r3,r2 | ||
− | 00198698: 10600011 beq r3,r0,0x001986e0 | + | 00198698: 10600011 beq r3,r0,0x001986e0 <?++> if Target Unit does not have status |
0019869c: 00000000 nop | 0019869c: 00000000 nop | ||
+ | |||
+ | <7> Evaluate Status | ||
001986a0: 3c02801a lui r2,0x801a | 001986a0: 3c02801a lui r2,0x801a | ||
− | 001986a4: 8c42f380 lw r2,-0x0c80(r2) | + | 001986a4: 8c42f380 lw r2,-0x0c80(r2) Load ? |
001986a8: 00000000 nop | 001986a8: 00000000 nop | ||
001986ac: 03a21021 addu r2,r29,r2 | 001986ac: 03a21021 addu r2,r29,r2 | ||
− | 001986b0: 90450010 lbu r5,0x0010(r2) | + | 001986b0: 90450010 lbu r5,0x0010(r2) Load Status ID |
− | 001986b4: 0c066207 jal 0x0019881c | + | 001986b4: 0c066207 jal 0x0019881c Evaluate Cancel Status Ability |
− | 001986b8: 02002021 addu r4,r16,r0 | + | 001986b8: 02002021 addu r4,r16,r0 r4 = Target ID |
001986bc: 00401821 addu r3,r2,r0 | 001986bc: 00401821 addu r3,r2,r0 | ||
001986c0: 2402ffff addiu r2,r0,0xffff | 001986c0: 2402ffff addiu r2,r0,0xffff | ||
− | 001986c4: 10620049 beq r3,r2,0x001987ec | + | 001986c4: 10620049 beq r3,r2,0x001987ec Save Decision and Return -1 if Ability was choosen |
− | 001986c8: 34020007 ori r2,r0,0x0007 | + | 001986c8: 34020007 ori r2,r0,0x0007 Next Decision = 7 |
+ | |||
001986cc: 34020002 ori r2,r0,0x0002 | 001986cc: 34020002 ori r2,r0,0x0002 | ||
− | 001986d0: 1062004b beq r3,r2,0x00198800 | + | 001986d0: 1062004b beq r3,r2,0x00198800 Branch if 0x0071 = True |
001986d4: 00000000 nop | 001986d4: 00000000 nop | ||
− | 001986d8: 1060ffaf beq r3,r0,0x00198598 | + | 001986d8: 1060ffaf beq r3,r0,0x00198598 Jump to <Peril Jump> if no abilities were choosen |
001986dc: 34020001 ori r2,r0,0x0001 | 001986dc: 34020001 ori r2,r0,0x0001 | ||
+ | |||
+ | <?++> | ||
001986e0: 3c02801a lui r2,0x801a | 001986e0: 3c02801a lui r2,0x801a | ||
− | 001986e4: 8c42f380 lw r2,-0x0c80(r2) | + | 001986e4: 8c42f380 lw r2,-0x0c80(r2) Load ? Counter |
001986e8: 00000000 nop | 001986e8: 00000000 nop | ||
001986ec: 24420001 addiu r2,r2,0x0001 | 001986ec: 24420001 addiu r2,r2,0x0001 | ||
001986f0: 3c01801a lui r1,0x801a | 001986f0: 3c01801a lui r1,0x801a | ||
− | 001986f4: ac22f380 sw r2,-0x0c80(r1) | + | 001986f4: ac22f380 sw r2,-0x0c80(r1) ? Counter++ |
001986f8: 28420003 slti r2,r2,0x0003 | 001986f8: 28420003 slti r2,r2,0x0003 | ||
− | 001986fc: 1440ffd6 bne r2,r0,0x00198658 | + | 001986fc: 1440ffd6 bne r2,r0,0x00198658 Do twice |
00198700: 001018c0 sll r3,r16,0x03 | 00198700: 001018c0 sll r3,r16,0x03 | ||
+ | |||
00198704: 34020001 ori r2,r0,0x0001 | 00198704: 34020001 ori r2,r0,0x0001 | ||
− | 00198708: a2220e2d sb r2,0x0e2d(r17) | + | 00198708: a2220e2d sb r2,0x0e2d(r17) Ability Decided = True |
− | 0019870c: 0c0657e3 jal 0x00195f8c | + | |
+ | <2> Set/Remove Charging, then look for Main Target | ||
+ | 0019870c: 0c0657e3 jal 0x00195f8c Set/Remove Charging | ||
00198710: 00000000 nop | 00198710: 00000000 nop | ||
00198714: 00401821 addu r3,r2,r0 | 00198714: 00401821 addu r3,r2,r0 | ||
00198718: 2402ffff addiu r2,r0,0xffff | 00198718: 2402ffff addiu r2,r0,0xffff | ||
− | 0019871c: 10620033 beq r3,r2,0x001987ec | + | 0019871c: 10620033 beq r3,r2,0x001987ec Save Decision and Return -1 if Frame RNG said so |
− | 00198720: 34020002 ori r2,r0,0x0002 | + | 00198720: 34020002 ori r2,r0,0x0002 Next Decision = 02 |
+ | |||
00198724: 34020001 ori r2,r0,0x0001 | 00198724: 34020001 ori r2,r0,0x0001 | ||
− | 00198728: 10620036 beq r3,r2,0x00198804 | + | 00198728: 10620036 beq r3,r2,0x00198804 Exit and return 0 if Ability is a Lower Priority |
0019872c: 00001021 addu r2,r0,r0 | 0019872c: 00001021 addu r2,r0,r0 | ||
− | 00198730: a2200e2d sb r0,0x0e2d(r17) | + | |
− | 00198734: 34040003 ori r4,r0,0x0003 | + | <Is Main Target Targetable> |
− | 00198738: 0c065f43 jal 0x00197d0c | + | 00198730: a2200e2d sb r0,0x0e2d(r17) Ability Decided = False |
− | 0019873c: 02002821 addu r5,r16,r0 | + | 00198734: 34040003 ori r4,r0,0x0003 Find Specific Unit |
− | 00198740: 1040000b beq r2,r0,0x00198770 | + | 00198738: 0c065f43 jal 0x00197d0c Find Active Unit |
+ | 0019873c: 02002821 addu r5,r16,r0 Look for Main Target | ||
+ | 00198740: 1040000b beq r2,r0,0x00198770 Branch if Target not Active | ||
00198744: 34020001 ori r2,r0,0x0001 | 00198744: 34020001 ori r2,r0,0x0001 | ||
− | 00198748: 0c065f98 jal 0x00197e60 | + | |
+ | <3> Attempt to Choose Move, then look for enemy unit | ||
+ | 00198748: 0c065f98 jal 0x00197e60 Decide if AI will choose ability (Chose Move from movelist) | ||
0019874c: 00000000 nop | 0019874c: 00000000 nop | ||
00198750: 2403ffff addiu r3,r0,0xffff | 00198750: 2403ffff addiu r3,r0,0xffff | ||
− | 00198754: 10430025 beq r2,r3,0x001987ec | + | 00198754: 10430025 beq r2,r3,0x001987ec Save Next Decision and Return -1 if Ability was choosen |
− | 00198758: 34020003 ori r2,r0,0x0003 | + | 00198758: 34020003 ori r2,r0,0x0003 Next Decision = 3 |
− | 0019875c: 0c065c2f jal 0x001970bc | + | |
+ | 0019875c: 0c065c2f jal 0x001970bc Randomly Transfer Data | ||
00198760: 00000000 nop | 00198760: 00000000 nop | ||
− | 00198764: 14400027 bne r2,r0,0x00198804 | + | 00198764: 14400027 bne r2,r0,0x00198804 Exit and return 0 if Data was successfully transferred |
00198768: 00001021 addu r2,r0,r0 | 00198768: 00001021 addu r2,r0,r0 | ||
+ | |||
0019876c: 34020001 ori r2,r0,0x0001 | 0019876c: 34020001 ori r2,r0,0x0001 | ||
− | 00198770: a2220e2d sb r2,0x0e2d(r17) | + | 00198770: a2220e2d sb r2,0x0e2d(r17) Ability Decided = True |
− | 00198774: 34040001 ori r4,r0,0x0001 | + | 00198774: 34040001 ori r4,r0,0x0001 Look for any enemy unit |
− | 00198778: 0c065f43 jal 0x00197d0c | + | 00198778: 0c065f43 jal 0x00197d0c Find Active Unit |
− | 0019877c: 00002821 addu r5,r0,r0 | + | 0019877c: 00002821 addu r5,r0,r0 |
− | 00198780: 1040000b beq r2,r0,0x001987b0 | + | 00198780: 1040000b beq r2,r0,0x001987b0 Branch if no active units found |
00198784: 34040002 ori r4,r0,0x0002 | 00198784: 34040002 ori r4,r0,0x0002 | ||
− | 00198788: 0c065f98 jal 0x00197e60 | + | |
+ | <4> | ||
+ | 00198788: 0c065f98 jal 0x00197e60 Decide if AI will choose ability (Chose Move from movelist) | ||
0019878c: 00000000 nop | 0019878c: 00000000 nop | ||
00198790: 2403ffff addiu r3,r0,0xffff | 00198790: 2403ffff addiu r3,r0,0xffff | ||
− | 00198794: 10430015 beq r2,r3,0x001987ec | + | 00198794: 10430015 beq r2,r3,0x001987ec Save Decision and Return -1 if -1 |
− | 00198798: 34020004 ori r2,r0,0x0004 | + | 00198798: 34020004 ori r2,r0,0x0004 Next Decision = 4 |
0019879c: 0c065c2f jal 0x001970bc | 0019879c: 0c065c2f jal 0x001970bc | ||
001987a0: 00000000 nop | 001987a0: 00000000 nop | ||
− | 001987a4: 14400017 bne r2,r0,0x00198804 | + | 001987a4: 14400017 bne r2,r0,0x00198804 Exit and return 0 |
001987a8: 00001021 addu r2,r0,r0 | 001987a8: 00001021 addu r2,r0,r0 | ||
− | 001987ac: 34040002 ori r4,r0,0x0002 | + | 001987ac: 34040002 ori r4,r0,0x0002 Look for any allied unit |
− | 001987b0: 0c065f43 jal 0x00197d0c | + | 001987b0: 0c065f43 jal 0x00197d0c Find Active unit |
001987b4: 00002821 addu r5,r0,r0 | 001987b4: 00002821 addu r5,r0,r0 | ||
− | 001987b8: 1040000f beq r2,r0,0x001987f8 | + | 001987b8: 1040000f beq r2,r0,0x001987f8 <Reset Flags> if no active units found |
001987bc: 34020002 ori r2,r0,0x0002 | 001987bc: 34020002 ori r2,r0,0x0002 | ||
− | 001987c0: 0c065f98 jal 0x00197e60 | + | |
+ | <Decision 5, 6, and 8+> | ||
+ | 001987c0: 0c065f98 jal 0x00197e60 Decide if AI will choose ability (Chose Move from movelist) | ||
001987c4: 00000000 nop | 001987c4: 00000000 nop | ||
001987c8: 2403ffff addiu r3,r0,0xffff | 001987c8: 2403ffff addiu r3,r0,0xffff | ||
− | 001987cc: 10430007 beq r2,r3,0x001987ec | + | 001987cc: 10430007 beq r2,r3,0x001987ec Save Decision and Return -1 if -1 |
− | 001987d0: 34020006 ori r2,r0,0x0006 | + | 001987d0: 34020006 ori r2,r0,0x0006 Next Decision = 6 |
− | 001987d4: 0c065c2f jal 0x001970bc | + | 001987d4: 0c065c2f jal 0x001970bc Find Active unit |
− | 001987d8: 00000000 nop | + | 001987d8: 00000000 nop It doesn't set it's search parameters(r4)? |
− | 001987dc: 10400006 beq r2,r0,0x001987f8 | + | 001987dc: 10400006 beq r2,r0,0x001987f8 <Reset Flags> if no active units found |
001987e0: 34020002 ori r2,r0,0x0002 | 001987e0: 34020002 ori r2,r0,0x0002 | ||
− | 001987e4: 08066201 j 0x00198804 | + | 001987e4: 08066201 j 0x00198804 Exit and return 0 |
001987e8: 00001021 addu r2,r0,r0 | 001987e8: 00001021 addu r2,r0,r0 | ||
− | 001987ec: a2220c6e sb r2,0x0c6e(r17) | + | |
− | 001987f0: 08066201 j 0x00198804 | + | <Save and Return -1> |
+ | 001987ec: a2220c6e sb r2,0x0c6e(r17) Save Next Decision | ||
+ | 001987f0: 08066201 j 0x00198804 Exit and return -1 | ||
001987f4: 2402ffff addiu r2,r0,0xffff | 001987f4: 2402ffff addiu r2,r0,0xffff | ||
− | 001987f8: 0c066526 jal 0x00199498 | + | |
− | 001987fc: a2220e2d sb r2,0x0e2d(r17) | + | <Reset Flags> |
+ | 001987f8: 0c066526 jal 0x00199498 Reset Ability Choice Data? (Target Flags?) | ||
+ | 001987fc: a2220e2d sb r2,0x0e2d(r17) Ability Decided = 02? | ||
00198800: 00001021 addu r2,r0,r0 | 00198800: 00001021 addu r2,r0,r0 | ||
+ | |||
00198804: 8fbf0020 lw r31,0x0020(r29) | 00198804: 8fbf0020 lw r31,0x0020(r29) | ||
00198808: 8fb1001c lw r17,0x001c(r29) | 00198808: 8fb1001c lw r17,0x001c(r29) | ||
Line 205: | Line 269: | ||
00198814: 03e00008 jr r31 | 00198814: 03e00008 jr r31 | ||
00198818: 00000000 nop | 00198818: 00000000 nop | ||
− |
Latest revision as of 07:37, 11 March 2017
Description: Documentation is not complete yet. This is the AI routine responsible for evaluating who needs healing and status curing.
Referenced In: Auto Battle Handling
Routines Used: Find Peril Most Unit (00198b04) Decide where to move to Find and Invert Priority Evaluate Cancel Status Ability Set/Remove Charging Find Active Unit Decide if AI will choose ability Randomly Transfer Data Reset Ability Choice Data?
001984ec: 3c02801a lui r2,0x801a 001984f0: 8c420bbc lw r2,0x0bbc(r2) 001984f4: 27bdffd8 addiu r29,r29,0xffd8 001984f8: afbf0020 sw r31,0x0020(r29) 001984fc: afb1001c sw r17,0x001c(r29) 00198500: afb00018 sw r16,0x0018(r29) 00198504: 3c068019 lui r6,0x8019 00198508: 24c63d70 addiu r6,r6,0x3d70 0019850c: 80c30000 lb r3,0x0000(r6) 00198510: 80c40001 lb r4,0x0001(r6) 00198514: 80c50002 lb r5,0x0002(r6) 00198518: a3a30010 sb r3,0x0010(r29) 0019851c: a3a40011 sb r4,0x0011(r29) 00198520: a3a50012 sb r5,0x0012(r29) 00198524: 905001b9 lbu r16,0x01b9(r2) Load Main Target 00198528: 3c02801a lui r2,0x801a 0019852c: 90420d7b lbu r2,0x0d7b(r2) 00198530: 3c11801a lui r17,0x801a 00198534: 2631f3c4 addiu r17,r17,0xf3c4 00198538: 1040000d beq r2,r0,0x00198570 0019853c: 00000000 nop 00198540: 3c03801a lui r3,0x801a 00198544: 90630032 lbu r3,0x0032(r3) Load Decision Byte 00198548: 00000000 nop 0019854c: 2c620008 sltiu r2,r3,0x0008 00198550: 1040009b beq r2,r0,0x001987c0 Branch if Decision > 7 00198554: 00031080 sll r2,r3,0x02 00198558: 3c018019 lui r1,0x8019 0019855c: 00220821 addu r1,r1,r2 00198560: 8c223d78 lw r2,0x3d78(r1) 00198564: 00000000 nop 00198568: 00400008 jr r2 0019856c: 00000000 nop
0: 80198578 1: 801985f8 2: 8019870c 3: 80198748 4: 80198788 5: 801987c0 6: 801987c0 7: 801986a0
<Usage not set> 00198570: 3c01801a lui r1,0x801a 00198574: a02001f1 sb r0,0x01f1(r1)
<0> (Initialize Priority) 00198578: 0c066672 jal 0x001999c8 Initialize Targeting Priorities of all units 0019857c: 00000000 nop 00198580: 2403ffff addiu r3,r0,0xffff 00198584: 14430008 bne r2,r3,0x001985a8 Branch if it failed 00198588: 00101100 sll r2,r16,0x04 0019858c: a2200c6e sb r0,0x0c6e(r17) Next Decision = 0 00198590: 08066201 j 0x00198804 Exit and return -1 00198594: 2402ffff addiu r2,r0,0xffff
(Peril Jump) 00198598: 3c01801a lui r1,0x801a 0019859c: ac22f37c sw r2,-0x0c84(r1) 001985a0: 08066177 j 0x001985dc Jump to Peril Routine 001985a4: 00000000 nop 001985a8: 02221821 addu r3,r17,r2 001985ac: 3c01801a lui r1,0x801a 001985b0: ac20f37c sw r0,-0x0c84(r1) 001985b4: 90621833 lbu r2,0x1833(r3) AI Targeting Flags 001985b8: 00000000 nop 001985bc: 00021102 srl r2,r2,0x04 Remove the 08 flag and below 001985c0: 30420001 andi r2,r2,0x0001 001985c4: 14400005 bne r2,r0,0x001985dc Branch if unit can't be targeted 001985c8: 00000000 nop 001985cc: 90621834 lbu r2,0x1834(r3) Load Enemy Flag 001985d0: 00000000 nop 001985d4: 10400006 beq r2,r0,0x001985f0 Branch if Ally 001985d8: 00000000 nop 001985dc: 0c0662c1 jal 0x00198b04 Find the unit in highest peril 001985e0: 00000000 nop 001985e4: 8e2217f8 lw r2,0x17f8(r17) Acting Unit's Data Pointer 001985e8: 00000000 nop 001985ec: 905001b9 lbu r16,0x01b9(r2) Load Main Target 001985f0: 0c065243 jal 0x0019490c Store main target ID and focus on target flag 001985f4: 02002021 addu r4,r16,r0
<1> 001985f8: 0c0660b6 jal 0x001982d8 Decide where to move to 001985fc: 00000000 nop 00198600: 2403ffff addiu r3,r0,0xffff 00198604: 10430079 beq r2,r3,0x001987ec Save Decision and Return -1 if no decision to move was made 00198608: 34020001 ori r2,r0,0x0001 Next Decision = 01 0019860c: 34020002 ori r2,r0,0x0002 00198610: 0c0658c3 jal 0x0019630c Find and Invert Priority 00198614: a2220e2d sb r2,0x0e2d(r17) Ability Decided = True 00198618: 3c02801a lui r2,0x801a 0019861c: 8c42f37c lw r2,-0x0c84(r2) 00198620: 00000000 nop 00198624: 14400037 bne r2,r0,0x00198704 00198628: a2200e2d sb r0,0x0e2d(r17) Ability Decided = False 0019862c: 00101100 sll r2,r16,0x04 00198630: 02221021 addu r2,r17,r2 00198634: 90421833 lbu r2,0x1833(r2) AI Targeting Flags 00198638: 00000000 nop 0019863c: 00021182 srl r2,r2,0x06 Remove the 20 flag and below 00198640: 30420001 andi r2,r2,0x0001 00198644: 14400030 bne r2,r0,0x00198708 Save ?, then <2> if Dead Unit with Reraise 00198648: 34020001 ori r2,r0,0x0001 0019864c: 3c01801a lui r1,0x801a 00198650: ac20f380 sw r0,-0x0c80(r1) Clear ? 00198654: 001018c0 sll r3,r16,0x03 Target ID * 8
<Status Loop> 00198658: 00701823 subu r3,r3,r16 Target ID * 7 0019865c: 3c02801a lui r2,0x801a 00198660: 8c42f380 lw r2,-0x0c80(r2) Load ? Counter 00198664: 00031980 sll r3,r3,0x06 Target ID * 1c0 00198668: 03a21021 addu r2,r29,r2 ? + Stack Pointer 0019866c: 90440010 lbu r4,0x0010(r2) r4 = Status ID? 00198670: 3c028019 lui r2,0x8019 00198674: 24420924 addiu r2,r2,0x0924 Point to Current Status 00198678: 00621821 addu r3,r3,r2 Point to Main Target's Current Status 0019867c: 34020080 ori r2,r0,0x0080 00198680: 000428c2 srl r5,r4,0x03 r5 = Status ID / 8 00198684: 00651821 addu r3,r3,r5 r3 = Status ID + Current Status Pointer 00198688: 30840007 andi r4,r4,0x0007 r4 = Status Position Slot Flag 0019868c: 90630000 lbu r3,0x0000(r3) Load Target Current Status 00198690: 00821007 srav r2,r2,r4 80 / (1 - 7) = (1 - 80) 00198694: 00621824 and r3,r3,r2 00198698: 10600011 beq r3,r0,0x001986e0 <?++> if Target Unit does not have status 0019869c: 00000000 nop
<7> Evaluate Status 001986a0: 3c02801a lui r2,0x801a 001986a4: 8c42f380 lw r2,-0x0c80(r2) Load ? 001986a8: 00000000 nop 001986ac: 03a21021 addu r2,r29,r2 001986b0: 90450010 lbu r5,0x0010(r2) Load Status ID 001986b4: 0c066207 jal 0x0019881c Evaluate Cancel Status Ability 001986b8: 02002021 addu r4,r16,r0 r4 = Target ID 001986bc: 00401821 addu r3,r2,r0 001986c0: 2402ffff addiu r2,r0,0xffff 001986c4: 10620049 beq r3,r2,0x001987ec Save Decision and Return -1 if Ability was choosen 001986c8: 34020007 ori r2,r0,0x0007 Next Decision = 7 001986cc: 34020002 ori r2,r0,0x0002 001986d0: 1062004b beq r3,r2,0x00198800 Branch if 0x0071 = True 001986d4: 00000000 nop 001986d8: 1060ffaf beq r3,r0,0x00198598 Jump to <Peril Jump> if no abilities were choosen 001986dc: 34020001 ori r2,r0,0x0001
<?++> 001986e0: 3c02801a lui r2,0x801a 001986e4: 8c42f380 lw r2,-0x0c80(r2) Load ? Counter 001986e8: 00000000 nop 001986ec: 24420001 addiu r2,r2,0x0001 001986f0: 3c01801a lui r1,0x801a 001986f4: ac22f380 sw r2,-0x0c80(r1) ? Counter++ 001986f8: 28420003 slti r2,r2,0x0003 001986fc: 1440ffd6 bne r2,r0,0x00198658 Do twice 00198700: 001018c0 sll r3,r16,0x03 00198704: 34020001 ori r2,r0,0x0001 00198708: a2220e2d sb r2,0x0e2d(r17) Ability Decided = True
<2> Set/Remove Charging, then look for Main Target 0019870c: 0c0657e3 jal 0x00195f8c Set/Remove Charging 00198710: 00000000 nop 00198714: 00401821 addu r3,r2,r0 00198718: 2402ffff addiu r2,r0,0xffff 0019871c: 10620033 beq r3,r2,0x001987ec Save Decision and Return -1 if Frame RNG said so 00198720: 34020002 ori r2,r0,0x0002 Next Decision = 02 00198724: 34020001 ori r2,r0,0x0001 00198728: 10620036 beq r3,r2,0x00198804 Exit and return 0 if Ability is a Lower Priority 0019872c: 00001021 addu r2,r0,r0
<Is Main Target Targetable> 00198730: a2200e2d sb r0,0x0e2d(r17) Ability Decided = False 00198734: 34040003 ori r4,r0,0x0003 Find Specific Unit 00198738: 0c065f43 jal 0x00197d0c Find Active Unit 0019873c: 02002821 addu r5,r16,r0 Look for Main Target 00198740: 1040000b beq r2,r0,0x00198770 Branch if Target not Active 00198744: 34020001 ori r2,r0,0x0001
<3> Attempt to Choose Move, then look for enemy unit 00198748: 0c065f98 jal 0x00197e60 Decide if AI will choose ability (Chose Move from movelist) 0019874c: 00000000 nop 00198750: 2403ffff addiu r3,r0,0xffff 00198754: 10430025 beq r2,r3,0x001987ec Save Next Decision and Return -1 if Ability was choosen 00198758: 34020003 ori r2,r0,0x0003 Next Decision = 3 0019875c: 0c065c2f jal 0x001970bc Randomly Transfer Data 00198760: 00000000 nop 00198764: 14400027 bne r2,r0,0x00198804 Exit and return 0 if Data was successfully transferred 00198768: 00001021 addu r2,r0,r0
0019876c: 34020001 ori r2,r0,0x0001 00198770: a2220e2d sb r2,0x0e2d(r17) Ability Decided = True 00198774: 34040001 ori r4,r0,0x0001 Look for any enemy unit 00198778: 0c065f43 jal 0x00197d0c Find Active Unit 0019877c: 00002821 addu r5,r0,r0 00198780: 1040000b beq r2,r0,0x001987b0 Branch if no active units found 00198784: 34040002 ori r4,r0,0x0002
<4> 00198788: 0c065f98 jal 0x00197e60 Decide if AI will choose ability (Chose Move from movelist) 0019878c: 00000000 nop 00198790: 2403ffff addiu r3,r0,0xffff 00198794: 10430015 beq r2,r3,0x001987ec Save Decision and Return -1 if -1 00198798: 34020004 ori r2,r0,0x0004 Next Decision = 4 0019879c: 0c065c2f jal 0x001970bc 001987a0: 00000000 nop 001987a4: 14400017 bne r2,r0,0x00198804 Exit and return 0 001987a8: 00001021 addu r2,r0,r0 001987ac: 34040002 ori r4,r0,0x0002 Look for any allied unit 001987b0: 0c065f43 jal 0x00197d0c Find Active unit 001987b4: 00002821 addu r5,r0,r0 001987b8: 1040000f beq r2,r0,0x001987f8 <Reset Flags> if no active units found 001987bc: 34020002 ori r2,r0,0x0002
<Decision 5, 6, and 8+> 001987c0: 0c065f98 jal 0x00197e60 Decide if AI will choose ability (Chose Move from movelist) 001987c4: 00000000 nop 001987c8: 2403ffff addiu r3,r0,0xffff 001987cc: 10430007 beq r2,r3,0x001987ec Save Decision and Return -1 if -1 001987d0: 34020006 ori r2,r0,0x0006 Next Decision = 6 001987d4: 0c065c2f jal 0x001970bc Find Active unit 001987d8: 00000000 nop It doesn't set it's search parameters(r4)? 001987dc: 10400006 beq r2,r0,0x001987f8 <Reset Flags> if no active units found 001987e0: 34020002 ori r2,r0,0x0002 001987e4: 08066201 j 0x00198804 Exit and return 0 001987e8: 00001021 addu r2,r0,r0
<Save and Return -1> 001987ec: a2220c6e sb r2,0x0c6e(r17) Save Next Decision 001987f0: 08066201 j 0x00198804 Exit and return -1 001987f4: 2402ffff addiu r2,r0,0xffff
<Reset Flags> 001987f8: 0c066526 jal 0x00199498 Reset Ability Choice Data? (Target Flags?) 001987fc: a2220e2d sb r2,0x0e2d(r17) Ability Decided = 02? 00198800: 00001021 addu r2,r0,r0
00198804: 8fbf0020 lw r31,0x0020(r29) 00198808: 8fb1001c lw r17,0x001c(r29) 0019880c: 8fb00018 lw r16,0x0018(r29) 00198810: 27bd0028 addiu r29,r29,0x0028 00198814: 03e00008 jr r31 00198818: 00000000 nop