本文整理汇总了C++中npc::get_skill_level方法的典型用法代码示例。如果您正苦于以下问题:C++ npc::get_skill_level方法的具体用法?C++ npc::get_skill_level怎么用?C++ npc::get_skill_level使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类npc
的用法示例。
在下文中一共展示了npc::get_skill_level方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: start_training
void talk_function::start_training( npc &p )
{
int cost;
time_duration time = 0_turns;
std::string name;
const skill_id &skill = p.chatbin.skill;
const matype_id &style = p.chatbin.style;
if( skill.is_valid() && g->u.get_skill_level( skill ) < p.get_skill_level( skill ) ) {
cost = calc_skill_training_cost( p, skill );
time = calc_skill_training_time( p, skill );
name = skill.str();
} else if( p.chatbin.style.is_valid() && !g->u.has_martialart( style ) ) {
cost = calc_ma_style_training_cost( p, style );
time = calc_ma_style_training_time( p, style );
name = p.chatbin.style.str();
} else {
debugmsg( "start_training with no valid skill or style set" );
return;
}
mission *miss = p.chatbin.mission_selected;
if( miss != nullptr && miss->get_assigned_player_id() == g->u.getID() ) {
clear_mission( p );
} else if( !pay_npc( p, cost ) ) {
return;
}
g->u.assign_activity( activity_id( "ACT_TRAIN" ), to_moves<int>( time ), p.getID(), 0, name );
p.add_effect( effect_asked_to_train, 6_hours );
}
示例2: test_fast_shooting
static void test_fast_shooting( npc &shooter, int moves, float hit_rate )
{
const int fast_shooting_range = 3;
const float hit_rate_cap = hit_rate + 0.3;
dispersion_sources dispersion = get_dispersion( shooter, moves );
std::array<statistics, 5> fast_stats = firing_test( dispersion, fast_shooting_range, {{ -1, hit_rate, -1, -1, -1 }} );
std::array<statistics, 5> fast_stats_upper = firing_test( dispersion, fast_shooting_range, {{ -1, hit_rate_cap, -1, -1, -1 }} );
INFO( dispersion );
INFO( "Range: " << fast_shooting_range );
INFO( "Max aim speed: " << shooter.aim_per_move( shooter.weapon, MAX_RECOIL ) );
INFO( "Min aim speed: " << shooter.aim_per_move( shooter.weapon, shooter.recoil ) );
CAPTURE( shooter.weapon.gun_skill().str() );
CAPTURE( shooter.get_skill_level( shooter.weapon.gun_skill() ) );
CAPTURE( shooter.get_dex() );
CAPTURE( to_milliliter( shooter.weapon.volume() ) );
CAPTURE( fast_stats[1].n() );
CAPTURE( fast_stats[1].adj_wald_error() );
CHECK( fast_stats[1].avg() > hit_rate );
CAPTURE( fast_stats_upper[1].n() );
CAPTURE( fast_stats_upper[1].adj_wald_error() );
CHECK( fast_stats_upper[1].avg() < hit_rate_cap );
}