public static PositionInfo CanHeroWalkToPos(Vector2 pos, float speed, float delay, float extraDist, bool useServerPosition = true) { int posDangerLevel = 0; int posDangerCount = 0; float closestDistance = float.MaxValue; List<int> dodgeableSpells = new List<int>(); List<int> undodgeableSpells = new List<int>(); Vector2 heroPos = ObjectCache.myHeroCache.serverPos2D; var minComfortDistance = ObjectCache.menuCache.cache["MinComfortZone"].Cast<Slider>().CurrentValue; if (useServerPosition == false) { heroPos = myHero.Position.LSTo2D(); } foreach (KeyValuePair<int, Spell> entry in SpellDetector.spells) { Spell spell = entry.Value; var moveBuff = EvadeSpell.evadeSpells.OrderBy(s => s.dangerlevel).FirstOrDefault(s => s.evadeType == EvadeType.MovementSpeedBuff); if (moveBuff != null && EvadeSpell.ShouldUseMovementBuff(spell)) { speed += speed * moveBuff.speedArray[myHero.GetSpell(moveBuff.spellKey).Level - 1] / 100; } closestDistance = Math.Min(closestDistance, GetClosestDistanceApproach(spell, pos, speed, delay, heroPos, extraDist)); if (pos.InSkillShot(spell, ObjectCache.myHeroCache.boundingRadius - 6) || PredictSpellCollision(spell, pos, speed, delay, heroPos, extraDist, useServerPosition) || (spell.info.spellType != SpellType.Line && pos.isNearEnemy(minComfortDistance))) { posDangerLevel = Math.Max(posDangerLevel, spell.dangerlevel); posDangerCount += spell.dangerlevel; undodgeableSpells.Add(spell.spellID); } else { dodgeableSpells.Add(spell.spellID); } } return new PositionInfo( pos, posDangerLevel, posDangerCount, posDangerCount > 0, closestDistance, dodgeableSpells, undodgeableSpells); }
public static PositionInfo CanHeroWalkToPos(Vector2 pos, float speed, float delay, float extraDist, bool useServerPosition = true) { int posDangerLevel = 0; int posDangerCount = 0; float closestDistance = float.MaxValue; List<int> dodgeableSpells = new List<int>(); List<int> undodgeableSpells = new List<int>(); Vector2 heroPos = ObjectCache.myHeroCache.serverPos2D; var minComfortDistance = ObjectCache.menuCache.cache["MinComfortZone"].GetValue<Slider>().Value; if (useServerPosition == false) { heroPos = myHero.Position.To2D(); } foreach (KeyValuePair<int, Spell> entry in SpellDetector.spells) { Spell spell = entry.Value; closestDistance = Math.Min(closestDistance, GetClosestDistanceApproach(spell, pos, speed, delay, heroPos, extraDist)); //GetIntersectTime(spell, ObjectCache.myHeroCache.serverPos2D, pos); //Math.Min(closestDistance, GetClosestDistanceApproach(spell, pos, ObjectCache.myHeroCache.moveSpeed, delay, ObjectCache.myHeroCache.serverPos2D)); if (pos.InSkillShot(spell, ObjectCache.myHeroCache.boundingRadius + 6) || PredictSpellCollision(spell, pos, speed, delay, heroPos, extraDist) || pos.IsUnderTurret() || (spell.info.spellType != SpellType.Line && pos.isNearEnemy(minComfortDistance))) { posDangerLevel = Math.Max(posDangerLevel, spell.dangerlevel); posDangerCount += spell.dangerlevel; undodgeableSpells.Add(spell.spellID); } else { dodgeableSpells.Add(spell.spellID); } } return new PositionInfo( pos, posDangerLevel, posDangerCount, posDangerCount > 0, closestDistance, dodgeableSpells, undodgeableSpells); }