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


C# WoWUnit.GetAuraTimeLeft方法代码示例

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


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

示例1: Buff

        public static Composite Buff(SimpleStringDelegate name, bool myBuff, UnitSelectionDelegate onUnit, SimpleBooleanDelegate requirements, int expirSecs, 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;

                    bool hasExpired;
                    if (!buffNames.Any())
                    {
                        hasExpired = _buffUnit.HasAuraExpired(_buffName, expirSecs, myBuff);
                        if (hasExpired && SingularSettings.Debug)
                            Logger.WriteDebug("Spell.Buff(r=>'{0}'): hasspell={1}, auraleft={2:F1} secs", _buffName, SpellManager.HasSpell(_buffName).ToYN(), _buffUnit.GetAuraTimeLeft(_buffName, true).TotalSeconds);

                        return hasExpired;
                    }

                    hasExpired = SpellManager.HasSpell(_buffName) && buffNames.All(b => _buffUnit.HasKnownAuraExpired(b, expirSecs, myBuff));
                    if (hasExpired && SingularSettings.Debug)
                        Logger.WriteDebug("Spell.Buff(r=>'{0}'): hasspell={1}, all auras less than {2:F1} secs", _buffName, SpellManager.HasSpell(_buffName).ToYN(), expirSecs );

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

示例2: Buff

        public static Composite Buff(SimpleStringDelegate name, TimeSpan expires, UnitSelectionDelegate onUnit = null, SimpleBooleanDelegate require = null, bool myBuff = true, HasGcd gcd = HasGcd.Yes, params string[] buffNames)
        {
            if (onUnit == null)
                onUnit = u => Me.CurrentTarget;
            if (require == null)
                require = req => true;

            return new Decorator(
                ret =>
                {
                    if (onUnit == null || name == null || require == null)
                        return false;

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

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

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

                    WoWSpell spell = sfr.Override ?? sfr.Original;
                    _buffName = spell.Name;
                    if (DoubleCastContains(_buffUnit, _buffName))
                        return false;
                    
                    if (!spell.CanCast && (sfr.Override == null || !sfr.Original.CanCast))
                    {
                        if (SingularSettings.DebugSpellCasting)
                            Logger.WriteFile("BuffCanCast[{0}]: spell specific CanCast failed (#{1})", spell.Name, spell.Id);

                        return false;
                    }

                    bool hasExpired;
                    if (!buffNames.Any())
                    {
                        hasExpired = _buffUnit.HasAuraExpired(_buffName, expires, myBuff);
                        if (SingularSettings.DebugSpellCasting)
                        {
                            if (hasExpired )
                                Logger.WriteDebug("Buff=expired: '{0}')={1}: hasspell={2}, auraleft={3:F1} secs", _buffName, hasExpired, SpellManager.HasSpell(_buffName).ToYN(), _buffUnit.GetAuraTimeLeft(_buffName, true).TotalSeconds);
                            else
                                Logger.WriteDebug("Buff=present: '{0}')={1}: hasspell={2}, auraleft={3:F1} secs", _buffName, hasExpired, SpellManager.HasSpell(_buffName).ToYN(), _buffUnit.GetAuraTimeLeft(_buffName, true).TotalSeconds);
                        }

                        return hasExpired;
                    }

                    hasExpired = SpellManager.HasSpell(_buffName) && buffNames.All(b => _buffUnit.HasKnownAuraExpired(b, expires, myBuff));
                    if (hasExpired && SingularSettings.DebugSpellCasting)
                        Logger.WriteDebug("Spell.Buff(r=>'{0}')={1}: hasspell={2}, all auras less than {3:F1} secs", _buffName, hasExpired, SpellManager.HasSpell(_buffName).ToYN(), expires.TotalSeconds);

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

示例3: NeedsRefresh

 private static bool NeedsRefresh( WoWUnit unit)
 {
     long frostTimeLeft = (long)unit.GetAuraTimeLeft("Frost Fever").TotalMilliseconds;
     long bloodTimeLeft = (long)unit.GetAuraTimeLeft("Blood Plauge").TotalMilliseconds;
     return frostTimeLeft > 500 && bloodTimeLeft > 500 && (frostTimeLeft < 3000 || bloodTimeLeft < 3000);
 }
开发者ID:superkhung,项目名称:SingularMod3,代码行数:6,代码来源:Blood.cs


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