Example #1
0
        private void Harass()
        {
            actionQueue.ExecuteNextAction(harasQueue);

            shadows.Harass();

            float maxRange = float.MaxValue;

            if (!energy.ReadyToHaras)
            {
                return;
            }

            List <Obj_AI_Hero> blackList = zedMenu.GetBlockList(BlockListType.Harass);

            if ((w.UseOnHarass && w.IsReady() && w.Instance.ToggleState == 0) &&
                (player.HealthPercent
                 > zedMenu.GetParamSlider("koreanzed.harasmenu.wusage.dontuselowlife") &&
                 HeroManager.Enemies.Count(
                     hero => !hero.IsDead && !hero.IsZombie && player.Distance(hero) < 2000F)
                 < zedMenu.GetParamSlider("koreanzed.harasmenu.wusage.dontuseagainst")))
            {
                if (q.UseOnHarass)
                {
                    if (q.UseOnHarass && q.IsReady() && (player.Mana > q.ManaCost + w.ManaCost))
                    {
                        switch ((ShadowHarassTrigger)zedMenu.GetParamStringList("koreanzed.harasmenu.wusage.trigger"))
                        {
                        case ShadowHarassTrigger.MaxRange:
                            maxRange = Math.Min(maxRange, q.Range + w.Range);
                            break;

                        case ShadowHarassTrigger.MaxDamage:
                            maxRange = Math.Min(maxRange, w.Range + e.Range);
                            break;
                        }

                        Obj_AI_Hero target = TargetSelector.GetTarget(maxRange, q.DamageType, true, blackList);

                        if (target != null)
                        {
                            shadows.Cast(target);
                            actionQueue.EnqueueAction(harasQueue, () => true, () => shadows.Harass(), () => false);
                        }
                    }
                }

                if (e.UseOnHarass && e.IsReady() && (player.Mana > e.ManaCost + w.ManaCost))
                {
                    maxRange = Math.Min(maxRange, e.Range + w.Range);
                    Obj_AI_Hero target = TargetSelector.GetTarget(maxRange, e.DamageType, true, blackList);

                    if (target != null)
                    {
                        shadows.Cast(target);
                        actionQueue.EnqueueAction(harasQueue,
                                                  () => true,
                                                  () => shadows.Harass(),
                                                  () => false);
                    }
                }
            }

            if (q.UseOnHarass && energy.ReadyToHaras)
            {
                maxRange = Math.Min(maxRange, q.Range);
                Obj_AI_Hero target = TargetSelector.GetTarget(maxRange, q.DamageType, true, blackList);

                if (target != null)
                {
                    PredictionOutput predictionOutput = q.GetPrediction(target);

                    bool checkColision = zedMenu.GetParamBool("koreanzed.harasmenu.checkcollisiononq");

                    if (predictionOutput.Hitchance >= HitChance.High &&
                        (!checkColision ||
                         !q.GetCollision(
                             player.Position.To2D(),
                             new List <Vector2>()
                    {
                        predictionOutput.CastPosition.To2D()
                    }).Any()))
                    {
                        q.Cast(predictionOutput.CastPosition);
                    }
                }
            }

            if (e.UseOnHarass && energy.ReadyToHaras)
            {
                if (TargetSelector.GetTarget(e.Range, e.DamageType) != null)
                {
                    e.Cast();
                }
            }

            LastHit();
        }