Пример #1
0
        public virtual async Task KillStealAsync()
        {
            var damageBlast = Blast.GetAbilityData("blast_damage");

            damageBlast *= GetSpellAmp();

            bool comboMana = Blast.GetManaCost(Blast.Level - 1) + Decrepify.GetManaCost(Decrepify.Level - 1) <
                             Owner.Mana;

            var decrepifyKillable =
                EntityManager <Hero> .Entities.FirstOrDefault(
                    x =>
                    x.IsAlive && x.Team != this.Owner.Team && !x.IsIllusion &&
                    x.Health < damageBlast *(1 - x.MagicDamageResist) &&
                    Decrepify.CanBeCasted(x) && Blast.CanBeCasted() &&
                    !UnitExtensions.IsMagicImmune(x) && comboMana);

            var blastKillable =
                EntityManager <Hero> .Entities.FirstOrDefault(
                    x =>
                    x.IsAlive && x.Team != this.Owner.Team && !x.IsIllusion &&
                    x.Health < damageBlast *(1 - x.MagicDamageResist) &&
                    Blast.CanBeCasted() && !UnitExtensions.IsMagicImmune(x) &&
                    Ensage.SDK.Extensions.EntityExtensions.Distance2D(Owner, x.NetworkPosition) <= 400);

            if (decrepifyKillable != null)
            {
                Decrepify.UseAbility(decrepifyKillable);
                await Await.Delay(GetAbilityDelay(decrepifyKillable, Decrepify));

                Blast.UseAbility(decrepifyKillable);
                await Await.Delay(GetAbilityDelay(decrepifyKillable, Decrepify));
            }

            if (blastKillable != null)
            {
                Blast.UseAbility(blastKillable.NetworkPosition);
                await Await.Delay(GetAbilityDelay(blastKillable, Blast));
            }
        }