public bool CanHit(Ability ability, Unit targetsama, float customDelay, bool checkForFace = true) { var modifs = targetsama.HasModifiers(new string[] { "modifier_puck_phase_shift", "modifier_cyclone", "modifier_obsidian_destroyer_astral_imprisonment_prison" }, false); if (checkForFace && targetsama.IsValid && targetsama.IsAlive && !targetsama.IsInvulnerable() && !modifs) { var radius = ability.GetRadius(); var range = ability.GetAbilitySpecialData("shadowraze_range"); var predFontPos = UnitExtensions.InFront(Owner, range); var input = Input(targetsama, ability, range); var output = Prediction.GetPrediction(input); output.CastPosition = predFontPos; PredictedTargetPosition = output.UnitPosition; var hullRadius = targetsama.HullRadius; var inRange = PredictedTargetPosition.Distance2D(predFontPos) <= radius + hullRadius; return(inRange); } else if (checkForFace && targetsama.IsValid && targetsama.IsAlive && !targetsama.IsInvulnerable() && !modifs) { var radius = ability.GetRadius(); var range = ability.GetAbilitySpecialData("shadowraze_range"); var predFontPos = UnitExtensions.InFront(Owner, range); var input = Input(targetsama, ability, range); var output = Prediction.GetPrediction(input); output.CastPosition = predFontPos; PredictedTargetPosition = output.UnitPosition; var hullRadius = targetsama.HullRadius; if (targetsama.IsMoving) { hullRadius += 20; } var inRange = PredictedTargetPosition.Distance2D(predFontPos) <= radius + hullRadius; return(inRange); } else { var radius = ability.GetAbilitySpecialData("shadowraze_radius"); var range = ability.GetAbilitySpecialData("shadowraze_range"); PredictedTargetPosition = targetsama.Position; var dist = PredictedTargetPosition.Distance2D(Owner); var inRange = dist <= (range + radius + targetsama.HullRadius) && dist >= (range - radius - targetsama.HullRadius); return(inRange); } }
public override async Task ExecuteAsync(CancellationToken token) { var casted = false; // checks for items if (this.manta != null && this.config.UseAbilities.Value.IsEnabled("item_manta") && this.manta.Item.CanBeCasted()) { Log.Debug("Used manta"); this.manta.Item.UseAbility(); casted = true; await Await.Delay(250 + (int)Game.Ping, token); } if (!casted && this.bottle != null && this.config.UseAbilities.Value.IsEnabled("item_bottle")) { var bottleItem = this.bottle.Item as Bottle; if (bottleItem?.StoredRune == RuneType.Illusion) { Log.Debug("Used bottle"); bottleItem.UseAbility(); casted = true; await Await.Delay(125 + (int)Game.Ping, token); } } // check for spells if (!casted) { if (this.mirrorImage != null && this.config.UseAbilities.Value.IsEnabled("naga_siren_mirror_image") && this.mirrorImage.CanBeCasted()) { this.mirrorImage.UseAbility(); var delay = (int)((this.mirrorImage.GetCastPoint(0) + this.mirrorImage.AbilitySpecialData.First(x => x.Name == "invuln_duration").Value) * 1000.0f) + 250 + (int)Game.Ping; Log.Debug($"using mirror image with delay {delay}"); await Await.Delay(delay, token); return; } if (this.conjureImage != null && this.config.UseAbilities.Value.IsEnabled("terrorblade_conjure_image") && this.conjureImage.CanBeCasted()) { this.conjureImage.UseAbility(); var delay = (int)((this.conjureImage.GetCastPoint(0) * 1000.0f) + 250.0f) + (int)Game.Ping; Log.Debug($"using conjure image with delay {delay}"); await Await.Delay(delay, token); return; } if (this.doppelWalk != null && this.config.UseAbilities.Value.IsEnabled("phantom_lancer_doppelwalk") && this.doppelWalk.CanBeCasted()) { var pos = Game.MousePosition - this.owner.Position; if (pos.Length() > this.doppelWalk.CastRange) { pos.Normalize(); pos *= this.doppelWalk.CastRange; } this.doppelWalk.UseAbility(this.owner.Position + pos); var delay = ((int)(this.doppelWalk.GetCastPoint(0) + this.doppelWalk.AbilitySpecialData.First(x => x.Name == "delay").Value) * 1000) + 250 + (int)Game.Ping; Log.Debug($"using doppel walk with delay {delay}"); await Await.Delay(delay, token); } } if (this.config.MoveHero) { // Log.Debug($"Move hero to position {Game.MousePosition}"); this.owner.Move(Game.MousePosition); this.heroTargetDirection = Game.MousePosition - this.owner.Position; } else { this.heroTargetDirection = UnitExtensions.InFront(this.owner, 250) - this.owner.Position; // Log.Debug($"Hero target dir {heroTargetDirection}"); } this.illusionHandler.RunAsync(); await Await.Delay(125, token); }
public override async Task ExecuteAsync(CancellationToken token) { if (!config.Enabled) { return; } var target = targetSelector.Active.GetTargets().FirstOrDefault(); if (target == null) { Orbwalker.OrbwalkTo(null); return; } if (!Owner.CanCast()) { return; } var posForHitChance = target.BasePredict(450 + Game.Ping); var distanceToHitChance = EntityExtensions.Distance2D(Owner, posForHitChance); var blink = Owner.GetItemById(AbilityId.item_blink); var force = Owner.GetItemById(AbilityId.item_force_staff); var blinkReady = blink != null && blink.CanBeCasted() && config.UseItemsInit.Value.IsEnabled(blink.Name); var forceReady = force != null && force.CanBeCasted() && config.UseItemsInit.Value.IsEnabled(force.Name); if (config.EnabledForcePlusBlink && forceReady && blinkReady) { if (distanceToHitChance < 1900 && distanceToHitChance > 1200 && Q.CanBeCasted()) { await TurnTo(posForHitChance, token); if (Vector3Extensions.Distance(UnitExtensions.InFront(Owner, 600), posForHitChance) < 1200) { force.UseAbility(Owner); await Task.Delay(10, token); } } } if (blinkReady) { if (distanceToHitChance < 1200 && !Q.CanHit(target) && Q.CanBeCasted()) { blink.UseAbility(posForHitChance); await Task.Delay(10, token); } } if (forceReady) { if (distanceToHitChance < 750 && !Q.CanHit(target) && Q.CanBeCasted()) { await TurnTo(posForHitChance, token); if (Vector3Extensions.Distance(UnitExtensions.InFront(Owner, 600), posForHitChance) < 260) { force.UseAbility(Owner); await Task.Delay(10, token); } } } await Kill(token); if (Q.CanBeCasted()) { if (Q.CanHit(target) && !target.HasModifiers(cuntCullModifiers, false)) { Q.UseAbility(); await Task.Delay((int)(Q.FindCastPoint() * 1000 + Game.Ping), token); } Orbwalker.Move(posForHitChance); } else { Orbwalker.OrbwalkTo(target); } await UseItems(target, token); }
private void OnUpdate() { if (RazeShort.Level <= 0) { return; } Razes = new List <Ability> { RazeShort, RazeMedium, RazeLong }; if (DrawRazeRange == true) { var raze1 = UnitExtensions.InFront(Owner, this.RazeShort.GetAbilitySpecialData("shadowraze_range")); var raze2 = UnitExtensions.InFront(Owner, this.RazeMedium.GetAbilitySpecialData("shadowraze_range")); var raze3 = UnitExtensions.InFront(Owner, this.RazeLong.GetAbilitySpecialData("shadowraze_range")); var file = "materials/ensage_ui/particles/alert_range.vpcf"; Particle.AddOrUpdate(Owner, $"DrawRange_{1}", file, ParticleAttachment.AbsOrigin, RestartType.None, 0, raze1, 1, new Vector3(255, 0, 0), 2, new Vector3(200, 255, 40)); Particle.AddOrUpdate(Owner, $"DrawRange_{2}", file, ParticleAttachment.AbsOrigin, RestartType.None, 0, raze2, 1, new Vector3(255, 0, 0), 2, new Vector3(200, 255, 40)); Particle.AddOrUpdate(Owner, $"DrawRange_{3}", file, ParticleAttachment.AbsOrigin, RestartType.None, 0, raze3, 1, new Vector3(255, 0, 0), 2, new Vector3(200, 255, 40)); var targets = EntityManager <Hero> .Entities.FirstOrDefault( x => x.IsAlive && x.Team != this.Owner.Team && x.Distance2D(this.Owner) < 1500 && !x.IsIllusion); if (targets != null && this.RazeShort.CanBeCasted() && !UnitExtensions.IsMagicImmune(targets) && !targets.IsInvulnerable() && CanHit(this.RazeShort, targets, GetRazeDelay(targets, RazeShort), true)) { Particle.AddOrUpdate(Owner, $"DrawRange_{1}", file, ParticleAttachment.AbsOrigin, RestartType.None, 0, raze1, 1, new Vector3(0, 255, 0), 2, new Vector3(200, 255, 40)); } if (targets != null && this.RazeMedium.CanBeCasted() && !UnitExtensions.IsMagicImmune(targets) && !targets.IsInvulnerable() && CanHit(this.RazeMedium, targets, GetRazeDelay(targets, RazeMedium), true)) { Particle.AddOrUpdate(Owner, $"DrawRange_{2}", file, ParticleAttachment.AbsOrigin, RestartType.None, 0, raze2, 1, new Vector3(0, 255, 0), 2, new Vector3(200, 255, 40)); } if (targets != null && this.RazeLong.CanBeCasted() && !UnitExtensions.IsMagicImmune(targets) && !targets.IsInvulnerable() && CanHit(this.RazeLong, targets, GetRazeDelay(targets, RazeLong), true)) { Particle.AddOrUpdate(Owner, $"DrawRange_{3}", file, ParticleAttachment.AbsOrigin, RestartType.None, 0, raze3, 1, new Vector3(0, 255, 0), 2, new Vector3(200, 255, 40)); } } else { Particle.Remove($"DrawRange_{1}"); Particle.Remove($"DrawRange_{2}"); Particle.Remove($"DrawRange_{3}"); } }