本文整理汇总了C#中Hero.GetAttackRange方法的典型用法代码示例。如果您正苦于以下问题:C# Hero.GetAttackRange方法的具体用法?C# Hero.GetAttackRange怎么用?C# Hero.GetAttackRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hero
的用法示例。
在下文中一共展示了Hero.GetAttackRange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawRanges
public static void DrawRanges(EventArgs args)
{
if (!Game.IsInGame || Game.IsWatchingGame)
return;
me = ObjectMgr.LocalHero;
if (me == null)
return;
if (Menu.Item("menurange_arrow").GetValue<bool>())
{
if (Menu.Item("AutoMode").GetValue<bool>())
{
if (me.ClassID == ClassID.CDOTA_Unit_Hero_Nevermore)
range_arrow = 700;
else if (me.ClassID == ClassID.CDOTA_Unit_Hero_Slark)
range_arrow = 700;
else if (me.ClassID == ClassID.CDOTA_Unit_Hero_Mirana)
{
if (me.Spellbook.SpellE.Level == 1)
range_arrow = 600;
else if (me.Spellbook.SpellE.Level == 2)
range_arrow = 700;
else if (me.Spellbook.SpellE.Level == 3)
range_arrow = 800;
else if (me.Spellbook.SpellE.Level == 4)
range_arrow = 900;
else
range_arrow = (int)me.GetAttackRange();
}
else if (me.FindItem("item_force_staff")!=null || me.FindItem("item_hurricane_pike")!=null)
range_arrow = 600;
else
range_arrow = (int)me.GetAttackRange();
}
else
range_arrow = Menu.Item("menurange_own").GetValue<Slider>().Value;
if (rangedisplay == null)
{
rangedisplay = new ParticleEffect(@"particles\ui_mouseactions\range_finder_directional_b.vpcf", me);
rangedisplay.SetControlPoint(1, me.NetworkPosition);
rangedisplay.SetControlPoint(2, FindVector(me.NetworkPosition, me.Rotation, range_arrow));
}
else
{
rangedisplay.SetControlPoint(1, me.NetworkPosition);
rangedisplay.SetControlPoint(2, FindVector(me.NetworkPosition, me.Rotation, range_arrow));
}
}
else if (rangedisplay!=null)
{
rangedisplay.Dispose();
rangedisplay = null;
}
}
示例2: BestAutoAttackTarget
/// <summary>
/// Find enemy hero that takes least hits to kill
/// </summary>
/// <param name="source">Source hero</param>
/// <returns></returns>
public static Hero BestAutoAttackTarget(Hero source)
{
var attackRange = source.GetAttackRange();
var enemyHeroes =
ObjectMgr.GetEntities<Hero>()
.Where(
x =>
x.Team == source.GetEnemyTeam() && !x.IsIllusion && x.IsAlive && x.IsVisible
&& x.Distance2D(source) <= (attackRange + x.HullRadius + source.HullRadius + 50));
var aaDmg = source.MinimumDamage + source.BonusDamage;
Hero bestTarget = null;
var lastHitsToKill = 0f;
foreach (var enemyHero in enemyHeroes)
{
var takenDmg = enemyHero.DamageTaken(aaDmg, DamageType.Physical, source, false);
var hitsToKill = enemyHero.Health / takenDmg;
if (bestTarget != null && !(lastHitsToKill > hitsToKill))
{
continue;
}
bestTarget = enemyHero;
lastHitsToKill = hitsToKill;
}
return bestTarget;
}
示例3: BestAutoAttackTarget
/// <summary>
/// Find enemy hero that takes least hits to kill
/// </summary>
/// <param name="source">Source hero</param>
/// <param name="bonusRange"></param>
/// <returns></returns>
public static Hero BestAutoAttackTarget(Hero source, float bonusRange = 0)
{
var attackRange = source.GetAttackRange();
var enemyHeroes =
Heroes.All.Where(
x =>
x.IsValid && x.Team != source.Team && x.IsAlive && x.IsVisible
&& x.Distance2D(source) <= attackRange + x.HullRadius + bonusRange + source.HullRadius + 50);
var aaDmg = source.MinimumDamage + source.BonusDamage;
Hero bestTarget = null;
var lastHitsToKill = 0f;
foreach (var enemyHero in enemyHeroes)
{
var takenDmg = enemyHero.DamageTaken(aaDmg, DamageType.Physical, source, false);
var hitsToKill = enemyHero.Health / takenDmg;
if (bestTarget != null && !(lastHitsToKill > hitsToKill))
{
continue;
}
bestTarget = enemyHero;
lastHitsToKill = hitsToKill;
}
return bestTarget;
}
示例4: GetLowestHPCreep
/// <summary>
/// Checks for lowest hp creep in attack range
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public static Unit GetLowestHPCreep(Hero source)
{
try
{
var attackRange = source.GetAttackRange();
var lowestHp =
ObjectMgr.GetEntities<Unit>()
.Where(
x =>
(x.ClassID == ClassID.CDOTA_BaseNPC_Tower || x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Lane
|| x.ClassID == ClassID.CDOTA_BaseNPC_Creep
|| x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Neutral
|| x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege
|| x.ClassID == ClassID.CDOTA_BaseNPC_Additive
|| x.ClassID == ClassID.CDOTA_BaseNPC_Barracks
|| x.ClassID == ClassID.CDOTA_BaseNPC_Building
|| x.ClassID == ClassID.CDOTA_BaseNPC_Creature) && x.IsAlive && x.IsVisible
&& x.Team != source.Team && x.Distance2D(source) < (attackRange + 100))
.OrderBy(creep => creep.Health)
.DefaultIfEmpty(null)
.FirstOrDefault();
return lowestHp;
}
catch (Exception)
{
//no
}
return null;
}
示例5: AD
//.........这里部分代码省略.........
//break special (1 hex, 2 cyclone)
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Riki && me.Modifiers.Any(y => y.Name == "modifier_riki_smoke_screen")
|| e.ClassID == ClassID.CDOTA_Unit_Hero_SpiritBreaker && e.Modifiers.Any(y => y.Name == "modifier_spirit_breaker_charge_of_darkness")
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Phoenix && e.Modifiers.Any(y => y.Name == "modifier_phoenix_icarus_dive")
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Magnataur && e.Modifiers.Any(y => y.Name == "modifier_magnataur_skewer_movement")
//break rats shadow blades and invis (1 hex, 2 seal, 3 cyclone)
|| e.IsMelee && me.Distance2D(e) <= 350 //test
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Legion_Commander && e.FindSpell("legion_commander_duel").Cooldown < 2 && me.Distance2D(e) < 480 && !me.IsAttackImmune()
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Tiny && me.Distance2D(e) <= 350
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Pudge && me.Distance2D(e) <= 350
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Nyx_Assassin && me.Distance2D(e) <= 350
|| e.ClassID == ClassID.CDOTA_Unit_Hero_BountyHunter && me.Distance2D(e) <= 350
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Nevermore && me.Distance2D(e) <= 350
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Weaver && me.Distance2D(e) <= 350 && !me.IsAttackImmune()
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Riki && me.Distance2D(e) <= 350 && !me.IsAttackImmune()
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Clinkz && me.Distance2D(e) <= 350 && !me.IsAttackImmune()
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Broodmother && me.Distance2D(e) <= 350 && !me.IsAttackImmune()
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Slark && me.Distance2D(e) <= 350 && !me.IsAttackImmune()
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Ursa && me.Distance2D(e) <= 350 && !me.IsAttackImmune()
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Earthshaker && (e.Spellbook.SpellQ.Cooldown<=1 || e.Spellbook.SpellR.Cooldown<=1)
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Alchemist && me.Distance2D(e) <= 350 && !me.IsAttackImmune()
|| e.ClassID == ClassID.CDOTA_Unit_Hero_TrollWarlord && me.Distance2D(e) <= 350 && !me.IsAttackImmune()
//break rats blinkers (1 hex, 2 seal, 3 cyclone)
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Ursa && me.Distance2D(e) <= 350 && !me.IsAttackImmune()
|| e.ClassID == ClassID.CDOTA_Unit_Hero_PhantomAssassin && me.Distance2D(e) <= 350 && !me.IsAttackImmune()
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Riki && me.Distance2D(e) <= 350 && !me.IsAttackImmune()
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Spectre && me.Distance2D(e) <= 350 && !me.IsAttackImmune()
|| e.ClassID == ClassID.CDOTA_Unit_Hero_AntiMage && me.Distance2D(e) <= 350 && !me.IsAttackImmune()
|| e.ClassID == ClassID.CDOTA_Unit_Hero_TemplarAssassin && me.Distance2D(e) <= e.GetAttackRange()+50 && !me.IsAttackImmune()
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Morphling && me.Distance2D(e) <= e.GetAttackRange()+50 && !me.IsAttackImmune()
|| e.ClassID == ClassID.CDOTA_Unit_Hero_QueenOfPain && me.Distance2D(e) <= 800+aetherrange + ensage_error
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Puck && me.Distance2D(e) <= 800+aetherrange + ensage_error
|| e.ClassID == ClassID.CDOTA_Unit_Hero_StormSpirit && me.Distance2D(e) <= 800+aetherrange + ensage_error
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Phoenix && me.Distance2D(e) <= 800+aetherrange + ensage_error
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Magnataur && me.Distance2D(e) <= 800+aetherrange + ensage_error
|| e.ClassID == ClassID.CDOTA_Unit_Hero_FacelessVoid && me.Distance2D(e) <= 800+aetherrange + ensage_error
//break mass dangerous spells (1 hex, 2 seal, 3 cyclone)
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Necrolyte && e.FindSpell("necrolyte_reapers_scythe").IsInAbilityPhase
|| e.ClassID == ClassID.CDOTA_Unit_Hero_FacelessVoid && e.FindSpell("faceless_void_chronosphere").IsInAbilityPhase
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Magnataur && e.FindSpell("magnataur_reverse_polarity").IsInAbilityPhase
|| e.ClassID == ClassID.CDOTA_Unit_Hero_DoomBringer && e.FindSpell("doom_bringer_doom").IsInAbilityPhase
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Tidehunter && e.FindSpell("tidehunter_ravage").IsInAbilityPhase
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Enigma && e.FindSpell("enigma_black_hole").IsInAbilityPhase
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Rattletrap && e.FindSpell("rattletrap_power_cogs").IsInAbilityPhase
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Luna && e.FindSpell("luna_eclipse").IsInAbilityPhase
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Nevermore && e.FindSpell("nevermore_requiem").IsInAbilityPhase
|| e.ClassID == ClassID.CDOTA_Unit_Hero_SpiritBreaker && e.FindSpell("spirit_breaker_nether_strike").IsInAbilityPhase
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Naga_Siren && e.FindSpell("naga_siren_song_of_the_siren").IsInAbilityPhase
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Medusa && e.FindSpell("medusa_stone_gaze").IsInAbilityPhase
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Treant && e.FindSpell("treant_overgrowth").IsInAbilityPhase
|| e.ClassID == ClassID.CDOTA_Unit_Hero_AntiMage && e.FindSpell("antimage_mana_void").IsInAbilityPhase
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Warlock && e.FindSpell("warlock_rain_of_chaos").IsInAbilityPhase
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Terrorblade && e.FindSpell("terrorblade_sunder").IsInAbilityPhase
|| e.ClassID == ClassID.CDOTA_Unit_Hero_DarkSeer && e.FindSpell("dark_seer_wall_of_replica").IsInAbilityPhase
|| e.ClassID == ClassID.CDOTA_Unit_Hero_DarkSeer && e.FindSpell("dark_seer_surge").IsInAbilityPhase
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Dazzle && e.FindSpell("dazzle_shallow_grave").IsInAbilityPhase
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Omniknight && e.FindSpell("omniknight_guardian_angel").IsInAbilityPhase
|| e.ClassID == ClassID.CDOTA_Unit_Hero_Omniknight && e.FindSpell("omniknight_repel").IsInAbilityPhase
示例6: Player_OnExecuteAction
//.........这里部分代码省略.........
var a = tpos.ToVector2().FindAngleBetween(target.NetworkPosition.ToVector2(), true);
safeRange -= (int)me.HullRadius;
p13 = new Vector3(
tpos.X + (safeRange + closeRange) * (float)Math.Cos(a),
tpos.Y + (safeRange + closeRange) * (float)Math.Sin(a),
100);
}
else
{
var tpos = me.NetworkPosition;
var a = tpos.ToVector2().FindAngleBetween(target.NetworkPosition.ToVector2(), true);
var uncloseRange = me.NetworkPosition.Distance2D(target.NetworkPosition) - closeRange;
safeRange -= (int)me.HullRadius;
p13 = new Vector3(
tpos.X + uncloseRange * (float)Math.Cos(a),
tpos.Y + uncloseRange * (float)Math.Sin(a),
100);
}
blink.UseAbility(p13);
//Utils.Sleep(250, "Blinks");
}*/
else
elsecount += 1;
if (!me.IsChanneling()
&& me.CanAttack()
&& !target.IsAttackImmune()
&& !me.Spellbook.Spells.Any(x => x.IsInAbilityPhase)
&& OneHitLeft(target)
&& target.NetworkPosition.Distance2D(me) <= me.GetAttackRange()+50
//&& Utils.SleepCheck("attack")
//&& Utils.SleepCheck("Blinks")
)
{
me.Attack(target);
//Orbwalking.Orbwalk(target);
//Utils.Sleep(250, "attack");
}
else
elsecount += 1;
if (target.IsLinkensProtected() && Utils.SleepCheck("combo2"))
{
if (forcestaff != null && forcestaff.CanBeCasted() )
forcestaff.UseAbility(target);
else if (cyclone != null && cyclone.CanBeCasted() )
cyclone.UseAbility(target);
else if (Laser.Level >= 1 && Laser.CanBeCasted() )
Laser.UseAbility(target);
Utils.Sleep(200, "combo2");
}
else
{
/*
if (sheep != null && sheep.CanBeCasted() && Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(sheep.Name) && magicimune )
{
示例7: 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");
}
示例8: Game_OnUpdate
//.........这里部分代码省略.........
} // Q Skill end
if ( //R Skill
R != null
&& (medallModiff
|| e.IsMagicImmune()
|| medall == null)
&& R.CanBeCasted()
&& me.CanCast()
&& !linkens
&& Menu.Item("Skills").GetValue<AbilityToggler>().IsEnabled(R.Name)
&& me.Distance2D(e) <= 350
&& Utils.SleepCheck("R")
)
{
R.UseAbility(e);
Utils.Sleep(150, "R");
} // R Skill end
if (urn != null && urn.CanBeCasted() && urn.CurrentCharges > 0 && me.Distance2D(e) <= 800 &&
Menu.Item("Items").GetValue<AbilityToggler>().IsEnabled(urn.Name) && Utils.SleepCheck("urn"))
{
urn.UseAbility(e);
Utils.Sleep(240, "urn");
}
float angle = me.FindAngleBetween(e.Position, true);
Vector3 pos = new Vector3((float) (e.Position.X + 50*Math.Cos(angle)), (float) (e.Position.Y + 50*Math.Sin(angle)),
0);
if (
blink != null
&& Q.CanBeCasted()
&& me.CanCast()
&& blink.CanBeCasted()
&& me.Distance2D(e) >= me.GetAttackRange()+me.HullRadius+150
&& me.Distance2D(pos) <= 1190
&& Menu.Item("Items").GetValue<AbilityToggler>().IsEnabled(blink.Name)
&& Utils.SleepCheck("blink")
)
{
blink.UseAbility(pos);
Utils.Sleep(250, "blink");
}
if ( // Abyssal Blade
abyssal != null
&& abyssal.CanBeCasted()
&& me.CanCast()
&& !e.IsStunned()
&& !e.IsHexed()
&& Utils.SleepCheck("abyssal")
&& Menu.Item("Items").GetValue<AbilityToggler>().IsEnabled(abyssal.Name)
&& me.Distance2D(e) <= 400
)
{
abyssal.UseAbility(e);
Utils.Sleep(250, "abyssal");
} // Abyssal Item end
if ( // E Skill
E != null
&& E.CanBeCasted()
&& me.CanCast()
&& ModifW
&& Menu.Item("Skills").GetValue<AbilityToggler>().IsEnabled(E.Name)
&& !e.IsMagicImmune()
&& Utils.SleepCheck("E")
&& me.Distance2D(e) <= 200
)
示例9: Game_OnUpdate
private static void Game_OnUpdate(EventArgs args)
{
if (!_isloaded)
{
_me = ObjectManager.LocalHero;
if (!Game.IsInGame || _me == null)
{
return;
}
// Auto Attack Checker
//_autoAttackAfterSpell = Game.GetConsoleVar("dota_player_units_auto_attack_after_spell").GetInt();
//_autoAttack = Game.GetConsoleVar("dota_player_units_auto_attack").GetInt();
// Auto Attack Checker
_lastRange = _me.GetAttackRange();
_isloaded = true;
_rangeDisplay = null;
_target = null;
}
if (_me == null || !_me.IsValid)
{
_isloaded = false;
_me = ObjectManager.LocalHero;
if (_rangeDisplay == null)
{
return;
}
_rangeDisplay = null;
_target = null;
return;
}
if (Game.IsPaused || Game.IsChatOpen)
{
return;
}
if (_target != null && (!_target.IsValid || !_target.IsVisible || !_target.IsAlive || _target.Health <= 0))
{
_target = null;
}
_q = _me.Spellbook.SpellQ;
_w = _me.Spellbook.SpellW;
_e = _me.Spellbook.SpellE;
_r = _me.Spellbook.SpellR;
double apoint = 0;
apoint = _me.ClassID == ClassID.CDOTA_Unit_Hero_ArcWarden
? 0.3
: UnitDatabase.Units.Find(x => x.UnitName == _me.Name).AttackPoint;
_aPoint = apoint / (1 + _me.AttacksPerSecond * _me.BaseAttackTime / 100) * 500;
_outrange = Menu.Item("outrange").GetValue<Slider>().Value;
if (_me.ClassID == ClassID.CDOTA_Unit_Hero_TrollWarlord)
_attackRange = _q.IsToggled ? 128 : _me.GetAttackRange();
else
_attackRange = _me.GetAttackRange();
var wait = false;
if (_target != null && !_target.IsVisible && !Orbwalking.AttackOnCooldown(_target))
{
_target = _me.ClosestToMouseTarget(500);
}
else if (_target == null || !Orbwalking.AttackOnCooldown(_target))
{
var bestAa = _me.BestAATarget();
if (bestAa != null)
{
_target = _me.BestAATarget();
}
}
if (Menu.Item("showatkrange").GetValue<bool>())
{
if (_rangeDisplay == null)
{
if (_me.IsAlive)
{
_rangeDisplay = _me.AddParticleEffect(@"particles\ui_mouseactions\drag_selected_ring.vpcf");
_rangeDisplay.SetControlPoint(1, new Vector3(255, 80, 50));
_rangeDisplay.SetControlPoint(3, new Vector3(20, 0, 0));
_rangeDisplay.SetControlPoint(2, new Vector3(_lastRange, 255, 0));
}
}
else
{
if (!_me.IsAlive)
{
_rangeDisplay.Dispose();
_rangeDisplay = null;
}
else if (_lastRange != _attackRange)
{
_rangeDisplay.Dispose();
_lastRange = _attackRange;
_rangeDisplay = _me.AddParticleEffect(@"particles\ui_mouseactions\drag_selected_ring.vpcf");
_rangeDisplay.SetControlPoint(1, new Vector3(255, 80, 50));
//.........这里部分代码省略.........
示例10: GetLowestHPCreep
/// <summary>
/// Checks for lowest hp creep in attack range
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public static Unit GetLowestHPCreep(Hero source, float bonusRange = 0)
{
try
{
var attackRange = source.GetAttackRange() + bonusRange;
var lowestHp =
Creeps.All.Where(
x => x.IsSpawned &&
(x.ClassID == ClassID.CDOTA_BaseNPC_Tower || x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Lane
|| x.ClassID == ClassID.CDOTA_BaseNPC_Creep || x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Neutral
|| x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege
|| x.ClassID == ClassID.CDOTA_BaseNPC_Additive || x.ClassID == ClassID.CDOTA_BaseNPC_Barracks
|| x.ClassID == ClassID.CDOTA_BaseNPC_Building || x.ClassID == ClassID.CDOTA_BaseNPC_Creature)
&& x.IsAlive && x.IsVisible && x.Team != source.Team && x.Distance2D(source) < attackRange + 100)
.OrderBy(creep => creep.Health)
.DefaultIfEmpty(null)
.FirstOrDefault();
return lowestHp;
}
catch (Exception)
{
// no
}
return null;
}
示例11: Execute
public static bool Execute(
Hero target,
Hero[] enemyHeroes,
float ping,
bool onlyDamage,
bool onlyDisable,
Hero me,
float mana)
{
var toggler = MainMenu.ComboKeysMenu.Item("comboAbilitiesToggler").GetValue<AbilityToggler>();
if (Utils.SleepCheck("UpdateCombo"))
{
MyAbilities.Combo =
MyAbilities.OffensiveAbilities.Where(
x => x.Value.IsValid && x.Value.Owner.Equals(me) && toggler.IsEnabled(NameManager.Name(x.Value)))
.OrderBy(x => ComboOrder.GetComboOrder(x.Value, onlyDisable));
Utils.Sleep(500, "UpdateCombo");
}
if (Utils.SleepCheck("casting") && MyAbilities.Combo != null)
{
if (target != null)
{
if (Dictionaries.HitDamageDictionary.ContainsKey(target.Handle)
&& Dictionaries.HitDamageDictionary[target.Handle] * 1.5 >= target.Health
&& target.Distance2D(MyHeroInfo.Position) <= me.GetAttackRange() + 150)
{
return false;
}
if (!Utils.SleepCheck(target.Handle + "KeyCombo"))
{
return false;
}
if (AbilityMain.Me.ClassID == ClassID.CDOTA_Unit_Hero_TemplarAssassin)
{
var r = MyAbilities.Combo.FirstOrDefault(x => x.Key == "templar_assassin_psionic_trapslow");
var modifier = target.FindModifier("modifier_templar_assassin_trap_slow");
if (modifier == null || modifier.RemainingTime < r.Value.GetHitDelay(target))
{
Slow.TemplarAssasinUseTrap(target);
}
}
if (me.ClassID == ClassID.CDOTA_Unit_Hero_Tinker && toggler.IsEnabled("tinker_rearm")
&& MyAbilities.TinkerRearm.CanBeCasted() && Utils.SleepCheck("Ability.TinkerRearm")
&& !MyAbilities.Combo.Any(
x =>
x.Value.CanBeCasted()
|| (x.Value.CanBeCasted(SoulRing.ManaGained) && SoulRing.Check(x.Value))))
{
MyAbilities.TinkerRearm.UseAbility();
Utils.Sleep(
MyAbilities.TinkerRearm.FindCastPoint() * 1000 + Game.Ping
+ MyAbilities.TinkerRearm.GetChannelTime(MyAbilities.TinkerRearm.Level - 1) * 1000 + 500,
"Ability.TinkerRearm");
Utils.Sleep(
MyAbilities.TinkerRearm.FindCastPoint() * 1000 + Game.Ping
+ MyAbilities.TinkerRearm.GetChannelTime(MyAbilities.TinkerRearm.Level - 1) * 1000,
"GlobalCasting");
Utils.Sleep(
MyAbilities.TinkerRearm.FindCastPoint() * 1000 + Game.Ping
+ MyAbilities.TinkerRearm.GetChannelTime(MyAbilities.TinkerRearm.Level - 1) * 1000,
"casting");
Utils.Sleep(
MyAbilities.TinkerRearm.FindCastPoint() * 1000 + Game.Ping
+ MyAbilities.TinkerRearm.GetChannelTime(MyAbilities.TinkerRearm.Level - 1) * 1000,
"cancelorder");
return true;
}
foreach (var data in
MyAbilities.Combo.Where(
x =>
x.Value.IsValid
&& (x.Value.CanBeCasted()
|| (x.Value.CanBeCasted(SoulRing.ManaGained) && SoulRing.Check(x.Value)))
&& !x.Value.IsAbilityBehavior(AbilityBehavior.Hidden)
&& ((x.Value is Item && me.CanUseItems()) || (!(x.Value is Item) && me.CanCast()))
&& (Utils.SleepCheck(x.Value.Handle.ToString())
|| (!x.Value.IsInAbilityPhase && x.Value.FindCastPoint() > 0))))
{
var ability = data.Value;
var name = NameManager.Name(ability);
var category = (name == "lion_impale") ? "disable" : data.Key.Substring(name.Length);
// if (category == "special" || category == "buff")
// {
// continue;
// }
// if (onlyDamage && (category == "disable" || category == "slow" || category == "silence"))
// {
// continue;
// }
// if (onlyDisable && (category == "nuke" || category == "harras"))
// {
// continue;
// }
if (category != "buff" && target.IsMagicImmune() && ability.ImmunityType != (ImmunityType)3)
//.........这里部分代码省略.........
示例12: AutoUsage
//.........这里部分代码省略.........
// "casting");
etherealHitTime =
(float)
(Environment.TickCount + me.GetTurnTime(hero) * 1000
+ Prediction.CalculateReachTime(hero, 1200, hero.Position - MyHeroInfo.Position)
+ ping);
Utils.Sleep(
me.GetTurnTime(hero) * 1000 + 100
+ (MyHeroInfo.Position.Distance2D(hero) / 1200) * 1000 + ping,
"calculate");
}
if (ability.ChannelTime(name) > 0)
{
Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "cancelorder");
Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "casting");
}
Utils.Sleep(
ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100,
handleString);
Utils.Sleep(delay, "GlobalCasting");
Utils.Sleep(delay, "cancelorder");
// Utils.Sleep(ping, "killsteal");
return true;
}
continue;
}
if (Dictionaries.HitDamageDictionary.ContainsKey(hero.Handle)
&& Dictionaries.HitDamageDictionary[hero.Handle] * 1.5 >= hero.Health
&& hero.Distance2D(MyHeroInfo.Position) <= me.GetAttackRange() + 150)
{
continue;
}
if (category == "disable"
&& Disables.DisablesMenuDictionary[name].Item(name + "minManaCheck").GetValue<Slider>().Value
< mana && MainMenu.Menu.Item("disablesToggler").GetValue<AbilityToggler>().IsEnabled(name))
{
if (
Disables.DisablesMenuDictionary[name].Item(name + "onsighttoggler")
.GetValue<HeroToggler>()
.IsEnabled(heroName) && canHit && Disable.Cast(ability, hero, name))
{
if (ability.ChannelTime(name) > 0)
{
Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "cancelorder");
Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "casting");
}
Utils.Sleep(
ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100,
handleString);
Utils.Sleep(delay, "GlobalCasting");
Utils.Sleep(delay, "cancelorder");
return true;
}
if (
Disables.DisablesMenuDictionary[name].Item(name + "onchainstuntoggler")
.GetValue<HeroToggler>()
.IsEnabled(heroName) && canHit && CastingChecks.ChainStun(ability, hero, name)
&& Disable.Cast(ability, hero, name))
示例13: AttackOnCooldown
private static bool AttackOnCooldown(Hero me, Entity target = null, float bonusWindupMs = 0)
{
if (me == null)
{
return false;
}
var turnTime = 0d;
if (target != null)
{
//turnTime = me.GetTurnTime(target);
turnTime = me.GetTurnTime(target)
+ Math.Max(me.Distance2D(target) - me.GetAttackRange() - 100, 0) / me.MovementSpeed;
}
int lastAttackStart;
LastAttackStart.TryGetValue(me.Handle,out lastAttackStart);
return lastAttackStart + UnitDatabase.GetAttackRate(me)*1000 - Game.Ping - turnTime*1000 - 75
+ bonusWindupMs >= _tick;
}
示例14: Main
//.........这里部分代码省略.........
rangedisplay_aura.SetControlPoint(1, new Vector3(100, 100, 255));
rangedisplay_aura.SetControlPoint(2, new Vector3(range_aura, 255, 0));
}
if(rangedisplay_exp == null)
rangedisplay_exp = me.AddParticleEffect(@"particles\ui_mouseactions\drag_selected_ring.vpcf");
if (menurange_exp)
{
range_exp = 1300 + 130;
rangedisplay_exp.SetControlPoint(1, new Vector3(111, 111, 111));
rangedisplay_exp.SetControlPoint(2, new Vector3(range_exp, 255, 0));
}
if (menurange_own)
{
if(rangedisplay_own == null)
{
rangedisplay_own = me.AddParticleEffect(@"particles\ui_mouseactions\drag_selected_ring.vpcf");
range_own = menurange_own_amount;
rangedisplay_own.SetControlPoint(1, new Vector3(0, 255, 0));
rangedisplay_own.SetControlPoint(2, new Vector3(range_own+range_own/4, 255, 0));
}
}
if (menurange_own2)
{
if(rangedisplay_own2 == null)
{
rangedisplay_own2 = me.AddParticleEffect(@"particles\ui_mouseactions\drag_selected_ring.vpcf");
range_own2 = menurange_own_amount2;
rangedisplay_own2.SetControlPoint(1, new Vector3(255, 255, 255));
rangedisplay_own2.SetControlPoint(2, new Vector3(range_own2+range_own2/6, 255, 0));
}
}
if (menurange_own3)
{
if(rangedisplay_own3 == null)
{
rangedisplay_own3 = me.AddParticleEffect(@"particles\ui_mouseactions\drag_selected_ring.vpcf");
range_own3 = menurange_own_amount3;
rangedisplay_own3.SetControlPoint(1, new Vector3(255, 255, 0));
rangedisplay_own3.SetControlPoint(2, new Vector3(range_own3+range_own3/8, 255, 0));
}
}
if (menurange_atck)
{
if(rangedisplay_atck == null)
{
rangedisplay_atck = me.AddParticleEffect(@"particles\ui_mouseactions\drag_selected_ring.vpcf");
range_atck = me.GetAttackRange() + 100;
rangedisplay_atck.SetControlPoint(1, new Vector3(200, 0, 0));
rangedisplay_atck.SetControlPoint(2, new Vector3(range_atck, 255, 0));
}
}
var alens = me.FindItem("item_aether_lens");
if (alens == null)
_alens = false;
else
_alens = true;
if (menurange_dagger)
{
if (!_alens)
{
if(rangedisplay_dagger == null)
{
rangedisplay_dagger = me.AddParticleEffect(@"particles\ui_mouseactions\drag_selected_ring.vpcf");
range_dagger = 1200 + 130;
rangedisplay_dagger.SetControlPoint(1, new Vector3(99, 255, 255));
rangedisplay_dagger.SetControlPoint(2, new Vector3(range_dagger, 255, 0));
}
}
if (_alens)
{
if(rangedisplay_dagger == null)
{
rangedisplay_dagger = me.AddParticleEffect(@"particles\ui_mouseactions\drag_selected_ring.vpcf");
range_dagger = 1200 + 130 + 200;
rangedisplay_dagger.SetControlPoint(1, new Vector3(99, 255, 255));
rangedisplay_dagger.SetControlPoint(2, new Vector3(range_dagger, 255, 0));
}
}
}
}
示例15: GetAllLowestHpCreep
public static Unit GetAllLowestHpCreep(Hero source)
{
try
{
var attackRange = source.GetAttackRange();
var lowestHp =
ObjectManager.GetEntities<Unit>()
.Where(
x =>
(x.ClassID == ClassID.CDOTA_BaseNPC_Tower ||
x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Lane
|| x.ClassID == ClassID.CDOTA_BaseNPC_Creep
|| x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Neutral
|| x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege
|| x.ClassID == ClassID.CDOTA_BaseNPC_Additive
|| x.ClassID == ClassID.CDOTA_BaseNPC_Barracks
|| x.ClassID == ClassID.CDOTA_BaseNPC_Building
|| x.ClassID == ClassID.CDOTA_BaseNPC_Creature) && x.IsAlive && x.IsVisible
&& x.Distance2D(source) < attackRange + _outrange)
.OrderBy(creep => creep.Health)
.DefaultIfEmpty(null)
.FirstOrDefault();
return lowestHp;
}
catch (Exception)
{
Console.WriteLine("Error GetLowestHpCreep");
}
return null;
}