diff --git a/reframework/autorun/MHR_Overlay/Damage_Meter/damage_hook.lua b/reframework/autorun/MHR_Overlay/Damage_Meter/damage_hook.lua index ec43116..fc7db5b 100644 --- a/reframework/autorun/MHR_Overlay/Damage_Meter/damage_hook.lua +++ b/reframework/autorun/MHR_Overlay/Damage_Meter/damage_hook.lua @@ -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("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("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) diff --git a/reframework/autorun/MHR_Overlay/Monsters/ailment_buildup.lua b/reframework/autorun/MHR_Overlay/Monsters/ailment_buildup.lua index 71e2b1f..68e5b95 100644 --- a/reframework/autorun/MHR_Overlay/Monsters/ailment_buildup.lua +++ b/reframework/autorun/MHR_Overlay/Monsters/ailment_buildup.lua @@ -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 diff --git a/reframework/autorun/MHR_Overlay/Monsters/ailments.lua b/reframework/autorun/MHR_Overlay/Monsters/ailments.lua index 87afbaa..b05b5cb 100644 --- a/reframework/autorun/MHR_Overlay/Monsters/ailments.lua +++ b/reframework/autorun/MHR_Overlay/Monsters/ailments.lua @@ -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 = {}; diff --git a/reframework/autorun/MHR_Overlay/UI/UI_Entities/ailment_buildup_UI_entity.lua b/reframework/autorun/MHR_Overlay/UI/UI_Entities/ailment_buildup_UI_entity.lua index 9054c73..43ee50b 100644 --- a/reframework/autorun/MHR_Overlay/UI/UI_Entities/ailment_buildup_UI_entity.lua +++ b/reframework/autorun/MHR_Overlay/UI/UI_Entities/ailment_buildup_UI_entity.lua @@ -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()