Difference between revisions of "Units action parameter checking"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with " 00194e58: 27bdff70 addiu r29,r29,0xff70 00194e5c: 340800ff ori r8,r0,0x00ff 00194e60: 340700ff ori r7,r0,0x00ff 00194e64: afb60080 sw r22,0x0080(r29) 00194e68: 3c16801a l...")
 
m (duplicated page)
 
Line 1: Line 1:
 +
DUPLICATED PAGE [[Set_AI_ability_considerations_for_all_units_and_self]]
 +
 
  00194e58: 27bdff70 addiu r29,r29,0xff70
 
  00194e58: 27bdff70 addiu r29,r29,0xff70
 
  00194e5c: 340800ff ori r8,r0,0x00ff
 
  00194e5c: 340800ff ori r8,r0,0x00ff

Latest revision as of 20:16, 16 April 2023

DUPLICATED PAGE Set_AI_ability_considerations_for_all_units_and_self
00194e58: 27bdff70 addiu r29,r29,0xff70
00194e5c: 340800ff ori r8,r0,0x00ff
00194e60: 340700ff ori r7,r0,0x00ff
00194e64: afb60080 sw r22,0x0080(r29)
00194e68: 3c16801a lui r22,0x801a
00194e6c: 26d6f3c4 addiu r22,r22,0xf3c4
00194e70: afb70084 sw r23,0x0084(r29)
00194e74: 0000b821 addu r23,r0,r0
00194e78: afbf008c sw r31,0x008c(r29)
00194e7c: afbe0088 sw r30,0x0088(r29)
00194e80: afb5007c sw r21,0x007c(r29)
00194e84: afb40078 sw r20,0x0078(r29)
00194e88: afb30074 sw r19,0x0074(r29)
00194e8c: afb20070 sw r18,0x0070(r29)
00194e90: afb1006c sw r17,0x006c(r29)
00194e94: afb00068 sw r16,0x0068(r29)
00194e98: afa40010 sw r4,0x0010(r29)
00194e9c: afa00020 sw r0,0x0020(r29)
00194ea0: afa00028 sw r0,0x0028(r29)
00194ea4: afa00030 sw r0,0x0030(r29)
00194ea8: afa00038 sw r0,0x0038(r29)
00194eac: afa00040 sw r0,0x0040(r29)
00194eb0: afa80058 sw r8,0x0058(r29)
00194eb4: afa70060 sw r7,0x0060(r29)
00194eb8: 0c065b23 jal 0x 00196c8c			check targetability (returns 1 if untargetable)
00194ebc: 02e02021 addu r4,r23,r0
00194ec0: 14400142 bne r2,r0,0x 001953cc		branch if not targetable
00194ec4: 00171100 sll r2,r23,0x04
00194ec8: 2442182c addiu r2,r2,0x182c
00194ecc: 3c08801a lui r8,0x801a
00194ed0: 2508f3c4 addiu r8,r8,0xf3c4
00194ed4: 0102a821 addu r21,r8,r2			r21 = AI decision data
00194ed8: 001710c0 sll r2,r23,0x03			
00194edc: 00571023 subu r2,r2,r23
00194ee0: 00021180 sll r2,r2,0x06
00194ee4: 3c038019 lui r3,0x8019
00194ee8: 246308cc addiu r3,r3,0x08cc		
00194eec: 3c04801a lui r4,0x801a
00194ef0: 908401f2 lbu r4,0x01f2(r4)		load acting units ID
00194ef4: 0043a021 addu r20,r2,r3			r20 = unit data
00194ef8: afa00048 sw r0,0x0048(r29)
00194efc: 16e40003 bne r23,r4,0x 00194f0c	branch if considered unit isn't self
00194f00: afa00050 sw r0,0x0050(r29)
00194f04: 080653c6 j 0x 00194f18
00194f08: afa00018 sw r0,0x0018(r29)
00194f0c: 0c0666e6 jal 0x 00199b98			calculate clockticks till unit acts
00194f10: 02802021 addu r4,r20,r0
00194f14: afa20018 sw r2,0x0018(r29)
00194f18: 92a20006 lbu r2,0x0006(r21)		load charging flag?
00194f1c: 0000f021 addu r30,r0,r0
00194f20: 304200fc andi r2,r2,0x00fc		remove 0x03 flags
00194f24: a2a20006 sb r2,0x0006(r21)		store new
00194f28: 3c07801a lui r7,0x801a
00194f2c: 24e7f3c4 addiu r7,r7,0xf3c4
00194f30: 00f71021 addu r2,r7,r23			
00194f34: 9043198c lbu r3,0x198c(r2)		load considered targets battle ID
00194f38: 00000000 nop
00194f3c: 00031100 sll r2,r3,0x04			ID*16
00194f40: 00431021 addu r2,r2,r3			ID*17
00194f44: 000210c0 sll r2,r2,0x03			ID*136
00194f48: 24420ef0 addiu r2,r2,0x0ef0		ID*136 + 0xef0 (0xf78)
00194f4c: 00e21021 addu r2,r7,r2			result + AI data (2nd units move list)
00194f50: 001e1880 sll r3,r30,0x02			counter*2
00194f54: 00439821 addu r19,r2,r3			r19 = move list + counter*2
00194f58: 96620002 lhu r2,0x0002(r19)		
00194f5c: 00000000 nop
00194f60: 30427fff andi r2,r2,0x7fff
00194f64: a6620002 sh r2,0x0002(r19)
00194f68: 92630002 lbu r3,0x0002(r19)
00194f6c: 340200ff ori r2,r0,0x00ff
00194f70: 106200f3 beq r3,r2,0x 00195340
00194f74: 00000000 nop
00194f78: 0c06561e jal 0x 00195878			AI ability data setting
00194f7c: 02602021 addu r4,r19,r0
00194f80: 92c30001 lbu r3,0x0001(r22)		load CT of ability
00194f84: 9282005a lbu r2,0x005a(r20)
00194f88: 8fa80018 lw r8,0x0018(r29)		load clockticks till unit acts
00194f8c: 86d00002 lh r16,0x0002(r22)		load ability ID
00194f90: 30420002 andi r2,r2,0x0002
00194f94: 10400008 beq r2,r0,0x 00194fb8		branch if not frog
00194f98: 01038821 addu r17,r8,r3			r17 = CT + clockticks till unit acts
00194f9c: 3402001d ori r2,r0,0x001d
00194fa0: 12020008 beq r16,r2,0x 00194fc4	branch if frog spell
00194fa4: 3402016f ori r2,r0,0x016f
00194fa8: 12020006 beq r16,r2,0x 00194fc4	branch if frog attack
00194fac: 00000000 nop
00194fb0: 080654cd j 0x 00195334
00194fb4: 27de0001 addiu r30,r30,0x0001		move counter++
00194fb8: 3402016f ori r2,r0,0x016f
00194fbc: 120200dc beq r16,r2,0x 00195330	branch if frog attack
00194fc0: 00000000 nop
00194fc4: 8fa40018 lw r4,0x0018(r29)		load clockticks till unit acts
00194fc8: 02802821 addu r5,r20,r0			r5 = unit data?
00194fcc: 0c067bc9 jal 0x 0019ef24			check if status should/can be applied
00194fd0: 34060025 ori r6,r0,0x0025
00194fd4: 144000d6 bne r2,r0,0x 00195330		branch if ??
00194fd8: 00000000 nop
00194fdc: 96c2000c lhu r2,0x000c(r22)		load AI behavior flags 1 and 2
00194fe0: 00000000 nop
00194fe4: 30420100 andi r2,r2,0x0100		
00194fe8: 10400006 beq r2,r0,0x 00195004		branch if not follow target
00194fec: 02202021 addu r4,r17,r0			r4 = ability CT + clockticks till unit acts
00194ff0: 02802821 addu r5,r20,r0			r5 = unit data?
00194ff4: 0c067bc9 jal 0x 0019ef24			check if status should/can be applied
00194ff8: 3406000c ori r6,r0,0x000c
00194ffc: 144000cc bne r2,r0,0x 00195330
00195000: 00000000 nop
00195004: 96c2000c lhu r2,0x000c(r22)		load AI behavior flags
00195008: 00000000 nop
0019500c: 30420400 andi r2,r2,0x0400
00195010: 10400006 beq r2,r0,0x 0019502c		branch if no faith calculation
00195014: 02202021 addu r4,r17,r0
00195018: 02802821 addu r5,r20,r0
0019501c: 0c067bc9 jal 0x 0019ef24			check if status should/can be applied
00195020: 34060021 ori r6,r0,0x0021
00195024: 144000c2 bne r2,r0,0x 00195330
00195028: 00000000 nop
0019502c: 92c30011 lbu r3,0x0011(r22)		load MP cost
00195030: 9682002c lhu r2,0x002c(r20)		load MP
00195034: 00000000 nop
00195038: 0043102b sltu r2,r2,r3
0019503c: 144000bc bne r2,r0,0x 00195330		branch if not enough MP
00195040: 00000000 nop
00195044: 92620002 lbu r2,0x0002(r19)		load ability's skillset
00195048: 3c018006 lui r1,0x8006
0019504c: 00220821 addu r1,r1,r2
00195050: 90235cb4 lbu r3,0x5cb4(r1)			load action menu byte
00195054: 34020001 ori r2,r0,0x0001
00195058: 10620007 beq r3,r2,0x 00195078			branch if Item
0019505c: 34020007 ori r2,r0,0x0007
00195060: 10620005 beq r3,r2,0x 00195078			branch if katana inventory
00195064: 3402017e ori r2,r0,0x017e
00195068: 12020003 beq r16,r2,0x 00195078		branch if ability = throw knife?
0019506c: 34020189 ori r2,r0,0x0189
00195070: 1602001e bne r16,r2,0x 001950ec		branch if ability != Ball
00195074: 34020002 ori r2,r0,0x0002
00195078: 928201ba lbu r2,0x01ba(r20)			load modified ENTD
0019507c: 00000000 nop
00195080: 30420030 andi r2,r2,0x0030
00195084: 1440000a bne r2,r0,0x 001950b0			other team check
00195088: 00000000 nop
0019508c: 92c20006 lbu r2,0x0006(r22)			load item considered
00195090: 3c018006 lui r1,0x8006
00195094: 00220821 addu r1,r1,r2
00195098: 902296e0 lbu r2,-0x6920(r1)			load item quantity
0019509c: 00000000 nop
001950a0: 14400052 bne r2,r0,0x 001951ec			branch if quantity exists
001950a4: 00000000 nop
001950a8: 080654cd j 0x 00195334					jump to end, counter++
001950ac: 27de0001 addiu r30,r30,0x0001			
001950b0: 92c30006 lbu r3,0x0006(r22)			load considered item
001950b4: 00000000 nop
001950b8: 00031040 sll r2,r3,0x01				item*2
001950bc: 00431021 addu r2,r2,r3				item*3
001950c0: 00021080 sll r2,r2,0x02				item*12
001950c4: 3c018006 lui r1,0x8006
001950c8: 00220821 addu r1,r1,r2
001950cc: 90232eba lbu r3,0x2eba(r1)			load item required level
001950d0: 92820022 lbu r2,0x0022(r20)			load level
001950d4: 00000000 nop
001950d8: 0043102b sltu r2,r2,r3
001950dc: 10400043 beq r2,r0,0x 001951ec			branch if level is ok
001950e0: 00000000 nop
001950e4: 080654cd j 0x 00195334
001950e8: 27de0001 addiu r30,r30,0x0001

