public static bool CheckMoveToDirection(Vector2 from, Vector2 movePos, float extraDelay = 0) { var dir = (movePos - from).Normalized(); foreach (KeyValuePair <int, Spell> entry in SpellDetector.spells) { Spell spell = entry.Value; if (!from.InSkillShot(spell, ObjectCache.myHeroCache.boundingRadius)) { Vector2 spellPos = spell.currentSpellPosition; /*if (ObjectCache.menuCache.cache["AllowCrossing"].GetValue<bool>()) * { * var extraDelayBuffer = Evade.menu.Item("ExtraPingBuffer").GetValue<Slider>().Value; * var extraDist = ObjectCache.menuCache.cache["ExtraCPADistance"].GetValue<Slider>().Value; * * if (PredictSpellCollision(spell, movePos, ObjectCache.myHeroCache.moveSpeed, extraDelayBuffer, from, extraDist)) * { * return true; * } * Console.WriteLine("cross"); * continue; * }*/ if (spell.info.spellType == SpellType.Line) { if (spell.LineIntersectLinearSpell(from, movePos)) { return(true); } } else if (spell.info.spellType == SpellType.Circular) { var cpa = MathUtilsCPA.CPAPointsEx(from, dir * ObjectCache.myHeroCache.moveSpeed, spell.endPos, new Vector2(0, 0), movePos, spell.endPos); if (cpa < spell.radius + 10) { return(true); } } else if (spell.info.spellType == SpellType.Cone) { } } } return(false); }
public static bool CheckMoveToDirection(Vector2 from, Vector2 movePos, float extraDelay = 0) { var dir = (movePos - from).LSNormalized(); //movePos = movePos.ExtendDir(dir, ObjectCache.myHeroCache.boundingRadius); foreach (KeyValuePair <int, Spell> entry in SpellDetector.spells) { Spell spell = entry.Value; if (!from.InSkillShot(spell, ObjectCache.myHeroCache.boundingRadius)) { Vector2 spellPos = spell.currentSpellPosition; if (spell.spellType == SpellType.Line) { if (spell.LineIntersectLinearSpell(from, movePos)) { return(true); } } else if (spell.spellType == SpellType.Circular) { if (spell.info.spellName == "VeigarEventHorizon") { var cpa2 = MathUtilsCPA.CPAPointsEx(from, dir * ObjectCache.myHeroCache.moveSpeed, spell.endPos, new Vector2(0, 0), movePos, spell.endPos); if (from.LSDistance(spell.endPos) < spell.radius && !(from.LSDistance(spell.endPos) < spell.radius - 135 && movePos.LSDistance(spell.endPos) < spell.radius - 135)) { return(true); } else if (from.LSDistance(spell.endPos) > spell.radius && cpa2 < spell.radius + 10) { return(true); } } else { Vector2 cHeroPos; Vector2 cSpellPos; var cpa2 = MathUtils.GetCollisionDistanceEx( from, dir * ObjectCache.myHeroCache.moveSpeed, 1, spell.endPos, new Vector2(0, 0), spell.radius, out cHeroPos, out cSpellPos); var cHeroPosProjection = cHeroPos.LSProjectOn(from, movePos); if (cHeroPosProjection.IsOnSegment && cpa2 != float.MaxValue) { return(true); } /*var cpa = MathUtilsCPA.CPAPointsEx(from, dir * ObjectCache.myHeroCache.moveSpeed, spell.endPos, new Vector2(0, 0), movePos, spell.endPos); * * if (cpa < spell.radius + 10) * { * return true; * }*/ } } else if (spell.spellType == SpellType.Arc) { if (from.isLeftOfLineSegment(spell.startPos, spell.endPos)) { return(MathUtils.CheckLineIntersection(from, movePos, spell.startPos, spell.endPos)); } var spellRange = spell.startPos.LSDistance(spell.endPos); var midPoint = spell.startPos + spell.direction * (spellRange / 2); var cpa = MathUtilsCPA.CPAPointsEx(from, dir * ObjectCache.myHeroCache.moveSpeed, midPoint, new Vector2(0, 0), movePos, midPoint); if (cpa < spell.radius + 10) { return(true); } } else if (spell.spellType == SpellType.Cone) { } } } return(false); }