private static void ObjMissileClientOnCreateDelayed(MissileClient missile, SpellData spellData)
 {
     var unit = missile.SpellCaster as Obj_AI_Hero;
     var missilePosition = missile.Position.ToVector2();
     var unitPosition = missile.StartPosition.ToVector2();
     var endPos = missile.EndPosition.ToVector2();
     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 = Variables.TickCount - Game.Ping / 2 - (spellData.MissileDelayed ? 0 : spellData.Delay)
                    - (int)(1000f * missilePosition.Distance(unitPosition) / spellData.MissileSpeed);
     TriggerOnDetectSkillshot(DetectionType.RecvPacket, spellData, castTime, unitPosition, endPos, unit);
 }
Example #2
0
 public Skillshot(
     DetectionType detectionType,
     SpellData spellData,
     int startT,
     Vector2 start,
     Vector2 end,
     Obj_AI_Base unit,
     MissileClient missile = null)
 {
     this.DetectionType = detectionType;
     this.SpellData = spellData;
     this.StartTick = startT;
     this.Start = start;
     this.End = end;
     this.Direction = (end - start).LSNormalized();
     this.Unit = unit;
     this.Missile = missile;
     switch (spellData.Type)
     {
         case SkillShotType.SkillshotCircle:
             this.Circle = new Geometry.Circle(this.CollisionEnd, spellData.Radius);
             break;
         case SkillShotType.SkillshotLine:
             this.Rectangle = new Geometry.Rectangle(this.Start, this.CollisionEnd, spellData.Radius);
             break;
         case SkillShotType.SkillshotMissileLine:
             this.Rectangle = new Geometry.Rectangle(this.Start, this.CollisionEnd, spellData.Radius);
             break;
         case SkillShotType.SkillshotCone:
             this.Sector = new Geometry.Sector(
                 start,
                 this.CollisionEnd - start,
                 spellData.Radius * (float)Math.PI / 180,
                 spellData.Range);
             break;
         case SkillShotType.SkillshotRing:
             this.Ring = new Geometry.Ring(this.CollisionEnd, spellData.Radius, spellData.RingRadius);
             break;
         case SkillShotType.SkillshotArc:
             this.Arc = new Geometry.Arc(
                 start,
                 end,
                 Config.SkillShotsExtraRadius + (int)Program.Player.BoundingRadius);
             break;
     }
     this.UpdatePolygon();
 }
Example #3
0
 private static void TriggerOnDetectSkillshot(
     DetectionType detectionType,
     SpellData spellData,
     int startT,
     Vector2 start,
     Vector2 end,
     Vector2 originalEnd,
     Obj_AI_Base unit,
     MissileClient missile = null)
 {
     OnDetectSkillshot?.Invoke(new Skillshot(detectionType, spellData, startT, start, end, unit, missile) { OriginalEnd = originalEnd });
 }
 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));
     }
 }
Example #5
0
 private static void ObjSpellMissileOnCreate(GameObject sender, EventArgs args)
 {
     var missile = sender as MissileClient;
     if (missile == null || !missile.IsValid)
     {
         return;
     }
     var caster = missile.SpellCaster as Obj_AI_Hero;
     if (caster == null || !caster.IsValid || caster.Team == Player.Team || !missile.Target.IsMe)
     {
         return;
     }
     var spellData =
         Spells.FirstOrDefault(
             i =>
             i.SpellNames.Contains(missile.SData.Name.ToLower())
             && MainMenu["EvadeTarget"][i.ChampionName.ToLowerInvariant()][i.MissileName]);
     if (spellData == null && AutoAttack.IsAutoAttack(missile.SData.Name)
         && (!missile.SData.Name.ToLower().Contains("crit")
                 ? MainMenu["EvadeTarget"]["AA"]["B"]
                   && Player.HealthPercent < MainMenu["EvadeTarget"]["AA"]["BHpU"]
                 : MainMenu["EvadeTarget"]["AA"]["C"]
                   && Player.HealthPercent < MainMenu["EvadeTarget"]["AA"]["CHpU"]))
     {
         spellData = new SpellData
                         { ChampionName = caster.ChampionName, SpellNames = new[] { missile.SData.Name } };
     }
     if (spellData == null)
     {
         return;
     }
     DetectedTargets.Add(new Targets { Start = caster.ServerPosition, Obj = missile });
 }