Lissandra_the_Ice_Goddess.Evade.Skillshot.IsDanger C# (CSharp) Метод

IsDanger() публичный Метод

public IsDanger ( System.Vector2 point ) : bool
point System.Vector2
Результат bool
        public bool IsDanger(Vector2 point)
        {
            return !IsSafe(point);
        }

Usage Example

Пример #1
0
 private static void OnDetectSkillshot(Skillshot skillshot)
 {
     var alreadyAdded = false;
     foreach (Skillshot item in EvadeDetectedSkillshots)
     {
         if (item.SpellData.SpellName == skillshot.SpellData.SpellName &&
             (item.Caster.NetworkId == skillshot.Caster.NetworkId &&
              (skillshot.Direction).AngleBetween(item.Direction) < 5 &&
              (skillshot.Start.Distance(item.Start) < 100 || skillshot.SpellData.FromObjects.Length == 0)))
         {
             alreadyAdded = true;
         }
     }
     //Check if the skillshot is from an ally.
     if (skillshot.Caster.Team == ObjectManager.Player.Team)
     {
         return;
     }
     //Check if the skillshot is too far away.
     if (skillshot.Start.Distance(ObjectManager.Player.ServerPosition.To2D()) >
         (skillshot.SpellData.Range + skillshot.SpellData.Radius + 1000) * 1.5)
     {
         return;
     }
     //Add the skillshot to the detected skillshot list.
     if (!alreadyAdded)
     {
         //Multiple skillshots like twisted fate _spells[Spells.Q].
         if (skillshot.DetectionType == DetectionType.ProcessSpell)
         {
             if (skillshot.SpellData.MultipleNumber != -1)
             {
                 var originalDirection = skillshot.Direction;
                 for (var i = -(skillshot.SpellData.MultipleNumber - 1) / 2;
                     i <= (skillshot.SpellData.MultipleNumber - 1) / 2;
                     i++)
                 {
                     var end = skillshot.Start +
                               skillshot.SpellData.Range *
                               originalDirection.Rotated(skillshot.SpellData.MultipleAngle * i);
                     var skillshotToAdd = new Skillshot(
                         skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, end,
                         skillshot.Caster);
                     EvadeDetectedSkillshots.Add(skillshotToAdd);
                 }
                 return;
             }
             if (skillshot.SpellData.SpellName == "UFSlash")
             {
                 skillshot.SpellData.MissileSpeed = 1600 + (int)skillshot.Caster.MoveSpeed;
             }
             if (skillshot.SpellData.Invert)
             {
                 var newDirection = -(skillshot.End - skillshot.Start).Normalized();
                 var end = skillshot.Start + newDirection * skillshot.Start.Distance(skillshot.End);
                 var skillshotToAdd = new Skillshot(
                     skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, end,
                     skillshot.Caster);
                 EvadeDetectedSkillshots.Add(skillshotToAdd);
                 return;
             }
             if (skillshot.SpellData.Centered)
             {
                 var start = skillshot.Start - skillshot.Direction * skillshot.SpellData.Range;
                 var end = skillshot.Start + skillshot.Direction * skillshot.SpellData.Range;
                 var skillshotToAdd = new Skillshot(
                     skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end,
                     skillshot.Caster);
                 EvadeDetectedSkillshots.Add(skillshotToAdd);
                 return;
             }
             if (skillshot.SpellData.SpellName == "SyndraE" || skillshot.SpellData.SpellName == "syndrae5")
             {
                 const int angle = 60;
                 const int fraction = -angle / 2;
                 var edge1 =
                     (skillshot.End - skillshot.Caster.ServerPosition.To2D()).Rotated(
                         fraction * (float)Math.PI / 180);
                 var edge2 = edge1.Rotated(angle * (float)Math.PI / 180);
                 foreach (var minion in ObjectManager.Get<Obj_AI_Minion>())
                 {
                     var v = minion.ServerPosition.To2D() - skillshot.Caster.ServerPosition.To2D();
                     if (minion.Name == "Seed" && edge1.CrossProduct(v) > 0 && v.CrossProduct(edge2) > 0 &&
                         minion.Distance(skillshot.Caster) < 800 && (minion.Team != ObjectManager.Player.Team))
                     {
                         var start = minion.ServerPosition.To2D();
                         var end = skillshot.Caster.ServerPosition.To2D()
                             .Extend(
                                 minion.ServerPosition.To2D(),
                                 skillshot.Caster.Distance(minion) > 200 ? 1300 : 1000);
                         var skillshotToAdd = new Skillshot(
                             skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end,
                             skillshot.Caster);
                         EvadeDetectedSkillshots.Add(skillshotToAdd);
                     }
                 }
                 return;
             }
             if (skillshot.SpellData.SpellName == "AlZaharCalloftheVoid")
             {
                 var start = skillshot.End - skillshot.Direction.Perpendicular() * 400;
                 var end = skillshot.End + skillshot.Direction.Perpendicular() * 400;
                 var skillshotToAdd = new Skillshot(
                     skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end,
                     skillshot.Caster);
                 EvadeDetectedSkillshots.Add(skillshotToAdd);
                 return;
             }
             if (skillshot.SpellData.SpellName == "ZiggsQ")
             {
                 var d1 = skillshot.Start.Distance(skillshot.End);
                 var d2 = d1 * 0.4f;
                 var d3 = d2 * 0.69f;
                 var bounce1SpellData = SpellDatabase.GetByName("ZiggsQBounce1");
                 var bounce2SpellData = SpellDatabase.GetByName("ZiggsQBounce2");
                 var bounce1Pos = skillshot.End + skillshot.Direction * d2;
                 var bounce2Pos = bounce1Pos + skillshot.Direction * d3;
                 bounce1SpellData.Delay =
                     (int)(skillshot.SpellData.Delay + d1 * 1000f / skillshot.SpellData.MissileSpeed + 500);
                 bounce2SpellData.Delay =
                     (int)(bounce1SpellData.Delay + d2 * 1000f / bounce1SpellData.MissileSpeed + 500);
                 var bounce1 = new Skillshot(
                     skillshot.DetectionType, bounce1SpellData, skillshot.StartTick, skillshot.End, bounce1Pos,
                     skillshot.Caster);
                 var bounce2 = new Skillshot(
                     skillshot.DetectionType, bounce2SpellData, skillshot.StartTick, bounce1Pos, bounce2Pos,
                     skillshot.Caster);
                 EvadeDetectedSkillshots.Add(bounce1);
                 EvadeDetectedSkillshots.Add(bounce2);
             }
             if (skillshot.SpellData.SpellName == "ZiggsR")
             {
                 skillshot.SpellData.Delay =
                     (int)(1500 + 1500 * skillshot.End.Distance(skillshot.Start) / skillshot.SpellData.Range);
             }
             if (skillshot.SpellData.SpellName == "JarvanIVDragonStrike")
             {
                 var endPos = new Vector2();
                 foreach (var s in EvadeDetectedSkillshots)
                 {
                     if (s.Caster.NetworkId == skillshot.Caster.NetworkId && s.SpellData.Slot == SpellSlot.E)
                     {
                         endPos = s.End;
                     }
                 }
                 foreach (var m in ObjectManager.Get<Obj_AI_Minion>())
                 {
                     if (m.BaseSkinName == "jarvanivstandard" && m.Team == skillshot.Caster.Team &&
                         skillshot.IsDanger(m.Position.To2D()))
                     {
                         endPos = m.Position.To2D();
                     }
                 }
                 if (!endPos.IsValid())
                 {
                     return;
                 }
                 skillshot.End = endPos + 200 * (endPos - skillshot.Start).Normalized();
                 skillshot.Direction = (skillshot.End - skillshot.Start).Normalized();
             }
         }
         if (skillshot.SpellData.SpellName == "OriannasQ")
         {
             var endCSpellData = SpellDatabase.GetByName("OriannaQend");
             var skillshotToAdd = new Skillshot(
                 skillshot.DetectionType, endCSpellData, skillshot.StartTick, skillshot.Start, skillshot.End,
                 skillshot.Caster);
             EvadeDetectedSkillshots.Add(skillshotToAdd);
         }
         //Dont allow fow detection.
         if (skillshot.SpellData.DisableFowDetection && skillshot.DetectionType == DetectionType.RecvPacket)
         {
             return;
         }
         EvadeDetectedSkillshots.Add(skillshot);
     }
 }