本文整理汇总了C#中Hero.HasModifiers方法的典型用法代码示例。如果您正苦于以下问题:C# Hero.HasModifiers方法的具体用法?C# Hero.HasModifiers怎么用?C# Hero.HasModifiers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hero
的用法示例。
在下文中一共展示了Hero.HasModifiers方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
/// <summary>
/// The execute.
/// </summary>
/// <param name="hero">
/// The hero.
/// </param>
/// <returns>
/// The <see cref="bool" />.
/// </returns>
public bool Execute(Hero hero)
{
if ((Variables.Instance.Techies.EnabledHeroes.ContainsKey(hero.ClassID)
&& !Variables.Instance.Techies.EnabledHeroes[hero.ClassID]) || hero.IsInvul() || hero.IsMagicImmune()
|| hero.HasModifiers(
new[]
{
"modifier_juggernaut_blade_fury",
"modifier_ember_spirit_sleight_of_fist_caster_invulnerability"
},
false) || !hero.CanDie())
{
return false;
}
if (!Utils.SleepCheck(hero.ClassID + "Techies.AutoDetonate"))
{
return false;
}
var tempDamage = hero.GetStackDamage();
if (!(tempDamage.Item1 >= hero.Health))
{
return false;
}
if (tempDamage.Item3 != null && tempDamage.Item3.AutoDetonate)
{
Detonate(tempDamage.Item2);
Utils.Sleep(500, hero.ClassID + "Techies.AutoDetonate");
return true;
}
if (tempDamage.Item3 == null || tempDamage.Item3.AutoDetonate
|| !Variables.Menu.DrawingsMenu.Item("Techies.ShowNotification").GetValue<bool>())
{
return false;
}
if (!Utils.SleepCheck("Techies.Notification." + hero.StoredName()))
{
return false;
}
Utils.Sleep(15000, "Techies.Notification." + hero.StoredName());
if (this.notification == null)
{
this.notification = new Notification(
5000,
new Vector2(HUDInfo.ScreenSizeX(), (float)(HUDInfo.ScreenSizeY() / 2.3)),
new Vector2(HUDInfo.ScreenSizeX() / 8, HUDInfo.ScreenSizeX() / 30));
}
this.notification.RemoteMines = tempDamage.Item2;
this.notification.PopUp(hero);
return false;
}
示例2: GetAttackRate
/// <summary>
/// Gets the attack rate.
/// </summary>
/// <param name="unit">
/// The unit.
/// </param>
/// <returns>
/// The <see cref="double" />.
/// </returns>
public static double GetAttackRate(Hero unit)
{
try
{
var attackSpeed = GetAttackSpeed(unit);
double attackBaseTime;
if (!AttackRateDictionary.TryGetValue(unit.Handle, out attackBaseTime))
{
attackBaseTime =
Game.FindKeyValues(unit.StoredName() + "/AttackRate", KeyValueSource.Hero).FloatValue;
AttackRateDictionary.Add(unit.Handle, attackBaseTime);
}
Ability spell = null;
if (
!unit.HasModifiers(
new[]
{
"modifier_alchemist_chemical_rage", "modifier_terrorblade_metamorphosis",
"modifier_lone_druid_true_form", "modifier_troll_warlord_berserkers_rage"
},
false))
{
return attackBaseTime / (1 + ((attackSpeed - 100) / 100));
}
switch (unit.ClassID)
{
case ClassID.CDOTA_Unit_Hero_Alchemist:
spell = unit.Spellbook.Spells.First(x => x.StoredName() == "alchemist_chemical_rage");
break;
case ClassID.CDOTA_Unit_Hero_Terrorblade:
spell = unit.Spellbook.Spells.First(x => x.StoredName() == "terrorblade_metamorphosis");
break;
case ClassID.CDOTA_Unit_Hero_LoneDruid:
spell = unit.Spellbook.Spells.First(x => x.StoredName() == "lone_druid_true_form");
break;
case ClassID.CDOTA_Unit_Hero_TrollWarlord:
spell = unit.Spellbook.Spells.First(x => x.StoredName() == "troll_warlord_berserkers_rage");
break;
}
if (spell == null)
{
return attackBaseTime / (1 + (attackSpeed - 100) / 100);
}
attackBaseTime = spell.GetAbilityData("base_attack_time");
return attackBaseTime / (1 + (attackSpeed - 100) / 100);
}
catch (KeyValuesNotFoundException)
{
if (!Utils.SleepCheck("Ensage.Common.DemoModeWarning"))
{
return 0;
}
Utils.Sleep(10000, "Ensage.Common.DemoModeWarning");
Console.WriteLine(@"[[Please do not use demo mode for testing assemblies]]");
return 0;
}
}
示例3: CastCombo
private static void CastCombo(Hero globalTarget, Ability laser, Ability rockets, bool singleCombo = false)
{
var myInventory = Members.MyHero.Inventory.Items.ToList();
var allItems = myInventory.Where(x =>
Helper.IsItemEnable(x.StoredName()) && x.CanBeCasted()).ToList();
var distance = Members.MyHero.Distance2D(globalTarget);
var daggerCastRange = 1150 + (myInventory.Any(x => x.StoredName() == "item_aether_lens") ? 200 : 0);
var inventory =
allItems.Where(
x =>
((x.StoredName() == "item_blink" && distance <= daggerCastRange + CloseRange) ||
(x.GetCastRange() > 0 && x.CanHit(globalTarget) /* && distance <= x.GetCastRange() + 150*/) ||
(x.GetCastRange() <= 0)) && Utils.SleepCheck($"{x.Handle}+item_usages"))
.ToList();
if (laser != null && Helper.IsAbilityEnable(laser.StoredName()) && laser.CanBeCasted() &&
laser.CanHit(globalTarget) && !_spellSleeper.Sleeping(laser))
{
laser.UseAbility(globalTarget);
_spellSleeper.Sleep(1000, laser);
}
var slarkMod = globalTarget.HasModifiers(new[] { "modifier_slark_dark_pact", "modifier_slark_dark_pact_pulses" }, false);
foreach (var item in inventory.OrderByDescending(Helper.PriorityHelper))
{
var name = item.StoredName();
if (name == "item_ethereal_blade")
_ethereal.Sleep(1000);
if (name.Contains("dagon"))
if (_ethereal.Sleeping && !globalTarget.HasModifier("modifier_item_ethereal_blade_ethereal"))
continue;
if (item.IsAbilityBehavior(AbilityBehavior.NoTarget))
{
item.UseAbility();
}
else if (item.IsAbilityBehavior(AbilityBehavior.UnitTarget))
if (item.TargetTeamType == TargetTeamType.Enemy || item.TargetTeamType == TargetTeamType.All ||
item.TargetTeamType == TargetTeamType.Custom)
{
if (item.IsDisable())
{
if (!slarkMod && !globalTarget.IsLinkensProtected())
item.UseAbility(globalTarget);
/*if (item.CastStun(globalTarget))
{
Utils.Sleep(250, $"{item.Handle}+item_usages");
continue;
}*/
}
else if (item.IsSilence())
{
if (!slarkMod)
if (!globalTarget.IsSilenced())
{
item.UseAbility(globalTarget);
}
}
else if ((item.StoredName().Contains("dagon") || item.StoredName() == "item_ethereal_blade") &&
globalTarget.HasModifiers(
new[]
{
/*"modifier_templar_assassin_refraction_absorb",
"modifier_templar_assassin_refraction_absorb_stacks",*/
"modifier_oracle_fates_edict",
"modifier_abaddon_borrowed_time"
}, false))
{
continue;
}
else
{
item.UseAbility(globalTarget);
}
/*item.UseAbility(target);
Print($"[Using]: {item.Name} (3)", print: false);*/
}
else
{
item.UseAbility(Members.MyHero);
}
else
{
if (name == "item_blink")
{
if (singleCombo || _spellSleeper.Sleeping("blink_fix"))
continue;
if (distance > daggerCastRange+CloseRange)
{
var angle = Members.MyHero.FindAngleBetween(globalTarget.Position, true);
var point = new Vector3(
(float)
(globalTarget.Position.X -
daggerCastRange *
Math.Cos(angle)),
(float)
(globalTarget.Position.Y -
daggerCastRange *
Math.Sin(angle)),
globalTarget.Position.Z);
var dist = Members.MyHero.Distance2D(point);
//.........这里部分代码省略.........
示例4: ItemUsage
/**
* ItemUsage takes in a Hero me, its inventory inv, a Hero target, the distance between me and target, a boolean usebkb and byillusion
* and uses all items as necessary
* 1) Uses blink dagger to a point given by Dagger.CloseRange menu option
* 2) Uses all other items specified in the Items list (line 53)
* 3) Uses diffusal blade (to purge or dispel) if enabled
* 4) Uses bkb if enabled
* 5) Uses ultimate if all items expect of refresher was casted
**/
private static bool ItemUsage(Hero me, IEnumerable<Item> inv, Hero target, double distance, bool useBkb, bool byIllusion = false)
{
if (me.IsChanneling() || !Utils.SleepCheck("DaggerTime") || me.IsStunned()) return false;
// use all items given in Items list (line 53)
var enumerable = inv as Item[] ?? inv.ToArray();
var phase =
enumerable.Find(
x =>
x.StoredName() == HideItemList[0] && byIllusion &&
SpellBaseList.Find(z => z.Name == x.Name) == null && Utils.SleepCheck(x.Name + me.Handle));
if (phase != null)
{
phase.UseAbility();
Utils.Sleep(250, $"{phase.StoredName() + me.Handle}");
}
var inventory =
enumerable.Where(
x =>
(IsItemEnable(x.StoredName(), byIllusion) || CloneOnlyComboItems.Contains(x.StoredName()) ||
x.StoredName() == "item_dust" || x.StoredName() == "item_black_king_bar") && x.CanBeCasted() &&
(!byIllusion || SpellBaseList.Find(z => z.Name == x.Name) == null)
/* && Menu.Item("Items").GetValue<AbilityToggler>().IsEnabled(x.Name)*/ && CheckForPike(me,target,distance,x) ).ToList();
var items =
inventory.Where(
x =>
Utils.SleepCheck(x.Name + me.Handle) && Items.Keys.Contains(x.Name) &&
((x.CastRange == 0 &&
distance <=
(x.Name == "item_blink" ? 1150 + Menu.Item("Dagger.CloseRange").GetValue<Slider>().Value : 1000)) ||
/*x.CastRange+50 >= distance*/x.CanHit(target))).OrderByDescending(y => GetComboOrder(y, byIllusion));
var slarkMod = target.HasModifiers(new[] { "modifier_slark_dark_pact", "modifier_slark_dark_pact_pulses" }, false);
foreach (var item in items)
{
var name = item.StoredName();
if (name == "item_ethereal_blade")
_ethereal.Sleep(1000);
if (name == "item_dagon" || name == "item_dagon_2" || name == "item_dagon_3" || name == "item_dagon_4" || name == "item_dagon_5")
if (_ethereal.Sleeping && !target.HasModifier("modifier_item_ethereal_blade_ethereal"))
continue;
if (name == "item_hurricane_pike")
{
item.UseAbility(me);
Utils.Sleep(250, $"{name + me.Handle}");
continue;
}
if (item.IsAbilityBehavior(AbilityBehavior.NoTarget))
{
item.UseAbility();
Print($"[Using]: {item.Name} (10)", print: false);
}
else if (item.IsAbilityBehavior(AbilityBehavior.UnitTarget))
if (item.TargetTeamType == TargetTeamType.Enemy || item.TargetTeamType == TargetTeamType.All ||
item.TargetTeamType == TargetTeamType.Custom)
{
if (item.IsDisable())
{
if (!slarkMod && !target.IsLinkensProtected())
if (item.CastStun(target))
{
Print($"[Using]: {item.Name} (9)", print: false);
Utils.Sleep(350, $"{item.Name + me.Handle}");
continue;
}
}
else if (item.IsSilence())
{
if (!slarkMod)
if (!target.IsSilenced())
{
item.UseAbility(target);
Print($"[Using]: {item.Name} (8)", print: false);
}
}
else if ((item.StoredName().Contains("dagon") || item.StoredName() == "item_ethereal_blade") &&
target.HasModifiers(
new[]
{
"modifier_templar_assassin_refraction_absorb",
"modifier_templar_assassin_refraction_absorb_stacks",
"modifier_oracle_fates_edict",
"modifier_abaddon_borrowed_time"
}, false))
{
Print("can damage this shit", print: false);
continue;
}
else
{
item.UseAbility(target);
Print($"[Using]: {item.Name} (1)", print: false);
Utils.Sleep(350, $"{item.Name + me.Handle}");
//.........这里部分代码省略.........