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


C# UnitSelectionDelegate类代码示例

本文整理汇总了C#中UnitSelectionDelegate的典型用法代码示例。如果您正苦于以下问题:C# UnitSelectionDelegate类的具体用法?C# UnitSelectionDelegate怎么用?C# UnitSelectionDelegate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: CastFreeze

        /// <summary>
        /// Cast "Freeze" pet ability on a target.  Uses a local store for location to
        /// avoid target position changing during cast preparation and being out of
        /// range after range check
        /// </summary>
        /// <param name="onUnit">target to cast on</param>
        /// <returns></returns>
        public static Composite CastFreeze( UnitSelectionDelegate onUnit, SimpleBooleanDelegate require = null)
        {
            if (onUnit == null)
                return new ActionAlwaysFail();

            if (require == null)
                require = req => true;

            return new Sequence(
                ctx => onUnit(ctx),
                new Decorator(
                    req => req != null && (req as WoWUnit).SpellDistance() < 40 && require(req),
                    new Action( r =>
                    {
                        _locFreeze = (r as WoWUnit).Location;
                        if (StyxWoW.Me.Location.Distance(_locFreeze) > 45)
                            _locFreeze = WoWMathHelper.CalculatePointFrom(StyxWoW.Me.Location, _locFreeze, 7f + (r as WoWUnit).CombatReach);
                        if (StyxWoW.Me.Location.Distance(_locFreeze) > 45)
                            return RunStatus.Failure;
                        return RunStatus.Success;
                    })
                    ),
                new Throttle( TimeSpan.FromMilliseconds(250),
                    Pet.CastPetActionOnLocation(
                        "Freeze",
                        on => _locFreeze,
                        ret => !Me.CurrentTarget.TreatAsFrozen()
                        )
                    )
                );
        }
开发者ID:aash,项目名称:Singular,代码行数:38,代码来源:Frost.cs

示例2: MovementMoveBehind

        public Composite MovementMoveBehind(UnitSelectionDelegate toUnit)
        {
            return
                new Decorator(
                    ret =>
                    THSettings.Instance.AutoMove &&
                    DateTime.Now > DoNotMove &&
                    !Me.Mounted &&
                    !IsOverrideModeOn &&
                    !Me.IsCasting &&
                    //!Me.IsChanneling &&
                    toUnit != null &&
                    toUnit(ret) != null &&
                    toUnit(ret) != Me &&
                    toUnit(ret).IsAlive &&
                    //only MovementMoveBehind if IsWithinMeleeRange
                    GetDistance(toUnit(ret)) <= 5 &&
                    !Me.IsBehind(toUnit(ret)) &&
                    //!IsTank(Me) &&
                    //Only Move again After a certain delay or target move 3 yard from original posision
                    (toUnit(ret).IsPlayer ||
                     !toUnit(ret).IsPlayer && toUnit(ret).CurrentTarget != Me && toUnit(ret).Combat),
                    new Action(ret =>
                        {
                            WoWPoint pointBehind =
                                toUnit(ret).Location.RayCast(
                                    toUnit(ret).Rotation + WoWMathHelper.DegreesToRadians(150), 3f);

                            Navigator.MoveTo(pointBehind);
                            return RunStatus.Failure;
                        }));
        }
开发者ID:bjss1976,项目名称:shamanspecialedition,代码行数:32,代码来源:THMovement.cs

示例3: CreateHunterTrapBehavior

 public static Composite CreateHunterTrapBehavior(string trapName, bool useLauncher, UnitSelectionDelegate onUnit)
 {
     return new PrioritySelector(
         new Decorator(
             ret => onUnit != null && onUnit(ret) != null && onUnit(ret).DistanceSqr < 40 * 40 &&
                    SpellManager.HasSpell(trapName) && !SpellManager.Spells[trapName].Cooldown,
             new PrioritySelector(
                 Spell.BuffSelf(trapName, ret => !useLauncher),
                 Spell.BuffSelf("Trap Launcher", ret => useLauncher),
                 new Decorator(
                     ret => StyxWoW.Me.HasAura("Trap Launcher"),
                     new Sequence(
                         new Switch<string>(ctx => trapName,
                             new SwitchArgument<string>("Immolation Trap",
                                 new Action(ret => LegacySpellManager.CastSpellById(82945))),
                             new SwitchArgument<string>("Freezing Trap",
                                 new Action(ret => LegacySpellManager.CastSpellById(60192))),
                             new SwitchArgument<string>("Explosive Trap",
                                 new Action(ret => LegacySpellManager.CastSpellById(82939))),
                             new SwitchArgument<string>("Ice Trap",
                                 new Action(ret => LegacySpellManager.CastSpellById(82941))),
                             new SwitchArgument<string>("Snake Trap",
                                 new Action(ret => LegacySpellManager.CastSpellById(82948)))
                             ),
                         new ActionSleep(200),
                         new Action(ret => LegacySpellManager.ClickRemoteLocation(onUnit(ret).Location)))))));
 }
