public void OnUpdate() { if (this.SpellData.CollisionObjects.Count() > 0 && this.SpellData.CollisionObjects != null && Variables.TickCount - this.lastCollisionCalc > 50) { this.lastCollisionCalc = Variables.TickCount; this.collisionEnd = this.GetCollisionPoint(); } if (this.SpellData.Type == SkillShotType.SkillshotMissileLine) { this.Rectangle = new Rectangle(this.GetMissilePosition(0), this.CollisionEnd, this.SpellData.Radius); this.UpdatePolygon(); } if (this.SpellData.MissileFollowsUnit && this.Unit.IsVisible) { this.End = this.Unit.ServerPosition.ToVector2(); this.Direction = (this.End - this.Start).Normalized(); this.UpdatePolygon(); } if (this.SpellData.SpellName == "SionR") { if (this.helperTick == 0) { this.helperTick = this.StartTick; } this.SpellData.MissileSpeed = (int)this.Unit.MoveSpeed; if (this.Unit.IsValidTarget(float.MaxValue, false)) { if (!this.Unit.HasBuff("SionR") && Variables.TickCount - this.helperTick > 600) { this.StartTick = 0; } else { this.StartTick = Variables.TickCount - this.SpellData.Delay; this.Start = this.Unit.ServerPosition.ToVector2(); this.End = this.Unit.ServerPosition.ToVector2() + 1000 * this.Unit.Direction.ToVector2().Perpendicular(); this.Direction = (this.End - this.Start).Normalized(); this.UpdatePolygon(); } } else { this.StartTick = 0; } } if (this.SpellData.FollowCaster) { this.Circle.Center = this.Unit.ServerPosition.ToVector2(); this.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 Circle(this.CollisionEnd, spellData.Radius, 22); break; case SkillShotType.SkillshotLine: case SkillShotType.SkillshotMissileLine: this.Rectangle = new Rectangle(this.Start, this.CollisionEnd, spellData.Radius); break; case SkillShotType.SkillshotCone: this.Sector = new Sector( start, this.CollisionEnd - start, spellData.Radius * (float)Math.PI / 180, spellData.Range, 22); break; case SkillShotType.SkillshotRing: this.Ring = new Ring(this.CollisionEnd, spellData.Radius, spellData.RingRadius, 22); break; case SkillShotType.SkillshotArc: this.Arc = new Arc( start, end, Configs.SkillShotsExtraRadius + (int)ObjectManager.Player.BoundingRadius, 22); break; } this.UpdatePolygon(); }