public static bool HasBuff(SNOPower power) { if (ShouldRefreshBuffs) RefreshCurrentBuffs(); int id = (int)power; return CurrentBuffs.Keys.Any(u => u == id); }
public void Reset() { _isDone = false; _state = States.NotStarted; _actor = null; _attackSkill = SNOPower.None; _attackRange = 10; }
/// <summary> /// Initializes a new instance of the <see cref="SpellCast"/> class. /// </summary> /// <param name="power">The power.</param> /// <param name="posRetriever">The pos retriever.</param> /// <param name="dynWorldRetriever">The dyn world retriever.</param> /// <param name="targetRetriever">The target retriever.</param> /// <param name="extra">The extra.</param> /// <remarks>Created 2012-06-18</remarks> public SpellCast(SNOPower power, ValueRetriever<Vector3> posRetriever = null, ValueRetriever<int> dynWorldRetriever = null, ValueRetriever<int> targetRetriever = null, ValueRetriever<bool> extra = null) { Power = power; PositionRetriever = posRetriever; DynamicWorldIdRetriever = dynWorldRetriever; TargetGuidRetriever = targetRetriever; ExtraCondition = extra; }
/// <summary> /// Check re-use timers on skills, returns true if we can use the power /// </summary> /// <param name="power">The power.</param> /// <param name="recheck">if set to <c>true</c> check again.</param> /// <returns> /// Returns whether or not we can use a skill, or if it's on our own internal Trinity cooldown timer /// </returns> public static bool SNOPowerUseTimer(SNOPower power, bool recheck = false) { if (TimeSinceUse(power) >= CombatBase.GetSNOPowerUseDelay(power)) return true; if (recheck && TimeSinceUse(power) >= 150 && TimeSinceUse(power) <= 600) return true; return false; }
internal int GetBuffStacks(SNOPower thispower) { int iStacks; if (CurrentBuffs.TryGetValue((int)thispower, out iStacks)) { return iStacks; } return 0; }
public static int GetBuffStacks(SNOPower thispower) { if (ShouldRefreshBuffs) RefreshCurrentBuffs(); HotbarBuff buff; if (CurrentBuffs.TryGetValue((int)thispower, out buff)) { return buff.StackCount; } return 0; }
/// <summary> /// Fast lookup for a Skill by SNOPower /// </summary> public static Skill ById(SNOPower power) { if (!_allSkillBySnoPower.Any()) _allSkillBySnoPower = All.ToDictionary(s => s.SNOPower, s => s); Skill skill; var result = _allSkillBySnoPower.TryGetValue(power, out skill); if (!result) { Logger.LogDebug("Unable to find skill for power {0}", power); } return result ? skill : new Skill(); }
/// <summary> /// Fast lookup for a Skill by SNOPower /// </summary> public static Passive ById(SNOPower power) { if (!_allPassiveBySnoPower.Any()) _allPassiveBySnoPower = All.ToDictionary(s => s.SNOPower, s => s); Passive passive; var result = _allPassiveBySnoPower.TryGetValue(power, out passive); if (!result) { Logger.LogDebug("Unable to find passive for power {0}", power); } return result ? passive : new Passive(); }
public static DateTime GetSpellLastused(SNOPower power = SNOPower.None) { DateTime lastUsed; if (power == SNOPower.None && CacheData.AbilityLastUsed.Any()) { var pair = CacheData.AbilityLastUsed.LastOrDefault(); lastUsed = pair.Value; } else { CacheData.AbilityLastUsed.TryGetValue(power, out lastUsed); } return lastUsed; }
/// <summary> /// Casts the specified power. /// </summary> /// <param name="power">The sno power.</param> /// <param name="positionRetriver">The position retriver.</param> /// <param name="levelAreaRetriever">The level area retriever.</param> /// <param name="extraCondition">The extra condition if any.</param> /// <param name="powerType">Type of the power.</param> /// <param name="onUnit">The target acd GUID retriever.</param> /// <returns> /// <c>RunStatus.Success</c> if successful, otherwise <c>RunStatus.Failure</c>. /// </returns> /// <remarks>Created 2012-04-09</remarks> public static Composite Cast(SNOPower power, ValueRetriever<Vector3> positionRetriver, ValueRetriever<int> levelAreaRetriever, int powerType, ValueRetriever<int> onUnit, ValueRetriever<bool> extraCondition) { return new Decorator(ret => { bool canCast = PowerManager.CanCast(power); bool minReqs = extraCondition != null ? extraCondition(ret) : true; return minReqs && canCast; }, new Action(ctx => { Vector3 position = positionRetriver != null ? positionRetriver(ctx) : Vector3.Zero; int levelArea = levelAreaRetriever != null ? levelAreaRetriever(ctx) : 0; int acdGuid = onUnit != null ? onUnit(ctx) : -1; ZetaDia.Me.UsePower(power, position, levelArea, powerType, acdGuid); }) ); }
/// <summary> /// Casts the specified power. /// </summary> /// <param name="power">The sno power.</param> /// <param name="positionRetriver">The position retriver.</param> /// <param name="levelAreaRetriever">The level area retriever.</param> /// <param name="extraCondition">The extra condition if any.</param> /// <param name="onUnit">The target acd GUID retriever.</param> /// <returns> /// <c>RunStatus.Success</c> if successful, otherwise <c>RunStatus.Failure</c>. /// </returns> /// <remarks>Created 2012-04-09</remarks> public static Composite Cast(SNOPower power, ValueRetriever<Vector3> positionRetriver, ValueRetriever<int> levelAreaRetriever, ValueRetriever<int> onUnit, ValueRetriever<bool> extraCondition) { return new Decorator(ret => { bool canCast = PowerManager.CanCast(power); bool minReqs = extraCondition != null ? extraCondition(ret) : true; return minReqs && canCast; }, new Action(ctx => { Vector3 position = positionRetriver != null ? positionRetriver(ctx) : Vector3.Zero; int worldId = levelAreaRetriever != null ? levelAreaRetriever(ctx) : 0; int acdGuid = onUnit != null ? onUnit(ctx) : -1; ZetaDia.Me.UsePower(power, position, worldId, acdGuid); Logger.WriteVerbose("Using power: {0}", power.ToString()); }) ); }
public override Ability CreateAbility(SNOPower Power) { Ability returnAbility=null; #region Shadow Power // Shadow Power if (Power.Equals(SNOPower.DemonHunter_ShadowPower)) { return new Ability { Power=Power, UsageType=AbilityUseType.Buff, WaitVars=new WaitLoops(1, 1, true), Cost=14, SecondaryEnergy=true, UseAvoiding=true, UseOOCBuff=false, Priority=AbilityPriority.High, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated|AbilityConditions.CheckRecastTimer|AbilityConditions.CheckEnergy), Fcriteria=new Func<bool>(() => { return (Bot.Character.dCurrentHealthPct<=0.99d||Bot.Character.bIsRooted||Bot.Combat.iElitesWithinRange[(int)RangeIntervals.Range_25]>=1||Bot.Combat.iAnythingWithinRange[(int)RangeIntervals.Range_15]>=3); }), }; } #endregion #region Smoke Screen // Smoke Screen if (Power.Equals(SNOPower.DemonHunter_SmokeScreen)) { return new Ability { Power=Power, UsageType=AbilityUseType.Buff, WaitVars=new WaitLoops(0, 1, true), Cost=28, SecondaryEnergy=true, Range=0, UseAvoiding=true, UseOOCBuff=false, Priority=AbilityPriority.High, //PreCastConditions=, Fcriteria=new Func<bool>(() => { return (!HasBuff(SNOPower.DemonHunter_ShadowPower)||Bot.Character.bIsIncapacitated) &&(Bot.Character.dDiscipline>=28||(Bot.Character.dDiscipline>=14&&Bot.Combat.IsFleeing)) &&(Bot.Character.dCurrentHealthPct<=0.90||Bot.Character.bIsRooted||Bot.Combat.iElitesWithinRange[(int)RangeIntervals.Range_20]>=1||Bot.Combat.iAnythingWithinRange[(int)RangeIntervals.Range_15]>=3||Bot.Character.bIsIncapacitated); }), }; } #endregion #region Preparation // Preparation if (Power.Equals(SNOPower.DemonHunter_Preparation)) { return new Ability { Power=Power, UsageType=AbilityUseType.Buff, WaitVars=new WaitLoops(1, 1, true), UseAvoiding=true, UseOOCBuff=false, Priority=AbilityPriority.High, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated|AbilityConditions.CheckRecastTimer|AbilityConditions.CheckCanCast), Cost=this.RuneIndexCache[SNOPower.DemonHunter_Preparation]==0?25:0, Fcriteria=new Func<bool>(() => { return Bot.Character.dDisciplinePct<0.25d //Rune: Punishment (Restores all Hatered for 25 disc) ||(this.RuneIndexCache[Power]==0&&Bot.Character.dCurrentEnergyPct<0.20d); }), }; } #endregion #region Evasive Fire // Evasive Fire if (Power.Equals(SNOPower.DemonHunter_EvasiveFire)) { return new Ability { Power=Power, UsageType=AbilityUseType.Target, WaitVars=new WaitLoops(1, 1, true), Cost=0, UseAvoiding=true, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated|AbilityConditions.CheckRecastTimer), UnitsWithinRangeConditions=new Tuple<RangeIntervals,int>(RangeIntervals.Range_20,1), }; } #endregion #region Companion // Companion if (Power.Equals(SNOPower.DemonHunter_Companion)) { return new Ability { Power=Power, UsageType=AbilityUseType.Buff, WaitVars=new WaitLoops(2, 1, true), Cost=10, SecondaryEnergy=true, Counter=1, Range=0, UseAvoiding=false, UseOOCBuff=true, Priority=AbilityPriority.High, PreCastConditions=(AbilityConditions.CheckPetCount|AbilityConditions.CheckEnergy|AbilityConditions.CheckRecastTimer|AbilityConditions.CheckPlayerIncapacitated), }; } #endregion #region Sentry Turret // Sentry Turret if (Power.Equals(SNOPower.DemonHunter_Sentry)) { return new Ability { Power=Power, UsageType=AbilityUseType.Self, WaitVars=new WaitLoops(0, 0, true), Cost=30, UseAvoiding=true, UseOOCBuff=false, Priority=AbilityPriority.High, PreCastConditions=(AbilityConditions.CheckEnergy|AbilityConditions.CheckRecastTimer|AbilityConditions.CheckPlayerIncapacitated), Fcriteria=new Func<bool>(() => { return Bot.Combat.powerLastSnoPowerUsed!=SNOPower.DemonHunter_Sentry&& (Bot.Combat.FleeingLastTarget||DateTime.Now.Subtract(Bot.Combat.LastFleeAction).TotalMilliseconds<1000)|| (Bot.Combat.iElitesWithinRange[(int)RangeIntervals.Range_40]>=1||Bot.Combat.iAnythingWithinRange[(int)RangeIntervals.Range_40]>=2); }), }; } #endregion #region Marked for Death // Marked for Death if (Power.Equals(SNOPower.DemonHunter_MarkedForDeath)) { return new Ability { Power=Power, UsageType=AbilityUseType.Target, WaitVars=new WaitLoops(1, 1, true), Cost=3, SecondaryEnergy=true, Range=40, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated|AbilityConditions.CheckEnergy|AbilityConditions.CheckRecastTimer), UnitsWithinRangeConditions=new Tuple<RangeIntervals, int>(RangeIntervals.Range_40, 3), ElitesWithinRangeConditions=new Tuple<RangeIntervals, int>(RangeIntervals.Range_40, 1), TargetUnitConditionFlags=new UnitTargetConditions(TargetProperties.IsSpecial, 40), }; } #endregion #region Vault // Vault if (Power.Equals(SNOPower.DemonHunter_Vault)) { return new Ability { Power=Power, UsageType=AbilityUseType.Location, WaitVars=new WaitLoops(1, 2, true), Cost=8, SecondaryEnergy=true, Range=20, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated|AbilityConditions.CheckCanCast|AbilityConditions.CheckEnergy|AbilityConditions.CheckRecastTimer), TargetUnitConditionFlags=new UnitTargetConditions(TargetProperties.None,10), UnitsWithinRangeConditions=new Tuple<RangeIntervals,int>(RangeIntervals.Range_6,1), }; } #endregion #region Rain of Vengeance // Rain of Vengeance if (Power.Equals(SNOPower.DemonHunter_RainOfVengeance)) { return new Ability { Power=Power, UsageType=AbilityUseType.Buff, WaitVars=new WaitLoops(1, 1, true), Cost=0, UseAvoiding=true, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated|AbilityConditions.CheckRecastTimer|AbilityConditions.CheckCanCast), UnitsWithinRangeConditions=new Tuple<RangeIntervals, int>(RangeIntervals.Range_25, 7), ElitesWithinRangeConditions=new Tuple<RangeIntervals,int>(RangeIntervals.Range_25, 1), }; } #endregion #region Cluster Arrow // Cluster Arrow if (Power.Equals(SNOPower.DemonHunter_ClusterArrow)) { return new Ability { Power=Power, UsageType=AbilityUseType.Location|AbilityUseType.ClusterLocation, WaitVars=new WaitLoops(1, 1, true), Cost=50, Range=50, IsRanged=true, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated|AbilityConditions.CheckEnergy|AbilityConditions.CheckRecastTimer), UnitsWithinRangeConditions=new Tuple<RangeIntervals, int>(RangeIntervals.Range_50, 3), ElitesWithinRangeConditions=new Tuple<RangeIntervals, int>(RangeIntervals.Range_50, 1), //TargetUnitConditionFlags=new UnitTargetConditions(TargetProperties.IsSpecial,69), ClusterConditions=new ClusterConditions(5d, 50, 1, true), }; } #endregion #region Multi Shot // Multi Shot if (Power.Equals(SNOPower.DemonHunter_Multishot)) { return new Ability { Power=Power, UsageType=AbilityUseType.ClusterTarget| AbilityUseType.Target, WaitVars=new WaitLoops(1, 1, true), Cost=30, Range=55, IsRanged=true, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated|AbilityConditions.CheckEnergy), ClusterConditions=new ClusterConditions(5d, 40, 3, true), }; } #endregion #region Fan of Knives // Fan of Knives if (Power.Equals(SNOPower.DemonHunter_FanOfKnives)) { return new Ability { Power=Power, UsageType=AbilityUseType.Target, WaitVars=new WaitLoops(1, 1, true), Cost=20, Range=0, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated|AbilityConditions.CheckRecastTimer|AbilityConditions.CheckEnergy), UnitsWithinRangeConditions=new Tuple<RangeIntervals, int>(RangeIntervals.Range_15, 4), ElitesWithinRangeConditions=new Tuple<RangeIntervals, int>(RangeIntervals.Range_15, 1), }; } #endregion #region Strafe // Strafe spam - similar to barbarian whirlwind routine if (Power.Equals(SNOPower.DemonHunter_Strafe)) { return new Ability { Power=Power, UsageType=AbilityUseType.ZigZagPathing, WaitVars=new WaitLoops(0, 0, true), Cost=15, Range=25, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated|AbilityConditions.CheckEnergy), TargetUnitConditionFlags=new UnitTargetConditions(TargetProperties.None,15), }; } #endregion #region Spike Trap // Spike Trap if (Power.Equals(SNOPower.DemonHunter_SpikeTrap)) { return new Ability { Power=Power, UsageType=AbilityUseType.Location, WaitVars=new WaitLoops(1, 1, true), Cost=30, Range=40, UseAvoiding=true, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated|AbilityConditions.CheckRecastTimer|AbilityConditions.CheckEnergy), UnitsWithinRangeConditions=new Tuple<RangeIntervals, int>(RangeIntervals.Range_25, 4), ElitesWithinRangeConditions=new Tuple<RangeIntervals, int>(RangeIntervals.Range_30, 1), TargetUnitConditionFlags=new UnitTargetConditions(TargetProperties.IsSpecial,35), Fcriteria=new Func<bool>(() => { return Bot.Combat.powerLastSnoPowerUsed!=SNOPower.DemonHunter_SpikeTrap; }), }; } #endregion #region Caltrops // Caltrops if (Power.Equals(SNOPower.DemonHunter_Caltrops)) { return new Ability { Power=Power, UsageType=AbilityUseType.Buff, WaitVars=new WaitLoops(1, 1, true), Cost=6, SecondaryEnergy=true, Range=0, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated|AbilityConditions.CheckEnergy|AbilityConditions.CheckRecastTimer), UnitsWithinRangeConditions=new Tuple<RangeIntervals, int>(RangeIntervals.Range_30, 2), ElitesWithinRangeConditions=new Tuple<RangeIntervals, int>(RangeIntervals.Range_40, 1), }; } #endregion #region Elemental Arrow // Elemental Arrow if (Power.Equals(SNOPower.DemonHunter_ElementalArrow)) { return new Ability { Power=Power, UsageType=AbilityUseType.ClusterTarget|AbilityUseType.Target, WaitVars=new WaitLoops(0, 1, true), Cost=10, Range=48, IsRanged=true, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated|AbilityConditions.CheckEnergy), ClusterConditions=new ClusterConditions(4d, 40, 2, true), Fcriteria=new Func<bool>(() => { return (!Bot.Target.CurrentTarget.IsTreasureGoblin&& Bot.Target.CurrentTarget.SNOID!=5208&&Bot.Target.CurrentTarget.SNOID!=5209&& Bot.Target.CurrentTarget.SNOID!=5210); }), }; } #endregion #region Chakram // Chakram if (Power.Equals(SNOPower.DemonHunter_Chakram)) { return new Ability { Power=Power, UsageType=AbilityUseType.ClusterTarget|AbilityUseType.Target, WaitVars=new WaitLoops(0, 1, true), Cost=10, Range=50, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated|AbilityConditions.CheckEnergy), ClusterConditions=new ClusterConditions(4d, 40, 2, true), TargetUnitConditionFlags=new UnitTargetConditions(TargetProperties.IsSpecial), Fcriteria=new Func<bool>(() => { return ((!Bot.Class.HotbarPowers.Contains(SNOPower.DemonHunter_ClusterArrow))|| DateTime.Now.Subtract(PowerCacheLookup.dictAbilityLastUse[SNOPower.DemonHunter_Chakram]).TotalMilliseconds>=110000); }), }; } #endregion #region Rapid Fire // Rapid Fire if (Power.Equals(SNOPower.DemonHunter_RapidFire)) { return new Ability { Power=Power, UsageType=AbilityUseType.Target, WaitVars=new WaitLoops(0, 1, true), Cost=20, Range=50, IsRanged=true, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated|AbilityConditions.CheckEnergy), }; } #endregion #region Impale // Impale if (Power.Equals(SNOPower.DemonHunter_Impale)) { return new Ability { Power=Power, UsageType=AbilityUseType.Target, WaitVars=new WaitLoops(0, 1, true), Cost=25, Range=12, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated), TargetUnitConditionFlags=new UnitTargetConditions(TargetProperties.None,12), Fcriteria=new Func<bool>(() => { return ((Bot.Character.dCurrentEnergy>=25&&!Bot.Character.bWaitingForReserveEnergy)||Bot.Character.dCurrentEnergy>=this.iWaitingReservedAmount); }), }; } #endregion #region Hungering Arrow // Hungering Arrow if (Power.Equals(SNOPower.DemonHunter_HungeringArrow)) { return new Ability { Power=Power, UsageType=AbilityUseType.Target, WaitVars=new WaitLoops(0, 1, true), Cost=0, Range=50, IsRanged=true, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.None, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated), }; } #endregion #region Entangling shot // Entangling shot if (Power.Equals(SNOPower.DemonHunter_EntanglingShot)) { return new Ability { Power=Power, UsageType=AbilityUseType.Target, WaitVars=new WaitLoops(0, 1, true), Cost=0, Range=50, IsRanged=true, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.None, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated), }; } #endregion #region Bola Shot // Bola Shot if (Power.Equals(SNOPower.DemonHunter_BolaShot)) { return new Ability { Power=Power, UsageType=AbilityUseType.ClusterTarget|AbilityUseType.Target, WaitVars=new WaitLoops(0, 1, true), Cost=0, Range=50, IsRanged=true, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.None, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated), ClusterConditions=new ClusterConditions(5d, 49f, 2, true), TargetUnitConditionFlags=new UnitTargetConditions(TargetProperties.None, 49), }; } #endregion #region Grenades // Grenades if (Power.Equals(SNOPower.DemonHunter_Grenades)) { return new Ability { Power=Power, UsageType=AbilityUseType.ClusterTarget| AbilityUseType.Target, ClusterConditions=new ClusterConditions(6d, 40f, 1, true), WaitVars=new WaitLoops(0, 1, true), Cost=0, Range=40, IsRanged=true, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.None, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated), }; } #endregion if (Power==SNOPower.Weapon_Ranged_Projectile) returnAbility=Ability.Projectile_Range_Attack; return returnAbility; }
public bool HasDebuff(SNOPower debuffSNO) { try { //These are the debuffs we've seen so far if (CommonData.GetAttribute <int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff0VisualEffect & 0xFFF)) == 1) { return(true); } if (CommonData.GetAttribute <int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff0VisualEffectNone & 0xFFF)) == 1) { return(true); } if (CommonData.GetAttribute <int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff0VisualEffectA & 0xFFF)) == 1) { return(true); } if (CommonData.GetAttribute <int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff0VisualEffectB & 0xFFF)) == 1) { return(true); } if (CommonData.GetAttribute <int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff0VisualEffectC & 0xFFF)) == 1) { return(true); } if (CommonData.GetAttribute <int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff0VisualEffectD & 0xFFF)) == 1) { return(true); } if (CommonData.GetAttribute <int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff0VisualEffectE & 0xFFF)) == 1) { return(true); } if (CommonData.GetAttribute <int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff1VisualEffectC & 0xFFF)) == 1) { return(true); } if (CommonData.GetAttribute <int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff2VisualEffectE & 0xFFF)) == 1) { return(true); } if (CommonData.GetAttribute <int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff3VisualEffectE & 0xFFF)) == 1) { return(true); } if (CommonData.GetAttribute <int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff4VisualEffectNone & 0xFFF)) == 1) { return(true); } //These are here just in case if (CommonData.GetAttribute <int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff1VisualEffectA & 0xFFF)) == 1) { return(true); } if (CommonData.GetAttribute <int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff1VisualEffectB & 0xFFF)) == 1) { return(true); } if (CommonData.GetAttribute <int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff1VisualEffectD & 0xFFF)) == 1) { return(true); } if (CommonData.GetAttribute <int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff1VisualEffectE & 0xFFF)) == 1) { return(true); } if (CommonData.GetAttribute <int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff2VisualEffectA & 0xFFF)) == 1) { return(true); } if (CommonData.GetAttribute <int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff2VisualEffectB & 0xFFF)) == 1) { return(true); } if (CommonData.GetAttribute <int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff2VisualEffectC & 0xFFF)) == 1) { return(true); } if (CommonData.GetAttribute <int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff2VisualEffectD & 0xFFF)) == 1) { return(true); } if (CommonData.GetAttribute <int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff3VisualEffectA & 0xFFF)) == 1) { return(true); } if (CommonData.GetAttribute <int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff3VisualEffectB & 0xFFF)) == 1) { return(true); } if (CommonData.GetAttribute <int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff3VisualEffectC & 0xFFF)) == 1) { return(true); } if (CommonData.GetAttribute <int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff3VisualEffectD & 0xFFF)) == 1) { return(true); } } catch (Exception) { } return(false); }
public TrackedSpell(SNOPower power, int runeIndex, float duration) { Power = power; RuneIndex = runeIndex; Duration = duration; }
internal static int MobsWithDebuff(SNOPower power, float maxRange = 30f) { return (from u in ObjectCache where u.IsUnit && u.IsFullyValid() && u.RadiusDistance <= maxRange && u.HasDebuff(power) select u).Count(); }
private static bool CanCastMantra(SNOPower mantraPower, float combatRange = 10f, int timeSpan = 2950) { var mantraBuff = Skills.Monk.MantraOfConviction.IsActive ? SNOPower.X1_Monk_MantraOfConviction_v2_Passive : Skills.Monk.MantraOfHealing.IsActive ? SNOPower.X1_Monk_MantraOfHealing_v2_Passive : Skills.Monk.MantraOfRetribution.IsActive ? SNOPower.X1_Monk_MantraOfRetribution_v2_Passive : SNOPower.X1_Monk_MantraOfEvasion_v2_Passive; return CanCast(mantraPower) && Player.PrimaryResource >= 50 && TimeSincePowerUse(mantraPower) > timeSpan && (!CacheData.Buffs.HasBuff(mantraBuff,1) || (_hasSwk && TargetUtil.AnyMobsInRange(combatRange))); }
/// <summary> /// Casts a spell on a Vector. /// </summary> /// <param name="power">The sno power.</param> /// <param name="position">The position.</param> /// <param name="extraRequirements">The extra requirements.</param> /// <returns> /// <c>RunStatus.Success</c> if successful, otherwise <c>RunStatus.Failure</c>. /// </returns> /// <remarks> /// Created 2012-04-09 /// </remarks> public static Composite CastAtLocation(SNOPower power, ValueRetriever<Vector3> position, ValueRetriever<bool> extraRequirements = null) { return Cast(power, position, null, extraRequirements); }
public int GetBuffStacks(SNOPower id, int variantId = -1) { return(GetBuffStacks((int)id, variantId)); }
/// <summary> /// Check if a particular buff is present /// </summary> /// <param name="power"></param> /// <returns></returns> public static bool GetHasBuff(SNOPower power) { return GetBuffStacks(power) > 0; }
public CachedBuff GetBuff(SNOPower id) { return(GetBuff((int)id)); }
public bool HasBuff(SNOPower id) { return(HasBuff((int)id)); }
public bool HasBuff(SNOPower power, int variantId) { return(HasBuff((int)power, variantId)); }
/// <summary> /// Checks if a unit is currently being tracked with a given SNOPower. When the spell is properly configured, this can be used to set a "timer" on a DoT re-cast, for example. /// </summary> /// <param name="AcdId"></param> /// <param name="power"></param> /// <returns></returns> public static bool IsUnitTracked(int AcdId, SNOPower power) { return(TrackedUnits.Any(t => t.AcdId == AcdId && t.Power == power)); }
public TrackedSpell(SNOPower power, int runeIndex) { Power = power; RuneIndex = runeIndex; }
public static double SkillDamagePercent(this ACDItem acdItem, SNOPower power) { return Math.Round(acdItem.GetAttribute<float>(((int) power << 12) + ((int) ActorAttributeType.PowerDamagePercentBonus & 0xFFF))*100, MidpointRounding.AwayFromZero); }
public double GetBuffTimeRemainingMilliseconds(SNOPower power) { return(Core.Cooldowns.GetBuffCooldownRemaining(power).TotalMilliseconds); }
/// <summary> /// Returns true if we have the ability and the buff is up, or true if we don't have the ability in our hotbar /// </summary> /// <param name="snoPower"></param> /// <returns></returns> internal static bool CheckAbilityAndBuff(SNOPower snoPower) { return (!Hotbar.Contains(snoPower) || (Hotbar.Contains(snoPower) && GetHasBuff(snoPower))); }
internal override Skill CreateAbility(SNOPower Power) { MonkActiveSkills power = (MonkActiveSkills)Enum.ToObject(typeof(MonkActiveSkills), (int)Power); switch (power) { case MonkActiveSkills.Monk_BreathOfHeaven: return(new BreathofHeaven()); case MonkActiveSkills.Monk_MantraOfRetribution: return(new MantraOfRetribution()); case MonkActiveSkills.Monk_MantraOfHealing: return(new MantraOfHealing()); case MonkActiveSkills.Monk_MantraOfConviction: return(new MantraOfConviction()); case MonkActiveSkills.Monk_FistsofThunder: return(new FistsofThunder()); case MonkActiveSkills.Monk_DeadlyReach: return(new DeadlyReach()); case MonkActiveSkills.Monk_WaveOfLight: return(new WaveOfLight()); case MonkActiveSkills.Monk_SweepingWind: return(new SweepingWind()); case MonkActiveSkills.Monk_DashingStrike: return(new DashingStrike()); case MonkActiveSkills.Monk_Serenity: return(new Serenity()); case MonkActiveSkills.Monk_CripplingWave: return(new CripplingWave()); case MonkActiveSkills.Monk_SevenSidedStrike: return(new SevenSidedStrike()); case MonkActiveSkills.Monk_WayOfTheHundredFists: return(new WayOfTheHundredFists()); case MonkActiveSkills.Monk_InnerSanctuary: return(new InnerSanctuary()); case MonkActiveSkills.Monk_ExplodingPalm: return(new ExplodingPalm()); case MonkActiveSkills.Monk_LashingTailKick: return(new LashingTailKick()); case MonkActiveSkills.Monk_TempestRush: return(new TempestRush()); case MonkActiveSkills.Monk_MysticAlly: return(new MysticAlly()); case MonkActiveSkills.Monk_BlindingFlash: return(new BlindingFlash()); case MonkActiveSkills.Monk_MantraOfEvasion: return(new MantraOfEvasion()); case MonkActiveSkills.Monk_CycloneStrike: return(new CycloneStrike()); default: return(DefaultAttack); } }
/// <summary> /// Returns how many stacks of a particular skill there are /// </summary> /// <param name="power"></param> /// <returns></returns> public static int GetSkillCharges(SNOPower power) { return(CacheData.Hotbar.GetSkillCharges(power)); }
public TrackedSpell(SNOPower power, int runeIndex, float duration) { this.Power = power; this.RuneIndex = runeIndex; this.Duration = duration; }
internal bool HasBuff(SNOPower power) { int id = (int)power; return CurrentBuffs.Keys.Any(u => u == id); }
public TrackedSpell(SNOPower power, int runeIndex) { this.Power = power; this.RuneIndex = runeIndex; }
/// <summary> /// Buffs the specified sno power. /// </summary> /// <param name="power">The sno power.</param> /// <param name="extraRequirements">The extra requirements.</param> /// <returns></returns> /// <remarks>Created 2012-04-09</remarks> public static Composite Buff(SNOPower power, ValueRetriever<bool> extraRequirements = null) { return Cast(power, pos => Vector3.Zero, null, extraRequirements); }
/// <summary> /// Checks if a unit is currently being tracked with a given SNOPower. When the spell is properly configured, this can be used to set a "timer" on a DoT re-cast, for example. /// </summary> /// <param name="acdGuid"></param> /// <param name="power"></param> /// <returns></returns> public static bool IsUnitTracked(int acdGuid, SNOPower power) { return(TrackedUnits.Any(t => t.ACDGuid == acdGuid && t.Power == power)); }
public bool HasBuff(SNOPower power) => Core.Buffs.HasBuff(power);
private static TrinityPower GetWizardPower(bool isCurrentlyAvoiding, bool useOocBuff, bool useDestructiblePower) { // Pick the best destructible power available if (useDestructiblePower) { if (!GetHasBuff(SNOPower.Wizard_Archon)) { return(GetWizardDestructablePower()); } if (CurrentTarget.RadiusDistance <= 10f) { return(new TrinityPower(SNOPower.Wizard_Archon_ArcaneStrike, 20f, Vector3.Zero, -1, CurrentTarget.ACDGuid, 0, 0)); } return(new TrinityPower(SNOPower.Wizard_Archon_DisintegrationWave, 19f, Vector3.Zero, -1, CurrentTarget.ACDGuid, 0, 0)); } // Wizards want to save up to a reserve of 65+ energy MinEnergyReserve = 45; if (!GetHasBuff(SNOPower.Wizard_Archon)) { bool hasIllusionist = HotbarSkills.PassiveSkills.Any(p => p == SNOPower.Wizard_Passive_Illusionist); // Illusionist speed boost if (hasIllusionist && useOocBuff) { // Slow Time on self for speed boost if (CombatBase.CanCast(SNOPower.Wizard_SlowTime)) { return(new TrinityPower(SNOPower.Wizard_SlowTime)); } // Mirror Image for speed boost if (CombatBase.CanCast(SNOPower.Wizard_MirrorImage)) { return(new TrinityPower(SNOPower.Wizard_MirrorImage)); } // Teleport already called from PlayerMover, not here (since it's a "movement" spell, not a buff) } bool hasCalamity = HotbarSkills.AssignedSkills.Any(s => s.Power == SNOPower.Wizard_Teleport && s.RuneIndex == 0); // Offensive Teleport: Calamity if (CombatBase.CanCast(SNOPower.Wizard_Teleport) && hasCalamity) { var bestClusterPoint = TargetUtil.GetBestClusterPoint(); return(new TrinityPower(SNOPower.Wizard_Teleport, 55f, bestClusterPoint)); } bool hasSafePassage = HotbarSkills.AssignedSkills.Any(s => s.Power == SNOPower.Wizard_Teleport && s.RuneIndex == 1); // Defensive Teleport: SafePassage if (CombatBase.CanCast(SNOPower.Wizard_Teleport) && hasSafePassage && TimeSinceUse(SNOPower.Wizard_Teleport) >= 5000 && Player.CurrentHealthPct <= 0.75 && (CurrentTarget.IsBossOrEliteRareUnique || TargetUtil.IsEliteTargetInRange(30f))) { return(new TrinityPower(SNOPower.Wizard_Teleport, 1f, Player.Position)); } // Black Hole experiment //spell steal //[Trinity] Hotbar Skills (Skill/RuneIndex/Slot): Weapon_Ranged_Wand/-1/HotbarMouseLeft X1_Wizard_Wormhole/3/HotbarSlot1 None/-1/HotbarSlot2 //blazar //[Trinity] Hotbar Skills (Skill/RuneIndex/Slot): Weapon_Ranged_Wand/-1/HotbarMouseLeft X1_Wizard_Wormhole/2/HotbarSlot1 None/-1/HotbarSlot2 //event horizon //[Trinity] Hotbar Skills (Skill/RuneIndex/Slot): Weapon_Ranged_Wand/-1/HotbarMouseLeft X1_Wizard_Wormhole/1/HotbarSlot1 None/-1/HotbarSlot2 //absolute zero //[Trinity] Hotbar Skills (Skill/RuneIndex/Slot): Weapon_Ranged_Wand/-1/HotbarMouseLeft X1_Wizard_Wormhole/4/HotbarSlot1 None/-1/HotbarSlot2 //super massive //[Trinity] Hotbar Skills (Skill/RuneIndex/Slot): Weapon_Ranged_Wand/-1/HotbarMouseLeft X1_Wizard_Wormhole/0/HotbarSlot1 None/-1/HotbarSlot2 //no rune //[Trinity] Hotbar Skills (Skill/RuneIndex/Slot): Weapon_Ranged_Wand/-1/HotbarMouseLeft X1_Wizard_Wormhole/-1/HotbarSlot1 None/-1/HotbarSlot2 bool hasSupermassive = HotbarSkills.AssignedSkills.Any(s => s.Power == SNOPower.X1_Wizard_Wormhole && s.RuneIndex == 0); float blackholeRadius = hasSupermassive ? 20f : 15f; if (!useOocBuff && !isCurrentlyAvoiding && CombatBase.CanCast(SNOPower.X1_Wizard_Wormhole, CombatBase.CanCastFlags.NoTimer) && TargetUtil.ClusterExists(blackholeRadius, 45f, 4)) { return(new TrinityPower(SNOPower.X1_Wizard_Wormhole, 45f, TargetUtil.GetBestClusterUnit(blackholeRadius, 45f, 1, false).Position)); } bool arcaneDynamoPassiveReady = (HotbarSkills.PassiveSkills.Any(s => s == SNOPower.Wizard_Passive_ArcaneDynamo) && GetBuffStacks(SNOPower.Wizard_Passive_ArcaneDynamo) == 5); var bestMeteorClusterUnit = TargetUtil.GetBestClusterUnit(); // Meteor: Arcane Dynamo if (!useOocBuff && !Player.IsIncapacitated && !arcaneDynamoPassiveReady && CombatBase.CanCast(SNOPower.Wizard_Meteor, CombatBase.CanCastFlags.NoTimer) && (TargetUtil.EliteOrTrashInRange(65) || TargetUtil.ClusterExists(15f, 65, 2))) { return(new TrinityPower(SNOPower.Wizard_Meteor, 65f, bestMeteorClusterUnit.Position)); } // Diamond Skin SPAM if (!useOocBuff && CombatBase.CanCast(SNOPower.Wizard_DiamondSkin) && LastPowerUsed != SNOPower.Wizard_DiamondSkin && !GetHasBuff(SNOPower.Wizard_DiamondSkin) && (TargetUtil.AnyElitesInRange(25, 1) || TargetUtil.AnyMobsInRange(25, 1) || Player.CurrentHealthPct <= 0.90 || Player.IsIncapacitated || Player.IsRooted || CurrentTarget.RadiusDistance <= 40f)) { return(new TrinityPower(SNOPower.Wizard_DiamondSkin)); } // Diamond Skin off CD bool hasSleekShell = HotbarSkills.AssignedSkills.Any(s => s.Power == SNOPower.Wizard_DiamondSkin && s.RuneIndex == 0); if (hasSleekShell && CombatBase.CanCast(SNOPower.Wizard_DiamondSkin)) { return(new TrinityPower(SNOPower.Wizard_DiamondSkin)); } // Slow Time for in combat if (!useOocBuff && !Player.IsIncapacitated && CombatBase.CanCast(SNOPower.Wizard_SlowTime, CombatBase.CanCastFlags.NoTimer) && (TargetUtil.AnyElitesInRange(25, 1) || TargetUtil.AnyMobsInRange(25, 2) || (CurrentTarget.IsBossOrEliteRareUnique && CurrentTarget.RadiusDistance <= 40f)) && (CombatBase.TimeSpanSincePowerUse(SNOPower.Wizard_SlowTime) > TimeSpan.FromSeconds(15) || SpellHistory.DistanceFromLastTarget(SNOPower.Wizard_SlowTime) > 30f)) { if (TargetUtil.AnyMobsInRange(20f)) { return(new TrinityPower(SNOPower.Wizard_SlowTime)); // cast of Self } return(new TrinityPower(SNOPower.Wizard_SlowTime, 55f, TargetUtil.GetBestClusterUnit(20f).Position)); } // Mirror Image @ half health or 5+ monsters or rooted/incapacitated or last elite left @25% health if (!useOocBuff && CombatBase.CanCast(SNOPower.Wizard_MirrorImage, CombatBase.CanCastFlags.NoTimer) && (Player.CurrentHealthPct <= PlayerEmergencyHealthPotionLimit || TargetUtil.AnyMobsInRange(30, 4) || Player.IsIncapacitated || Player.IsRooted || TargetUtil.AnyElitesInRange(30) || CurrentTarget.IsBossOrEliteRareUnique)) { return(new TrinityPower(SNOPower.Wizard_MirrorImage, 0f, Vector3.Zero, CurrentWorldDynamicId, -1, 1, 1)); } // Familiar if (!Player.IsIncapacitated && CombatBase.CanCast(SNOPower.Wizard_Familiar) && Player.PrimaryResource >= 20 && !Wizard_HasFamiliar()) { return(new TrinityPower(SNOPower.Wizard_Familiar, 0f, Vector3.Zero, CurrentWorldDynamicId, -1, 1, 2)); } // The three wizard armors, done in an else-if loop so it doesn't keep replacing one with the other if (!Player.IsIncapacitated && Player.PrimaryResource >= 25) { // Energy armor as priority cast if available and not buffed if (Hotbar.Contains(SNOPower.Wizard_EnergyArmor)) { if ((!GetHasBuff(SNOPower.Wizard_EnergyArmor) && PowerManager.CanCast(SNOPower.Wizard_EnergyArmor)) || (Hotbar.Contains(SNOPower.Wizard_Archon) && (!GetHasBuff(SNOPower.Wizard_EnergyArmor) || SNOPowerUseTimer(SNOPower.Wizard_EnergyArmor)))) { return(new TrinityPower(SNOPower.Wizard_EnergyArmor, 0f, Vector3.Zero, CurrentWorldDynamicId, -1, 1, 2)); } } // Ice Armor else if (Hotbar.Contains(SNOPower.Wizard_IceArmor)) { if (!GetHasBuff(SNOPower.Wizard_IceArmor) && PowerManager.CanCast(SNOPower.Wizard_IceArmor)) { return(new TrinityPower(SNOPower.Wizard_IceArmor, 0f, Vector3.Zero, CurrentWorldDynamicId, -1, 1, 2)); } } // Storm Armor else if (Hotbar.Contains(SNOPower.Wizard_StormArmor)) { if (!GetHasBuff(SNOPower.Wizard_StormArmor) && PowerManager.CanCast(SNOPower.Wizard_StormArmor)) { return(new TrinityPower(SNOPower.Wizard_StormArmor, 0f, Vector3.Zero, CurrentWorldDynamicId, -1, 1, 2)); } } } // Magic Weapon (10 minutes) if (!Player.IsIncapacitated && Player.PrimaryResource >= 25 && CombatBase.CanCast(SNOPower.Wizard_MagicWeapon) && !GetHasBuff(SNOPower.Wizard_MagicWeapon)) { return(new TrinityPower(SNOPower.Wizard_MagicWeapon, 0f, Vector3.Zero, CurrentWorldDynamicId, -1, 1, 2)); } // Hydra if (!useOocBuff && Hotbar.Contains(SNOPower.Wizard_Hydra)) { var _14s = TimeSpan.FromSeconds(14); const float maxHydraDistance = 30f; const float maxHydraDistSqr = maxHydraDistance * maxHydraDistance; // This will check if We have the "Serpent Sparker" wand, and attempt to cast a 2nd hydra immediately after the first bool serpentSparkerRecast1 = EquippedItemCache.Instance.ItemIds.Contains(WizardCombat.SerpentSparkerId) && LastPowerUsed == SNOPower.Wizard_Hydra && SpellHistory.SpellUseCountInTime(SNOPower.Wizard_Hydra, TimeSpan.FromSeconds(2)) < 2; bool baseRecast = CombatBase.TimeSpanSincePowerUse(SNOPower.Wizard_Hydra) > TimeSpan.FromSeconds(14); var lastCast = SpellHistory.HistoryQueue .Where(p => p.Power.SNOPower == SNOPower.Wizard_Hydra && p.TimeSinceUse < _14s) .OrderBy(s => s.TimeSinceUse).ThenBy(p => p.Power.TargetPosition.Distance2DSqr(CurrentTarget.Position)) .FirstOrDefault(); bool distanceRecast = lastCast != null && lastCast.TargetPosition.Distance2DSqr(CurrentTarget.Position) > maxHydraDistSqr; bool twoAlredyCastIn5Sec = SpellHistory.SpellUseCountInTime(SNOPower.Wizard_Hydra, TimeSpan.FromSeconds(5)) >= 2; if (!Player.IsIncapacitated && CombatBase.CanCast(SNOPower.Wizard_Hydra, CombatBase.CanCastFlags.NoTimer) && (baseRecast || distanceRecast || serpentSparkerRecast1) && !twoAlredyCastIn5Sec && CurrentTarget.RadiusDistance <= maxHydraDistance && Player.PrimaryResource >= 15) { var pos = TargetUtil.GetBestClusterPoint(maxHydraDistance, 65f); return(new TrinityPower(SNOPower.Wizard_Hydra, maxHydraDistance, pos)); } } // Archon if (!useOocBuff && !isCurrentlyAvoiding && CombatBase.CanCast(SNOPower.Wizard_Archon, CombatBase.CanCastFlags.NoTimer) && Wizard_ShouldStartArchon()) { //CanCastArchon = false; //return new TrinityPower(SNOPower.Wizard_Archon, 0f, Vector3.Zero, CurrentWorldDynamicId, -1, 4, 5); // Familiar has been removed for now. Uncomment the three comments below relating to familiars to force re-buffing them int reserveArcanePower = 0; if (Hotbar.Contains(SNOPower.Wizard_MagicWeapon)) { reserveArcanePower += 25; } if (Hotbar.Contains(SNOPower.Wizard_Familiar)) { reserveArcanePower += 25; } if (Hotbar.Contains(SNOPower.Wizard_EnergyArmor) || Hotbar.Contains(SNOPower.Wizard_IceArmor) || Hotbar.Contains(SNOPower.Wizard_StormArmor)) { reserveArcanePower += 25; } bool hasBuffSpells = (Hotbar.Contains(SNOPower.Wizard_MagicWeapon) || Hotbar.Contains(SNOPower.Wizard_Familiar) || Hotbar.Contains(SNOPower.Wizard_EnergyArmor) || Hotbar.Contains(SNOPower.Wizard_IceArmor) || Hotbar.Contains(SNOPower.Wizard_StormArmor)); CanCastArchon = //Player.PrimaryResource >= reserveArcanePower || ( //hasBuffSpells && CheckAbilityAndBuff(SNOPower.Wizard_MagicWeapon) && (!Hotbar.Contains(SNOPower.Wizard_Familiar) || Wizard_HasFamiliar()) && CheckAbilityAndBuff(SNOPower.Wizard_EnergyArmor) && CheckAbilityAndBuff(SNOPower.Wizard_IceArmor) && CheckAbilityAndBuff(SNOPower.Wizard_StormArmor)); if (CanCastArchon) { Player.WaitingForReserveEnergy = false; CanCastArchon = false; ShouldRefreshHotbarAbilities = true; return(new TrinityPower(SNOPower.Wizard_Archon, 0f, Vector3.Zero, CurrentWorldDynamicId, -1, 4, 5)); } Player.WaitingForReserveEnergy = true; } // Explosive Blast if (!useOocBuff && !Player.IsIncapacitated && CombatBase.CanCast(SNOPower.Wizard_ExplosiveBlast, CombatBase.CanCastFlags.NoTimer) && Player.PrimaryResource >= 20) { return(new TrinityPower(SNOPower.Wizard_ExplosiveBlast, 12f, CurrentTarget.Position)); } //SkillDict.Add("Blizzard", SNOPower.Wizard_Blizzard); //RuneDict.Add("GraspingChill", 2); //RuneDict.Add("FrozenSolid", 4); //RuneDict.Add("Snowbound", 3); //RuneDict.Add("StarkWinter", 1); //RuneDict.Add("UnrelentingStorm", 0); bool hasSnowBoundRune = HotbarSkills.AssignedSkills.Any(s => s.Power == SNOPower.Wizard_Blizzard && s.RuneIndex == 3); // Blizzard if (!useOocBuff && !Player.IsIncapacitated && Hotbar.Contains(SNOPower.Wizard_Blizzard) && (TargetUtil.ClusterExists(18f, 90f, 2, false) || TargetUtil.AnyElitesInRange(40f) || TargetUtil.IsEliteTargetInRange(45f)) && (Player.PrimaryResource >= 40 || (hasSnowBoundRune && Player.PrimaryResource >= 20)) && SNOPowerUseTimer(SNOPower.Wizard_Blizzard)) { var bestClusterPoint = TargetUtil.GetBestClusterPoint(18f, 45f, false); return(new TrinityPower(SNOPower.Wizard_Blizzard, 45f, bestClusterPoint, CurrentWorldDynamicId, -1, 1, 1)); } bool hasArcaneDynamo = HotbarSkills.PassiveSkills.Any(s => s == SNOPower.Wizard_Passive_ArcaneDynamo); // Meteor - no arcane dynamo if (!useOocBuff && !Player.IsIncapacitated && !hasArcaneDynamo && CombatBase.CanCast(SNOPower.Wizard_Meteor, CombatBase.CanCastFlags.NoTimer) && (TargetUtil.EliteOrTrashInRange(65) || TargetUtil.ClusterExists(15f, 65, 2))) { return(new TrinityPower(SNOPower.Wizard_Meteor, 65f, bestMeteorClusterUnit.Position)); } //SkillDict.Add("FrostNova", SNOPower.Wizard_FrostNova); //RuneDict.Add("Shatter", 1); //RuneDict.Add("ColdSnap", 3); //RuneDict.Add("FrozenMist", 2); //RuneDict.Add("DeepFreeze", 4); //RuneDict.Add("BoneChill", 0); bool hasDeepFreeze = HotbarSkills.AssignedSkills.Any(s => s.Power == SNOPower.Wizard_FrostNova && s.RuneIndex == 4); // Frost Nova if (!useOocBuff && CombatBase.CanCast(SNOPower.Wizard_FrostNova) && !Player.IsIncapacitated && ((hasDeepFreeze && TargetUtil.AnyMobsInRange(25, 5)) || (!hasDeepFreeze && (TargetUtil.AnyMobsInRange(25, 1) || Player.CurrentHealthPct <= 0.7)) && CurrentTarget.RadiusDistance <= 25f)) { return(new TrinityPower(SNOPower.Wizard_FrostNova, 20f, Vector3.Zero, CurrentWorldDynamicId, -1, 0, 2)); } // Check to see if we have a signature spell on our hotbar, for energy twister check bool hasSignatureSpell = (Hotbar.Contains(SNOPower.Wizard_MagicMissile) || Hotbar.Contains(SNOPower.Wizard_ShockPulse) || Hotbar.Contains(SNOPower.Wizard_SpectralBlade) || Hotbar.Contains(SNOPower.Wizard_Electrocute)); //SkillDict.Add("EnergyTwister", SNOPower.Wizard_EnergyTwister); //RuneDict.Add("MistralBreeze", 3); //RuneDict.Add("GaleForce", 0); //RuneDict.Add("RagingStorm", 1); //RuneDict.Add("WickedWind", 4); //RuneDict.Add("StromChaser", 2); bool hasWickedWindRune = HotbarSkills.AssignedSkills.Any(s => s.Power == SNOPower.Wizard_EnergyTwister && s.RuneIndex == 4); // Energy Twister SPAMS whenever 35 or more ap to generate Arcane Power if (!useOocBuff && !Player.IsIncapacitated && CombatBase.CanCast(SNOPower.Wizard_EnergyTwister) && Player.PrimaryResource >= 35 && // If using storm chaser, then force a signature spell every 1 stack of the buff, if we have a signature spell (!hasSignatureSpell || GetBuffStacks(SNOPower.Wizard_EnergyTwister) < 1) && ((!hasWickedWindRune && CurrentTarget.RadiusDistance <= 25f) || (hasWickedWindRune && CurrentTarget.RadiusDistance <= 60f)) && (!Hotbar.Contains(SNOPower.Wizard_Electrocute) || !DataDictionary.FastMovingMonsterIds.Contains(CurrentTarget.ActorSNO))) { Vector3 bestClusterPoint = TargetUtil.GetBestClusterPoint(10f, 15f); const float twisterRange = 28f; return(new TrinityPower(SNOPower.Wizard_EnergyTwister, twisterRange, bestClusterPoint, CurrentWorldDynamicId, -1, 0, 0)); } // Wave of force if (!useOocBuff && !Player.IsIncapacitated && !isCurrentlyAvoiding && Player.PrimaryResource >= 25 && CombatBase.CanCast(SNOPower.Wizard_WaveOfForce, CombatBase.CanCastFlags.NoTimer)) { return(new TrinityPower(SNOPower.Wizard_WaveOfForce, 15f, CurrentTarget.Position)); } bool hasEntropy = HotbarSkills.AssignedSkills.Any(s => s.Power == SNOPower.Wizard_Disintegrate && s.RuneIndex == 2); float disintegrateRange = hasEntropy ? 10f : 35f; // Disintegrate if (!useOocBuff && !Player.IsIncapacitated && CombatBase.CanCast(SNOPower.Wizard_Disintegrate) && ((Player.PrimaryResource >= 20 && !Player.WaitingForReserveEnergy) || Player.PrimaryResource >= MinEnergyReserve)) { return(new TrinityPower(SNOPower.Wizard_Disintegrate, disintegrateRange, Vector3.Zero, -1, CurrentTarget.ACDGuid, 0, 0)); } // Arcane Orb if (!useOocBuff && !Player.IsIncapacitated && CombatBase.CanCast(SNOPower.Wizard_ArcaneOrb) && ((Player.PrimaryResource >= 30 && !Player.WaitingForReserveEnergy) || Player.PrimaryResource >= MinEnergyReserve)) { return(new TrinityPower(SNOPower.Wizard_ArcaneOrb, 35f, CurrentTarget.ACDGuid)); } // Arcane Torrent if (!useOocBuff && !Player.IsIncapacitated && CombatBase.CanCast(SNOPower.Wizard_ArcaneTorrent) && ((Player.PrimaryResource >= 16 && !Player.WaitingForReserveEnergy) || Player.PrimaryResource >= MinEnergyReserve)) { return(new TrinityPower(SNOPower.Wizard_ArcaneTorrent, 40f, Vector3.Zero, -1, CurrentTarget.ACDGuid, 0, 0)); } //skillDict.Add("RayOfFrost", SNOPower.Wizard_RayOfFrost); //runeDict.Add("Numb", 2); //runeDict.Add("SnowBlast", 0); //runeDict.Add("ColdBlood", 3); //runeDict.Add("SleetStorm", 1); //runeDict.Add("BlackIce", 4); bool hasSleetStorm = HotbarSkills.AssignedSkills.Any(s => s.Power == SNOPower.Wizard_RayOfFrost && s.RuneIndex == 1); // Ray of Frost if (!useOocBuff && !isCurrentlyAvoiding && !Player.IsIncapacitated && Hotbar.Contains(SNOPower.Wizard_RayOfFrost) && Player.PrimaryResource >= 12 && !Player.WaitingForReserveEnergy) { float range = 50f; if (hasSleetStorm) { range = 5f; } return(new TrinityPower(SNOPower.Wizard_RayOfFrost, range, Vector3.Zero, -1, CurrentTarget.ACDGuid, 0, 1)); } bool hasConflagrate = HotbarSkills.AssignedSkills.Any(s => s.Power == SNOPower.Wizard_MagicMissile && s.RuneIndex == 2); // Magic Missile if (!useOocBuff && !isCurrentlyAvoiding && Hotbar.Contains(SNOPower.Wizard_MagicMissile)) { var bestPierceTarget = TargetUtil.GetBestPierceTarget(45f); int targetId; if (bestPierceTarget != null) { targetId = hasConflagrate ? bestPierceTarget.ACDGuid : CurrentTarget.ACDGuid; } else { targetId = CurrentTarget.ACDGuid; } return(new TrinityPower(SNOPower.Wizard_MagicMissile, 45f, targetId)); } // Shock Pulse if (!useOocBuff && !isCurrentlyAvoiding && CombatBase.CanCast(SNOPower.Wizard_ShockPulse)) { return(new TrinityPower(SNOPower.Wizard_ShockPulse, 15f, CurrentTarget.ACDGuid)); } // Spectral Blade if (!useOocBuff && !isCurrentlyAvoiding && CombatBase.CanCast(SNOPower.Wizard_SpectralBlade)) { return(new TrinityPower(SNOPower.Wizard_SpectralBlade, 14f, CurrentTarget.ACDGuid)); } // Electrocute if (!useOocBuff && !isCurrentlyAvoiding && CombatBase.CanCast(SNOPower.Wizard_Electrocute)) { return(new TrinityPower(SNOPower.Wizard_Electrocute, 40f, CurrentTarget.ACDGuid)); } // Default attacks return(CombatBase.DefaultPower); } else { // Archon form // Archon Slow Time for in combat if (!useOocBuff && !Player.IsIncapacitated && CombatBase.CanCast(SNOPower.Wizard_Archon_SlowTime, CombatBase.CanCastFlags.NoTimer) && (CombatBase.TimeSpanSincePowerUse(SNOPower.Wizard_Archon_SlowTime) > TimeSpan.FromSeconds(30))) { return(new TrinityPower(SNOPower.Wizard_Archon_SlowTime, 0f, Vector3.Zero, CurrentWorldDynamicId, -1, 1, 1)); } // Archon Teleport in combat for kiting if (!useOocBuff && !isCurrentlyAvoiding && !Player.IsIncapacitated && CombatBase.CanCast(SNOPower.Wizard_Archon_Teleport, CombatBase.CanCastFlags.NoTimer) && Settings.Combat.Wizard.KiteLimit > 0 && // Try and teleport-retreat from 1 elite or 3+ greys or a boss at 15 foot range (TargetUtil.AnyElitesInRange(15, 1) || TargetUtil.AnyMobsInRange(15, 3) || (CurrentTarget.IsBoss && CurrentTarget.RadiusDistance <= 15f))) { Vector3 vNewTarget = MathEx.CalculatePointFrom(CurrentTarget.Position, Player.Position, -20f); return(new TrinityPower(SNOPower.Wizard_Archon_Teleport, 35f, vNewTarget)); } // Archon teleport in combat for no-kite if (!useOocBuff && !isCurrentlyAvoiding && !Player.IsIncapacitated && CombatBase.CanCast(SNOPower.Wizard_Archon_Teleport, CombatBase.CanCastFlags.NoTimer) && Settings.Combat.Wizard.KiteLimit == 0 && CurrentTarget.RadiusDistance >= 10f) { return(new TrinityPower(SNOPower.Wizard_Archon_Teleport, 35f, CurrentTarget.Position)); } // 2.0.5 Archon elemental runes // This needs some checking on range i think //392694, 392695, 392696 == Arcane Strike, //392697, 392699, 392698 == Disintegration Wave //392692, 392693, 392691 == Arcane Blast, Ice Blast SNOPower beamPower = SNOPower.Wizard_Archon_ArcaneBlast, strikePower = SNOPower.Wizard_Archon_ArcaneStrike, blastPower = SNOPower.Wizard_Archon_DisintegrationWave; HotbarSkills beamSkill = HotbarSkills.AssignedSkills .FirstOrDefault(p => p.Power == SNOPower.Wizard_Archon_DisintegrationWave || p.Power == SNOPower.Wizard_Archon_DisintegrationWave_Cold || p.Power == SNOPower.Wizard_Archon_DisintegrationWave_Fire || p.Power == SNOPower.Wizard_Archon_DisintegrationWave_Lightning); HotbarSkills strikeSkill = HotbarSkills.AssignedSkills .FirstOrDefault(p => p.Power == SNOPower.Wizard_Archon_ArcaneStrike || p.Power == SNOPower.Wizard_Archon_ArcaneStrike_Fire || p.Power == SNOPower.Wizard_Archon_ArcaneStrike_Cold || p.Power == SNOPower.Wizard_Archon_ArcaneStrike_Lightning); HotbarSkills blastSkill = HotbarSkills.AssignedSkills .FirstOrDefault(p => p.Power == SNOPower.Wizard_Archon_ArcaneBlast || p.Power == SNOPower.Wizard_Archon_ArcaneBlast_Cold || p.Power == SNOPower.Wizard_Archon_ArcaneBlast_Fire || p.Power == SNOPower.Wizard_Archon_ArcaneBlast_Lightning); if (beamSkill != null && beamSkill.Power != default(SNOPower)) { beamPower = beamSkill.Power; } if (strikeSkill != null && strikeSkill.Power != default(SNOPower)) { strikePower = strikeSkill.Power; } if (blastSkill != null && blastSkill.Power != default(SNOPower)) { blastPower = blastSkill.Power; } // Arcane Blast - 2 second cooldown, big AoE if (!useOocBuff && !Player.IsIncapacitated && CombatBase.CanCast(blastPower, CombatBase.CanCastFlags.NoTimer)) { return(new TrinityPower(blastPower, 10f, CurrentTarget.Position)); } // Disintegrate if (!useOocBuff && !isCurrentlyAvoiding && !Player.IsIncapacitated && !Settings.Combat.Wizard.DisableDisintegrationWave && CombatBase.CanCast(beamPower, CombatBase.CanCastFlags.NoTimer) && (CurrentTarget.CountUnitsBehind(25f) > 2 || Settings.Combat.Wizard.NoArcaneStrike || Settings.Combat.Wizard.KiteLimit > 0)) { return(new TrinityPower(beamPower, 49f, Vector3.Zero, -1, CurrentTarget.ACDGuid, 0, 0)); } // Arcane Strike Rapid Spam at close-range only, and no AoE inbetween us and target if (!useOocBuff && !Player.IsIncapacitated && !Settings.Combat.Wizard.NoArcaneStrike && CombatBase.CanCast(strikePower, CombatBase.CanCastFlags.NoTimer) && !CacheData.TimeBoundAvoidance.Any(aoe => MathUtil.IntersectsPath(aoe.Position, aoe.Radius, Player.Position, CurrentTarget.Position))) { return(new TrinityPower(strikePower, 7f, Vector3.Zero, -1, CurrentTarget.ACDGuid, 1, 1)); } // Disintegrate as final option just in case if (!useOocBuff && !isCurrentlyAvoiding && !Player.IsIncapacitated && CombatBase.CanCast(beamPower, CombatBase.CanCastFlags.NoTimer)) { return(new TrinityPower(beamPower, 49f, Vector3.Zero, -1, CurrentTarget.ACDGuid, 0, 0)); } return(new TrinityPower(SNOPower.None, -1, Vector3.Zero, -1, -1, 0, 0)); } }
public override Ability CreateAbility(SNOPower Power) { Ability returnAbility=null; #region Spirit Walk // Spirit Walk Cast on 65% health or while avoiding anything but molten core or incapacitated or Chasing Goblins if (Power.Equals(SNOPower.Witchdoctor_SpiritWalk)) { return new Ability { Power=Power, UsageType=AbilityUseType.Buff, WaitVars=new WaitLoops(0, 0, true), Cost=49, UseAvoiding=true, UseOOCBuff=true, IsNavigationSpecial=true, Priority=AbilityPriority.High, PreCastConditions=(AbilityConditions.CheckEnergy|AbilityConditions.CheckCanCast), //TestCustomCombatConditionAlways=true, Fcriteria=new Func<bool>(() => { return (Bot.Character.dCurrentHealthPct<=0.65 ||(Bot.Combat.FleeingLastTarget&&Bot.Combat.iAnythingWithinRange[(int)RangeIntervals.Range_25]>1) ||(Bot.Combat.AvoidanceLastTarget&&Bot.Combat.NearbyAvoidances.Count>0) ||Bot.Character.bIsIncapacitated ||Bot.Character.bIsRooted ||Bot.SettingsFunky.OutOfCombatMovement); }), }; } #endregion #region Soul Harvest // Soul Harvest Any Elites or 2+ Norms and baby it's harvest season if (Power.Equals(SNOPower.Witchdoctor_SoulHarvest)) { return new Ability { Power=Power, UsageType=AbilityUseType.Buff, WaitVars=new WaitLoops(0, 1, true), Cost=59, Counter=5, UseAvoiding=true, UseOOCBuff=false, Priority=AbilityPriority.High, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated| AbilityConditions.CheckCanCast | AbilityConditions.CheckExisitingBuff | AbilityConditions.CheckEnergy), UnitsWithinRangeConditions=new Tuple<RangeIntervals, int>(RangeIntervals.Range_12, 3), }; } #endregion #region Sacrifice // Sacrifice AKA Zombie Dog Jihad, use on Elites Only or to try and Save yourself if (Power.Equals(SNOPower.Witchdoctor_Sacrifice)) { return new Ability { Power=Power, UsageType=AbilityUseType.Buff, WaitVars=new WaitLoops(1, 0, true), Cost=10, Range=48, UseAvoiding=true, UseOOCBuff=false, Priority=AbilityPriority.None, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated| AbilityConditions.CheckCanCast), ElitesWithinRangeConditions=new Tuple<RangeIntervals, int>(RangeIntervals.Range_15, 1), TargetUnitConditionFlags=new UnitTargetConditions(TargetProperties.IsSpecial, 15), }; } #endregion #region Gargantuan // Gargantuan, Recast on 1+ Elites or Bosses to trigger Restless Giant if (Power.Equals(SNOPower.Witchdoctor_Gargantuan)) { return new Ability { Power=Power, UsageType=AbilityUseType.Buff, WaitVars=new WaitLoops(2, 1, true), Cost=147, Counter=1, UseAvoiding=true, UseOOCBuff=true, Priority=AbilityPriority.High, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated| AbilityConditions.CheckCanCast | AbilityConditions.CheckEnergy | AbilityConditions.CheckPetCount), Fbuff=new Func<bool>(() => { return this.RuneIndexCache[SNOPower.Witchdoctor_Gargantuan]!=0&&Bot.Character.PetData.Gargantuan==0; }), Fcriteria=new Func<bool>(() => { return (this.RuneIndexCache[SNOPower.Witchdoctor_Gargantuan]==0&&(Bot.Combat.iElitesWithinRange[(int)RangeIntervals.Range_15]>=1||(Bot.Target.CurrentUnitTarget.IsEliteRareUnique&&Bot.Target.CurrentTarget.RadiusDistance<=15f)) ||this.RuneIndexCache[SNOPower.Witchdoctor_Gargantuan]!=0&&Bot.Character.PetData.Gargantuan==0); }), }; } #endregion #region Zombie dogs // Zombie dogs Woof Woof, good for being blown up, cast when less than or equal to 1 Dog or Not Blowing them up and cast when less than 4 if (Power.Equals(SNOPower.Witchdoctor_SummonZombieDog)) { return new Ability { Power=Power, UsageType=AbilityUseType.Buff, WaitVars=new WaitLoops(0, 0, true), Cost=49, UseAvoiding=true, UseOOCBuff=true, Priority=AbilityPriority.High, PreCastConditions=(AbilityConditions.CheckCanCast|AbilityConditions.CheckEnergy), Fbuff=new Func<bool>(() => { return Bot.Character.PetData.ZombieDogs<(this.PassivePowers.Contains(SNOPower.Witchdoctor_Passive_ZombieHandler)?4:3); }), Fcriteria=new Func<bool>(() => { return Bot.Character.PetData.ZombieDogs<(this.PassivePowers.Contains(SNOPower.Witchdoctor_Passive_ZombieHandler)?4:3); }), }; } #endregion #region Hex // Hex Spam Cast on ANYTHING in range, mmm pork and chicken if (Power.Equals(SNOPower.Witchdoctor_Hex)) { return new Ability { Power=Power, UsageType=AbilityUseType.Self, WaitVars=new WaitLoops(0, 0, true), Cost=49, UseAvoiding=true, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated| AbilityConditions.CheckEnergy | AbilityConditions.CheckCanCast), UnitsWithinRangeConditions=new Tuple<RangeIntervals, int>(RangeIntervals.Range_12, 1), ElitesWithinRangeConditions=new Tuple<RangeIntervals, int>(RangeIntervals.Range_12, 1), TargetUnitConditionFlags=new UnitTargetConditions(TargetProperties.IsSpecial,18), }; } #endregion #region Mass Confuse // Mass Confuse, elites only or big mobs or to escape on low health if (Power.Equals(SNOPower.Witchdoctor_MassConfusion)) { return new Ability { Power=Power, UsageType=AbilityUseType.Target, WaitVars=new WaitLoops(1, 1, true), Cost=74, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated|AbilityConditions.CheckEnergy|AbilityConditions.CheckCanCast), UnitsWithinRangeConditions=new Tuple<RangeIntervals, int>(RangeIntervals.Range_12, 6), ElitesWithinRangeConditions=new Tuple<RangeIntervals, int>(RangeIntervals.Range_12, 1), TargetUnitConditionFlags=new UnitTargetConditions(TargetProperties.IsSpecial, 12), }; } #endregion #region Big Bad Voodoo // Big Bad Voodoo, elites and bosses only if (Power.Equals(SNOPower.Witchdoctor_BigBadVoodoo)) { return new Ability { Power=Power, UsageType=AbilityUseType.Self, WaitVars=new WaitLoops(0, 0, true), UseAvoiding=true, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated| AbilityConditions.CheckCanCast), ElitesWithinRangeConditions=new Tuple<RangeIntervals, int>(RangeIntervals.Range_6, 1), TargetUnitConditionFlags=new UnitTargetConditions(TargetProperties.IsSpecial, 12), }; } #endregion #region Grasp of the Dead // Grasp of the Dead, look below, droping globes and dogs when using it on elites and 3 norms if (Power.Equals(SNOPower.Witchdoctor_GraspOfTheDead)) { return new Ability { Power=Power, UsageType=AbilityUseType.ClusterTarget|AbilityUseType.Target, WaitVars=new WaitLoops(0, 3, true), Cost=122, Range=45, IsRanged=true, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated| AbilityConditions.CheckCanCast | AbilityConditions.CheckEnergy), ClusterConditions=new ClusterConditions(4d, 45f, 2, true), TargetUnitConditionFlags=new UnitTargetConditions(TargetProperties.IsSpecial, 45, falseConditionalFlags: TargetProperties.Fast|TargetProperties.Weak), Fcriteria=new Func<bool>(() => { return !this.bWaitingForSpecial; }), }; } #endregion #region Horrify // Horrify Buff at 60% health if (Power.Equals(SNOPower.Witchdoctor_Horrify)) { return new Ability { Power=Power, UsageType=AbilityUseType.Self, WaitVars=new WaitLoops(0, 0, true), Cost=37, UseAvoiding=true, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated|AbilityConditions.CheckCanCast|AbilityConditions.CheckEnergy), Fcriteria=new Func<bool>(() => { return Bot.Character.dCurrentHealthPct<=0.60; }), }; } #endregion #region Fetish Army // Fetish Army, elites only if (Power.Equals(SNOPower.Witchdoctor_FetishArmy)) { return new Ability { Power=Power, UsageType=AbilityUseType.Self, WaitVars=new WaitLoops(1, 1, true), UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated| AbilityConditions.CheckCanCast), ElitesWithinRangeConditions=new Tuple<RangeIntervals, int>(RangeIntervals.Range_25, 1), TargetUnitConditionFlags=new UnitTargetConditions(TargetProperties.IsSpecial, 16), }; } #endregion #region Spirit Barrage // Spirit Barrage if (Power.Equals(SNOPower.Witchdoctor_SpiritBarrage)) { return new Ability { Power=Power, UsageType=AbilityUseType.ClusterTargetNearest| AbilityUseType.Target, ClusterConditions=new ClusterConditions(5d,20f,1,true), TargetUnitConditionFlags=new UnitTargetConditions(TargetProperties.None,25,falseConditionalFlags: TargetProperties.DOTDPS), WaitVars=new WaitLoops(1, 1, true), Cost=108, Range=21, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated| AbilityConditions.CheckCanCast | AbilityConditions.CheckEnergy), Fcriteria=new Func<bool>(() => { return !this.bWaitingForSpecial; }), }; } #endregion #region Haunt // Haunt the shit out of monster and maybe they will give you treats if (Power.Equals(SNOPower.Witchdoctor_Haunt)) { return new Ability { Power=Power, UsageType=AbilityUseType.Target, TargetUnitConditionFlags=new UnitTargetConditions(TargetProperties.None, 24, falseConditionalFlags: TargetProperties.DOTDPS), WaitVars=new WaitLoops(1, 1, true), Cost=98, Range=21, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated|AbilityConditions.CheckCanCast|AbilityConditions.CheckEnergy), Fcriteria=new Func<bool>(() => { return true; }), }; } #endregion #region Locust // Locust if (Power.Equals(SNOPower.Witchdoctor_Locust_Swarm)) { return new Ability { Power=Power, UsageType=AbilityUseType.ClusterLocation|AbilityUseType.Location, ClusterConditions=new ClusterConditions(5d, 20f, 1, true, 0.25d), TargetUnitConditionFlags=new UnitTargetConditions(TargetProperties.None, 21, 0.5d, TargetProperties.DOTDPS), WaitVars=new WaitLoops(1, 1, true), Cost=196, Range=21, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.High, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated|AbilityConditions.CheckCanCast|AbilityConditions.CheckEnergy|AbilityConditions.CheckRecastTimer), IsSpecialAbility=true, Fcriteria=new Func<bool>(() => { return true; }), }; } #endregion #region Wall of Zombies // Wall of Zombies if (Power.Equals(SNOPower.Witchdoctor_WallOfZombies)) { return new Ability { Power=Power, UsageType=AbilityUseType.Location, WaitVars=new WaitLoops(1, 1, true), Cost=103, Range=25, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated| AbilityConditions.CheckEnergy | AbilityConditions.CheckCanCast ), UnitsWithinRangeConditions=new Tuple<RangeIntervals, int>(RangeIntervals.Range_15, 3), ElitesWithinRangeConditions=new Tuple<RangeIntervals, int>(RangeIntervals.Range_15, 1), TargetUnitConditionFlags=new UnitTargetConditions(TargetProperties.IsSpecial, 25), Fcriteria=new Func<bool>(() => { return !this.bWaitingForSpecial; }), }; } #endregion #region Zombie Charger // Zombie Charger aka Zombie bears Spams Bears @ Everything from 11feet away if (Power.Equals(SNOPower.Witchdoctor_ZombieCharger)) { return new Ability { Power=Power, UsageType=AbilityUseType.ClusterTarget|AbilityUseType.Target, WaitVars=new WaitLoops(0, 1, true), Cost=134, Range=11, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated|AbilityConditions.CheckEnergy|AbilityConditions.CheckCanCast), ClusterConditions=new ClusterConditions(5d, 20f, 2, true), TargetUnitConditionFlags=new UnitTargetConditions(TargetProperties.IsSpecial, 15), }; } #endregion #region Acid Cloud // Acid Cloud if (Power.Equals(SNOPower.Witchdoctor_AcidCloud)) { return new Ability { Power=Power, UsageType=AbilityUseType.ClusterTarget| AbilityUseType.Target, WaitVars=new WaitLoops(1, 1, true), Cost=250, Range=this.RuneIndexCache[Power]==4?20:40, IsRanged=true, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated|AbilityConditions.CheckEnergy|AbilityConditions.CheckCanCast|AbilityConditions.CheckRecastTimer), TargetUnitConditionFlags=new UnitTargetConditions(TargetProperties.IsSpecial, falseConditionalFlags: TargetProperties.Fast), ClusterConditions=new ClusterConditions(4d, this.RuneIndexCache[Power]==4?20f:40f, 2, true), Fcriteria=new Func<bool>(() => { return !this.bWaitingForSpecial; }), }; } #endregion #region Fire Bats // Fire Bats fast-attack if (Power.Equals(SNOPower.Witchdoctor_Firebats)) { return new Ability { Power=Power, UsageType=AbilityUseType.ClusterLocation|AbilityUseType.Target, WaitVars=new WaitLoops(1, 1, true), Range=this.RuneIndexCache[Power]==0?0:this.RuneIndexCache[Power]==4?14:25, IsRanged=true, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.Low, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated), TargetUnitConditionFlags=new UnitTargetConditions(TargetProperties.IsSpecial), ClusterConditions=new ClusterConditions(5d, this.RuneIndexCache[Power]==4?12f:20f, 1, true), Fcriteria=new Func<bool>(() => { return (Bot.Character.dCurrentEnergy>=551||(Bot.Character.dCurrentEnergy>66 &&Bot.Character.CurrentAnimationState==AnimationState.Channeling&&Bot.Character.CurrentSNOAnim.HasFlag(SNOAnim.WitchDoctor_Female_1HT_spell_channel|SNOAnim.WitchDoctor_Female_2HT_spell_channel|SNOAnim.WitchDoctor_Female_HTH_spell_channel|SNOAnim.WitchDoctor_Male_1HT_Spell_Channel|SNOAnim.WitchDoctor_Male_HTH_Spell_Channel))); }), }; } #endregion #region Poison Darts // Poison Darts fast-attack Spams Darts when mana is too low (to cast bears) @12yds or @10yds if Bears avialable if (Power.Equals(SNOPower.Witchdoctor_PoisonDart)) { return new Ability { Power=Power, UsageType=AbilityUseType.Target, WaitVars=new WaitLoops(0, 1, true), Cost=10, Range=48, IsRanged=true, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.None, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated), Fcriteria=new Func<bool>(() => { return true; }), }; } #endregion #region Corpse Spiders // Corpse Spiders fast-attacks Spams Spiders when mana is too low (to cast bears) @12yds or @10yds if Bears avialable if (Power.Equals(SNOPower.Witchdoctor_CorpseSpider)) { return new Ability { Power=Power, UsageType=AbilityUseType.Target, WaitVars=new WaitLoops(0, 1, true), Cost=10, Range=40, IsRanged=true, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.None, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated), Fcriteria=new Func<bool>(() => { return true; }), }; } #endregion #region Toads // Toads fast-attacks Spams Toads when mana is too low (to cast bears) @12yds or @10yds if Bears avialable if (Power.Equals(SNOPower.Witchdoctor_PlagueOfToads)) { return new Ability { Power=Power, UsageType=AbilityUseType.Target, WaitVars=new WaitLoops(0, 1, true), Cost=10, Range=30, IsRanged=true, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.None, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated), Fcriteria=new Func<bool>(() => { return true; }), }; } #endregion #region Fire Bomb // Fire Bomb fast-attacks Spams Bomb when mana is too low (to cast bears) @12yds or @10yds if Bears avialable if (Power.Equals(SNOPower.Witchdoctor_Firebomb)) { return new Ability { Power=Power, UsageType=AbilityUseType.Target|AbilityUseType.ClusterTarget, WaitVars=new WaitLoops(0, 1, true), Range=35, IsRanged=true, UseAvoiding=false, UseOOCBuff=false, Priority=AbilityPriority.None, PreCastConditions=(AbilityConditions.CheckPlayerIncapacitated), ClusterConditions=new ClusterConditions(4d,35,2,true), TargetUnitConditionFlags=new UnitTargetConditions(), }; } #endregion if (Power==SNOPower.Weapon_Melee_Instant) returnAbility=Ability.Instant_Melee_Attack; return returnAbility; }
public static float DistanceFromLastUsePosition(SNOPower power) { var lastUsed = GetSpellLastMyPosition(power); return(Trinity.Player.Position.Distance2D(lastUsed)); }
internal static TrinityCacheObject GetNewHavePowerNonePowerChargeTarget(SNOPower power1, SNOPower power2) { var StaticChareDistance = Settings.Combat.Monk.StaticChargeDistance; var bestTarget = TargetUtil.ClosestUnit(StaticChareDistance, t => t.IsBoss && t.HasDebuff(power1) && !t.HasDebuff(power2)); if (bestTarget == null) { bestTarget = TargetUtil.ClosestUnit(StaticChareDistance, t => t.HasDebuff(power1) && !t.HasDebuff(power2)); if (bestTarget == null) return CurrentTarget; } _lastTargetChange = DateTime.UtcNow; LastSpecialTarget = bestTarget; Logger.Log(LogCategory.Behavior, "Blacklisting {0} {1} for 1 second", CurrentTarget.InternalName, CurrentTarget.CommonData.ACDGuid); Trinity.Blacklist1Second.Add(CurrentTarget.RActorGuid); Logger.Log(LogCategory.Behavior, "Changing target to {0} {1} (Health={2:0.##}%)", bestTarget.InternalName, bestTarget.CommonData.ACDGuid, bestTarget.HitPointsPct * 100); return bestTarget; }
public static void RecordSpell(SNOPower power) { RecordSpell(new TrinityPower(power)); }
/// <summary> /// If the unit has a specific debuff /// </summary> public bool HasDebuff(SNOPower debuffSNO) { try { if (Source.GetAttribute<int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff0VisualEffect & 0xFFF)) == 1) return true; if (Source.GetAttribute<int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff0VisualEffectA & 0xFFF)) == 1) return true; if (Source.GetAttribute<int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff0VisualEffectB & 0xFFF)) == 1) return true; if (Source.GetAttribute<int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff0VisualEffectC & 0xFFF)) == 1) return true; if (Source.GetAttribute<int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff0VisualEffectD & 0xFFF)) == 1) return true; if (Source.GetAttribute<int>(((int)debuffSNO << 12) + ((int)ActorAttributeType.PowerBuff0VisualEffectE & 0xFFF)) == 1) return true; } catch (Exception ex) { Logger.Log("Exception in HasDebuff for {0} on {1}. {2}", debuffSNO, Name, ex); } return false; }
public static TimeSpan TimeSinceUse(SNOPower power) { DateTime lastUsed = GetSpellLastused(power); return(DateTime.UtcNow.Subtract(lastUsed)); }
internal static bool WasUsedWithinMilliseconds(SNOPower power, float timeMs) { var timeSinceCast = TimeSincePowerUse(power); return(timeSinceCast > 0 && timeSinceCast < timeMs); }
/// <summary> /// Gets the time in Millseconds since we've used the specified power /// </summary> /// <param name="power"></param> /// <returns></returns> internal static double TimeSinceUse(SNOPower power) { if (CacheData.AbilityLastUsed.ContainsKey(power)) return DateTime.UtcNow.Subtract(CacheData.AbilityLastUsed[power]).TotalMilliseconds; else return -1; }
/// <summary> /// Casts the specified power. /// </summary> /// <param name="power">The sno power.</param> /// <param name="position">The position.</param> /// <param name="extraCondition">The extra condition if any.</param> /// <param name="onUnit">The target acd GUID retriever.</param> /// <returns><c>RunStatus.Success</c> if successful, otherwise <c>RunStatus.Failure</c>.</returns> /// <remarks>Created 2012-04-09</remarks> public static Composite Cast(SNOPower power, ValueRetriever<Vector3> position, ValueRetriever<int> onUnit, ValueRetriever<bool> extraCondition) { return Cast(power, position, ret => ZetaDia.Me.WorldDynamicId, onUnit, extraCondition); }
/// <summary> /// Returns how many stacks of a particular buff there are /// </summary> /// <param name="power"></param> /// <returns></returns> public static int GetBuffStacks(SNOPower power) { return CacheData.Buffs.GetBuffStacks(power); }
/// <summary> /// Returns how many stacks of a particular buff there are /// </summary> /// <param name="power"></param> /// <returns></returns> public static int GetBuffStacks(SNOPower power) { return(CacheData.Buffs.GetBuffStacks(power)); }
/// <summary> /// Convert a D3 rune index to a proper rune index (order they are listed in d3 skills UI) /// </summary> /// <returns>-999 on failure</returns> public static int GetProperRuneIndex(int dbRuneIndex, SNOPower power) { var firstOrDefault = SkillUtils.ById(power).Runes.FirstOrDefault(r => r.RuneIndex == dbRuneIndex); if (firstOrDefault != null) return firstOrDefault.Index; return -999; }
public static T FindMultiAttributeValue <T>(this ACD acd, SNOPower power, IEnumerable <ActorAttributeType> attributes, Func <T, bool> condition) where T : struct { return(acd.FindMultiAttributeValue(new List <SNOPower> { power }, attributes, condition)); }
/// <summary> /// Returns true if we have the ability and the buff is up, or true if we don't have the ability in our hotbar /// </summary> /// <param name="snoPower"></param> /// <returns></returns> internal static bool CheckAbilityAndBuff(SNOPower snoPower) { return (!CacheData.Hotbar.ActivePowers.Contains(snoPower) || (CacheData.Hotbar.ActivePowers.Contains(snoPower) && GetHasBuff(snoPower))); }
///<summary> ///Create Ability (Derieved classes override this!) ///</summary> internal virtual Skill CreateAbility(SNOPower P) { return(DefaultAttack); }
internal bool HasDebuff(SNOPower power) { int id = (int)power; return CurrentDebuffs.Contains(id); }
public bool UsePower(SNOPower power, Vector3 position) { return(ZetaDia.Me.UsePower(power, position)); }
/// <summary> /// Casts a spell on a unit. /// </summary> /// <param name="power">The sno power.</param> /// <param name="onUnit">The on unit.</param> /// <param name="extraRequirements">The extra requirements.</param> /// <returns> /// <c>RunStatus.Success</c> if successful, otherwise <c>RunStatus.Failure</c>. /// </returns> /// <remarks> /// Created 2012-04-09 /// </remarks> public static Composite CastOnUnit(SNOPower power, ValueRetriever<int> onUnit, ValueRetriever<bool> extraRequirements = null) { return Cast(power, null, null, onUnit, extraRequirements); }
public bool HasBuff(SNOPower power, int variantId) => Core.Buffs.HasBuff(power, variantId);
/// <summary> /// Check if a particular buff is present /// </summary> /// <param name="power"></param> /// <returns></returns> public static bool GetHasBuff(SNOPower power) { int id = (int)power; return(listCachedBuffs.Any(u => u.SNOId == id)); }
internal override Skill CreateAbility(SNOPower Power) { WizardActiveSkills power = (WizardActiveSkills)Enum.ToObject(typeof(WizardActiveSkills), (int)Power); switch (power) { case WizardActiveSkills.Wizard_Electrocute: return(new Electrocute()); case WizardActiveSkills.Wizard_SlowTime: return(new SlowTime()); case WizardActiveSkills.Wizard_ArcaneOrb: return(new ArcaneOrb()); case WizardActiveSkills.Wizard_Blizzard: return(new Blizzard()); case WizardActiveSkills.Wizard_FrostNova: return(new FrostNova()); case WizardActiveSkills.Wizard_Hydra: return(new Hydra()); case WizardActiveSkills.Wizard_MagicMissile: return(new MagicMissile()); case WizardActiveSkills.Wizard_ShockPulse: return(new ShockPulse()); case WizardActiveSkills.Wizard_WaveOfForce: return(new WaveOfForce()); case WizardActiveSkills.Wizard_Meteor: return(new Meteor()); case WizardActiveSkills.Wizard_SpectralBlade: return(new SpectralBlade()); case WizardActiveSkills.Wizard_IceArmor: return(new IceArmor()); case WizardActiveSkills.Wizard_StormArmor: return(new StormArmor()); case WizardActiveSkills.Wizard_DiamondSkin: return(new DiamondSkin()); case WizardActiveSkills.Wizard_MagicWeapon: return(new MagicWeapon()); case WizardActiveSkills.Wizard_EnergyTwister: return(new EnergyTwister()); case WizardActiveSkills.Wizard_EnergyArmor: return(new EnergyArmor()); case WizardActiveSkills.Wizard_ExplosiveBlast: return(new ExplosiveBlast()); case WizardActiveSkills.Wizard_Disintegrate: return(new Disintegrate()); case WizardActiveSkills.Wizard_RayOfFrost: return(new RayOfFrost()); case WizardActiveSkills.Wizard_MirrorImage: return(new MirrorImage()); case WizardActiveSkills.Wizard_Familiar: return(new Familiar()); case WizardActiveSkills.Wizard_ArcaneTorrent: return(new ArcaneTorrent()); case WizardActiveSkills.Wizard_Archon: return(new Archon()); case WizardActiveSkills.Wizard_Archon_ArcaneStrike: return(new ArchonArcaneStrike()); case WizardActiveSkills.Wizard_Archon_DisintegrationWave: return(new ArchonDisintegrationWave()); case WizardActiveSkills.Wizard_Archon_SlowTime: return(new ArchonSlowTime()); case WizardActiveSkills.Wizard_Archon_ArcaneBlast: return(new ArchonArcaneBlast()); case WizardActiveSkills.Wizard_Archon_Teleport: return(new ArchonTeleport()); case WizardActiveSkills.Wizard_Teleport: return(new Teleport()); case WizardActiveSkills.Wizard_BlackHole: return(new BlackHole()); case WizardActiveSkills.Wizard_Archon_ArcaneBlast_Cold: return(new ArchonArcaneBlastCold()); case WizardActiveSkills.Wizard_Archon_ArcaneBlast_Fire: return(new ArchonArcaneBlastFire()); case WizardActiveSkills.Wizard_Archon_ArcaneBlast_Lightning: return(new ArchonArcaneBlastLightning()); case WizardActiveSkills.Wizard_Archon_ArcaneStrike_Cold: return(new ArchonArcaneStrikeCold()); case WizardActiveSkills.Wizard_Archon_ArcaneStrike_Fire: return(new ArchonArcaneStrikeFire()); case WizardActiveSkills.Wizard_Archon_ArcaneStrike_Lightning: return(new ArchonArcaneStrikeLightning()); case WizardActiveSkills.Wizard_Archon_DisintegrationWave_Cold: return(new ArchonDisintegrationWaveCold()); case WizardActiveSkills.Wizard_Archon_DisintegrationWave_Fire: return(new ArchonDisintegrationWaveFire()); case WizardActiveSkills.Wizard_Archon_DisintegrationWave_Lightning: return(new ArchonDisintegrationWaveLightning()); default: return(DefaultAttack); } }
/// <summary> /// Casts an AOE spell. eg; "Wave of Force". /// </summary> /// <param name="power">The sno power.</param> /// <param name="extraRequirements">The extra requirements.</param> /// <returns> /// <c>RunStatus.Success</c> if successful, otherwise <c>RunStatus.Failure</c>. /// </returns> /// <remarks> /// Created 2012-04-09 /// </remarks> public static Composite CastAOESpell(SNOPower power, ValueRetriever<bool> extraRequirements) { return Cast(power, ret => Vector3.Zero, null, extraRequirements); }
/// <summary> /// Check if a particular buff is present /// </summary> /// <param name="power"></param> /// <returns></returns> public static bool GetHasBuff(SNOPower power) { return(CacheData.Buffs.HasBuff(power)); }