Skip to content

Commit

Permalink
Revert "[Player] use range( vector ) helper"
Browse files Browse the repository at this point in the history
This reverts commit bea2093.
  • Loading branch information
gastank committed Sep 25, 2024
1 parent bea2093 commit 54c345a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion engine/player/pet_spawner_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,8 @@ T* pet_spawner_t<T, O>::replacement_pet()
case pet_replacement_strategy::REPLACE_OLDEST:
return active_pet_min_remains();
case pet_replacement_strategy::REPLACE_RANDOM:
return m_owner->rng().range( m_active_pets );
return m_active_pets[ static_cast<unsigned>(
m_owner->rng().range( 0.0, as<double>( m_active_pets.size() ) ) ) ];
default:
return nullptr;
}
Expand Down
9 changes: 6 additions & 3 deletions engine/player/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8840,7 +8840,8 @@ struct ancestral_call_t : public racial_spell_t
{
racial_spell_t::execute();

rng().range( player->buffs.ancestral_call )->trigger();
auto& buffs = player->buffs.ancestral_call;
buffs[ rng().range( buffs.size() ) ] -> trigger();
}
};

Expand Down Expand Up @@ -13700,15 +13701,17 @@ action_t* player_t::select_action( const action_priority_list_t& list,

if ( list.random == 1 )
{
a = rng().range( a_list );
size_t random = rng().range( a_list.size() );
a = a_list[ random ];
}
else
{
double skill = list.player->current.skill - list.player->current.skill_debuff;
if ( skill != 1 && rng().roll( ( 1 - skill ) * 0.5 ) )
{
size_t max_random_attempts = static_cast<size_t>( a_list.size() * ( skill * 0.5 ) );
a = rng().range( a_list );
size_t random = rng().range( a_list.size() );
a = a_list[ random ];
attempted_random++;
// Limit the amount of attempts to select a random action based on skill, then bail out and try again in 100
// ms.
Expand Down

0 comments on commit 54c345a

Please sign in to comment.