本文整理汇总了C#中Ability.IsAbilityBehavior方法的典型用法代码示例。如果您正苦于以下问题:C# Ability.IsAbilityBehavior方法的具体用法?C# Ability.IsAbilityBehavior怎么用?C# Ability.IsAbilityBehavior使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ability
的用法示例。
在下文中一共展示了Ability.IsAbilityBehavior方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Cast
public static bool Cast(Ability ability, Unit target, string name)
{
if (name == "razor_static_link" && target.Distance2D(AbilityMain.Me) > (ability.GetCastRange(name) * 0.75))
{
return false;
}
if (ability.IsAbilityBehavior(AbilityBehavior.UnitTarget, name))
{
Game.ExecuteCommand("dota_player_units_auto_attack_after_spell 0");
ManageAutoAttack.AutoAttackDisabled = true;
SoulRing.Cast(ability);
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))
{
Game.ExecuteCommand("dota_player_units_auto_attack_after_spell 0");
ManageAutoAttack.AutoAttackDisabled = true;
SoulRing.Cast(ability);
ability.UseAbility();
return true;
}
return false;
}
示例2: Create
public static Menu Create(string name, Ability ability)
{
var menu = new Menu(name, name, textureName: name);
if (!ability.IsAbilityBehavior(AbilityBehavior.NoTarget)
|| (name == "item_pipe" || name == "item_buckler" || name == "omniknight_guardian_angel"
|| name == "item_crimson_guard"))
{
menu.AddItem(Togglers.UseOnAllies(name));
}
menu.AddItem(Sliders.MissingHpMin(name));
menu.AddItem(Sliders.HpPercentBelow(name));
if (name == "item_pipe" || name == "item_buckler" || name == "omniknight_guardian_angel"
|| name == "item_crimson_guard")
{
menu.AddItem(
new MenuItem(name + "minalliesaffect", "Minimum affected allies: ").SetValue(
new StringList(new[] { "1", "2", "3", "4" }, 1)));
}
menu.AddItem(
new MenuItem(name + "minenemiesaround", "Minimum of enemies near: ").SetValue(
new StringList(new[] { "1", "2", "3", "4", "5" })));
menu.AddItem(
new MenuItem(name + "usenearbool", "Use when near selected enemy: ").SetValue(true)
.SetTooltip("Use the ability only when affected target is near selected enemy"));
menu.AddItem(Togglers.UseNear(name));
return menu;
}
示例3: Cast
public static bool Cast(Ability ability, Unit target, string name)
{
if (name == "item_tango" || name == "item_tango_single")
{
if (!target.Equals(AbilityMain.Me))
{
return false;
}
var closestTree =
ObjectMgr.GetEntities<Tree>()
.Where(x => x.IsAlive && x.IsVisible && x.Distance2D(target) < 250)
.MinOrDefault(x => x.Distance2D(target));
if (closestTree == null)
{
return false;
}
//Console.WriteLine(closestTree);
//ability.UseAbility(closestTree);
//Player.UseAbility(target, ability, closestTree);
return true;
}
if (ability.IsAbilityBehavior(AbilityBehavior.NoTarget, name))
{
Game.ExecuteCommand("dota_player_units_auto_attack_after_spell 1");
ManageAutoAttack.AutoAttackDisabled = true;
SoulRing.Cast(ability);
ability.UseAbility();
return true;
}
if (name == "abaddon_death_coil" && target.Equals(AbilityMain.Me))
{
return false;
}
SoulRing.Cast(ability);
Game.ExecuteCommand("dota_player_units_auto_attack_after_spell 1");
ManageAutoAttack.AutoAttackDisabled = true;
ability.UseAbility(target);
return true;
}
示例4: Cast
public static bool Cast(Ability ability, Unit target, string name)
{
if (ability.IsAbilityBehavior(AbilityBehavior.NoTarget, name))
{
Game.ExecuteCommand("dota_player_units_auto_attack_after_spell 0");
ManageAutoAttack.AutoAttackDisabled = true;
SoulRing.Cast(ability);
ability.UseAbility();
return true;
}
if ((name == "item_solar_crest" || name == "item_medallion_of_courage") && target.Equals(AbilityMain.Me))
{
return false;
}
SoulRing.Cast(ability);
Game.ExecuteCommand("dota_player_units_auto_attack_after_spell 0");
ManageAutoAttack.AutoAttackDisabled = true;
ability.UseAbility(target);
return true;
}
示例5: Cast
public static bool Cast(Ability ability, Unit target, string name)
{
if (name == "item_tango" || name == "item_tango_single")
{
return false;
//if (!target.Equals(AbilityMain.Me))
//{
// return false;
//}
//var closestTree =
// ObjectMgr.GetEntities<Entity>()
// .Where(x => x.Name == "ent_dota_tree" && x.Distance2D(target) < 250)
// .MinOrDefault(x => x.Distance2D(target)) as Tree;
//if (closestTree == null)
//{
// return false;
//}
//Player.UseAbility(AbilityMain.Me,ability,closestTree);
//ability.UseAbility(closestTree as Unit);
}
if (ability.IsAbilityBehavior(AbilityBehavior.NoTarget, name))
{
Game.ExecuteCommand("dota_player_units_auto_attack_after_spell 1");
ManageAutoAttack.AutoAttackDisabled = true;
SoulRing.Cast(ability);
ability.UseAbility();
return true;
}
if (name == "abaddon_death_coil" && target.Equals(AbilityMain.Me))
{
return false;
}
SoulRing.Cast(ability);
Game.ExecuteCommand("dota_player_units_auto_attack_after_spell 1");
ManageAutoAttack.AutoAttackDisabled = true;
ability.UseAbility(target);
return true;
}
示例6: AddRange
public static void AddRange(Ability ability, float crange = 0, bool visible = true)
{
var name = NameManager.Name(ability);
if (RangesDictionary.ContainsKey(ability))
{
return;
}
var castrange = crange;
if (castrange == 0)
{
castrange = ability.GetCastRange();
}
if (!ability.IsAbilityBehavior(AbilityBehavior.NoTarget))
{
castrange += Math.Max(castrange / 9, 80);
}
else
{
castrange += Math.Max(castrange / 7, 40);
}
// var list = new[] { "selected_ring", "drag_selected_ring", "hero_underglow" };
var menu = new Menu(name, name + "range", false, name);
menu.AddItem(new MenuItem(name + "rangeenable", "Show range")).SetValue(false).ValueChanged +=
(sender, args) => { RangeVisible(ability, args.GetNewValue<bool>()); };
menu.AddItem(new MenuItem(name + "red", "Red:"))
.SetFontStyle(fontColor: Color.Red)
.SetValue(new Slider(100, 0, 255))
.ValueChanged += (sender, args) =>
{
if (RangesDictionary.ContainsKey(ability))
{
RangesDictionary[ability].SetControlPoint(
1,
new Vector3(
args.GetNewValue<Slider>().Value,
menu.Item(name + "green").GetValue<Slider>().Value,
menu.Item(name + "blue").GetValue<Slider>().Value));
}
};
menu.AddItem(new MenuItem(name + "green", "Green:"))
.SetFontStyle(fontColor: Color.Green)
.SetValue(new Slider(100, 0, 255))
.ValueChanged += (sender, args) =>
{
if (RangesDictionary.ContainsKey(ability))
{
RangesDictionary[ability].SetControlPoint(
1,
new Vector3(
menu.Item(name + "red").GetValue<Slider>().Value,
args.GetNewValue<Slider>().Value,
menu.Item(name + "blue").GetValue<Slider>().Value));
}
};
menu.AddItem(new MenuItem(name + "blue", "Blue:"))
.SetFontStyle(fontColor: Color.Blue)
.SetValue(new Slider(100, 0, 255))
.ValueChanged += (sender, args) =>
{
if (RangesDictionary.ContainsKey(ability))
{
RangesDictionary[ability].SetControlPoint(
1,
new Vector3(
menu.Item(name + "red").GetValue<Slider>().Value,
menu.Item(name + "green").GetValue<Slider>().Value,
args.GetNewValue<Slider>().Value));
}
};
MainMenu.RangeDrawingMenu.AddSubMenu(menu);
var range = AbilityMain.Me.AddParticleEffect(@"particles\ui_mouseactions\drag_selected_ring.vpcf");
if (menu.Item(name + "rangeenable").GetValue<bool>())
{
range.SetControlPoint(
1,
new Vector3(
menu.Item(name + "red").GetValue<Slider>().Value,
menu.Item(name + "green").GetValue<Slider>().Value,
menu.Item(name + "blue").GetValue<Slider>().Value));
range.SetControlPoint(2, new Vector3(castrange, 255, 0));
range.SetControlPoint(3, new Vector3(10, 0, 0));
}
else
{
range.Dispose();
}
RangesValueDictionary.Add(name, castrange);
RangesDictionary.Add(ability, range);
}
示例7: RangeVisible
public static void RangeVisible(Ability ability, bool visible, float crange = 0)
{
var name = NameManager.Name(ability);
ParticleEffect range;
if (!RangesDictionary.TryGetValue(ability, out range) || RangesDictionary[ability] == null
|| RangesDictionary[ability].IsDestroyed)
{
range = AbilityMain.Me.AddParticleEffect(@"particles\ui_mouseactions\drag_selected_ring.vpcf");
if (!RangesDictionary.ContainsKey(ability))
{
RangesDictionary.Add(ability, range);
}
else
{
RangesDictionary[ability] = range;
}
}
var castrange = crange;
if (castrange == 0)
{
castrange = ability.GetCastRange();
}
if (!ability.IsAbilityBehavior(AbilityBehavior.NoTarget))
{
castrange += Math.Max(castrange / 9, 80);
}
else
{
castrange += Math.Max(castrange / 7, 40);
}
if (visible)
{
var menu = MainMenu.RangeDrawingMenu.SubMenu(name + "range");
range.SetControlPoint(
1,
new Vector3(
menu.Item(name + "red").GetValue<Slider>().Value,
menu.Item(name + "green").GetValue<Slider>().Value,
menu.Item(name + "blue").GetValue<Slider>().Value));
range.SetControlPoint(2, new Vector3(castrange, 255, 0));
range.SetControlPoint(3, new Vector3(10, 0, 0));
return;
}
RangesDictionary[ability].Dispose();
}
示例8: Cast
public static bool Cast(
Ability ability,
Unit target,
Unit buffTarget,
string name,
List<Modifier> modifiers,
bool togglearmlet = false)
{
if (name == "item_armlet")
{
if (buffTarget.Modifiers.Any(x => x.Name == "modifier_ice_blast"))
{
return false;
}
if (!togglearmlet && buffTarget.Distance2D(target) > Math.Max(target.GetAttackRange(), 500))
{
return false;
}
var armlettoggled = modifiers.Any(x => x.Name == "modifier_item_armlet_unholy_strength")
&& ability.IsToggled;
Game.ExecuteCommand("dota_player_units_auto_attack_after_spell 0");
ManageAutoAttack.AutoAttackDisabled = true;
if (armlettoggled)
{
ability.ToggleAbility();
ability.ToggleAbility();
return true;
}
ability.ToggleAbility();
return true;
}
if (!(buffTarget.Distance2D(target) < MyHeroInfo.AttackRange() + 150))
{
return false;
}
SoulRing.Cast(ability);
if (ability.Name == "templar_assassin_refraction")
{
var meld = AbilityMain.Me.Spellbook.Spell2;
if (meld != null && meld.CanBeCasted())
{
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();
if (Nuke.Cast(meld, target, NameManager.Name(meld)))
{
DelayAction.Add(
new DelayActionItem(
(int)meld.GetCastDelay(AbilityMain.Me, target) * 1000 + 100,
() =>
{
AbilityMain.Me.Attack(target);
},
CancellationToken.None));
}
Utils.Sleep(meld.GetCastDelay(AbilityMain.Me,target)*1000, "GlobalCasting");
Utils.Sleep(meld.GetHitDelay(target, name) * 1000 + 200, "casting");
Utils.Sleep(meld.GetHitDelay(target, name) * 1000 + 200, ability.Handle.ToString());
return true;
}
}
if (ability.IsAbilityBehavior(AbilityBehavior.NoTarget, name))
{
Game.ExecuteCommand("dota_player_units_auto_attack_after_spell 0");
ManageAutoAttack.AutoAttackDisabled = true;
ability.UseAbility();
return true;
}
Game.ExecuteCommand("dota_player_units_auto_attack_after_spell 0");
ManageAutoAttack.AutoAttackDisabled = true;
ability.UseAbility(buffTarget);
return true;
}
示例9: UseItem
private static async Task UseItem(Ability ability, Unit target, CancellationToken cancellationToken)
{
if (ComboSleeper.Sleeping("invisAction"))
return;
ComboSleeper.Sleep(150, ability);
if (ability.StoredName() == "item_armlet")
{
if (!Members.MyHero.HasModifier("modifier_item_armlet_unholy_strength"))
{
ability.ToggleAbility();
}
else
{
return;
}
}
else if (ability.IsAbilityBehavior(AbilityBehavior.NoTarget))
{
ability.UseAbility();
}
else if (ability.IsAbilityBehavior(AbilityBehavior.UnitTarget))
{
if (ability.TargetTeamType == TargetTeamType.Enemy || ability.TargetTeamType == TargetTeamType.All ||
ability.TargetTeamType == TargetTeamType.Custom)
{
ability.UseAbility(target);
}
else
{
ability.UseAbility(Members.MyHero);
}
}
Printer.Print($"[{(int) Game.RawGameTime}] [Item] {ability.Name}: {50}");
await Task.Delay(5, cancellationToken);
}
示例10: 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;
}
示例11: CastAbility
private static void CastAbility(Ability ability, float range)
{
if (ability == null || !ability.CanBeCasted() || ability.IsInAbilityPhase || target.IsMagicImmune() ||
!target.IsValidTarget(range, true, me.NetworkPosition) ||
!Menu.Item("abilities").GetValue<AbilityToggler>().IsEnabled(ability.Name)) return;
if (ability.IsAbilityBehavior(AbilityBehavior.UnitTarget))
{
ability.UseAbility(target);
return;
}
if (ability.IsAbilityBehavior(AbilityBehavior.NoTarget))
{
if (Equals(ability, slow))
{
ability.UseAbility();
Utils.Sleep(me.NetworkPosition.Distance2D(target.NetworkPosition)/800*1000, "slowsleep");
return;
}
ability.UseAbility();
}
}
示例12: Cast
public static bool Cast(Ability ability, Unit target, string name)
{
if (name == "razor_static_link" && target.Distance2D(AbilityMain.Me) > (ability.GetCastRange(name) * 0.75))
{
return false;
}
if (ability.IsAbilityBehavior(AbilityBehavior.UnitTarget, name))
{
Game.ExecuteCommand("dota_player_units_auto_attack_after_spell 0");
ManageAutoAttack.AutoAttackDisabled = true;
SoulRing.Cast(ability);
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;
if (ability.ClassID == ClassID.CDOTA_Item_SentryWard)
{
var sentry =
ObjectMgr.GetEntities<Entity>()
.FirstOrDefault(
x =>
x.ClassID == ClassID.CDOTA_NPC_Observer_Ward_TrueSight && x.Distance2D(target) < 700);
if (sentry != null)
{
return false;
}
var tower = EnemyTowers.Towers.FirstOrDefault(x => x.Distance2D(target) < 800);
if (tower != null)
{
return false;
}
}
var casted = ability.CastSkillShot(target, name, SoulRing.Check(ability) ? MyAbilities.SoulRing : null);
if (casted)
{
if (ability.ClassID == ClassID.CDOTA_Item_SentryWard)
{
Utils.Sleep(20000, ability.Handle.ToString());
}
return true;
}
return false;
}
if (ability.IsAbilityBehavior(AbilityBehavior.NoTarget, name))
{
Game.ExecuteCommand("dota_player_units_auto_attack_after_spell 0");
ManageAutoAttack.AutoAttackDisabled = true;
SoulRing.Cast(ability);
ability.UseAbility();
return true;
}
return false;
}
示例13: UseSpell
private static void UseSpell(Ability spellForCast, Unit target,Hero me,bool itsall=false)
{
var targ = target?.Position ?? Game.MousePosition;
if (spellForCast.IsAbilityBehavior(AbilityBehavior.Point))
{
spellForCast.UseAbility(targ);
return;
}
if (spellForCast.IsAbilityBehavior(AbilityBehavior.NoTarget))
{
spellForCast.UseAbility();
return;
}
if (!spellForCast.IsAbilityBehavior(AbilityBehavior.UnitTarget)) return;
if (spellForCast.TargetTeamType == TargetTeamType.Enemy || spellForCast.TargetTeamType == TargetTeamType.All || spellForCast.TargetTeamType == TargetTeamType.Custom)
{
if (target != null)
spellForCast.UseAbility(target);
}
else
{
spellForCast.UseAbility(itsall?target:me);
}
}