Some type of checking algorithm

From Final Fantasy Hacktics Wiki
Revision as of 07:46, 12 February 2021 by Dokurider (talk | contribs) (Forgot to upload these notes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Disable Usage if Ability adds designated Status

Unflags Usable by AI on ability if it adds a designated status. This routine is to prevent the AI from using unnecessary status adding abilities if they are not needed, such as Shell vs a team that has no Magic damage whatsoever.

r4 = Ability Address (In Unit Ability List) r5 = (0011(Float), 0026(Reflect), 001a(Protect), 001b(Shell), -1)

001957c0: 3c02801a lui r2,0x801a
001957c4: 8c42f3d0 lw r2,-0x0c30(r2)
001957c8: 00000000 nop
001957cc: 30420010 andi r2,r2,0x0010
001957d0: 10400027 beq r2,r0,0x00195870
001957d4: 00000000 nop

001957d8: 3c02801a lui r2,0x801a
001957dc: 9042f3d0 lbu r2,-0x0c30(r2)
001957e0: 00000000 nop
001957e4: 304200ee andi r2,r2,0x00ee
001957e8: 14400021 bne r2,r0,0x00195870
001957ec: 00000000 nop

001957f0: 00003821 addu r7,r0,r0
001957f4: 34090080 ori r9,r0,0x0080
001957f8: 3c06801a lui r6,0x801a
001957fc: 24c6f3c4 addiu r6,r6,0xf3c4
00195800: 00a04021 addu r8,r5,r0				r8 = Status
00195804: 00a01021 addu r2,r5,r0
00195808: 04410002 bgez r2,0x00195814			Branch if no Status was passed
0019580c: 00000000 nop
00195810: 24420007 addiu r2,r2,0x0007			Set status to Performing??

00195814: 000210c3 sra r2,r2,0x03
00195818: 14e20008 bne r7,r2,0x0019583c			Branch if this is not the status being looked for
0019581c: 01091007 srav r2,r9,r8

Status Found

00195820: 90c30007 lbu r3,0x0007(r6)
00195824: 384200ff xori r2,r2,0x00ff
00195828: 00621824 and r3,r3,r2
0019582c: 14600010 bne r3,r0,0x00195870
00195830: 00000000 nop
00195834: 08065614 j 0x00195850
00195838: 24c60001 addiu r6,r6,0x0001

Status not Found

0019583c: 90c20007 lbu r2,0x0007(r6)			Load Status Inflictions
00195840: 00000000 nop
00195844: 1440000a bne r2,r0,0x00195870			Branch if any found
00195848: 00000000 nop

0019584c: 24c60001 addiu r6,r6,0x0001
00195850: 24e70001 addiu r7,r7,0x0001
00195854: 28e20005 slti r2,r7,0x0005
00195858: 1440ffea bne r2,r0,0x00195804			Look through next status block
0019585c: 2508fff8 addiu r8,r8,0xfff8

00195860: 94820002 lhu r2,0x0002(r4)			Load Ability Address
00195864: 00000000 nop
00195868: 30427fff andi r2,r2,0x7fff
0019586c: a4820002 sh r2,0x0002(r4)				Set Ability as unusable
00195870: 03e00008 jr r31
00195874: 00000000 nop