public PredictionResult GetPrediction(Obj_AI_Base target, CustomSettings custom = null) { var source = custom != null && custom.Source != null ? custom.Source : Source; if (!CachedPredictions.ContainsKey(source.NetworkId)) { CachedPredictions.Add(source.NetworkId, new Dictionary <int, PredictionResult>()); } if (!CachedPredictions[source.NetworkId].ContainsKey(target.NetworkId)) { var speed = custom != null && custom.Speed > 0 ? custom.Speed : Speed; var castDelay = custom != null && custom.CastDelay > 0 ? custom.CastDelay : CastDelay; var range = custom != null && custom.Range > 0 ? custom.Range : Range; var width = custom != null && custom.Width > 0 ? custom.Width : Width; var allowedCollisionCount = custom != null && custom.AllowedCollisionCount > 0 ? custom.AllowedCollisionCount : AllowedCollisionCount; var type = custom != null && custom.Type != SpellType.Unknown ? custom.Type : Type; PredictionResult result; switch (type) { case SpellType.Circular: result = Prediction.Position.PredictCircularMissile(target, range, width, castDelay, speed, source.Position); break; case SpellType.Cone: result = Prediction.Position.PredictConeSpell(target, range, width, castDelay, speed, source.Position); break; case SpellType.Self: result = Prediction.Position.PredictCircularMissile(target, range, width, castDelay, speed, source.Position); break; default: result = Prediction.Position.PredictLinearMissile(target, range, 2 * width, castDelay, speed, allowedCollisionCount, source.Position); break; } CachedPredictions[source.NetworkId].Add(target.NetworkId, result); } return(CachedPredictions[source.NetworkId][target.NetworkId]); }
public void Cast(Obj_AI_Base target, CustomSettings custom = null) { if (!IsReady || Chat.IsOpen || AIO.MyHero.Spellbook.IsCastingSpell || !InRange(target)) { return; } if (ModeManager.Harass && target.Type == GameObjectType.AIHeroClient) { if (Orbwalker.ShouldWait) { return; } } if (ModeManager.LaneClear || ModeManager.LastHit || ModeManager.Harass) { if (Orbwalker.LastTarget != null && Orbwalker.LastTarget.Type == GameObjectType.obj_AI_Minion && !Orbwalker.CanMove) { return; } } if (Type == SpellType.Linear || Type == SpellType.Circular || Type == SpellType.Cone) { var pred = GetPrediction(target, custom); if (pred.HitChancePercent >= HitChancePercent) { if (WillHitYasuoWall(pred.CastPosition) || !PredictedPosInRange(target)) { return; } if (AIO.MyHero.Spellbook.CastSpell(Slot, pred.CastPosition)) { LastSentTime = Core.GameTickCount; } } } else if (Type == SpellType.Targeted) { if (WillHitYasuoWall(target.ServerPosition)) { return; } if (AIO.MyHero.Spellbook.CastSpell(Slot, target)) { LastSentTime = Core.GameTickCount; } } else if (Type == SpellType.Self) { var pred = GetPrediction(target, custom); if (pred.HitChancePercent >= HitChancePercent) { if (!PredictedPosInRange(target)) { return; } if (AIO.MyHero.Spellbook.CastSpell(Slot)) { LastSentTime = Core.GameTickCount; } } } }
public PredictionResult GetPrediction(Obj_AI_Base target, CustomSettings custom = null) { var source = custom != null && custom.Source != null ? custom.Source : Source; if (!CachedPredictions.ContainsKey(source.NetworkId)) { CachedPredictions.Add(source.NetworkId, new Dictionary<int, PredictionResult>()); } if (!CachedPredictions[source.NetworkId].ContainsKey(target.NetworkId)) { var speed = custom != null && custom.Speed > 0 ? custom.Speed : Speed; var castDelay = custom != null && custom.CastDelay > 0 ? custom.CastDelay : CastDelay; var range = custom != null && custom.Range > 0 ? custom.Range : Range; var width = custom != null && custom.Width > 0 ? custom.Width : Width; var allowedCollisionCount = custom != null && custom.AllowedCollisionCount > 0 ? custom.AllowedCollisionCount : AllowedCollisionCount; var type = custom != null && custom.Type != SpellType.Unknown ? custom.Type : Type; PredictionResult result; switch (type) { case SpellType.Circular: result = Prediction.Position.PredictCircularMissile(target, range, width, castDelay, speed, source.Position); break; case SpellType.Cone: result = Prediction.Position.PredictConeSpell(target, range, width, castDelay, speed, source.Position); break; case SpellType.Self: result = Prediction.Position.PredictCircularMissile(target, range, width, castDelay, speed, source.Position); break; default: result = Prediction.Position.PredictLinearMissile(target, range, 2 * width, castDelay, speed, allowedCollisionCount, source.Position); break; } CachedPredictions[source.NetworkId].Add(target.NetworkId, result); } return CachedPredictions[source.NetworkId][target.NetworkId]; }