本文整理汇总了C++中npc::set_attitude方法的典型用法代码示例。如果您正苦于以下问题:C++ npc::set_attitude方法的具体用法?C++ npc::set_attitude怎么用?C++ npc::set_attitude使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类npc
的用法示例。
在下文中一共展示了npc::set_attitude方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lead_to_safety
void talk_function::lead_to_safety( npc &p )
{
const auto mission = mission::reserve_new( mission_type_id( "MISSION_REACH_SAFETY" ), -1 );
mission->assign( g->u );
p.goal = mission->get_target();
p.set_attitude( NPCATT_LEAD );
}
示例2: follow
void talk_function::follow( npc &p )
{
g->add_npc_follower( p.getID() );
p.set_attitude( NPCATT_FOLLOW );
g->u.cash += p.cash;
p.cash = 0;
}
示例3: assign_guard
void talk_function::assign_guard( npc &p )
{
add_msg( _( "%s is posted as a guard." ), p.name );
p.set_attitude( NPCATT_NULL );
p.mission = NPC_MISSION_GUARD_ALLY;
p.chatbin.first_topic = "TALK_FRIEND_GUARD";
p.set_destination();
}
示例4: stop_guard
void talk_function::stop_guard( npc &p )
{
p.set_attitude( NPCATT_FOLLOW );
add_msg( _( "%s begins to follow you." ), p.name );
p.mission = NPC_MISSION_NULL;
p.chatbin.first_topic = "TALK_FRIEND";
p.goal = npc::no_goal_point;
p.guard_pos = npc::no_goal_point;
}
示例5: stop_guard
void talk_function::stop_guard( npc &p )
{
if( p.mission != NPC_MISSION_GUARD_ALLY ) {
p.set_attitude( NPCATT_NULL );
p.mission = NPC_MISSION_NULL;
return;
}
p.set_attitude( NPCATT_FOLLOW );
add_msg( _( "%s begins to follow you." ), p.name );
p.mission = NPC_MISSION_NULL;
p.chatbin.first_topic = "TALK_FRIEND";
p.goal = npc::no_goal_point;
p.guard_pos = npc::no_goal_point;
cata::optional<basecamp *> bcp = overmap_buffer.find_camp( p.global_omt_location().x,
p.global_omt_location().y );
if( bcp ) {
basecamp *temp_camp = *bcp;
temp_camp->validate_assignees();
}
}
示例6: npc_thankful
void talk_function::npc_thankful( npc &p )
{
if( p.get_attitude() == NPCATT_MUG || p.get_attitude() == NPCATT_WAIT_FOR_LEAVE ||
p.get_attitude() == NPCATT_FLEE || p.get_attitude() == NPCATT_KILL ||
p.get_attitude() == NPCATT_FLEE_TEMP ) {
p.set_attitude( NPCATT_NULL );
}
if( p.chatbin.first_topic != "TALK_FRIEND" ) {
p.chatbin.first_topic = "TALK_STRANGER_FRIENDLY";
}
p.personality.aggression -= 1;
}
示例7: assign_base
void talk_function::assign_base( npc &p )
{
// TODO: decide what to do upon assign? maybe pathing required
basecamp *camp = g->m.camp_at( g->u.pos() );
if( !camp ) {
dbg( D_ERROR ) << "talk_function::assign_base: Assigned to base but no base here.";
return;
}
add_msg( _( "%1$s waits at %2$s" ), p.name, camp->camp_name() );
p.mission = NPC_MISSION_BASE;
p.set_attitude( NPCATT_NULL );
}
示例8: hostile
void talk_function::hostile( npc &p )
{
if( p.get_attitude() == NPCATT_KILL ) {
return;
}
if( p.sees( g->u ) ) {
add_msg( _( "%s turns hostile!" ), p.name );
}
g->u.add_memorial_log( pgettext( "memorial_male", "%s became hostile." ),
pgettext( "memorial_female", "%s became hostile." ),
p.name );
p.set_attitude( NPCATT_KILL );
}
示例9: goto_location
void talk_function::goto_location( npc &p )
{
int i = 0;
uilist selection_menu;
selection_menu.text = string_format( _( "Select a destination" ) );
std::vector<basecamp *> camps;
tripoint destination;
for( auto elem : g->u.camps ) {
if( elem == p.global_omt_location() ) {
continue;
}
cata::optional<basecamp *> camp = overmap_buffer.find_camp( elem.x, elem.y );
if( !camp ) {
continue;
}
basecamp *temp_camp = *camp;
camps.push_back( temp_camp );
}
for( auto iter : camps ) {
selection_menu.addentry( i++, true, MENU_AUTOASSIGN, _( "%s at (%d, %d)" ), iter->camp_name(),
iter->camp_omt_pos().x, iter->camp_omt_pos().y );
}
selection_menu.addentry( i++, true, MENU_AUTOASSIGN, _( "My current location" ) );
selection_menu.addentry( i++, true, MENU_AUTOASSIGN, _( "Cancel" ) );
selection_menu.selected = 0;
selection_menu.query();
auto index = selection_menu.ret;
if( index < 0 || index > static_cast<int>( camps.size() + 1 ) ||
index == static_cast<int>( camps.size() + 1 ) || index == UILIST_CANCEL ) {
return;
}
if( index == static_cast<int>( camps.size() ) ) {
destination = g->u.global_omt_location();
} else {
auto selected_camp = camps[index];
destination = selected_camp->camp_omt_pos();
}
p.set_companion_mission( p.global_omt_location(), "TRAVELLER", "travelling", destination );
p.mission = NPC_MISSION_TRAVELLING;
p.chatbin.first_topic = "TALK_FRIEND_GUARD";
p.goal = destination;
p.guard_pos = npc::no_goal_point;
p.set_attitude( NPCATT_NULL );
return;
}
示例10: assign_guard
void talk_function::assign_guard( npc &p )
{
if( !p.is_following() ) {
p.mission = NPC_MISSION_GUARD;
p.set_omt_destination();
return;
}
if( p.is_travelling() ) {
if( p.has_companion_mission() ) {
p.reset_companion_mission();
}
}
p.set_attitude( NPCATT_NULL );
p.mission = NPC_MISSION_GUARD_ALLY;
p.chatbin.first_topic = "TALK_FRIEND_GUARD";
p.set_omt_destination();
cata::optional<basecamp *> bcp = overmap_buffer.find_camp( p.global_omt_location().x,
p.global_omt_location().y );
if( bcp ) {
basecamp *temp_camp = *bcp;
temp_camp->validate_assignees();
if( p.rules.has_flag( ally_rule::ignore_noise ) ) {
//~ %1$s is the NPC's translated name, %2$s is the translated faction camp name
add_msg( _( "%1$s is assigned to %2$s" ), p.disp_name(), temp_camp->camp_name() );
} else {
//~ %1$s is the NPC's translated name, %2$s is the translated faction camp name
add_msg( _( "%1$s is assigned to guard %2$s" ), p.disp_name(), temp_camp->camp_name() );
}
} else {
if( p.rules.has_flag( ally_rule::ignore_noise ) ) {
//~ %1$s is the NPC's translated name, %2$s is the pronoun for the NPC's gender
add_msg( _( "%1$s will wait for you where %2$s is." ), p.disp_name(),
p.male ? _( "he" ) : _( "she" ) );
} else {
add_msg( _( "%s is posted as a guard." ), p.disp_name() );
}
}
}
示例11: insult_combat
void talk_function::insult_combat( npc &p )
{
add_msg( _( "You start a fight with %s!" ), p.name );
p.chatbin.first_topic = "TALK_DONE";
p.set_attitude( NPCATT_KILL );
}
示例12: follow
void talk_function::follow( npc &p )
{
p.set_attitude( NPCATT_FOLLOW );
g->u.cash += p.cash;
p.cash = 0;
}
示例13: player_leaving
void talk_function::player_leaving( npc &p )
{
p.set_attitude( NPCATT_WAIT_FOR_LEAVE );
p.patience = 15 - p.personality.aggression;
}
示例14: start_mugging
void talk_function::start_mugging( npc &p )
{
p.set_attitude( NPCATT_MUG );
add_msg( _( "Pause to stay still. Any movement may cause %s to attack." ), p.name );
}
示例15: stranger_neutral
void talk_function::stranger_neutral( npc &p )
{
add_msg( _( "%s feels less threatened by you." ), p.name );
p.set_attitude( NPCATT_NULL );
p.chatbin.first_topic = "TALK_STRANGER_NEUTRAL";
}