本文整理汇总了C#中GameLiving.IsObjectGreyCon方法的典型用法代码示例。如果您正苦于以下问题:C# GameLiving.IsObjectGreyCon方法的具体用法?C# GameLiving.IsObjectGreyCon怎么用?C# GameLiving.IsObjectGreyCon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameLiving
的用法示例。
在下文中一共展示了GameLiving.IsObjectGreyCon方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalculateAggroLevelToTarget
/// <summary>
/// calculate the aggro of this npc against another living
/// </summary>
/// <param name="target"></param>
/// <returns></returns>
public virtual int CalculateAggroLevelToTarget(GameLiving target)
{
if (GameServer.ServerRules.IsAllowedToAttack(Body, target, true) == false)
return 0;
// related to the pet owner if applicable
if (target is GamePet)
{
GamePlayer thisLiving = (((GamePet)target).Brain as IControlledBrain).GetPlayerOwner();
if (thisLiving != null)
if (thisLiving.IsObjectGreyCon(Body))
return 0;
}
if (target.IsObjectGreyCon(Body)) return 0; // only attack if green+ to target
if (Body.Faction != null && target is GamePlayer)
{
GamePlayer player = (GamePlayer)target;
AggroLevel = Body.Faction.GetAggroToFaction(player);
}
if (AggroLevel >= 100) return 100;
return AggroLevel;
}
示例2: CalculateAggroLevelToTarget
/// <summary>
/// calculate the aggro of this npc against another living
/// </summary>
/// <param name="target"></param>
/// <returns></returns>
public virtual int CalculateAggroLevelToTarget(GameLiving target)
{
if (GameServer.ServerRules.IsAllowedToAttack(Body, target, true) == false)
return 0;
// related to the pet owner if applicable
if (target is GameNPC)
{
IControlledBrain brain = ((GameNPC)target).Brain as IControlledBrain;
if (brain != null)
{
GameLiving thisLiving = (((GameNPC)target).Brain as IControlledBrain).GetLivingOwner();
if (thisLiving != null)
{
if (thisLiving.IsObjectGreyCon(Body))
return 0;
}
}
}
if (target.IsObjectGreyCon(Body)) return 0; // only attack if green+ to target
if (Body.Faction != null && target is GamePlayer)
{
GamePlayer player = (GamePlayer)target;
AggroLevel = Body.Faction.GetAggroToFaction(player);
}
else if (Body.Faction != null && target is GameNPC)
{
GameNPC npc = (GameNPC)target;
if (npc.Faction != null)
{
if (npc.Brain is IControlledBrain && (npc.Brain as IControlledBrain).GetPlayerOwner() != null)
{
GamePlayer factionChecker = (npc.Brain as IControlledBrain).GetPlayerOwner();
AggroLevel = Body.Faction.GetAggroToFaction(factionChecker);
}
else
{
if (Body.Faction.EnemyFactions.Contains(npc.Faction))
AggroLevel = 100;
}
}
}
//we put this here to prevent aggroing non-factions npcs
if (target.Realm == eRealm.None && target is GameNPC)
return 0;
if (AggroLevel >= 100) return 100;
return AggroLevel;
}