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


C# WoWUnit.GetAuraById方法代码示例

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


在下文中一共展示了WoWUnit.GetAuraById方法的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()) 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;
                case AbilityCategory.Bloodtalons:
                    logColor = Colors.YellowGreen;
                    break;
                case AbilityCategory.Pandemic:
                    logColor = Colors.Blue;
                    break;
                case AbilityCategory.Buff:
                    logColor = Colors.Plum;
                    break;
            }

            if (StyxWoW.Me.Specialization == WoWSpec.DruidGuardian)
            {
                Log.AppendLine(
                    string.Format("[{0}] Casted {1} on {2} {3}(HP: {4:0.##}%, Rage: {5:0.##}%, SE = {6}) {7}",
                        ability.Category,
                        ability.Spell.Name,
                        target == null ? "Nothing" : (target.IsMe ? "Me" : target.SafeName),
                        target == null
                            ? "No Guid"
                            : (target.IsMe ? string.Empty : "[" + UnitManager.GuidToUnitId(target.Guid) + "] "),
                        StyxWoW.Me.HealthPercent,
                        StyxWoW.Me.RagePercent,
                        UnitManager.Instance.LastKnownSurroundingEnemies.Count,
                        target == null
                            ? string.Empty
                            : (target.IsMe
                                ? string.Empty
                                : string.Format("(Target HP = {0:0.##}%, D = {1:0.##} yd, L = {2})",
                                    target.HealthPercent, target.Distance,
                                    target.HasAura(SpellBook.Lacerate)
                                        ? target.GetAuraById(SpellBook.Lacerate).StackCount.ToString()
                                        : "0"))
                        ), logColor);
            }
            else
            {
                Log.AppendLine(
                    string.Format("[{0}] Casted {1} on {2} {3}({4}CP: {5}, HP: {6:0.##}%, E: {7:0.##}%, SE = {8}) {9}",
                        ability.Category,
                        ability.Spell.Name,
                        target == null ? "Nothing" : (target.IsMe ? "Me" : target.SafeName),
                        target == null
                            ? "No Guid"
                            : (target.IsMe ? string.Empty : "[" + UnitManager.GuidToUnitId(target.Guid) + "] "),
                        ability.Spell.Id == SpellBook.Rake || ability.Spell.Id == SpellBook.Rip
                            ? string.Format("M: {0:0.##}x, ", SnapshotManager.CurrentMultiplier)
                            : string.Empty,
                        StyxWoW.Me.ComboPoints,
                        StyxWoW.Me.HealthPercent,
                        StyxWoW.Me.EnergyPercent,
                        UnitManager.Instance.LastKnownSurroundingEnemies.Count,
                        target == null
                            ? string.Empty
                            : (target.IsMe
                                ? string.Empty
                                : string.Format("(Target HP = {0:0.##}%, D = {1:0.##} ({2:0.##}) yd)",
                                    target.HealthPercent, Math.Abs(target.Distance - target.CombatReach),
                                    target.Distance))
                        ), logColor);
            }


            await CommonCoroutines.SleepForLagDuration();

            return true;
        }
开发者ID:Lbniese,项目名称:PawsPremium,代码行数:91,代码来源:CastManager.cs


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