From 502651937c24d101887c1605eb25b00ffb3b6127 Mon Sep 17 00:00:00 2001 From: Saeldur <5496498+Saeldur@users.noreply.github.com> Date: Sat, 23 Nov 2024 11:24:22 +0000 Subject: [PATCH] [Gear] Fix Heal/Absorb Target Cache Issues --- engine/action/absorb.cpp | 17 ++++++++--------- engine/action/heal.cpp | 3 ++- engine/player/unique_gear_thewarwithin.cpp | 6 ++++++ 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/engine/action/absorb.cpp b/engine/action/absorb.cpp index 3c20efb9b31..6f75fcaba4f 100644 --- a/engine/action/absorb.cpp +++ b/engine/action/absorb.cpp @@ -42,7 +42,7 @@ absorb_buff_t* absorb_t::create_buff(const action_state_t* s) // Add absorb target stats as a child to the main stats object for reporting stats->add_child(stats_obj); } - auto buff = make_buff(s->target, name_str, &data()); + auto buff = make_buff( actor_pair_t( s->target, player ), name_str, &data() ); buff->set_absorb_source(stats_obj); return buff; @@ -50,9 +50,7 @@ absorb_buff_t* absorb_t::create_buff(const action_state_t* s) void absorb_t::activate() { - sim->player_non_sleeping_list.register_callback([this](player_t*) { - target_cache.is_valid = false; - }); + sim->player_non_sleeping_list.register_callback( [ this ]( player_t* ) { target_cache.is_valid = false; } ); } void absorb_t::impact(action_state_t* s) @@ -116,15 +114,16 @@ double absorb_t::composite_versatility(const action_state_t* state) const return spell_base_t::composite_versatility(state) + player->cache.heal_versatility(); } -size_t absorb_t::available_targets(std::vector& target_list) const +size_t absorb_t::available_targets( std::vector& target_list ) const { target_list.clear(); - target_list.push_back(target); + if ( !target->is_sleeping() ) + target_list.push_back( target ); - for (const auto& t : sim->player_non_sleeping_list) + for ( const auto& t : sim->player_non_sleeping_list ) { - if (t != target) - target_list.push_back(t); + if ( t != target ) + target_list.push_back( t ); } return target_list.size(); diff --git a/engine/action/heal.cpp b/engine/action/heal.cpp index 80bbe9999da..36b04313667 100644 --- a/engine/action/heal.cpp +++ b/engine/action/heal.cpp @@ -427,7 +427,8 @@ int heal_t::num_targets() const size_t heal_t::available_targets( std::vector& target_list ) const { target_list.clear(); - target_list.push_back( target ); + if ( !target->is_sleeping() ) + target_list.push_back( target ); for ( const auto& t : sim->player_non_sleeping_list ) { diff --git a/engine/player/unique_gear_thewarwithin.cpp b/engine/player/unique_gear_thewarwithin.cpp index 079c3b26737..df70ac999bc 100644 --- a/engine/player/unique_gear_thewarwithin.cpp +++ b/engine/player/unique_gear_thewarwithin.cpp @@ -6160,10 +6160,12 @@ struct damage_citrine_t : citrine_base_t if ( has_role_mult( e.player, driver_spell ) ) this->base_multiplier *= role_mult( e.player, driver_spell ); } + void execute() override { if ( !target->is_enemy() ) { + target_cache.is_valid = false; target = rng().range( target_list() ); } @@ -6185,6 +6187,8 @@ struct heal_citrine_t : citrine_base_t { if ( target->is_enemy() ) { + target = player; + target_cache.is_valid = false; target = rng().range( target_list() ); } @@ -6205,6 +6209,8 @@ struct absorb_citrine_t : citrine_base_t { if ( target->is_enemy() ) { + target = player; + target_cache.is_valid = false; target = rng().range( target_list() ); }