本文整理汇总了C#中LeagueSharp.Common.Spell.GetPrediction方法的典型用法代码示例。如果您正苦于以下问题:C# Spell.GetPrediction方法的具体用法?C# Spell.GetPrediction怎么用?C# Spell.GetPrediction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LeagueSharp.Common.Spell
的用法示例。
在下文中一共展示了Spell.GetPrediction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CastSkillshot
public void CastSkillshot(Obj_AI_Hero t, Spell s, HitChance hc = HitChance.High)
{
if (!s.IsSkillshot)
return;
PredictionOutput p = s.GetPrediction(t);
if (s.Collision)
{
for (int i = 0; i < p.CollisionObjects.Count; i++)
if (!p.CollisionObjects[i].IsDead && (p.CollisionObjects[i].IsEnemy || p.CollisionObjects[i].IsMinion))
return;
}
if ((t.HasBuffOfType(BuffType.Slow) && p.Hitchance >= HitChance.High) || p.Hitchance == HitChance.Immobile)
s.Cast(p.CastPosition);
else if (t.IsRecalling())
s.Cast(t.ServerPosition);
else
{
if (s.IsReady())
{
s.SPredictionCast(t, hc);
}
}
}
示例2: GetEnemyHitByR
// This is for sona only atm.
public static Obj_AI_Hero GetEnemyHitByR(Spell R, int numHit) {
int totalHit = 0;
Obj_AI_Hero target = null;
foreach (Obj_AI_Hero current in ObjectManager.Get<Obj_AI_Hero>()) {
var prediction = R.GetPrediction(current, true);
if (Vector3.Distance(ObjectManager.Player.Position, prediction.CastPosition) <= R.Range) {
Vector2 extended = current.Position.To2D().Extend(ObjectManager.Player.Position.To2D(), -R.Range + Vector2.Distance(ObjectManager.Player.Position.To2D(), current.Position.To2D()));
rect = new Geometry.Rectangle(ObjectManager.Player.Position.To2D(), extended, R.Width);
if (!current.IsMe && current.IsEnemy) {
// SEt to 1 as the current target is hittable.
totalHit = 1;
foreach (var enemy in ObjectManager.Get<Obj_AI_Hero>()) {
if (enemy.IsEnemy && current.ChampionName != enemy.ChampionName && !enemy.IsDead && !rect.ToPolygon().IsOutside(enemy.Position.To2D())) {
totalHit += 1;
}
}
}
if (totalHit >= numHit) {
target = current;
break;
}
}
}
Console.WriteLine(Game.Time + " | Targets hit is: " + totalHit + " Out of " + numHit);
return target;
}
示例3: IsPositionSafe
public static bool IsPositionSafe(Obj_AI_Base vTarget, Spell vSpell)
{
Vector2 predPos = vSpell.GetPrediction(vTarget).CastPosition.To2D();
Vector2 myPos = ObjectManager.Player.Position.To2D();
Vector2 newPos = (vTarget.Position.To2D() - myPos);
newPos.Normalize();
Vector2 checkPos = predPos + newPos * (vSpell.Range - Vector2.Distance(predPos, myPos));
Obj_Turret closestTower = null;
foreach (Obj_Turret tower in
ObjectManager.Get<Obj_Turret>()
.Where(tower => tower.IsValid && !tower.IsDead && tower.Health != 0 && tower.IsEnemy))
{
if (Vector3.Distance(tower.Position, ObjectManager.Player.Position) < 1450)
closestTower = tower;
}
if (closestTower == null)
return true;
if (Vector2.Distance(closestTower.Position.To2D(), checkPos) <= 910)
return false;
return true;
}
示例4: CastMec
private static void CastMec(Spell spell, int minHit)
{
if (!spell.IsReady() || ObjectManager.Player.HealthPercent <= 10)
return;
foreach (var target in HeroManager.Enemies.Where(x => x.IsValidTarget(spell.Range)))
{
var pred = spell.GetPrediction(target, true);
var nearByEnemies = 1;
if (spell.Type == SkillshotType.SkillshotLine && spell.Collision)
{
var poly = new Geometry.Polygon.Circle(pred.UnitPosition, spell.Width);
nearByEnemies +=
HeroManager.Enemies.Where(x => x.NetworkId != target.NetworkId)
.Count(enemy => poly.IsInside(enemy.ServerPosition));
}
else
{
nearByEnemies = pred.AoeTargetsHitCount;
}
if (nearByEnemies >= minHit)
{
spell.Cast(target);
return;
}
}
}
示例5: IsPositionSafe
// use underTurret and .Extend for this please
public static bool IsPositionSafe(Obj_AI_Hero target, Spell spell)
{
var predPos = spell.GetPrediction(target).UnitPosition.To2D();
var myPos = Player.Position.To2D();
var newPos = (target.Position.To2D() - myPos);
newPos.Normalize();
var checkPos = predPos + newPos * (spell.Range - Vector2.Distance(predPos, myPos));
Obj_Turret closestTower = null;
foreach (var tower in ObjectManager.Get<Obj_Turret>()
.Where(tower => tower.IsValid && !tower.IsDead && Math.Abs(tower.Health) > float.Epsilon)
.Where(tower => Vector3.Distance(tower.Position, Player.Position) < 1450))
{
closestTower = tower;
}
if (closestTower == null)
return true;
if (Vector2.Distance(closestTower.Position.To2D(), checkPos) <= 910)
return false;
return true;
}
示例6: CastBasicSkillShot
public static void CastBasicSkillShot(Spell spell, float range, LeagueSharp.Common.TargetSelector.DamageType type, HitChance hitChance)
{
var target = LeagueSharp.Common.TargetSelector.GetTarget(range, type);
if (target == null || !spell.IsReady())
return;
spell.UpdateSourcePosition();
if (spell.GetPrediction(target).Hitchance >= hitChance)
spell.Cast(target, packets());
}
示例7: GetTargetNoCollision
public static Obj_AI_Hero GetTargetNoCollision(Spell spell,
bool ignoreShields = true,
Vector3 from = default(Vector3),
IEnumerable<Obj_AI_Hero> ignoreChampions = null)
{
return
GetTargets(spell.Range, Utils.ConvertDamageType(spell.DamageType), ignoreShields, from, ignoreChampions)
.FirstOrDefault(t => spell.GetPrediction(t).Hitchance != HitChance.Collision);
}
示例8: CastSpell
public static void CastSpell(Spell spell, Obj_AI_Base target, HitChance hitChance, bool packetCast)
{
Obj_AI_Hero Player = ObjectManager.Player;
if (target.IsValidTarget(spell.Range) && spell.GetPrediction(target).Hitchance >= hitChance)
{
spell.Cast(target, packetCast);
LastCastTime = Environment.TickCount;
Orbwalking.ResetAutoAttackTimer();
}
}
示例9: Cast_BasicSkillshot_Enemy
public Obj_AI_Hero Cast_BasicSkillshot_Enemy(Spell spell, TargetSelector.PriorityMode prio = TargetSelector.PriorityMode.AutoPriority, float extrarange = 0)
{
if(!spell.IsReady())
return null;
var target = TargetSelector.GetTarget(spell.Range, prio);
if(target == null)
return null;
if (!target.IsValidTarget(spell.Range + extrarange) || spell.GetPrediction(target).Hitchance < HitChance.High)
return null;
spell.Cast(target, UsePackets());
return target;
}
示例10: castLineSkillShot
/// <summary>
/// Casts a basic line skillshot towards target if hitchance is high
/// </summary>
/// <param name="spell"></param>
/// <param name="damageType"></param>
/// <returns> target </returns>
public Obj_AI_Hero castLineSkillShot(Spell spell,
SimpleTs.DamageType damageType = SimpleTs.DamageType.Physical)
{
if (!spell.IsReady())
return null;
Obj_AI_Hero target = SimpleTs.GetTarget(spell.Range, damageType);
if (target == null)
return null;
if (!target.IsValidTarget(spell.Range) || spell.GetPrediction(target).Hitchance < HitChance.High)
return null;
spell.Cast(target, true);
return target;
}
示例11: castCircleSkillShot
/// <summary>
/// Casts a basic circle skillshot towards target if hitchance is high
/// </summary>
/// <param name="spell"></param>
/// <param name="damageType"></param>
/// <param name="extrarange"></param>
/// <returns></returns>
public Obj_AI_Base castCircleSkillShot(Spell spell,
SimpleTs.DamageType damageType = SimpleTs.DamageType.Physical, float extrarange = 0)
{
if (!spell.IsReady())
return null;
Obj_AI_Hero target = SimpleTs.GetTarget(spell.Range + extrarange, damageType);
if (target == null)
return null;
if (target.IsValidTarget(spell.Range + extrarange) &&
spell.GetPrediction(target).Hitchance >= HitChance.High)
spell.Cast(target, true);
return target;
}
示例12: DoCast
public static bool DoCast(Spell spell, Obj_AI_Hero target, HitChance minHitChance, bool colisionCheck=false)
{
// Data.Static.Objects.ProjectLogger.WriteLog("DoCast Call");
if ((PredictionMethod==0)||((PredictionMethod==1)&&colisionCheck)) //Sebby Colision is broken...lol
{
var output=spell.GetPrediction(target);
if (colisionCheck)
if (CheckColision(output))
return false;
if (minHitChance>output.Hitchance)
return false;
spell.Cast(output.CastPosition);
return true;
}
if (PredictionMethod==1)
{
var output=SebbyLib.Prediction.Prediction.GetPrediction(target, spell.Delay);
if (minHitChance>(HitChance)output.Hitchance)
return false;
spell.Cast(output.CastPosition);
return true;
}
if (PredictionMethod==2)
{
var output=spell.GetSPrediction(target);
if (colisionCheck)
if (CheckColision(output))
return false;
if (minHitChance>output.HitChance)
return false;
spell.Cast(output.CastPosition);
return true;
}
return false;
}
示例13: CastSpell
private static void CastSpell(Spell spell, BuffType x, Obj_AI_Hero target, float lastpostime)
{
if (x == BuffType.Stun || x == BuffType.Snare || x == BuffType.Knockup || x == BuffType.Fear)
{
if (Game.Time <= lastpostime)
{
spell.Cast(target.ServerPosition);
}
}
else
{
var pred = spell.GetPrediction(target);
if (pred != null && Game.Time <= lastpostime)
{
spell.Cast(pred.CastPosition);
}
}
}
示例14: SkillShot
public static void SkillShot(Obj_AI_Base target,
Spell spell,
HitChance hitChance,
bool aoe = false,
bool towerCheck = false)
{
if (!spell.IsReady())
{
return;
}
if (target == null || towerCheck && target.UnderTurret(true))
{
return;
}
spell.UpdateSourcePosition();
var prediction = spell.GetPrediction(target, aoe);
if (prediction.Hitchance >= hitChance)
{
spell.Cast(prediction.CastPosition);
}
}
示例15: LineFarm
private static void LineFarm(Spell spell, List<Obj_AI_Base> minions, int min, float overrideWidth = -1f)
{
var spellWidth = overrideWidth > 0 ? overrideWidth : spell.Width;
var totalHits = 0;
var castPos = Vector3.Zero;
foreach (var minion in minions)
{
var lMinion = minion;
var pred = spell.GetPrediction(minion);
if (pred.Hitchance < HitChance.Medium)
{
continue;
}
var rect = new Geometry.Polygon.Rectangle(
ObjectManager.Player.Position.To2D(),
ObjectManager.Player.Position.Extend(pred.CastPosition, spell.Range).To2D(), spellWidth);
var count = 1 + (from minion2 in minions.Where(m => m.NetworkId != lMinion.NetworkId)
let pred2 = spell.GetPrediction(minion2)
where pred2.Hitchance >= HitChance.Medium
where
new Geometry.Polygon.Circle(pred2.UnitPosition, minion2.BoundingRadius * 0.8f).Points.Any(
p => rect.IsInside(p))
select 1).Sum();
if (count > totalHits)
{
totalHits = count;
castPos = pred.CastPosition;
}
if (totalHits == minions.Count)
{
break;
}
if (!castPos.Equals(Vector3.Zero) && totalHits >= min)
{
spell.Cast(castPos);
}
}
}