Beispiel #1
0
 public static void Cast(SpellSlot slot)
 {
     var first = _spells.FirstOrDefault(spell => spell.Slot == slot && (string.IsNullOrEmpty(spell.SpellName) || string.Equals(Player.Spellbook.GetSpell(slot).Name, spell.SpellName, StringComparison.CurrentCultureIgnoreCase)));
     if (first != null)
     {
         var allowedCollisionCount = int.MaxValue;
         if (first.Collisions.Contains(CollisionType.AiHeroClient))
         {
             allowedCollisionCount = 0;
         }
         else if (first.Collisions.Contains(CollisionType.ObjAiMinion))
         {
             allowedCollisionCount = -1;
         }
         var collidesWithWall = first.Collisions.Contains(CollisionType.YasuoWall);
         SpellBase spell = null;
         switch (first.Type)
         {
             case EloBuddy.SDK.Spells.SpellType.Self:
                 spell = new SpellBase(slot, SpellType.Self, first.Range) { Delay = first.Delay + first.MissileFixedTravelTime, Speed = first.MissileSpeed, AllowedCollisionCount = allowedCollisionCount, CollidesWithYasuoWall = collidesWithWall };
                 break;
             case EloBuddy.SDK.Spells.SpellType.Circle:
                 spell = new SpellBase(slot, SpellType.Circular, first.Range) { Delay = first.Delay + first.MissileFixedTravelTime, Speed = first.MissileSpeed, AllowedCollisionCount = allowedCollisionCount, CollidesWithYasuoWall = collidesWithWall, Width = first.Radius };
                 break;
             case EloBuddy.SDK.Spells.SpellType.Line:
                 spell = new SpellBase(slot, SpellType.Linear, first.Range) { Delay = first.Delay + first.MissileFixedTravelTime, Speed = first.MissileSpeed, AllowedCollisionCount = allowedCollisionCount, CollidesWithYasuoWall = collidesWithWall, Width = first.Radius };
                 break;
             case EloBuddy.SDK.Spells.SpellType.Cone:
                 spell = new SpellBase(slot, SpellType.Cone, first.Range) { Delay = first.Delay + first.MissileFixedTravelTime, Speed = first.MissileSpeed, AllowedCollisionCount = allowedCollisionCount, CollidesWithYasuoWall = collidesWithWall, Width = first.Radius };
                 break;
             case EloBuddy.SDK.Spells.SpellType.Ring:
                 break;
             case EloBuddy.SDK.Spells.SpellType.MissileLine:
                 spell = new SpellBase(slot, SpellType.Linear, first.Range) { Delay = first.Delay + first.MissileFixedTravelTime, Speed = first.MissileSpeed, AllowedCollisionCount = allowedCollisionCount, CollidesWithYasuoWall = collidesWithWall, Width = first.Radius };
                 break;
             case EloBuddy.SDK.Spells.SpellType.MissileAoe:
                 spell = new SpellBase(slot, SpellType.Circular, first.Range) { Delay = first.Delay + first.MissileFixedTravelTime, Speed = first.MissileSpeed, AllowedCollisionCount = allowedCollisionCount, CollidesWithYasuoWall = collidesWithWall, Width = first.Radius };
                 break;
         }
         if (spell != null)
         {
             if (first.Chargeable)
             {
                 if (IsCharging)
                 {
                     var percentageGrowth = Math.Min(1 / 1000f * (Core.GameTickCount - _lastChargeTime - first.CastRangeGrowthStartTime) / first.CastRangeGrowthDuration, 1);
                     spell.Range = (first.CastRangeGrowthMax - first.CastRangeGrowthMin) * percentageGrowth + first.CastRangeGrowthMin;
                     spell.ReleaseCast();
                 }
                 else
                 {
                     spell.StartCast();
                 }
             }
             else if (!IsCharging)
             {
                 spell.Cast();
             }
         }
     }
 }
Beispiel #2
0
        public static void Cast(SpellSlot slot)
        {
            var first = _spells.FirstOrDefault(spell => spell.Slot == slot && (string.IsNullOrEmpty(spell.SpellName) || string.Equals(Player.Spellbook.GetSpell(slot).Name, spell.SpellName, StringComparison.CurrentCultureIgnoreCase)));

            if (first != null)
            {
                var allowedCollisionCount = int.MaxValue;
                if (first.Collisions.Contains(CollisionType.AiHeroClient))
                {
                    allowedCollisionCount = 0;
                }
                else if (first.Collisions.Contains(CollisionType.ObjAiMinion))
                {
                    allowedCollisionCount = -1;
                }
                var       collidesWithWall = first.Collisions.Contains(CollisionType.YasuoWall);
                SpellBase spell            = null;
                switch (first.Type)
                {
                case EloBuddy.SDK.Spells.SpellType.Self:
                    spell = new SpellBase(slot, SpellType.Self, first.Range)
                    {
                        Delay = first.Delay + first.MissileFixedTravelTime, Speed = first.MissileSpeed, AllowedCollisionCount = allowedCollisionCount, CollidesWithYasuoWall = collidesWithWall
                    };
                    break;

                case EloBuddy.SDK.Spells.SpellType.Circle:
                    spell = new SpellBase(slot, SpellType.Circular, first.Range)
                    {
                        Delay = first.Delay + first.MissileFixedTravelTime, Speed = first.MissileSpeed, AllowedCollisionCount = allowedCollisionCount, CollidesWithYasuoWall = collidesWithWall, Width = first.Radius
                    };
                    break;

                case EloBuddy.SDK.Spells.SpellType.Line:
                    spell = new SpellBase(slot, SpellType.Linear, first.Range)
                    {
                        Delay = first.Delay + first.MissileFixedTravelTime, Speed = first.MissileSpeed, AllowedCollisionCount = allowedCollisionCount, CollidesWithYasuoWall = collidesWithWall, Width = first.Radius
                    };
                    break;

                case EloBuddy.SDK.Spells.SpellType.Cone:
                    spell = new SpellBase(slot, SpellType.Cone, first.Range)
                    {
                        Delay = first.Delay + first.MissileFixedTravelTime, Speed = first.MissileSpeed, AllowedCollisionCount = allowedCollisionCount, CollidesWithYasuoWall = collidesWithWall, Width = first.Radius
                    };
                    break;

                case EloBuddy.SDK.Spells.SpellType.Ring:
                    break;

                case EloBuddy.SDK.Spells.SpellType.MissileLine:
                    spell = new SpellBase(slot, SpellType.Linear, first.Range)
                    {
                        Delay = first.Delay + first.MissileFixedTravelTime, Speed = first.MissileSpeed, AllowedCollisionCount = allowedCollisionCount, CollidesWithYasuoWall = collidesWithWall, Width = first.Radius
                    };
                    break;

                case EloBuddy.SDK.Spells.SpellType.MissileAoe:
                    spell = new SpellBase(slot, SpellType.Circular, first.Range)
                    {
                        Delay = first.Delay + first.MissileFixedTravelTime, Speed = first.MissileSpeed, AllowedCollisionCount = allowedCollisionCount, CollidesWithYasuoWall = collidesWithWall, Width = first.Radius
                    };
                    break;
                }
                if (spell != null)
                {
                    if (first.Chargeable)
                    {
                        if (IsCharging)
                        {
                            var percentageGrowth = Math.Min(1 / 1000f * (Core.GameTickCount - _lastChargeTime - first.CastRangeGrowthStartTime) / first.CastRangeGrowthDuration, 1);
                            spell.Range = (first.CastRangeGrowthMax - first.CastRangeGrowthMin) * percentageGrowth + first.CastRangeGrowthMin;
                            spell.ReleaseCast();
                        }
                        else
                        {
                            spell.StartCast();
                        }
                    }
                    else if (!IsCharging)
                    {
                        spell.Cast();
                    }
                }
            }
        }