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


C# SimpleBooleanDelegate类代码示例

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


SimpleBooleanDelegate类属于命名空间,在下文中一共展示了SimpleBooleanDelegate类的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: CreateUseWand

 /// <summary>
 ///  Creates a behavior to start shooting current target with the wand if extra conditions are met.
 /// </summary>
 /// <param name="extra"> Extra conditions to check to start shooting. </param>
 /// <returns></returns>
 public static Composite CreateUseWand(SimpleBooleanDelegate extra)
 {
     return new PrioritySelector(
         new Decorator(
             ret => Item.HasWand && !StyxWoW.Me.IsWanding() && extra(ret),
             new Action(ret => SpellManager.Cast("Shoot")))
         );
 }
开发者ID:killingzor,项目名称:pqrotation-profiles,代码行数:13,代码来源:Common.cs

示例3: GetChainedClusterCount

        /// <summary>
        /// retrieve best estimation of number of hops a chained spell will make for a given target
        /// </summary>
        /// <param name="target">spell target all hops originate from</param>
        /// <param name="otherUnits">units to consider as possible targets</param>
        /// <param name="chainRange">chain hop distance</param>
        /// <param name="avoid">delegate to determine if an unwanted target would be hit</param>
        /// <returns>0 avoid target would be hit, otherwise count of targets hit (including initial target)</returns>
        public static int GetChainedClusterCount(WoWUnit target, IEnumerable<WoWUnit> otherUnits, float chainRange, SimpleBooleanDelegate avoid = null)
        {
            if (avoid == null)
                return GetChainedCluster(target, otherUnits, chainRange).Count();

            int cnt = 0;
            foreach (var u in GetChainedCluster(target, otherUnits, chainRange))
            {
                cnt++;
                if (avoid(u))
                {
                    cnt = 0;
                    break;
                }
            }
            return cnt;
        }
开发者ID:aash,项目名称:Singular,代码行数:25,代码来源:Clusters.cs

示例4: BuffGroup

 /// <summary>
 /// checks group members in range if they have a buff providing the benefits 
 /// that this spell does, and if not casts the buff upon them.  understands
 /// similar buffs such as Blessing of Kings being same as Mark of the Wild.
 /// if  not in a group, will treat Me as a group of one. 
 /// Will not buff if Mounted unless during prep phase of a battleground
 /// </summary>
 /// <param name="name">spell name of buff</param>
 /// <param name="requirements">requirements delegate that must be true for cast to occur</param>
 /// <param name="myMutexBuffs">list of your buffs which are mutually exclusive to 'name'.  For example, BuffGroup("Blessing of Kings", ret => true, "Blessing of Might") </param>
 /// <returns></returns>
 public static Composite BuffGroup(string name, SimpleBooleanDelegate requirements, params string[] myMutexBuffs)
 {
     return
         new Decorator(ret => IsItTimeToBuff()
                             && SpellManager.HasSpell(name)
                             && (!StyxWoW.Me.Mounted || !PVP.IsPrepPhase),
             new PrioritySelector(
                 ctx => Unit.GroupMembers.FirstOrDefault(m => m.IsAlive && m.DistanceSqr < 30 * 30 && (PartyBuffType.None != (m.GetMissingPartyBuffs() & GetPartyBuffForSpell(name)))),
                 BuffUnit(name, ctx => (WoWUnit)ctx, requirements, myMutexBuffs)
                 )
             );
 }
开发者ID:superkhung,项目名称:SingularMod3,代码行数:23,代码来源:Party.cs

示例5: 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

示例6: CastOnGround

 /// <summary>
 ///   Creates a behavior to cast a spell by name, on the ground at the specified location. Returns RunStatus.Success if successful, RunStatus.Failure otherwise.
 /// </summary>
 /// <remarks>
 ///   Created 5/2/2011.
 /// </remarks>
 /// <param name = "spell">The spell.</param>
 /// <param name = "onLocation">The on location.</param>
 /// <param name = "requirements">The requirements.</param>
 /// <returns>.</returns>
 public static Composite CastOnGround(string spell, LocationRetriever onLocation,
     SimpleBooleanDelegate requirements)
 {
     return CastOnGround(spell, onLocation, requirements, true);
 }
开发者ID:Asphodan,项目名称:Alphabuddy,代码行数:15,代码来源:Spell.cs

示例7: Cast

 /// <summary>
 ///   Creates a behavior to cast a spell by ID, with special requirements. 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 = "requirements">The requirements.</param>
 /// <returns>.</returns>
 public static Composite Cast(int spellId, SimpleBooleanDelegate requirements)
 {
     return Cast(spellId, ret => StyxWoW.Me.CurrentTarget, requirements);
 }
开发者ID:Asphodan,项目名称:Alphabuddy,代码行数:14,代码来源:Spell.cs

示例8: BuffSelf

 /// <summary>
 ///   Creates a behavior to cast a buff by ID on yourself with special requirements. Returns RunStatus.Success if
 ///   successful, RunStatus.Failure otherwise.
 /// </summary>
 /// <remarks>
 ///   Created 5/6/2011.
 /// </remarks>
 /// <param name = "spellId">The buff ID.</param>
 /// <param name = "requirements">The requirements.</param>
 /// <returns>.</returns>
 public static Composite BuffSelf(int spellId, SimpleBooleanDelegate requirements)
 {
     return Buff(spellId, ret => StyxWoW.Me, requirements);
 }
