本文整理汇总了C++中CAI_Stalker::ID方法的典型用法代码示例。如果您正苦于以下问题:C++ CAI_Stalker::ID方法的具体用法?C++ CAI_Stalker::ID怎么用?C++ CAI_Stalker::ID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAI_Stalker
的用法示例。
在下文中一共展示了CAI_Stalker::ID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool should_process (CAI_Stalker &object, const CEntityAlive *enemy)
{
if (object.agent_manager().enemy().wounded_processed(enemy))
return (false);
ALife::_OBJECT_ID processor_id = object.agent_manager().enemy().wounded_processor(enemy);
if ((processor_id != ALife::_OBJECT_ID(-1)) && (processor_id != object.ID()))
return (false);
return (true);
}
示例2: Action
void RELATION_REGISTRY::Action (CEntityAlive* from, CEntityAlive* to, ERelationAction action)
{
static CHARACTER_GOODWILL friend_kill_goodwill = pSettings->r_s32(ACTIONS_POINTS_SECT, "friend_kill_goodwill");
static CHARACTER_GOODWILL neutral_kill_goodwill = pSettings->r_s32(ACTIONS_POINTS_SECT, "neutral_kill_goodwill");
static CHARACTER_GOODWILL enemy_kill_goodwill = pSettings->r_s32(ACTIONS_POINTS_SECT, "enemy_kill_goodwill");
static CHARACTER_GOODWILL community_member_kill_goodwill = pSettings->r_s32(ACTIONS_POINTS_SECT, "community_member_kill_goodwill");
static CHARACTER_REPUTATION_VALUE friend_kill_reputation = pSettings->r_s32(ACTIONS_POINTS_SECT, "friend_kill_reputation");
static CHARACTER_REPUTATION_VALUE neutral_kill_reputation = pSettings->r_s32(ACTIONS_POINTS_SECT, "neutral_kill_reputation");
static CHARACTER_REPUTATION_VALUE enemy_kill_reputation = pSettings->r_s32(ACTIONS_POINTS_SECT, "enemy_kill_reputation");
//(с) мин. время через которое снова будет зарегестрировано сообщение об атаке на персонажа
static u32 min_attack_delta_time = u32(1000.f * pSettings->r_float(ACTIONS_POINTS_SECT, "min_attack_delta_time"));
static CHARACTER_GOODWILL friend_fight_help_goodwill = pSettings->r_s32(ACTIONS_POINTS_SECT, "friend_fight_help_goodwill");
static CHARACTER_GOODWILL neutral_fight_help_goodwill = pSettings->r_s32(ACTIONS_POINTS_SECT, "neutral_fight_help_goodwill");
static CHARACTER_GOODWILL enemy_fight_help_goodwill = pSettings->r_s32(ACTIONS_POINTS_SECT, "enemy_fight_help_goodwill");
static CHARACTER_GOODWILL community_member_fight_help_goodwill = pSettings->r_s32(ACTIONS_POINTS_SECT, "community_member_fight_help_goodwill");
static CHARACTER_REPUTATION_VALUE friend_fight_help_reputation = pSettings->r_s32(ACTIONS_POINTS_SECT, "friend_fight_help_reputation");
static CHARACTER_REPUTATION_VALUE neutral_fight_help_reputation = pSettings->r_s32(ACTIONS_POINTS_SECT, "neutral_fight_help_reputation");
static CHARACTER_REPUTATION_VALUE enemy_fight_help_reputation = pSettings->r_s32(ACTIONS_POINTS_SECT, "enemy_fight_help_reputation");
CActor* actor = smart_cast<CActor*> (from);
CInventoryOwner* inv_owner_from = smart_cast<CInventoryOwner*> (from);
CAI_Stalker* stalker_from = smart_cast<CAI_Stalker*> (from);
CAI_Stalker* stalker = smart_cast<CAI_Stalker*> (to);
//вычисление изменения репутации и рейтинга пока ведется
//только для актера
if(!inv_owner_from || from->cast_base_monster()) return;
ALife::ERelationType relation = ALife::eRelationTypeDummy;
if(stalker)
{
stalker->m_actor_relation_flags.set(action, TRUE);
relation = GetRelationType(smart_cast<CInventoryOwner*>(stalker), inv_owner_from);
}
switch(action)
{
case ATTACK:
{
if(actor)
{
//учитывать ATTACK и FIGHT_HELP, только если прошло время
//min_attack_delta_time
FIGHT_DATA* fight_data_from = FindFight (from->ID(), true);
if(Device.dwTimeGlobal - fight_data_from->attack_time < min_attack_delta_time)
break;
fight_data_from->attack_time = Device.dwTimeGlobal;
//если мы атаковали персонажа или монстра, который
//кого-то атаковал, то мы помогли тому, кто защищался
FIGHT_DATA* fight_data = FindFight (to->ID(),true);
if(fight_data)
{
CAI_Stalker* defending_stalker = smart_cast<CAI_Stalker*>(Level().Objects.net_Find(fight_data->defender));
if(defending_stalker)
{
CAI_Stalker* attacking_stalker = smart_cast<CAI_Stalker*>(Level().Objects.net_Find(fight_data->attacker));
Action(actor, defending_stalker, attacking_stalker?FIGHT_HELP_HUMAN:FIGHT_HELP_MONSTER);
}
}
}
if(stalker)
{
bool bDangerScheme = false;
const CEntityAlive* stalker_enemy = stalker->memory().enemy().selected();
if(actor && stalker_enemy)
{
const CInventoryOwner* const_inv_owner_from = inv_owner_from;
if(stalker_enemy->human_being())
{
const CInventoryOwner* const_inv_owner_stalker_enemy = smart_cast<const CInventoryOwner*>(stalker_enemy);
ALife::ERelationType relation_to_actor = GetRelationType(const_inv_owner_stalker_enemy, const_inv_owner_from);
if(relation_to_actor == ALife::eRelationTypeEnemy)
bDangerScheme = true;
}
}
SAttackGoodwillStorage* st = bDangerScheme?&gw_danger:&gw_free;
CHARACTER_GOODWILL delta_goodwill = 0;
CHARACTER_REPUTATION_VALUE delta_reputation = 0;
switch (relation)
{
case ALife::eRelationTypeEnemy:
{
delta_goodwill = st->enemy_attack_goodwill;
delta_reputation = st->enemy_attack_reputation;
}break;
case ALife::eRelationTypeNeutral:
{
delta_goodwill = st->neutral_attack_goodwill;
delta_reputation = st->neutral_attack_reputation;
}break;
//.........这里部分代码省略.........