Difference between revisions of "Compare Target Priority and Hit Rate (00196db0)"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
m
 
(One intermediate revision by the same user not shown)
Line 38: Line 38:
 
===Return locations===
 
===Return locations===
 
  '''BATTLE.BIN'''
 
  '''BATTLE.BIN'''
   0019617c: [[Set_or_Remove_Charging_(00195f8c)]]
+
   0019617c: [[Set_or_Remove_Charging_(00195f8c)]]                     r4 = AI 0x30 r5 =  AI 0x1818
   00196e48: [[Set_Highest_Target_Priority_(00196e20)]]
+
   00196e48: [[Set_Highest_Target_Priority_(00196e20)]]               r4 = AI 0x30 r5 = AI 0x50
 
   00196ff4: [[Compare_Set_Highest_Unit_Target_Priority_(00196fc4)]]  r4 = AI 0x50 r5 = AI 0x170
 
   00196ff4: [[Compare_Set_Highest_Unit_Target_Priority_(00196fc4)]]  r4 = AI 0x50 r5 = AI 0x170

Latest revision as of 07:16, 25 June 2024

BATTLE.BIN :  - Compare Target Priority and Hit Rate (00196db0)
Compare 2 AI action data : first AI 0x30 (?) then priority score (if equality), then Hit% 
------------------------------------------------------------------------------------------
Parameter : r4 = Pointer to AI 0x0030 (or Any other Action simulation result + 0x01c)
            r5 = Pointer to AI 0x0050
Return : r2 = 0x02 if Higher Score (AI 0x32), Higher Average Hit% (AI 0x31) or Higher AI 0x30
         r2 = 0x00 if Lower results
         r2 = 0x01 if Equality
------------------------------------------------------------------------------------------
00196db0: 90860000 lbu r6,0x0000(r4)         |Highest ? (0x30 in AI Data) (Can kill this unit flag?) Only seen as 0x00
00196db4: 90a30000 lbu r3,0x0000(r5)         |Always zero, but set in a half word along with Hit Rate
00196db8: 00000000 nop                       |
00196dbc: 0066102b sltu r2,r3,r6             |
00196dc0: 14400015 bne r2,r0,0x00196e18      #if AI 0x50 < AI 0x30 Exit Returns 0x02
00196dc4: 34020002 ori r2,r0,0x0002          |
00196dc8: 00c3102b sltu r2,r6,r3             |
00196dcc: 14400012 bne r2,r0,0x00196e18      #if AI 0x30 < AI 0x50 Exit Returns 0x00
00196dd0: 00001021 addu r2,r0,r0             |
00196dd4: 84860002 lh r6,0x0002(r4)          |Considered Action Priority score Signed
00196dd8: 84a30002 lh r3,0x0002(r5)          |Best Action priority score so far ? Signed
00196ddc: 00000000 nop                       |
00196de0: 0066102a slt r2,r3,r6              |
00196de4: 1440000c bne r2,r0,0x00196e18      #If Previous score is < Considered score Exit Returns 0x02
00196de8: 34020002 ori r2,r0,0x0002          |
00196dec: 00c3102a slt r2,r6,r3              |
00196df0: 14400009 bne r2,r0,0x00196e18      #If Considered score < Previous score Exit Returns 0x00
00196df4: 00001021 addu r2,r0,r0             |
00196df8: 90840001 lbu r4,0x0001(r4)         |Average Hit%
00196dfc: 90a50001 lbu r5,0x0001(r5)         |Average Hit%
00196e00: 00000000 nop                       |
00196e04: 00a4102b sltu r2,r5,r4             |
00196e08: 14400003 bne r2,r0,0x00196e18      #If same score but Previous Hit% < Considered Hit% Exit Returns 0x02
00196e0c: 34020002 ori r2,r0,0x0002          |
00196e10: 0085102b sltu r2,r4,r5             |0x1 if Current Hit% < Previous Hit%
00196e14: 38420001 xori r2,r2,0x0001         |Returns 0x1 if Same Hit% or 0 if Previous Hit% is higher
00196e18: 03e00008 jr r31                    |
00196e1c: 00000000 nop

Return locations

BATTLE.BIN
 0019617c: Set_or_Remove_Charging_(00195f8c)                     r4 = AI 0x30 r5 =  AI 0x1818
 00196e48: Set_Highest_Target_Priority_(00196e20)                r4 = AI 0x30 r5 = AI 0x50
 00196ff4: Compare_Set_Highest_Unit_Target_Priority_(00196fc4)   r4 = AI 0x50 r5 = AI 0x170