开发者ID:killingzor,项目名称:pqrotation-profiles,代码行数:27,代码来源:Common.cs

示例4: CreateFaceTargetBehavior

 public static Composite CreateFaceTargetBehavior(UnitSelectionDelegate toUnit, float viewDegrees = 70f)
 {
     return new Decorator(
         ret =>
         !SingularSettings.Instance.DisableAllMovement && toUnit != null && toUnit(ret) != null &&
         !StyxWoW.Me.IsMoving && !toUnit(ret).IsMe &&
         !StyxWoW.Me.IsSafelyFacing(toUnit(ret), viewDegrees ),
         new Action(ret =>
                        {
                            StyxWoW.Me.CurrentTarget.Face();
                            return RunStatus.Failure;
                        }));
 }
开发者ID:superkhung,项目名称:SingularMod,代码行数:13,代码来源:Movement.cs

示例5: Cast

 private static Composite Cast(string spell, UnitSelectionDelegate onUnit, Selection<bool> reqs = null)
 {
     return
         new Decorator(
             ret => onUnit != null && onUnit(ret) != null &&
                    ((reqs != null && reqs(ret)) || (reqs == null)) &&
                    SpellManager.CanCast(spell, onUnit(ret), true),
             new Sequence(
                 new Action(ret => SpellManager.Cast(spell, onUnit(ret))),
                 new Action(
                     ret =>
                         Log.Info(string.Format("[Casting:{0}] [Target:{1}] [Distance:{2:F1}yds]", spell,
                             onUnit(ret).SafeName, onUnit(ret).Distance)))
                 ));
 }
开发者ID:Lbniese,项目名称:IWantMovement2,代码行数:15,代码来源:CombatRoutineHook.cs

示例6: Cast

		public static Composite Cast(string spell, UnitSelectionDelegate onUnit, Selection<bool> reqs = null)
		{
			return
				new Decorator(
					ret =>
						(onUnit != null && onUnit(ret) != null && (reqs == null || reqs(ret)) &&
						 AbilityManager.CanCast(spell, onUnit(ret))),
					new PrioritySelector(
						new Action(delegate
						{
							Logger.Write(">> Casting <<   " + spell);
							return RunStatus.Failure;
						}),
						new Action(ret => AbilityManager.Cast(spell, onUnit(ret))))
					);
		}
开发者ID:Markeeen,项目名称:BuddyWing.DefaultCombat,代码行数:16,代码来源:Spell.cs

