Пример #1
0
 public SpellData(
     string championName,
     string spellName,
     SpellSlot slot,
     SkillShotType type,
     int delay,
     int range,
     int radius,
     int missileSpeed,
     bool addHitbox,
     bool fixedRange,
     int defaultDangerValue)
 {
     this.ChampionName = championName;
     this.SpellName = spellName;
     this.Slot = slot;
     this.Type = type;
     this.Delay = delay;
     this.Range = range;
     this.RawRadius = radius;
     this.MissileSpeed = missileSpeed;
     this.AddHitbox = addHitbox;
     this.FixedRange = fixedRange;
     this.DangerValue = defaultDangerValue;
 }
Пример #2
0
    private void OnCharacterSelectAsTarget(Character character)
    {
        _currentSelectedTarget = character;

        _currentSelectedCharacter.SpellSelectionDone();

        _newBattleUI.SetTurnFinished();

        for (int i = 0; i < _parties.Length; i++)
        {
            _parties[i].Event_TargetSelected -= OnCharacterSelectAsTarget;
            _parties[i].ChangePartyTargetMode(false);
        }

        DivineDebug.Log("BattleLogic, char: " + character.moniker);

        SkillShotType skillShotType = AppearanceConfigData.instance.GetMagicWithIndex(_currentSelectedCharacter.moniker,
                                                                                      _currentSelectedSpellIndex)._skillShotType;

        DivineDebug.Log("OnCharacterSelectAsTarget ----------> skillShotType: " + skillShotType.ToString());

        if (skillShotType == SkillShotType.None)
        {
            Net_SendAction(character.id, _currentSelectedSpellIndex);
        }
        //else
        //    ; //Skill Shot???
        //(UIGroup.CreateGroup("Skillshot_" + skillShotType.ToString()) as ISkillshot).Init(OnSkillShotFinished);
    }
 public SpellData(string championName,
                  string spellName,
                  SpellSlot slot,
                  SkillShotType type,
                  int delay,
                  int range,
                  int radius,
                  int missileSpeed,
                  bool addHitbox,
                  bool fixedRange,
                  int defaultDangerValue)
 {
     ChampionName  = championName;
     CharacterName = championName;
     SpellName     = spellName;
     Slot          = slot;
     Type          = type;
     Delay         = delay;
     Range         = range;
     _radius       = radius;
     MissileSpeed  = missileSpeed;
     AddHitbox     = addHitbox;
     FixedRange    = fixedRange;
     DangerValue   = defaultDangerValue;
 }
Пример #4
0
 public SpellData(
     string championName,
     string spellName,
     SpellSlot slot,
     SkillShotType type,
     int delay,
     int range,
     int radius,
     int missileSpeed,
     bool addHitbox,
     bool fixedRange,
     int defaultDangerValue)
 {
     this.ChampionName = championName;
     this.SpellName    = spellName;
     this.Slot         = slot;
     this.Type         = type;
     this.Delay        = delay;
     this.Range        = range;
     this.RawRadius    = radius;
     this.MissileSpeed = missileSpeed;
     this.AddHitbox    = addHitbox;
     this.FixedRange   = fixedRange;
     this.DangerValue  = defaultDangerValue;
 }
Пример #5
0
        public Spell.Skillshot GetSkillshotSpell(string name, uint range, SkillShotType type)
        {
            var slot = Player.Instance.GetSpellSlotFromName(name);

            if (slot != SpellSlot.Unknown)
            {
                return(new Spell.Skillshot(slot, range, type));
            }

            return(null);
        }
Пример #6
0
 public Hero(Champion champion, SpellSlot slot, SkillShotType type, uint range, int width, int castdelay, int speed, int allowedCollisionCount)
 {
     this.Champion              = champion;
     this.Slot                  = slot;
     this.Type                  = type;
     this.Range                 = range;
     this.Width                 = width;
     this.CastDelay             = castdelay;
     this.Speed                 = speed;
     this.AllowedCollisionCount = allowedCollisionCount;
 }
Пример #7
0
        public static Spell.SpellBase GetSkillshotSpell(string name, uint range, SkillShotType type)
        {
            var slot = Player.Instance.GetSpellSlotFromName(name);

            if (slot != SpellSlot.Unknown)
            {
                return new Spell.Skillshot(slot, range, type);
            }

            return null;
        }
Пример #8
0
 public Ultilmate_Infomation(Champion champion, SpellSlot slot, SkillShotType type, uint range, int width, int castdelay, int speed, int allowedCollisionCount)
 {
     Champion              = champion;
     Slot                  = slot;
     Type                  = type;
     Range                 = range;
     Width                 = width;
     CastDelay             = castdelay;
     Speed                 = speed;
     AllowedCollisionCount = allowedCollisionCount;
 }
Пример #9
0
        public static Spell.Skillshot GetSkillShotData(this SpellSlot slot, SkillShotType skillType)
        {
            var spellData = SpellDatabase.GetSpellInfoList(Player.Instance).FirstOrDefault(s => s.Slot == slot);

            if (spellData != null)
            {
                return(new Spell.Skillshot(slot, (uint)spellData.Range, skillType, (int)(1000 * spellData.Delay), (int)spellData.MissileSpeed, (int)spellData.Radius)
                {
                    AllowedCollisionCount = slot.GetCollisionCount()
                });
            }
            return(null);
        }
Пример #10
0
        public DynamicSpellObsolete SetSkillshot(
            bool collision,
            SkillShotType type,
            Vector3 fromVector3           = default(Vector3),
            Vector3 rangeCheckFromVector3 = default(Vector3))
        {
            From              = fromVector3;
            HasCollision      = collision;
            SkillShotTypeType = type;
            RangeCheckFrom    = rangeCheckFromVector3;
            IsSkillshot       = true;

            return(this);
        }
Пример #11
0
 public SpellData(string championName, string spellName, SpellSlot slot, SkillShotType type, int delay, int range,
     int radius, int missileSpeed, bool addHitbox, bool fixedRange, int defaultDangerValue)
 {
     ChampionName = championName;
     SpellName = spellName;
     Slot = slot;
     Type = type;
     Delay = delay;
     Range = range;
     _radius = radius;
     MissileSpeed = missileSpeed;
     AddHitbox = addHitbox;
     FixedRange = fixedRange;
     DangerValue = defaultDangerValue;
 }
Пример #12
0
            public Skillshot(SpellSlot spellSlot, uint spellRange, SkillShotType skillShotType, int castDelay = 250,
                             int?spellSpeed = null, int?spellWidth = null, DamageType dmgType = DamageType.Mixed)
                : base(spellSlot, spellRange, dmgType)
            {
                // Initialize properties
                Type = skillShotType;

                // Optional parameters
                CastDelay        = castDelay;
                Speed            = spellSpeed ?? 0;
                Width            = spellWidth ?? 0;
                ConeAngleDegrees = 90;

                // Default values for properties
                MinimumHitChance = HitChance.Medium;
            }
Пример #13
0
        public DynamicSpellObsolete SetSkillshot(
            int delay,
            int skillWidth,
            int speed,
            SkillShotType type,
            Vector3 fromVector3           = default(Vector3),
            Vector3 rangeCheckFromVector3 = default(Vector3))
        {
            Delay             = delay;
            Width             = skillWidth;
            Speed             = speed;
            From              = fromVector3;
            SkillShotTypeType = type;
            RangeCheckFrom    = rangeCheckFromVector3;
            IsSkillshot       = true;

            return(this);
        }
Пример #14
0
 public void SetSkillshot(
     float delay,
     float width,
     float speed,
     bool collision,
     SkillShotType type,
     Vector3 from           = new Vector3(),
     Vector3 rangeCheckFrom = new Vector3())
 {
     Delay          = delay;
     Width          = width;
     Speed          = speed;
     From           = from;
     Collision      = collision;
     Type           = type;
     RangeCheckFrom = rangeCheckFrom;
     IsSkillshot    = true;
 }
Пример #15
0
        public static void CastPredictedSpell(SpellSlot spellslot, float range, SkillShotType type, float delay, float speed, float width, Obj_AI_Base target, bool minioncollision, bool championcollision)
        {
            if (speed > 1f)
            {
                float ax = ObjectManager.Player.ServerPosition.X;
                float ay = ObjectManager.Player.ServerPosition.Y;

                float bx = target.ServerPosition.X;
                float by = target.ServerPosition.Y;

                float cx = target.RealPath().LastOrDefault().X;
                float cy = target.RealPath().LastOrDefault().Y;

                float bc = (float)(Math.Sqrt((bx - cx) * (bx - cx) + (by - cy) * (by - cy)));
                float vx = (cx - bx) / bc;
                float vy = (cy - by) / bc;

                float bv = target.MoveSpeed;
                float ab = (float)(Math.Sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by)));

                float hx = bx + (vx * bv * (delay + ab / speed));
                float hy = by + (vy * bv * (delay + ab / speed));
                float ah = (float)(Math.Sqrt((hx - ax) * (hx - ax) + (hy - ay) * (hy - ay)));

                float ix = bx + (vx * bv * (delay + ah / speed));
                float iy = by + (vy * bv * (delay + ah / speed));
                float ai = (float)(Math.Sqrt((ix - ax) * (ix - ax) + (iy - ay) * (iy - ay)));

                float jx = bx + (vx * bv * (delay + ai / speed));
                float jy = by + (vy * bv * (delay + ai / speed));

                float aj = (float)(Math.Sqrt((ax - jx) * (ax - jx) + (ay - jy) * (ay - jy)));
                float bj = (float)(Math.Sqrt((bx - jx) * (bx - jx) + (by - jy) * (by - jy)));

                float at = delay + aj / speed;
                float bt = bj / bv;
                if (at - bt > -0.05f && at - bt < 0.05f)
                {
                    float x  = jx - (vx * (width / 2f - Game.Ping / 2.15f));
                    float y  = jy - (vy * (width / 2f - Game.Ping / 2.15f));
                    float bp = (float)(Math.Sqrt((bx - x) * (bx - x) + (by - y) * (by - y)));
                    if (bp > bc)
                    {
                        x = cx;
                        y = cy;
                    }
                    float ap = (float)(Math.Sqrt((ax - x) * (ax - x) + (ay - y) * (ay - y)));
                    if (ap < range + ObjectManager.Player.BoundingRadius)
                    {
                        Vector3 pos = new Vector3 {
                            X = x, Y = y
                        };
                        float pl = (float)(Math.Sqrt((target.RealPath().LastOrDefault().X - cx) * (target.RealPath().LastOrDefault().X - cx) + (target.RealPath().LastOrDefault().Y - cy) * (target.RealPath().LastOrDefault().Y - cy)));
                        if (pl < 50f)
                        {
                            if (minioncollision || championcollision)
                            {
                                var MinionCollision = EntityManager.MinionsAndMonsters.EnemyMinions.Any(minion => minion.IsValidTarget(ap + 200f) && CollisionDetection(minion, ObjectManager.Player, pos, ap, delay, speed, width));
                                var HeroesCollision = EntityManager.Heroes.Enemies.Any(hero => hero != target && hero.IsValidTarget(ap + 200f) && CollisionDetection(hero, ObjectManager.Player, pos, ap, delay, speed, width));
                                if ((!minioncollision || !MinionCollision) && (!championcollision || !HeroesCollision))
                                {
                                    Player.CastSpell(spellslot, pos);
                                }
                            }
                            else
                            {
                                Player.CastSpell(spellslot, pos);
                            }
                        }
                    }
                }
            }
            else
            {
                float ax = ObjectManager.Player.ServerPosition.X;
                float ay = ObjectManager.Player.ServerPosition.Y;

                float bx = target.ServerPosition.X;
                float by = target.ServerPosition.Y;

                float cx = target.RealPath().LastOrDefault().X;
                float cy = target.RealPath().LastOrDefault().Y;

                float bc = (float)(Math.Sqrt((bx - cx) * (bx - cx) + (by - cy) * (by - cy)));
                float vx = (cx - bx) / bc;
                float vy = (cy - by) / bc;

                float x = bx + (vx * target.MoveSpeed * delay);
                float y = by + (vy * target.MoveSpeed * delay);

                float xx = x - vx * (width / 2f - Game.Ping / 2.15f);
                float yy = y - vy * (width / 2f - Game.Ping / 2.15f);

                float bp = (float)(Math.Sqrt((bx - xx) * (bx - xx) + (by - yy) * (by - yy)));
                if (bp > bc)
                {
                    xx = cx;
                    yy = cy;
                }
                float ap = (float)(Math.Sqrt((ax - xx) * (ax - xx) + (ay - yy) * (ay - yy)));
                if (ap < range + ObjectManager.Player.BoundingRadius)
                {
                    Vector3 pos = new Vector3 {
                        X = xx, Y = yy
                    };
                    float pl = (float)(Math.Sqrt((target.RealPath().LastOrDefault().X - cx) * (target.RealPath().LastOrDefault().X - cx) + (target.RealPath().LastOrDefault().Y - cy) * (target.RealPath().LastOrDefault().Y - cy)));
                    if (pl < 50f)
                    {
                        Player.CastSpell(spellslot, pos);
                    }
                }
            }
        }
Пример #16
0
        public static HitChance GetHitChance(SpellSlot spellslot, float range, SkillShotType type, float delay, float speed, float radius, Vector3 fromPoint, Obj_AI_Base target)
        {
            // CAN'T MOVE SPELLS ///////////////////////////////////////////////////////////////////////////////////

            if (UnitTracker.GetSpecialSpellEndTime(target) > 0 || target.HasBuff("recall") || (UnitTracker.GetLastStopMoveTime(target) < 0.1d && target.IsRooted))
            {
                return(HitChance.High);
            }

            // PREPARE MATH ///////////////////////////////////////////////////////////////////////////////////

            var tempHitchance = HitChance.Low;

            var   lastWaypiont           = target.RealPath().Last();
            var   distanceUnitToWaypoint = lastWaypiont.Distance(target.ServerPosition);
            var   distanceFromToUnit     = fromPoint.Distance(target.ServerPosition);
            var   distanceFromToWaypoint = lastWaypiont.Distance(fromPoint);
            var   getAngle   = GetAngle(fromPoint, target);
            float speedDelay = distanceFromToUnit / speed;

            if (Math.Abs(speed - float.MaxValue) < float.Epsilon)
            {
                speedDelay = 0;
            }

            float  totalDelay = speedDelay + delay;
            float  moveArea   = target.MoveSpeed * totalDelay;
            float  fixRange   = moveArea * 0.4f;
            float  pathMinLen = 900 + +moveArea;
            double angleMove  = 31;

            if (radius > 70)
            {
                angleMove++;
            }
            else if (radius <= 60)
            {
                angleMove--;
            }
            if (delay < 0.3)
            {
                angleMove++;
            }

            if (UnitTracker.GetLastNewPathTime(target) < 0.1d)
            {
                tempHitchance = HitChance.High;
                pathMinLen    = 700f + moveArea;
                angleMove    += 1.5;
                fixRange      = moveArea * 0.3f;
            }

            if (type == SkillShotType.Circular)
            {
                fixRange -= radius / 2;
            }

            // FIX RANGE ///////////////////////////////////////////////////////////////////////////////////
            if (distanceFromToWaypoint <= distanceFromToUnit)
            {
                if (distanceFromToUnit > range - fixRange)
                {
                    tempHitchance = HitChance.Medium;
                    // return tempHitchance;
                }
            }
            else if (distanceUnitToWaypoint > 350)
            {
                angleMove += 1.5;
            }

            // SPAM CLICK ///////////////////////////////////////////////////////////////////////////////////

            if (UnitTracker.PathCalc(target))
            {
                //OktwCommon.debug("PRED: SPAM CLICK");
                if (distanceFromToUnit < range - fixRange)
                {
                    tempHitchance = HitChance.High;
                }
                else
                {
                    tempHitchance = HitChance.Medium;
                }
                // return tempHitchance;
            }

            // SPAM POSITION ///////////////////////////////////////////////////////////////////////////////////

            if (UnitTracker.SpamSamePlace(target))
            {
                //OktwCommon.debug("PRED: SPAM POSITION");
                return(HitChance.High);
            }



            // SPECIAL CASES ///////////////////////////////////////////////////////////////////////////////////

            if (distanceFromToUnit < 250)
            {
                //OktwCommon.debug("PRED: SPECIAL CASES NEAR");
                return(HitChance.High);
            }
            else if (target.MoveSpeed < 250)
            {
                //OktwCommon.debug("PRED: SPECIAL CASES SLOW");
                return(HitChance.High);
            }
            else if (distanceFromToWaypoint < 250)
            {
                //OktwCommon.debug("PRED: SPECIAL CASES ON WAY");
                return(HitChance.High);
            }

            // LONG CLICK DETECTION ///////////////////////////////////////////////////////////////////////////////////

            if (distanceUnitToWaypoint > pathMinLen)
            {
                //OktwCommon.debug("PRED: LONG CLICK DETECTION");
                return(HitChance.High);
            }

            // RUN IN LANE DETECTION ///////////////////////////////////////////////////////////////////////////////////

            if (getAngle < angleMove && distanceUnitToWaypoint > 260)
            {
                //OktwCommon.debug(GetAngle(input.From, target) + " PRED: ANGLE " + angleMove + " DIS " + distanceUnitToWaypoint);
                return(HitChance.High);
            }

            // CIRCLE NEW PATH ///////////////////////////////////////////////////////////////////////////////////

            if (type == SkillShotType.Circular)
            {
                if (UnitTracker.GetLastNewPathTime(target) < 0.1d && distanceUnitToWaypoint > fixRange)
                {
                    //OktwCommon.debug("PRED: CIRCLE NEW PATH");
                    return(HitChance.High);
                }
            }

            // LOW HP DETECTION ///////////////////////////////////////////////////////////////////////////////////

            if (target.HealthPercent < 20 || ObjectManager.Player.HealthPercent < 20)
            {
                tempHitchance = HitChance.Medium;
                // return HitChance.Medium;
            }

            // STOP LOGIC ///////////////////////////////////////////////////////////////////////////////////

            if (target.RealPath().LastOrDefault() != target.ServerPosition)
            {
                if ((UnitTracker.GetLastAutoAttackTime(target) < 0.1 || UnitTracker.GetLastStopMoveTime(target) < 0.1) && totalDelay < 0.6)
                {
                    //OktwCommon.debug("PRED: STOP LOGIC WINDING");
                    tempHitchance = HitChance.Medium;
                }
                else if (UnitTracker.GetLastStopMoveTime(target) < 0.5)
                {
                    tempHitchance = HitChance.Medium;
                }
                else
                {
                    //OktwCommon.debug("PRED: STOP LOGIC");
                    tempHitchance = HitChance.Medium;
                }
                return(tempHitchance);
            }
            //Program.debug("PRED: NO DETECTION");
            return(tempHitchance);
        }
Пример #17
0
        public static HitChance GetHitChance(SpellSlot spellslot, float range, SkillShotType type, float delay, float speed, float radius,Vector3 fromPoint, Obj_AI_Base target)
        {
            // CAN'T MOVE SPELLS ///////////////////////////////////////////////////////////////////////////////////

            if (UnitTracker.GetSpecialSpellEndTime(target) > 0 || target.HasBuff("recall") || (UnitTracker.GetLastStopMoveTime(target) < 0.1d && target.IsRooted))
            {
            return HitChance.High;
            }

            // PREPARE MATH ///////////////////////////////////////////////////////////////////////////////////

            var tempHitchance = HitChance.Low;

            var lastWaypiont = target.RealPath().Last();
            var distanceUnitToWaypoint = lastWaypiont.Distance(target.ServerPosition);
            var distanceFromToUnit = fromPoint.Distance(target.ServerPosition);
            var distanceFromToWaypoint = lastWaypiont.Distance(fromPoint);
            var getAngle = GetAngle(fromPoint, target);
            float speedDelay = distanceFromToUnit / speed;

            if (Math.Abs(speed - float.MaxValue) < float.Epsilon)
            speedDelay = 0;

            float totalDelay = speedDelay + delay;
            float moveArea = target.MoveSpeed * totalDelay;
            float fixRange = moveArea * 0.4f;
            float pathMinLen = 900 + + moveArea;
            double angleMove = 31;

            if (radius > 70)
            angleMove ++;
            else if (radius <= 60)
            angleMove--;
            if (delay < 0.3)
            angleMove++;

            if (UnitTracker.GetLastNewPathTime(target) < 0.1d)
            {
            tempHitchance = HitChance.High;
            pathMinLen = 700f + moveArea;
            angleMove += 1.5;
            fixRange = moveArea * 0.3f;
            }

            if (type == SkillShotType.Circular)
            {
            fixRange -= radius / 2;
            }

            // FIX RANGE ///////////////////////////////////////////////////////////////////////////////////
            if (distanceFromToWaypoint <= distanceFromToUnit)
            {
            if (distanceFromToUnit > range - fixRange)
            {
                tempHitchance = HitChance.Medium;
                // return tempHitchance;
            }
            }
            else if (distanceUnitToWaypoint > 350)
            {
            angleMove += 1.5;
            }

            // SPAM CLICK ///////////////////////////////////////////////////////////////////////////////////

            if (UnitTracker.PathCalc(target))
            {
            //OktwCommon.debug("PRED: SPAM CLICK");
            if(distanceFromToUnit < range - fixRange)
                tempHitchance = HitChance.High;
            else
                tempHitchance = HitChance.Medium;
            // return tempHitchance;
            }

            // SPAM POSITION ///////////////////////////////////////////////////////////////////////////////////

            if (UnitTracker.SpamSamePlace(target))
            {
            //OktwCommon.debug("PRED: SPAM POSITION");
            return HitChance.High;
            }

            // SPECIAL CASES ///////////////////////////////////////////////////////////////////////////////////

            if (distanceFromToUnit < 250)
            {
            //OktwCommon.debug("PRED: SPECIAL CASES NEAR");
            return HitChance.High;
            }
            else if( target.MoveSpeed < 250)
            {
            //OktwCommon.debug("PRED: SPECIAL CASES SLOW");
            return HitChance.High;
            }
            else if(distanceFromToWaypoint < 250)
            {
            //OktwCommon.debug("PRED: SPECIAL CASES ON WAY");
            return HitChance.High;
            }

            // LONG CLICK DETECTION ///////////////////////////////////////////////////////////////////////////////////

            if (distanceUnitToWaypoint > pathMinLen)
            {
            //OktwCommon.debug("PRED: LONG CLICK DETECTION");
            return HitChance.High;
            }

            // RUN IN LANE DETECTION ///////////////////////////////////////////////////////////////////////////////////

            if (getAngle < angleMove && distanceUnitToWaypoint > 260)
            {
            //OktwCommon.debug(GetAngle(input.From, target) + " PRED: ANGLE " + angleMove + " DIS " + distanceUnitToWaypoint);
            return HitChance.High;
            }

            // CIRCLE NEW PATH ///////////////////////////////////////////////////////////////////////////////////

            if (type == SkillShotType.Circular)
            {
            if (UnitTracker.GetLastNewPathTime(target) < 0.1d && distanceUnitToWaypoint > fixRange)
            {
                //OktwCommon.debug("PRED: CIRCLE NEW PATH");
                return HitChance.High;
            }
            }

            // LOW HP DETECTION ///////////////////////////////////////////////////////////////////////////////////

            if (target.HealthPercent < 20 || ObjectManager.Player.HealthPercent < 20)
            {
            tempHitchance = HitChance.Medium;
            // return HitChance.Medium;
            }

            // STOP LOGIC ///////////////////////////////////////////////////////////////////////////////////

            if (target.RealPath().LastOrDefault() != target.ServerPosition)
            {
                if ((UnitTracker.GetLastAutoAttackTime(target) < 0.1 || UnitTracker.GetLastStopMoveTime(target) < 0.1) && totalDelay < 0.6)
                {
                    //OktwCommon.debug("PRED: STOP LOGIC WINDING");
                    tempHitchance = HitChance.Medium;
                }
            else if (UnitTracker.GetLastStopMoveTime(target) < 0.5)
            {
                tempHitchance = HitChance.Medium;
            }
            else
            {
                //OktwCommon.debug("PRED: STOP LOGIC");
                tempHitchance = HitChance.Medium;
            }
            return tempHitchance;
            }
            //Program.debug("PRED: NO DETECTION");
            return tempHitchance;
        }
Пример #18
0
        public static void CastPredictedSpell(SpellSlot spellslot, float range, SkillShotType type, float delay, float speed, float width, Obj_AI_Base target, bool minioncollision, bool championcollision)
        {
            if (speed > 1f)
            {
            float ax = ObjectManager.Player.ServerPosition.X;
            float ay = ObjectManager.Player.ServerPosition.Y;

            float bx = target.ServerPosition.X;
            float by = target.ServerPosition.Y;

            float cx = target.RealPath().LastOrDefault().X;
            float cy = target.RealPath().LastOrDefault().Y;

            float bc = (float)(Math.Sqrt((bx-cx)*(bx-cx)+(by-cy)*(by-cy)));
            float vx = ( cx - bx ) / bc;
            float vy = ( cy - by ) / bc;

            float bv = target.MoveSpeed;
            float ab = (float)(Math.Sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by)));

            float hx = bx + ( vx * bv * ( delay + ab / speed ) );
            float hy = by + ( vy * bv * ( delay + ab / speed ) );
            float ah = (float)(Math.Sqrt((hx-ax)*(hx-ax)+(hy-ay)*(hy-ay)));

            float ix = bx + ( vx * bv * ( delay + ah / speed ) );
            float iy = by + ( vy * bv * ( delay + ah / speed ) );
            float ai = (float)(Math.Sqrt((ix-ax)*(ix-ax)+(iy-ay)*(iy-ay)));

            float jx = bx + ( vx * bv * ( delay + ai / speed ) );
            float jy = by + ( vy * bv * ( delay + ai / speed ) );

            float aj = (float)(Math.Sqrt((ax-jx)*(ax-jx)+(ay-jy)*(ay-jy)));
            float bj = (float)(Math.Sqrt((bx-jx)*(bx-jx)+(by-jy)*(by-jy)));

            float at = delay + aj / speed;
            float bt = bj / bv;
            if (at - bt > -0.05f && at - bt < 0.05f)
            {
                float x = jx - ( vx * ( width / 2f - Game.Ping / 2.15f ) );
                float y = jy - ( vy * ( width / 2f - Game.Ping / 2.15f ) );
                float bp = (float)(Math.Sqrt((bx-x)*(bx-x)+(by-y)*(by-y)));
                if (bp > bc)
                {
                    x = cx;
                    y = cy;
                }
                float ap = (float)(Math.Sqrt((ax-x)*(ax-x)+(ay-y)*(ay-y)));
                if (ap < range + ObjectManager.Player.BoundingRadius)
                {
                    Vector3 pos = new Vector3 {X = x, Y = y};
                    float pl = (float)(Math.Sqrt((target.RealPath().LastOrDefault().X-cx)*(target.RealPath().LastOrDefault().X-cx)+(target.RealPath().LastOrDefault().Y-cy)*(target.RealPath().LastOrDefault().Y-cy)));
                    if (pl < 50f)
                    {
                        if (minioncollision || championcollision)
                        {
                            var MinionCollision = EntityManager.MinionsAndMonsters.EnemyMinions.Any(minion=>minion.IsValidTarget(ap+200f) && CollisionDetection(minion, ObjectManager.Player, pos, ap, delay, speed, width));
                            var HeroesCollision = EntityManager.Heroes.Enemies.Any(hero=>hero != target && hero.IsValidTarget(ap+200f) && CollisionDetection(hero, ObjectManager.Player, pos, ap, delay, speed, width));
                            if ((!minioncollision || !MinionCollision) && (!championcollision || !HeroesCollision))
                            {
                                Player.CastSpell(spellslot, pos);
                            }
                        }
                        else
                        {
                            Player.CastSpell(spellslot, pos);
                        }
                    }
                }
            }
              	}
            else
            {
            float ax = ObjectManager.Player.ServerPosition.X;
            float ay = ObjectManager.Player.ServerPosition.Y;

            float bx = target.ServerPosition.X;
            float by = target.ServerPosition.Y;

            float cx = target.RealPath().LastOrDefault().X;
            float cy = target.RealPath().LastOrDefault().Y;

            float bc = (float)(Math.Sqrt((bx-cx)*(bx-cx)+(by-cy)*(by-cy)));
            float vx = ( cx - bx ) / bc;
            float vy = ( cy - by ) / bc;

            float x = bx + ( vx * target.MoveSpeed * delay );
            float y = by + ( vy * target.MoveSpeed * delay );

            float xx = x - vx * ( width / 2f - Game.Ping / 2.15f );
            float yy = y - vy * ( width / 2f - Game.Ping / 2.15f );

            float bp = (float)(Math.Sqrt((bx-xx)*(bx-xx)+(by-yy)*(by-yy)));
            if (bp > bc)
            {
                xx = cx;
                yy = cy;
            }
            float ap = (float)(Math.Sqrt((ax-xx)*(ax-xx)+(ay-yy)*(ay-yy)));
            if (ap < range + ObjectManager.Player.BoundingRadius)
            {
                Vector3 pos = new Vector3 {X = xx, Y = yy};
                float pl = (float)(Math.Sqrt((target.RealPath().LastOrDefault().X-cx)*(target.RealPath().LastOrDefault().X-cx)+(target.RealPath().LastOrDefault().Y-cy)*(target.RealPath().LastOrDefault().Y-cy)));
                if (pl < 50f)
                {
                    Player.CastSpell(spellslot, pos);
                }
            }
            }
        }
Пример #19
0
 public static Spell.Skillshot GetSkillShotData(this SpellSlot slot, SkillShotType skillType)
 {
     var spellData = SpellDatabase.GetSpellInfoList(Player.Instance).FirstOrDefault(s => s.Slot == slot);
     if (spellData != null)
     {
         return new Spell.Skillshot(slot, (uint)spellData.Range, skillType, (int)(1000 * spellData.Delay), (int)spellData.MissileSpeed, (int)spellData.Radius)
         {
             AllowedCollisionCount = slot.GetCollisionCount()
         };
     }
     return null;
 }