本文整理汇总了C#中Obj_AI_Hero.GetWaypoints方法的典型用法代码示例。如果您正苦于以下问题:C# Obj_AI_Hero.GetWaypoints方法的具体用法?C# Obj_AI_Hero.GetWaypoints怎么用?C# Obj_AI_Hero.GetWaypoints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Obj_AI_Hero
的用法示例。
在下文中一共展示了Obj_AI_Hero.GetWaypoints方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSPrediction
/// <summary>
/// Gets Prediction result
/// </summary>
/// <param name="target">Target</param>
/// <returns>Prediction result as <see cref="Prediction.Result"/></returns>
public static Prediction.Result GetSPrediction(this Spell s, Obj_AI_Hero target)
{
switch (s.Type)
{
case SkillshotType.SkillshotLine:
return LinePrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), target.LastAngleDiff(), s.From.To2D(), s.RangeCheckFrom.To2D());
case SkillshotType.SkillshotCircle:
return CirclePrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), target.LastAngleDiff(), s.From.To2D(), s.RangeCheckFrom.To2D());
case SkillshotType.SkillshotCone:
return ConePrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), target.LastAngleDiff(), s.From.To2D(), s.RangeCheckFrom.To2D());
}
throw new NotSupportedException("Unknown skill shot type");
}
示例2: Cast
public override void Cast(Obj_AI_Hero target, bool force = false, HitChance minChance = HitChance.Low)
{
if (HasBeenSafeCast() || target == null || target.GetWaypoints().Last().Distance(target) > 50) return;
var prediction = Spell.GetPrediction(target, true);
if (prediction.Hitchance < minChance) return;
SafeCast(() => Spell.Cast(prediction.CastPosition));
}
示例3: IsValidTarget
public static bool IsValidTarget(Obj_AI_Hero target)
{
if (!IsWhitelisted(target))
return false;
var targetPosition = Geometry.PositionAfter(target.GetWaypoints(), 300, (int)target.MoveSpeed);
if (target.Distance(ObjectManager.Player.ServerPosition) < 650f && IsCondemnable(ObjectManager.Player.ServerPosition.To2D(), targetPosition, target.BoundingRadius))
{
if (target.Path.Length == 0)
{
var outRadius = (0.3f * target.MoveSpeed) / (float)Math.Cos(2 * Math.PI / 12);
int count = 0;
for (int i = 1; i <= 12; i++)
{
var angle = i * 2 * Math.PI / 12;
float x = target.Position.X + outRadius * (float)Math.Cos(angle);
float y = target.Position.Y + outRadius * (float)Math.Sin(angle);
if (IsCondemnable(ObjectManager.Player.ServerPosition.To2D(), new Vector2(x, y), target.BoundingRadius))
count++;
}
return count >= 4;
}
else
return true;
}
else
{
if (TumbleCondemn && s_Champion.Spells[Champion.Q].IsReady())
{
var outRadius = 300 / (float)Math.Cos(2 * Math.PI / 12);
for (int i = 1; i <= 12; i++)
{
var angle = i * 2 * Math.PI / 12;
float x = ObjectManager.Player.Position.X + outRadius * (float)Math.Cos(angle);
float y = ObjectManager.Player.Position.Y + outRadius * (float)Math.Sin(angle);
targetPosition = Geometry.PositionAfter(target.GetWaypoints(), 300, (int)target.MoveSpeed);
if (targetPosition.Distance(new Vector2(x, y)) < 550f && IsCondemnable(new Vector2(x, y), targetPosition, target.BoundingRadius, 300f))
{
s_Champion.Spells[Champion.Q].Cast(new Vector2(x, y));
return false;
}
}
return false;
}
}
return false;
}
示例4: GetAngle
private static double GetAngle(this Vector3 from, Obj_AI_Hero target)
{
var c = target.ServerPosition.ToVector2();
var a = target.GetWaypoints().Last();
if (c == a)
{
return 60;
}
var b = from.ToVector2();
var ab = Math.Pow(a.X - b.X, 2) + Math.Pow(a.Y - b.Y, 2);
var bc = Math.Pow(b.X - c.X, 2) + Math.Pow(b.Y - c.Y, 2);
var ac = Math.Pow(a.X - c.X, 2) + Math.Pow(a.Y - c.Y, 2);
return Math.Cos((ab + bc - ac) / (2 * Math.Sqrt(ab) * Math.Sqrt(bc))) * 180 / Math.PI;
}
示例5: SPredictionCastArc
/// <summary>
/// Spell extension for cast arc spell with SPrediction
/// </summary>
/// <param name="s">Spell to cast</param>
/// <param name="t">Target for spell</param>
/// <param name="hc">Minimum HitChance to cast</param>
/// <param name="reactionIgnoreDelay">Delay to ignore target's reaction time</param>
/// <param name="minHit">Minimum Hit Count to cast</param>
/// <param name="rangeCheckFrom">Position where spell will be casted from</param>
/// <param name="filterHPPercent">Minimum HP Percent to cast (for target)</param>
/// <returns>true if spell has casted</returns>
public static bool SPredictionCastArc(this Spell s, Obj_AI_Hero t, HitChance hc, bool arconly = true, int reactionIgnoreDelay = 0, byte minHit = 1, Vector3? rangeCheckFrom = null, float filterHPPercent = 100)
{
if (ConfigMenu.SelectedPrediction.SelectedIndex == 1)
throw new NotSupportedException("Arc Prediction not supported in Common prediction");
if (minHit > 1)
return SPredictionCastAoeArc(s, minHit);
if (t.HealthPercent > filterHPPercent)
return false;
if (rangeCheckFrom == null)
rangeCheckFrom = ObjectManager.Player.ServerPosition;
if (Monitor.TryEnter(PathTracker.EnemyInfo[t.NetworkId].m_lock))
{
try
{
float avgt = t.AvgMovChangeTime() + reactionIgnoreDelay;
float movt = t.LastMovChangeTime();
float avgp = t.AvgPathLenght();
var result = ArcPrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range, s.Collision, t.GetWaypoints(), avgt, movt, avgp, t.LastAngleDiff(), s.From.To2D(), s.RangeCheckFrom.To2D(), arconly);
if (result.HitChance >= hc)
{
s.Cast(result.CastPosition);
return true;
}
Monitor.Pulse(PathTracker.EnemyInfo[t.NetworkId].m_lock);
return false;
}
finally
{
Monitor.Exit(PathTracker.EnemyInfo[t.NetworkId].m_lock);
}
}
return false;
}
示例6: castR
private void castR(Obj_AI_Hero target)
{
if (Config.Item("hitchanceR", true).GetValue<bool>())
{
List<Vector2> waypoints = target.GetWaypoints();
if (target.Path.Count() < 2 && (Player.Distance(waypoints.Last<Vector2>().To3D()) - Player.Distance(target.Position)) > 300)
{
Program.CastSpell(R, target);
}
}
else
Program.CastSpell(R, target);
}
示例7: PreCastPos
private static Vector3 PreCastPos(Obj_AI_Hero Hero ,float Delay)
{
float value = 0f;
if (Hero.IsFacing(Player))
{
value = (10f - Hero.BoundingRadius);
}
else
{
value = -(120f - Hero.BoundingRadius);
}
var distance = Delay * Hero.MoveSpeed + value;
var path = Hero.GetWaypoints();
for (var i = 0; i < path.Count - 1; i++)
{
var a = path[i];
var b = path[i + 1];
var d = a.Distance(b);
if (d < distance)
{
distance -= d;
}
else
{
return (a + distance * (b - a).Normalized()).To3D();
}
}
return (path[path.Count - 1]).To3D();
}
示例8: GetPrediction
/// <summary>
/// Gets Prediction result
/// </summary>
/// <param name="target">Target for spell</param>
/// <param name="width">Spell width</param>
/// <param name="delay">Spell delay</param>
/// <param name="missileSpeed">Spell missile speed</param>
/// <param name="range">Spell range</param>
/// <param name="collisionable">Spell collisionable</param>
/// <param name="type">Spell skillshot type</param>
/// <param name="from">Spell casted position</param>
/// <returns>Prediction result as <see cref="Prediction.Result"/></returns>
public static Prediction.Result GetPrediction(Obj_AI_Hero target, float width, float delay, float missileSpeed, float range, bool collisionable)
{
return GetPrediction(target, width, delay, missileSpeed, range, collisionable, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), ObjectManager.Player.ServerPosition.To2D(), ObjectManager.Player.ServerPosition.To2D());
}
示例9: IsFaced
public static bool IsFaced(Obj_AI_Hero target)
{
Vector2 LastWaypoint = target.GetWaypoints().Last();
if (LastWaypoint.Distance(Player.Position) < target.Distance(Player.Position))
return true;
return false;
}
示例10: SPredictionCastArc
/// <summary>
/// Casts spell
/// </summary>
/// <param name="s">Spell to cast</param>
/// <param name="t">Target for spell</param>
/// <param name="hc">Minimum HitChance to cast</param>
/// <param name="reactionIgnoreDelay">Delay to ignore target's reaction time</param>
/// <param name="minHit">Minimum Hit Count to cast</param>
/// <param name="rangeCheckFrom">Position where spell will be casted from</param>
/// <param name="filterHPPercent">Minimum HP Percent to cast (for target)</param>
/// <returns>true if spell has casted</returns>
public static bool SPredictionCastArc(this Spell s, Obj_AI_Hero t, HitChance hc, int reactionIgnoreDelay = 0, byte minHit = 1, Vector3? rangeCheckFrom = null, float filterHPPercent = 100)
{
if (minHit > 1)
throw new NotSupportedException("Arc aoe prediction has not supported yet");
if (predMenu != null && predMenu.Item("PREDICTONLIST").GetValue<StringList>().SelectedIndex == 1)
throw new NotSupportedException("Arc Prediction not supported in Common prediction");
if (t.HealthPercent > filterHPPercent)
return false;
if (rangeCheckFrom == null)
rangeCheckFrom = ObjectManager.Player.ServerPosition;
if (Monitor.TryEnter(EnemyInfo[t.NetworkId].m_lock))
{
try
{
HitChance predictedhc;
float avgt = t.AvgMovChangeTime() + reactionIgnoreDelay;
float movt = t.LastMovChangeTime();
float avgp = t.AvgPathLenght();
Vector2 pos = GetArcPrediction(t, s, t.GetWaypoints(), avgt, movt, avgp, out predictedhc, rangeCheckFrom.Value);
if (rangeCheckFrom.Value.To2D().Distance(pos) > s.Range + s.Width / 2 - t.BoundingRadius) //out of range
{
Monitor.Pulse(EnemyInfo[t.NetworkId].m_lock);
return false;
}
float multp = (pos.Distance(rangeCheckFrom.Value.To2D()) / 875.0f);
var dianaArc = new SPrediction.Geometry.Polygon(
ClipperWrapper.DefineArc(rangeCheckFrom.Value.To2D() - new Vector2(875 / 2f, 20), pos, (float)Math.PI * multp, 410, 200 * multp),
ClipperWrapper.DefineArc(rangeCheckFrom.Value.To2D() - new Vector2(875 / 2f, 20), pos, (float)Math.PI * multp, 410, 320 * multp));
if (Collision.CheckYasuoWallCollision(dianaArc))
{
Monitor.Pulse(EnemyInfo[t.NetworkId].m_lock);
return false;
}
if (predictedhc >= hc)
{
s.Cast(pos);
return true;
}
Monitor.Pulse(EnemyInfo[t.NetworkId].m_lock);
return false;
}
finally
{
Monitor.Exit(EnemyInfo[t.NetworkId].m_lock);
}
}
return false;
}
示例11: GetArcSPrediction
/// <summary>
/// Gets Prediction result
/// </summary>
/// <param name="target">Target</param>
/// <returns>Prediction result as <see cref="Prediction.Result"/></returns>
public static Prediction.Result GetArcSPrediction(this Spell s, Obj_AI_Hero target)
{
return ArcPrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), s.From.To2D(), s.RangeCheckFrom.To2D());
}
示例12: SPredictionCastRing
/// <summary>
/// Spell extension for cast vector spell with SPrediction
/// </summary>
/// <param name="s">Spell to cast</param>
/// <param name="t">Target for spell</param>
/// <param name="ringRadius">Ring Radius</param>
/// <param name="hc">Minimum HitChance to cast</param>
/// <param name="reactionIgnoreDelay">Delay to ignore target's reaction time</param>
/// <param name="minHit">Minimum Hit Count to cast</param>
/// <param name="rangeCheckFrom">Position where spell will be casted from</param>
/// <param name="filterHPPercent">Minimum HP Percent to cast (for target)</param>
/// <returns>true if spell has casted</returns>
public static bool SPredictionCastRing(this Spell s, Obj_AI_Hero t, float ringRadius, HitChance hc, bool onlyEdge = true, int reactionIgnoreDelay = 0, byte minHit = 1, Vector3? rangeCheckFrom = null, float filterHPPercent = 100)
{
if (Prediction.predMenu != null && Prediction.predMenu.Item("PREDICTONLIST").GetValue<StringList>().SelectedIndex == 1)
throw new NotSupportedException("Vector Prediction not supported in Common prediction");
if (minHit > 1)
throw new NotSupportedException("Ring aoe prediction not supported yet");
if (t.HealthPercent > filterHPPercent)
return false;
if (rangeCheckFrom == null)
rangeCheckFrom = ObjectManager.Player.ServerPosition;
if (Monitor.TryEnter(PathTracker.EnemyInfo[t.NetworkId].m_lock))
{
try
{
float avgt = t.AvgMovChangeTime() + reactionIgnoreDelay;
float movt = t.LastMovChangeTime();
float avgp = t.AvgPathLenght();
Prediction.Result result;
if (onlyEdge)
result = RingPrediction.GetPrediction(t, s.Width, ringRadius, s.Delay, s.Speed, s.Range, s.Collision, t.GetWaypoints(), avgt, movt, avgp, s.From.To2D(), rangeCheckFrom.Value.To2D());
else
result = CirclePrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range + ringRadius, s.Collision, t.GetWaypoints(), avgt, movt, avgp, 360, s.From.To2D(), rangeCheckFrom.Value.To2D());
Prediction.lastDrawTick = Utils.TickCount;
Prediction.lastDrawPos = result.CastPosition;
Prediction.lastDrawHitchance = result.HitChance.ToString();
Prediction.lastDrawDirection = (result.CastPosition - s.From.To2D()).Normalized().Perpendicular();
Prediction.lastDrawWidth = (int)ringRadius;
if (result.HitChance >= hc)
{
s.Cast(result.CastPosition);
return true;
}
Monitor.Pulse(PathTracker.EnemyInfo[t.NetworkId].m_lock);
return false;
}
finally
{
Monitor.Exit(PathTracker.EnemyInfo[t.NetworkId].m_lock);
}
}
return false;
}
示例13: castR
private static void castR(Obj_AI_Hero target)
{
if (Config.Item("hitchanceR").GetValue<bool>())
{
List<Vector2> waypoints = target.GetWaypoints();
if ((ObjectManager.Player.Distance(waypoints.Last<Vector2>().To3D()) - ObjectManager.Player.Distance(target.Position)) > 400)
{
R.Cast(target, true);
}
}
else
R.Cast(target, true);
}
示例14: IsValidTarget
public static bool IsValidTarget(Obj_AI_Hero target)
{
if (!IsWhitelisted(target))
return false;
var targetPosition = Geometry.PositionAfter(target.GetWaypoints(), 300, (int)target.MoveSpeed);
if (target.Distance(ObjectManager.Player.ServerPosition) < 650f && IsCondemnable(ObjectManager.Player.ServerPosition.To2D(), targetPosition, target.BoundingRadius))
{
if (target.Path.Length == 0)
{
var outRadius = (0.3f * target.MoveSpeed) / (float)Math.Cos(2 * Math.PI / Accuracy);
int count = 0;
for (int i = 1; i <= Accuracy; i++)
{
if (count + (Accuracy - i) < Accuracy / 3)
return false;
var angle = i * 2 * Math.PI / Accuracy;
float x = target.Position.X + outRadius * (float)Math.Cos(angle);
float y = target.Position.Y + outRadius * (float)Math.Sin(angle);
if (IsCondemnable(ObjectManager.Player.ServerPosition.To2D(), new Vector2(x, y), target.BoundingRadius))
count++;
}
return count >= Accuracy / 3;
}
else
return true;
}
else
{
if (TumbleCondemn && s_Champion.Spells[Champion.Q].IsReady())
{
var outRadius = 300 / (float)Math.Cos(2 * Math.PI / TumbleCondemnCount);
for (int i = 1; i <= TumbleCondemnCount; i++)
{
var angle = i * 2 * Math.PI / TumbleCondemnCount;
float x = ObjectManager.Player.Position.X + outRadius * (float)Math.Cos(angle);
float y = ObjectManager.Player.Position.Y + outRadius * (float)Math.Sin(angle);
targetPosition = Geometry.PositionAfter(target.GetWaypoints(), 300, (int)target.MoveSpeed);
var vec = new Vector2(x, y);
if (targetPosition.Distance(vec) < 550f && IsCondemnable(vec, targetPosition, target.BoundingRadius, 300f))
{
if (!TumbleCondemnSafe || Tumble.IsSafe(target, vec.To3D2(), false).IsValid())
{
s_Champion.Spells[Champion.Q].Cast(vec);
break;
}
}
}
return false;
}
}
return false;
}
示例15: CastSpell
private static void CastSpell(Spell QWER, Obj_AI_Hero target, int HitChanceNum)
{
//HitChance 0 - 2
// example CastSpell(Q, ts, 2);
var poutput = QWER.GetPrediction(target);
var col = poutput.CollisionObjects.Count(ColObj => ColObj.IsEnemy && ColObj.IsMinion && !ColObj.IsDead);
if (target.IsDead || col > 0 || target.Path.Count() > 1)
return;
if ((target.Path.Count() == 0 && target.Position == target.ServerPosition) || target.HasBuff("Recall"))
{
QWER.Cast(poutput.CastPosition);
return;
}
if (HitChanceNum == 0)
QWER.Cast(target, true);
else if (HitChanceNum == 1)
{
if ((int)poutput.Hitchance > 4)
QWER.Cast(poutput.CastPosition);
}
else if (HitChanceNum == 2)
{
List<Vector2> waypoints = target.GetWaypoints();
if (waypoints.Last<Vector2>().To3D().Distance(poutput.CastPosition) > QWER.Width && (int)poutput.Hitchance == 5)
{
if (waypoints.Last<Vector2>().To3D().Distance(Player.Position) <= target.Distance(Player.Position) || (target.Path.Count() == 0 && target.Position == target.ServerPosition))
{
if (Player.Distance(target.ServerPosition) < QWER.Range - (poutput.CastPosition.Distance(target.ServerPosition) + target.BoundingRadius))
{
QWER.Cast(poutput.CastPosition);
}
}
else if ((int)poutput.Hitchance == 5)
{
QWER.Cast(poutput.CastPosition);
}
}
}
else if (HitChanceNum == 3)
{
List<Vector2> waypoints = target.GetWaypoints();
float SiteToSite = ((target.MoveSpeed * QWER.Delay) + (Player.Distance(target.ServerPosition) / QWER.Speed) - QWER.Width) * 6;
float BackToFront = ((target.MoveSpeed * QWER.Delay) + (Player.Distance(target.ServerPosition) / QWER.Speed));
if (Player.Distance(waypoints.Last<Vector2>().To3D()) < SiteToSite || Player.Distance(target.Position) < SiteToSite)
QWER.CastIfHitchanceEquals(target, HitChance.High, true);
else if ((target.ServerPosition.Distance(waypoints.Last<Vector2>().To3D()) > SiteToSite
|| Math.Abs(Player.Distance(waypoints.Last<Vector2>().To3D()) - Player.Distance(target.Position)) > BackToFront))
{
if (waypoints.Last<Vector2>().To3D().Distance(Player.Position) <= target.Distance(Player.Position))
{
if (Player.Distance(target.ServerPosition) < QWER.Range - (poutput.CastPosition.Distance(target.ServerPosition)))
{
QWER.Cast(poutput.CastPosition);
}
}
else
{
QWER.Cast(poutput.CastPosition);
}
}
}
else if (HitChanceNum == 4 && (int)poutput.Hitchance > 4)
{
List<Vector2> waypoints = target.GetWaypoints();
float SiteToSite = ((target.MoveSpeed * QWER.Delay) + (Player.Distance(target.ServerPosition) / QWER.Speed) - QWER.Width) * 6;
float BackToFront = ((target.MoveSpeed * QWER.Delay) + (Player.Distance(target.ServerPosition) / QWER.Speed));
if (Player.Distance(waypoints.Last<Vector2>().To3D()) < SiteToSite || Player.Distance(target.Position) < SiteToSite)
QWER.CastIfHitchanceEquals(target, HitChance.High, true);
else if ((target.ServerPosition.Distance(waypoints.Last<Vector2>().To3D()) > SiteToSite
|| Math.Abs(Player.Distance(waypoints.Last<Vector2>().To3D()) - Player.Distance(target.Position)) > BackToFront))
{
if (waypoints.Last<Vector2>().To3D().Distance(Player.Position) <= target.Distance(Player.Position))
{
if (Player.Distance(target.ServerPosition) < QWER.Range - (poutput.CastPosition.Distance(target.ServerPosition)))
{
QWER.Cast(poutput.CastPosition);
}
}
else
{
QWER.Cast(poutput.CastPosition);
}
}
}
}