private static void CollateralDamageKs() { foreach (Obj_AI_Hero target in _player.Position.GetEnemiesInRange(1900).Where(e => e.IsValidTarget())) { if (R2Damage(target) < target.Health) { return; } var pred = _r2.GetPrediction(target); if ( pred.CollisionObjects.Count( a => a.IsEnemy && a.IsValid <Obj_AI_Hero>() && _player.Distance(a) < 1100) > 0) { _r2.Cast(pred.CastPosition); } else { foreach (var target2 in _player.Position.GetEnemiesInRange(1100).Where(e => e.IsValidTarget())) { var sector = new Geometry.Sector( _spells[SpellSlot.R].GetPrediction(target2).UnitPosition.To2D(), _player.Position.To2D() .Extend( _spells[SpellSlot.R].GetPrediction(target2).UnitPosition.To2D(), _player.Distance(_spells[SpellSlot.R].GetPrediction(target2).UnitPosition) + 100), 60 * (float)Math.PI / 180, 800).ToPolygon(); if (!sector.IsOutside(target2.Position.To2D())) { _r2.Cast(_r2.GetPrediction(target2).CastPosition); } } } } }
private static void CollateralDamageKs() { foreach (Obj_AI_Hero target in _player.Position.GetEnemiesInRange(1900).Where(e => e.IsValidTarget())) { if (R2Damage(target) < target.Health) { return; } var pred = _r2.GetPrediction(target); if ( pred.CollisionObjects.Count( a => a.IsEnemy && a.IsValid<Obj_AI_Hero>() && _player.Distance(a) < 1100) > 0) { _r2.Cast(pred.CastPosition); } else { foreach (var target2 in _player.Position.GetEnemiesInRange(1100).Where(e => e.IsValidTarget())) { var sector = new Geometry.Sector( _spells[SpellSlot.R].GetPrediction(target2).UnitPosition.To2D(), _player.Position.To2D() .Extend( _spells[SpellSlot.R].GetPrediction(target2).UnitPosition.To2D(), _player.Distance(_spells[SpellSlot.R].GetPrediction(target2).UnitPosition) + 100), 60 * (float) Math.PI / 180, 800).ToPolygon(); if (!sector.IsOutside(target2.Position.To2D())) { _r2.Cast(_r2.GetPrediction(target2).CastPosition); } } } } }