--[[
Displays the hitbox and status value from RAM for thief trial bosses. May work for other enemies. The important box for causing the boss to lunge backwards is the one for its weapon. The following criteria all must be met for the thief 2 and 3 bosses to make them lunge backwards:
1. Status must be 0x97.
2. Kuros_left < Enemy_right
3. Kuros_right >= Enemy_left
4. Kuros_top < Enemy_bottom
5. Kuros_bottom >= Enemy_top
Kuros_left and so forth refer to the edges of the hitbox for Kuros's weapon. Enemy_right and so forth refer to the edges of the hitbox for the boss's weapon. Values increase from left to right and from top to bottom across the screen.
--]]
local status_offset, status_hitbox_x, status_hitbox_y
local camera_x, camera_y
local x_pos, x_low, x_high, y_pos, y_low, y_high
while true do
camera_x = memory.read_u16_le(0x0079)
camera_y = memory.read_u16_le(0x007B)
for i = 15, 23 do
if (memory.read_u8(0x03D8 + i) ~= 0) and (bit.band(memory.read_u8(0x04C2 + i), 0x04) == 0) then
status_offset = memory.read_u8(0x0440 + i)
if (status_offset ~= 0xFF) then
x_low = memory.read_u8(0x02EE + i)
x_high = memory.read_u8(0x0308 + i)
x_pos = x_high * 0x0100 + x_low - camera_x
y_low = memory.read_u8(0x033C + i)
y_high = memory.read_u8(0x0356 + i)
y_pos = y_high * 0x0100 + y_low - camera_y
status_hitbox_x = memory.read_u8(0x92E1 + status_offset, "PRG ROM")
status_hitbox_y = memory.read_u8(0xA69D + status_offset, "PRG ROM")
gui.drawBox(x_pos - status_hitbox_x, y_pos - status_hitbox_y, x_pos + status_hitbox_x, y_pos + status_hitbox_y)
gui.drawText(x_pos - status_hitbox_x, y_pos - status_hitbox_y, bizstring.hex(status_offset))
end
end
end
emu.frameadvance()
end