当前位置: 首页>>代码示例>>C#>>正文


C# Ability.GetCastDelay方法代码示例

本文整理汇总了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})");
            }
        }
开发者ID:JumpAttacker,项目名称:EnsageSharp,代码行数:25,代码来源:Core.cs

示例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;
 }
开发者ID:dendimonster,项目名称:EnsageSharp,代码行数:82,代码来源:Nuke.cs

示例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;
			}
开发者ID:oleg9522,项目名称:Ensage,代码行数:31,代码来源:Program.cs


注:本文中的Ability.GetCastDelay方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。