internal static CastStates CastingBestTarget( this Spell spell, bool aoe = false, LeagueSharp.SDK.CollisionableObjects collisionable = LeagueSharp.SDK.CollisionableObjects.Minions | LeagueSharp.SDK.CollisionableObjects.YasuoWall) { return(spell.Casting(spell.GetTarget(spell.Width / 2), aoe, collisionable)); }
internal static CastStates Casting( this Spell spell, Obj_AI_Base unit, bool aoe = false, LeagueSharp.SDK.CollisionableObjects collisionable = LeagueSharp.SDK.CollisionableObjects.Minions | LeagueSharp.SDK.CollisionableObjects.YasuoWall) { if (!unit.LSIsValidTarget()) { return(CastStates.InvalidTarget); } if (!spell.IsReady()) { return(CastStates.NotReady); } if (spell.CastCondition != null && !spell.CastCondition()) { return(CastStates.FailedCondition); } var pred = spell.GetPrediction(unit, aoe, -1, collisionable); if (pred.CollisionObjects.Count > 0) { return(CastStates.Collision); } if (spell.RangeCheckFrom.DistanceSquared(pred.CastPosition) > spell.RangeSqr) { return(CastStates.OutOfRange); } if (pred.Hitchance < spell.MinHitChance && (!pred.Input.AoE || pred.Hitchance < HitChance.High || pred.AoeTargetsHitCount < 2)) { return(CastStates.LowHitChance); } if (!Program.Player.Spellbook.CastSpell(spell.Slot, pred.CastPosition)) { return(CastStates.NotCasted); } spell.LastCastAttemptT = Variables.TickCount; return(CastStates.SuccessfullyCasted); }
internal static List <Obj_AI_Base> GetCollision( this Spell spell, Obj_AI_Base target, List <Vector3> to, LeagueSharp.SDK.CollisionableObjects collisionable = LeagueSharp.SDK.CollisionableObjects.Minions) { var col = Collision.GetCollision( to, new PredictionInput { Delay = spell.Delay, Radius = spell.Width, Speed = spell.Speed, From = spell.From, Range = spell.Range, Type = spell.Type, CollisionObjects = collisionable }); col.RemoveAll(i => i.Compare(target)); return(col); }