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


C# WoWUnit.IsEvading方法代码示例

本文整理汇总了C#中WoWUnit.IsEvading方法的典型用法代码示例。如果您正苦于以下问题:C# WoWUnit.IsEvading方法的具体用法?C# WoWUnit.IsEvading怎么用?C# WoWUnit.IsEvading使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WoWUnit的用法示例。


在下文中一共展示了WoWUnit.IsEvading方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ValidUnit

        public static bool ValidUnit(WoWUnit p, bool showReason = false)
        {
            if (p == null || !p.IsValid)
                return false;

            if (StyxWoW.Me.IsInInstance && IgnoreMobs.Contains(p.Entry))
            {
                if (showReason) Logger.Write(invalidColor, "invalid attack unit {0} is an Instance Ignore Mob", p.SafeName());
                return false;
            }

            // Ignore shit we can't select
            if (!p.CanSelect )
            {
                if (showReason) Logger.Write(invalidColor, "invalid attack unit {0} cannot be Selected", p.SafeName());
                return false;
            }

            // Ignore shit we can't attack
            if (!p.Attackable)
            {
                if (showReason) Logger.Write(invalidColor, "invalid attack unit {0} cannot be Attacked", p.SafeName());
                return false;
            }

            // Duh
            if (p.IsDead)
            {
                if (showReason) Logger.Write(invalidColor, "invalid attack unit {0} is already Dead", p.SafeName());
                return false;
            }

            // check for enemy players here as friendly only seems to work on npc's
            if (p.IsPlayer)
            {
                WoWPlayer pp = p.ToPlayer();
                if (pp.IsHorde == StyxWoW.Me.IsHorde && !pp.IsHostile)
                {
                    if (showReason)
                        Logger.Write(invalidColor, "invalid attack player {0} not a hostile enemy", p.SafeName());
                    return false;
                }

                if (!pp.CanWeAttack())
                {
                    if (showReason)
                        Logger.Write(invalidColor, "invalid attack player {0} cannot be Attacked currently", p.SafeName());
                    return false;
                }

                return true;
            }

            // Ignore evading NPCs
            if (p.IsEvading())
            {
                if (showReason)
                    Logger.Write(invalidColor, "invalid unit, {0} game flagged as evading", p.SafeName());
                return false;
            }

            // Ignore friendlies!
            if (p.IsFriendly)
            {
                if (showReason) Logger.Write(invalidColor, "invalid attack unit {0} is Friendly", p.SafeName());
                return false;
            }

            // Dummies/bosses are valid by default. Period.
            if (p.IsTrainingDummy() || p.IsBoss())
                return true;

            // If it is a pet/minion/totem, lets find the root of ownership chain
            WoWPlayer pOwner = GetPlayerParent(p);

            // ignore if owner is player, alive, and not blacklisted then ignore (since killing owner kills it)
            // .. following .IsMe check to prevent treating quest mob summoned by us that we need to kill as invalid
            if (pOwner != null && pOwner.IsAlive && !pOwner.IsMe)
            {
                if (!ValidUnit(pOwner))
                {
                    if (showReason)
                        Logger.Write(invalidColor, "invalid attack unit {0} - pets parent not an attackable Player", p.SafeName());
                    return false;
                }
                if (!StyxWoW.Me.IsPvPFlagged)
                {
                    if (showReason)
                        Logger.Write(invalidColor, "valid attackable player {0} but I am not PvP Flagged", p.SafeName());
                    return false;
                }
                if (Blacklist.Contains(pOwner, BlacklistFlags.Combat))
                {
                    if (showReason)
                        Logger.Write(invalidColor, "invalid attack unit {0} - Parent blacklisted for combat", p.SafeName());
                    return false;
                }

                return true;
            }
//.........这里部分代码省略.........
开发者ID:aash,项目名称:Singular,代码行数:101,代码来源:Unit.cs


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