3 Commits

Author SHA1 Message Date
GreenComfyTea
673bf28451 Fix Ailment Buildup UI 2022-11-23 13:35:16 +02:00
GreenComfyTea
2dde202501 Hide Large Monster Dynamic UI when in stealth 2022-11-23 12:06:00 +02:00
GreenComfyTea
ed6f59655c Implement proper tracking of monster capturability 2022-11-23 11:29:16 +02:00
6 changed files with 87 additions and 21 deletions

View File

@@ -21,6 +21,8 @@ local get_total_damage_method = enemy_calc_damage_info_type_def:get_method("get_
local get_physical_damage_method = enemy_calc_damage_info_type_def:get_method("get_PhysicalDamage");
local get_elemental_damage_method = enemy_calc_damage_info_type_def:get_method("get_ElementDamage");
local stun_damage_field = enemy_calc_damage_info_type_def:get_field("<StunDamage>k__BackingField");
local get_condition_damage_method = enemy_calc_damage_info_type_def:get_method("get_ConditionDamage");
local get_condition_type_method = enemy_calc_damage_info_type_def:get_method("get_ConditionDamageType");
local get_condition_damage2_method = enemy_calc_damage_info_type_def:get_method("get_ConditionDamage2");
@@ -174,18 +176,17 @@ function damage_hook.update_damage(enemy, enemy_calc_damage_info)
monster = small_monster.get_monster(enemy);
end
local stun_damage = enemy_calc_damage_info:get_field("<StunDamage>k__BackingField");
if stun_damage ~= 0 and stun_damage ~= nil then
local stun_damage = stun_damage_field:get_data(enemy_calc_damage_info);
if attacking_player ~= nil then
ailments.apply_ailment_buildup(monster, attacker_id, ailments.stun_id, stun_damage);
end
ailments.apply_ailment_buildup(monster, attacker_id, condition_type, condition_damage);
ailments.apply_ailment_buildup(monster, attacker_id, condition_type2, condition_damage2);
ailments.apply_ailment_buildup(monster, attacker_id, condition_type3, condition_damage3);
ailments.apply_ailment_buildup(monster, attacker_id, condition_type, condition_damage);
ailments.apply_ailment_buildup(monster, attacker_id, condition_type2, condition_damage2);
ailments.apply_ailment_buildup(monster, attacker_id, condition_type3, condition_damage3);
end
player.update_damage(player.total, damage_source_type, is_large_monster, damage_object);
player.update_damage(attacking_player, damage_source_type, is_large_monster, damage_object);
end
--function damage_hook.on_mystery_core_break(enemy)

View File

@@ -116,7 +116,6 @@ function ailment_buildup.draw(monster, ailment_buildup_UI, cached_config, ailmen
};
ailment_buildup_UI_entity.draw(_player, ailment_buildup_UI, cached_config, ailment_buildup_position_on_screen, opacity_scale, top_buildup);
last_j = j;
end

View File

@@ -595,11 +595,15 @@ end
function ailments.apply_ailment_buildup(monster, attacker_id, ailment_type, ailment_buildup)
if monster == nil or player == nil or
if monster == nil or
(ailment_type ~= ailments.poison_id and ailment_type ~= ailments.blast_id and ailment_type ~= ailments.stun_id) then
return;
end
if ailment_buildup == 0 or ailment_buildup == nil then
return;
end
-- get the buildup accumulator for this type
if monster.ailments[ailment_type].buildup == nil then
monster.ailments[ailment_type].buildup = {};

View File

@@ -35,11 +35,14 @@ function large_monster.new(enemy)
monster.health_percentage = 0;
monster.missing_health = 0;
monster.is_capturable = true;
monster.capture_health = 0;
monster.capture_percentage = 0;
monster.dead_or_captured = false;
monster.is_disp_icon_mini_map = true;
monster.is_stealth = false;
monster.can_go_stealth = false;
monster.is_tired = false;
monster.stamina = 0;
@@ -98,7 +101,6 @@ function large_monster.new(enemy)
local physical_param = large_monster.update_health(enemy, monster);
large_monster.update_stamina(enemy, monster, nil);
large_monster.update_stamina_timer(enemy, monster, nil);
@@ -153,6 +155,10 @@ function large_monster.init(monster, enemy)
monster.id = enemy_type;
if monster.id == 549 or monster.id == 25 or monster.id == 2073 then
monster.can_go_stealth = true;
end
local enemy_name = get_enemy_name_message_method:call(singletons.message_manager, enemy_type);
if enemy_name ~= nil then
monster.name = enemy_name;
@@ -198,6 +204,25 @@ function large_monster.init(monster, enemy)
monster.crown = language.current_language.UI.silver;
end
end
local is_capture_enable = true;
local damage_param = enemy:get_field("<DamageParam>k__BackingField");
if damage_param ~= nil then
local capture_param = damage_param:get_field("_CaptureParam");
if capture_param ~= nil then
local is_capture_enable_ = capture_param:call("get_IsEnable");
if is_capture_enable_ ~= nil then
is_capture_enable = is_capture_enable_;
end
end
end
local curia_param = enemy:get_field("<CuriaParam>k__BackingField");
local is_anomaly = curia_param ~= nil;
monster.is_capturable = is_capture_enable and not is_anomaly;
end
function large_monster.init_UI(monster, monster_UI, cached_config)
@@ -373,6 +398,33 @@ function large_monster.update(enemy, monster)
monster.is_disp_icon_mini_map = is_disp_icon_mini_map;
end
if monster.id == 549 or monster.id == 25 or monster.id == 2073 then
monster.can_go_stealth = true;
end
if monster.can_go_stealth then
-- Lucent Nargacuga
if monster.id == 549 then
local is_stealth = enemy:call("isStealth");
if is_stealth ~= nil then
monster.is_stealth = is_stealth;
end
-- Chameleos and Risen Chameleos
elseif monster.id == 25 or monster.id == 2073 then
local stealth_controller = enemy:call("get_StealthCtrl");
if stealth_controller ~= nil then
local status = stealth_controller:call("get_CurrentStatus");
if status >= 2 then
monster.is_stealth = true;
else
monster.is_stealth = false;
end
end
end
end
pcall(ailments.update_ailments, enemy, monster);
end
@@ -747,7 +799,7 @@ function large_monster.draw(monster, type, cached_config, position_on_screen, op
100 * monster.big_border, 100 * monster.king_border);
end
if monster.health < monster.capture_health then
if monster.is_capturable and monster.health < monster.capture_health then
monster_UI.health_UI.bar.colors = monster_UI.health_UI.bar.capture_colors;
else
monster_UI.health_UI.bar.colors = monster_UI.health_UI.bar.normal_colors;
@@ -784,7 +836,11 @@ function large_monster.draw(monster, type, cached_config, position_on_screen, op
};
health_UI_entity.draw(monster, monster_UI.health_UI, health_position_on_screen, opacity_scale);
drawing.draw_capture_line(monster_UI.health_UI, health_position_on_screen, opacity_scale, monster.capture_percentage);
if monster.is_capturable then
drawing.draw_capture_line(monster_UI.health_UI, health_position_on_screen, opacity_scale, monster.capture_percentage);
end
stamina_UI_entity.draw(monster, monster_UI.stamina_UI, stamina_position_on_screen, opacity_scale);
rage_UI_entity.draw(monster, monster_UI.rage_UI, rage_position_on_screen, opacity_scale);

View File

@@ -143,7 +143,7 @@ function large_monster_UI.draw_dynamic(displayed_monsters, highlighted_monster,
break
end
if monster.id == 549 or monster.id == 25 or monster.id == 2073 then
if monster.is_stealth then
goto continue
end

View File

@@ -55,28 +55,34 @@ function ailment_buildup_UI_entity.new(buildup_bar, highlighted_buildup_bar, ail
return entity;
end
function ailment_buildup_UI_entity.draw(_player, ailment_buildup_UI, cached_config, position_on_screen, opacity_scale, top_buildup)
function ailment_buildup_UI_entity.draw(_player_buildup, ailment_buildup_UI, cached_config, position_on_screen, opacity_scale, top_buildup)
local player_buildup_bar_percentage = 0;
if cached_config.settings.buildup_bar_relative_to == "Total Buildup" then
player_buildup_bar_percentage = _player.buildup_share;
player_buildup_bar_percentage = _player_buildup.buildup_share;
else
if top_buildup ~= 0 then
player_buildup_bar_percentage = _player.buildup / top_buildup;
player_buildup_bar_percentage = _player_buildup.buildup / top_buildup;
end
end
if _player.id == player.myself.id and cached_config.settings.highlighted_bar == "Me" then
if _player_buildup.id == player.myself.id and cached_config.settings.highlighted_bar == "Me" then
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
elseif cached_config.settings.highlighted_bar == "Top Buildup" and _player.buildup == top_buildup then
elseif cached_config.settings.highlighted_bar == "Top Buildup" and _player_buildup.buildup == top_buildup then
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
else
drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
end
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale, player.get_player(_player.id).name);
drawing.draw_label(ailment_buildup_UI.buildup_value_label, position_on_screen, opacity_scale, _player.buildup);
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale, 100 * _player.buildup_share);
local _player = player.get_player(_player_buildup.id);
local player_name = "Player " .. tostring(_player_buildup.id);
if _player ~= nil then
player_name = _player.name;
end
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale, player_name);
drawing.draw_label(ailment_buildup_UI.buildup_value_label, position_on_screen, opacity_scale, _player_buildup.buildup);
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale, 100 * _player_buildup.buildup_share);
end
function ailment_buildup_UI_entity.init_module()