Refactoring

This commit is contained in:
GreenComfyTea
2022-07-26 19:27:37 +03:00
parent a20c458629
commit 2f9a8ac6a3
41 changed files with 5939 additions and 18587 deletions

View File

@@ -21,23 +21,24 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
for id, ailment in pairs(monster.ailments) do
if id == ailments.stun_id then
if not cached_config.filter.stun then
goto continue;
goto continue
end
elseif id == ailments.poison_id then
if not cached_config.filter.poison then
goto continue;
goto continue
end
elseif id == ailments.blast_id then
if not cached_config.filter.blast then
goto continue;
goto continue
end
else
goto continue;
goto continue
end
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit then
goto continue;
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit then
goto continue
end
local total_buildup = 0;
@@ -52,7 +53,7 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
end
table.insert(displayed_players,
{
{
["buildup"] = player_buildup,
["buildup_share"] = ailment.buildup_share[player_id],
["id"] = player_id
@@ -61,7 +62,7 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
end
if total_buildup == 0 then
goto continue;
goto continue
end
if cached_config.sorting.type == "Normal" then
@@ -103,8 +104,9 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
if cached_config.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
end
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_dynamic_UI.ailment_name_label, ailment_buildups_position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_dynamic_UI.ailment_name_label,
ailment_buildups_position_on_screen, opacity_scale, ailment_name);
local last_j = 0;
@@ -114,21 +116,24 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
y = ailment_buildups_position_on_screen.y + cached_config.player_spacing.y * (j - 1) * global_scale_modifier;
};
ailment_buildup_UI_entity.draw_dynamic(_player, monster.ailments[ailments.stun_id].ailment_buildup_dynamic_UI, ailment_buildup_position_on_screen, opacity_scale, top_buildup);
ailment_buildup_UI_entity.draw_dynamic(_player, monster.ailments[ailments.stun_id].ailment_buildup_dynamic_UI,
ailment_buildup_position_on_screen, opacity_scale, top_buildup);
last_j = j;
end
local total_buildup_position_on_screen = {
x = ailment_buildups_position_on_screen.x + cached_config.player_spacing.x * last_j * global_scale_modifier,
y = ailment_buildups_position_on_screen.y + cached_config.player_spacing.y * last_j * global_scale_modifier;
};
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_dynamic_UI.total_buildup_label, total_buildup_position_on_screen, opacity_scale, language.current_language.UI.total_buildup);
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_dynamic_UI.total_buildup_label,
total_buildup_position_on_screen, opacity_scale, language.current_language.UI.total_buildup);
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_dynamic_UI.total_buildup_value_label, total_buildup_position_on_screen, opacity_scale, total_buildup);
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_dynamic_UI.total_buildup_value_label,
total_buildup_position_on_screen, opacity_scale, total_buildup);
ailment_buildups_position_on_screen = {
x = total_buildup_position_on_screen.x + cached_config.ailment_spacing.x * global_scale_modifier,
@@ -138,7 +143,7 @@ function ailment_buildup.draw_dynamic(monster, ailment_buildups_position_on_scre
::continue::
end
end
function ailment_buildup.draw_static(monster, ailment_buildups_position_on_screen, opacity_scale)
@@ -152,23 +157,24 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
for id, ailment in pairs(monster.ailments) do
if id == ailments.stun_id then
if not cached_config.filter.stun then
goto continue;
goto continue
end
elseif id == ailments.poison_id then
if not cached_config.filter.poison then
goto continue;
goto continue
end
elseif id == ailments.blast_id then
if not cached_config.filter.blast then
goto continue;
goto continue
end
else
goto continue;
goto continue
end
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit then
goto continue;
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit then
goto continue
end
local total_buildup = 0;
@@ -183,7 +189,7 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
end
table.insert(displayed_players,
{
{
["buildup"] = player_buildup,
["buildup_share"] = ailment.buildup_share[player_id],
["id"] = player_id
@@ -192,7 +198,7 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
end
if total_buildup == 0 then
goto continue;
goto continue
end
if cached_config.sorting.type == "Normal" then
@@ -235,7 +241,8 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
end
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_static_UI.ailment_name_label, ailment_buildups_position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_static_UI.ailment_name_label,
ailment_buildups_position_on_screen, opacity_scale, ailment_name);
local last_j = 0;
for j, _player in ipairs(displayed_players) do
@@ -244,7 +251,8 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
y = ailment_buildups_position_on_screen.y + cached_config.player_spacing.y * (j - 1) * global_scale_modifier;
};
ailment_buildup_UI_entity.draw_static(_player, monster.ailments[ailments.stun_id].ailment_buildup_static_UI, ailment_buildup_position_on_screen, opacity_scale, top_buildup);
ailment_buildup_UI_entity.draw_static(_player, monster.ailments[ailments.stun_id].ailment_buildup_static_UI,
ailment_buildup_position_on_screen, opacity_scale, top_buildup);
last_j = j;
end
@@ -254,9 +262,11 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
y = ailment_buildups_position_on_screen.y + cached_config.player_spacing.y * last_j * global_scale_modifier;
};
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_static_UI.total_buildup_label, total_buildup_position_on_screen, opacity_scale, language.current_language.UI.total_buildup);
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_static_UI.total_buildup_label,
total_buildup_position_on_screen, opacity_scale, language.current_language.UI.total_buildup);
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_static_UI.total_buildup_value_label, total_buildup_position_on_screen, opacity_scale, total_buildup);
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_static_UI.total_buildup_value_label,
total_buildup_position_on_screen, opacity_scale, total_buildup);
ailment_buildups_position_on_screen = {
x = total_buildup_position_on_screen.x + cached_config.ailment_spacing.x * global_scale_modifier,
@@ -266,7 +276,7 @@ function ailment_buildup.draw_static(monster, ailment_buildups_position_on_scree
::continue::
end
end
function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_screen, opacity_scale)
@@ -280,23 +290,24 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
for id, ailment in pairs(monster.ailments) do
if id == ailments.stun_id then
if not cached_config.filter.stun then
goto continue;
goto continue
end
elseif id == ailments.poison_id then
if not cached_config.filter.poison then
goto continue;
goto continue
end
elseif id == ailments.blast_id then
if not cached_config.filter.blast then
goto continue;
goto continue
end
else
goto continue;
goto continue
end
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit then
goto continue;
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit then
goto continue
end
local total_buildup = 0;
@@ -311,7 +322,7 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
end
table.insert(displayed_players,
{
{
["buildup"] = player_buildup,
["buildup_share"] = ailment.buildup_share[player_id],
["id"] = player_id
@@ -320,7 +331,7 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
end
if total_buildup == 0 then
goto continue;
goto continue
end
if cached_config.sorting.type == "Normal" then
@@ -363,7 +374,8 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
end
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_highlighted_UI.ailment_name_label, ailment_buildups_position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_highlighted_UI.ailment_name_label,
ailment_buildups_position_on_screen, opacity_scale, ailment_name);
local last_j = 0;
for j, _player in ipairs(displayed_players) do
@@ -372,7 +384,8 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
y = ailment_buildups_position_on_screen.y + cached_config.player_spacing.y * (j - 1) * global_scale_modifier;
};
ailment_buildup_UI_entity.draw_highlighted(_player, monster.ailments[ailments.stun_id].ailment_buildup_highlighted_UI, ailment_buildup_position_on_screen, opacity_scale, top_buildup);
ailment_buildup_UI_entity.draw_highlighted(_player, monster.ailments[ailments.stun_id].ailment_buildup_highlighted_UI
, ailment_buildup_position_on_screen, opacity_scale, top_buildup);
last_j = j;
end
@@ -382,9 +395,11 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
y = ailment_buildups_position_on_screen.y + cached_config.player_spacing.y * last_j * global_scale_modifier;
};
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_highlighted_UI.total_buildup_label, total_buildup_position_on_screen, opacity_scale, language.current_language.UI.total_buildup);
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_highlighted_UI.total_buildup_label,
total_buildup_position_on_screen, opacity_scale, language.current_language.UI.total_buildup);
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_highlighted_UI.total_buildup_value_label, total_buildup_position_on_screen, opacity_scale, total_buildup);
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_highlighted_UI.total_buildup_value_label,
total_buildup_position_on_screen, opacity_scale, total_buildup);
ailment_buildups_position_on_screen = {
x = total_buildup_position_on_screen.x + cached_config.ailment_spacing.x * global_scale_modifier,
@@ -394,7 +409,7 @@ function ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_
::continue::
end
end
function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen, opacity_scale)
@@ -408,23 +423,24 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
for id, ailment in pairs(monster.ailments) do
if id == ailments.stun_id then
if not cached_config.filter.stun then
goto continue;
goto continue
end
elseif id == ailments.poison_id then
if not cached_config.filter.poison then
goto continue;
goto continue
end
elseif id == ailments.blast_id then
if not cached_config.filter.blast then
goto continue;
goto continue
end
else
goto continue;
goto continue
end
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit then
goto continue;
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit then
goto continue
end
local total_buildup = 0;
@@ -439,7 +455,7 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
end
table.insert(displayed_players,
{
{
["buildup"] = player_buildup,
["buildup_share"] = ailment.buildup_share[player_id],
["id"] = player_id
@@ -448,7 +464,7 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
end
if total_buildup == 0 then
goto continue;
goto continue
end
if cached_config.sorting.type == "Normal" then
@@ -491,7 +507,8 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
end
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_small_UI.ailment_name_label, ailment_buildups_position_on_screen, opacity_scale, ailment_name);
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_small_UI.ailment_name_label,
ailment_buildups_position_on_screen, opacity_scale, ailment_name);
local last_j = 0;
for j, _player in ipairs(displayed_players) do
@@ -500,7 +517,8 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
y = ailment_buildups_position_on_screen.y + cached_config.player_spacing.y * (j - 1) * global_scale_modifier;
};
ailment_buildup_UI_entity.draw_small(_player, monster.ailments[ailments.stun_id].ailment_buildup_small_UI, ailment_buildup_position_on_screen, opacity_scale, top_buildup);
ailment_buildup_UI_entity.draw_small(_player, monster.ailments[ailments.stun_id].ailment_buildup_small_UI,
ailment_buildup_position_on_screen, opacity_scale, top_buildup);
last_j = j;
end
@@ -510,9 +528,11 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
y = ailment_buildups_position_on_screen.y + cached_config.player_spacing.y * last_j * global_scale_modifier;
};
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_small_UI.total_buildup_label, total_buildup_position_on_screen, opacity_scale, language.current_language.UI.total_buildup);
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_small_UI.total_buildup_label,
total_buildup_position_on_screen, opacity_scale, language.current_language.UI.total_buildup);
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_small_UI.total_buildup_value_label, total_buildup_position_on_screen, opacity_scale, total_buildup);
drawing.draw_label(monster.ailments[ailments.stun_id].ailment_buildup_small_UI.total_buildup_value_label,
total_buildup_position_on_screen, opacity_scale, total_buildup);
ailment_buildups_position_on_screen = {
x = total_buildup_position_on_screen.x + cached_config.ailment_spacing.x * global_scale_modifier,
@@ -522,7 +542,7 @@ function ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen
::continue::
end
end
function ailment_buildup.init_module()
@@ -538,4 +558,4 @@ function ailment_buildup.init_module()
drawing = require("MHR_Overlay.UI.drawing");
end
return ailment_buildup;
return ailment_buildup;

View File

@@ -50,11 +50,11 @@ function ailment_hook.poison_proc(poison_param)
monster = small_monster.get_monster(enemy);
end
monster.ailments[ailments.poison_id].cached_buildup_share = table_helpers.deep_copy(monster.ailments[ailments.poison_id].buildup_share);
monster.ailments[ailments.poison_id].cached_buildup_share = table_helpers.deep_copy(monster.ailments[ailments
.poison_id].buildup_share);
ailments.clear_ailment_contribution(monster, ailments.poison_id);
end
function ailment_hook.blast_proc(blast_param)
if blast_param == nil then
return;
@@ -79,7 +79,7 @@ function ailment_hook.blast_proc(blast_param)
local blast_damage = blast_damage_method:call(blast_param);
local blast_adjust_rate = blast_adjust_rate_method:call(blast_param);
ailments.apply_ailment_damage(monster, ailments.blast_id, blast_damage * blast_adjust_rate);
ailments.clear_ailment_contribution(monster, ailments.blast_id);
@@ -89,7 +89,7 @@ function ailment_hook.stock_damage()
for enemy, monster in pairs(large_monster.list) do
local damage_param = damage_param_field:get_data(enemy);
if damage_param == nil then
goto continue;
goto continue
end
local poison_param = poison_param_field:get_data(damage_param);
@@ -101,7 +101,7 @@ function ailment_hook.stock_damage()
for enemy, monster in pairs(small_monster.list) do
local damage_param = damage_param_field:get_data(enemy);
if damage_param == nil then
goto continue;
goto continue
end
local poison_param = poison_param_field:get_data(damage_param);
@@ -123,7 +123,7 @@ function ailment_hook.init_module()
end, function(retval)
return retval;
end);
sdk.hook(on_poison_activate_proc_method, function(args)
pcall(ailment_hook.poison_proc, sdk.to_managed_object(args[2]));
end, function(retval)
@@ -137,4 +137,4 @@ function ailment_hook.init_module()
end);
end
return ailment_hook;
return ailment_hook;