开发者ID:Asphodan,项目名称:Alphabuddy,代码行数:14,代码来源:Spell.cs

示例9: CreateShieldCharge

        private static Composite CreateShieldCharge(UnitSelectionDelegate onUnit = null, SimpleBooleanDelegate requirements = null)
        {
            if (onUnit == null)
                onUnit = on => Me.CurrentTarget;

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

            return new Sequence(
                new Decorator(
                    req => Spell.DoubleCastContains(Me, "Shield Charge") || !HasShieldInOffHand,
                    new ActionAlwaysFail()
                    ),
                Spell.Cast("Shield Charge", onUnit, req => requirements(req), gcd: HasGcd.No),
                new Action(ret => Spell.UpdateDoubleCast("Shield Charge", Me))
                );
        }
开发者ID:aash,项目名称:Singular,代码行数:17,代码来源:Protection.cs

示例10: SelfCast

 private Composite SelfCast(string spell, SimpleBooleanDelegate requirements)
 {
     return Cast(spell, requirements, unit => StyxWoW.Me);
 }
开发者ID:arkandel,项目名称:Mistweaver-Monk,代码行数:4,代码来源:Mistweaver.cs

示例11: CastLikeMonk

 private Composite CastLikeMonk(string spell, UnitSelectionDelegate onUnit, SimpleBooleanDelegate requirements, bool face = false)
 {
     return new Decorator(
         ret => requirements != null && onUnit != null && requirements(ret) && onUnit(ret) != null && spell != null && CanCastLikeMonk(spell, onUnit(ret)),
         new Sequence(
             new Styx.TreeSharp.Action(ctx =>
                 {
                     Logging.Write(LogLevel.Normal, MONK_COLOR, "{0} on {1} at {2:F1} yds at {3:F1}%", spell, onUnit(ctx).Name, onUnit(ctx).Distance, onUnit(ctx).HealthPercent);
                     if (face)
                         onUnit(ctx).Face();
                     SpellManager.Cast(spell, onUnit(ctx));
                 }
             ),
             new WaitContinue(TimeSpan.FromMilliseconds((int)StyxWoW.WoWClient.Latency << 1),
                 ctx => !(SpellManager.GlobalCooldown || StyxWoW.Me.IsCasting || StyxWoW.Me.ChanneledSpell != null),
                 new ActionAlwaysSucceed()
             ),
             new WaitContinue(TimeSpan.FromMilliseconds((int)StyxWoW.WoWClient.Latency << 1),
                 ctx => SpellManager.GlobalCooldown || StyxWoW.Me.IsCasting || StyxWoW.Me.ChanneledSpell != null,
                 new ActionAlwaysSucceed()
             )
         )
     );
 }
开发者ID:arkandel,项目名称:Mistweaver-Monk,代码行数:24,代码来源:Mistweaver.cs

示例12: 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

示例13: CastThrash

 public static Composite CastThrash( UnitSelectionDelegate on, SimpleBooleanDelegate required, int seconds = 2)
 {
     return Spell.Cast( "Thrash", on, req => required(req) && on(req).HasAuraExpired("Thrash",seconds, true));
     // return Spell.Buff("Thrash", true, on, required, 2);
     //  return Spell.Buff(106832, on => Me.CurrentTarget, req => Me.HasAura("Omen of Clarity") && Me.CurrentTarget.HasAuraExpired("Thrash", 3)),
 }
开发者ID:aash,项目名称:Singular,代码行数:6,代码来源:Feral.cs

示例14: Buff

 /// <summary>
 ///   Creates a behavior to cast a buff by name, with special requirements, on a specific unit. Returns
 ///   RunStatus.Success if successful, RunStatus.Failure otherwise.
 /// </summary>
 /// <remarks>
 ///   Created 5/2/2011.
 /// </remarks>
 /// <param name = "spellId">The ID of the buff</param>
 /// <param name = "onUnit">The on unit</param>
 /// <param name = "requirements">The requirements.</param>
 /// <returns></returns>
 public static Composite Buff(int spellId, UnitSelectionDelegate onUnit, SimpleBooleanDelegate requirements)
 {
     return new Decorator(ret => onUnit(ret) != null && onUnit(ret).Auras.Values.All(a => a.SpellId != spellId),
         Cast(spellId, onUnit, requirements));
 }
开发者ID:Asphodan,项目名称:Alphabuddy,代码行数:16,代码来源:Spell.cs

示例15: CreateUseManaGemBehavior

 public static Composite CreateUseManaGemBehavior(SimpleBooleanDelegate requirements)
 {
     return new Throttle( 2,
         new PrioritySelector(
             ctx => StyxWoW.Me.BagItems.FirstOrDefault(i => i.Entry == 36799 || i.Entry == 81901),
             new Decorator(
                 ret => ret != null && StyxWoW.Me.ManaPercent < 100 && ((WoWItem)ret).Cooldown == 0 && requirements(ret),
                 new Sequence(
                     new Action(ret => Logger.Write("Using {0}", ((WoWItem)ret).Name)),
                     new Action(ret => ((WoWItem)ret).Use())
                     )
                 )
             )
         );
 }
开发者ID:aash,项目名称:Singular,代码行数:15,代码来源:Common.cs


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