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


C# WoWUnit.AuraExists方法代码示例

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


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

示例1: CastOnTarget

        /// <summary>
        ///     (Non-Blocking) Casts the provided spell on the provided target requiring all conditions to be satisfied prior to
        ///     casting.
        /// </summary>
        /// <returns>Returns true if the cast is successful</returns>
        public static async Task<bool> CastOnTarget(WoWUnit target, IAbility ability, List<ICondition> conditions)
        {
            foreach (var condition in conditions)
                if (!condition.Satisfied())
                {
                    if (Main.Debug && !(condition is IsOffGlobalCooldownCondition))
                    {
                        if (Main.Debug)
                        {
                            Log.Diagnostics("In " + ability + " call.");
                        }
                        if (Main.Debug)
                        {
                            Log.Diagnostics("Failed at condition: " + condition);
                        }

                        if (Main.Debug && ability is Rupture)
                        {
                            Log.Diagnostics("Has Target Rupture up? :" + target.AuraExists(ability.Spell.Id));
                        }
                        // if(Main.Debug) Log.Diagnostics("current Target: " + target);
                       
                    }
                    return false;
                }

            //Check if we should cast Ability depending on Diminishing Return

            /*
            switch (ability.DrCategory)
            {
                    
                case DrCategory.None:
                    if (Main.Debug) Log.Diagnostics("In Switchcase none");
                    break;
                case DrCategory.Disoriented:
                    {
                        if (Main.Debug) Log.Diagnostics("In Switchcase Desoriented, target : "+target.SafeName);
                        if (DiminishingReturnManager.Instance.GetDrLevel(target, DrCategory.Disoriented) >= 3)
                        {
                            Log.Combat(String.Format("Blocked {0} from Casting because Target is on Immune-DR",
                                ability.Spell.Name));
                            return false;
                        }
                        break;


                    }
            }
            
            //Check for sapped targets
            if (ability is SapAbility)
            {

                if (!UnitManager.Instance.LastSappedUnits.ContainsKey(target))
                {
                    if (!SpellManager.HasSpell(ability.Spell)) return false;
                    if (!SpellManager.CanCast(ability.Spell)) return false;
                    if (!SpellManager.Cast(ability.Spell, target)) return false;

                    Log.AppendLine(string.Format("[{0}] Casted {1} on {2}(Energy: {3}, ComboPoints: {4} HP: {5:0.##}%)",
                        ability.Category,
                        ability.Spell.Name,
                        target == null ? "Nothing" : (target.IsMe ? "Me" : target.SafeName),
                        StyxWoW.Me.CurrentEnergy,
                        StyxWoW.Me.ComboPoints,
                        StyxWoW.Me.HealthPercent
                        ), Colors.CornflowerBlue);

                    UnitManager.Instance.LastSappedUnits.Add(target, DateTime.Now + TimeSpan.FromSeconds(5));

                    await CommonCoroutines.SleepForLagDuration();

                    return true;
                } 
                //We sapped that target in the last 5 seconds, do not sap again, get another target
                return false;

            }

            */
            if (!SpellManager.HasSpell(ability.Spell)) return false;
            if (!SpellManager.CanCast(ability.Spell)) return false;
            if (!SpellManager.Cast(ability.Spell, target)) return false;

            var logColor = Colors.CornflowerBlue;

            switch (ability.Category)
            {
                case AbilityCategory.Heal:
                    logColor = Colors.Yellow;
                    break;
                case AbilityCategory.Defensive:
                    logColor = Colors.LightGreen;
                    break;
//.........这里部分代码省略.........
开发者ID:Joshuahelmle,项目名称:BotA,代码行数:101,代码来源:CastManager.cs


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