View File

@@ -42,7 +42,7 @@ ailments.thunder_id = 11;
ailments.fall_trap_id = 12;
ailments.shock_trap_id = 13;
ailments.capture_id = 14 --tranq bomb
ailments.koyashi_id = 15; --dung bomb
ailments.koyashi_id = 15; --dung bomb
ailments.steel_fang_id = 16;
ailments.fall_quick_sand_id = 17;
ailments.fall_otomo_trap_id = 18;
@@ -258,14 +258,14 @@ function ailments.update_ailments(enemy, monster)
end
ailments.update_stun_poison_blast_ailments(monster, damage_param);
if not config.current_config.large_monster_UI.dynamic.ailments.visibility
and not config.current_config.large_monster_UI.static.ailments.visibility
and not config.current_config.large_monster_UI.highlighted.ailments.visibility
and not config.current_config.small_monster_UI.ailments.visibility
and not config.current_config.large_monster_UI.dynamic.ailment_buildups.visibility
and not config.current_config.large_monster_UI.static.ailment_buildups.visibility
and not config.current_config.small_monster_UI.ailment_buildups.visibility then
and not config.current_config.large_monster_UI.static.ailments.visibility
and not config.current_config.large_monster_UI.highlighted.ailments.visibility
and not config.current_config.small_monster_UI.ailments.visibility
and not config.current_config.large_monster_UI.dynamic.ailment_buildups.visibility
and not config.current_config.large_monster_UI.static.ailment_buildups.visibility
and not config.current_config.small_monster_UI.ailment_buildups.visibility then
return;
end
@@ -285,7 +285,7 @@ function ailments.update_ailments(enemy, monster)
for index, ailment_param in ipairs(condition_param_table) do
local id = index - 1;
if id == ailments.stun_id or id == ailments.poison_id or id == ailments.blast_id then
goto continue;
goto continue
end
ailments.update_ailment(monster, ailment_param, id);
@@ -312,100 +312,100 @@ function ailments.update_stun_poison_blast_ailments(monster, damage_param)
end
function ailments.update_ailment(monster, ailment_param, id)
local is_enable = get_is_enable_method:call(ailment_param);
local activate_count = get_activate_count_method:call(ailment_param):get_element(0):get_field("mValue") or 0;
local buildup = get_stock_method:call(ailment_param):get_element(0):get_field("mValue");
local buildup_limit = get_limit_method:call(ailment_param):get_element(0):get_field("mValue");
local timer = get_active_timer_method:call(ailment_param);
local duration = get_active_time_method:call(ailment_param);
local is_active = get_is_active_method:call(ailment_param);
if is_enable == nil then
is_enable = true;
local is_enable = get_is_enable_method:call(ailment_param);
local activate_count = get_activate_count_method:call(ailment_param):get_element(0):get_field("mValue") or 0;
local buildup = get_stock_method:call(ailment_param):get_element(0):get_field("mValue");
local buildup_limit = get_limit_method:call(ailment_param):get_element(0):get_field("mValue");
local timer = get_active_timer_method:call(ailment_param);
local duration = get_active_time_method:call(ailment_param);
local is_active = get_is_active_method:call(ailment_param);
if is_enable == nil then
is_enable = true;
end
if is_enable ~= monster.ailments[id].is_enable then
ailments.update_last_change_time(monster, id);
end
monster.ailments[id].is_enable = is_enable;
if activate_count ~= nil then
if activate_count ~= monster.ailments[id].activate_count then
ailments.update_last_change_time(monster, id);
if id == ailments.stun_id then
ailments.clear_ailment_contribution(monster, ailments.stun_id);
end
end
monster.ailments[id].activate_count = activate_count;
end
if is_enable ~= monster.ailments[id].is_enable then
if buildup ~= nil then
if buildup ~= monster.ailments[id].total_buildup then
ailments.update_last_change_time(monster, id);
end
monster.ailments[id].is_enable = is_enable;
monster.ailments[id].total_buildup = buildup;
end
if activate_count ~= nil then
if activate_count ~= monster.ailments[id].activate_count then
ailments.update_last_change_time(monster, id);
if id == ailments.stun_id then
ailments.clear_ailment_contribution(monster, ailments.stun_id);
end
end
monster.ailments[id].activate_count = activate_count;
if buildup_limit ~= nil then
if buildup_limit ~= monster.ailments[id].buildup_limit then
ailments.update_last_change_time(monster, id);
end
if buildup ~= nil then
if buildup ~= monster.ailments[id].total_buildup then
ailments.update_last_change_time(monster, id);
end
monster.ailments[id].buildup_limit = buildup_limit;
end
monster.ailments[id].total_buildup = buildup;
if buildup ~= nil and buildup_limit ~= nil and buildup_limit ~= 0 then
monster.ailments[id].buildup_percentage = buildup / buildup_limit;
end
if timer ~= nil then
if timer ~= monster.ailments[id].timer then
ailments.update_last_change_time(monster, id);
end
if buildup_limit ~= nil then
if buildup_limit ~= monster.ailments[id].buildup_limit then
ailments.update_last_change_time(monster, id);
end
monster.ailments[id].timer = timer;
end
monster.ailments[id].buildup_limit = buildup_limit;
if is_active ~= nil then
if is_active ~= monster.ailments[id].is_active then
ailments.update_last_change_time(monster, id);
end
if buildup ~= nil and buildup_limit ~= nil and buildup_limit ~= 0 then
monster.ailments[id].buildup_percentage = buildup / buildup_limit;
monster.ailments[id].is_active = is_active;
end
if duration ~= nil and not monster.ailments[id].is_active then
if duration ~= monster.ailments[id].duration then
ailments.update_last_change_time(monster, id);
end
if timer ~= nil then
if timer ~= monster.ailments[id].timer then
ailments.update_last_change_time(monster, id);
end
monster.ailments[id].duration = duration;
end
monster.ailments[id].timer = timer;
if duration ~= 0 and duration ~= nil then
monster.ailments[id].timer_percentage = timer / monster.ailments[id].duration;
end
if is_active then
if timer < 0 then
timer = 0;
end
if is_active ~= nil then
if is_active ~= monster.ailments[id].is_active then
ailments.update_last_change_time(monster, id);
end
local minutes_left = math.floor(timer / 60);
local seconds_left = timer - 60 * minutes_left;
monster.ailments[id].is_active = is_active;
end
if duration ~= nil and not monster.ailments[id].is_active then
if duration ~= monster.ailments[id].duration then
ailments.update_last_change_time(monster, id);
end
monster.ailments[id].duration = duration;
end
if duration ~= 0 and duration ~= nil then
if duration ~= 0 then
monster.ailments[id].timer_percentage = timer / monster.ailments[id].duration;
end
if is_active then
if timer < 0 then
timer = 0;
end
local minutes_left = math.floor(timer / 60);
local seconds_left = timer - 60 * minutes_left;
if duration ~= 0 then
monster.ailments[id].timer_percentage = timer / monster.ailments[id].duration;
end
monster.ailments[id].minutes_left = minutes_left;
monster.ailments[id].seconds_left = seconds_left;
end
monster.ailments[id].minutes_left = minutes_left;
monster.ailments[id].seconds_left = seconds_left;
end
end
function ailments.update_last_change_time(monster, id)
@@ -423,7 +423,7 @@ function ailments.update_poison(monster, poison_param)
local is_damage = poison_get_is_damage_method:call(poison_param);
if is_damage then
local poison_damage = poison_damage_field:get_data(poison_param);
ailments.apply_ailment_damage(monster, ailments.poison_id, poison_damage);
end
end
@@ -438,116 +438,121 @@ function ailments.draw_dynamic(monster, ailments_position_on_screen, opacity_sca
for id, ailment in pairs(monster.ailments) do
if id == ailments.paralyze_id then
if not cached_config.filter.paralysis then
goto continue;
goto continue
end
elseif id == ailments.sleep_id then
if not cached_config.filter.sleep then
goto continue;
goto continue
end
elseif id == ailments.stun_id then
if not cached_config.filter.stun then
goto continue;
goto continue
end
elseif id == ailments.flash_id then
if not cached_config.filter.flash then
goto continue;
goto continue
end
elseif id == ailments.poison_id then
if not cached_config.filter.poison then
goto continue;
goto continue
end
elseif id == ailments.blast_id then
if not cached_config.filter.blast then
goto continue;
goto continue
end
elseif id == ailments.exhaust_id then
if not cached_config.filter.exhaust then
goto continue;
goto continue
end
elseif id == ailments.ride_id then
if not cached_config.filter.ride then
goto continue;
goto continue
end
elseif id == ailments.water_id then
if not cached_config.filter.waterblight then
goto continue;
goto continue
end
elseif id == ailments.fire_id then
if not cached_config.filter.fireblight then
goto continue;
goto continue
end
elseif id == ailments.ice_id then
if not cached_config.filter.iceblight then
goto continue;
goto continue
end
elseif id == ailments.thunder_id then
if not cached_config.filter.thunderblight then
goto continue;
goto continue
end
elseif id == ailments.fall_trap_id then
if not cached_config.filter.fall_trap then
goto continue;
goto continue
end
elseif id == ailments.shock_trap_id then
if not cached_config.filter.shock_trap then
goto continue;
goto continue
end
elseif id == ailments.capture_id then
if not cached_config.filter.tranq_bomb then
goto continue;
goto continue
end
elseif id == ailments.koyashi_id then
if not cached_config.filter.dung_bomb then
goto continue;
goto continue
end
elseif id == ailments.steel_fang_id then
if not cached_config.filter.steel_fang then
goto continue;
goto continue
end
elseif id == ailments.fall_quick_sand_id then
if not cached_config.filter.quick_sand then
goto continue;
goto continue
end
elseif id == ailments.fall_otomo_trap_id then
if not cached_config.filter.fall_otomo_trap then
goto continue;
goto continue
end
elseif id == ailments.shock_otomo_trap_id then
if not cached_config.filter.shock_otomo_trap then
goto continue;
goto continue
end
else
goto continue;
goto continue
end
if cached_config.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and ailment.buildup_limit ~= 0 and ailment.activate_count == 0 and not ailment.is_active then
goto continue;
if cached_config.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and
ailment.buildup_limit ~= 0
and ailment.activate_count == 0 and not ailment.is_active then
goto continue
end
if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and not ailment.is_active then
goto continue;
if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and
not ailment.is_active then
goto continue
end
if cached_config.settings.hide_all_inactive_ailments and not ailment.is_active then
goto continue;
goto continue
end
if cached_config.settings.hide_all_active_ailments and ailment.is_active then
goto continue;
goto continue
end
if cached_config.settings.hide_disabled_ailments and not ailment.is_enable then
goto continue;
goto continue
end
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit and not ailment.is_active then
goto continue;
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit and
not ailment.is_active then
goto continue
end
table.insert(displayed_ailments, ailment);
::continue::
end
if cached_config.sorting.type == "Normal" then
if cached_config.sorting.reversed_order then
@@ -601,116 +606,121 @@ function ailments.draw_static(monster, ailments_position_on_screen, opacity_scal
for id, ailment in pairs(monster.ailments) do
if id == ailments.paralyze_id then
if not cached_config.filter.paralysis then
goto continue;
goto continue
end
elseif id == ailments.sleep_id then
if not cached_config.filter.sleep then
goto continue;
goto continue
end
elseif id == ailments.stun_id then
if not cached_config.filter.stun then
goto continue;
goto continue
end
elseif id == ailments.flash_id then
if not cached_config.filter.flash then
goto continue;
goto continue
end
elseif id == ailments.poison_id then
if not cached_config.filter.poison then
goto continue;
goto continue
end
elseif id == ailments.blast_id then
if not cached_config.filter.blast then
goto continue;
goto continue
end
elseif id == ailments.exhaust_id then
if not cached_config.filter.exhaust then
goto continue;
goto continue
end
elseif id == ailments.ride_id then
if not cached_config.filter.ride then
goto continue;
goto continue
end
elseif id == ailments.water_id then
if not cached_config.filter.waterblight then
goto continue;
goto continue
end
elseif id == ailments.fire_id then
if not cached_config.filter.fireblight then
goto continue;
goto continue
end
elseif id == ailments.ice_id then
if not cached_config.filter.iceblight then
goto continue;
goto continue
end
elseif id == ailments.thunder_id then
if not cached_config.filter.thunderblight then
goto continue;
goto continue
end
elseif id == ailments.fall_trap_id then
if not cached_config.filter.fall_trap then
goto continue;
goto continue
end
elseif id == ailments.shock_trap_id then
if not cached_config.filter.shock_trap then
goto continue;
goto continue
end
elseif id == ailments.capture_id then
if not cached_config.filter.tranq_bomb then
goto continue;
goto continue
end
elseif id == ailments.koyashi_id then
if not cached_config.filter.dung_bomb then
goto continue;
goto continue
end
elseif id == ailments.steel_fang_id then
if not cached_config.filter.steel_fang then
goto continue;
goto continue
end
elseif id == ailments.fall_quick_sand_id then
if not cached_config.filter.quick_sand then
goto continue;
goto continue
end
elseif id == ailments.fall_otomo_trap_id then
if not cached_config.filter.fall_otomo_trap then
goto continue;
goto continue
end
elseif id == ailments.shock_otomo_trap_id then
if not cached_config.filter.shock_otomo_trap then
goto continue;
goto continue
end
else
goto continue;
goto continue
end
if cached_config.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and ailment.buildup_limit ~= 0 and ailment.activate_count == 0 and not ailment.is_active then
goto continue;
if cached_config.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and
ailment.buildup_limit ~= 0
and ailment.activate_count == 0 and not ailment.is_active then
goto continue
end
if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and not ailment.is_active then
goto continue;
if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and
not ailment.is_active then
goto continue
end
if cached_config.settings.hide_all_inactive_ailments and not ailment.is_active then
goto continue;
goto continue
end
if cached_config.settings.hide_all_active_ailments and ailment.is_active then
goto continue;
goto continue
end
if cached_config.settings.hide_disabled_ailments and not ailment.is_enable then
goto continue;
goto continue
end
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit and not ailment.is_active then
goto continue;
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit and
not ailment.is_active then
goto continue
end
table.insert(displayed_ailments, ailment);
::continue::
end
if cached_config.sorting.type == "Normal" then
if cached_config.sorting.reversed_order then
@@ -749,7 +759,7 @@ function ailments.draw_static(monster, ailments_position_on_screen, opacity_scal
x = ailments_position_on_screen.x + cached_config.spacing.x * (j - 1) * global_scale_modifier,
y = ailments_position_on_screen.y + cached_config.spacing.y * (j - 1) * global_scale_modifier;
}
ailment_UI_entity.draw_static(ailment, monster.ailment_static_UI, ailment_position_on_screen, opacity_scale);
end
end
@@ -763,116 +773,121 @@ function ailments.draw_highlighted(monster, ailments_position_on_screen, opacity
for id, ailment in pairs(monster.ailments) do
if id == ailments.paralyze_id then
if not cached_config.filter.paralysis then
goto continue;
goto continue
end
elseif id == ailments.sleep_id then
if not cached_config.filter.sleep then
goto continue;
goto continue
end
elseif id == ailments.stun_id then
if not cached_config.filter.stun then
goto continue;
goto continue
end
elseif id == ailments.flash_id then
if not cached_config.filter.flash then
goto continue;
goto continue
end
elseif id == ailments.poison_id then
if not cached_config.filter.poison then
goto continue;
goto continue
end
elseif id == ailments.blast_id then
if not cached_config.filter.blast then
goto continue;
goto continue
end
elseif id == ailments.exhaust_id then
if not cached_config.filter.exhaust then
goto continue;
goto continue
end
elseif id == ailments.ride_id then
if not cached_config.filter.ride then
goto continue;
goto continue
end
elseif id == ailments.water_id then
if not cached_config.filter.waterblight then
goto continue;
goto continue
end
elseif id == ailments.fire_id then
if not cached_config.filter.fireblight then
goto continue;
goto continue
end
elseif id == ailments.ice_id then
if not cached_config.filter.iceblight then
goto continue;
goto continue
end
elseif id == ailments.thunder_id then
if not cached_config.filter.thunderblight then
goto continue;
goto continue
end
elseif id == ailments.fall_trap_id then
if not cached_config.filter.fall_trap then
goto continue;
goto continue
end
elseif id == ailments.shock_trap_id then
if not cached_config.filter.shock_trap then
goto continue;
goto continue
end
elseif id == ailments.capture_id then
if not cached_config.filter.tranq_bomb then
goto continue;
goto continue
end
elseif id == ailments.koyashi_id then
if not cached_config.filter.dung_bomb then
goto continue;
goto continue
end
elseif id == ailments.steel_fang_id then
if not cached_config.filter.steel_fang then
goto continue;
goto continue
end
elseif id == ailments.fall_quick_sand_id then
if not cached_config.filter.quick_sand then
goto continue;
goto continue
end
elseif id == ailments.fall_otomo_trap_id then
if not cached_config.filter.fall_otomo_trap then
goto continue;
goto continue
end
elseif id == ailments.shock_otomo_trap_id then
if not cached_config.filter.shock_otomo_trap then
goto continue;
goto continue
end
else
goto continue;
goto continue
end
if cached_config.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and ailment.buildup_limit ~= 0 and ailment.activate_count == 0 and not ailment.is_active then
goto continue;
if cached_config.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and
ailment.buildup_limit ~= 0
and ailment.activate_count == 0 and not ailment.is_active then
goto continue
end
if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and not ailment.is_active then
goto continue;
if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and
not ailment.is_active then
goto continue
end
if cached_config.settings.hide_all_inactive_ailments and not ailment.is_active then
goto continue;
goto continue
end
if cached_config.settings.hide_all_active_ailments and ailment.is_active then
goto continue;
goto continue
end
if cached_config.settings.hide_disabled_ailments and not ailment.is_enable then
goto continue;
goto continue
end
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit and not ailment.is_active then
goto continue;
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit and
not ailment.is_active then
goto continue
end
table.insert(displayed_ailments, ailment);
::continue::
end
if cached_config.sorting.type == "Normal" then
if cached_config.sorting.reversed_order then
table.sort(displayed_ailments, function(left, right)
@@ -910,7 +925,7 @@ function ailments.draw_highlighted(monster, ailments_position_on_screen, opacity
x = ailments_position_on_screen.x + cached_config.spacing.x * (j - 1) * global_scale_modifier,
y = ailments_position_on_screen.y + cached_config.spacing.y * (j - 1) * global_scale_modifier;
}
ailment_UI_entity.draw_highlighted(ailment, monster.ailment_highlighted_UI, ailment_position_on_screen, opacity_scale);
end
end
@@ -924,116 +939,121 @@ function ailments.draw_small(monster, ailments_position_on_screen, opacity_scale
for id, ailment in pairs(monster.ailments) do
if id == ailments.paralyze_id then
if not cached_config.filter.paralysis then
goto continue;
goto continue
end
elseif id == ailments.sleep_id then
if not cached_config.filter.sleep then
goto continue;
goto continue
end
elseif id == ailments.stun_id then
if not cached_config.filter.stun then
goto continue;
goto continue
end
elseif id == ailments.flash_id then
if not cached_config.filter.flash then
goto continue;
goto continue
end
elseif id == ailments.poison_id then
if not cached_config.filter.poison then
goto continue;
goto continue
end
elseif id == ailments.blast_id then
if not cached_config.filter.blast then
goto continue;
goto continue
end
elseif id == ailments.exhaust_id then
if not cached_config.filter.exhaust then
goto continue;
goto continue
end
elseif id == ailments.ride_id then
if not cached_config.filter.ride then
goto continue;
goto continue
end
elseif id == ailments.water_id then
if not cached_config.filter.waterblight then
goto continue;
goto continue
end
elseif id == ailments.fire_id then
if not cached_config.filter.fireblight then
goto continue;
goto continue
end
elseif id == ailments.ice_id then
if not cached_config.filter.iceblight then
goto continue;
goto continue
end
elseif id == ailments.thunder_id then
if not cached_config.filter.thunderblight then
goto continue;
goto continue
end
elseif id == ailments.fall_trap_id then
if not cached_config.filter.fall_trap then
goto continue;
goto continue
end
elseif id == ailments.shock_trap_id then
if not cached_config.filter.shock_trap then
goto continue;
goto continue
end
elseif id == ailments.capture_id then
if not cached_config.filter.tranq_bomb then
goto continue;
goto continue
end
elseif id == ailments.koyashi_id then
if not cached_config.filter.dung_bomb then
goto continue;
goto continue
end
elseif id == ailments.steel_fang_id then
if not cached_config.filter.steel_fang then
goto continue;
goto continue
end
elseif id == ailments.fall_quick_sand_id then
if not cached_config.filter.quick_sand then
goto continue;
goto continue
end
elseif id == ailments.fall_otomo_trap_id then
if not cached_config.filter.fall_otomo_trap then
goto continue;
goto continue
end
elseif id == ailments.shock_otomo_trap_id then
if not cached_config.filter.shock_otomo_trap then
goto continue;
goto continue
end
else
goto continue;
goto continue
end
if cached_config.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and ailment.buildup_limit ~= 0 and ailment.activate_count == 0 and not ailment.is_active then
goto continue;
if cached_config.settings.hide_ailments_with_zero_buildup and ailment.total_buildup == 0 and
ailment.buildup_limit ~= 0
and ailment.activate_count == 0 and not ailment.is_active then
goto continue
end
if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and not ailment.is_active then
goto continue;
if cached_config.settings.hide_inactive_ailments_with_no_buildup_support and ailment.buildup_limit == 0 and
not ailment.is_active then
goto continue
end
if cached_config.settings.hide_all_inactive_ailments and not ailment.is_active then
goto continue;
goto continue
end
if cached_config.settings.hide_all_active_ailments and ailment.is_active then
goto continue;
goto continue
end
if cached_config.settings.hide_disabled_ailments and not ailment.is_enable then
goto continue;
goto continue
end
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit and not ailment.is_active then
goto continue;
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - ailment.last_change_time > cached_config.settings.time_limit and
not ailment.is_active then
goto continue
end
table.insert(displayed_ailments, ailment);
::continue::
end
if cached_config.sorting.type == "Normal" then
if cached_config.sorting.reversed_order then
@@ -1087,7 +1107,8 @@ end
function ailments.apply_ailment_buildup(monster, attacker_id, ailment_type, ailment_buildup)
if monster == nil or player == nil or (ailment_type ~= ailments.poison_id and ailment_type ~= ailments.blast_id and ailment_type ~= ailments.stun_id) then
if monster == nil or player == nil or
(ailment_type ~= ailments.poison_id and ailment_type ~= ailments.blast_id and ailment_type ~= ailments.stun_id) then
return;
end
@@ -1095,9 +1116,10 @@ function ailments.apply_ailment_buildup(monster, attacker_id, ailment_type, ailm
if monster.ailments[ailment_type].buildup == nil then
monster.ailments[ailment_type].buildup = {};
end
-- accumulate this buildup for this attacker
monster.ailments[ailment_type].buildup[attacker_id] = (monster.ailments[ailment_type].buildup[attacker_id] or 0) + ailment_buildup;
monster.ailments[ailment_type].buildup[attacker_id] = (monster.ailments[ailment_type].buildup[attacker_id] or 0) +
ailment_buildup;
ailments.calculate_ailment_contribution(monster, ailment_type);
end
@@ -1150,9 +1172,9 @@ function ailments.apply_ailment_damage(monster, ailment_type, ailment_damage)
damage_object.physical_damage = 0;
damage_object.elemental_damage = 0;
damage_object.ailment_damage = damage_portion;
local attacking_player = player.get_player(attacker_id);
if attacking_player ~= nil then
player.update_damage(attacking_player, damage_source_type, true, damage_object);
end
@@ -1179,4 +1201,4 @@ function ailments.init_module()
table_helpers = require("MHR_Overlay.Misc.table_helpers");
end
return ailments;
return ailments;

View File

@@ -44,7 +44,6 @@ function body_part.new(id, name)
return part;
end
function body_part.init_dynamic_UI(part)
local cached_config = config.current_config.large_monster_UI.dynamic.body_parts;
@@ -155,7 +154,7 @@ function body_part.update_break(part, part_break_current, part_break_max, part_b
if part.break_max_count ~= part_break_max_count then
part.last_change_time = time.total_elapsed_script_seconds;
end
part.break_health = part_break_current;
part.break_max_health = part_break_max;
@@ -205,21 +204,21 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
if break_supported then
if severe_supported then
if not cached_config.filter.health_break_severe then
goto continue;
goto continue
end
else
if not cached_config.filter.health_break then
goto continue;
goto continue
end
end
else
if severe_supported then
if not cached_config.filter.health_severe then
goto continue;
goto continue
end
else
if not cached_config.filter.health then
goto continue;
goto continue
end
end
end
@@ -227,39 +226,42 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
if break_supported then
if severe_supported then
if not cached_config.filter.break_severe then
goto continue;
goto continue
end
else
if not cached_config.filter.break_ then
goto continue;
goto continue
end
end
else
if severe_supported then
if not cached_config.filter.severe then
goto continue;
goto continue
end
else
goto continue;
goto continue
end
end
end
if cached_config.settings.hide_undamaged_parts
and ((part.health == part.max_health and part.flinch_count == 0) or not health_supported)
and ((part.break_health == part.break_max_health and part.break_count == 0) or not break_supported)
and ((part.loss_health == part.loss_max_health and not part.is_severed) or not severe_supported) then
goto continue;
and ((part.health == part.max_health and part.flinch_count == 0) or not health_supported)
and ((part.break_health == part.break_max_health and part.break_count == 0) or not break_supported)
and ((part.loss_health == part.loss_max_health and not part.is_severed) or not severe_supported) then
goto continue
end
if (not part.body_part_dynamic_UI.flinch_visibility or not health_supported)
and (not part.body_part_dynamic_UI.break_visibility or not break_supported or part.break_count >= part.break_max_count)
and (not part.body_part_dynamic_UI.loss_visibility or not severe_supported or part.is_severed) then
goto continue;
and
(not part.body_part_dynamic_UI.break_visibility or not break_supported or part.break_count >= part.break_max_count
)
and (not part.body_part_dynamic_UI.loss_visibility or not severe_supported or part.is_severed) then
goto continue
end
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_script_seconds - part.last_change_time > cached_config.settings.time_limit then
goto continue;
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - part.last_change_time > cached_config.settings.time_limit then
goto continue
end
table.insert(displayed_parts, part);
@@ -387,21 +389,21 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
if break_supported then
if severe_supported then
if not cached_config.filter.health_break_severe then
goto continue;
goto continue
end
else
if not cached_config.filter.health_break then
goto continue;
goto continue
end
end
else
if severe_supported then
if not cached_config.filter.health_severe then
goto continue;
goto continue
end
else
if not cached_config.filter.health then
goto continue;
goto continue
end
end
end
@@ -409,39 +411,42 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
if break_supported then
if severe_supported then
if not cached_config.filter.break_severe then
goto continue;
goto continue
end
else
if not cached_config.filter.break_ then
goto continue;
goto continue
end
end
else
if severe_supported then
if not cached_config.filter.severe then
goto continue;
goto continue
end
else
goto continue;
goto continue
end
end
end
if cached_config.settings.hide_undamaged_parts
and ((part.health == part.max_health and part.flinch_count == 0) or not health_supported)
and ((part.break_health == part.break_max_health and part.break_count == 0) or not break_supported)
and ((part.loss_health == part.loss_max_health and not part.is_severed) or not severe_supported) then
goto continue;
and ((part.health == part.max_health and part.flinch_count == 0) or not health_supported)
and ((part.break_health == part.break_max_health and part.break_count == 0) or not break_supported)
and ((part.loss_health == part.loss_max_health and not part.is_severed) or not severe_supported) then
goto continue
end
if (not part.body_part_static_UI.flinch_visibility or not health_supported)
and (not part.body_part_static_UI.break_visibility or not break_supported or part.break_count >= part.break_max_count)
and (not part.body_part_static_UI.loss_visibility or not severe_supported or part.is_severed) then
goto continue;
and
(not part.body_part_static_UI.break_visibility or not break_supported or part.break_count >= part.break_max_count
)
and (not part.body_part_static_UI.loss_visibility or not severe_supported or part.is_severed) then
goto continue
end
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_script_seconds - part.last_change_time > cached_config.settings.time_limit then
goto continue;
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - part.last_change_time > cached_config.settings.time_limit then
goto continue
end
@@ -570,21 +575,21 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
if break_supported then
if severe_supported then
if not cached_config.filter.health_break_severe then
goto continue;
goto continue
end
else
if not cached_config.filter.health_break then
goto continue;
goto continue
end
end
else
if severe_supported then
if not cached_config.filter.health_severe then
goto continue;
goto continue
end
else
if not cached_config.filter.health then
goto continue;
goto continue
end
end
end
@@ -592,39 +597,42 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
if break_supported then
if severe_supported then
if not cached_config.filter.break_severe then
goto continue;
goto continue
end
else
if not cached_config.filter.break_ then
goto continue;
goto continue
end
end
else
if severe_supported then
if not cached_config.filter.severe then
goto continue;
goto continue
end
else
goto continue;
goto continue
end
end
end
if cached_config.settings.hide_undamaged_parts
and ((part.health == part.max_health and part.flinch_count == 0) or not health_supported)
and ((part.break_health == part.break_max_health and part.break_count == 0) or not break_supported)
and ((part.loss_health == part.loss_max_health and not part.is_severed) or not severe_supported) then
goto continue;
and ((part.health == part.max_health and part.flinch_count == 0) or not health_supported)
and ((part.break_health == part.break_max_health and part.break_count == 0) or not break_supported)
and ((part.loss_health == part.loss_max_health and not part.is_severed) or not severe_supported) then
goto continue
end
if (not part.body_part_highlighted_UI.flinch_visibility or not health_supported)
and (not part.body_part_highlighted_UI.break_visibility or not break_supported or part.break_count >= part.break_max_count)
and (not part.body_part_highlighted_UI.loss_visibility or not severe_supported or part.is_severed) then
goto continue;
and (
not part.body_part_highlighted_UI.break_visibility or not break_supported or part.break_count >= part.break_max_count
)
and (not part.body_part_highlighted_UI.loss_visibility or not severe_supported or part.is_severed) then
goto continue
end
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_script_seconds - part.last_change_time > cached_config.settings.time_limit then
goto continue;
if cached_config.settings.time_limit ~= 0 and
time.total_elapsed_script_seconds - part.last_change_time > cached_config.settings.time_limit then
goto continue
end
table.insert(displayed_parts, part);
@@ -753,4 +761,4 @@ function body_part.init_module()
time = require("MHR_Overlay.Game_Handler.time");
end
return body_part;
return body_part;

View File

@@ -147,7 +147,7 @@ function large_monster.init(monster, enemy)
if enemy_name ~= nil then
monster.name = enemy_name;
end
local set_info = get_set_info_method:call(enemy);
if set_info ~= nil then
local unique_id = get_unique_id_method:call(set_info);
@@ -204,10 +204,14 @@ function large_monster.init_dynamic_UI(monster)
cached_config.health.percentage_label
);
monster.health_dynamic_UI.bar.capture_line.offset.x = monster.health_dynamic_UI.bar.capture_line.offset.x * global_scale_modifier;
monster.health_dynamic_UI.bar.capture_line.offset.y = monster.health_dynamic_UI.bar.capture_line.offset.y * global_scale_modifier;
monster.health_dynamic_UI.bar.capture_line.size.width = monster.health_dynamic_UI.bar.capture_line.size.width * global_scale_modifier;
monster.health_dynamic_UI.bar.capture_line.size.height = monster.health_dynamic_UI.bar.capture_line.size.height * global_scale_modifier;
monster.health_dynamic_UI.bar.capture_line.offset.x = monster.health_dynamic_UI.bar.capture_line.offset.x *
global_scale_modifier;
monster.health_dynamic_UI.bar.capture_line.offset.y = monster.health_dynamic_UI.bar.capture_line.offset.y *
global_scale_modifier;
monster.health_dynamic_UI.bar.capture_line.size.width = monster.health_dynamic_UI.bar.capture_line.size.width *
global_scale_modifier;
monster.health_dynamic_UI.bar.capture_line.size.height = monster.health_dynamic_UI.bar.capture_line.size.height *
global_scale_modifier;
monster.health_dynamic_UI.bar.colors = cached_config.health.bar.normal_colors;
@@ -251,7 +255,7 @@ function large_monster.init_static_UI(monster)
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
monster.static_name_label = table_helpers.deep_copy(cached_config.monster_name_label);
monster.static_name_label.offset.x = monster.static_name_label.offset.x * global_scale_modifier;
monster.static_name_label.offset.y = monster.static_name_label.offset.y * global_scale_modifier;
@@ -263,10 +267,14 @@ function large_monster.init_static_UI(monster)
cached_config.health.percentage_label
);
monster.health_static_UI.bar.capture_line.offset.x = monster.health_static_UI.bar.capture_line.offset.x * global_scale_modifier;
monster.health_static_UI.bar.capture_line.offset.y = monster.health_static_UI.bar.capture_line.offset.y * global_scale_modifier;
monster.health_static_UI.bar.capture_line.size.width = monster.health_static_UI.bar.capture_line.size.width * global_scale_modifier;
monster.health_static_UI.bar.capture_line.size.height = monster.health_static_UI.bar.capture_line.size.height * global_scale_modifier;
monster.health_static_UI.bar.capture_line.offset.x = monster.health_static_UI.bar.capture_line.offset.x *
global_scale_modifier;
monster.health_static_UI.bar.capture_line.offset.y = monster.health_static_UI.bar.capture_line.offset.y *
global_scale_modifier;
monster.health_static_UI.bar.capture_line.size.width = monster.health_static_UI.bar.capture_line.size.width *
global_scale_modifier;
monster.health_static_UI.bar.capture_line.size.height = monster.health_static_UI.bar.capture_line.size.height *
global_scale_modifier;
monster.health_static_UI.bar.colors = cached_config.health.bar.normal_colors;
@@ -278,7 +286,7 @@ function large_monster.init_static_UI(monster)
cached_config.stamina.percentage_label,
cached_config.stamina.timer_label
);
monster.rage_static_UI = rage_UI_entity.new(
cached_config.rage.visibility,
cached_config.rage.bar,
@@ -287,7 +295,7 @@ function large_monster.init_static_UI(monster)
cached_config.rage.percentage_label,
cached_config.rage.timer_label
);
for REpart, part in pairs(monster.parts) do
body_part.init_static_UI(part);
end
@@ -319,10 +327,14 @@ function large_monster.init_highlighted_UI(monster)
cached_config.health.percentage_label
);
monster.health_highlighted_UI.bar.capture_line.offset.x = monster.health_highlighted_UI.bar.capture_line.offset.x * global_scale_modifier;
monster.health_highlighted_UI.bar.capture_line.offset.y = monster.health_highlighted_UI.bar.capture_line.offset.y * global_scale_modifier;
monster.health_highlighted_UI.bar.capture_line.size.width = monster.health_highlighted_UI.bar.capture_line.size.width * global_scale_modifier;
monster.health_highlighted_UI.bar.capture_line.size.height = monster.health_highlighted_UI.bar.capture_line.size.height * global_scale_modifier;
monster.health_highlighted_UI.bar.capture_line.offset.x = monster.health_highlighted_UI.bar.capture_line.offset.x *
global_scale_modifier;
monster.health_highlighted_UI.bar.capture_line.offset.y = monster.health_highlighted_UI.bar.capture_line.offset.y *
global_scale_modifier;
monster.health_highlighted_UI.bar.capture_line.size.width = monster.health_highlighted_UI.bar.capture_line.size.width *
global_scale_modifier;
monster.health_highlighted_UI.bar.capture_line.size.height = monster.health_highlighted_UI.bar.capture_line.size.height
* global_scale_modifier;
monster.health_highlighted_UI.bar.colors = cached_config.health.bar.normal_colors;
@@ -334,7 +346,7 @@ function large_monster.init_highlighted_UI(monster)
cached_config.stamina.percentage_label,
cached_config.stamina.timer_label
);
monster.rage_highlighted_UI = rage_UI_entity.new(
cached_config.rage.visibility,
cached_config.rage.bar,
@@ -343,7 +355,7 @@ function large_monster.init_highlighted_UI(monster)
cached_config.rage.percentage_label,
cached_config.rage.timer_label
);
for REpart, part in pairs(monster.parts) do
body_part.init_highlighted_UI(part);
end
@@ -402,7 +414,8 @@ local get_mario_player_index_method = mario_param_type:get_method("get_MarioPlay
local get_pos_field = enemy_character_base_type_def:get_method("get_Pos");
function large_monster.update_position(enemy, monster)
if not config.current_config.large_monster_UI.dynamic.enabled and config.current_config.large_monster_UI.static.sorting.type ~= "Distance" then
if not config.current_config.large_monster_UI.dynamic.enabled and
config.current_config.large_monster_UI.static.sorting.type ~= "Distance" then
return;
end
@@ -427,15 +440,15 @@ function large_monster.update_all_riders()
end
end
end
end
function large_monster.update(enemy, monster)
local cached_config = config.current_config.large_monster_UI;
if not cached_config.dynamic.enabled
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
return;
end
@@ -445,21 +458,21 @@ function large_monster.update(enemy, monster)
monster.is_disp_icon_mini_map = (is_disp_icon_mini_map == nil and false) or is_disp_icon_mini_map;
ailments.update_ailments(enemy, monster);
end
function large_monster.update_health(enemy, monster)
local cached_config = config.current_config.large_monster_UI;
if not cached_config.dynamic.enabled
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
return;
end
if not cached_config.dynamic.health.visibility
and not cached_config.static.health.visibility
and not cached_config.highlighted.health.visibility then
and not cached_config.static.health.visibility
and not cached_config.highlighted.health.visibility then
return nil;
end
@@ -492,14 +505,14 @@ function large_monster.update_stamina(enemy, monster, stamina_param)
local cached_config = config.current_config.large_monster_UI;
if not cached_config.dynamic.enabled
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
return;
end
if not cached_config.dynamic.stamina.visibility
and not cached_config.static.stamina.visibility
and not cached_config.highlighted.stamina.visibility then
and not cached_config.static.stamina.visibility
and not cached_config.highlighted.stamina.visibility then
return;
end
@@ -516,11 +529,11 @@ function large_monster.update_stamina(enemy, monster, stamina_param)
monster.is_tired = is_tired;
end
monster.stamina = get_stamina_method:call(stamina_param) or monster.stamina;
monster.max_stamina = get_max_stamina_method:call(stamina_param) or monster.max_stamina;
monster.stamina = get_stamina_method:call(stamina_param) or monster.stamina;
monster.max_stamina = get_max_stamina_method:call(stamina_param) or monster.max_stamina;
monster.missing_stamina = monster.max_stamina - monster.stamina;
if monster.max_stamina ~= 0 then
if monster.max_stamina ~= 0 then
monster.stamina_percentage = monster.stamina / monster.max_stamina;
end
end
@@ -529,14 +542,14 @@ function large_monster.update_stamina_timer(enemy, monster, stamina_param)
local cached_config = config.current_config.large_monster_UI;
if not cached_config.dynamic.enabled
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
return;
end
if not cached_config.dynamic.stamina.visibility
and not cached_config.static.stamina.visibility
and not cached_config.highlighted.stamina.visibility then
and not cached_config.static.stamina.visibility
and not cached_config.highlighted.stamina.visibility then
return;
end
@@ -576,14 +589,14 @@ function large_monster.update_rage(enemy, monster, anger_param)
local cached_config = config.current_config.large_monster_UI;
if not cached_config.dynamic.enabled
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
return;
end
if not cached_config.dynamic.rage.visibility
and not cached_config.static.rage.visibility
and not cached_config.highlighted.rage.visibility then
and not cached_config.static.rage.visibility
and not cached_config.highlighted.rage.visibility then
return;
end
@@ -597,8 +610,8 @@ function large_monster.update_rage(enemy, monster, anger_param)
monster.rage_point = get_anger_point_method:call(anger_param) or monster.rage_point;
monster.rage_limit = get_limit_anger_method:call(anger_param)or monster.rage_limit;
monster.rage_limit = get_limit_anger_method:call(anger_param) or monster.rage_limit;
if monster.rage_limit ~= 0 then
monster.rage_percentage = monster.rage_point / monster.rage_limit;
end
@@ -608,14 +621,14 @@ function large_monster.update_rage_timer(enemy, monster, anger_param)
local cached_config = config.current_config.large_monster_UI;
if not cached_config.dynamic.enabled
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
return;
end
if not cached_config.dynamic.rage.visibility
and not cached_config.static.rage.visibility
and not cached_config.highlighted.rage.visibility then
and not cached_config.static.rage.visibility
and not cached_config.highlighted.rage.visibility then
return;
end
@@ -631,7 +644,7 @@ function large_monster.update_rage_timer(enemy, monster, anger_param)
if is_in_rage ~= nil then
monster.is_in_rage = is_in_rage;
end
monster.rage_timer = get_remaining_anger_time_method:call(anger_param) or monster.rage_timer;
monster.rage_duration = get_total_anger_time_method:call(anger_param) or monster.rage_duration;
@@ -654,26 +667,26 @@ function large_monster.update_parts(enemy, monster, physical_param)
local cached_config = config.current_config.large_monster_UI;
if not cached_config.dynamic.enabled
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
and not cached_config.static.enabled
and not cached_config.highlighted.enabled then
return;
end
if not cached_config.dynamic.body_parts.visibility
and not cached_config.static.body_parts.visibility
and not cached_config.highlighted.body_parts.visibility then
and not cached_config.static.body_parts.visibility
and not cached_config.highlighted.body_parts.visibility then
return;
end
if not cached_config.dynamic.body_parts.part_health.visibility
and not cached_config.dynamic.body_parts.part_break.visibility
and not cached_config.dynamic.body_parts.part_loss.visibility
and not cached_config.static.body_parts.part_health.visibility
and not cached_config.static.body_parts.part_break.visibility
and not cached_config.static.body_parts.part_loss.visibility
and not cached_config.highlighted.body_parts.part_health.visibility
and not cached_config.highlighted.body_parts.part_break.visibility
and not cached_config.highlighted.body_parts.part_loss.visibility then
and not cached_config.dynamic.body_parts.part_break.visibility
and not cached_config.dynamic.body_parts.part_loss.visibility
and not cached_config.static.body_parts.part_health.visibility
and not cached_config.static.body_parts.part_break.visibility
and not cached_config.static.body_parts.part_loss.visibility
and not cached_config.highlighted.body_parts.part_health.visibility
and not cached_config.highlighted.body_parts.part_break.visibility
and not cached_config.highlighted.body_parts.part_loss.visibility then
return;
end
@@ -708,34 +721,34 @@ function large_monster.update_parts(enemy, monster, physical_param)
local part_id = 1;
for i = 0, enemy_parts_info_array_size - 1 do
local enemy_parts_info = enemy_parts_info_array[i];
local part = monster.parts[part_id];
if part == nil then
local part_name = part_names.get_part_name(monster.id, part_id);
if part_name == nil then
goto continue;
goto continue
else
part = body_part.new(part_id, part_name);
monster.parts[part_id] = part;
end
end
if cached_config.dynamic.body_parts.part_health.visibility
or cached_config.static.body_parts.part_health.visibility
or cached_config.highlighted.body_parts.part_health.visibility then
or cached_config.static.body_parts.part_health.visibility
or cached_config.highlighted.body_parts.part_health.visibility then
local part_vital = physical_param:call("getVital", 1, i);
if part_vital ~= nil then
local part_current = part_vital:call("get_Current") or -1;
local part_max = part_vital:call("get_Max") or -1;
body_part.update_flinch(part, part_current, part_max);
end
end
if cached_config.dynamic.body_parts.part_break.visibility
or cached_config.static.body_parts.part_break.visibility
or cached_config.highlighted.body_parts.part_break.visibility then
or cached_config.static.body_parts.part_break.visibility
or cached_config.highlighted.body_parts.part_break.visibility then
local part_break_vital = physical_param:call("getVital", 2, i);
if part_break_vital ~= nil then
local part_break_current = part_break_vital:call("get_Current") or -1;
@@ -747,14 +760,14 @@ function large_monster.update_parts(enemy, monster, physical_param)
part_break_count = enemy_parts_info:call("get_PartsBreakDamageLevel") or part_break_count;
part_break_max_count = enemy_parts_info:call("get_PartsBreakDamageMaxLevel") or part_break_max_count;
end
body_part.update_break(part, part_break_current, part_break_max, part_break_count, part_break_max_count)
end
end
if cached_config.dynamic.body_parts.part_loss.visibility
or cached_config.static.body_parts.part_loss.visibility
or cached_config.highlighted.body_parts.part_loss.visibility then
or cached_config.static.body_parts.part_loss.visibility
or cached_config.highlighted.body_parts.part_loss.visibility then
local part_loss_vital = physical_param:call("getVital", 3, i);
if part_loss_vital ~= nil then
local part_loss_current = part_loss_vital:call("get_Current") or -1;
@@ -767,11 +780,11 @@ function large_monster.update_parts(enemy, monster, physical_param)
is_severed = _is_severed;
end
end
body_part.update_loss(part, part_loss_current, part_loss_max, is_severed)
end
end
part_id = part_id + 1;
::continue::
end
@@ -799,7 +812,7 @@ function large_monster.draw_dynamic(monster, position_on_screen, opacity_scale)
if cached_config.monster_name_label.include.scrown_thresholds then
monster_name_text = monster_name_text .. string.format("<=%.0f >=%.0f >=%.0f", 100 * monster.small_border,
100 * monster.big_border, 100 * monster.king_border);
100 * monster.big_border, 100 * monster.king_border);
end
if monster.health < monster.capture_health then
@@ -839,21 +852,26 @@ function large_monster.draw_dynamic(monster, position_on_screen, opacity_scale)
x = position_on_screen.x + cached_config.ailment_buildups.offset.x * global_scale_modifier,
y = position_on_screen.y + cached_config.ailment_buildups.offset.y * global_scale_modifier
};
health_UI_entity.draw(monster, monster.health_dynamic_UI, health_position_on_screen, opacity_scale);
drawing.draw_capture_line(monster.health_dynamic_UI, health_position_on_screen, opacity_scale, monster.capture_percentage);
drawing.draw_capture_line(monster.health_dynamic_UI, health_position_on_screen, opacity_scale,
monster.capture_percentage);
stamina_UI_entity.draw(monster, monster.stamina_dynamic_UI, stamina_position_on_screen, opacity_scale);
rage_UI_entity.draw(monster, monster.rage_dynamic_UI, rage_position_on_screen, opacity_scale);
local last_part_position_on_screen = body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale);
local last_part_position_on_screen = body_part.draw_dynamic(monster,
parts_position_on_screen
, opacity_scale);
if cached_config.ailments.settings.offset_is_relative_to_parts then
if last_part_position_on_screen ~= nil then
ailments_position_on_screen = {
x = last_part_position_on_screen.x + config.current_config.large_monster_UI.highlighted.ailments.relative_offset.x * global_scale_modifier,
y = last_part_position_on_screen.y + config.current_config.large_monster_UI.highlighted.ailments.relative_offset.y * global_scale_modifier
x = last_part_position_on_screen.x +
config.current_config.large_monster_UI.highlighted.ailments.relative_offset.x * global_scale_modifier,
y = last_part_position_on_screen.y +
config.current_config.large_monster_UI.highlighted.ailments.relative_offset.y * global_scale_modifier
};
end
end
@@ -884,7 +902,7 @@ function large_monster.draw_static(monster, position_on_screen, opacity_scale)
if cached_config.monster_name_label.include.scrown_thresholds then
monster_name_text = monster_name_text .. string.format("<=%.0f >=%.0f >=%.0f", 100 * monster.small_border,
100 * monster.big_border, 100 * monster.king_border);
100 * monster.big_border, 100 * monster.king_border);
end
if monster.health < monster.capture_health then
@@ -932,7 +950,9 @@ function large_monster.draw_static(monster, position_on_screen, opacity_scale)
stamina_UI_entity.draw(monster, monster.stamina_static_UI, stamina_position_on_screen, opacity_scale);
rage_UI_entity.draw(monster, monster.rage_static_UI, rage_position_on_screen, opacity_scale);
local last_part_position_on_screen = body_part.draw_static(monster, parts_position_on_screen, opacity_scale);
local last_part_position_on_screen = body_part.draw_static(monster,
parts_position_on_screen
, opacity_scale);
if cached_config.ailments.settings.offset_is_relative_to_parts then
if last_part_position_on_screen ~= nil then
@@ -969,7 +989,7 @@ function large_monster.draw_highlighted(monster, position_on_screen, opacity_sca
if cached_config.monster_name_label.include.scrown_thresholds then
monster_name_text = monster_name_text .. string.format("<=%.0f >=%.0f >=%.0f", 100 * monster.small_border,
100 * monster.big_border, 100 * monster.king_border);
100 * monster.big_border, 100 * monster.king_border);
end
if monster.health < monster.capture_health then
@@ -1011,12 +1031,15 @@ function large_monster.draw_highlighted(monster, position_on_screen, opacity_sca
};
health_UI_entity.draw(monster, monster.health_highlighted_UI, health_position_on_screen, opacity_scale);
drawing.draw_capture_line(monster.health_highlighted_UI, health_position_on_screen, opacity_scale, monster.capture_percentage);
drawing.draw_capture_line(monster.health_highlighted_UI, health_position_on_screen, opacity_scale,
monster.capture_percentage);
stamina_UI_entity.draw(monster, monster.stamina_highlighted_UI, stamina_position_on_screen, opacity_scale);
rage_UI_entity.draw(monster, monster.rage_highlighted_UI, rage_position_on_screen, opacity_scale);
local last_part_position_on_screen = body_part.draw_highlighted(monster, parts_position_on_screen, opacity_scale);
local last_part_position_on_screen = body_part.draw_highlighted(monster,
parts_position_on_screen
, opacity_scale);
if cached_config.ailments.settings.offset_is_relative_to_parts then
if last_part_position_on_screen ~= nil then
@@ -1031,7 +1054,7 @@ function large_monster.draw_highlighted(monster, position_on_screen, opacity_sca
ailment_buildup.draw_highlighted(monster, ailment_buildups_position_on_screen, opacity_scale);
end
function large_monster.init_list()
function large_monster.init_list()
large_monster.list = {};
end
@@ -1056,4 +1079,4 @@ function large_monster.init_module()
ailment_buildup = require("MHR_Overlay.Monsters.ailment_buildup");
end
return large_monster;
return large_monster;

View File

@@ -37,19 +37,19 @@ local updates_this_tick = 0;
-- the reason for this is that the hooks on all the monsters' update functions
-- causes a HUGE performance hit (adds ~3+ ms to UpdateBehavior and frame time)
re.on_pre_application_entry("UpdateBehavior", function()
tick_count = tick_count + 1;
tick_count = tick_count + 1;
updates_this_tick = 0;
if num_known_monsters ~= 0 and num_updated_monsters >= num_known_monsters or tick_count >= num_known_monsters * 2 then
recorded_monsters = {};
updated_monsters = {};
if num_known_monsters ~= 0 and num_updated_monsters >= num_known_monsters or tick_count >= num_known_monsters * 2 then
recorded_monsters = {};
updated_monsters = {};
known_big_monsters = {};
last_update_tick = 0;
tick_count = 0;
num_known_monsters = 0;
num_updated_monsters = 0;
last_update_tick = 0;
tick_count = 0;
num_known_monsters = 0;
num_updated_monsters = 0;
updates_this_tick = 0;
end
end
end)
function monster_hook.update_monster(enemy)
@@ -57,10 +57,10 @@ function monster_hook.update_monster(enemy)
return;
end
if not recorded_monsters[enemy] then
num_known_monsters = num_known_monsters + 1;
recorded_monsters[enemy] = true;
end
if not recorded_monsters[enemy] then
num_known_monsters = num_known_monsters + 1;
recorded_monsters[enemy] = true;
end
-- saves on a method call.
if not known_big_monsters[enemy] then
@@ -83,8 +83,8 @@ function monster_hook.update_large_monster(enemy)
local cached_config = config.current_config.large_monster_UI;
if not cached_config.dynamic.enabled and
not cached_config.static.enabled and
not cached_config.highlighted.enabled then
not cached_config.static.enabled and
not cached_config.highlighted.enabled then
return;
end
@@ -101,7 +101,8 @@ function monster_hook.update_large_monster(enemy)
-- is it old tick?
-- is update limit reached?
if tick_count == last_update_tick and updates_this_tick >= config.current_config.global_settings.performance.max_monster_updates_per_tick then
if tick_count == last_update_tick and
updates_this_tick >= config.current_config.global_settings.performance.max_monster_updates_per_tick then
return;
end
@@ -142,7 +143,8 @@ function monster_hook.update_small_monster(enemy)
-- is it old tick?
-- is update limit reached?
if tick_count == last_update_tick and updates_this_tick >= config.current_config.global_settings.performance.max_monster_updates_per_tick then
if tick_count == last_update_tick and
updates_this_tick >= config.current_config.global_settings.performance.max_monster_updates_per_tick then
return;
end
@@ -171,10 +173,10 @@ function monster_hook.update_health(enemy_damage_stock_param)
if is_large == nil then
return;
end
if is_large then
local monster = large_monster.get_monster(enemy);
local physical_param = large_monster.update_health(enemy, monster);
large_monster.update_parts(enemy, monster, physical_param);
@@ -244,10 +246,11 @@ function monster_hook.init_module()
end);
sdk.hook(anger_add_method, function(args)
pcall(monster_hook.update_rage, sdk.to_managed_object(args[2]), sdk.to_float(args[3]), sdk.to_managed_object(args[4]));
pcall(monster_hook.update_rage, sdk.to_managed_object(args[2]), sdk.to_float(args[3]),
sdk.to_managed_object(args[4]));
end, function(retval)
return retval;
end);
end
return monster_hook;
return monster_hook;

View File

@@ -29,7 +29,7 @@ function small_monster.new(enemy)
monster.name = "Small Monster";
monster.ailments = ailments.init_ailments();
small_monster.init(monster, enemy);
small_monster.init_UI(monster);
@@ -118,7 +118,7 @@ local get_pos_field = enemy_character_base_type_def:get_method("get_Pos");
function small_monster.update_position(enemy, monster)
local cached_config = config.current_config.small_monster_UI;
if not cached_config.enabled then
return;
end
@@ -197,7 +197,7 @@ function small_monster.draw(monster, position_on_screen, opacity_scale)
ailment_buildup.draw_small(monster, ailment_buildups_position_on_screen, opacity_scale);
end
function small_monster.init_list()
function small_monster.init_list()
small_monster.list = {};
end
@@ -215,4 +215,4 @@ function small_monster.init_module()
ailment_buildup = require("MHR_Overlay.Monsters.ailment_buildup");
end
return small_monster;
return small_monster;