示例7: CreateInterruptSpellCast

        /// <summary>Creates an interrupt spell cast composite. This will attempt to use racials before any class/spec abilities. It will attempt to stun if possible!</summary>
        /// <remarks>Created 9/7/2011.</remarks>
        /// <param name="onUnit">The on unit.</param>
        /// <returns>.</returns>
        public static Composite CreateInterruptSpellCast(UnitSelectionDelegate onUnit)
        {
            return
                new Decorator(
                    // If the target is casting, and can actually be interrupted, AND we've waited out the double-interrupt timer, then find something to interrupt with.
                    ret => onUnit != null && onUnit(ret) != null && onUnit(ret).IsCasting && onUnit(ret).CanInterruptCurrentSpellCast
                    /* && PreventDoubleInterrupt*/,
                    new PrioritySelector(
                        Spell.Cast("Rebuke", onUnit),
                        Spell.Cast("Avenger's Shield", onUnit),
                        Spell.Cast("Hammer of Justice", onUnit),
                        Spell.Cast("Repentance", onUnit, 
                            ret =>  onUnit(ret).IsPlayer || onUnit(ret).IsDemon || onUnit(ret).IsHumanoid || 
                                    onUnit(ret).IsDragon || onUnit(ret).IsGiant || onUnit(ret).IsUndead),

                        Spell.Cast("Kick", onUnit),
                        Spell.Cast("Gouge", onUnit, ret => !onUnit(ret).IsBoss() && !onUnit(ret).MeIsSafelyBehind), // Can't gouge bosses.

                        Spell.Cast("Counterspell", onUnit),

                        Spell.Cast("Wind Shear", onUnit),

                        Spell.Cast("Pummel", onUnit),
                        // Gag Order only works on non-bosses due to it being a silence, not an interrupt!
                        Spell.Cast("Heroic Throw", onUnit, ret => TalentManager.GetCount(3, 7) == 2 && !onUnit(ret).IsBoss()),

                        Spell.Cast("Silence", onUnit),

                        Spell.Cast("Silencing Shot", onUnit),

                        // Can't stun most bosses. So use it on trash, etc.
                        Spell.Cast("Bash", onUnit, ret => !onUnit(ret).IsBoss()),
                        Spell.Cast("Skull Bash (Cat)", onUnit, ret => StyxWoW.Me.Shapeshift == ShapeshiftForm.Cat),
                        Spell.Cast("Skull Bash (Bear)", onUnit, ret => StyxWoW.Me.Shapeshift == ShapeshiftForm.Bear),
                        Spell.Cast("Solar Beam", onUnit, ret => StyxWoW.Me.Shapeshift == ShapeshiftForm.Moonkin),

                        Spell.Cast("Strangulate", onUnit),
                        Spell.Cast("Mind Freeze", onUnit),


                        // Racials last.
                        Spell.Cast("Arcane Torrent", onUnit),
                        // Don't waste stomp on bosses. They can't be stunned 99% of the time!
                        Spell.Cast("War Stomp", onUnit, ret => !onUnit(ret).IsBoss() && onUnit(ret).Distance < 8)
                        ));
        }
开发者ID:killingzor,项目名称:pqrotation-profiles,代码行数:50,代码来源:Common.cs

示例8: CastFreeze

 /// <summary>
 /// Cast "Freeze" pet ability on a target.  Uses a local store for location to
 /// avoid target position changing during cast preparation and being out of
 /// range after range check
 /// </summary>
 /// <param name="onUnit">target to cast on</param>
 /// <returns></returns>
 public static Composite CastFreeze( UnitSelectionDelegate onUnit )
 {
     return new Sequence(
         new Decorator(
             ret => onUnit != null && onUnit(ret) != null,
             new Action( ret => _locFreeze = onUnit(ret).Location)
             ),
         new Throttle( TimeSpan.FromMilliseconds(250),
             Pet.CreateCastPetActionOnLocation(
                 "Freeze",
                 on => _locFreeze,
                 ret => Me.Pet.ManaPercent >= 12
                     && Me.Pet.Location.Distance(_locFreeze) < 45
                     && !Me.CurrentTarget.IsFrozen()
                 )
             )
         );
 }
开发者ID:superkhung,项目名称:SingularMod3,代码行数:25,代码来源:Frost.cs

示例9: MovementMoveStop

 private static Composite MovementMoveStop(UnitSelectionDelegate toUnit, double range)
 {
     return new Decorator(
         ret =>
         THSettings.Instance.AutoMove &&
         !IsOverrideModeOn &&
         toUnit != null &&
         toUnit(ret) != null &&
         toUnit(ret) != Me &&
         toUnit(ret).IsAlive &&
         IsMoving(Me) &&
         IsEnemy(toUnit(ret)) &&
         GetDistance(toUnit(ret)) <= range &&
         InLineOfSpellSightCheck(toUnit(ret)),
         new Action(ret =>
             {
                 Navigator.PlayerMover.MoveStop();
                 return RunStatus.Failure;
             }));
 }
开发者ID:bjss1976,项目名称:shamanspecialedition,代码行数:20,代码来源:THMovement.cs

