private static bool CastQKill(LeagueSharp.SDK.Spell spell, Obj_AI_Base target) { var pred1 = spell.GetPrediction(target, false, -1, CollisionableObjects.YasuoWall); if (pred1.Hitchance < Q.MinHitChance) { return(false); } var pred2 = spell.GetPrediction( target, false, -1, CollisionableObjects.Heroes | CollisionableObjects.Minions); if (pred2.Hitchance == HitChance.Collision) { var subDmg = Q.GetDamage(target, DamageStage.SecondForm); switch (target.Type) { case GameObjectType.AIHeroClient: return(target.Health + target.AttackShield <= subDmg && Q.Cast(pred1.CastPosition)); case GameObjectType.obj_AI_Minion: return(spell.CanLastHit(target, subDmg) && Q.Cast(pred1.CastPosition)); } } else if (pred2.Hitchance >= Q.MinHitChance) { return(Q.Cast(pred2.CastPosition)); } return(false); }
public void CheckForImmobiles() { var heros = ObjectManager.Get <AIHeroClient>().Where(h => h.IsEnemy && h.Distance(GameObjects.Player) <= SpellQ.Range); foreach (var objAiHero in heros) { if ((objAiHero.HasBuffOfType(BuffType.Charm) || objAiHero.HasBuffOfType(BuffType.Stun) || objAiHero.HasBuffOfType(BuffType.Knockup) || objAiHero.HasBuffOfType(BuffType.Snare)) && Extensions.IsValidTarget(objAiHero, SpellQ.Range)) { Console.WriteLine("Cast on immo"); var pred = SpellQ.GetPrediction(objAiHero).CastPosition; SpellQ.Cast(pred); } } }
private static bool CastQKill(LeagueSharp.SDK.Spell spell, Obj_AI_Base target) { var pred = spell.GetPrediction(target, false, -1, LeagueSharp.SDK.CollisionableObjects.YasuoWall); if (pred.Hitchance < Q.MinHitChance) { return(false); } var col = spell.GetCollision( target, new List <Vector3> { pred.UnitPosition, target.Position }, LeagueSharp.SDK.CollisionableObjects.Heroes | LeagueSharp.SDK.CollisionableObjects.Minions); if (col.Count == 0) { return(Q.Cast(pred.CastPosition)); } var subDmg = Q.GetDamage(target, DamageStage.SecondForm); switch (target.Type) { case GameObjectType.AIHeroClient: return(target.Health + target.AttackShield <= subDmg && Q.Cast(pred.CastPosition)); case GameObjectType.obj_AI_Minion: return(spell.CanLastHit(target, subDmg) && Q.Cast(pred.CastPosition)); } return(false); }
public static bool IsSpellHeroCollision(Obj_AI_Hero t, Spell QWER, int extraWith = 50) { foreach (var hero in GameObjects.EnemyHeroes.Where(hero => hero.IsValidTarget(QWER.Range + QWER.Width, true, QWER.RangeCheckFrom) && t.NetworkId != hero.NetworkId)) { var prediction = QWER.GetPrediction(hero); var powCalc = Math.Pow((QWER.Width + extraWith + hero.BoundingRadius), 2); if (prediction.UnitPosition.ToVector2().DistanceSquared(QWER.From.ToVector2(), QWER.GetPrediction(t).CastPosition.ToVector2(), true) <= powCalc) { return true; } else if (prediction.UnitPosition.ToVector2().Distance(QWER.From.ToVector2(), t.ServerPosition.ToVector2(), true) <= powCalc) { return true; } } return false; }
public static object GetPrediction(this Spell spell, Obj_AI_Base target) { switch (PredictionMode.SelectedValue) { case "SDK": { return(spell.GetPrediction(target)); } case "Common": { var commonSpell = new LeagueSharp.Common.Spell(spell.Slot, spell.Range); commonSpell.SetSkillshot(spell.Delay, spell.Width, spell.Speed, spell.Collision, GetCommonSkillshotType(spell.Type)); return(commonSpell.GetPrediction(target)); } default: { return(spell.GetPrediction(target)); } } }
public static Tuple<LeagueSharp.SDK.Enumerations.HitChance, Vector3, List<Obj_AI_Base>> GetPrediction(AIHeroClient target, Spell spell) { switch (Utils.Prediction.PredictionMode) { case 1: { var pred = spell.GetPrediction(target); return new Tuple<LeagueSharp.SDK.Enumerations.HitChance, Vector3, List<Obj_AI_Base>>(pred.Hitchance, pred.UnitPosition, pred.CollisionObjects); } default: { var pred = LeagueSharp.Common.Prediction.GetPrediction(target, spell.Delay, spell.Width, spell.Speed); return new Tuple<LeagueSharp.SDK.Enumerations.HitChance, Vector3, List<Obj_AI_Base>>((HitChance)((int)pred.Hitchance), pred.UnitPosition, pred.CollisionObjects); } } }
public static Tuple <LeagueSharp.SDK.Enumerations.HitChance, Vector3, List <Obj_AI_Base> > GetPrediction(AIHeroClient target, Spell spell) { switch (Utils.Prediction.PredictionMode) { case 1: { var pred = spell.GetPrediction(target); return(new Tuple <LeagueSharp.SDK.Enumerations.HitChance, Vector3, List <Obj_AI_Base> >(pred.Hitchance, pred.UnitPosition, pred.CollisionObjects)); } default: { var pred = LeagueSharp.Common.Prediction.GetPrediction(target, spell.Delay, spell.Width, spell.Speed); return(new Tuple <LeagueSharp.SDK.Enumerations.HitChance, Vector3, List <Obj_AI_Base> >((HitChance)((int)pred.Hitchance), pred.UnitPosition, pred.CollisionObjects)); } } }
private static bool CastQKill(LeagueSharp.SDK.Spell spell, Obj_AI_Base target) { var pred = spell.GetPrediction(target, false, -1, LeagueSharp.SDK.CollisionableObjects.YasuoWall); if (pred.Hitchance < Q.MinHitChance) { return false; } var col = pred.GetCollision(LeagueSharp.SDK.CollisionableObjects.Heroes | LeagueSharp.SDK.CollisionableObjects.Minions); if (col.Count == 0) { return Q.Cast(pred.CastPosition); } var subDmg = Q.GetDamage(target, DamageStage.SecondForm); if (target is AIHeroClient && target.Health + target.AttackShield <= subDmg) { return Q.Cast(pred.CastPosition); } return target is Obj_AI_Minion && spell.CanLastHit(target, subDmg) && Q.Cast(pred.CastPosition); }
/// <summary> /// Gets the target without collision checking. /// </summary> /// <param name="spell"> /// The spell. /// </param> /// <param name="ignoreShields"> /// Indicates whether to ignore shields. /// </param> /// <param name="ignoreChampions"> /// Indicates whether to ignore champions. /// </param> /// <returns> /// The <see cref="Obj_AI_Hero" />. /// </returns> public Obj_AI_Hero GetTargetNoCollision( Spell spell, bool ignoreShields = true, IEnumerable<Obj_AI_Hero> ignoreChampions = null) { return this.GetTargets(spell.Range, spell.DamageType, ignoreShields, spell.From, ignoreChampions) .FirstOrDefault(t => spell.GetPrediction(t).Hitchance != HitChance.Collision); }