private static void ObjMissileClientOnCreateDelayed(MissileClient missile, SpellData spellData)
 {
     var unit = missile.SpellCaster as AIHeroClient;
     var missilePosition = missile.Position.To2D();
     var unitPosition = missile.StartPosition.To2D();
     var endPos = missile.EndPosition.To2D();
     var direction = (endPos - unitPosition).Normalized();
     if (unitPosition.Distance(endPos) > spellData.Range || spellData.FixedRange)
     {
         endPos = unitPosition + direction * spellData.Range;
     }
     if (spellData.ExtraRange != -1)
     {
         endPos += Math.Min(spellData.ExtraRange, spellData.Range - endPos.Distance(unitPosition)) * direction;
     }
     var castTime = Utils.GameTimeTickCount - Game.Ping / 2 - (spellData.MissileDelayed ? 0 : spellData.Delay)
                    - (int)(1000 * missilePosition.Distance(unitPosition) / spellData.MissileSpeed);
     TriggerOnDetectSkillshot(DetectionType.RecvPacket, spellData, castTime, unitPosition, endPos, unit);
 }
Beispiel #2
0
        public Skillshot(DetectionType detectionType,
            SpellData spellData,
            int startT,
            Vector2 start,
            Vector2 end,
            Obj_AI_Base unit,
            Obj_AI_Base target = null
            )
        {
            DetectionType = detectionType;
            SpellData = spellData;
            StartTick = startT;
            Start = start;
            End = end;
            MissilePosition = start;
            Direction = (end - start).Normalized();
            Target = target;
            Unit = unit;

            //Create the spatial object for each type of skillshot.
            switch (spellData.Type)
            {
                case SkillShotType.SkillshotCircle:
                    Circle = new Geometry.Circle(CollisionEnd, spellData.Radius);
                    break;
                case SkillShotType.SkillshotLine:
                    Rectangle = new Geometry.Rectangle(Start, CollisionEnd, spellData.Radius);
                    break;
                case SkillShotType.SkillshotMissileLine:
                    Rectangle = new Geometry.Rectangle(Start, CollisionEnd, spellData.Radius);
                    break;
                case SkillShotType.SkillshotCone:
                    Sector = new Geometry.Sector(
                        start, CollisionEnd - start, spellData.Radius * (float) Math.PI / 180, spellData.Range);
                    break;
                case SkillShotType.SkillshotRing:
                    Ring = new Geometry.Ring(CollisionEnd, spellData.Radius, spellData.RingRadius);
                    break;
            }

            UpdatePolygon(); //Create the polygon.
        }
Beispiel #3
0
 private static void ObjSpellMissileOnCreate(GameObject sender, EventArgs args)
 {
     if (!sender.IsValid<MissileClient>())
     {
         return;
     }
     var missile = (MissileClient)sender;
     if (!missile.SpellCaster.IsValid<AIHeroClient>() || missile.SpellCaster.Team == Variables._Player.Team)
     {
         return;
     }
     var unit = (AIHeroClient)missile.SpellCaster;
     var spellData =
         Spells.FirstOrDefault(
             i =>
             i.SpellNames.Contains(missile.SData.Name.ToLower())
             && championmenu2[i.MissileName].Cast<CheckBox>().CurrentValue);
     if (spellData == null //MenuManager.LaneClearMenu["E"].Cast<CheckBox>().CurrentValue
         && (!missile.SData.Name.ToLower().Contains("crit")
                 ? evadeMenu2["BAttack"].Cast<CheckBox>().CurrentValue
                   && Variables._Player.HealthPercent < evadeMenu2["BAttackHpU"].Cast<Slider>().CurrentValue
                 : evadeMenu2["CAttack"].Cast<CheckBox>().CurrentValue
                   && Variables._Player.HealthPercent < evadeMenu2["CAttackHpU"].Cast<Slider>().CurrentValue))
     {
         spellData = new SpellData
         { ChampionName = unit.ChampionName, SpellNames = new[] { missile.SData.Name } };
     }
     if (spellData == null || !missile.Target.IsMe)
     {
         return;
     }
     DetectedTargets.Add(new Targets { Start = unit.ServerPosition, Obj = missile });
 }
Beispiel #4
0
        private static void TriggerOnDetectSkillshot(DetectionType detectionType,
            SpellData spellData,
            int startT,
            Vector2 start,
            Vector2 end,
            Obj_AI_Base unit,
            Obj_AI_Base target = null)
        {
            var skillshot = new Skillshot(detectionType, spellData, startT, start, end, unit, target);

            if (OnDetectSkillshot != null)
            {
                OnDetectSkillshot(skillshot);
            }
        }
 private static void TriggerOnDetectSkillshot(
     DetectionType detectionType,
     SpellData spellData,
     int startT,
     Vector2 start,
     Vector2 end,
     Obj_AI_Base unit)
 {
     if (OnDetectSkillshot != null)
     {
         OnDetectSkillshot(new Skillshot(detectionType, spellData, startT, start, end, unit));
     }
 }
Beispiel #6
0
 public Skillshot(
     DetectionType detectionType,
     SpellData spellData,
     int startT,
     Vector2 start,
     Vector2 end,
     Obj_AI_Base unit)
 {
     this.DetectionType = detectionType;
     this.SpellData = spellData;
     this.StartTick = startT;
     this.Start = start;
     this.End = end;
     this.Direction = (end - start).Normalized();
     this.Unit = unit;
     switch (spellData.Type)
     {
         case SkillShotType.SkillshotCircle:
             this.Circle = new Geometry.Polygon.Circle(this.CollisionEnd, spellData.Radius, 22);
             break;
         case SkillShotType.SkillshotLine:
         case SkillShotType.SkillshotMissileLine:
             this.Rectangle = new Geometry.Polygon.Rectangle(this.Start, this.CollisionEnd, spellData.Radius);
             break;
         case SkillShotType.SkillshotCone:
             this.Sector = new Geometry.Polygon.Sector(
                 start,
                 this.CollisionEnd - start,
                 spellData.Radius * (float)Math.PI / 180,
                 spellData.Range,
                 22);
             break;
         case SkillShotType.SkillshotRing:
             this.Ring = new Geometry.Polygon.Ring(this.CollisionEnd, spellData.Radius, spellData.RingRadius, 22);
             break;
         case SkillShotType.SkillshotArc:
             this.Arc = new Geometry.Polygon.Arc(
                 start,
                 end,
                 Configs.SkillShotsExtraRadius + (int)ObjectManager.Player.BoundingRadius,
                 22);
             break;
     }
     this.UpdatePolygon();
 }