private static void ObjMissileClientOnCreateDelayed(MissileClient missile, SpellData spellData) { var unit = missile.SpellCaster as Obj_AI_Hero; 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); }
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)); } }
private static void ObjSpellMissileOnCreate(GameObject sender, EventArgs args) { if (!sender.IsValid<MissileClient>()) { return; } var missile = (MissileClient) sender; if (!missile.SpellCaster.IsValid<Obj_AI_Hero>() || missile.SpellCaster.Team == Player.Team) { return; } var unit = (Obj_AI_Hero) missile.SpellCaster; var spellData = Spells.FirstOrDefault( i => i.SpellNames.Contains(missile.SData.Name.ToLower()) && GetItem("ET_" + i.ChampionName, i.MissileName) != null && GetValue<bool>("ET_" + i.ChampionName, i.MissileName)); if (spellData == null && missile.SData.IsAutoAttack() && (!missile.SData.Name.ToLower().Contains("crit") ? GetValue<bool>("EvadeTarget", "BAttack") && Player.HealthPercent < GetValue<Slider>("EvadeTarget", "BAttackHpU").Value : GetValue<bool>("EvadeTarget", "CAttack") && Player.HealthPercent < GetValue<Slider>("EvadeTarget", "CAttackHpU").Value)) { spellData = new SpellData { ChampionName = unit.ChampionName, SpellNames = new[] { missile.SData.Name } }; } if (spellData == null || !missile.Target.IsMe) { return; } DetectedTargets.Add(new Targets { Obj = missile }); }
public Skillshot(DetectionType detectionType, SpellData spellData, int startT, Vector2 start, Vector2 end, Obj_AI_Base unit) { DetectionType = detectionType; SpellData = spellData; StartTick = startT; Start = start; End = end; Direction = (end - start).Normalized(); Unit = unit; switch (spellData.Type) { case SkillShotType.SkillshotCircle: Circle = new Geometry.Polygon.Circle(CollisionEnd, spellData.Radius, 22); break; case SkillShotType.SkillshotLine: case SkillShotType.SkillshotMissileLine: Rectangle = new Geometry.Polygon.Rectangle(Start, CollisionEnd, spellData.Radius); break; case SkillShotType.SkillshotCone: Sector = new Geometry.Polygon.Sector( start, CollisionEnd - start, spellData.Radius * (float) Math.PI / 180, spellData.Range, 22); break; case SkillShotType.SkillshotRing: Ring = new Geometry.Polygon.Ring(CollisionEnd, spellData.Radius, spellData.RingRadius, 22); break; } UpdatePolygon(); }
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(); }