Esempio n. 1
0
 public static Composite DemonHunterCombat()
 {
     return
         (new PrioritySelector(CtxChanger,
                               new Decorator(
                                   ctx =>
                                   ctx is CombatContext &&
                                   ((CombatContext)ctx).CurrentTarget != null,
                                   new PrioritySelector(
                                       new SelfCast(SNOPower.DemonHunter_SmokeScreen,
                                                    extra => ((CombatContext)extra).IsPlayerIncapacited),
                                       Common.CreateUsePotion(),
                                       Common.CreateWaitWhileFearedStunnedFrozenOrBlind(),
                                       Common.CreateGetHealthGlobe(),
                                       Common.CreateUseHealthWell(),
                                       Kiting.CreateKitingBehavior(),
                                       Common.CreateWaitForAttack(),
                                       new SelfCast(SNOPower.DemonHunter_ShadowPower,
                                                    extra =>
                                                    ShadowPowerTimer.IsFinished &&
                                                    ((CombatContext)extra).CurrentHealthPercentage <
                                                    BelphegorSettings.Instance.DemonHunter.ShadowPowerHp,
                                                    s => ShadowPowerTimer.Reset()),
                                       new CastOnUnit(SNOPower.DemonHunter_MarkedForDeath,
                                                      ctx => ((CombatContext)ctx).TargetGuid,
                                                      ctx =>
                                                      ((CombatContext)ctx).CurrentTargetIsElite &&
                                                      MarkTimer.IsFinished,
                                                      s => MarkTimer.Reset()),
                                       new SelfCast(SNOPower.X1_DemonHunter_Vengeance,
                                                    ctx => ((CombatContext)ctx).CurrentTargetIsElite),
                                       new SelfCast(SNOPower.DemonHunter_Caltrops,
                                                    ctx =>
                                                    TrapTimer.IsFinished &&
                                                    (Minion.PetCount(((CombatContext)ctx), Pet.DH_Caltrops) < 3 &&
                                                     (Clusters.GetClusterCount(ZetaDia.Me, ((CombatContext)ctx),
                                                                               16f) >=
                                                      BelphegorSettings.Instance.DemonHunter.CaltropsAoECount ||
                                                      Unit.IsEliteInRange(16f, ((CombatContext)ctx))) ||
                                                     (BelphegorSettings.Instance.DemonHunter.StandInCaltrops &&
                                                      Minion.GetMinions(((CombatContext)ctx), Pet.DH_Caltrops).Count(
                                                          c => c.Distance < 8f) < 1)),
                                                    s => TrapTimer.Reset()),
                                       new SelfCast(SNOPower.DemonHunter_SpikeTrap,
                                                    ctx =>
                                                    TrapTimer.IsFinished && Minion.PetCount(((CombatContext)ctx), Pet.DH_SpikeTrap) < 3 &&
                                                    Clusters.GetClusterCount(ZetaDia.Me, ((CombatContext)ctx),
                                                                             16f) >=
                                                    BelphegorSettings.Instance.DemonHunter.SpikeTrapAoECount ||
                                                    Unit.IsEliteInRange(16f, ((CombatContext)ctx)),
                                                    s => TrapTimer.Reset()),
                                       // AOE
                                       new CastAtLocation(SNOPower.DemonHunter_RainOfVengeance,
                                                          ctx => ((CombatContext)ctx).TargetPosition,
                                                          ctx =>
                                                          Clusters.GetClusterCount(((CombatContext)ctx).CurrentTarget, ((CombatContext)ctx),
                                                                                   20f) >= 3 || ((CombatContext)ctx).CurrentTargetIsElite),
                                       new CastOnUnit(SNOPower.DemonHunter_Strafe,
                                                      ctx => ((CombatContext)ctx).TargetGuid,
                                                      req =>
                                                      Clusters.GetClusterCount(ZetaDia.Me, ((CombatContext)req),
                                                                               45f) >= 2
                                                      ),
                                       new CastAtLocation(SNOPower.DemonHunter_Multishot,
                                                          ctx => ((CombatContext)ctx).TargetPosition,
                                                          req =>
                                                          Clusters.GetClusterCount(
                                                              ((CombatContext)req).CurrentTarget,
                                                              ((CombatContext)req), 45f) >= 2
                                                          ),
                                       new CastOnUnit(SNOPower.DemonHunter_FanOfKnives,
                                                      ctx => ((CombatContext)ctx).TargetGuid,
                                                      ctx =>
                                                      ((CombatContext)ctx).CurrentTargetIsElite &&
                                                      ((CombatContext)ctx).TargetDistance < 20f ||
                                                      Clusters.GetClusterCount(ZetaDia.Me, ((CombatContext)ctx),
                                                                               20f) >=
                                                      BelphegorSettings.Instance.DemonHunter.FanOfKnivesAoECount
                                                      ),
                                       new CastOnUnit(SNOPower.DemonHunter_ClusterArrow,
                                                      ctx => ((CombatContext)ctx).TargetGuid,
                                                      req =>
                                                      Clusters.GetClusterCount(
                                                          ((CombatContext)req).CurrentTarget,
                                                          ((CombatContext)req), 15f) >= 2 ||
                                                      ((CombatContext)req).CurrentTargetIsElite
                                                      ),
                                       new CastAtLocation(SNOPower.DemonHunter_Sentry,
                                                          ctx => ((CombatContext)ctx).TargetPosition,
                                                          ctx => !Minion.HasPet(((CombatContext)ctx), Pet.DH_Sentry) &&
                                                          Clusters.GetClusterCount(ZetaDia.Me,
                                                                                   ((CombatContext)ctx),
                                                                                   35f) >=
                                                          2 ||
                                                          ((CombatContext)ctx).CurrentTargetIsElite
                                                          ),
                                       new SelfCast(SNOPower.DemonHunter_Preparation,
                                                    extra => ZetaDia.Me.CurrentSecondaryResource <=
                                                    BelphegorSettings.Instance.DemonHunter.
                                                    PrperationDiscipline),
                                       // Singles
                                       new CastOnUnit(SNOPower.DemonHunter_Chakram,
                                                      ctx => ((CombatContext)ctx).TargetGuid),
                                       new CastOnUnit(SNOPower.X1_DemonHunter_EvasiveFire,
                                                      ctx => ((CombatContext)ctx).TargetGuid,
                                                      ctx =>
                                                      !BelphegorSettings.Instance.DemonHunter.
                                                      OnlyEvasiveFireWhenClose ||
                                                      ((CombatContext)ctx).TargetDistance <= 16f),
                                       new CastOnUnit(SNOPower.DemonHunter_Impale,
                                                      ctx => ((CombatContext)ctx).TargetGuid),
                                       new CastOnUnit(SNOPower.DemonHunter_RapidFire,
                                                      ctx => ((CombatContext)ctx).TargetGuid,
                                                      extra => ZetaDia.Me.CurrentPrimaryResource > 20),
                                       new CastOnUnit(SNOPower.DemonHunter_ElementalArrow,
                                                      ctx => ((CombatContext)ctx).TargetGuid),
                                       // Hatred Generators
                                       new CastOnUnit(SNOPower.DemonHunter_Bolas,
                                                      ctx => ((CombatContext)ctx).TargetGuid),
                                       new CastOnUnit(SNOPower.DemonHunter_Grenades,
                                                      ctx => ((CombatContext)ctx).TargetGuid),
                                       new CastOnUnit(SNOPower.DemonHunter_HungeringArrow,
                                                      ctx => ((CombatContext)ctx).TargetGuid),
                                       new CastOnUnit(SNOPower.X1_DemonHunter_EntanglingShot,
                                                      ctx => ((CombatContext)ctx).TargetGuid)
                                       )
                                   ),
                               new Action(ret => RunStatus.Success)
                               ));
 }
