Exemple #1
0
        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;
            MissilePosition = start;
            Direction       = (end - start).Normalized();

            Unit = unit;

            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;

            case SkillShotType.SkillshotArc:
                Arc = new Geometry.Arc(start, end,
                                       EvadeManager.SkillShotsExtraRadius + (int)ObjectManager.Player.BoundingRadius);
                break;
            }

            UpdatePolygon();
        }
Exemple #2
0
        public void OnUpdate()
        {
            if (SpellData.CollisionObjects.Length > 0 && SpellData.CollisionObjects != null &&
                Utils.GameTimeTickCount - _lastCollisionCalc > 50)
            {
                _lastCollisionCalc = Utils.GameTimeTickCount;
                _collisionEnd      = Collision.GetCollisionPoint(this);
            }

            if (SpellData.Type == SkillShotType.SkillshotMissileLine)
            {
                Rectangle = new Geometry.Rectangle(GetMissilePosition(0), CollisionEnd, SpellData.Radius);
                UpdatePolygon();
            }

            if (SpellData.MissileFollowsUnit)
            {
                if (Unit.IsVisible)
                {
                    End       = Unit.ServerPosition.To2D();
                    Direction = (End - Start).Normalized();
                    UpdatePolygon();
                }
            }

            if (SpellData.SpellName == "TaricE")
            {
                Start     = Unit.ServerPosition.To2D();
                End       = Start + Direction * SpellData.Range;
                Rectangle = new Geometry.Rectangle(Start, End, SpellData.Radius);
                UpdatePolygon();
            }

            if (SpellData.SpellName == "SionR")
            {
                if (_helperTick == 0)
                {
                    _helperTick = StartTick;
                }

                SpellData.MissileSpeed = (int)Unit.MoveSpeed;
                if (Unit.IsValidTarget(float.MaxValue, false))
                {
                    if (!Unit.HasBuff("SionR") && Utils.GameTimeTickCount - _helperTick > 600)
                    {
                        StartTick = 0;
                    }
                    else
                    {
                        StartTick = Utils.GameTimeTickCount - SpellData.Delay;
                        Start     = Unit.ServerPosition.To2D();
                        End       = Unit.ServerPosition.To2D() + 1000 * Unit.Direction.To2D().Perpendicular();
                        Direction = (End - Start).Normalized();
                        UpdatePolygon();
                    }
                }
                else
                {
                    StartTick = 0;
                }
            }

            if (SpellData.FollowCaster)
            {
                Circle.Center = Unit.ServerPosition.To2D();
                UpdatePolygon();
            }
        }