Esempio n. 1
0
        public PredictionResult GetPrediction(Obj_AI_Base target, CustomSettings custom = null)
        {
            var source         = custom != null && custom.Source != null ? custom.Source : Source;
            var sourcePosition = custom != null && custom.SourcePosition.HasValue ? custom.SourcePosition : source.Position;

            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,
                                                                        sourcePosition);
                    break;

                case SpellType.Cone:
                    result = Prediction.Position.PredictConeSpell(target, range, width, castDelay, speed,
                                                                  sourcePosition);
                    break;

                case SpellType.Self:
                    result = Prediction.Position.PredictCircularMissile(target, range, width, castDelay, speed,
                                                                        sourcePosition);
                    break;

                default:
                    result = Prediction.Position.PredictLinearMissile(target, range, width, castDelay, speed,
                                                                      allowedCollisionCount, source.Position);
                    break;
                }
                CachedPredictions[source.NetworkId].Add(target.NetworkId, result);
            }
            return(CachedPredictions[source.NetworkId][target.NetworkId]);
        }
Esempio n. 2
0
 public void Cast(Obj_AI_Base target, CustomSettings custom = null)
 {
     if (!IsReady || Chat.IsOpen || !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;
                 LastEndPosition = pred.CastPosition;
             }
         }
     }
     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;
             }
         }
     }
 }
Esempio n. 3
0
 public PredictionResult GetPrediction(Obj_AI_Base target, CustomSettings custom = null)
 {
     var source = custom != null && custom.Source != null ? custom.Source : Source;
     var sourcePosition = custom != null && custom.SourcePosition.HasValue ? custom.SourcePosition : source.Position;
     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,
                     sourcePosition);
                 break;
             case SpellType.Cone:
                 result = Prediction.Position.PredictConeSpell(target, range, width, castDelay, speed,
                     sourcePosition);
                 break;
             case SpellType.Self:
                 result = Prediction.Position.PredictCircularMissile(target, range, width, castDelay, speed,
                     sourcePosition);
                 break;
             default:
                 result = Prediction.Position.PredictLinearMissile(target, range, width, castDelay, speed,
                     allowedCollisionCount, source.Position);
                 break;
         }
         CachedPredictions[source.NetworkId].Add(target.NetworkId, result);
     }
     return CachedPredictions[source.NetworkId][target.NetworkId];
 }
Esempio n. 4
0
 public void Cast(Obj_AI_Base target, CustomSettings custom = null)
 {
     if (!IsReady || Chat.IsOpen || !IsInRange(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) || !RangeCheckSource.IsInRange(pred.CastPosition, Range))
             {
                 return;
             }
             if (AIO.MyHero.Spellbook.CastSpell(Slot, pred.CastPosition))
             {
                 LastSentTime = Core.GameTickCount;
                 LastEndPosition = pred.CastPosition;
             }
         }
     }
     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;
             }
         }
     }
 }