当前位置: 首页>>代码示例>>C#>>正文


C# GameLiving.IsObjectGreyCon方法代码示例

本文整理汇总了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;
        }
开发者ID:mynew4,项目名称:DAoC,代码行数:29,代码来源:ML10BOSS.cs

示例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;
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:58,代码来源:StandardMobBrain.cs


注:本文中的GameLiving.IsObjectGreyCon方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。