public static bool CanHeroWalkIntoSpell(Spell spell)
{
if (ConfigValue.AdvancedSpellDetection.GetBool())
{
Vector2 heroPos = MyHero.Position.To2D();
var extraDist = MyHero.Distance(GameData.HeroInfo.ServerPos2D);
if (spell.SpellType == SpellType.Line)
{
var walkRadius = GameData.HeroInfo.MoveSpeed * (spell.EndTime - EvadeUtils.TickCount) / 1000 +
GameData.HeroInfo.BoundingRadius + spell.Info.Radius + extraDist + 10;
var spellPos = spell.CurrentSpellPosition;
var spellEndPos = spell.GetSpellEndPosition();
var projection = heroPos.ProjectOn(spellPos, spellEndPos);
return projection.SegmentPoint.Distance(heroPos) <= walkRadius;
}
else if (spell.SpellType == SpellType.Circular)
{
var walkRadius = GameData.HeroInfo.MoveSpeed * (spell.EndTime - EvadeUtils.TickCount) / 1000 +
GameData.HeroInfo.BoundingRadius + spell.Info.Radius + extraDist + 10;
if (heroPos.Distance(spell.EndPos) < walkRadius)
{
return true;
}
}
else if (spell.SpellType == SpellType.Arc)
{
var spellRange = spell.StartPos.Distance(spell.EndPos);
var midPoint = spell.StartPos + spell.Direction * (spellRange / 2);
var arcRadius = spell.Info.Radius * (1 + spellRange / 100);
var walkRadius = GameData.HeroInfo.MoveSpeed * (spell.EndTime - EvadeUtils.TickCount) / 1000 +
GameData.HeroInfo.BoundingRadius + arcRadius + extraDist + 10;
if (heroPos.Distance(midPoint) < walkRadius)
{
return true;
}
}
return false;
}
return true;
}