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


C# WoWUnit.HasMyAura方法代码示例

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


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

示例1: Buff

        public static Composite Buff(SimpleStringDelegate name, bool myBuff, UnitSelectionDelegate onUnit, SimpleBooleanDelegate require, params string[] buffNames)
        {
            System.Diagnostics.Debug.Assert(name != null);
            System.Diagnostics.Debug.Assert(onUnit != null);
            System.Diagnostics.Debug.Assert(require != null);

            return new Decorator(
                ret =>
                {
                    _buffUnit = onUnit(ret);
                    if (_buffUnit == null)
                        return false;

                    _buffName = name(ret);
                    if (_buffName == null)
                        return false;

                    SpellFindResults sfr;
                    if (!SpellManager.FindSpell(_buffName, out sfr))
                        return false;

                    if (sfr.Override != null)
                        _buffName = sfr.Override.Name;

                    if (DoubleCastContains(_buffUnit, _buffName))
                        return false;

                    if (!buffNames.Any())
                        return !(myBuff ? _buffUnit.HasMyAura(_buffName) : _buffUnit.HasAura(_buffName));

                    bool buffFound;
                    try
                    {
                        if (myBuff)
                            buffFound = buffNames.Any(b => _buffUnit.HasMyAura(b));
                        else
                            buffFound = buffNames.Any(b => _buffUnit.HasAura(b));
                    }
                    catch
                    {
                        // mark as found buff, so we return false
                        buffFound = true;
                    }

                    return !buffFound;
                },
                new Sequence(
                // new Action(ctx => _lastBuffCast = name),
                    Cast(sp => _buffName, chkMov => true, on => _buffUnit, require, cancel => false /* causes cast to complete */ ),
                    new Action(ret => UpdateDoubleCast(_buffName, _buffUnit))
                    )
                );
        }
开发者ID:aash,项目名称:Singular,代码行数:53,代码来源:Spell.cs

示例2: Replace

        private string Replace(string prefix, string s, WoWUnit theunit)
        {
            string fnname = "FTWCore.Replace";
            MyTimer.Start(fnname);
            if (theunit != null && theunit.Guid == StyxWoW.Me.Guid)
            {
                if (StyxWoW.Me.HasAura("Eclipse (Solar)"))
                    FTWProps._eclipsedirection = -1;
                else if (StyxWoW.Me.HasAura("Eclipse (Lunar)"))
                    FTWProps._eclipsedirection = 1;
            }

            // Replace aura checks with parenthese (Target.HasMyAura("Bad Aura") > 3)
            string findstring = string.Format(@"{0}\.(?<action>.*)\(""(?<aura>.*)""\)", prefix);
            Regex rg = new Regex(findstring);
            Match match = rg.Match(s);
            Dictionary<String, Object> d = new Dictionary<String, Object>();
            while (match.Success)
            {
                if (!d.ContainsKey(match.Value))
                {
                    string action = match.Groups["action"].Value;
                    string aura = match.Groups["aura"].Value;
                    int value = 0;
                    if (false) { }
                    else if (action == "Weapon1HasAura") value = (theunit != null && FTWCoreItems.WeaponEnchant(1) == aura) ? 1 : 0;
                    else if (action == "Weapon2HasAura") value = (theunit != null && FTWCoreItems.WeaponEnchant(2) == aura) ? 1 : 0;
                    else if (action == "AuraExpiring") value = (theunit != null) ? theunit.AuraExpiring(aura) : 0;
                    else if (action == "CanCast") value = (theunit != null && SpellManager.CanCast(aura, theunit)) ? 1 : 0;
                    else if (action == "ClearBehindMe") value = (theunit != null && StyxWoW.Me.ClearBehindMe(aura) ? 1 : 0);
                    else if (action == "HasAura") value = (theunit != null && theunit.HasAura(aura)) ? 1 : 0;
                    else if (action == "HasItem") value = StyxWoW.Me.HasItem(aura) ? 1 : 0;
                    else if (action == "HasMyAura") value = (theunit != null && theunit.HasMyAura(aura)) ? 1 : 0;
                    else if (action == "HasSpell") value = (StyxWoW.Me.HasSpell(aura)) ? 1 : 0;
                    else if (action == "HasTotem") value = FTWCoreStatus.HasTotem(aura) ? 1 : 0;
                    else if (action == "IsCasting") value = (theunit != null && theunit.CurrentSpellName() == aura) ? 1 : 0;
                    else if (action == "ItemOnCooldown") value = FTWCoreItems.ItemOnCooldown(aura) ? 1 : 0;
                    else if (action == "MyAuraExpiring") value = (theunit != null) ? theunit.MyAuraExpiring(aura) : 0;
                    else if (action == "MyStackCount") value = (theunit != null) ? theunit.MyStackCount(aura) : 0;
                    else if (action == "OnCooldown") value = FTWCoreStatus.OnCooldown(aura) ? 1 : 0;
                    else if (action == "PartyWithAura") value = FTWCoreUnits.GetPartyWithAura(aura);
                    else if (action == "PartyWithHealth") value = FTWCoreUnits.GetPartyWithHealth(aura);
                    else if (action == "StackCount") value = (theunit != null) ? theunit.StackCount(aura) : 0;
                    else if (action == "NumItems") value = (theunit != null) ? FTWCoreItems.NumItems(aura) : 0;
                    else throw new Exception(string.Format("Unknown action {0}!", action));
                    d.Add(match.Value, 0);
                    s = s.Replace(match.Value, value.ToString());
                }
                match = match.NextMatch();

            }

            // Replace simple properties
            for (int i = 0; i < FTWProps.PropertyNames.Count(); i++)
            {
                string propname = FTWProps.PropertyNames[i].Trim();
                if (propname.Length > 0)
                {
                    string search = prefix + "." + propname;
                    if (s.Contains(search))
                        s = s.Replace(search, GetProperty(theunit, propname).ToString());
                }
            }

            // Stop the timer
            MyTimer.Stop(fnname);

            return s;
        }