示例10: CreateMoveToAndFace

 /// <summary>
 ///   Creates a behavior to move within range, within LOS, and keep facing the specified target.
 /// </summary>
 /// <remarks>
 ///   Created 3/4/2011.
 /// </remarks>
 /// <param name = "maxRange">The maximum range.</param>
 /// <param name = "coneDegrees">The cone in degrees. (If we're facing +/- this many degrees from the target, we will face the target)</param>
 /// <param name = "unit">The unit.</param>
 /// <param name="noMovement"></param>
 /// <returns>.</returns>
 protected Composite CreateMoveToAndFace(float maxRange, float coneDegrees, UnitSelectionDelegate unit, bool noMovement)
 {
     return new Decorator(
         ret =>!SingularSettings.Instance.DisableAllMovement&& unit(ret) != null,
         new PrioritySelector(
             new Decorator(
                 ret =>(!unit(ret).InLineOfSightOCD || (!noMovement && unit(ret).DistanceSqr > maxRange * maxRange)),
                 new Action(ret => Navigator.MoveTo(unit(ret).Location))),
             //Returning failure for movestop for smoother movement
             //Rest should return success !
             new Decorator(
                 ret =>Me.IsMoving && unit(ret).DistanceSqr <= maxRange * maxRange,
                 new Action(delegate
                     {
                         Navigator.PlayerMover.MoveStop();
                         return RunStatus.Failure;
                     })),
             new Decorator(
                 ret => Me.CurrentTarget != null && Me.CurrentTarget.IsAlive && !Me.IsSafelyFacing(Me.CurrentTarget, coneDegrees),
                 new Action(ret => Me.CurrentTarget.Face()))
             ));
 }
开发者ID:naacra,项目名称:wowhbbotcracked,代码行数:33,代码来源:SingularRoutine.Movement.cs

示例11: Buff

 public static Composite Buff(string name, bool myBuff, UnitSelectionDelegate onUnit, params string[] buffNames)
 {
     return Buff(name, myBuff, onUnit, ret => true, buffNames);
 }
开发者ID:Asphodan,项目名称:Alphabuddy,代码行数:4,代码来源:Spell.cs

示例12: PreventDoubleCast

 /// <summary>
 /// Creates a composite to avoid double casting spells on specified unit. Mostly usable for spells like Immolate, Devouring Plague etc.
 /// </summary>
 /// <remarks>
 /// Created 19/12/2011 raphus
 /// </remarks>
 /// <param name="unit"> Unit to check </param>
 /// <param name="spellNames"> Spell names to check </param>
 /// <returns></returns>
 public static Composite PreventDoubleCast(UnitSelectionDelegate unit, params string[] spellNames)
 {
     return
         new PrioritySelector(
             new Decorator(
                 ret =>
                 StyxWoW.Me.IsCasting && spellNames.Contains(StyxWoW.Me.CastingSpell.Name) && unit != null &&
                 unit(ret) != null &&
                 unit(ret).Auras.Any(
                     a => a.Value.SpellId == StyxWoW.Me.CastingSpellId && a.Value.CreatorGuid == StyxWoW.Me.Guid),
                 new Action(ret => SpellManager.StopCasting())));
 }
开发者ID:Asphodan,项目名称:Alphabuddy,代码行数:21,代码来源:Spell.cs

示例13: Heal

 public static Composite Heal(string name, SimpleBooleanDelegate checkMovement, UnitSelectionDelegate onUnit,
     SimpleBooleanDelegate requirements, bool allowLagTollerance = false)
 {
     return Heal(name, checkMovement, onUnit, requirements,
         ret => onUnit(ret).HealthPercent > SingularSettings.Instance.IgnoreHealTargetsAboveHealth,
         false);
 }
开发者ID:Asphodan,项目名称:Alphabuddy,代码行数:7,代码来源:Spell.cs

示例14: Cast

 /// <summary>
 ///   Creates a behavior to cast a spell by ID, on a specific unit. Returns
 ///   RunStatus.Success if successful, RunStatus.Failure otherwise.
 /// </summary>
 /// <remarks>
 ///   Created 5/2/2011.
 /// </remarks>
 /// <param name = "spellId">Identifier for the spell.</param>
 /// <param name = "onUnit">The on unit.</param>
 /// <returns>.</returns>
 public static Composite Cast(int spellId, UnitSelectionDelegate onUnit)
 {
     return Cast(spellId, onUnit, ret => true);
 }
开发者ID:Asphodan,项目名称:Alphabuddy,代码行数:14,代码来源:Spell.cs

示例15: Cast

 private Composite Cast(string spell, SimpleBooleanDelegate requirements, UnitSelectionDelegate unit)
 {
     return new Decorator(ret => requirements != null && requirements(ret) && SpellManager.HasSpell(spell) && SpellManager.CanCast(spell, unit(ret), true, true),
         new Styx.TreeSharp.Action(ctx =>
         {
             SpellManager.Cast(spell, unit(ctx));
             Logging.Write(LogLevel.Normal, MONK_COLOR, "Casting Spell [{0}].", spell);
             return RunStatus.Success;
         })
     );
 }
开发者ID:arkandel,项目名称:Mistweaver-Monk,代码行数:11,代码来源:Mistweaver.cs


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