feat: Add capture health hint

This commit is contained in:
Jacob Chen
2022-01-25 01:22:56 +08:00
parent 9c44d3ce06
commit 9b3189c9e1

View File

@@ -76,7 +76,8 @@ local monster_UI = {
colors = { colors = {
health_bar = { health_bar = {
remaining_health = 0xB952A674, remaining_health = 0xB952A674,
missing_health = 0xB9000000 missing_health = 0xB9000000,
capturable_health = 0xFF7373ff
}, },
monster_name = { monster_name = {
@@ -321,7 +322,6 @@ re.on_frame(function()
damage_meter(); damage_meter();
end end
draw.text("x:\n" .. tostring(x), 500, 800, 0xFFFFFFFF);
end); end);
function get_window_size() function get_window_size()
@@ -404,6 +404,7 @@ function record_health(enemy)
local health = vital_param:call("get_Current"); local health = vital_param:call("get_Current");
local max_health = vital_param:call("get_Max"); local max_health = vital_param:call("get_Max");
local missing_health = max_health - health; local missing_health = max_health - health;
local capture_health = physical_param:call("get_CaptureHpVital");
local health_percentage = 1; local health_percentage = 1;
if max_health ~= 0 then if max_health ~= 0 then
@@ -437,6 +438,8 @@ function record_health(enemy)
monster.max_health = max_health; monster.max_health = max_health;
monster.health_percentage = health_percentage; monster.health_percentage = health_percentage;
monster.missing_health = missing_health; monster.missing_health = missing_health;
monster.capture_health = capture_health;
end end
function monster_health() function monster_health()
@@ -517,7 +520,13 @@ function monster_health()
local health_bar_missing_health_width = monster_UI.health_bar.width - health_bar_remaining_health_width; local health_bar_missing_health_width = monster_UI.health_bar.width - health_bar_remaining_health_width;
--remaining health --remaining health
draw.filled_rect(screen_position.x + monster_UI.offsets.health_bar.x, screen_position.y + monster_UI.offsets.health_bar.y, health_bar_remaining_health_width, monster_UI.health_bar.height, monster_UI.colors.health_bar.remaining_health); if monster.health <= monster.capture_health then
remaining_health_color = monster_UI.colors.health_bar.capturable_health
else
remaining_health_color = monster_UI.colors.health_bar.remaining_health
end
draw.filled_rect(screen_position.x + monster_UI.offsets.health_bar.x, screen_position.y + monster_UI.offsets.health_bar.y, health_bar_remaining_health_width, monster_UI.health_bar.height, remaining_health_color);
--missing health --missing health
draw.filled_rect(screen_position.x + monster_UI.offsets.health_bar.x + health_bar_remaining_health_width, screen_position.y + monster_UI.offsets.health_bar.y, health_bar_missing_health_width, monster_UI.health_bar.height, monster_UI.colors.health_bar.missing_health); draw.filled_rect(screen_position.x + monster_UI.offsets.health_bar.x + health_bar_remaining_health_width, screen_position.y + monster_UI.offsets.health_bar.y, health_bar_missing_health_width, monster_UI.health_bar.height, monster_UI.colors.health_bar.missing_health);
end end