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


C# WoWUnit.SpellDistance方法代码示例

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


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

示例1: IsViableForPolymorph

        private static bool IsViableForPolymorph(WoWUnit unit)
        {
            if (StyxWoW.Me.CurrentTargetGuid == unit.Guid)
                return false;

            if (!unit.Combat)
                return false;

            if (unit.CreatureType != WoWCreatureType.Beast && unit.CreatureType != WoWCreatureType.Humanoid)
                return false;

            if (unit.IsCrowdControlled())
                return false;

            if (!unit.IsTargetingMeOrPet && !unit.IsTargetingMyPartyMember)
                return false;

            if (StyxWoW.Me.RaidMembers.Any(m => m.CurrentTargetGuid == unit.Guid && m.IsAlive))
                return false;

            if (!unit.SpellDistance().Between(14, 30))
                return false;

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

示例2: NeedsPvpCrowdControl

 //
 private static bool NeedsPvpCrowdControl(WoWUnit u)
 {
     bool good = u.SpellDistance().Between(8, 40) && !u.IsCrowdControlled() && u.Guid != TargetGuid && !Blacklist.Contains(u.Guid, BlacklistFlags.Combat);
     // && !Unit.NearbyGroupMembers.Any( g => g.CurrentTargetGuid == u.Guid);
     return good;
 }
开发者ID:aash,项目名称:Singular,代码行数:7,代码来源:Common.cs

示例3: IsTankSettledIntoFight

        public static bool IsTankSettledIntoFight(WoWUnit tank = null)
        {
            if (tank == null)
                tank = HealerManager.TankToStayNear;

            if (tank == null)
            {
                return false;
            }
            if (!tank.Combat)
            {
                return false;
            }
            if (tank.IsMoving)
            {
                return false;
            }
            if (!tank.GotTarget() || tank.SpellDistance(tank.CurrentTarget) > 8)
            {
                return false;
            }

            return true;
        }
开发者ID:aash,项目名称:Singular,代码行数:24,代码来源:HealerManager.cs

示例4: CastContext

        // always create passing the existing context so it is preserved for delegate usage
        internal CastContext(object ctx, SpellFindDelegate ssd, UnitSelectionDelegate onUnit, HasGcd gcd = HasGcd.Yes)
        {
            if (ssd == null || onUnit == null)
                return;

            if (ssd(ctx, out sfr))
            {
                spell = sfr.Override ?? sfr.Original;
                name = spell.Name;
                context = ctx;
                unit = onUnit(ctx);
                    
                // health/dist change quickly, so grab these now where
                // .. we check requirements so the log message we output
                // .. later reflects what they were when we were testing
                // .. as opposed to what they may have changed to
                // .. (since spell lookup, move while casting check, and cancast take time)
                if (unit != null && unit.IsValid)
                {
                    health = unit.HealthPercent;
                    distance = unit.SpellDistance();
                }
            }
        }
开发者ID:aash,项目名称:Singular,代码行数:25,代码来源:Spell.cs

示例5: LogCast

 public static void LogCast(string sname, WoWUnit unit, bool isHeal = false)
 {
     LogCast(sname, unit, unit.HealthPercent, unit.SpellDistance(), isHeal);
 }
开发者ID:aash,项目名称:Singular,代码行数:4,代码来源:Spell.cs

示例6: NeedSoulSwapNormal

        private static bool NeedSoulSwapNormal(WoWUnit unit)
        {
            if (!unit.IsAlive)
                return false;

            if (GetSoulSwapDotsNeeded(unit) < 2)
                return false;

            if (unit.SpellDistance() > 40)
                return false;

            if (!unit.InLineOfSpellSight)
                return false;

            return true;
        }
开发者ID:aash,项目名称:Singular,代码行数:16,代码来源:Affliction.cs

示例7: CanWeDisengage

        public static bool CanWeDisengage(string spell, Direction dir, int distance)
        {
            if (!SpellManager.HasSpell(spell))
                return false;

            if (DateTime.UtcNow < NextDisengageAllowed)
                return false;

            if (!Me.IsAlive || Me.IsFalling || Me.IsCasting || Me.IsSwimming)
                return false;

            if (Me.Stunned || Me.Rooted || Me.IsStunned() || Me.IsRooted())
                return false;

            if (!Spell.CanCastHack(spell, Me))
                return false;

            mobToGetAwayFrom = SafeArea.NearestEnemyMobAttackingMe;
            if (mobToGetAwayFrom == null)
                return false;

            if (mobToGetAwayFrom.SpellDistance() > mobToGetAwayFrom.MeleeDistance() + 3f)
                return false;

            SafeArea sa = new SafeArea();
            sa.MinScanDistance = distance;    // average distance on flat ground
            sa.MaxScanDistance = sa.MinScanDistance;
            sa.RaysToCheck = 36;
            sa.LineOfSightMob = Target;
            sa.MobToRunFrom = mobToGetAwayFrom;
            sa.CheckLineOfSightToSafeLocation = true;
            sa.CheckSpellLineOfSightToMob = false;
            sa.DirectPathOnly = true;

            safeSpot = sa.FindLocation();
            if (safeSpot == WoWPoint.Empty)
            {
                Logger.WriteDebug(Color.Cyan, "DIS: no safe landing spots found for {0}", spell);
                return false;
            }

            Logger.WriteDebug(Color.Cyan, "DIS: Attempt safe {0} due to {1} @ {2:F1} yds",
                spell,
                mobToGetAwayFrom.SafeName(),
                mobToGetAwayFrom.Distance);

            return true;
        }
开发者ID:aash,项目名称:Singular,代码行数:48,代码来源:Kite.cs

示例8: NeedSoulburnHauntNormal

        private static bool NeedSoulburnHauntNormal(WoWUnit unit)
        {
            if (!unit.IsAlive)
                return false;

            if (unit.SpellDistance() > 40)
                return false;

            if (!unit.InLineOfSpellSight)
                return false;

            return true;
        }
开发者ID:aash,项目名称:Singular,代码行数:13,代码来源:Affliction.cs

示例9: CastPetAction

        public static void CastPetAction(string action, WoWUnit on)
        {
            WoWPetSpell spell = PetSpells.FirstOrDefault(p => p.ToString() == action);
            if (spell == null)
                return;

            Logger.Write(Color.DeepSkyBlue, "*Pet:{0} on {1} @ {2:F1} yds", action, on.SafeName(), on.SpellDistance());
            if (on.Guid == StyxWoW.Me.CurrentTargetGuid)
            {
                Logger.WriteDebug("CastPetAction: cast [{0}] specifying CurrentTarget", action);
                Lua.DoString("CastPetAction({0}, 'target')", spell.ActionBarIndex + 1);
            }
            else
            {
                WoWUnit save = StyxWoW.Me.FocusedUnit;
                StyxWoW.Me.SetFocus(on);
                Logger.WriteDebug("CastPetAction: cast [{0}] specifying FocusTarget {1}", action, on.SafeName());
                Lua.DoString("CastPetAction({0}, 'focus')", spell.ActionBarIndex + 1);
                StyxWoW.Me.SetFocus(save == null ? WoWGuid.Empty : save.Guid);
            }
        }
开发者ID:aash,项目名称:Singular,代码行数:21,代码来源:PetManager.cs

示例10: Attack

        public static bool Attack(WoWUnit unit)
        {
            if (unit == null || StyxWoW.Me.Pet == null || !IsPetUseAllowed)
                return false;

            if (StyxWoW.Me.Pet.CurrentTargetGuid != unit.Guid && (lastPetAttack != unit.Guid || waitNextPetAttack.IsFinished))
            {
                lastPetAttack = unit.Guid;
                if (SingularSettings.Debug)
                    Logger.WriteDebug("PetAttack: on {0} @ {1:F1} yds", unit.SafeName(), unit.SpellDistance());
                PetManager.CastPetAction("Attack", unit);
                waitNextPetAttack.Reset();
                return true;
            }

            return false;
        }
开发者ID:aash,项目名称:Singular,代码行数:17,代码来源:PetManager.cs

示例11: UnfriendlyUnits

        /// <summary>
        ///   Gets the nearby unfriendly units within specified range.  if no range specified, 
        ///   includes all unfriendly units
        /// </summary>
        /// <value>The nearby unfriendly units.</value>
        public static IEnumerable<WoWUnit> UnfriendlyUnits(int maxSpellDist = -1, WoWUnit origin = null )
        {
            if (origin == null)
                origin = StyxWoW.Me;

            // need to use TargetList for this if in Dungeon
            bool useTargeting = (SingularRoutine.IsDungeonBuddyActive || (SingularRoutine.IsQuestBotActive && StyxWoW.Me.IsInInstance));
            if (useTargeting)
            {
                if ( maxSpellDist == -1)
                    return Targeting.Instance.TargetList.Where(u => u != null && ValidUnit(u));
                return Targeting.Instance.TargetList.Where(u => u != null && ValidUnit(u) && origin.SpellDistance(u) < maxSpellDist);
            }

            List<WoWUnit> list = new List<WoWUnit>();
            List<WoWObject> objectList = ObjectManager.ObjectList;

            for (int i = 0; i < objectList.Count; i++)
            {
                Type type = objectList[i].GetType();
                if (type == typeof(WoWUnit) || type == typeof(WoWPlayer))
                {
                    WoWUnit t = objectList[i] as WoWUnit;
                    if (t != null && ValidUnit(t) && (maxSpellDist == -1 || origin.SpellDistance(t) < maxSpellDist ))
                    {
                        list.Add(t);
                    }
                }
            }

            return list;
        }
开发者ID:aash,项目名称:Singular,代码行数:37,代码来源:Unit.cs

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