本文整理汇总了C#中Unit.IsAttackImmune方法的典型用法代码示例。如果您正苦于以下问题:C# Unit.IsAttackImmune方法的具体用法?C# Unit.IsAttackImmune怎么用?C# Unit.IsAttackImmune使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Unit
的用法示例。
在下文中一共展示了Unit.IsAttackImmune方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AttackIfCan
private static void AttackIfCan(Unit source, Unit target)
{
if (target == null) return;
if (source.CanAttack() && AttackTarget.isActive && !target.IsAttackImmune() && !target.IsInvul()) source.Attack(target);
}
示例2: Orbwalk
/// <summary>
/// Orbwalks on given target if they are in range, while moving to mouse position
/// </summary>
/// <param name="target"></param>
/// <param name="bonusWindupMs"></param>
/// <param name="bonusRange"></param>
/// <param name="attackmodifiers"></param>
public static void Orbwalk(
Unit target,
float bonusWindupMs = 0,
float bonusRange = 0,
bool attackmodifiers = false)
{
if (me == null)
{
return;
}
var targetHull = 0f;
if (target != null)
{
targetHull = target.HullRadius;
}
float distance = 0;
if (target != null)
{
var pos = Prediction.InFront(
me,
(float)((Game.Ping / 1000 + me.GetTurnTime(target.Position)) * me.MovementSpeed));
distance = pos.Distance2D(target) - me.Distance2D(target);
}
var isValid = target != null && target.IsValid && target.IsAlive && target.IsVisible
&& target.Distance2D(me)
<= (me.GetAttackRange() + me.HullRadius + 50 + targetHull + bonusRange + distance);
if (isValid || (target != null && me.IsAttacking() && me.GetTurnTime(target.Position) < 0.1))
{
var canAttack = (!AttackOnCooldown(target, bonusWindupMs) || !CanCancelAnimation())
&& !target.IsAttackImmune() && !target.IsInvul() && me.CanAttack();
if (canAttack && Utils.SleepCheck("Orbwalk.Attack"))
{
Attack(target, attackmodifiers);
Utils.Sleep(100, "Orbwalk.Attack");
return;
}
}
var canCancel = (CanCancelAnimation() && AttackOnCooldown(target, bonusWindupMs))
|| (!isValid && !me.IsAttacking());
if (!canCancel || !Utils.SleepCheck("Orbwalk.Move"))
{
return;
}
me.Move(Game.MousePosition);
Utils.Sleep(100, "Orbwalk.Move");
}
示例3: Orbwalk
/// <summary>
/// Orbwalks on given target if they are in range, while moving to mouse position
/// </summary>
/// <param name="target"></param>
/// <param name="bonusWindupMs"></param>
/// <param name="bonusRange"></param>
/// <param name="attackmodifiers"></param>
public static void Orbwalk(
Unit target,
float bonusWindupMs = 0,
float bonusRange = 0,
bool attackmodifiers = false)
{
if (me == null)
{
return;
}
// if (!Utils.SleepCheck("GlobalCasting"))
// {
// return;
// }
var targetHull = 0f;
if (target != null)
{
targetHull = target.HullRadius;
}
float distance = 0;
if (target != null)
{
var pos = Prediction.InFront(
me,
(float)((Game.Ping / 1000 + me.GetTurnTime(target.Position)) * me.MovementSpeed));
distance = pos.Distance2D(target) - me.Distance2D(target);
}
var isValid = target != null && target.IsValid && target.IsAlive && target.IsVisible && !target.IsInvul()
&& !target.HasModifiers(
new[] { "modifier_ghost_state", "modifier_item_ethereal_blade_slow" },
false)
&& target.Distance2D(me)
<= me.GetAttackRange() + me.HullRadius + 50 + targetHull + bonusRange + Math.Max(distance, 0);
if (isValid || (target != null && me.IsAttacking() && me.GetTurnTime(target.Position) < 0.1))
{
var canAttack = !AttackOnCooldown(target, bonusWindupMs) && !target.IsAttackImmune()
&& !target.IsInvul() && me.CanAttack();
if (canAttack && Utils.SleepCheck("Orbwalk.Attack"))
{
Attack(target, attackmodifiers);
Utils.Sleep(
UnitDatabase.GetAttackPoint(me) * 1000 + me.GetTurnTime(target) * 1000,
"Orbwalk.Attack");
return;
}
}
var canCancel = (CanCancelAnimation() && AttackOnCooldown(target, bonusWindupMs))
|| (!isValid && !me.IsAttacking() && CanCancelAnimation());
if (!canCancel || !Utils.SleepCheck("Orbwalk.Move") || !Utils.SleepCheck("Orbwalk.Attack"))
{
return;
}
me.Move(Game.MousePosition);
Utils.Sleep(100, "Orbwalk.Move");
}
示例4: Orbwalk
private static void Orbwalk(Hero me,Unit target,float bonusWindupMs = 100,float bonusRange = 0)
{
if (me == null)
{
return;
}
var targetHull = 0f;
if (target != null)
{
targetHull = target.HullRadius;
}
float distance = 0;
if (target != null)
{
var pos = Prediction.InFront(
me,
(float)((Game.Ping / 1000 + me.GetTurnTime(target.Position)) * me.MovementSpeed));
distance = pos.Distance2D(target) - me.Distance2D(target);
}
var isValid = target != null && target.IsValid && target.IsAlive && target.IsVisible && !target.IsInvul()
&& !target.Modifiers.Any(
x => x.Name == "modifier_ghost_state" || x.Name == "modifier_item_ethereal_blade_slow")
&& target.Distance2D(me)
<= (me.GetAttackRange() + me.HullRadius + 50 + targetHull + bonusRange + Math.Max(distance, 0));
if (isValid || (target != null && me.IsAttacking() && me.GetTurnTime(target.Position) < 0.1))
{
var canAttack = !AttackOnCooldown(me,target, bonusWindupMs)
&& !target.IsAttackImmune() && !target.IsInvul() && me.CanAttack();
if (canAttack && Utils.SleepCheck("!Orbwalk.Attack"))
{
me.Attack(target);
Utils.Sleep(
UnitDatabase.GetAttackPoint(me) * 1000 + me.GetTurnTime(target) * 1000,
"!Orbwalk.Attack");
return;
}
}
var canCancel = (CanCancelAnimation(me) && AttackOnCooldown(me,target, bonusWindupMs))
|| (!isValid && !me.IsAttacking() && CanCancelAnimation(me));
if (!canCancel || !Utils.SleepCheck("!Orbwalk.Move") || !Utils.SleepCheck("!Orbwalk.Attack"))
{
return;
}
if (target != null) me.Move(target.Position);
Utils.Sleep(100, "!Orbwalk.Move");
}
示例5: OrbwalkOn
/// <summary>
/// The orbwalk.
/// </summary>
/// <param name="target">
/// The target.
/// </param>
/// <param name="movePosition">
/// The move Position.
/// </param>
/// <param name="bonusWindupMs">
/// The bonus windup ms.
/// </param>
/// <param name="bonusRange">
/// The bonus range.
/// </param>
/// <param name="attackmodifiers">
/// The attackmodifiers.
/// </param>
/// <param name="followTarget">
/// The follow target.
/// </param>
public void OrbwalkOn(
Unit target,
Vector3 movePosition,
float bonusWindupMs = 0,
float bonusRange = 0,
bool attackmodifiers = true,
bool followTarget = false)
{
if (this.Unit == null || !this.Unit.IsValid)
{
return;
}
var targetHull = 0f;
if (target != null)
{
targetHull = target.HullRadius;
}
float distance = 0;
if (target != null)
{
var pos = Prediction.InFront(
this.Unit,
(float)(Game.Ping / 1000 + this.Unit.GetTurnTime(target.Position) * this.Unit.MovementSpeed));
distance = pos.Distance2D(target) - this.Unit.Distance2D(target);
}
var isValid = target != null && target.IsValid && target.IsAlive && target.IsVisible;
var isAttackable = target != null && target.IsValid && !target.IsInvul() && !target.IsAttackImmune()
&& !target.HasModifiers(
new[] { "modifier_ghost_state", "modifier_item_ethereal_blade_slow" },
false)
&& target.Distance2D(this.Unit)
<= this.Unit.GetAttackRange() + this.Unit.HullRadius + 50 + targetHull + bonusRange
+ Math.Max(distance, 0);
if ((isValid && isAttackable)
|| (!isAttackable && target != null && target.IsValid && this.Unit.IsAttacking()
&& this.Unit.GetTurnTime(target.Position) < 0.1))
{
var canAttack = !this.IsAttackOnCoolDown(target, bonusWindupMs) && this.Unit.CanAttack();
if (canAttack && !this.attackSleeper.Sleeping && (!this.hero || Utils.SleepCheck("Orbwalk.Attack")))
{
this.attacker.Attack(target, attackmodifiers);
this.AttackOrder();
this.attackSleeper.Sleep(
(float)
(UnitDatabase.GetAttackPoint(this.Unit) * 1000 + this.Unit.GetTurnTime(target) * 1000
+ Game.Ping + 100));
this.moveSleeper.Sleep(
(float)
(UnitDatabase.GetAttackPoint(this.Unit) * 1000 + this.Unit.GetTurnTime(target) * 1000 + 50));
if (!this.hero)
{
return;
}
Utils.Sleep(
UnitDatabase.GetAttackPoint(this.Unit) * 1000 + this.Unit.GetTurnTime(target) * 1000 + Game.Ping
+ 100,
"Orbwalk.Attack");
Utils.Sleep(
UnitDatabase.GetAttackPoint(this.Unit) * 1000 + this.Unit.GetTurnTime(target) * 1000 + 50,
"Orbwalk.Move");
return;
}
if (canAttack && !this.attackSleeper2.Sleeping)
{
this.attacker.Attack(target, attackmodifiers);
this.AttackOrder();
this.attackSleeper2.Sleep(100);
return;
}
}
var userdelay = this.setUserDelayManually ? this.UserDelay : Orbwalking.UserDelay;
var canCancel = (this.CanCancelAttack(userdelay) && this.IsAttackOnCoolDown(target, bonusWindupMs))
|| ((!isValid || !isAttackable)
//.........这里部分代码省略.........