开发者ID:psmyth1,项目名称:code-samples,代码行数:69,代码来源:FTWCore.cs

示例3: IsValidEarthShieldTarget

        private static bool IsValidEarthShieldTarget(WoWUnit unit)
        {
            if ( unit == null || !unit.IsValid || !unit.IsAlive || !Unit.GroupMembers.Any( g => g.Guid == unit.Guid ) || unit.Distance > 99 )
                return false;

            return unit.HasMyAura("Earth Shield") || !unit.HasAnyAura( "Earth Shield", "Water Shield", "Lightning Shield");
        }
开发者ID:superkhung,项目名称:SingularMod3,代码行数:7,代码来源:Restoration.cs

示例4: Buff

        public static Composite Buff(SimpleStringDelegate name, bool myBuff, UnitSelectionDelegate onUnit, SimpleBooleanDelegate requirements, params string[] buffNames)
        {
            return new Decorator(
                ret =>
                {
                    if (onUnit == null || name == null || requirements == null)
                        return false;

                    _buffUnit = onUnit(ret);
                    if (_buffUnit == null)
                        return false;

                    _buffName = name(ret);
                    if (_buffName == null)
                        return false;

                    if (DoubleCastPreventionDict.Contains(_buffUnit, _buffName))
                        return false;

                    if (!buffNames.Any())
                        return !(myBuff ? _buffUnit.HasMyAura(_buffName) : _buffUnit.HasAura(_buffName));

                    bool buffFound;
                    try
                    {
                        if (myBuff)
                            buffFound = buffNames.Any(b => _buffUnit.HasMyAura(b));
                        else
                            buffFound = buffNames.Any(b => _buffUnit.HasAura(b));
                    }
                    catch
                    {
                        // mark as found buff, so we return false
                        buffFound = true;
                    }

                    return !buffFound;
                },
                new Sequence(
                // new Action(ctx => _lastBuffCast = name),
                    Cast( sp => _buffName, chkMov => true, on => _buffUnit, requirements, cancel => false /* causes cast to complete */ ),
                    new Action(ret => UpdateDoubleCastDict(_buffName, _buffUnit))
                    )
                );
        }
开发者ID:superkhung,项目名称:SingularMod3,代码行数:45,代码来源:Spell.cs


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