Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using Belphegor.Dynamics;
- using Belphegor.Helpers;
- using Zeta;
- using Zeta.CommonBot;
- using Zeta.Internals.Actors;
- using Zeta.TreeSharp;
- using Action = Zeta.TreeSharp.Action;
- using Zeta.Common.Helpers;
- namespace Belphegor.Routines
- {
- public class DemonHunter
- {
- [Class(ActorClass.DemonHunter)]
- [Behavior(BehaviorType.Buff)]
- public static Composite DemonHunterBuffs()
- {
- return
- new PrioritySelector(
- Spell.Buff(SNOPower.DemonHunter_Companion,
- req => !HasCompanion
- )
- /*
- * Vault disabled untill i can come up with method to ensure porting is "safe".
- *
- * Technically this is what's required need to make it work properly.
- * - My position compare it against planned location. (Vault will make you jump 35 feets so if you jump too far bot will run back to reach its traveling route.)
- * - If i am facing location.
- * - If it's possible to travel to location using a straight line.
- * - If all of the above is true its safe to use Vault or any other Spell that would make character jump from one location to another.
- */
- /*
- Spell.CastAtLocation(SNOPower.DemonHunter_Vault,
- ctx => ZetaDia.Me.Position,
- require => !ZetaDia.Me.HasBuff(SNOPower.DemonHunter_Vault) && ZetaDia.Me.Movement.ACDTarget.Distance >= 35f
- )
- */
- );
- }
- [Class(ActorClass.DemonHunter)]
- [Behavior(BehaviorType.Combat)]
- public static Composite DemonHunterCombat()
- {
- return
- new PrioritySelector(ctx => CombatTargeting.Instance.FirstNpc,
- Common.CreateWaitWhileIncapacitated(),
- Common.CreateWaitForAttack(),
- Common.CreateUsePotion(),
- new Decorator(ctx => ctx != null,
- new PrioritySelector(
- new Decorator(ctx => ctx != null && ((DiaUnit)ctx).Distance > 30f,
- Movement.MoveTo(ctx => ((DiaUnit)ctx).Position, 15f)
- ),
- //These could use some better values, 0.50 = 50%
- Spell.Buff(SNOPower.DemonHunter_ShadowPower, extra => ZetaDia.Me.HitpointsCurrentPct <= 0.50),
- Spell.Buff(SNOPower.DemonHunter_SmokeScreen, extra => ZetaDia.Me.HitpointsCurrentPct <= 0.50),
- new Decorator(ret => _markTimer.IsFinished && PowerManager.CanCast(SNOPower.DemonHunter_MarkedForDeath),
- new Sequence(
- Spell.CastOnUnit(SNOPower.DemonHunter_MarkedForDeath, ctx => ((DiaUnit)ctx).ACDGuid, ctx => Common.IsElite((DiaUnit)ctx)),
- new Action(ret => _markTimer.Reset()))),
- // AOE
- Spell.CastAOESpell(SNOPower.DemonHunter_RainOfVengeance,
- extra => Clusters.GetClusterCount(ZetaDia.Me, CombatTargeting.Instance.LastObjects, ClusterType.Radius, 45f) >= 3
- ),
- Spell.CastOnUnit(SNOPower.DemonHunter_Strafe,
- ctx => ((DiaUnit)ctx).ACDGuid,
- req => Clusters.GetClusterCount(ZetaDia.Me, CombatTargeting.Instance.LastObjects, ClusterType.Radius, 45f) >= 2
- ),
- Spell.CastOnUnit(SNOPower.DemonHunter_Multishot,
- ctx => ((DiaUnit)ctx).ACDGuid,
- extra => Clusters.GetClusterCount(ZetaDia.Me, CombatTargeting.Instance.LastObjects, ClusterType.Radius, 45f) >= 2
- ),
- Spell.CastOnUnit(SNOPower.DemonHunter_Chakram,
- ctx => ((DiaUnit)ctx).ACDGuid,
- extra => Clusters.GetClusterCount(ZetaDia.Me, CombatTargeting.Instance.LastObjects, ClusterType.Radius, 25f) >= 2
- ),
- Spell.CastAOESpell(SNOPower.DemonHunter_Grenades,
- req => Clusters.GetClusterCount(ZetaDia.Me, CombatTargeting.Instance.LastObjects, ClusterType.Radius, 25f) >= 2
- ),
- Spell.CastOnUnit(SNOPower.DemonHunter_FanOfKnives,
- ctx => ((DiaUnit)ctx).ACDGuid,
- req => Clusters.GetClusterCount(ZetaDia.Me, CombatTargeting.Instance.LastObjects, ClusterType.Radius, 15f) >= 2
- ),
- // Singles
- Spell.CastOnUnit(SNOPower.DemonHunter_Impale, ctx => ((DiaUnit)ctx).ACDGuid),
- Spell.CastOnUnit(SNOPower.DemonHunter_RapidFire, ctx => ((DiaUnit)ctx).ACDGuid),
- Spell.CastOnUnit(SNOPower.DemonHunter_ElementalArrow, ctx => ((DiaUnit)ctx).ACDGuid),
- Spell.CastOnUnit(SNOPower.DemonHunter_ClusterArrow, ctx => ((DiaUnit)ctx).ACDGuid),
- // Hatred Generators
- Spell.CastOnUnit(SNOPower.DemonHunter_EvasiveFire, ctx => ((DiaUnit)ctx).ACDGuid),
- Spell.CastOnUnit(SNOPower.DemonHunter_HungeringArrow, ctx => ((DiaUnit)ctx).ACDGuid),
- Spell.CastOnUnit(SNOPower.DemonHunter_BolaShot, ctx => ((DiaUnit)ctx).ACDGuid),
- Spell.CastOnUnit(SNOPower.DemonHunter_EntanglingShot, ctx => ((DiaUnit)ctx).ACDGuid)
- )
- ),
- new Action(ret => RunStatus.Success)
- );
- }
- #region timmers
- static DemonHunter()
- {
- GameEvents.OnGameLeft += OnGameLeft;
- //GameEvents.OnPlayerDied += OnGameLeft;
- }
- private static WaitTimer _markTimer = new WaitTimer(TimeSpan.FromSeconds(10));
- static void OnGameLeft(object sender, EventArgs e)
- {
- _markTimer.Stop();
- }
- #endregion
- public static bool HasCompanion
- {
- get
- {
- int dynId = ZetaDia.Me.CommonData.DynamicId;
- //You only need to partialy reference the name string :)
- var companion = ZetaDia.Actors.GetActorsOfType<DiaUnit>().FirstOrDefault(u => u != null && u.Name.Contains("DH_Companion") && u.SummonedByACDId == dynId);
- return companion != null;
- }
- }
- public static void DemonHunterOnLevelUp(object sender, EventArgs e)
- {
- if (ZetaDia.Me.ActorClass != ActorClass.DemonHunter)
- return;
- int myLevel = ZetaDia.Me.Level;
- Logger.Write("Player leveled up, congrats! Your level is now: {0}",
- myLevel
- );
- if (myLevel == 2)
- {
- ZetaDia.Me.SetActiveSkill(SNOPower.DemonHunter_Impale, -1, 1);
- Logger.Write("Setting Impale as Secondary skill");
- }
- if (myLevel == 4)
- {
- ZetaDia.Me.SetActiveSkill(SNOPower.DemonHunter_Caltrops, -1, 2);
- Logger.Write("Setting Caltrops as Defensive skill");
- }
- if (myLevel == 5)
- {
- ZetaDia.Me.SetActiveSkill(SNOPower.DemonHunter_RapidFire, -1, 1);
- Logger.Write("Setting Rapid Fire as Secondary skill");
- }
- if (myLevel == 8)
- {
- ZetaDia.Me.SetActiveSkill(SNOPower.DemonHunter_SmokeScreen, -1, 1);
- Logger.Write("Setting Smoke Screen as Defensive skill");
- }
- if (myLevel == 9)
- {
- ZetaDia.Me.SetActiveSkill(SNOPower.DemonHunter_Vault, -1, 3);
- Logger.Write("Setting Vault as Hunting skill");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment