/// <summary> /// behavior to cast appropriate seal /// </summary> /// <returns></returns> public static Composite CreatePaladinSealBehavior() { return new Throttle( TimeSpan.FromMilliseconds(500), new Sequence( new Action( ret => _seal = GetBestSeal() ), new Decorator( ret => _seal != PaladinSeal.None && !Me.HasMyAura(SealSpell(_seal)) && SpellManager.CanCast(SealSpell(_seal), Me), new Action(ret => SpellManager.Cast(SealSpell(_seal), Me)) ) ) ); }
static string SealSpell( PaladinSeal s) { return "Seal of " + s.ToString(); }
static string SealSpell(PaladinSeal s) { return("Seal of " + s.ToString()); }
/// <summary> /// determines the best PaladinSeal value to use. Attempts to use /// user setting first, but defaults to something reasonable otherwise /// </summary> /// <returns>PaladinSeal to use</returns> public static PaladinSeal GetBestSeal() { if (PaladinSettings.Seal == PaladinSeal.None) { return(PaladinSeal.None); } if (StyxWoW.Me.Specialization == WoWSpec.None) { return(SpellManager.HasSpell("Seal of Command") ? PaladinSeal.Command : PaladinSeal.None); } PaladinSeal bestSeal = Settings.PaladinSeal.Truth; if (PaladinSettings.Seal != Settings.PaladinSeal.Auto) { bestSeal = PaladinSettings.Seal; } else { switch (Me.Specialization) { case WoWSpec.PaladinHoly: if (Me.IsInGroup()) { bestSeal = Settings.PaladinSeal.Insight; } break; // Seal Twisting. fixed bug in prior implementation that would cause it // .. to flip seal too quickly. When we have Insight and go above 5% // .. would cause casting another seal, which would take back below 5% and // .. and recast Insight. Wait till we build up to 10% if we do this to // .. avoid wasting mana and gcd's case WoWSpec.PaladinRetribution: if (Unit.NearbyUnfriendlyUnits.Count(u => u.Distance <= 8) >= 4) { bestSeal = Settings.PaladinSeal.Righteousness; } if (Me.ManaPercent < 10 || (Me.ManaPercent < 20 && Me.HasMyAura("Seal of Insight"))) { bestSeal = Settings.PaladinSeal.Insight; } break; case WoWSpec.PaladinProtection: if (Me.ManaPercent < 5 || (Me.ManaPercent < 10 && Me.HasMyAura("Seal of Insight"))) { bestSeal = Settings.PaladinSeal.Insight; } else if (SingularRoutine.CurrentWoWContext == WoWContext.Battlegrounds) { bestSeal = Settings.PaladinSeal.Truth; } else if (Unit.NearbyUnfriendlyUnits.Count(u => u.Distance <= 8) >= 7) { bestSeal = Settings.PaladinSeal.Righteousness; } break; } } if (!SpellManager.HasSpell(SealSpell(bestSeal))) { if (bestSeal != Settings.PaladinSeal.Truth && SpellManager.HasSpell("Seal of Truth")) { bestSeal = Settings.PaladinSeal.Truth; } else { bestSeal = Settings.PaladinSeal.Command; } } return(bestSeal); }