Difference between revisions of "Main reaction routine"
Jump to navigation
Jump to search
(Updated documentation) |
|||
Line 1: | Line 1: | ||
− | 00197d0c: 00005821 addu r11,r0,r0 | + | '''BATTLE.BIN''' : - Find which units are active? |
− | 00197d10: 00003821 addu r7,r0,r0 | + | ------------------------------------------------------------------------------------------ |
− | 00197d14: 340d0001 ori r13,r0,0x0001 | + | ------------------------------------------------------------------------------------------ |
− | 00197d18: 3c0c801a lui r12,0x801a | + | Parameter : r4 = Preset Value 1 |
− | 00197d1c: 258cf3c4 addiu r12,r12,0xf3c4 | + | r5 = preset Value 2 |
− | 00197d20: 01804821 addu r9,r12,r0 | + | Return : r2 = Nb Of Unit in List (AI 0xc78) |
− | 00197d24: 00004021 addu r8,r0,r0 | + | ------------------------------------------------------------------------------------------ |
− | 00197d28: 340a182c ori r10,r0,0x182c | + | 00197d0c: 00005821 addu r11,r0,r0 |{{f/std|Targetable Unit counter ?}} |
− | + | 00197d10: 00003821 addu r7,r0,r0 |{{f/std|Initialize Unit counter}} | |
− | + | 00197d14: 340d0001 ori r13,r0,0x0001 |{{f/std|Prepare [True] Flag}} | |
− | 00197d2c: 018a1821 addu r3,r12,r10 | + | 00197d18: 3c0c801a lui r12,0x801a | |
− | 00197d30: a1200c78 sb r0,0x0c78(r9) | + | 00197d1c: 258cf3c4 addiu r12,r12,0xf3c4 |{{f/adr|0x8019f3c4}} |
− | 00197d34: 90620007 lbu r2,0x0007(r3) | + | 00197d20: 01804821 addu r9,r12,r0 |{{f/std|Initialize Dynamic pointer to AI 0xc78 Table}} |
− | 00197d38: 00000000 nop | + | 00197d24: 00004021 addu r8,r0,r0 |{{f/std|Initialize Dynamic Battle offset}} |
− | 00197d3c: 30420010 andi r2,r2,0x0010 | + | 00197d28: 340a182c ori r10,r0,0x182c |{{f/std|Intialize Dynamic AI Decision offset}} |
− | 00197d40: 1440003f bne r2,r0,0x00197e40 | + | {{f/bloop|LOOP}} |
− | 00197d44: 00000000 nop | + | 00197d2c: 018a1821 addu r3,r12,r10 |{{f/adr|This Unit AI decision data pointer}} {{f/std|8019f3c4 + 0x182c + Unit offset}} |
− | 00197d48: 3c018019 lui r1,0x8019 | + | 00197d30: a1200c78 sb r0,0x0c78(r9) |{{f/store|Initialize Chosen Unit ID?}} |
− | 00197d4c: 00280821 addu r1,r1,r8 | + | 00197d34: 90620007 lbu r2,0x0007(r3) |{{f/load|Load AI Decision data 0x07}} |
− | 00197d50: 90220925 lbu r2,0x0925(r1) | + | 00197d38: 00000000 nop | |
− | 00197d54: 00000000 nop | + | 00197d3c: 30420010 andi r2,r2,0x0010 |{{f/std|Check flag 0x10}} |
− | 00197d58: 30420010 andi r2,r2,0x0010 | + | 00197d40: 1440003f bne r2,r0,0x00197e40 {{f/Cond|If Unit is Untargetable branch to }} {{f/loc|Next Unit}} {{f/std|Will not increase r11}} |
− | 00197d5c: 14400006 bne r2,r0,0x00197d78 | + | 00197d44: 00000000 nop | |
− | 00197d60: 00000000 nop | + | '''Else : This Unit is Targetable''' |
− | 00197d64: 90620004 lbu r2,0x0004(r3) | + | 00197d48: 3c018019 lui r1,0x8019 | |
− | 00197d68: 00000000 nop | + | 00197d4c: 00280821 addu r1,r1,r8 | |
− | 00197d6c: 30420080 andi r2,r2,0x0080 | + | 00197d50: 90220925 lbu r2,0x0925(r1) |{{f/load|Current Status 2}} {{f/adr|Dynamic pointer to this Unit Battle Data 0x59}} |
− | 00197d70: 10400033 beq r2,r0,0x00197e40 | + | 00197d54: 00000000 nop | |
− | 00197d74: 00000000 nop | + | 00197d58: 30420010 andi r2,r2,0x0010 | |
− | 00197d78: 91820e2e lbu r2,0x0e2e(r12) | + | 00197d5c: 14400006 bne r2,r0,0x00197d78 {{f/Cond|If Unit is NOT confused}} |
− | 00197d7c: 00000000 nop | + | 00197d60: 00000000 nop | |
− | 00197d80: 14e20004 bne r7,r2,0x00197d94 | + | 00197d64: 90620004 lbu r2,0x0004(r3) |{{f/load|AI Decision Byte 0x04}} {{f/adr|Dynamic pointer to Unit AI 0x182c + 0x04}} |
− | 00197d84: 34020002 ori r2,r0,0x0002 | + | 00197d68: 00000000 nop | |
− | 00197d88: 340200ff ori r2,r0,0x00ff | + | 00197d6c: 30420080 andi r2,r2,0x0080 | |
− | 00197d8c: 10a2002c beq r5,r2,0x00197e40 | + | 00197d70: 10400033 beq r2,r0,0x00197e40 {{f/Cond|If Unit is NOT Worth to be considered branch to}} {{f/loc|Next Unit}} |
− | 00197d90: 34020002 ori r2,r0,0x0002 | + | 00197d74: 00000000 nop | |
− | 00197d94: 10820015 beq r4,r2,0x00197dec | + | |
− | 00197d98: 28820003 slti r2,r4,0x0003 | + | '''Else : Unit Confused or Worth to be considered''' |
− | 00197d9c: 10400005 beq r2,r0,0x00197db4 | + | 00197d78: 91820e2e lbu r2,0x0e2e(r12) |{{f/load|Acting Unit's ID}} |
− | 00197da0: 00000000 nop | + | 00197d7c: 00000000 nop | |
− | 00197da4: 108d000e beq r4,r13,0x00197de0 | + | 00197d80: 14e20004 bne r7,r2,0x00197d94 {{f/Cond|If This Unit is Acting Unit }} |
− | 00197da8: 00000000 nop | + | 00197d84: 34020002 ori r2,r0,0x0002 |{{f/std|<nowiki>r2 = (0x2) </nowiki>}} |
− | 00197dac: 08065f8f j 0x00197e3c | + | 00197d88: 340200ff ori r2,r0,0x00ff | |
− | 00197db0: a12d0c78 sb r13,0x0c78(r9) | + | 00197d8c: 10a2002c beq r5,r2,0x00197e40 {{f/Cond|<nowiki>If Preset Value 2 = 0xff</nowiki>}} {{f/loc|Ignore Acting Unit}} |
− | + | 00197d90: 34020002 ori r2,r0,0x0002 |{{f/std|<nowiki>r2 = (0x2) 2</nowiki>}} | |
− | 00197db4: 34020003 ori r2,r0,0x0003 | + | 00197d94: 10820015 beq r4,r2,0x00197dec {{f/Cond|<nowiki>if Preset Value 1 = 0x02</nowiki>}} {{f/loc|go to Allies only section}} |
− | 00197db8: 10820005 beq r4,r2,0x00197dd0 | + | 00197d98: 28820003 slti r2,r4,0x0003 |{{f/std|1 if preset value < 0x3 }} |
− | + | 00197d9c: 10400005 beq r2,r0,0x00197db4 {{f/Cond|if Preset Value 1< 0x02}} | |
− | 00197dbc: 34020004 ori r2,r0,0x0004 | + | 00197da0: 00000000 nop | |
− | 00197dc0: 10820010 beq r4,r2,0x00197e04 | + | 00197da4: 108d000e beq r4,r13,0x00197de0 {{f/Cond|<nowiki>if Preset Value = 0x1</nowiki>}} {{f/loc|go to Enemies only section}} |
− | 00197dc4: 3c020001 lui r2,0x0001 | + | 00197da8: 00000000 nop | |
− | + | 00197dac: 08065f8f j 0x00197e3c {{f/jump|<nowiki>Directly Enable 0xc78 flag if preset Value = 0x00 and go to </nowiki>}} {{f/loc|Increase Target counter}} | |
− | + | 00197db0: a12d0c78 sb r13,0x0c78(r9) |{{f/store|Enable This Unit flag inAI 0xc78 Table}} | |
− | 00197dc8: 08065f8f j 0x00197e3c | + | 00197db4: 34020003 ori r2,r0,0x0003 |{{f/std|<nowiki>r2 = (0x3) 3</nowiki>}} |
− | 00197dcc: a12d0c78 sb r13,0x0c78(r9) | + | 00197db8: 10820005 beq r4,r2,0x00197dd0 {{f/Cond|<nowiki>If preset Value 1 = 0x03</nowiki>}} {{f/loc|go to specific unit section}} |
− | + | 00197dbc: 34020004 ori r2,r0,0x0004 |{{f/std|<nowiki>r2 = (0x4) 4</nowiki>}} | |
− | + | 00197dc0: 10820010 beq r4,r2,0x00197e04 {{f/Cond|<nowiki>If preset Value 1 = 0x04</nowiki>}} {{f/loc|Go to status section}} | |
− | 00197dd0: 14e5001b bne r7,r5,0x00197e40 | + | 00197dc4: 3c020001 lui r2,0x0001 | |
− | 00197dd4: 00000000 nop | + | 00197dc8: 08065f8f j 0x00197e3c {{f/jump|Else : PV > 0x04 }} {{f/loc|Increase Target counter}} |
− | 00197dd8: 08065f8f j 0x00197e3c | + | 00197dcc: a12d0c78 sb r13,0x0c78(r9) |{{f/store|Enable This Unit flag inAI 0xc78 Table}} |
− | 00197ddc: a12d0c78 sb r13,0x0c78(r9) | + | |
− | + | {{f/sec|<nowiki>Preset Value 1 = 0x03 -Find one specific Unit (ID = r5)</nowiki>}} | |
− | + | 00197dd0: 14e5001b bne r7,r5,0x00197e40 {{f/Cond|If Preset Value 2 <> Unit Counter : }} {{f/loc|Ignore This Unit}} | |
− | 00197de0: 90620008 lbu r2,0x0008(r3) | + | 00197dd4: 00000000 nop | |
− | 00197de4: 08065f8c j 0x00197e30 | + | 00197dd8: 08065f8f j 0x00197e3c {{f/jump|Else : Enable Flag and }} {{f/loc|Count this unit}} |
− | 00197de8: 00000000 nop | + | 00197ddc: a12d0c78 sb r13,0x0c78(r9) |{{f/store|Enable This Unit flag inAI 0xc78 Table}} |
− | + | ||
− | + | {{f/sec|<nowiki>Preset Value 1 = 0x01 - Seek enemies only</nowiki>}} | |
− | 00197dec: 90620008 lbu r2,0x0008(r3) | + | 00197de0: 90620008 lbu r2,0x0008(r3) |{{f/load|Load Enemy Flag}} {{f/adr|Dynamic pointer to Unit AI 0x182c + 0x08}} |
− | 00197df0: 00000000 nop | + | 00197de4: 08065f8c j 0x00197e30 {{f/jump|Jump and : }} {{f/loc|Count only Enemies}} |
− | 00197df4: 14400012 bne r2,r0,0x00197e40 | + | 00197de8: 00000000 nop | |
− | 00197df8: 00000000 nop | + | |
− | 00197dfc: 08065f8f j 0x00197e3c | + | {{f/sec|<nowiki>Preset Value 1 = 0x02 - Seek Allies only</nowiki>}} |
− | 00197e00: a12d0c78 sb r13,0x0c78(r9) | + | 00197dec: 90620008 lbu r2,0x0008(r3) |{{f/load|Load Enemy Flag}} {{f/adr|Dynamic pointer to Unit AI 0x182c + 0x08}} |
− | + | 00197df0: 00000000 nop | | |
− | + | 00197df4: 14400012 bne r2,r0,0x00197e40 {{f/Cond|If Unit in an Enemy}} {{f/loc|Ignore This Unit}} | |
− | 00197e04: 3c038019 lui r3,0x8019 | + | 00197df8: 00000000 nop | |
− | 00197e08: 246308cc addiu r3,r3,0x08cc | + | 00197dfc: 08065f8f j 0x00197e3c {{f/jump|Else : if Unit is an Ally}} {{f/loc|Count this unit}} |
− | 00197e0c: 01033021 addu r6,r8,r3 | + | 00197e00: a12d0c78 sb r13,0x0c78(r9) |{{f/store|Enable This Unit flag inAI 0xc78 Table}} |
− | 00197e10: 8cc30058 lw r3,0x0058(r6) | + | |
− | 00197e14: 34428020 ori r2,r2,0x8020 | + | {{f/sec|<nowiki>Preset Value 1 = 0x04 - seek Unit with death, petrify, critical or death sentence</nowiki>}} |
− | 00197e18: 00621824 and r3,r3,r2 | + | 00197e04: 3c038019 lui r3,0x8019 | |
− | 00197e1c: 14600006 bne r3,r0,0x00197e38 | + | 00197e08: 246308cc addiu r3,r3,0x08cc | |
− | 00197e20: 00000000 nop | + | 00197e0c: 01033021 addu r6,r8,r3 |{{f/adr|This Unit Battle data pointer}} |
− | 00197e24: 90c2005c lbu r2,0x005c(r6) | + | 00197e10: 8cc30058 lw r3,0x0058(r6) |{{f/adr|Load Current Statuses 1-4}} |
− | 00197e28: 00000000 nop | + | 00197e14: 34428020 ori r2,r2,0x8020 |{{f/std|<nowiki>r2 = 00018020</nowiki>}} |
− | 00197e2c: 30420001 andi r2,r2,0x0001 | + | 00197e18: 00621824 and r3,r3,r2 | |
− | 00197e30: 10400003 beq r2,r0,0x00197e40 | + | 00197e1c: 14600006 bne r3,r0,0x00197e38 {{f/Cond|If Unit is Critical, Petrifed or Dead}} {{f/loc|Count this unit}} |
− | 00197e34: 00000000 nop | + | 00197e20: 00000000 nop | |
− | 00197e38: a12d0c78 sb r13,0x0c78(r9) | + | 00197e24: 90c2005c lbu r2,0x005c(r6) |{{f/load|Load Current Statuses 5}} |
− | + | 00197e28: 00000000 nop | | |
− | + | 00197e2c: 30420001 andi r2,r2,0x0001 | | |
− | 00197e3c: 340b0001 ori r11,r0,0x0001 | + | 00197e30: 10400003 beq r2,r0,0x00197e40 {{f/Cond|If This Unit has not Death Sentence}} {{f/loc|Ignore This Unit}} |
− | 00197e40: 25290001 addiu r9,r9,0x0001 | + | 00197e34: 00000000 nop | |
− | 00197e44: 250801c0 addiu r8,r8,0x01c0 | + | |
− | 00197e48: 24e70001 addiu r7,r7,0x0001 | + | {{f/sec|<nowiki>Preset Value 1 = 0x00 - Any Units</nowiki>}} |
− | 00197e4c: 28e20015 slti r2,r7,0x0015 | + | 00197e38: a12d0c78 sb r13,0x0c78(r9) |{{f/store|Enable This Unit flag inAI 0xc78 Table}} |
− | 00197e50: 1440ffb6 bne r2,r0,0x00197d2c | + | |
− | 00197e54: 254a0010 addiu r10,r10,0x0010 | + | {{f/sec|Add Unit to Targeted Unit counter}} |
− | + | 00197e3c: 340b0001 ori r11,r0,0x0001 |{{f/std|Considered Units Counter + 1}} | |
− | 00197e58: 03e00008 jr r31 | + | 00197e40: 25290001 addiu r9,r9,0x0001 |{{f/std|Offset for AI Table 0xc78}} |
− | 00197e5c: 01601021 addu r2,r11,r0 | + | 00197e44: 250801c0 addiu r8,r8,0x01c0 |{{f/std|Battle Data Offset (+0x1c0 each iteration)}} |
+ | 00197e48: 24e70001 addiu r7,r7,0x0001 |{{f/std|Unit Counter + 1}} | ||
+ | 00197e4c: 28e20015 slti r2,r7,0x0015 | | ||
+ | 00197e50: 1440ffb6 bne r2,r0,0x00197d2c {{f/eloop|Do for all units}} | ||
+ | 00197e54: 254a0010 addiu r10,r10,0x0010 |{{f/std|AI Decision Offset (+0x10 each iteration)}} {{f/std|For data at 8019f3c4 + 0x182c}} | ||
+ | 00197e58: 03e00008 jr r31 {{f/jump|Jump to Address}} | ||
+ | 00197e5c: 01601021 addu r2,r11,r0 |{{f/std|<nowiki>r2 = # of units considered</nowiki>}} | ||
+ | ===Return locations=== | ||
+ | '''BATTLE.BIN''' | ||
+ | 00196248: [[Non-Specific AI AutoBattle (Enemies)]] r4 = 0x00 / r5 = 0x00 | ||
+ | 00197350: [[Set_chosen_ability/target_for_AI_status]] r4 = 0x00 / r5 = 0xff (Confuse section) | ||
+ | 00198238: [[Fight_for_Life_-_Auto_Battle_(00197ff4)]] r4 = 0x03 / r5 = Unit ID | ||
+ | 00198278: [[Fight_for_Life_-_Auto_Battle_(00197ff4)]] r4 = 0x00 / r5 = 0x00 | ||
+ | 00198740: [[Protect_Allies_-_Auto_Battle_(001984ec)]] r4 = 0x03 / r5 = Unit ID | ||
+ | 00198780: [[Protect_Allies_-_Auto_Battle_(001984ec)]] r4 = 0x01 / r5 = 0x00 | ||
+ | 001987b8: [[Protect_Allies_-_Auto_Battle_(001984ec)]] r4 = 0x02 / r5 = 0x00 | ||
+ | 00198900: [[Evaluate_Cancel_Status_Ability_(0019881c)]] r4 = 0x03 / r5 = Unit ID | ||
+ | 00198f18: [[AI_Critical_or_Run_Like_Rabbit]] r4 = 0x03 / r5 = Acting Unit ID | ||
+ | 00198ff0: [[AI_Critical_or_Run_Like_Rabbit]] r4 = 0x00 / r5 = 0xff |
Revision as of 17:18, 23 April 2024
BATTLE.BIN : - Find which units are active? ------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------ Parameter : r4 = Preset Value 1 r5 = preset Value 2 Return : r2 = Nb Of Unit in List (AI 0xc78) ------------------------------------------------------------------------------------------ 00197d0c: 00005821 addu r11,r0,r0 |Targetable Unit counter ? 00197d10: 00003821 addu r7,r0,r0 |Initialize Unit counter 00197d14: 340d0001 ori r13,r0,0x0001 |Prepare [True] Flag 00197d18: 3c0c801a lui r12,0x801a | 00197d1c: 258cf3c4 addiu r12,r12,0xf3c4 |0x8019f3c4 00197d20: 01804821 addu r9,r12,r0 |Initialize Dynamic pointer to AI 0xc78 Table 00197d24: 00004021 addu r8,r0,r0 |Initialize Dynamic Battle offset 00197d28: 340a182c ori r10,r0,0x182c |Intialize Dynamic AI Decision offset @LOOP 00197d2c: 018a1821 addu r3,r12,r10 |This Unit AI decision data pointer 8019f3c4 + 0x182c + Unit offset 00197d30: a1200c78 sb r0,0x0c78(r9) |Initialize Chosen Unit ID? 00197d34: 90620007 lbu r2,0x0007(r3) |Load AI Decision data 0x07 00197d38: 00000000 nop | 00197d3c: 30420010 andi r2,r2,0x0010 |Check flag 0x10 00197d40: 1440003f bne r2,r0,0x00197e40 #If Unit is Untargetable branch to Next Unit Will not increase r11 00197d44: 00000000 nop | Else : This Unit is Targetable 00197d48: 3c018019 lui r1,0x8019 | 00197d4c: 00280821 addu r1,r1,r8 | 00197d50: 90220925 lbu r2,0x0925(r1) |Current Status 2 Dynamic pointer to this Unit Battle Data 0x59 00197d54: 00000000 nop | 00197d58: 30420010 andi r2,r2,0x0010 | 00197d5c: 14400006 bne r2,r0,0x00197d78 #If Unit is NOT confused 00197d60: 00000000 nop | 00197d64: 90620004 lbu r2,0x0004(r3) |AI Decision Byte 0x04 Dynamic pointer to Unit AI 0x182c + 0x04 00197d68: 00000000 nop | 00197d6c: 30420080 andi r2,r2,0x0080 | 00197d70: 10400033 beq r2,r0,0x00197e40 #If Unit is NOT Worth to be considered branch to Next Unit 00197d74: 00000000 nop | Else : Unit Confused or Worth to be considered 00197d78: 91820e2e lbu r2,0x0e2e(r12) |Acting Unit's ID 00197d7c: 00000000 nop | 00197d80: 14e20004 bne r7,r2,0x00197d94 #If This Unit is Acting Unit 00197d84: 34020002 ori r2,r0,0x0002 |r2 = (0x2) 00197d88: 340200ff ori r2,r0,0x00ff | 00197d8c: 10a2002c beq r5,r2,0x00197e40 #If Preset Value 2 = 0xff Ignore Acting Unit 00197d90: 34020002 ori r2,r0,0x0002 |r2 = (0x2) 2 00197d94: 10820015 beq r4,r2,0x00197dec #if Preset Value 1 = 0x02 go to Allies only section 00197d98: 28820003 slti r2,r4,0x0003 |1 if preset value < 0x3 00197d9c: 10400005 beq r2,r0,0x00197db4 #if Preset Value 1< 0x02 00197da0: 00000000 nop | 00197da4: 108d000e beq r4,r13,0x00197de0 #if Preset Value = 0x1 go to Enemies only section 00197da8: 00000000 nop | 00197dac: 08065f8f j 0x00197e3c >>Directly Enable 0xc78 flag if preset Value = 0x00 and go to Increase Target counter 00197db0: a12d0c78 sb r13,0x0c78(r9) |Enable This Unit flag inAI 0xc78 Table 00197db4: 34020003 ori r2,r0,0x0003 |r2 = (0x3) 3 00197db8: 10820005 beq r4,r2,0x00197dd0 #If preset Value 1 = 0x03 go to specific unit section 00197dbc: 34020004 ori r2,r0,0x0004 |r2 = (0x4) 4 00197dc0: 10820010 beq r4,r2,0x00197e04 #If preset Value 1 = 0x04 Go to status section 00197dc4: 3c020001 lui r2,0x0001 | 00197dc8: 08065f8f j 0x00197e3c >>Else : PV > 0x04 Increase Target counter 00197dcc: a12d0c78 sb r13,0x0c78(r9) |Enable This Unit flag inAI 0xc78 Table Preset Value 1 = 0x03 -Find one specific Unit (ID = r5) 00197dd0: 14e5001b bne r7,r5,0x00197e40 #If Preset Value 2 <> Unit Counter : Ignore This Unit 00197dd4: 00000000 nop | 00197dd8: 08065f8f j 0x00197e3c >>Else : Enable Flag and Count this unit 00197ddc: a12d0c78 sb r13,0x0c78(r9) |Enable This Unit flag inAI 0xc78 Table Preset Value 1 = 0x01 - Seek enemies only 00197de0: 90620008 lbu r2,0x0008(r3) |Load Enemy Flag Dynamic pointer to Unit AI 0x182c + 0x08 00197de4: 08065f8c j 0x00197e30 >>Jump and : Count only Enemies 00197de8: 00000000 nop | Preset Value 1 = 0x02 - Seek Allies only 00197dec: 90620008 lbu r2,0x0008(r3) |Load Enemy Flag Dynamic pointer to Unit AI 0x182c + 0x08 00197df0: 00000000 nop | 00197df4: 14400012 bne r2,r0,0x00197e40 #If Unit in an Enemy Ignore This Unit 00197df8: 00000000 nop | 00197dfc: 08065f8f j 0x00197e3c >>Else : if Unit is an Ally Count this unit 00197e00: a12d0c78 sb r13,0x0c78(r9) |Enable This Unit flag inAI 0xc78 Table Preset Value 1 = 0x04 - seek Unit with death, petrify, critical or death sentence 00197e04: 3c038019 lui r3,0x8019 | 00197e08: 246308cc addiu r3,r3,0x08cc | 00197e0c: 01033021 addu r6,r8,r3 |This Unit Battle data pointer 00197e10: 8cc30058 lw r3,0x0058(r6) |Load Current Statuses 1-4 00197e14: 34428020 ori r2,r2,0x8020 |r2 = 00018020 00197e18: 00621824 and r3,r3,r2 | 00197e1c: 14600006 bne r3,r0,0x00197e38 #If Unit is Critical, Petrifed or Dead Count this unit 00197e20: 00000000 nop | 00197e24: 90c2005c lbu r2,0x005c(r6) |Load Current Statuses 5 00197e28: 00000000 nop | 00197e2c: 30420001 andi r2,r2,0x0001 | 00197e30: 10400003 beq r2,r0,0x00197e40 #If This Unit has not Death Sentence Ignore This Unit 00197e34: 00000000 nop | Preset Value 1 = 0x00 - Any Units 00197e38: a12d0c78 sb r13,0x0c78(r9) |Enable This Unit flag inAI 0xc78 Table Add Unit to Targeted Unit counter 00197e3c: 340b0001 ori r11,r0,0x0001 |Considered Units Counter + 1 00197e40: 25290001 addiu r9,r9,0x0001 |Offset for AI Table 0xc78 00197e44: 250801c0 addiu r8,r8,0x01c0 |Battle Data Offset (+0x1c0 each iteration) 00197e48: 24e70001 addiu r7,r7,0x0001 |Unit Counter + 1 00197e4c: 28e20015 slti r2,r7,0x0015 | 00197e50: 1440ffb6 bne r2,r0,0x00197d2c Λ Do for all units 00197e54: 254a0010 addiu r10,r10,0x0010 |AI Decision Offset (+0x10 each iteration) For data at 8019f3c4 + 0x182c 00197e58: 03e00008 jr r31 >>Jump to Address 00197e5c: 01601021 addu r2,r11,r0 |r2 = # of units considered
Return locations
BATTLE.BIN 00196248: Non-Specific AI AutoBattle (Enemies) r4 = 0x00 / r5 = 0x00 00197350: Set_chosen_ability/target_for_AI_status r4 = 0x00 / r5 = 0xff (Confuse section) 00198238: Fight_for_Life_-_Auto_Battle_(00197ff4) r4 = 0x03 / r5 = Unit ID 00198278: Fight_for_Life_-_Auto_Battle_(00197ff4) r4 = 0x00 / r5 = 0x00 00198740: Protect_Allies_-_Auto_Battle_(001984ec) r4 = 0x03 / r5 = Unit ID 00198780: Protect_Allies_-_Auto_Battle_(001984ec) r4 = 0x01 / r5 = 0x00 001987b8: Protect_Allies_-_Auto_Battle_(001984ec) r4 = 0x02 / r5 = 0x00 00198900: Evaluate_Cancel_Status_Ability_(0019881c) r4 = 0x03 / r5 = Unit ID 00198f18: AI_Critical_or_Run_Like_Rabbit r4 = 0x03 / r5 = Acting Unit ID 00198ff0: AI_Critical_or_Run_Like_Rabbit r4 = 0x00 / r5 = 0xff