AI throw determinations

001950ec: 1462003f bne r3,r2,0x 001951ec			branch if not Throw
001950f0: 00000000 nop
001950f4: 3c02801a lui r2,0x801a
001950f8: 904201f2 lbu r2,0x01f2(r2)			load acting unit ID
001950fc: 00000000 nop
00195100: 16e2008b bne r23,r2,0x 00195330		branch if considered unit isn't self
00195104: 2411ffff addiu r17,r0,0xffff
00195108: 3410017f ori r16,r0,0x017f			default?
0019510c: 34120001 ori r18,r0,0x0001			default?
00195110: 02e02021 addu r4,r23,r0
00195114: 92c50000 lbu r5,0x0000(r22)			load skillset
00195118: 0c066a94 jal 0x 0019aa50				load known ability flag
0019511c: 2606fe83 addiu r6,r16,0xfe83
00195120: 1040002b beq r2,r0,0x 001951d0			branch if ability not known
00195124: 00000000 nop
00195128: 3c018006 lui r1,0x8006
0019512c: 00320821 addu r1,r1,r18
00195130: 90261020 lbu r6,0x1020(r1)			load throw ability item type
00195134: 00002021 addu r4,r0,r0
00195138: 00002821 addu r5,r0,r0
0019513c: 3c018006 lui r1,0x8006
00195140: 00250821 addu r1,r1,r5
00195144: 90222ebd lbu r2,0x2ebd(r1)			load item type
00195148: 00000000 nop
0019514c: 1446001c bne r2,r6,0x 001951c0
00195150: 00000000 nop
00195154: 3c018006 lui r1,0x8006
00195158: 00250821 addu r1,r1,r5
0019515c: 90232eba lbu r3,0x2eba(r1)			load required level
00195160: 00000000 nop
00195164: 0071102a slt r2,r3,r17
00195168: 14400015 bne r2,r0,0x 001951c0
0019516c: 00000000 nop
00195170: 928201ba lbu r2,0x01ba(r20)
00195174: 00000000 nop
00195178: 30420030 andi r2,r2,0x0030
0019517c: 14400006 bne r2,r0,0x 00195198			other team check
00195180: 00000000 nop
00195184: 3c018006 lui r1,0x8006
00195188: 00240821 addu r1,r1,r4
0019518c: 902296e0 lbu r2,-0x6920(r1)			load quantity
00195190: 08065469 j 0x 001951a4
00195194: 2c420005 sltiu r2,r2,0x0005			set if quantity is less than 05
00195198: 92820022 lbu r2,0x0022(r20)			load level
0019519c: 00000000 nop
001951a0: 0043102a slt r2,r2,r3
001951a4: 14400006 bne r2,r0,0x 001951c0
001951a8: 00000000 nop
001951ac: 00608821 addu r17,r3,r0
001951b0: 3c01801a lui r1,0x801a
001951b4: a43001d8 sh r16,0x01d8(r1)			store chosen ability ID
001951b8: 3c01801a lui r1,0x801a
001951bc: a02401da sb r4,0x01da(r1)				store chosen weapon ID
001951c0: 24840001 addiu r4,r4,0x0001
001951c4: 28820100 slti r2,r4,0x0100
001951c8: 1440ffdc bne r2,r0,0x 0019513c
001951cc: 24a5000c addiu r5,r5,0x000c
001951d0: 26100001 addiu r16,r16,0x0001
001951d4: 2a020189 slti r2,r16,0x0189
001951d8: 1440ffcd bne r2,r0,0x 00195110
001951dc: 26520001 addiu r18,r18,0x0001
001951e0: 2402ffff addiu r2,r0,0xffff
001951e4: 12220052 beq r17,r2,0x 00195330
001951e8: 00000000 nop
001951ec: 96620002 lhu r2,0x0002(r19)			load skillset and usage type
001951f0: 00000000 nop
001951f4: 34428000 ori r2,r2,0x8000				add flag
001951f8: a6620002 sh r2,0x0002(r19)			store new flags
001951fc: 30420800 andi r2,r2,0x0800
00195200: 1440004b bne r2,r0,0x 00195330			branch if requires monster skill
00195204: 00000000 nop
00195208: 92a20008 lbu r2,0x0008(r21)			load enemy flag
0019520c: 00000000 nop
00195210: 10400026 beq r2,r0,0x 001952ac			branch if same team
00195214: 00000000 nop
00195218: 96c4000c lhu r4,0x000c(r22)			load ai behavior
0019521c: 00000000 nop
00195220: 30820002 andi r2,r4,0x0002
00195224: 10400021 beq r2,r0,0x 001952ac			branch if not target enemies
00195228: 00000000 nop
0019522c: 8fa70020 lw r7,0x0020(r29)			????
00195230: 96c3000e lhu r3,0x000e(r22)			
00195234: 24e70001 addiu r7,r7,0x0001			????++
00195238: 30620002 andi r2,r3,0x0002
0019523c: 10400005 beq r2,r0,0x 00195254			branch if not magic attack
00195240: afa70020 sw r7,0x0020(r29)
00195244: 8fa80028 lw r8,0x0028(r29)			????
00195248: 00000000 nop
0019524c: 25080001 addiu r8,r8,0x0001
00195250: afa80028 sw r8,0x0028(r29)			???++
00195254: 30620001 andi r2,r3,0x0001
00195258: 10400005 beq r2,r0,0x 00195270			branch if not physical attack
0019525c: 30824000 andi r2,r4,0x4000			r2 = reflectable check
00195260: 8fa70030 lw r7,0x0030(r29)
00195264: 00000000 nop
00195268: 24e70001 addiu r7,r7,0x0001
0019526c: afa70030 sw r7,0x0030(r29)			???++
00195270: 10400005 beq r2,r0,0x 00195288			branch if not reflectable
00195274: 00000000 nop
00195278: 8fa80038 lw r8,0x0038(r29)
0019527c: 00000000 nop
00195280: 25080001 addiu r8,r8,0x0001
00195284: afa80038 sw r8,0x0038(r29)			???++
00195288: 92c20010 lbu r2,0x0010(r22)			load elements
0019528c: 00000000 nop
00195290: 30420008 andi r2,r2,0x0008
00195294: 10400005 beq r2,r0,0x 001952ac			branch if not Earth element?
00195298: 00000000 nop
0019529c: 8fa70040 lw r7,0x0040(r29)
001952a0: 00000000 nop
001952a4: 24e70001 addiu r7,r7,0x0001
001952a8: afa70040 sw r7,0x0040(r29)			??++
001952ac: 96c2000c lhu r2,0x000c(r22)			load AI behavior
001952b0: 34030081 ori r3,r0,0x0081
001952b4: 30420081 andi r2,r2,0x0081
001952b8: 14430005 bne r2,r3,0x 001952d0			branch if not HP recovery on allies
001952bc: 00000000 nop
001952c0: 92a20006 lbu r2,0x0006(r21)
001952c4: 00000000 nop
001952c8: 34420002 ori r2,r2,0x0002
001952cc: a2a20006 sb r2,0x0006(r21)			store HP recovery on ally flag
001952d0: 96c2000e lhu r2,0x000e(r22)
001952d4: 00000000 nop
001952d8: 304200c0 andi r2,r2,0x00c0
001952dc: 10400005 beq r2,r0,0x 001952f4			branch if not direct or Arc attack
001952e0: 00000000 nop
001952e4: 92a20006 lbu r2,0x0006(r21)
001952e8: 00000000 nop
001952ec: 34420001 ori r2,r2,0x0001
001952f0: a2a20006 sb r2,0x0006(r21)
001952f4: 96c3000c lhu r3,0x000c(r22)			
001952f8: 00000000 nop
001952fc: 30620002 andi r2,r3,0x0002
00195300: 10400005 beq r2,r0,0x 00195318			branch if not target enemies
00195304: 30620001 andi r2,r3,0x0001
00195308: 8fa80048 lw r8,0x0048(r29)
0019530c: 00000000 nop
00195310: 25080001 addiu r8,r8,0x0001
00195314: afa80048 sw r8,0x0048(r29)			??++
00195318: 10400005 beq r2,r0,0x 00195330			branch if not target allies
0019531c: 00000000 nop
00195320: 8fa70050 lw r7,0x0050(r29)
00195324: 00000000 nop
00195328: 24e70001 addiu r7,r7,0x0001
0019532c: afa70050 sw r7,0x0050(r29)
00195330: 27de0001 addiu r30,r30,0x0001			move counter++
00195334: 2bc20022 slti r2,r30,0x0022			
00195338: 1440fefb bne r2,r0,0x 00194f28			branch if < 0x22 moves
0019533c: 00000000 nop
00195340: 92a20008 lbu r2,0x0008(r21)			load enemy flag
00195344: 00000000 nop
00195348: 14400020 bne r2,r0,0x 001953cc			branch if enemy
0019534c: 00000000 nop
00195350: 8fa80050 lw r8,0x0050(r29)			target allies check
00195354: 8fa70048 lw r7,0x0048(r29)			target enemies check
00195358: 00000000 nop
0019535c: 01071821 addu r3,r8,r7
00195360: 14600006 bne r3,r0,0x 0019537c			branch if either target allies or enemies
00195364: 000811c0 sll r2,r8,0x07
00195368: 92a20006 lbu r2,0x0006(r21)			
0019536c: 00000000 nop
00195370: 304200fb andi r2,r2,0x00fb			remove 0x04 flag
00195374: 080654f3 j 0x 001953cc					go to next ability
00195378: a2a20006 sb r2,0x0006(r21)
0019537c: 0043001a div r2,r3
00195380: 00001812 mflo r3
00195384: 00000000 nop
00195388: 2862004d slti r2,r3,0x004d
0019538c: 14400004 bne r2,r0,0x 001953a0
00195390: 00000000 nop
00195394: 92a20006 lbu r2,0x0006(r21)
00195398: 080654eb j 0x 001953ac
0019539c: 34420004 ori r2,r2,0x0004				add 0x04 flag
001953a0: 92a20006 lbu r2,0x0006(r21)
001953a4: 00000000 nop
001953a8: 304200fb andi r2,r2,0x00fb			remove 0x04 flag
001953ac: a2a20006 sb r2,0x0006(r21)
001953b0: 8fa70058 lw r7,0x0058(r29)
001953b4: 00000000 nop
001953b8: 0067102a slt r2,r3,r7
001953bc: 10400003 beq r2,r0,0x 001953cc
001953c0: 00000000 nop
001953c4: afb70060 sw r23,0x0060(r29)			store unit counter
001953c8: afa30058 sw r3,0x0058(r29)
001953cc: 26f70001 addiu r23,r23,0x0001
001953d0: 2ae20015 slti r2,r23,0x0015
001953d4: 1440feb8 bne r2,r0,0x 00194eb8
001953d8: 340200ff ori r2,r0,0x00ff
001953dc: 8fa80060 lw r8,0x0060(r29)			
001953e0: 00000000 nop
001953e4: 11020009 beq r8,r2,0x 0019540c			branch if no target found?
001953e8: 00009021 addu r18,r0,r0
001953ec: 00081900 sll r3,r8,0x04
001953f0: 3c07801a lui r7,0x801a
001953f4: 24e7f3c4 addiu r7,r7,0xf3c4
001953f8: 00e31821 addu r3,r7,r3
001953fc: 90621832 lbu r2,0x1832(r3)
00195400: 00000000 nop
00195404: 304200fb andi r2,r2,0x00fb			remove 0x04 flag
00195408: a0621832 sb r2,0x1832(r3)
0019540c: 0000a021 addu r20,r0,r0
00195410: 3c02dfff lui r2,0xdfff
00195414: 3c15801a lui r21,0x801a
00195418: 8eb501f8 lw r21,0x01f8(r21)			load acting units AI decision
0019541c: 3c03801a lui r3,0x801a
00195420: 8c630078 lw r3,0x0078(r3)				load targeting flags
00195424: 8fa40020 lw r4,0x0020(r29)			load target enemies flag for ability
00195428: 3442ffff ori r2,r2,0xffff				r2 = 0xdfffffff
0019542c: 3c01801a lui r1,0x801a
00195430: a0200082 sb r0,0x0082(r1)
00195434: 00621824 and r3,r3,r2					remove 0x20000000 flag
00195438: 340200ff ori r2,r0,0x00ff
0019543c: 3c01801a lui r1,0x801a
00195440: ac230078 sw r3,0x0078(r1)				store new flags
00195444: a2a2000f sb r2,0x000f(r21)			store 0xff in 0x0f of decision data
00195448: 04810002 bgez r4,0x 00195454
0019544c: a2a2000e sb r2,0x000e(r21)			store 0xff in 0x0e of decision data
00195450: 24840007 addiu r4,r4,0x0007
00195454: 000488c3 sra r17,r4,0x03
00195458: 341e0004 ori r30,r0,0x0004
0019545c: 3c08801a lui r8,0x801a
00195460: 2508f3c4 addiu r8,r8,0xf3c4
00195464: 25020004 addiu r2,r8,0x0004
00195468: a0400e44 sb r0,0x0e44(r2)				clear ??
0019546c: 27deffff addiu r30,r30,0xffff			perform 4 times
00195470: 07c1fffd bgez r30,0x 00195468
00195474: 2442ffff addiu r2,r2,0xffff
00195478: 0000f021 addu r30,r0,r0
0019547c: 3c03801a lui r3,0x801a
00195480: 906301f3 lbu r3,0x01f3(r3)			load acting units battle ID
00195484: 3c07801a lui r7,0x801a
00195488: 24e7f3c4 addiu r7,r7,0xf3c4
0019548c: 00031100 sll r2,r3,0x04
00195490: 00431021 addu r2,r2,r3
00195494: 000210c0 sll r2,r2,0x03
00195498: 24420ef0 addiu r2,r2,0x0ef0			
0019549c: 00e21021 addu r2,r7,r2				r2 = units move list
001954a0: 001e1880 sll r3,r30,0x02
001954a4: 00439821 addu r19,r2,r3
001954a8: 92630002 lbu r3,0x0002(r19)			load skillset
001954ac: 340200ff ori r2,r0,0x00ff
001954b0: 1062009b beq r3,r2,0x 00195720			branch if skillset = 0xff
001954b4: 00000000 nop
001954b8: 0c06561e jal 0x 00195878				AI ability setting
001954bc: 02602021 addu r4,r19,r0
001954c0: 96620002 lhu r2,0x0002(r19)			load skillset/usage type
001954c4: 00000000 nop
001954c8: 30428000 andi r2,r2,0x8000
001954cc: 10400090 beq r2,r0,0x 00195710			branch if 0x8000 not set (disabled?)
001954d0: 00000000 nop
001954d4: 8fa80028 lw r8,0x0028(r29)			magic attack check
001954d8: 00000000 nop
001954dc: 0228102a slt r2,r17,r8
001954e0: 14400003 bne r2,r0,0x 001954f0			branch if not magic attack?
001954e4: 02602021 addu r4,r19,r0
001954e8: 0c0655f0 jal 0x 001957c0				check for some status inflictions?
001954ec: 3405001b ori r5,r0,0x001b
001954f0: 8fa70030 lw r7,0x0030(r29)			
001954f4: 00000000 nop
001954f8: 0227102a slt r2,r17,r7
001954fc: 14400003 bne r2,r0,0x 0019550c			branch if physical attack?
00195500: 02602021 addu r4,r19,r0
00195504: 0c0655f0 jal 0x 001957c0
00195508: 3405001a ori r5,r0,0x001a
0019550c: 8fa80038 lw r8,0x0038(r29)
00195510: 00000000 nop
00195514: 0228102a slt r2,r17,r8
00195518: 14400003 bne r2,r0,0x 00195528			branch if not reflectable?
0019551c: 02602021 addu r4,r19,r0
00195520: 0c0655f0 jal 0x 001957c0
00195524: 34050026 ori r5,r0,0x0026
00195528: 8fa70040 lw r7,0x0040(r29)
0019552c: 00000000 nop
00195530: 1ce00003 bgtz r7,0x 00195540
00195534: 02602021 addu r4,r19,r0
00195538: 0c0655f0 jal 0x 001957c0
0019553c: 34050011 ori r5,r0,0x0011
00195540: 96620002 lhu r2,0x0002(r19)			load skillset/usage type
00195544: 00000000 nop
00195548: 30428000 andi r2,r2,0x8000
0019554c: 10400070 beq r2,r0,0x 00195710			branch if 0x8000 not set
00195550: 00000000 nop
00195554: 96c2000c lhu r2,0x000c(r22)			load AI behavior
00195558: 00000000 nop
0019555c: 30420800 andi r2,r2,0x0800
00195560: 10400002 beq r2,r0,0x 0019556c			branch if not random hits
00195564: 26520001 addiu r18,r18,0x0001
00195568: 26940001 addiu r20,r20,0x0001
0019556c: 86c30002 lh r3,0x0002(r22)			load ability ID
00195570: 3402017b ori r2,r0,0x017b
00195574: 14620007 bne r3,r2,0x 00195594			branch if not 0x17b (holy water)
00195578: 3c032000 lui r3,0x2000
0019557c: 3c02801a lui r2,0x801a
00195580: 8c420078 lw r2,0x0078(r2)				load targetability flags
00195584: 00000000 nop
00195588: 00431025 or r2,r2,r3					set 0x20000000 flag
0019558c: 3c01801a lui r1,0x801a
00195590: ac220078 sw r2,0x0078(r1)
00195594: 96c2000c lhu r2,0x000c(r22)			load AI behavior
00195598: 00000000 nop
0019559c: 30420020 andi r2,r2,0x0020
001955a0: 1040000e beq r2,r0,0x 001955dc			branch if not cancel status
001955a4: 00000000 nop
001955a8: 00008021 addu r16,r0,r0
001955ac: 3c08801a lui r8,0x801a
001955b0: 2508f3c4 addiu r8,r8,0xf3c4
001955b4: 01102021 addu r4,r8,r16
001955b8: 02d01821 addu r3,r22,r16
001955bc: 90820e44 lbu r2,0x0e44(r4)
001955c0: 90630007 lbu r3,0x0007(r3)
001955c4: 26100001 addiu r16,r16,0x0001
001955c8: 00431025 or r2,r2,r3
001955cc: a0820e44 sb r2,0x0e44(r4)
001955d0: 2a020005 slti r2,r16,0x0005
001955d4: 1440fff8 bne r2,r0,0x 001955b8
001955d8: 01102021 addu r4,r8,r16
001955dc: 96c2000c lhu r2,0x000c(r22)			load AI behavior
001955e0: 34030040 ori r3,r0,0x0040
001955e4: 30420042 andi r2,r2,0x0042
001955e8: 14430003 bne r2,r3,0x 001955f8			branch if MP or target enemies
001955ec: 34020001 ori r2,r0,0x0001
001955f0: 3c01801a lui r1,0x801a
001955f4: a0220082 sb r2,0x0082(r1)				store 0x01
001955f8: 92c40004 lbu r4,0x0004(r22)			load range
001955fc: 92c30005 lbu r3,0x0005(r22)			load aoe
00195600: 96c2000c lhu r2,0x000c(r22)			load AI
00195604: 00000000 nop
00195608: 30420002 andi r2,r2,0x0002
0019560c: 10400007 beq r2,r0,0x 0019562c			branch if not target enemies
00195610: 00832021 addu r4,r4,r3				r4 = max range
00195614: 92a2000e lbu r2,0x000e(r21)			load 0x0e of decision data
00195618: 00000000 nop
0019561c: 0082102a slt r2,r4,r2					set if max range < stored max range
00195620: 10400002 beq r2,r0,0x 0019562c			branch if not
00195624: 00000000 nop
00195628: a2a4000e sb r4,0x000e(r21)			store smallest range ability?
0019562c: 96c2000c lhu r2,0x000c(r22)			load ai behavior
00195630: 00000000 nop
00195634: 30420001 andi r2,r2,0x0001
00195638: 10400011 beq r2,r0,0x 00195680			branch if not target allies
0019563c: 00000000 nop
00195640: 92c20000 lbu r2,0x0000(r22)			load skillset
00195644: 3c018006 lui r1,0x8006
00195648: 00220821 addu r1,r1,r2
0019564c: 90235cb4 lbu r3,0x5cb4(r1)			load action menu
00195650: 34020001 ori r2,r0,0x0001
00195654: 14620004 bne r3,r2,0x 00195668			branch if not item
00195658: 24820001 addiu r2,r4,0x0001			r2 = range + 1?
0019565c: 00021fc2 srl r3,r2,0x1f
00195660: 00431021 addu r2,r2,r3
00195664: 00022043 sra r4,r2,0x01
00195668: 92a2000f lbu r2,0x000f(r21)			load max range ability?
0019566c: 00000000 nop
00195670: 0082102a slt r2,r4,r2					set if range < max range
00195674: 10400002 beq r2,r0,0x 00195680			branch if not
00195678: 00000000 nop
0019567c: a2a4000f sb r4,0x000f(r21)			store new max range
00195680: 96630002 lhu r3,0x0002(r19)			load skillset/usage type
00195684: 00000000 nop
00195688: 30620200 andi r2,r3,0x0200
0019568c: 14400017 bne r2,r0,0x 001956ec			branch if 0x0200
00195690: 34620100 ori r2,r3,0x0100				r2 = flags + 0x0100
00195694: 30620400 andi r2,r3,0x0400			
00195698: 14400015 bne r2,r0,0x 001956f0			branch if 0x400 is set
0019569c: 00000000 nop
001956a0: 92c20001 lbu r2,0x0001(r22)			load ability CT
001956a4: 3c03801a lui r3,0x801a
001956a8: 90630213 lbu r3,0x0213(r3)			load remaining clockticks
001956ac: 00000000 nop
001956b0: 0043102b sltu r2,r2,r3				set if ability CT < remaining clockticks
001956b4: 10400007 beq r2,r0,0x 001956d4			branch if not
001956b8: 00000000 nop
001956bc: 3c04801a lui r4,0x801a
001956c0: 908401f2 lbu r4,0x01f2(r4)			load acting units ID
001956c4: 0c067976 jal 0x 0019e5d8				????
001956c8: 34050001 ori r5,r0,0x0001
001956cc: 14400004 bne r2,r0,0x 001956e0			branch if return value != 0
001956d0: 00000000 nop
001956d4: 96620002 lhu r2,0x0002(r19)			load skillset/usage
001956d8: 080655bb j 0x 001956ec
001956dc: 34420100 ori r2,r2,0x0100				set 0x0100 flag
001956e0: 96620002 lhu r2,0x0002(r19)			load usage flags
001956e4: 00000000 nop
001956e8: 3042feff andi r2,r2,0xfeff			remove 0x0100 flag
001956ec: a6620002 sh r2,0x0002(r19)			store new flags
001956f0: 8fa70010 lw r7,0x0010(r29)			load ??
001956f4: 00000000 nop
001956f8: 10e00005 beq r7,r0,0x 00195710
001956fc: 00000000 nop
00195700: 96620002 lhu r2,0x0002(r19)			load usage flags
00195704: 00000000 nop
00195708: 30427fff andi r2,r2,0x7fff			remove 0x8000 flag
0019570c: a6620002 sh r2,0x0002(r19)
00195710: 27de0001 addiu r30,r30,0x0001			move counter++
00195714: 2bc20022 slti r2,r30,0x0022			do for 0x22 moves
00195718: 1440ff58 bne r2,r0,0x 0019547c
0019571c: 00000000 nop
00195720: 92a2000e lbu r2,0x000e(r21)			load lowest range
00195724: 340400ff ori r4,r0,0x00ff
00195728: 10440007 beq r2,r4,0x 00195748			branch if lowest range = 0xff
0019572c: 00000000 nop
00195730: 92a2000e lbu r2,0x000e(r21)			load lowest range
00195734: 3c03801a lui r3,0x801a
00195738: 906301fc lbu r3,0x01fc(r3)			load acting units move
0019573c: 00000000 nop
00195740: 00431021 addu r2,r2,r3				move + lowest range (max range)
00195744: a2a2000e sb r2,0x000e(r21)			store max range of lowest range ability
00195748: 92a2000f lbu r2,0x000f(r21)			load highest range ability
0019574c: 00000000 nop
00195750: 14440002 bne r2,r4,0x 0019575c			branch if not 0xff
00195754: 00000000 nop
00195758: a2a0000f sb r0,0x000f(r21)			clear highest range ability
0019575c: 92a2000f lbu r2,0x000f(r21)			load highest range
00195760: 3c03801a lui r3,0x801a
00195764: 906301fc lbu r3,0x01fc(r3)			load move
00195768: 00000000 nop
0019576c: 00431021 addu r2,r2,r3				add move to range
00195770: 12400006 beq r18,r0,0x 0019578c		branch if ??
00195774: a2a2000f sb r2,0x000f(r21)			store highest max range
00195778: 001411c0 sll r2,r20,0x07
0019577c: 0052001a div r2,r18
00195780: 00001012 mflo r2
00195784: 3c01801a lui r1,0x801a
00195788: a0220d7c sb r2,0x0d7c(r1)				store ??
0019578c: 8fbf008c lw r31,0x008c(r29)
00195790: 8fbe0088 lw r30,0x0088(r29)
00195794: 8fb70084 lw r23,0x0084(r29)
00195798: 8fb60080 lw r22,0x0080(r29)
0019579c: 8fb5007c lw r21,0x007c(r29)
001957a0: 8fb40078 lw r20,0x0078(r29)
001957a4: 8fb30074 lw r19,0x0074(r29)
001957a8: 8fb20070 lw r18,0x0070(r29)
001957ac: 8fb1006c lw r17,0x006c(r29)
001957b0: 8fb00068 lw r16,0x0068(r29)
001957b4: 27bd0090 addiu r29,r29,0x0090
001957b8: 03e00008 jr r31
001957bc: 00000000 nop