本文整理汇总了C#中Hero.GetTurnTime方法的典型用法代码示例。如果您正苦于以下问题:C# Hero.GetTurnTime方法的具体用法?C# Hero.GetTurnTime怎么用?C# Hero.GetTurnTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hero
的用法示例。
在下文中一共展示了Hero.GetTurnTime方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
int lastAttackStart;
LastAttackStart.TryGetValue(me.Handle,out lastAttackStart);
return lastAttackStart + UnitDatabase.GetAttackRate(me)*1000 - Game.Ping - turnTime*1000 - 75
+ bonusWindupMs > _tick;
}
示例3: 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");
}
示例4: Game_OnUpdate
public static void Game_OnUpdate(EventArgs args)
{
me = ObjectMgr.LocalHero;
if (me == null || !Game.IsInGame || Game.IsWatchingGame)
return;
if (me.ClassID != ClassID.CDOTA_Unit_Hero_Tinker)
return;
// Ability init
Laser = me.Spellbook.Spell1;
Rocket = me.Spellbook.Spell2;
Refresh = me.Spellbook.Spell4;
// Item init
Blink = me.FindItem("item_blink");
Dagon = me.GetDagon();
Hex = me.FindItem("item_sheepstick");
Soulring = me.FindItem("item_soul_ring");
Ethereal = me.FindItem("item_ethereal_blade");
Veil = me.FindItem("item_veil_of_discord");
Orchid = me.FindItem("item_orchid");
Shiva = me.FindItem("item_shiva");
// Manacost calculations
var manaForCombo = Laser.ManaCost + Rocket.ManaCost;
if (Dagon != null && Dagon.CanBeCasted())
manaForCombo += 180;
if (Hex != null && Hex.CanBeCasted())
manaForCombo += 100;
if (Ethereal != null && Ethereal.CanBeCasted())
manaForCombo += 150;
if (Veil != null && Veil.CanBeCasted())
manaForCombo += 50;
// Main combo
if (active && toggle)
{
target = me.ClosestToMouseTarget(1000);
if (target != null && target.IsAlive && !target.IsIllusion && !target.IsMagicImmune() && Utils.SleepCheck("refresh") && !Refresh.IsChanneling)
{
if (Soulring != null && me.Mana < manaForCombo && Soulring.CanBeCasted() && me.Health > 400 && Utils.SleepCheck("soulring"))
{
Soulring.UseAbility();
Utils.Sleep(150 + Game.Ping, "soulring");
}
// Blink
else if (Blink != null && Blink.CanBeCasted() && Utils.SleepCheck("blink"))
{
Utils.Sleep(300 + Game.Ping, "blink");
Utils.ChainStun(me, me.GetTurnTime(target) * 1000 + Game.Ping, null, false);
Blink.UseAbility(target.Position);
}
// Items
else if (Veil != null && Veil.CanBeCasted() && Utils.SleepCheck("veil"))
{
Veil.UseAbility(target.Position);
Utils.Sleep(150 + Game.Ping, "veil");
Utils.Sleep(300 + Game.Ping, "ve");
Utils.ChainStun(me, 170 + Game.Ping, null, false);
}
else if (Hex != null && Hex.CanBeCasted() && Utils.SleepCheck("hex"))
{
Hex.UseAbility(target);
Utils.Sleep(150 + Game.Ping, "hex");
Utils.Sleep(300 + Game.Ping, "h");
Utils.ChainStun(me, 170 + Game.Ping, null, false);
}
else if (Ethereal != null && Ethereal.CanBeCasted() && Utils.SleepCheck("ethereal"))
{
Ethereal.UseAbility(target);
Utils.Sleep(270 + Game.Ping, "ethereal");
Utils.ChainStun(me, 200 + Game.Ping, null, false);
}
else if (Dagon != null && Dagon.CanBeCasted() && Utils.SleepCheck("ethereal") && Utils.SleepCheck("h") && Utils.SleepCheck("dagon") && Utils.SleepCheck("veil"))
{
Dagon.UseAbility(target);
Utils.Sleep(270 + Game.Ping, "dagon");
Utils.ChainStun(me, 200 + Game.Ping, null, false);
}
// Skills
else if (Rocket != null && Rocket.CanBeCasted() && Utils.SleepCheck("rocket") && Utils.SleepCheck("ethereal") && Utils.SleepCheck("veil"))
{
Rocket.UseAbility();
Utils.Sleep(150 + Game.Ping, "rocket");
Utils.ChainStun(me, 150 + Game.Ping, null, false);
}
else if (Laser != null && Laser.CanBeCasted() && Utils.SleepCheck("laser") && Utils.SleepCheck("ethereal") && Utils.SleepCheck("rocket"))
{
Laser.UseAbility(target);
Utils.Sleep(150 + Game.Ping, "laser");
Utils.ChainStun(me, 150 + Game.Ping, null, false);
//.........这里部分代码省略.........
示例5: GetCastDelay
/// <summary>
/// Returns delay before ability is casted
/// </summary>
/// <param name="ability"></param>
/// <param name="source"></param>
/// <param name="target"></param>
/// <param name="usePing"></param>
/// <param name="useCastPoint"></param>
/// <returns></returns>
public static double GetCastDelay(
this Ability ability,
Hero source,
Unit target,
bool usePing = false,
bool useCastPoint = true)
{
double delay;
if (useCastPoint)
{
if (!DelayDictionary.TryGetValue(ability.Name + " " + ability.Level, out delay))
{
delay = Math.Max(ability.FindCastPoint(), 0.05);
AbilityInfo data;
if (!AbilityDamage.DataDictionary.TryGetValue(ability, out data))
{
data = AbilityDatabase.Find(ability.Name);
AbilityDamage.DataDictionary.Add(ability, data);
}
delay += data.AdditionalDelay;
DelayDictionary.Add(ability.Name + " " + ability.Level, delay);
}
if ((ability.Name == "item_diffusal_blade" || ability.Name == "item_diffusal_blade_2"))
{
delay += 2;
}
}
else
{
delay = 0.08;
}
if (usePing)
{
delay += Game.Ping / 1000;
}
//Console.WriteLine(ability.GetChannelTime(ability.Level - 1) + " " + delay + " " + ability.Name);
delay += ability.GetChannelTime(ability.Level - 1);
if (!ability.AbilityBehavior.HasFlag(AbilityBehavior.NoTarget))
{
return delay + (useCastPoint ? source.GetTurnTime(target) : source.GetTurnTime(target) / 2);
}
return delay;
}
示例6: 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;
}
示例7: Tick
//.........这里部分代码省略.........
}
else
auto_atack_after_spell = false;
if (Game.GetConsoleVar("dota_player_units_auto_attack").GetInt() == 1)
{
Game.ExecuteCommand("dota_player_units_auto_attack 0");
auto_atack = true;
}
else
auto_atack = false;
Utils.Sleep(Game.Ping + 50, "auto_atack_change");
stage_combo2 = 1;
}
if (stage_combo2 == 1 && Utils.SleepCheck("EskillSleep") && Utils.SleepCheck("auto_atack_change"))
{
if (Eskill.CanBeCasted() && stone_peoples.FirstOrDefault().NetworkPosition.Distance2D(me) >= 180)
{
Eskill.UseAbility(stone_peoples.FirstOrDefault().NetworkPosition);
Utils.Sleep(Game.Ping, "EskillSleep");
}
else
stage_combo2 = 2;
}
else if (stage_combo2 == 2)
{
if (Wskill.CanBeCasted())
{
int DelayCombo = 0;
if (stone_peoples.FirstOrDefault().NetworkPosition.Distance2D(stone_peoples.FirstOrDefault().NetworkPosition / me.NetworkPosition * 100) < 200)
DelayCombo = 150 - (int)Game.Ping;
else
DelayCombo = 400 - (int)Game.Ping;
Wskill.UseAbility(Mouse_Position);
Utils.Sleep(Game.Ping + DelayCombo + (me.GetTurnTime(Mouse_Position) * 100), "PerfectDelay");
}
else
stage_combo2 = 3;
}
else if (stage_combo2 == 3 && Utils.SleepCheck("PerfectDelay"))
{
if (Qskill.CanBeCasted())
Qskill.UseAbility(Mouse_Position);
else
{
stage_combo2 = 0;
key_active_2 = false;
if (auto_atack_after_spell)
{
Game.ExecuteCommand("dota_player_units_auto_attack_after_spell 1");
auto_atack_after_spell = false;
}
if (auto_atack)
{
auto_atack = false;
Game.ExecuteCommand("dota_player_units_auto_attack 1");
}
}
}
}
if (stone_peoples.FirstOrDefault() == null || !me.CanCast())
{
stage_combo2 = 0;
key_active_2 = false;
if (auto_atack_after_spell)
{
Game.ExecuteCommand("dota_player_units_auto_attack_after_spell 1");
示例8: Execute
//.........这里部分代码省略.........
{
continue;
}
if (category == "silence"
&& Silences.SilencesMenuDictionary[name].Item(name + "minManaCheckCombo")
.GetValue<Slider>()
.Value < mana && !Silence.Cast(ability, target, name))
{
continue;
}
if (category == "special"
&& Specials.SpecialsMenuDictionary[name].Item(name + "minManaCheckCombo")
.GetValue<Slider>()
.Value < mana && !Special.Cast(ability, target, name))
{
continue;
}
if (category == "buff"
&& Buffs.BuffsMenuDictionary[name].Item(name + "minManaCheckCombo").GetValue<Slider>().Value
< mana
&& (name == "item_armlet" || name == "item_satanic"
|| !Buff.Cast(ability, target, me, name)))
{
continue;
}
if (Utils.SleepCheck(ability.Handle.ToString()))
{
dealtDamage += AbilityDamage.CalculateDamage(ability, me, target);
}
var delay = Math.Max(ability.GetCastDelay(me, target, abilityName: name), 0.2) * 1000;
switch (name)
{
case "riki_blink_strike":
Utils.Sleep(MyHeroInfo.AttackRate() * 1000, handleString);
break;
case "necrolyte_reapers_scythe":
Utils.Sleep(delay + ping + 1500, "calculate");
break;
case "necrolyte_death_pulse":
Utils.Sleep(delay + ping + 200, "calculate");
break;
case "item_ethereal_blade":
etherealHitTime =
(float)
(Environment.TickCount + me.GetTurnTime(target) * 1000
+ Prediction.CalculateReachTime(target, 1200, target.Position - me.Position)
+ ping * 2);
Utils.Sleep(
me.GetTurnTime(target) * 1000 + 100
+ (MyHeroInfo.Position.Distance2D(target) / 1200) * 1000 + ping,
"calculate");
break;
case "tusk_snowball":
Utils.Sleep(
me.GetTurnTime(target) * 1000
+ (MyHeroInfo.Position.Distance2D(target) / 675) * 1000,
"GlobalCasting");
break;
case "ancient_apparition_cold_feet":
coldFeetLastUse = Environment.TickCount + 4000;
break;
}
if (ability.ChannelTime(name) > 0)
{
Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "cancelorder");
Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 4, "GlobalCasting");
Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 4, "casting");
}
Utils.Sleep(delay, handleString);
Utils.Sleep(
ability.GetCastDelay(me, target, abilityName: name, useCastPoint: false) * 1000,
"GlobalCasting");
Utils.Sleep(ability.GetHitDelay(target, name) * 1000, "calculate");
Utils.Sleep(
Math.Max(ability.GetCastDelay(me, target, useCastPoint: false, abilityName: name), 0.15)
* 1000 + Game.Ping,
// + (Math.Max(me.Distance2D(target) - ability.GetCastRange(name) - 50, 0)
// / me.MovementSpeed) * 1000,
"casting");
Utils.Sleep(delay, "cancelorder");
if (name == "pudge_rot")
{
continue;
}
return true;
}
}
}
return false;
}
示例9: AutoUsage
public static bool AutoUsage(
Hero enemyHero,
Hero[] enemyHeroes,
float meMissingHp,
float ping,
Hero me,
float mana)
{
var hero = enemyHero;
var heroName = NameManager.Name(hero);
var heroDistance = MyHeroInfo.Position.Distance2D(hero);
if (Utils.SleepCheck("GlobalCasting") && Utils.SleepCheck("casting"))
{
if (me.ClassID == ClassID.CDOTA_Unit_Hero_Tusk
&& Dictionaries.InDamageDictionary.ContainsKey(hero.Handle)
&& (Dictionaries.OutDamageDictionary[hero.Handle] + Dictionaries.InDamageDictionary[hero.Handle])
>= enemyHero.Health && Utils.SleepCheck("tusk_snowball") && heroDistance <= 1350
&& me.FindSpell("tusk_snowball").CanBeCasted())
{
if (!Nuke.Cast(me.FindSpell("tusk_snowball"), hero, "tusk_snowball"))
{
return false;
}
DelayAction.Add(
new DelayActionItem(300, () => { AbilityMain.LaunchSnowball(); }, CancellationToken.None));
Utils.Sleep(100 + me.GetTurnTime(hero) * 1000 + ping, "tusk_snowball");
Utils.Sleep(me.GetTurnTime(hero) * 1000 + (heroDistance / 675) * 1000 + 100, "GlobalCasting");
Utils.Sleep(me.GetTurnTime(hero) * 1000 + (heroDistance / 675) * 1000 + 100, "calculate");
Utils.Sleep(me.GetTurnTime(hero) * 1000 + (heroDistance / 675) * 1000, "cancelorder");
return true;
}
foreach (var data in
MyAbilities.OffensiveAbilities.Where(
x =>
x.Value.IsValid
&& (x.Value.CanBeCasted()
|| (x.Value.CanBeCasted(SoulRing.ManaGained) && SoulRing.Check(x.Value)))
&& ((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)))
.OrderBy(x => ComboOrder.GetAbilityOrder(x.Value)))
{
var ability = data.Value;
var name = NameManager.Name(ability);
var category = data.Key.Substring(name.Length);
var handleString = ability.Handle.ToString();
if (category != "buff" && hero.IsMagicImmune() && ability.ImmunityType != (ImmunityType)3)
{
continue;
}
if (!CastingChecks.All(name, hero))
{
continue;
}
var delay = ability.GetCastDelay(me, hero, useCastPoint: false, abilityName: name) * 1000;
var canHit = ability.CanHit(hero, MyHeroInfo.Position, name);
if (name == "omniknight_purification")
{
if (Nukes.NukesMenuDictionary[name].Item(name + "minManaCheck").GetValue<Slider>().Value < mana
&& MainMenu.Menu.Item("nukesToggler").GetValue<AbilityToggler>().IsEnabled(name)
&& Nukes.NukesMenuDictionary[name].Item(name + "herotoggler")
.GetValue<HeroToggler>()
.IsEnabled(heroName)
&& (etherealHitTime < (Environment.TickCount + ability.GetHitDelay(hero, name) * 1000))
&& hero.Health
> Nukes.NukesMenuDictionary[name].Item(NameManager.Name(ability) + "minhealthslider")
.GetValue<Slider>()
.Value && CastingChecks.Killsteal(ability, hero, name))
{
var target = FindPurificationTarget(hero);
if (target != null && ability.CanHit(target, MyHeroInfo.Position, name)
&& target.PredictedPosition().Distance2D(hero.PredictedPosition())
< ability.GetRadius(name)
&& target.PredictedPosition()
.Distance2D(
hero.PredictedPosition(ability.FindCastPoint(NameManager.Name(ability))))
< ability.GetRadius(name))
{
if (Nuke.Cast(ability, target, name))
{
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;
}
}
}
return false;
}
//.........这里部分代码省略.........
示例10: KillSteal
//.........这里部分代码省略.........
if (!ability.CanHit(possibleTarget, MyHeroInfo.Position, name)
|| (name == "zuus_thundergods_wrath"
&& (1
+ enemyHeroes.Count(
x =>
!x.Equals(possibleTarget)
&& x.Health <= AbilityDamage.CalculateDamage(ability, me, x)))
< Nukes.NukesMenuDictionary[name].Item(name + "minenemykill").GetValue<Slider>().Value)
|| !MainMenu.Menu.Item("nukesToggler").GetValue<AbilityToggler>().IsEnabled(name)
|| !Nukes.NukesMenuDictionary[name].Item(name + "herotoggler")
.GetValue<HeroToggler>()
.IsEnabled(NameManager.Name(possibleTarget))
|| !Nuke.Cast(ability, possibleTarget, name))
{
return false;
}
if (Utils.SleepCheck(handleString))
{
dealtDamage += AbilityDamage.CalculateDamage(ability, me, possibleTarget);
if (possibleTarget.Health - dealtDamage <= 0)
{
Utils.Sleep(
ability.GetHitDelay(possibleTarget, name) * 1000 + 500,
possibleTarget.Handle + "KillSteal");
}
}
var delay = ability.GetCastDelay(me, possibleTarget, abilityName: name) * 1000;
if (name == "riki_blink_strike")
{
Utils.Sleep(MyHeroInfo.AttackRate() * 1000, handleString);
}
if (name == "necrolyte_reapers_scythe")
{
Utils.Sleep(delay + ping + 1500, "calculate");
}
if (name == "necrolyte_death_pulse")
{
Utils.Sleep(delay + ping + 200, "calculate");
}
if (name == "item_ethereal_blade")
{
// Utils.Sleep(
// Me.GetTurnTime(possibleTarget) * 1000
// + Prediction.CalculateReachTime(
// possibleTarget,
// 1200,
// possibleTarget.Position - MyHeroInfo.Position),
// "casting");
etherealHitTime =
(float)
(Environment.TickCount + me.GetTurnTime(possibleTarget) * 1000
+ Prediction.CalculateReachTime(
possibleTarget,
1200,
possibleTarget.Position - MyHeroInfo.Position) + ping * 2);
Utils.Sleep(
me.GetTurnTime(possibleTarget) * 1000 + 100
+ (MyHeroInfo.Position.Distance2D(possibleTarget) / 1200) * 1000 + ping,
"calculate");
}
if (name == "tusk_snowball")
{
Utils.Sleep(
me.GetTurnTime(possibleTarget) * 1000
+ (MyHeroInfo.Position.Distance2D(possibleTarget) / 675) * 1000,
"GlobalCasting");
}
Utils.Sleep(delay, handleString);
Utils.Sleep(
ability.GetCastDelay(me, possibleTarget, useCastPoint: false, abilityName: name) * 1000,
"GlobalCasting");
Utils.Sleep(ability.GetHitDelay(possibleTarget, name) * 1000, "calculate");
Utils.Sleep(
ability.GetCastDelay(me, possibleTarget, useCastPoint: false, abilityName: name) * 1000,
// + (Math.Max(Me.Distance2D(possibleTarget) - ability.GetCastRange(name) - 50, 0)
// / Me.MovementSpeed) * 1000,
"casting");
Utils.Sleep(delay, "cancelorder");
return true;
}
return true;
}
}
// else if (MyAbilities.NukesCombo.Any())
// {
// MyAbilities.NukesCombo = new List<Ability>();
// }
return false;
}
示例11: 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;
}
示例12: GetCastDelay
/// <summary>
/// Returns delay before ability is casted
/// </summary>
/// <param name="ability"></param>
/// <param name="source"></param>
/// <param name="target"></param>
/// <param name="usePing"></param>
/// <param name="useCastPoint"></param>
/// <param name="abilityName"></param>
/// <param name="useChannel"></param>
/// <returns></returns>
public static double GetCastDelay(
this Ability ability,
Hero source,
Unit target,
bool usePing = false,
bool useCastPoint = true,
string abilityName = null,
bool useChannel = false)
{
var name = abilityName ?? ability.StoredName();
var delay = 0d;
if (useCastPoint)
{
if (!DelayDictionary.TryGetValue(name + " " + ability.Level, out delay))
{
delay = Math.Max(ability.FindCastPoint(name), 0.07);
DelayDictionary.Add(name + " " + ability.Level, delay);
}
if (name == "templar_assassin_meld")
{
delay += UnitDatabase.GetAttackPoint(source) + Game.Ping / 500 + 0.1 + source.GetTurnTime(target);
}
if (name == "item_diffusal_blade" || name == "item_diffusal_blade_2")
{
delay += 2;
}
}
else
{
if (ability is Item)
{
delay = 0;
}
else
{
delay = 0.05;
}
}
if (usePing)
{
delay += Game.Ping / 1000;
}
if (useChannel)
{
delay += ability.ChannelTime(name);
}
if (!ability.IsAbilityBehavior(AbilityBehavior.NoTarget, name))
{
return Math.Max(delay + (!target.Equals(source) ? source.GetTurnTime(target) : 0), 0);
}
return Math.Max(delay, 0);
}
示例13: Game_OnUpdate
//.........这里部分代码省略.........
}
if (me.Spellbook.SpellW.CanBeCasted() && Utils.SleepCheck("Wfarm"))
{
me.Spellbook.SpellW.UseAbility(Wcreep);
Utils.Sleep(200 + Game.Ping, "Wfarm");
}
}
}
}
if ((Menu.Item("active").GetValue<KeyBind>().Active || Menu.Item("harass").GetValue<KeyBind>().Active) && !Menu.Item("confirmSteal").GetValue<KeyBind>().Active && me.IsAlive)
{
if (target != null && target.IsAlive && !target.IsInvul())
{
var haslinken = target.FindItem("item_sphere");
var linkedsph = (haslinken != null && haslinken.Cooldown == 0) ||
(target.Modifiers.Any(x => x.Name == "modifier_item_sphere_target"));
var targetPos = (target.Position - me.Position)*
(me.Distance2D(target) - Menu.Item("saferange").GetValue<Slider>().Value)/
me.Distance2D(target) + me.Position;
var ghostform = target.Modifiers.Any(x => x.Name == "modifier_ghost_state" ||
x.Name == "modifier_item_ethereal_blade_ethereal" ||
x.Name == "modifier_pugna_decrepify");
if (
blink != null &&
blink.CanBeCasted() &&
(me.Distance2D(target) < blinkrange + Menu.Item("saferange").GetValue<Slider>().Value) &&
(me.Distance2D(target) > realWrange) &&
Utils.SleepCheck("blink1") && Menu.Item("blink").GetValue<bool>() &&
Menu.Item("active").GetValue<KeyBind>().Active
)
{
blink.UseAbility(targetPos);
Utils.Sleep(me.GetTurnTime(targetPos) + Game.Ping*2, "blink1");
}
if (soulring != null && soulring.CanBeCasted() && me.Health > me.MaximumHealth * 0.4 && Utils.SleepCheck("soulring") && me.Distance2D(target) < realWrange)
{
soulring.UseAbility();
Utils.Sleep(Game.Ping, "soulring");
}
if (arcane != null &&
(me.Mana < me.Spellbook.Spell2.ManaCost ||
(me.Mana < refresherComboManacost && Menu.Item("refresherToggle").GetValue<bool>() &&
refresher.CanBeCasted())) && arcane.CanBeCasted() && Utils.SleepCheck("arcane"))
{
arcane.UseAbility();
Utils.Sleep(Game.Ping, "arcane");
}
if (sheepstick != null && sheepstick.CanBeCasted() && !target.IsMagicImmune() && !target.IsIllusion && !linkedsph && !target.IsHexed() && !target.IsStunned() &&
Utils.SleepCheck("sheepstick") && Menu.Item("active").GetValue<KeyBind>().Active && menuValue.IsEnabled(sheepstick.Name))
{
sheepstick.UseAbility(target);
Utils.Sleep(50+Game.Ping, "sheepstick");
}
if (orchid != null && orchid.CanBeCasted() && !target.IsMagicImmune() && !target.IsIllusion && !linkedsph &&
!target.IsHexed() && Utils.SleepCheck("orchid") && menuValue.IsEnabled(orchid.Name))
{
orchid.UseAbility(target);
Utils.Sleep(50+Game.Ping, "orchid");
}
if (veil != null && veil.CanBeCasted() && !target.IsMagicImmune() && !target.IsIllusion &&