protected override async Task KillStealAsync(CancellationToken token) { if (Game.IsPaused || !this.Owner.IsAlive || !AbilityExtensions.CanBeCasted(this.Blast)) { await Task.Delay(125, token); return; } var damageBlast = Blast.GetAbilitySpecialData("blast_damage"); damageBlast *= Ensage.SDK.Extensions.UnitExtensions.GetSpellAmplification(this.Owner); 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) && Blast != null && Blast.IsValid && x.Distance2D(this.Owner) <= 900 && Ensage.Common.Extensions.AbilityExtensions.CanBeCasted(Decrepify, x) && Ensage.Common.Extensions.AbilityExtensions.CanBeCasted(Blast, x) && !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) && Ensage.Common.Extensions.AbilityExtensions.CanBeCasted(Blast, x) && !UnitExtensions.IsMagicImmune(x) && Blast.CanHit(x) && Ensage.SDK.Extensions.EntityExtensions.Distance2D(Owner, x.NetworkPosition) <= 800); if (!UnitExtensions.IsChanneling(this.Owner)) { if (decrepifyKillable != null) { if (Decrepify.UseAbility(decrepifyKillable)) { await this.AwaitKillstealDelay((int)AbilityExtensions.GetCastDelay(this.Decrepify, this.Owner, decrepifyKillable, true), token); // decrepify } if (Blast.CanHit(decrepifyKillable)) { if (Blast.UseAbility(decrepifyKillable)) { await this.AwaitKillstealDelay((int)AbilityExtensions.GetCastDelay(this.Blast, this.Owner, decrepifyKillable, true), token); } } } if (blastKillable != null) { if (Blast.UseAbility(blastKillable.NetworkPosition)) { await this.AwaitKillstealDelay((int)AbilityExtensions.GetCastDelay(this.Blast, this.Owner, blastKillable, true), token); } } } }
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) && Blast != null && Blast.IsValid && x.Distance2D(this.Owner) <= 900 && 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) && Blast.CanHit(x) && Ensage.SDK.Extensions.EntityExtensions.Distance2D(Owner, x.NetworkPosition) <= 800); if (!UnitExtensions.IsChanneling(this.Owner)) { if (decrepifyKillable != null) { Decrepify.UseAbility(decrepifyKillable); await Await.Delay(GetAbilityDelay(decrepifyKillable, Decrepify)); if (Blast.CanHit(decrepifyKillable)) { Blast.UseAbility(decrepifyKillable); await Await.Delay(GetAbilityDelay(decrepifyKillable, Blast)); } } if (blastKillable != null) { Blast.UseAbility(blastKillable.NetworkPosition); await Await.Delay(GetAbilityDelay(blastKillable, Blast)); } } else if (UnitExtensions.HasModifier(Target, "modifier_pugna_life_drain")) { if (decrepifyKillable != null) { Decrepify.UseAbility(decrepifyKillable); await Await.Delay(GetAbilityDelay(decrepifyKillable, Decrepify)); if (Blast.CanHit(decrepifyKillable)) { Blast.UseAbility(decrepifyKillable); await Await.Delay(GetAbilityDelay(decrepifyKillable, Blast)); } } if (blastKillable != null) { Blast.UseAbility(blastKillable.NetworkPosition); await Await.Delay(GetAbilityDelay(blastKillable, Blast)); } } }