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


C# WoWUnit.IsMelee方法代码示例

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


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

示例1: CreateDruidCrowdControl

        /// <summary>
        /// Crowd Control all targets within 25 yds that are attacking (if possible.)
        /// if not, attempt to Kite
        /// </summary>
        /// <returns></returns>
        public static Composite CreateDruidCrowdControl()
        {
            return new PrioritySelector(

            #region Crowd Control to Self-Heal

            // Incapacitating Roar - 10 yds, all 3 secs
            // Mighty Bash - Melee, 5 secs
            // Cyclone - 20 yds, 6 secds

                new Action(r =>
                {
                    _CrowdControlTarget = null;
                    if (_CrowdControlGuid != WoWGuid.Empty)
                    {
                        _CrowdControlTarget = ObjectManager.GetObjectByGuid<WoWUnit>(_CrowdControlGuid);
                        if (_CrowdControlTarget != null)
                        {
                            if (Spell.DoubleCastContainsAny(_CrowdControlTarget, "Incapacitating Roar", "Mighty Bash", "Cyclone"))
                            {
                            }
                            else if (_CrowdControlTarget.IsCrowdControlled())
                            {
                            }
                            else if (_CrowdControlTarget.IsMelee() && _CrowdControlTarget.SpellDistance() > 25)
                            {
                                _CrowdControlGuid = WoWGuid.Empty;
                                _CrowdControlTarget = null;
                            }
                        }
                    }

                    _CrowdControlTarget = Unit.UnitsInCombatWithUsOrOurStuff(25)
                        .Where(u => u.CurrentTargetGuid == Me.Guid
                            && u.Guid != _CrowdControlGuid
                            && u.Combat && !u.IsCrowdControlled())
                        .OrderByDescending(k => k.IsPlayer)
                        .ThenBy(k => k.Guid == Me.CurrentTargetGuid)
                        .ThenBy(k => k.DistanceSqr)
                        .FirstOrDefault();

                    _CrowdControlGuid = _CrowdControlTarget == null ? WoWGuid.Empty : _CrowdControlTarget.Guid;
                    return RunStatus.Failure;
                }),

                new Decorator(
                    ret => _CrowdControlTarget != null,
                    new PrioritySelector(
                        Spell.Buff("Incapacitating Roar", on => _CrowdControlTarget, req => Unit.UnfriendlyUnits(10).Count(u => u.CurrentTargetGuid == Me.Guid) > 1),
                        Spell.Buff("Mighty Bash", on => _CrowdControlTarget, req => Me.IsSafelyFacing(_CrowdControlTarget)),
                        new Sequence(
                            Spell.Cast("Cyclone", on => _CrowdControlTarget, req => !Unit.NearbyUnfriendlyUnits.Any(u => u.HasMyAura("Cyclone")), cancel => false),
                            new Action(r => Spell.UpdateDoubleCast("Cyclone", _CrowdControlTarget))
                            ),
                        Spell.Buff("Disorienting Roar", on => _CrowdControlTarget, req => Unit.UnfriendlyUnits(10).Count(u => u.CurrentTargetGuid == Me.Guid) > 0)
                        )
                    ),

            #endregion

            #region Avoidance

            // attackers within 8 yds and we need heal? try to knock them away
                Spell.Cast(
                    "Typhoon",
                    req =>
                    {
                        if (!Spell.CanCastHack("Typhoon"))
                            return false;
                        int attackers = Unit.UnfriendlyUnits(15)
                            .Where(u => u.CurrentTargetGuid == Me.Guid
                                && u.Combat
                                && !u.IsCrowdControlled()
                                && (u.IsMelee() || u.CastingSpellId == 1949 /*Hellfire*/ || u.HasAura("Immolation Aura"))
                                && Me.IsSafelyFacing(u, 90f))
                            .Count();
                        if (attackers < 1)
                            return false;
                        Logger.Write(LogColor.Hilite, "^Typhoon: knock-back and daze {0} attackers", attackers);
                        return true;
                    }),

                // no knock back? lets root and move away if settings allow
                new Decorator(
                    ret => Unit.NearbyUnitsInCombatWithMeOrMyStuff.Any(u => u.SpellDistance() < 8),
                    CreateDruidAvoidanceBehavior(CreateDruidSlowMeleeBehavior(), null, null)
                    )

            #endregion

                );
        }
开发者ID:aash,项目名称:Singular,代码行数:97,代码来源:Common.cs


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