本文整理汇总了C++中CAI_Stalker::Rank方法的典型用法代码示例。如果您正苦于以下问题:C++ CAI_Stalker::Rank方法的具体用法?C++ CAI_Stalker::Rank怎么用?C++ CAI_Stalker::Rank使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAI_Stalker
的用法示例。
在下文中一共展示了CAI_Stalker::Rank方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
CHARACTER_RANK_VALUE CScriptGameObject::GetRank ()
{
CAI_Stalker *stalker = smart_cast<CAI_Stalker*>(&object());
if (!stalker) {
ai().script_engine().script_log (ScriptStorage::eLuaMessageTypeError,"CAI_Stalker : cannot access class member GetRank!");
return (CHARACTER_RANK_VALUE(0));
}
else
return (stalker->Rank());
}
示例2: Action
//.........这里部分代码省略.........
delta_reputation = neutral_kill_reputation;
}break;
case ALife::eRelationTypeFriend:
{
delta_goodwill = friend_kill_goodwill;
delta_reputation = friend_kill_reputation;
}break;
};
//сталкер при нападении на членов своей же группировки отношения не меняют
//(считается, что такое нападение всегда случайно)
bool stalker_kills_team_mate = stalker_from && (stalker_from->Community() == stalker->Community());
if(delta_goodwill && !stalker_kills_team_mate)
{
//изменить отношение ко всем членам группы (если такая есть)
//убитого, кроме него самого
CGroupHierarchyHolder& group = Level().seniority_holder().team(stalker->g_Team()).squad(stalker->g_Squad()).group(stalker->g_Group());
for(std::size_t i = 0; i < group.members().size(); i++)
{
if(stalker->ID() != group.members()[i]->ID())
{
ChangeGoodwill(group.members()[i]->ID(), from->ID(), delta_goodwill);
}
}
//(CHARACTER_GOODWILL)( stalker->Sympathy() * (float)(delta_goodwill+community_member_kill_goodwill));
CHARACTER_GOODWILL community_goodwill = (CHARACTER_GOODWILL)( stalker->Sympathy() * (float)(community_member_kill_goodwill) );
if (community_goodwill)
{
ChangeCommunityGoodwill(stalker->Community(), from->ID(), community_goodwill);
}
}
if(delta_reputation)
{
inv_owner_from->ChangeReputation(delta_reputation);
}
CHARACTER_RANK_VALUE delta_rank = 0;
delta_rank = CHARACTER_RANK::rank_kill_points(CHARACTER_RANK::ValueToIndex(stalker->Rank()));
if(delta_rank)
inv_owner_from->ChangeRank(delta_rank);
}
}
break;
case FIGHT_HELP_HUMAN:
case FIGHT_HELP_MONSTER:
{
if(stalker && stalker->g_Alive())
{
CHARACTER_GOODWILL delta_goodwill = 0;
CHARACTER_REPUTATION_VALUE delta_reputation = 0;
switch (relation)
{
case ALife::eRelationTypeEnemy:
{
delta_goodwill = enemy_fight_help_goodwill;
delta_reputation = enemy_fight_help_reputation;
}break;
case ALife::eRelationTypeNeutral:
{
delta_goodwill = neutral_fight_help_goodwill;
delta_reputation = neutral_fight_help_reputation;
}break;
case ALife::eRelationTypeFriend:
{
delta_goodwill = friend_fight_help_goodwill;
delta_reputation = friend_fight_help_reputation;
}break;
};
if(delta_goodwill)
{
//изменить отношение ко всем членам атакованой группы (если такая есть)
//как к тому кого атаковали
CGroupHierarchyHolder& group = Level().seniority_holder().team(stalker->g_Team()).squad(stalker->g_Squad()).group(stalker->g_Group());
for(std::size_t i = 0; i < group.members().size(); i++)
{
ChangeGoodwill(group.members()[i]->ID(), from->ID(), delta_goodwill);
}
//* ChangeCommunityGoodwill(stalker->Community(), from->ID(), (CHARACTER_GOODWILL)( stalker->Sympathy() * (float)delta_goodwill ));
CHARACTER_GOODWILL community_goodwill = (CHARACTER_GOODWILL)( stalker->Sympathy() * (float)(community_member_fight_help_goodwill) );
if (community_goodwill)
{
ChangeCommunityGoodwill(stalker->Community(), from->ID(), community_goodwill);
}
}
if(delta_reputation)
{
inv_owner_from->ChangeReputation(delta_reputation);
}
}
}
break;
}
}