Ejemplo n.º 1
0
        public SpellInstance(
            SpellData data,
            int startT,
            int endT,
            Vector2 start,
            Vector2 end,
            Obj_AI_Base unit,
            SpellType type)
        {
            this.Data      = data;
            this.StartTick = startT;
            this.EndTick   = this.StartTick + endT;
            this.Start     = start;
            this.End       = end;
            this.Direction = (end - start).Normalized();
            this.Unit      = unit;
            this.Type      = type;
            this.Radius    = this.GetRadius;

            switch (this.Type)
            {
            case SpellType.Line:
            case SpellType.MissileLine:
                this.Line = new Polygons.Line(this.Start, this.End, this.Radius);
                break;

            case SpellType.Cone:
            case SpellType.MissileCone:
                this.Cone = new Polygons.Cone(this.Start, this.Direction, this.Radius, data.Range);
                break;

            case SpellType.Circle:
                this.Circle = new Polygons.Circle(this.End, this.Radius);
                break;

            case SpellType.Ring:
                this.Ring = new Polygons.Ring(this.End, data.RadiusEx, this.Radius);
                break;

            case SpellType.Arc:
                this.Arc = new Polygons.Arc(this.Start, this.End, this.Radius);
                break;
            }

            this.UpdatePolygon();
        }
Ejemplo n.º 2
0
        public void OnUpdate()
        {
            if (this.Data.CollisionObjects != null && this.Data.CollisionObjects.Length > 0)
            {
                if (Utils.GameTimeTickCount - this.lastCalcColTick > 50 &&
                    Configs.Menu.Item("CheckCollision").GetValue <bool>())
                {
                    this.lastCalcColTick = Utils.GameTimeTickCount;
                    this.predEnd         = Collisions.GetCollision(this);
                }
            }
            else if (this.predEnd.IsValid())
            {
                this.predEnd = Vector2.Zero;
            }

            if (this.Type == SpellType.Line || this.Type == SpellType.MissileLine)
            {
                this.Line = new Polygons.Line(this.GetMissilePosition(0), this.PredictEnd, this.Radius);
                this.UpdatePolygon();
            }

            if (this.Type == SpellType.Circle && string.IsNullOrEmpty(this.Data.TrapName))
            {
                this.Circle = new Polygons.Circle(this.PredictEnd, this.Radius);
                this.UpdatePolygon();
            }

            if (!this.Unit.IsVisible)
            {
                return;
            }

            if (this.Data.MissileToUnit)
            {
                this.End       = this.Unit.ServerPosition.To2D();
                this.Direction = (this.End - this.Start).Normalized();

                if (this.Type == SpellType.Ring)
                {
                    this.Ring.Center = this.End;
                    this.UpdatePolygon();
                }
            }

            if (this.Data.MissileFromUnit)
            {
                this.Start = this.Unit.ServerPosition.To2D();
                this.End   = this.Start + this.Direction * this.Data.Range;
            }

            if (this.Data.MenuName == "GalioR" && !this.Unit.HasBuff("GalioIdolOfDurand") &&
                Utils.GameTimeTickCount - this.StartTick > this.Data.Delay + 300)
            {
                this.EndTick = 0;
            }

            if (this.Data.MenuName == "SionR")
            {
                if (this.Unit.HasBuff("SionR"))
                {
                    this.Start             = this.Unit.ServerPosition.To2D();
                    this.End               = this.Start + this.Unit.Direction.To2D().Perpendicular() * this.Data.Range;
                    this.Direction         = (this.End - this.Start).Normalized();
                    this.Data.MissileSpeed = (int)this.Unit.MoveSpeed;
                    this.StartTick         = Utils.GameTimeTickCount;
                    this.EndTick           = this.StartTick + (int)(this.Start.Distance(this.End) / this.Data.MissileSpeed * 1000);
                }
                else
                {
                    this.EndTick = Utils.GameTimeTickCount - this.StartTick > 500 ? 0 : Utils.GameTimeTickCount + 100;
                }
            }

            if (this.Data.MenuName == "MonkeyKingR")
            {
                if (this.Unit.HasBuff("MonkeyKingSpinToWin"))
                {
                    this.StartTick = Utils.GameTimeTickCount;
                    this.EndTick   = this.StartTick + 10;
                }
                else
                {
                    this.EndTick = Utils.GameTimeTickCount - this.StartTick > 500 ? 0 : Utils.GameTimeTickCount + 100;
                }
            }
        }