Newbie HvHer
- User ID
- 63477
- Messages
- 2
- Reactions
- 1
- Level
- 4
lol maybe start free something good?
C++:
static constexpr auto max_seeds = 128u;
static constexpr auto max_awall_seeds = 48u;
bool c_rage_bot::calc_hit_chance( sdk::qang_t aim_ang )
{
if ( ( g_local_player->shoot_pos( ) - m_final_target.m_record->m_player->origin( ) ).length( ) > ( g_local_player->info( )->m_range * 1.02f ) )
return false;
build_seed_table( );
int traces_hit{}, awalls_hit{}, awall_traces_done{};
static sdk::vec3_t fwd{}, right{}, up{};
aim_ang.vectors( &fwd, &right, &up );
auto weapon_inaccuracy = g_local_player->inaccuracy( );
// if ( COERCE_INT( weapon_inaccuracy * 10000.0 ) == 0.0 )
if ( static_cast< int >( weapon_inaccuracy * 10000.f ) == 0 )
return true;
auto weapon_spread = g_local_player->spread( );
auto is_special_weapon = g_local_player->weapon_id( ) == 9
|| g_local_player->weapon_id( ) == 11
|| g_local_player->weapon_id( ) == 38
|| g_local_player->weapon_id( ) == 40;
if ( m_precomputed_seeds.empty( ) )
return false;
static std::tuple< float, float, float, float, float >* seed{};
static float c{}, spread_val{}, inaccuracy_val{};
static sdk::vec3_t v_spread{}, dir{}, end{};
float average_spread{};
// IMPORTANT - calc weapon spread not from skeet but who cares
for ( int i{}; i <= max_seeds; i++ )
{
seed = &m_precomputed_seeds[ i ];
c = std::get< 0 >( *seed );
spread_val = c * weapon_spread;
inaccuracy_val = c * weapon_inaccuracy;
v_spread = sdk::vec3_t( ( std::get< 2 >( *seed ) * spread_val ) + ( std::get< 4 >( *seed ) * inaccuracy_val ), ( std::get< 3 >( *seed ) * spread_val ) + ( std::get< 1 >( *seed ) * inaccuracy_val ), 0 );
dir.x = fwd.x + ( v_spread.x * right.x ) + ( v_spread.y * up.x );
dir.y = fwd.y + ( v_spread.x * right.y ) + ( v_spread.y * up.y );
dir.z = fwd.z + ( v_spread.x * right.z ) + ( v_spread.y * up.z );
end = g_local_player->shoot_pos( ) + ( dir * g_local_player->info( )->m_range );
// we can hit
if ( m_can_intersect )
{
++traces_hit;
if ( g_local_player->weapon_id( ) != 64 && !( is_special_weapon && !g_local_player->scoped( ) ) )
{
average_spread += inaccuracy_val;
if ( max_awall_seeds > awall_traces_done && ( i <= 5 || ( average_spread / i ) <= inaccuracy_val ) )
{
auto sucess_data = g_penetration->get_dmg( g_local_player->shoot_pos( ), end, m_final_target.m_record->m_player );
if ( sucess_data.m_dmg >= 1 )
++awalls_hit;
++awall_traces_done;
}
}
else
{
if ( max_awall_seeds > awalls_hit )
++awalls_hit;
}
}
}
// ( ( COERCE_FLOAT( traces_hit ) / COERCE_FLOAT( max_seeds ) ) * 100.0 )
auto trace_chance = ( ( static_cast< float >( traces_hit ) / static_cast< float >( max_seeds ) ) * 100.f );
if ( trace_chance >= 15.f && g_local_player->flags( ) & 1 && is_special_weapon && !g_local_player->scoped( ) && g_local_player->can_shoot( false ) )
{
if ( g_eng_pred->ideal_inaccuracy( ) >= ( g_local_player->weapon( )->accuracy_penalty( ) * 0.02f ) )
return true;
}
// ( ( COERCE_FLOAT( awalls_hit ) / COERCE_FLOAT( max_awall_seeds ) ) * 100.0 )
auto final_chance = ( static_cast< float >( awalls_hit ) / static_cast< float >( max_awall_seeds ) ) * 100.f;
if ( static_cast< float >( g_menu->aim_bot( ).m_hit_chance.get( ) ) <= final_chance )
return true;
return false;
}