本文整理汇总了C#中Hero.IsAttacking方法的典型用法代码示例。如果您正苦于以下问题:C# Hero.IsAttacking方法的具体用法?C# Hero.IsAttacking怎么用?C# Hero.IsAttacking使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hero
的用法示例。
在下文中一共展示了Hero.IsAttacking方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
/// <summary>
/// The execute.
/// </summary>
/// <param name="hero">
/// The hero.
/// </param>
/// <returns>
/// The <see cref="bool" />.
/// </returns>
public bool Execute(Hero hero = null)
{
if (hero == null)
{
return false;
}
var item = hero.FindItem("item_tango_single")
?? hero.FindItem("item_tango") ?? hero.FindItem("item_quelling_blade");
var nearestStack = Variables.Stacks.MinOrDefault(x => x.Position.Distance(hero.Position));
if (nearestStack == null || nearestStack.Position.Distance(hero.Position) > 1000)
{
return false;
}
foreach (var mine in
nearestStack.RemoteMines.Where(
x => x.Entity.IsValid && x.Entity.IsAlive && x.Entity.IsVisible && x.Entity.IsVisibleToEnemies))
{
if (item != null && item.CanHit(mine.Entity) && hero.GetTurnTime(mine.Position) < 0.01)
{
mine.Detonate();
return true;
}
if (!hero.IsAttacking() || !(hero.GetTurnTime(mine.Position) < 0.01)
|| !(mine.Entity.DamageTaken(hero.MaximumDamage, DamageType.Physical, hero) >= mine.Entity.Health))
{
continue;
}
mine.Detonate();
return true;
}
return false;
}
示例2: Game_OnUpdate
//.........这里部分代码省略.........
catch (Exception)
{
}
}
/*if (t.DayVision == 0 && !find)
{
Bara = t;
find = true;
BaraStartPos=Bara.Position;
}
else if (!find)
{
Bara = null;
BaraStartPos=new Vector3(0,0,0);
}*/
}
}
#endregion
#region ShowRoshanTimer
if (ShowRoshanTimer)
{
var tickDelta = Game.GameTime - _deathTime;
_roshanMinutes = Math.Floor(tickDelta / 60);
_roshanSeconds = tickDelta % 60;
var roshan =
ObjectMgr.GetEntities<Unit>()
.FirstOrDefault(unit => unit.ClassID == ClassID.CDOTA_Unit_Roshan && unit.IsAlive);
if (roshan != null)
{
_roshIsAlive = true;
//RoshanMinutes = 0;
//RoshanSeconds = 0;
//DeathTime = 0;
}
}
#endregion
#region ShowIllusions
if (ShowIllusions)
{
var illusions = ObjectMgr.GetEntities<Hero>()
.Where(
x =>
x.IsIllusion && x.Team != _me.Team);
foreach (var s in illusions)
{
HandleEffect(s);
}
}
#endregion
return;
#region AutoItems
if (!AutoItemsActive || !Utils.SleepCheck("AutoItems")) return;
if (AutoItemsMidas)
{
var midas = _me.FindItem("item_hand_of_midas");
if (midas != null && midas.CanBeCasted() && !_me.IsInvisible())
{
var creep =
ObjectMgr
.GetEntities<Unit>(
).FirstOrDefault(x => ((x is Hero && !x.IsIllusion) || (x is Creep && x.IsSpawned)) && x.IsAlive &&
x.IsVisible && _me.Distance2D(x) <= midas.CastRange && x.Team != _me.Team);
midas.UseAbility(creep);
Utils.Sleep(250, "AutoItems");
//PrintError("midas.CastRange: " + midas.CastRange);
}
}
if (AutoItemsPhase)
{
var phase = _me.FindItem("item_phase_boots");
if (phase != null && phase.CanBeCasted() && !_me.IsAttacking() && !_me.IsInvisible())
{
phase.UseAbility();
Utils.Sleep(250, "AutoItems");
}
}
if (!AutoItemsStick) return;
var stick = _me.FindItem("item_magic_stick");
var wand = _me.FindItem("item_magic_wand");
if (_me.Health * 100 / _me.MaximumHealth > 30 || !_me.IsAlive) return;
if (stick != null && stick.CanBeCasted() && !_me.IsInvisible())
{
stick.UseAbility();
Utils.Sleep(250, "AutoItems");
}
if (wand == null || !wand.CanBeCasted()) return;
wand.UseAbility();
Utils.Sleep(250, "AutoItems");
#endregion
}
示例3: Game_OnUpdate
private static void Game_OnUpdate(EventArgs args)
{
_mainHero = ObjectMgr.LocalHero;
//Print($"_mainHero: {_mainHero.Position.X}/{_mainHero.Position.Y}/{_mainHero.Position.Z}");
if (!_loaded)
{
if (!Game.IsInGame || _mainHero == null || _mainHero.ClassID != ClassID.CDOTA_Unit_Hero_ArcWarden)
{
return;
}
_loaded = true;
Game.PrintMessage(
"<font face='Comic Sans MS, cursive'><font color='#00aaff'>" + Menu.DisplayName + " By Jumpering" +
" loaded!</font> <font color='#aa0000'>v" + Assembly.GetExecutingAssembly().GetName().Version,
MessageType.LogMessage);
LastAttackStart.Clear();
LastActivity.Clear();
}
if (!Game.IsInGame || _mainHero == null)
{
_loaded = false;
return;
}
if (Game.IsPaused) return;
_tick = Environment.TickCount;
NetworkActivity act;
var handle = _mainHero.Handle;
if (!LastActivity.TryGetValue(handle, out act) || _mainHero.NetworkActivity != act)
{
LastActivity.Remove(handle);
LastActivity.Add(handle, _mainHero.NetworkActivity);
if (_mainHero.IsAttacking())
{
LastAttackStart.Remove(handle);
LastAttackStart.Add(handle,_tick);
}
}
foreach (var clone in Objects.Tempest.GetCloneList(_mainHero))
{
if (Menu.Item("AutoHeal.Enable").GetValue<KeyBind>().Active)
{
var enemy =
ObjectMgr.GetEntities<Unit>()
.Any(
x =>
x.Team == _mainHero.GetEnemyTeam() && x.IsAlive && x.IsVisible &&
x.Distance2D(_mainHero) < Menu.Item("AutoHeal.Range").GetValue<Slider>().Value);
if (!enemy)
{
CloneUseHealItems(clone, _mainHero, clone.Distance2D(_mainHero));
}
}
handle = clone.Handle;
if (LastActivity.TryGetValue(handle, out act) && clone.NetworkActivity == act) continue;
LastActivity.Remove(handle);
LastActivity.Add(handle, clone.NetworkActivity);
if (!clone.IsAttacking()) continue;
LastAttackStart.Remove(handle);
LastAttackStart.Add(handle, _tick);
}
if (Menu.Item("spamHotkey").GetValue<KeyBind>().Active)
{
SparkSpam(_mainHero);
return;
}
if (Menu.Item("hotkeyClone").GetValue<KeyBind>().Active)
{
if (_globalTarget2 == null || !_globalTarget2.IsValid)
{
_globalTarget2 = ClosestToMouse(_mainHero, 500);
}
if (_globalTarget2 != null && _globalTarget2.IsValid && _globalTarget2.IsAlive)
{
DoCombo2(_mainHero, _globalTarget2);
}
}
else
{
_globalTarget2 = null;
if (Menu.Item("AutoPush.Enable").GetValue<KeyBind>().Active)
AutoPush(_mainHero);
}
//if (!me.IsAlive) return;
var midas = _mainHero.FindItem("item_hand_of_midas");
if (midas != null && Menu.Item("AutoMidas").GetValue<bool>())
{
if (midas.CanBeCasted() && Utils.SleepCheck(_mainHero.Handle + "midas") && _mainHero.IsAlive && !_mainHero.IsInvisible())
{
var enemy =
ObjectMgr.GetEntities<Unit>()
.Where(
x =>
!x.IsMagicImmune() && x.Team != _mainHero.Team &&
(x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Lane ||
x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege ||
x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Neutral) && x.IsSpawned && x.IsAlive &&
//.........这里部分代码省略.........
示例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: JungleFarm
private static void JungleFarm(Hero me)
{
var s = JungleCamps.FindClosestCamp(me, Menu.Item("JungleFarm.TeamCheck").GetValue<bool>(),
Menu.Item("JungleFarm.Ancient").GetValue<bool>());
string name;
var enemyHeroes = Heroes.GetByTeam(me.GetEnemyTeam()).Where(x => x.IsAlive).ToList();
var dist = Menu.Item("JungleFarm.EscapeRange").GetValue<Slider>().Value;
if (Menu.Item("JungleFarm.EscapeFromAnyEnemyHero").GetValue<bool>() &&
enemyHeroes.Any(x => x.Distance2D(me) <= dist)) //escape from hero
{
var handle = me.Handle;
OrderStates[handle] = OrderState.Escape;
NeedHeal[handle] = true;
}
if (s == null)
{
s = JungleCamps.GetCamps.OrderBy(x => x.CampPosition.Distance2D(me)).FirstOrDefault();
if (s != null)
{
name = MeepoSet.Find(x => Equals(x.Hero, me)).Handle.ToString();
if (Utils.SleepCheck("MOVIER_jungle" + name))
{
me.Move(s.StackPosition);
Utils.Sleep(500, "MOVIER_jungle" + name);
}
}
return;
}
name = MeepoSet.Find(x => Equals(x.Hero, me)).Handle.ToString();
var anyMeepo =
MeepoSet.Where(
x =>
x.CurrentOrderState == OrderState.Jungle && x.IsAlive && x.Handle != me.Handle &&
x.Hero.Health >= Menu.Item("Escape.MinRange").GetValue<Slider>().Value)
.OrderBy(y => y.Hero.Distance2D(me))
.FirstOrDefault();
if (anyMeepo != null && me.Health <= 500 && anyMeepo.Hero.Distance2D(MyHero) <= 400 &&
CheckForChangedHealth(me))
{
if (!Utils.SleepCheck(name + "attack_test")) return;
Utils.Sleep(200, name + "attack_test");
var enemy =
ObjectManager.GetEntities<Unit>()
.FirstOrDefault(
x =>
x.IsAlive && x.IsVisible && x.Team != MyHero.Team && x.Distance2D(MyHero) <= 500 &&
!x.IsWaitingToSpawn);
if (enemy != null)
{
var creep = enemy.Position;
var ang = me.FindAngleBetween(creep, true);
var p = new Vector3((float) (me.Position.X - 250*Math.Cos(ang)),
(float) (me.Position.Y - 250*Math.Sin(ang)), 0);
me.Move(p);
}
me.Attack(anyMeepo.Hero, true);
return;
}
var mySet = MeepoSet.Find(x => Equals(x.Hero, me));
var w = mySet.SpellW;
if (w != null && Menu.Item("JungleFarm.AutoW").GetValue<bool>() && w.CanBeCasted())
{
var enemy =
ObjectManager
.GetEntities<Unit>(
)
.FirstOrDefault(
x =>
x.IsAlive && x.Health > 80 && x.IsVisible && x.Team != MyHero.Team &&
x.Distance2D(me) <= 375 &&
!x.IsWaitingToSpawn);
if (enemy != null && Utils.SleepCheck("jungle_farm_w" + name))
{
w.UseAbility(enemy.Position);
Utils.Sleep(1500, "jungle_farm_w_inCasting" + name);
Utils.Sleep(250, "jungle_farm_w" + name);
}
else if (enemy == null && !Utils.SleepCheck("jungle_farm_w_inCasting" + name) &&
Utils.SleepCheck("jungle_farm_w_stop" + name))
{
me.Stop();
Utils.Sleeps.Remove("jungle_farm_w_inCasting" + name);
Utils.Sleep(500, "jungle_farm_w_stop" + name);
}
}
if (!Utils.SleepCheck(name + "attack") || me.IsAttacking()) return;
Utils.Sleep(500, name + "attack");
me.Attack(s.CampPosition);
}
示例6: Game_OnUpdate
//.........这里部分代码省略.........
}
else
{
_findAa = false;
}
/*if (t.DayVision == 0 && !find)
{
Bara = t;
find = true;
BaraStartPos=Bara.Position;
}
else if (!find)
{
Bara = null;
BaraStartPos=new Vector3(0,0,0);
}*/
}
}
#endregion
#region ShowRoshanTimer
if (_showRoshanTimer)
{
var tickDelta = Game.GameTime - _deathTime;
_roshanMinutes = Math.Floor(tickDelta / 60);
_roshanSeconds = tickDelta % 60;
var roshan =
ObjectMgr.GetEntities<Unit>()
.FirstOrDefault(unit => unit.ClassID == ClassID.CDOTA_Unit_Roshan && unit.IsAlive);
if (roshan != null)
{
_roshIsAlive = true;
//RoshanMinutes = 0;
//RoshanSeconds = 0;
//DeathTime = 0;
}
}
#endregion
#region ShowIllusions
if (_showIllusions)
{
var illusions = ObjectMgr.GetEntities<Hero>()
.Where(
x =>
x.IsIllusion && x.Team != _me.Team);
foreach (var s in illusions)
{
HandleEffect(s);
}
}
#endregion
#region AutoItems
if (!_autoItemsActive || !Utils.SleepCheck("AutoItems") || !_me.IsAlive) return;
if (Menu.Item("autoitemsList").GetValue<AbilityToggler>().IsEnabled("item_hand_of_midas"))
{
var midas = _me.FindItem("item_hand_of_midas");
if (midas != null && midas.CanBeCasted() && !_me.IsInvisible())
{
var creep =
ObjectMgr.GetEntities<Unit>()
.FirstOrDefault(
x =>
x.Team != _me.Team &&
(x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Lane ||
x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege ||
x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Neutral) && x.IsSpawned && x.IsAlive &&
x.Distance2D(_me) <= 600);
midas.UseAbility(creep);
Utils.Sleep(250, "AutoItems");
//PrintError("midas.CastRange: " + midas.CastRange);
}
}
if (Menu.Item("autoitemsList").GetValue<AbilityToggler>().IsEnabled("item_phase_boots"))
{
var phase = _me.FindItem("item_phase_boots");
if (phase != null && phase.CanBeCasted() && !_me.IsAttacking() && !_me.IsInvisible() && !_me.IsChanneling() && _me.NetworkActivity==NetworkActivity.Move)
{
phase.UseAbility();
Utils.Sleep(250, "AutoItems");
}
}
if (!Menu.Item("autoitemsList").GetValue<AbilityToggler>().IsEnabled("item_magic_wand")) return;
var stick = _me.Inventory.Items.FirstOrDefault(x => (x.Name == "item_magic_stick" || x.Name == "item_magic_wand") && x.CanBeCasted() && x.CurrentCharges>0);
if (!_me.IsAlive) return;
if (_me.Health*100/_me.MaximumHealth >= Menu.Item("autoitemlistHealth").GetValue<Slider>().Value &&
!(_me.Mana*100/_me.MaximumMana < Menu.Item("autoitemlistMana").GetValue<Slider>().Value)) return;
if (stick == null || _me.IsInvisible()) return;
stick.UseAbility();
Utils.Sleep(250, "AutoItems");
#endregion
}
示例7: Attacking
public static bool Attacking(Hero target, Hero me)
{
var attacking = me.IsAttacking() && me.Distance2D(target) <= MyHeroInfo.AttackRange() + 150
&& me.GetTurnTime(target.Position) < 0.1;
return attacking;
}
示例8: Game_OnUpdate
//.........这里部分代码省略.........
{
ghost.UseAbility();
Utils.Sleep(250, "Ghost");
}
if (// Shiva Item
shiva != null
&& shiva.CanBeCasted()
&& me.CanCast()
&& !target.IsMagicImmune()
&& Utils.SleepCheck("shiva")
&& Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(shiva.Name)
&& me.Distance2D(target) <= 600
)
{
shiva.UseAbility();
Utils.Sleep(250, "shiva");
} // Shiva Item end
if ( // sheep
sheep != null
&& sheep.CanBeCasted()
&& me.CanCast()
&& !target.IsLinkensProtected()
&& !target.IsMagicImmune()
&& me.Distance2D(target) <= 1400
&& Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(sheep.Name)
&& Utils.SleepCheck("sheep")
)
{
sheep.UseAbility(target);
Utils.Sleep(250, "sheep");
} // sheep Item end
if (// Dagon
me.CanCast()
&& dagon != null
&& (ethereal == null
|| (target.Modifiers.Any(y => y.Name == "modifier_item_ethereal_blade_slow")
|| ethereal.Cooldown < 17))
&& !target.IsLinkensProtected()
&& dagon.CanBeCasted()
&& !target.IsMagicImmune()
&& Utils.SleepCheck("dagon")
)
{
dagon.UseAbility(target);
Utils.Sleep(200, "dagon");
} // Dagon Item end
if (
// cheese
cheese != null
&& cheese.CanBeCasted()
&& me.Health <= (me.MaximumHealth * 0.3)
&& me.Distance2D(target) <= 700
&& Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(cheese.Name)
&& Utils.SleepCheck("cheese")
)
{
cheese.UseAbility();
Utils.Sleep(200, "cheese");
} // cheese Item end
}
}
}
if (Menu.Item("orbwalk").GetValue<bool>())
{
if (me.Distance2D(target) <= me.AttackRange + 5 &&
(!me.IsAttackImmune()
|| !target.IsAttackImmune()
)
&& me.NetworkActivity != NetworkActivity.Attack
&& me.CanAttack()
&& !me.IsAttacking()
&& Utils.SleepCheck("attack")
)
{
me.Attack(target);
Utils.Sleep(180, "attack");
}
else if (
(!me.CanAttack()
|| me.Distance2D(target) >= 450)
&& me.NetworkActivity != NetworkActivity.Attack
&& me.Distance2D(target) <= 2500
&& !me.IsAttacking()
&& Utils.SleepCheck("Move")
)
{
me.Move(Prediction.InFront(target, 100));
Utils.Sleep(400, "Move");
}
}
}
}
Utils.Sleep(100, "activated");
}
A();
}
示例9: Game_OnUpdate
//.........这里部分代码省略.........
if (canCancel)
{
if (target != null && !target.IsVisible && !Orbwalking.AttackOnCooldown(target))
{
target = me.ClosestToMouseTarget(0x3e8);
}
}
if (target != null && target.IsAlive && !target.IsInvul() && !target.IsIllusion)
{
int attackrange = 0x276;
if (me.CanAttack() && me.CanCast())
{
if (arrows != null && arrows.IsValid && arrows.CanBeCasted() &&me.CanCast() && Utils.SleepCheck("arrows"))
{
arrows.UseAbility(target);
Utils.Sleep(50, "arrows");
}
if (strafe != null && strafe.IsValid && strafe.CanBeCasted() && me.CanCast() && me.Distance2D(target) <= 720 &&
Utils.SleepCheck("strafe"))
{
strafe.UseAbility();
Utils.Sleep(50 + Game.Ping, "strafe");
}
if (creepR.Count > 0 && !me.Modifiers.ToList().Exists(x => x.Name == "modifier_clinkz_death_pact"))
{
var creepmax = creepR.MaxOrDefault(x => x.Health);
me.Spellbook.SpellR.UseAbility(creepmax);
}
if (medallion != null && medallion.IsValid && medallion.CanBeCasted() && Utils.SleepCheck("medallion") && menuValue.IsEnabled(medallion.Name))
{
medallion.UseAbility(target);
Utils.Sleep(50 + Game.Ping, "medallion");
}
if (solar != null && solar.IsValid && solar.CanBeCasted() && Utils.SleepCheck("solar") && menuValue.IsEnabled(solar.Name))
{
solar.UseAbility(target);
Utils.Sleep(50 + Game.Ping, "solar");
}
if (bkb != null && bkb.IsValid && bkb.CanBeCasted() && Utils.SleepCheck("bkb") && menuValue.IsEnabled(bkb.Name) && me.Distance2D(target) <= 720)
{
bkb.UseAbility();
Utils.Sleep(150 + Game.Ping, "bkb");
}
if (hex != null && hex.IsValid && hex.CanBeCasted() && Utils.SleepCheck("hex") && menuValue.IsEnabled(hex.Name))
{
hex.CastStun(target);
Utils.Sleep(250 + Game.Ping, "hex");
return;
}
if (orchid != null && orchid.IsValid && orchid.CanBeCasted() && Utils.SleepCheck("orchid") && menuValue.IsEnabled(orchid.Name))
{
orchid.CastStun(target);
Utils.Sleep(250 + Game.Ping, "orchid");
return;
}
if (arrows == null || arrows.CanBeCasted() || !Utils.SleepCheck("arrows")
|| !Menu.Item("orbwalk").GetValue<bool>() || !(me.Distance2D(target) <= attackrange))
{
}
else
{
Orbwalking.Orbwalk(target);
Utils.Sleep(Game.Ping + 150, "arrows");
}
if (me.IsAttacking() || !(me.Distance2D(target) >= attackrange)
|| !Utils.SleepCheck("follow"))
{
return;
}
me.Move(Game.MousePosition);
Utils.Sleep(150 + Game.Ping, "follow");
}
else if (Utils.SleepCheck("strafe") && !arrows.CanBeCasted() && Utils.SleepCheck("arrows"))
{
me.Attack(target);
Utils.Sleep(150, "strafe");
}
}
else
{
me.Move(Game.MousePosition);
}
}
}