Skip to content

Commit

Permalink
[Gear] Fix Heal/Absorb Target Cache Issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Saeldur committed Nov 23, 2024
1 parent 01f83b5 commit 5026519
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
17 changes: 8 additions & 9 deletions engine/action/absorb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,15 @@ 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<absorb_buff_t>(s->target, name_str, &data());
auto buff = make_buff<absorb_buff_t>( actor_pair_t( s->target, player ), name_str, &data() );
buff->set_absorb_source(stats_obj);

return buff;
}

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)
Expand Down Expand Up @@ -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<player_t*>& target_list) const
size_t absorb_t::available_targets( std::vector<player_t*>& 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();
Expand Down
3 changes: 2 additions & 1 deletion engine/action/heal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,8 @@ int heal_t::num_targets() const
size_t heal_t::available_targets( std::vector<player_t*>& 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 )
{
Expand Down
6 changes: 6 additions & 0 deletions engine/player/unique_gear_thewarwithin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6160,10 +6160,12 @@ struct damage_citrine_t : citrine_base_t<generic_proc_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() );
}

Expand All @@ -6185,6 +6187,8 @@ struct heal_citrine_t : citrine_base_t<generic_heal_t>
{
if ( target->is_enemy() )
{
target = player;
target_cache.is_valid = false;
target = rng().range( target_list() );
}

Expand All @@ -6205,6 +6209,8 @@ struct absorb_citrine_t : citrine_base_t<absorb_t>
{
if ( target->is_enemy() )
{
target = player;
target_cache.is_valid = false;
target = rng().range( target_list() );
}

Expand Down

0 comments on commit 5026519

Please sign in to comment.