• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# SimpleBooleanDelegate类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



SimpleBooleanDelegate类属于命名空间,在下文中一共展示了SimpleBooleanDelegate类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: CreateCastSoulburn

 public static Composite CreateCastSoulburn(SimpleBooleanDelegate requirements)
 {
     return new Sequence(
         Spell.BuffSelf("Soulburn", ret => Me.CurrentSoulShards > 0 && requirements(ret)),
         new Wait(TimeSpan.FromMilliseconds(500), ret => Me.HasAura("Soulburn"), new Action(ret => { return RunStatus.Success; }))
         );
 }
开发者ID:superkhung,项目名称:SingularMod3,代码行数:7,代码来源:Common.cs


示例17: BuffUnit

 /// <summary>
 /// private function to buff individual units.  makes assumptions
 /// that certain states have been checked previously. only the 
 /// group interface to PartyBuffs is exposed since it handles the
 /// case of LocalPlayer not in a group as well
 /// </summary>
 /// <param name="name">spell name</param>
 /// <param name="onUnit">unit selection delegate</param>
 /// <param name="requirements">requirements delegate that must be true to cast buff</param>
 /// <param name="myMutexBuffs">list of buffs your mechanics make mutually exclusive for you to cast.  For example, BuffGroup("Blessing of Kings", ret => true, "Blessing of Might") </param>
 /// <returns></returns>
 private static Composite BuffUnit(string name, UnitSelectionDelegate onUnit, SimpleBooleanDelegate requirements, params string[] myMutexBuffs)
 {
     return
         new Decorator(
             ret => onUnit(ret) != null
                 && (PartyBuffType.None != (onUnit(ret).GetMissingPartyBuffs() & GetPartyBuffForSpell(name)))
                 && (myMutexBuffs == null || myMutexBuffs.Count() == 0 || !onUnit(ret).GetAllAuras().Any(a => a.CreatorGuid == StyxWoW.Me.Guid && myMutexBuffs.Contains(a.Name))),
             new Sequence(
                 Spell.Buff( name, onUnit, requirements),
                 new Wait( 1, until => StyxWoW.Me.HasPartyBuff(name), new ActionAlwaysSucceed()),
                 new Action(ret =>
                     {
                     System.Diagnostics.Debug.Assert( PartyBuffType.None != GetPartyBuffForSpell(name));
                     if (PartyBuffType.None != GetPartyBuffForSpell(name))
                         ResetReadyToPartyBuffTimer();
                     else
                         Logger.WriteDebug("Programmer Error: should use Spell.Buff(\"{0}\") instead", name);
                     })
                 )
             );
 }
开发者ID:superkhung,项目名称:SingularMod3,代码行数:32,代码来源:Party.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SimpleButton类代码示例发布时间:2022-05-24
下一篇:
C# SimpleActionExecuteEventArgs类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap