Set type of target for all targets

From Final Fantasy Hacktics Wiki
Revision as of 18:27, 6 July 2020 by Dokurider (talk | contribs) (Correction the notes around setting Critical HP Flag)
Jump to navigation Jump to search
00194314: 3c02801a lui r2,0x801a
00194318: 90420d7b lbu r2,0x0d7b(r2)		Load ?
0019431c: 27bdffd8 addiu r29,r29,0xffd8
00194320: afb3001c sw r19,0x001c(r29)
00194324: 3c13801a lui r19,0x801a
00194328: 2673f3c4 addiu r19,r19,0xf3c4		r19 = AI Data Pointer
0019432c: afbf0024 sw r31,0x0024(r29)
00194330: afb40020 sw r20,0x0020(r29)
00194334: afb20018 sw r18,0x0018(r29)
00194338: afb10014 sw r17,0x0014(r29)
0019433c: 14400077 bne r2,r0,0x0019451c		Branch if ? != 0
00194340: afb00010 sw r16,0x0010(r29)
00194344: 00009021 addu r18,r0,r0		Unit Counter = 0
00194348: 0000a021 addu r20,r0,r0		Pointer Mod = 0
0019434c: 3c028019 lui r2,0x8019
00194350: 244208cc addiu r2,r2,0x08cc
00194354: 02828821 addu r17,r20,r2		r17 = Unit's Data Pointer
00194358: 00121100 sll r2,r18,0x04		UC * 16
0019435c: 2442182c addiu r2,r2,0x182c
00194360: 02628021 addu r16,r19,r2		r16 = AI Decision Data Pointer
00194364: 0c065b3a jal 0x00196ce8		Check if Unit can be Targeted (Cryst/Trea/Mount/Trans)
00194368: 02402021 addu r4,r18,r0		r4 = Unit Counter
0019436c: 10400006 beq r2,r0,0x00194388		Branch if Unit can be targeted
00194370: 00000000 nop
00194374: 92020007 lbu r2,0x0007(r16)		Load AI Targeting Flags
00194378: 00000000 nop
0019437c: 34420010 ori r2,r2,0x0010		Enable Can't Be Targeted?
00194380: 0806513c j 0x001944f0
00194384: a2020007 sb r2,0x0007(r16)		Store AI Targeting Flags
00194388: 92620e2e lbu r2,0x0e2e(r19)		Load Acting Unit's ID
0019438c: 00000000 nop
00194390: 12420008 beq r18,r2,0x001943b4	Branch if Unit Counter = Acting Unit
00194394: 00000000 nop
00194398: 922201ba lbu r2,0x01ba(r17)		Load Unit's Modified ENTD Flags
0019439c: 92630e39 lbu r3,0x0e39(r19)		Load Acting Unit's Team
001943a0: 30420030 andi r2,r2,0x0030
001943a4: 10430003 beq r2,r3,0x001943b4		Branch if Unit's Team = Acting Unit's Team
001943a8: 34020001 ori r2,r0,0x0001		r2 = 1
001943ac: 080650ee j 0x001943b8
001943b0: a2020008 sb r2,0x0008(r16)		Store Enemy Flag = True
001943b4: a2000008 sb r0,0x0008(r16)		Store Enemy Flag = False
001943b8: 92020007 lbu r2,0x0007(r16)		Load AI Targeting Flags
001943bc: 00000000 nop
001943c0: 3043000c andi r3,r2,0x000c
001943c4: a2030007 sb r3,0x0007(r16)		Store Flags with only ?/Save CTProtect Self? enabled
001943c8: 92220058 lbu r2,0x0058(r17)		Load Unit's Current Statuses 1
001943cc: 00000000 nop
001943d0: 30420020 andi r2,r2,0x0020
001943d4: 10400008 beq r2,r0,0x001943f8		Branch if Unit isn't Dead
001943d8: 00000000 nop
001943dc: 9222005a lbu r2,0x005a(r17)		Load Unit's Current Statuses 3
001943e0: 00000000 nop
001943e4: 30420020 andi r2,r2,0x0020
001943e8: 14400002 bne r2,r0,0x001943f4		Branch if Unit has Reraise
001943ec: 34620040 ori r2,r3,0x0040		Enable Dead Unit with Reraise
001943f0: 34620020 ori r2,r3,0x0020		Enable Dead Unit without Reraise
001943f4: a2020007 sb r2,0x0007(r16)		Store new AI Targeting Flags
001943f8: 9622002a lhu r2,0x002a(r17)		Load Max HP
001943fc: 96230028 lhu r3,0x0028(r17)		Load Current HP
00194400: 00021042 srl r2,r2,0x01		Max HP / 2
00194404: 0062182b sltu r3,r3,r2
00194408: 10600005 beq r3,r0,0x00194420		Branch if Current HP >= Max HP / 2
0019440c: 00000000 nop
00194410: 92020007 lbu r2,0x0007(r16)		Load AI Targeting Flags
00194414: 00000000 nop
00194418: 34420001 ori r2,r2,0x0001		Enable Low HP Unit
0019441c: a2020007 sb r2,0x0007(r16)		Store new AI Targeting Flags
00194420: 9202000b lbu r2,0x000b(r16)		Load MP Using Ability Mod
00194424: 00000000 nop
00194428: 10400019 beq r2,r0,0x00194490		Branch if no MP abilities are available
0019442c: 00000000 nop
00194430: 9622002e lhu r2,0x002e(r17)		Load Max MP
00194434: 9623002c lhu r3,0x002c(r17)		Load Current MP
00194438: 00021042 srl r2,r2,0x01		Max MP / 2
0019443c: 0062182b sltu r3,r3,r2
00194440: 10600005 beq r3,r0,0x00194458		Branch if Current MP >= Max MP / 2
00194444: 00000000 nop
00194448: 92020007 lbu r2,0x0007(r16)		Load AI Targeting Flags
0019444c: 00000000 nop
00194450: 34420002 ori r2,r2,0x0002		Enable Low MP Unit
00194454: a2020007 sb r2,0x0007(r16)		Store new AI Targeting Flags
00194458: 92620e39 lbu r2,0x0e39(r19)		Load Acting Unit's Team
0019445c: 00000000 nop
00194460: 1040000b beq r2,r0,0x00194490		Branch if Team = Blue
00194464: 00000000 nop
00194468: 9622002c lhu r2,0x002c(r17)		Load Unit's Current MP
0019446c: 92030009 lbu r3,0x0009(r16)		Load Highest MP Cost
00194470: 00000000 nop
00194474: 0043102b sltu r2,r2,r3
00194478: 10400005 beq r2,r0,0x00194490		Branch if Current MP >= Highest MP Cost
0019447c: 00000000 nop
00194480: 92020007 lbu r2,0x0007(r16)		Load AI Targeting Flags
00194484: 00000000 nop
00194488: 34420002 ori r2,r2,0x0002		Enable Low MP Unit
0019448c: a2020007 sb r2,0x0007(r16)		Store new AI Targeting Flags
00194490: 92020007 lbu r2,0x0007(r16)		Load AI Targeting Flags
00194494: 00000000 nop
00194498: 3045007f andi r5,r2,0x007f		Disable 0x80 (already done above with AND 0x0c)
0019449c: a2050007 sb r5,0x0007(r16)		Store new AI Targeting Flags
001944a0: 96230028 lhu r3,0x0028(r17)		Load Unit's Current HP
001944a4: 9624002a lhu r4,0x002a(r17)		Load Unit's Max HP
001944a8: 00031880 sll r3,r3,0x02		CHP * 4
001944ac: 00041080 sll r2,r4,0x02		MHP * 4
001944b0: 00441023 subu r2,r2,r4		MHP * 4 - MHP = MHP * 3
001944b4: 0062182a slt r3,r3,r2                CHP*4 < MHP * 3
001944b8: 10600002 beq r3,r0,0x001944c4		Branch if CHP >= 25% MHP
001944bc: 34a20080 ori r2,r5,0x0080		Enable Critical HP Unit
001944c0: a2020007 sb r2,0x0007(r16)		Store new AI Targeting Flags
001944c4: 92020004 lbu r2,0x0004(r16)		Load ?
001944c8: 92030008 lbu r3,0x0008(r16)		Load Enemy Flag
001944cc: 3044007f andi r4,r2,0x007f		Disable Charging/Performing
001944d0: 10600005 beq r3,r0,0x001944e8		Branch if Unit is an Ally
001944d4: a2040004 sb r4,0x0004(r16)		Store new ?
001944d8: 9223015d lbu r3,0x015d(r17)		Load Current Ability CT
001944dc: 340200ff ori r2,r0,0x00ff		r2 = FF
001944e0: 10620003 beq r3,r2,0x001944f0		Branch if Unit doesn't have a charging ability
001944e4: 00000000 nop
001944e8: 34820080 ori r2,r4,0x0080		Enable Charging/Performing
001944ec: a2020004 sb r2,0x0004(r16)		Store new ?
001944f0: 26520001 addiu r18,r18,0x0001		Unit Counter ++
001944f4: 2a420015 slti r2,r18,0x0015
001944f8: 1440ff94 bne r2,r0,0x0019434c		Branch if Unit Counter < 0x15
001944fc: 269401c0 addiu r20,r20,0x01c0		Pointer Mod += 0x1c0
00194500: 34020001 ori r2,r0,0x0001		r2 = 1
00194504: a2620014 sb r2,0x0014(r19)		Store ? = 1
00194508: 8e620cb4 lw r2,0x0cb4(r19)		Load ?
0019450c: 3c030100 lui r3,0x0100
00194510: a260001d sb r0,0x001d(r19)		Store Skillset = 0
00194514: 00431025 or r2,r2,r3			Enable 0x01000000
00194518: ae620cb4 sw r2,0x0cb4(r19)		Store new ?
0019451c: 0c0674df jal 0x0019d37c
00194520: 00000000 nop
00194524: 2403ffff addiu r3,r0,0xffff
00194528: 10430007 beq r2,r3,0x00194548
0019452c: 3c04feff lui r4,0xfeff
00194530: 3484ffff ori r4,r4,0xffff
00194534: 8e630cb4 lw r3,0x0cb4(r19)
00194538: 00001021 addu r2,r0,r0
0019453c: 00641824 and r3,r3,r4
00194540: 08065153 j 0x0019454c
00194544: ae630cb4 sw r3,0x0cb4(r19)
00194548: 2402ffff addiu r2,r0,0xffff
0019454c: 8fbf0024 lw r31,0x0024(r29)
00194550: 8fb40020 lw r20,0x0020(r29)
00194554: 8fb3001c lw r19,0x001c(r29)
00194558: 8fb20018 lw r18,0x0018(r29)
0019455c: 8fb10014 lw r17,0x0014(r29)
00194560: 8fb00010 lw r16,0x0010(r29)
00194564: 27bd0028 addiu r29,r29,0x0028
00194568: 03e00008 jr r31
0019456c: 00000000 nop