本文整理汇总了C#中Ability.GetCastDelay方法的典型用法代码示例。如果您正苦于以下问题:C# Ability.GetCastDelay方法的具体用法?C# Ability.GetCastDelay怎么用?C# Ability.GetCastDelay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ability
的用法示例。
在下文中一共展示了Ability.GetCastDelay方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UseAbility
private static async Task UseAbility(Ability ability, Unit target, CancellationToken cancellationToken,
int extraDelay = 0)
{
if (ability.CanBeCasted() && ability.CanHit(target) && Helper.IsAbilityEnable(ability.StoredName()))
{
var cPont = ability.GetCastDelay(Members.MyHero, target, true)*1000 + 250;
switch (ability.StoredName())
{
case "riki_smoke_screen":
ability.UseAbility(Prediction.PredictedXYZ(target, (float) cPont));
break;
default:
ability.UseAbility(target);
break;
}
Printer.Print($"[{(int) Game.RawGameTime}] [Ability] {ability.Name}: {cPont}");
await Task.Delay((int) cPont, cancellationToken);
}
else
{
//Printer.Print($"[CANT]: ({ability.Name})");
}
}
示例2: Cast
public static bool Cast(Ability ability, Unit target, string name)
{
if (target.Modifiers.Any(x => x.Name == "modifier_item_blade_mail_reflect")
&& AbilityDamage.CalculateDamage(ability, AbilityMain.Me, target) > AbilityMain.Me.Health)
{
return false;
}
if (target.Modifiers.Any(x => x.Name == "modifier_nyx_assassin_spiked_carapace"))
{
return false;
}
if (ability.Name == "sniper_assassinate")
{
if (AbilityMain.Me.Distance2D(target) <= AbilityMain.Me.GetAttackRange() + 100)
{
return false;
}
}
if (ability.IsAbilityBehavior(AbilityBehavior.UnitTarget, name) && ability.Name != "lion_impale")
{
Game.ExecuteCommand("dota_player_units_auto_attack_after_spell 0");
ManageAutoAttack.AutoAttackDisabled = true;
SoulRing.Cast(ability);
if (name == "omniknight_purification")
{
ability.UseAbility(AbilityMain.Me);
}
ability.UseAbility(target);
return true;
}
if ((ability.IsAbilityBehavior(AbilityBehavior.AreaOfEffect, name)
|| ability.IsAbilityBehavior(AbilityBehavior.Point, name))
&& (Prediction.StraightTime(target) > 1000 || target.MovementSpeed < 200))
{
Game.ExecuteCommand("dota_player_units_auto_attack_after_spell 0");
ManageAutoAttack.AutoAttackDisabled = true;
return ability.CastSkillShot(target, name, SoulRing.Check(ability) ? MyAbilities.SoulRing : null);
}
if (ability.IsAbilityBehavior(AbilityBehavior.NoTarget, name))
{
if (ability.Name == "templar_assassin_meld")
{
if (
!(target.Distance2D(MyHeroInfo.Position)
< (AbilityMain.Me.GetAttackRange() + 50 + target.HullRadius + AbilityMain.Me.HullRadius))
|| Orbwalking.AttackOnCooldown(target) || AbilityMain.Me.IsAttacking()
|| (target.Predict(Game.Ping).Distance2D(MyHeroInfo.Position)
> (AbilityMain.Me.GetAttackRange() + 50 + target.HullRadius + AbilityMain.Me.HullRadius))
|| !Utils.SleepCheck("GlobalCasting"))
{
return false;
}
Game.ExecuteCommand("dota_player_units_auto_attack_after_spell 0");
ManageAutoAttack.AutoAttackDisabled = true;
ability.UseAbility();
DelayAction.Add(
new DelayActionItem(
(int)ability.GetCastDelay(AbilityMain.Me, target)*1000,
() =>
{
AbilityMain.Me.Attack(target);
},
CancellationToken.None));
Utils.Sleep(ability.GetCastDelay(AbilityMain.Me, target) * 1000, "GlobalCasting");
Utils.Sleep(ability.GetCastDelay(AbilityMain.Me, target) * 1000 + 200, "casting");
Utils.Sleep(ability.GetCastDelay(AbilityMain.Me, target) * 1000 + 200, "Ability.Move");
return true;
}
if (ability.Name.Contains("nevermore_shadowraze"))
{
Game.ExecuteCommand("dota_player_units_auto_attack_after_spell 0");
ManageAutoAttack.AutoAttackDisabled = true;
return ability.CastSkillShot(target, name);
}
SoulRing.Cast(ability);
Game.ExecuteCommand("dota_player_units_auto_attack_after_spell 0");
ManageAutoAttack.AutoAttackDisabled = true;
ability.UseAbility();
return true;
}
return false;
}
示例3: useAbility
private static bool useAbility(Ability ability, string codeWord, Hero target, bool isPos, Hero me)
{
if (ability == null)
{
return true;
}
if (ability.CanBeCasted() && !ability.IsInAbilityPhase && Utils.SleepCheck(codeWord))
{
if (target != null)
{
if (isPos)
{
ability.UseAbility(target.Position);
}
else
{
ability.UseAbility(target);
}
}
else
{
ability.UseAbility();
}
Utils.Sleep(ability.GetCastDelay(me, target, true) * 1000, codeWord);
if (ability.CanBeCasted())
{
return false;
}
}
return true;
}