當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。