Monster Skill check

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
Monster Skill check
00182508: 27bdffc8 addiu r29,r29,0xffc8
0018250c: afb30024 sw r19,0x0024(r29)
00182510: 00a09821 addu r19,r5,r0			r19 = x coords + mod
00182514: afb40028 sw r20,0x0028(r29)
00182518: 00c0a021 addu r20,r6,r0			r20 = Y coords + mod
0018251c: afb60030 sw r22,0x0030(r29)
00182520: 0080b021 addu r22,r4,r0			r22 = ENTD flags
00182524: afbf0034 sw r31,0x0034(r29)
00182528: afb5002c sw r21,0x002c(r29)
0018252c: afb20020 sw r18,0x0020(r29)
00182530: afb1001c sw r17,0x001c(r29)
00182534: 0660003f bltz r19,0x 00182634		branch if on the X coord 0
00182538: afb0 0018 sw r16,0x 0018(r29)
0018253c: 3c02800e lui r2,0x800e
00182540: 90424e9c lbu r2,0x4e9c(r2)			load map max X
00182544: 00000000 nop
00182548: 0262102a slt r2,r19,r2			set if adjacent tile (x) is on the map
0018254c: 10400039 beq r2,r0,0x 00182634		branch if off the map
00182550: 00000000 nop
00182554: 06800038 bltz r20,0x 00182638		branch if Y + mod is off the map
00182558: 00001021 addu r2,r0,r0
0018255c: 3c02800e lui r2,0x800e
00182560: 90424ea0 lbu r2,0x4ea0(r2)			load map max Y
00182564: 00000000 nop
00182568: 0282102a slt r2,r20,r2			set if map max Y is less than Y coords
0018256c: 14400003 bne r2,r0,0x 0018257c		branch if valid coords
00182570: 00009021 addu r18,r0,r0
00182574: 0806098e j 0x 00182638			jump to end, return r2 = 0 (fail?)
00182578: 00001021 addu r2,r0,r0
0018257c: 30f500ff andi r21,r7,0x00ff		        r21 = unit ID of other unit?
00182580: 00008821 addu r17,r0,r0
00182584: 3c028019 lui r2,0x8019
00182588: 244208cc addiu r2,r2,0x08cc		        load units data
0018258c: 02228021 addu r16,r17,r2
00182590: 92030001 lbu r3,0x0001(r16)			
00182594: 340200ff ori r2,r0,0x00ff
00182598: 10620022 beq r3,r2,0x 00182624		branch if unit doesn't exist
0018259c: 263101c0 addiu r17,r17,0x01c0
001825a0: 92020047 lbu r2,0x0047(r16)			load units X coordinate
001825a4: 00000000 nop
001825a8: 1453001e bne r2,r19,0x 00182624		branch if unit not 1 X tile away
001825ac: 00000000 nop
001825b0: 92020048 lbu r2,0x0048(r16)
001825b4: 00000000 nop
001825b8: 1454001a bne r2,r20,0x 00182624		branch if Y coordinate doesn't match
001825bc: 00000000 nop
001825c0: 0c06325a jal 0x 0018c968			status checks that prevent action
001825c4: 02002021 addu r4,r16,r0
001825c8: 14400016 bne r2,r0,0x 00182624		branch if status found (berserk, confused, unable to fight)
001825cc: 00000000 nop
001825d0: 92020092 lbu r2,0x0092(r16)				
001825d4: 00000000 nop
001825d8: 30420080 andi r2,r2,0x0080
001825dc: 10400011 beq r2,r0,0x 00182624		branch if monster skill not equipped
001825e0: 00000000 nop
001825e4: 92020005 lbu r2,0x0005(r16)			load ENTD
001825e8: 00000000 nop
001825ec: 00561026 xor r2,r2,r22
001825f0: 30420030 andi r2,r2,0x0030
001825f4: 1440000b bne r2,r0,0x 00182624		branch if not players team
001825f8: 00000000 nop
001825fc: 9205018a lbu r5,0x018a(r16)			load ENTD
00182600: 0c05f056 jal 0x0017c158			Calculate_Height_Data
00182604: 27a40010 addiu r4,r29,0x0010
00182608: 93a20016 lbu r2,0x0016(r29)
0018260c: 00000000 nop
00182610: 02a21023 subu r2,r21,r2			unit ID - ??
00182614: 24420005 addiu r2,r2,0x0005
00182618: 2c42000b sltiu r2,r2,0x000b
0018261c: 14400006 bne r2,r0,0x 00182638		make sure unit is on player team?
00182620: 34020001 ori r2,r0,0x0001
00182624: 26520001 addiu r18,r18,0x0001
00182628: 2a420015 slti r2,r18,0x0015
0018262c: 1440ffd5 bne r2,r0,0x 00182584
00182630: 00000000 nop
00182634: 00001021 addu r2,r0,r0
00182638: 8fbf0034 lw r31,0x0034(r29)
0018263c: 8fb60030 lw r22,0x0030(r29)
00182640: 8fb5002c lw r21,0x002c(r29)
00182644: 8fb40028 lw r20,0x0028(r29)
00182648: 8fb30024 lw r19,0x0024(r29)
0018264c: 8fb20020 lw r18,0x0020(r29)
00182650: 8fb1001c lw r17,0x001c(r29)
00182654: 8fb0 0018 lw r16,0x 0018(r29)
00182658: 27bd0038 addiu r29,r29,0x0038
0018265c: 03e00008 jr r31
00182660: 00000000 nop
r2 = 1 success
r2 = 0 fail