using System.Linq;
using Singular.Dynamics;
using Singular.Helpers;
using Singular.Managers;
using Singular.Settings;
using Styx;
using Styx.Combat.CombatRoutine;
using Styx.Logic.Combat;
using TreeSharp;
using Styx.WoWInternals.WoWObjects;
using CommonBehaviors.Actions;
using System;
namespace Singular.ClassSpecific.Paladin
{
public class Retribution
{
#region Combat
[Class(WoWClass.Paladin)]
[Spec(TalentSpec.RetributionPaladin)]
[Behavior(BehaviorType.Combat)]
[Behavior(BehaviorType.Heal)]
[Context(WoWContext.All)]
public static Composite CreateRetributionPaladinCombat()
{
return new PrioritySelector(
Safers.EnsureTarget(),
new Decorator( ret => Group.Healer == null, Holy.CreatePaladinHealBehavior(true)),
Movement.CreateMoveToLosBehavior(),
Movement.CreateFaceTargetBehavior(),
Helpers.Common.CreateAutoAttack(true),
//AoE
new Decorator(ret => Unit.NearbyUnfriendlyUnits.Count(a => a.Distance < 8) > 3,
new PrioritySelector(
Spell.Cast("Divine Storm", ret => StyxWoW.Me.CurrentHolyPower < 3),
Spell.Cast("Judgement", ret => !StyxWoW.Me.ActiveAuras.ContainsKey("Zealotry") && StyxWoW.Me.CurrentHolyPower < 3),
Spell.Cast("Inquisition",
ret => (!StyxWoW.Me.ActiveAuras.ContainsKey("Inquisition") || StyxWoW.Me.GetAuraTimeLeft("Inquisition", true).Seconds <= 2) &&
(StyxWoW.Me.CurrentHolyPower >= 3 || StyxWoW.Me.ActiveAuras.ContainsKey("Divine Purpose"))),
Spell.Cast("Templars Verdict", ret => StyxWoW.Me.ActiveAuras.ContainsKey("Divine Purpose")),
Spell.Cast("Templars Verdict", ret => StyxWoW.Me.CurrentHolyPower >= 3),
Spell.Cast("Exorcism", ret => StyxWoW.Me.ActiveAuras.ContainsKey("The Art of War")),
Spell.Cast("Hammer of Wrath"),
Spell.Cast("Holy Wrath"),
Spell.Cast("Consecration", ret => StyxWoW.Me.ManaPercent > 70),
Spell.Cast("Judgement", ret => HasPaladinT13_2PC_Melee() && StyxWoW.Me.ActiveAuras.ContainsKey("Zealotry") && StyxWoW.Me.CurrentHolyPower < 3)
)
),
//Single
new Decorator(ret => Unit.NearbyUnfriendlyUnits.Count(a => a.Distance < 8) < 4,
new PrioritySelector(
Spell.Cast("Crusader Strike", ret => StyxWoW.Me.CurrentHolyPower < 3),
Spell.Cast("Judgement", ret => !StyxWoW.Me.ActiveAuras.ContainsKey("Zealotry") && StyxWoW.Me.CurrentHolyPower < 3),
Spell.Cast("Inquisition",
ret => (!StyxWoW.Me.ActiveAuras.ContainsKey("Inquisition") || StyxWoW.Me.GetAuraTimeLeft("Inquisition", true).Seconds <= 2) &&
(StyxWoW.Me.CurrentHolyPower >= 3 || StyxWoW.Me.ActiveAuras.ContainsKey("Divine Purpose"))),
Spell.Cast("Templars Verdict", ret => StyxWoW.Me.ActiveAuras.ContainsKey("Divine Purpose")),
Spell.Cast("Templars Verdict", ret => StyxWoW.Me.CurrentHolyPower >= 3),
Spell.Cast("Exorcism", ret => StyxWoW.Me.ActiveAuras.ContainsKey("The Art of War")),
Spell.Cast("Hammer of Wrath"),
Spell.Cast("Judgement", ret => HasPaladinT13_2PC_Melee() && StyxWoW.Me.ActiveAuras.ContainsKey("Zealotry") && StyxWoW.Me.CurrentHolyPower < 3),
new Decorator(ret =>
{
TimeSpan cooldown = Spell.GetSpellCooldown("Crusader Strike");
return cooldown.TotalMilliseconds < 20 && cooldown.TotalMilliseconds > 0;
}, new ActionAlwaysSucceed()
),
Spell.Cast("Holy Wrath"),
Spell.Cast("Consecration", ret => StyxWoW.Me.ManaPercent > 70)
)
)
);
}
#endregion
#region Pull
[Class(WoWClass.Paladin)]
[Spec(TalentSpec.RetributionPaladin)]
[Behavior(BehaviorType.Pull)]
[Context(WoWContext.All)]
public static Composite CreateRetributionPaladinPull()
{
return new PrioritySelector(
Movement.CreateMoveToLosBehavior(),
Movement.CreateFaceTargetBehavior(),
Spell.Cast("Judgement"),
Helpers.Common.CreateAutoAttack(true),
Movement.CreateMoveToTargetBehavior(true, 5f)
);
}
#endregion
#region Combat Buffs
[Class(WoWClass.Paladin)]
[Spec(TalentSpec.RetributionPaladin)]
[Behavior(BehaviorType.CombatBuffs)]
[Context(WoWContext.All)]
public static Composite CreateRetributionPaladinCombatBuffs()
{
return new PrioritySelector(
//We don't swap seal, no point.
Spell.Cast("Seal of Truth", ret => !StyxWoW.Me.ActiveAuras.ContainsKey("Seal of Truth")),
//Only use these in non AoE to get best output
new Decorator(ret => Unit.NearbyUnfriendlyUnits.Count(a => a.Distance < 8) < 4,
new PrioritySelector(
//Cast GoAK if target is boss (Shud be on CD to get the best output, there is no logic currently to determine how long a fight is going to last.)
Spell.Cast("Guardian of Ancient Kings", ret => Unit.IsBoss(StyxWoW.Me.CurrentTarget)),
//Cast Zealotry if GoAK been up for 10 seconds
Spell.Cast("Zealotry", ret => StyxWoW.Me.GetAuraTimeLeft("Guardian of Ancient Kings", true).Seconds <= 20 && StyxWoW.Me.GetAuraTimeLeft("Guardian of Ancient Kings", true).Seconds > 0),
//Cast Zealotry if GoAK cd > 110 seconds (1 min 50) and we have no GoAK atm)
Spell.Cast("Zealotry", ret => Spell.GetSpellCooldown("Guardian of Ancient Kings").TotalSeconds >= 110 && !StyxWoW.Me.ActiveAuras.ContainsKey("Guardian of Ancient Kings")),
//Cast Zealotry if target is boss and health percent < 10, we dont wait for GoAK then.
Spell.Cast("Zealotry", ret => Unit.IsBoss(StyxWoW.Me.CurrentTarget) && StyxWoW.Me.CurrentTarget.HealthPercent < 10),
//Cast Zealotry if target isn't boss and level is >= ours
Spell.Cast("Zealotry", ret => !Unit.IsBoss(StyxWoW.Me.CurrentTarget) && StyxWoW.Me.CurrentTarget.Level >= StyxWoW.Me.Level),
//Cast Avenging Wrath if we have Zealotry
Spell.Cast("Avenging Wrath", ret => StyxWoW.Me.ActiveAuras.ContainsKey("Zealotry"))
)
),
Spell.BuffSelf("Divine Protection", ret => StyxWoW.Me.HealthPercent <= SingularSettings.Instance.Paladin.DivineProtectionHealthRet)
);
}
#endregion
private const int PALADIN_MELEE_T13_ITEM_SET_ID = 1064;
public static bool HasPaladinT13_2PC_Melee()
{
int count = StyxWoW.Me.Inventory.Equipped.Hands.ItemInfo.ItemSetId == PALADIN_MELEE_T13_ITEM_SET_ID ? 1 : 0;
count += StyxWoW.Me.Inventory.Equipped.Legs.ItemInfo.ItemSetId == PALADIN_MELEE_T13_ITEM_SET_ID ? 1 : 0;
count += StyxWoW.Me.Inventory.Equipped.Chest.ItemInfo.ItemSetId == PALADIN_MELEE_T13_ITEM_SET_ID ? 1 : 0;
count += StyxWoW.Me.Inventory.Equipped.Shoulder.ItemInfo.ItemSetId == PALADIN_MELEE_T13_ITEM_SET_ID ? 1 : 0;
count += StyxWoW.Me.Inventory.Equipped.Head.ItemInfo.ItemSetId == PALADIN_MELEE_T13_ITEM_SET_ID ? 1 : 0;
return count >= 2;
}
}
}