Esempio n. 2
0
        public static Composite WizardCombat()
        {
            return
                (new PrioritySelector(CtxChanger,
                                      new Decorator(
                                          ctx =>
                                          ctx is CombatContext &&
                                          ((CombatContext)ctx).CurrentTarget != null,
                                          new PrioritySelector(
                                              new SelfCast(SNOPower.Wizard_DiamondSkin,
                                                           extra =>
                                                           ((CombatContext)extra).CurrentHealthPercentage <=
                                                           BelphegorSettings.Instance.Wizard.DiamondSkinHp ||
                                                           ((CombatContext)extra).IsPlayerIncapacited),
                                              Common.CreateUsePotion(),
                                              Common.CreateWaitWhileFearedStunnedFrozenOrBlind(),
                                              Common.CreateGetHealthGlobe(),
                                              Common.CreateWaitForAttack(),
                                              Kiting.CreateKitingBehavior(),
                                              //Movement.MoveTo(ctx => ((DiaUnit)ctx).Position, BelphegorSettings.Instance.Wizard.MaximumRange),

                                              new Decorator(ret => ZetaDia.Me.HasBuff(SNOPower.Wizard_Archon),
                                                            new PrioritySelector(
                                                                new SelfCast(SNOPower.Wizard_Archon_SlowTime,
                                                                             extra =>
                                                                             ((CombatContext)extra).
                                                                             CurrentHealthPercentage <= 0.4),
                                                                new SelfCast(SNOPower.Wizard_Archon_ArcaneBlast,
                                                                             ctx =>
                                                                             ((CombatContext)ctx).CurrentTarget.IsElite(
                                                                                 16f)
                                                                             ||
                                                                             Clusters.GetClusterCount(ZetaDia.Me,
                                                                                                      ((CombatContext)
                                                                                                       ctx),
                                                                                                      ClusterType.Radius,
                                                                                                      16f) >= 2),
                                                                new CastOnUnit(
                                                                    SNOPower.Wizard_Archon_DisintegrationWave,
                                                                    ctx => ((CombatContext)ctx).TargetGuid),
                                                                new CastOnUnit(SNOPower.Wizard_Archon_ArcaneStrike,
                                                                               ctx => ((CombatContext)ctx).TargetGuid)
                                                                )),
                                              // Low health stuff
                                              new SelfCast(SNOPower.Wizard_MirrorImage,
                                                           extra =>
                                                           ((CombatContext)extra).CurrentHealthPercentage <=
                                                           BelphegorSettings.Instance.Wizard.MirrorImageHp),
                                              new SelfCast(SNOPower.Wizard_SlowTime,
                                                           extra =>
                                                           ((CombatContext)extra).CurrentHealthPercentage <=
                                                           BelphegorSettings.Instance.Wizard.SlowTimeHp),
                                              // AoE spells.
                                              new SelfCast(SNOPower.Wizard_WaveOfForce,
                                                           ctx =>
                                                           Clusters.GetClusterCount(ZetaDia.Me, ((CombatContext)ctx),
                                                                                    ClusterType.Radius, 12f) >= 2 ||
                                                           (((CombatContext)ctx).CurrentTarget.IsElite(16f))),
                                              new SelfCast(SNOPower.Wizard_FrostNova,
                                                           ctx =>
                                                           Clusters.GetClusterCount(ZetaDia.Me, ((CombatContext)ctx),
                                                                                    ClusterType.Radius, 16f) >=
                                                           BelphegorSettings.Instance.Wizard.FrostNovaAoECount ||
                                                           (((CombatContext)ctx).CurrentTarget.IsElite(16f))),
                                              //Hydra
                                              new CastAtLocation(SNOPower.Wizard_Hydra,
                                                                 ctx => ((CombatContext)ctx).TargetPosition,
                                                                 ctx =>
                                                                 HydraTimer.IsFinished && !Minion.HasPet(Pet.Hydra)
                                                                 &&
                                                                 (((CombatContext)ctx).CurrentTarget.IsElite() ||
                                                                  Clusters.GetClusterCount(
                                                                      ((CombatContext)ctx).CurrentTarget,
                                                                      ((CombatContext)ctx), ClusterType.Radius, 12f) >=
                                                                  BelphegorSettings.Instance.Wizard.HydraAoECount),
                                                                 s => HydraTimer.Reset()),
                                              new SelfCast(SNOPower.Wizard_Archon,
                                                           ctx => ((CombatContext)ctx).CurrentTarget.IsElite() ||
                                                           Clusters.GetClusterCount(ZetaDia.Me,
                                                                                    ((CombatContext)ctx),
                                                                                    ClusterType.Radius, 60f) >=
                                                           BelphegorSettings.Instance.Wizard.ArchonAoECount),
                                              new CastOnUnit(SNOPower.Wizard_EnergyTwister,
                                                             ctx => ((CombatContext)ctx).TargetGuid,
                                                             ctx =>
                                                             Clusters.GetClusterCount(
                                                                 ((CombatContext)ctx).CurrentTarget,
                                                                 ((CombatContext)ctx), ClusterType.Radius, 20f) >=
                                                             BelphegorSettings.Instance.Wizard.EnergyTwisterAoECount),
                                              new CastAtLocation(SNOPower.Wizard_Meteor,
                                                                 ctx => ((CombatContext)ctx).TargetPosition,
                                                                 ctx =>
                                                                 MeteorTimer.IsFinished &&
                                                                 (((CombatContext)ctx).CurrentTarget.IsElite() ||
                                                                  Clusters.GetClusterCount(
                                                                      ((CombatContext)ctx).CurrentTarget,
                                                                      ((CombatContext)ctx), ClusterType.Radius, 16f) >=
                                                                  4),
                                                                 s => MeteorTimer.Reset()),
                                              new CastAtLocation(SNOPower.Wizard_Blizzard,
                                                                 ctx => ((CombatContext)ctx).TargetPosition,
                                                                 ctx =>
                                                                 BlizzardTimer.IsFinished &&
                                                                 Clusters.GetClusterCount(
                                                                     ((CombatContext)ctx).CurrentTarget,
                                                                     ((CombatContext)ctx), ClusterType.Radius, 16f) >= 4,
                                                                 s => BlizzardTimer.Reset()),
                                              new SelfCast(SNOPower.Wizard_ExplosiveBlast,
                                                           ctx =>
                                                           ExplosiveBlast.IsFinished &&
                                                           (((CombatContext)ctx).CurrentTarget.IsElite(16f) ||
                                                            Clusters.GetClusterCount(ZetaDia.Me, ((CombatContext)ctx),
                                                                                     ClusterType.Radius, 16f) >=
                                                            BelphegorSettings.Instance.Wizard.ExplosiveBlastAoECount),
                                                           s => ExplosiveBlast.Reset()),
                                              // Arcane power spenders.
                                              new CastOnUnit(SNOPower.Wizard_ArcaneOrb,
                                                             ctx => ((CombatContext)ctx).TargetGuid),
                                              new CastOnUnit(SNOPower.Wizard_RayOfFrost,
                                                             ctx => ((CombatContext)ctx).TargetGuid),
                                              new CastOnUnit(SNOPower.Wizard_ArcaneTorrent,
                                                             ctx => ((CombatContext)ctx).TargetGuid),
                                              new CastOnUnit(SNOPower.Wizard_Disintegrate,
                                                             ctx => ((CombatContext)ctx).TargetGuid),
                                              // Signature spells.
                                              new CastOnUnit(SNOPower.Wizard_SpectralBlade,
                                                             ctx => ((CombatContext)ctx).TargetGuid),
                                              new CastOnUnit(SNOPower.Wizard_Electrocute,
                                                             ctx => ((CombatContext)ctx).TargetGuid),
                                              new CastOnUnit(SNOPower.Wizard_ShockPulse,
                                                             ctx => ((CombatContext)ctx).TargetGuid),
                                              new CastOnUnit(SNOPower.Wizard_MagicMissile,
                                                             ctx => ((CombatContext)ctx).TargetGuid)
                                              )),
                                      new Action(ret => RunStatus.Success)
                                      ));
        }
 public static Composite WitchDoctorCombat()
 {
     return(new PrioritySelector(CtxChanger,
                                 new Decorator(
                                     ctx =>
                                     ctx is CombatContext &&
                                     ((CombatContext)ctx).CurrentTarget != null,
                                     new PrioritySelector(
                                         Common.CreateUsePotion(),
                                         Common.CreateWaitWhileFearedStunnedFrozenOrBlind(),
                                         Common.CreateGetHealthGlobe(),
                                         Common.CreateUseHealthWell(),
                                         Common.CreateWaitForAttack(),
                                         Kiting.CreateKitingBehavior(),
                                         // Make sure we are within range/line of sight of the unit.
                                         Movement.MoveTo(ctx => ((CombatContext)ctx).TargetPosition,
                                                         BelphegorSettings.Instance.WitchDoctor.MaximumRange),
                                         new SelfCast(SNOPower.Witchdoctor_SpiritWalk,
                                                      extra =>
                                                      ((CombatContext)extra).CurrentHealthPercentage <=
                                                      BelphegorSettings.Instance.WitchDoctor.SpiritWalkHp),
                                         new SelfCast(SNOPower.Witchdoctor_Sacrifice,
                                                      ctx => Minion.PetCount(((CombatContext)ctx), Pet.ZombieDogs) > 1 &&
                                                      ((CombatContext)ctx).CurrentHealthPercentage <=
                                                      BelphegorSettings.Instance.WitchDoctor.SacrificeHp),
                                         new SelfCast(SNOPower.Witchdoctor_Hex),
                                         new SelfCast(SNOPower.Witchdoctor_SoulHarvest,
                                                      ctx =>
                                                      Clusters.GetClusterCount(ZetaDia.Me, ((CombatContext)ctx), 16f) >=
                                                      BelphegorSettings.Instance.WitchDoctor.SoulHarvestAoECount ||
                                                      (((CombatContext)ctx).CurrentTargetIsElite &&
                                                       ((CombatContext)ctx).TargetDistance < 16f)),
                                         new CastAtLocation(SNOPower.Witchdoctor_Piranhas, ctx => ((CombatContext)ctx).TargetPosition,
                                                            ctx =>
                                                            ((CombatContext)ctx).CurrentTargetIsElite ||
                                                            Clusters.GetClusterCount(((CombatContext)ctx).CurrentTarget, ((CombatContext)ctx), 10f) >=
                                                            BelphegorSettings.Instance.WitchDoctor.PiranhasAoECount),
                                         new SelfCast(SNOPower.Witchdoctor_BigBadVoodoo,
                                                      ctx =>
                                                      Clusters.GetClusterCount(
                                                          ((CombatContext)ctx).CurrentTarget,
                                                          ((CombatContext)ctx), 40f) >=
                                                      BelphegorSettings.Instance.WitchDoctor.BigBadVoodooAoECount ||
                                                      ((CombatContext)ctx).CurrentTargetIsElite),
                                         new SelfCast(SNOPower.Witchdoctor_FetishArmy,
                                                      ctx =>
                                                      Clusters.GetClusterCount(
                                                          ((CombatContext)ctx).CurrentTarget,
                                                          ((CombatContext)ctx), 40f) >=
                                                      BelphegorSettings.Instance.WitchDoctor.FetishArmyAoECount ||
                                                      ((CombatContext)ctx).CurrentTargetIsElite),
                                         new SelfCast(SNOPower.Witchdoctor_Horrify,
                                                      extra =>
                                                      Clusters.GetClusterCount(
                                                          ((CombatContext)extra).CurrentTarget,
                                                          ((CombatContext)extra), 40f) >=
                                                      BelphegorSettings.Instance.WitchDoctor.HorrifyAoECount),
                                         new CastOnUnit(SNOPower.Witchdoctor_MassConfusion,
                                                        ctx => ((CombatContext)ctx).TargetGuid,
                                                        extra =>
                                                        Clusters.GetClusterCount(
                                                            ((CombatContext)extra).CurrentTarget,
                                                            ((CombatContext)extra), 40f) >=
                                                        BelphegorSettings.Instance.WitchDoctor.
                                                        MassConfusionAoECount),
                                         new CastOnUnit(SNOPower.Witchdoctor_GraspOfTheDead,
                                                        ctx => ((CombatContext)ctx).TargetGuid),
                                         new CastAtLocation(SNOPower.Witchdoctor_AcidCloud,
                                                            ctx => ((CombatContext)ctx).TargetPosition,
                                                            ctx =>
                                                            AcidTimer.IsFinished &&
                                                            Clusters.GetClusterCount(
                                                                ((CombatContext)ctx).CurrentTarget,
                                                                ((CombatContext)ctx), 18f) >=
                                                            BelphegorSettings.Instance.WitchDoctor.
                                                            AcidCloudAoECount,
                                                            s => AcidTimer.Reset()),
                                         new CastAtLocation(SNOPower.Witchdoctor_Firebats,
                                                            ctx => ((CombatContext)ctx).TargetPosition,
                                                            extra =>
                                                            Clusters.GetClusterCount(
                                                                ((CombatContext)extra).CurrentTarget,
                                                                ((CombatContext)extra), 40f) >=
                                                            BelphegorSettings.Instance.WitchDoctor.
                                                            FirebatsAoECount),
                                         new CastAtLocation(SNOPower.Witchdoctor_WallOfZombies,
                                                            ctx => ((CombatContext)ctx).TargetPosition,
                                                            extra =>
                                                            Clusters.GetClusterCount(
                                                                ((CombatContext)extra).CurrentTarget,
                                                                ((CombatContext)extra), 40f) >=
                                                            BelphegorSettings.Instance.WitchDoctor.
                                                            WallOfZombiesAoECount),
                                         new CastOnUnit(SNOPower.Witchdoctor_Locust_Swarm,
                                                        ctx => ((CombatContext)ctx).TargetGuid,
                                                        ctx =>
                                                        LocustSwarmTimer.IsFinished &&
                                                        ((CombatContext)ctx).TargetDistance < 16 &&
                                                        ((CombatContext)ctx).CurrentTargetIsElite ||
                                                        Clusters.GetClusterCount(
                                                            ((CombatContext)ctx).CurrentTarget,
                                                            ((CombatContext)ctx), 20) >=
                                                        BelphegorSettings.Instance.WitchDoctor.
                                                        LocustSwarmAoECount,
                                                        s => LocustSwarmTimer.Reset()),
                                         new CastOnUnit(SNOPower.Witchdoctor_Haunt,
                                                        ctx => ((CombatContext)ctx).TargetGuid,
                                                        extra => HauntTimer.IsFinished, s => HauntTimer.Reset()),
                                         //Other spells
                                         new CastOnUnit(SNOPower.Witchdoctor_SpiritBarrage,
                                                        ctx => ((CombatContext)ctx).TargetGuid),
                                         new CastOnUnit(SNOPower.Witchdoctor_ZombieCharger,
                                                        ctx => ((CombatContext)ctx).TargetGuid),
                                         //Primary
                                         new CastAtLocation(SNOPower.Witchdoctor_PlagueOfToads,
                                                            ctx => ((CombatContext)ctx).TargetPosition),
                                         new CastAtLocation(SNOPower.Witchdoctor_CorpseSpider,
                                                            ctx => ((CombatContext)ctx).TargetPosition),
                                         new CastOnUnit(SNOPower.Witchdoctor_Firebomb,
                                                        ctx => ((CombatContext)ctx).TargetGuid),
                                         new CastOnUnit(SNOPower.Witchdoctor_PoisonDart,
                                                        ctx => ((CombatContext)ctx).TargetGuid)
                                         )
                                     ),
                                 new Action(ret => RunStatus.Success)
                                 ));
 }