本文整理汇总了C#中Hero.HasModifier方法的典型用法代码示例。如果您正苦于以下问题:C# Hero.HasModifier方法的具体用法?C# Hero.HasModifier怎么用?C# Hero.HasModifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hero
的用法示例。
在下文中一共展示了Hero.HasModifier方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Game_OnUpdate
private static void Game_OnUpdate(EventArgs args)
{
me = ObjectManager.LocalHero;
if (me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_ArcWarden || !Game.IsInGame || Game.IsWatchingGame)
return;
keyCombo = Game.IsKeyDown(Menu.Item("Combo Key").GetValue<KeyBind>().Key);
keyAutoCombo = Menu.Item("ComboAutoKey").GetValue<KeyBind>().Active;
List<Hero> zet = ObjectManager.GetEntities<Hero>().Where(x => x.IsControllable && x.Team == me.Team && x.IsAlive && x.ClassID == ClassID.CDOTA_Unit_Hero_ArcWarden).ToList();
var enem = ObjectManager.GetEntities<Hero>().Where(x => x.Team != me.Team && x.IsAlive && x.IsVisible && !x.IsIllusion && !x.IsMagicImmune()).ToList();
Ability[] Q = new Ability[zet.Count()];
for (int i = 0; i < zet.Count(); ++i) Q[i] = zet[i].Spellbook.SpellQ;
Ability[] W = new Ability[zet.Count()];
for (int i = 0; i < zet.Count(); ++i) W[i] = zet[i].Spellbook.SpellW;
Ability[] E = new Ability[zet.Count()];
for (int i = 0; i < zet.Count(); ++i) E[i] = zet[i].Spellbook.SpellE;
Ability[] R = new Ability[zet.Count()];
for (int i = 0; i < zet.Count(); ++i) R[i] = zet[i].Spellbook.SpellR;
/**************************************************DODGE*************************************************************/
if (Menu.Item("AutoMagnetic").GetValue<AbilityToggler>().IsEnabled(me.Spellbook.SpellW.Name))
{
for (int i = 0; i < zet.Count(); ++i)
{
for (int v = 0; v < enem.Count(); ++v)
{
for (int j = 0; j < zet.Count(); ++j)
{
if (
zet[i] != null
&& zet[i].Handle != me.Handle
&& zet[j].Handle == me.Handle
&& W[i].CanBeCasted()
&& !me.HasModifier("modifier_arc_warden_magnetic_field")
&& zet[j].Position.Distance2D(enem[v]) < enem[v].AttackRange + zet[j].HullRadius + 40
&& zet[j].Position.Distance2D(zet[i]) < W[j].CastRange
&& enem[v].NetworkActivity == NetworkActivity.Attack
&& Utils.SleepCheck(zet[i].Handle + "_net_casting"))
{
W[i].UseAbility(zet[j].Position);
Utils.Sleep(W[i].GetCastDelay(zet[i], enem[v], true) + 500, zet[i].Handle + "_net_casting");
}
if (
(zet[i].Handle != me.Handle
|| zet[i] == null)
&& zet[j].Handle == me.Handle
&& (!W[i].CanBeCasted() || zet[i] == null || zet[i].Distance2D(zet[j]) >= W[i].CastRange + 70)
&& W[j].CanBeCasted()
&& zet[j].Distance2D(enem[v]) <= enem[v].AttackRange + zet[j].HullRadius + 40
&& me.Level >= 6
&& enem[v].NetworkActivity == NetworkActivity.Attack
&& !me.HasModifier("modifier_arc_warden_magnetic_field")
&& Utils.SleepCheck(zet[i].Handle + "_net_casting")
)
{
W[j].UseAbility(zet[j].Position);
Utils.Sleep(W[j].GetCastDelay(zet[j], enem[v], true) + 1500, zet[i].Handle + "_net_casting");
break;
}
if (
zet.Count == 1
&& W[j].CanBeCasted()
&& zet[j].Distance2D(enem[v]) <= enem[v].AttackRange + zet[j].HullRadius + 40
&& enem[v].NetworkActivity == NetworkActivity.Attack
&& !me.HasModifier("modifier_arc_warden_magnetic_field")
&& Utils.SleepCheck(zet[j].Handle + "_net_casting")
)
{
W[j].UseAbility(zet[j].Position);
Utils.Sleep(W[j].GetCastDelay(zet[j], enem[v], true, true) + 1500, zet[j].Handle + "_net_casting");
break;
}
if (zet[j].Handle != me.Handle && me.Level >= 6 && W[j].CanBeCasted() && zet[j].Position.Distance2D(enem[v]) <= enem[v].AttackRange + zet[j].HullRadius + 40 && !me.HasModifier("modifier_arc_warden_magnetic_field")
&& enem[v].NetworkActivity == NetworkActivity.Attack
&& zet[j].Position.Distance2D(zet[i]) > W[j].CastRange + 500 && Utils.SleepCheck(zet[i].Handle + "_net_casting"))
{
W[j].UseAbility(zet[j].Position);
Utils.Sleep(W[j].GetCastDelay(zet[j], enem[v], true, true) + 1500, zet[i].Handle + "_net_casting");
break;
}
}
}
}
}
/**************************************************DODGE*************************************************************/
/**************************************************COMBO*************************************************************/
//TODO: start combo
Item[] bkb = new Item[zet.Count()];
for (int i = 0; i < zet.Count(); ++i) bkb[i] = zet[i].FindItem("item_black_king_bar");
Item[] ethereal = new Item[zet.Count()];
for (int i = 0; i < zet.Count(); ++i) ethereal[i] = zet[i].FindItem("item_ethereal_blade");
Item[] vail = new Item[zet.Count()];
for (int i = 0; i < zet.Count(); ++i) vail[i] = zet[i].FindItem("item_veil_of_discord");
Item[] cheese = new Item[zet.Count()];
for (int i = 0; i < zet.Count(); ++i) cheese[i] = zet[i].FindItem("item_cheese");
Item[] ghost = new Item[zet.Count()];
//.........这里部分代码省略.........
示例2: CalculateDamageR
private double CalculateDamageR(Hero victim)
{
double dmgResult = 0;
eDmg = E.GetAbilityData("damage_health_pct") * 0.01f * victim.Health;
rDmg = me.AghanimState() ? R.GetAbilityData("damage_scepter") : R.GetAbilityData("damage");
if (R != null &&
R.CanBeCasted() && Menu.Item("AutoUlt").GetValue<AbilityToggler>().IsEnabled(R.Name))
{
if (victim.NetworkName == "CDOTA_Unit_Hero_Spectre" && victim.Spellbook.Spell3.Level > 0)
{
dmgResult += rDmg * (1 - (0.10 + victim.Spellbook.Spell3.Level * 0.04));
}
else
dmgResult += rDmg;
if (victim.NetworkName == "CDOTA_Unit_Hero_SkeletonKing" && victim.Spellbook.SpellR.CanBeCasted())
dmgResult = 0;
if (victim.HasModifier("modifier_kunkka_ghost_ship_damage_absorb"))
dmgResult *= 0.5;
if (victim.HasModifier("modifier_bloodseeker_bloodrage"))
{
var blood = ObjectManager.GetEntities<Hero>()
.FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Bloodseeker);
if (blood != null)
dmgResult *= bloodrage[blood.Spellbook.Spell1.Level];
else
dmgResult *= 1.4;
}
if (victim.HasModifier("modifier_chen_penitence"))
{
var chen =
ObjectManager.GetEntities<Hero>()
.FirstOrDefault(x => x.Team == me.Team && x.ClassID == ClassID.CDOTA_Unit_Hero_Chen);
if (chen != null)
dmgResult *= penitence[chen.Spellbook.Spell1.Level];
}
if (victim.HasModifier("modifier_shadow_demon_soul_catcher"))
{
var demon = ObjectManager.GetEntities<Hero>()
.FirstOrDefault(x => x.Team == me.Team && x.ClassID == ClassID.CDOTA_Unit_Hero_Shadow_Demon);
if (demon != null)
dmgResult *= souls[demon.Spellbook.Spell2.Level];
}
if (victim.HasModifier("modifier_item_mask_of_madness_berserk"))
dmgResult *= 1.3;
if (victim.Distance2D(me) <= 1200 + me.HullRadius)
{
dmgResult += eDmg;
vail = me.FindItem("item_veil_of_discord");
if (vail != null && vail.CanBeCasted() &&
!victim.HasModifier("modifier_item_veil_of_discord_debuff")
&& me.Distance2D(victim) <= vail.GetCastRange()
&& Menu.Item("AutoUltItems").GetValue<AbilityToggler>().IsEnabled(vail.Name))
{
dmgResult *= 1.25;
}
int etherealdamage = (int)((me.TotalStrength * 2) + 75);
if (ethereal != null && ethereal.CanBeCasted() && me.Distance2D(victim) <= ethereal.GetCastRange() &&
victim.Handle == e?.Handle)
{
dmgResult += etherealdamage * 1.4;
}
if (dagon != null && dagon.CanBeCasted() && me.Distance2D(victim) <= dagon.GetCastRange() &&
victim.Handle == e?.Handle &&
Menu.Item("AutoUltItems").GetValue<AbilityToggler>().IsEnabled("item_dagon"))
dmgResult += dagonDmg[dagon.Level];
}
dmgResult *= 1 - victim.MagicDamageResist;
}
return dmgResult;
}
示例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: DrawShowMeMoreBara
private static void DrawShowMeMoreBara(Hero v, Vector2 pos, Vector2 size, int height = 7)
{
if (!Menu.Item("showMeMore.Enable").GetValue<bool>()) return;
var mod = v.HasModifier("modifier_spirit_breaker_charge_of_darkness_vision");
if (mod)
{
var textPos = pos + new Vector2(0, size.Y + height*4);
Drawing.DrawText("Spirit Breaker", textPos, new Vector2(15, 150), Color.White,
FontFlags.AntiAlias | FontFlags.DropShadow);
if (Equals(MeHero, v))
{
const string name = "modifier_spirit_breaker_charge_of_darkness_vision";
Drawing.DrawRect(new Vector2(0, 0), new Vector2(Drawing.Width, Drawing.Height),
new Color(Menu.Item(name + ".Red").GetValue<Slider>().Value,
Menu.Item(name + ".Green").GetValue<Slider>().Value,
Menu.Item(name + ".Blue").GetValue<Slider>().Value,
Menu.Item(name + ".Alpha").GetValue<Slider>().Value));
}
ParticleEffect eff;
if (BaraIndicator.TryGetValue(v, out eff)) return;
eff = new ParticleEffect("", v);
eff.SetControlPointEntity(1, v);
BaraIndicator.Add(v, eff);
GenerateSideMessage(v.Name.Replace("npc_dota_hero_", ""),
"spirit_breaker_charge_of_darkness");
}
else
{
ParticleEffect eff;
if (!BaraIndicator.TryGetValue(v, out eff)) return;
eff.Dispose();
BaraIndicator.Remove(v);
}
}
示例5: GetAttackSpeed
/// <summary>
/// Gets the attack speed.
/// </summary>
/// <param name="unit">
/// The unit.
/// </param>
/// <returns>
/// The <see cref="float" />.
/// </returns>
public static float GetAttackSpeed(Hero unit)
{
// Console.WriteLine(unit.AttacksPerSecond * Game.FindKeyValues(unit.Name + "/AttackRate", KeyValueSource.Hero).FloatValue / 0.01);
try
{
double attackBaseTime;
if (!AttackRateDictionary.TryGetValue(unit.Handle, out attackBaseTime))
{
attackBaseTime =
Game.FindKeyValues(unit.StoredName() + "/AttackRate", KeyValueSource.Hero).FloatValue;
AttackRateDictionary.Add(unit.Handle, attackBaseTime);
}
var attackSpeed = Math.Min(unit.AttacksPerSecond * attackBaseTime / 0.01, 600);
if (unit.HasModifier("modifier_ursa_overpower"))
{
attackSpeed = 600;
}
return (float)attackSpeed;
}
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;
}
}
示例6: Game_OnUpdate
//.........这里部分代码省略.........
&& Utils.SleepCheck(meepos[i].Handle + "_net_casting"))
{
q[i].CastSkillShot(e);
Utils.Sleep(q[i].GetCastDelay(meepos[i], e, true) + 500, meepos[i].Handle + "_net_casting");
}
else if (!q[i].CanBeCasted() && meepos[i].Health <= meepos[i].MaximumHealth / 100 * Menu.Item("healh").GetValue<Slider>().Value)
{
for (var j = 0; j < meepos.Count(); j++)
{
if (e != null
&& q[j] != null
&& meepos[i].Handle != meepos[j].Handle
&& meepos[j].Position.Distance2D(e) < q[i].CastRange
&& e.Modifiers.Any(y => y.Name != "modifier_meepo_earthbind")
&& meepos[j].Position.Distance2D(meepos[i]) < q[j].CastRange
&& !e.IsMagicImmune()
&& Utils.SleepCheck(meepos[i].Handle + "_net_casting"))
{
q[j].CastSkillShot(e);
Utils.Sleep(q[j].GetCastDelay(meepos[j], e, true) + 1500, meepos[i].Handle + "_net_casting");
break;
}
}
}
if (e != null
&& w[i] != null
&& w[i].CanBeCasted()
&& meepos[i].Health <= meepos[i].MaximumHealth
/ 100 * Menu.Item("healh").GetValue<Slider>().Value
&& meepos[i].Handle != f.Handle && meepos[i].Distance2D(f) >= 700
&& (meepos[i].Distance2D(e) >= (e.AttackRange + 60)
|| meepos[i].MovementSpeed <= 290)
&& (q == null || (!q[i].CanBeCasted()
|| e.HasModifier("modifier_meepo_earthbind")
|| !e.IsMagicImmune()) || meepos[i].Distance2D(e) >= 1000)
&& meepos[i].Distance2D(fount.First().Position) >= 1100
&& Utils.SleepCheck(meepos[i].Handle + "W"))
{
w[i].UseAbility(f);
Utils.Sleep(1000, meepos[i].Handle + "W");
}
else if (
e != null
&& travel != null
&& travel.CanBeCasted()
&& meepos[i].Health <= meepos[i].MaximumHealth
/ 100 * Menu.Item("healh").GetValue<Slider>().Value
&& (!w[i].CanBeCasted()
|| meepos[i].Position.Distance2D(f) >= 1000
|| (w[i].CanBeCasted()
&& f.Distance2D(fount.First()) >= 2000))
&& (meepos[i].Distance2D(e) >= (e.AttackRange + 60)
|| (meepos[i].IsSilenced()
|| meepos[i].MovementSpeed <= 290))
&& meepos[i].Distance2D(fount.First().Position) >= 1100
&& Utils.SleepCheck(meepos[i].Handle + "travel"))
{
travel.UseAbility(fount.First().Position);
Utils.Sleep(1000, meepos[i].Handle + "travel");
}
}
}
/**************************************************DODGE*************************************************************/
/***************************************************POOF*************************************************************/
if (PoofKey)
{
示例7: CalculateMyCurrentDamage
public static float CalculateMyCurrentDamage(Hero globalTarget,bool checkForRange=false)
{
var mana = Members.MyHero.Mana;
var laser = Abilities.FindAbility("tinker_laser");
var rocked = Abilities.FindAbility("tinker_heat_seeking_missile");
var allItems = new List<Ability>();
var allItems2 = new List<Ability>(Members.MyHero.Inventory.Items.Where(x =>
IsItemEnable(x.StoredName()) && (x.ManaCost > 0 || x.StoredName() == "item_soul_ring"))
.OrderByDescending(PriorityHelper)
.ToList());
allItems.AddRange(allItems2);
if (laser.Level > 0 && IsAbilityEnable(laser.StoredName()))
allItems.Add(laser);
if (rocked.Level > 0 && IsAbilityEnable(rocked.StoredName()))
allItems.Add(rocked);
var haveEb =
allItems.Any(
x =>
x.StoredName() == "item_ethereal_blade" && x.CanBeCasted() &&
(x.CanHit(globalTarget) || !checkForRange));
var haveVeil =
allItems.Any(
x =>
x.StoredName() == "item_veil_of_discord" && x.CanBeCasted() &&
(x.CanHit(globalTarget) || !checkForRange));
var myDmg = 0f;
var extraDamage = haveEb && !globalTarget.HasModifier("modifier_item_ethereal_blade_ethereal") ? 40 : 0;
extraDamage += haveVeil && !globalTarget.HasModifier("modifier_item_veil_of_discord_debuff") ? 25 : 0;
var ignoreList=new List<Ability>();
foreach (
var x in
allItems.Where(x => x.CanBeCasted() && !ignoreList.Contains(x))
.Where(x => !checkForRange || x.CanHit(globalTarget)))
{
if (x.Equals(rocked))
if (!CanRockedHit(globalTarget))
{
ignoreList.Add(rocked);
continue;
}
if (mana > x.ManaCost)
{
if (x.StoredName() == "item_soul_ring")
{
mana += 150;
continue;
}
var mCost = x.ManaCost;
if (!(mana - mCost > 0)) break;
mana -= mCost;
var dmgFromSpell = AbilityDamage.CalculateDamage(x, Members.MyHero, globalTarget,
minusMagicResistancePerc: extraDamage);
myDmg += dmgFromSpell;
}
}
return (int) (globalTarget.Health - myDmg);
}
示例8: HandleEffectD
private static void HandleEffectD(Unit unit)
{
/*
if (unit == null) return;
//ParticleEffect effect2;
me = ObjectMgr.LocalHero;
if (me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Tinker)
return;
var upos = unit.Position;
if (unit.Modifiers.Any(y => y.Name == "modifier_boots_of_travel_incoming") && me.HasModifier("modifier_teleporting"))// && !Prediction.IsTurning(me))
{
if (VisibleUnit2.TryGetValue(unit, out effect2)) return;
//effect2 = unit.AddParticleEffect(@"particles\ui_mouseactions\range_finder_d_glow.vpcf");
effect2 = unit.AddParticleEffect(@"particles\ui_mouseactions\range_finder_directional_b.vpcf");
effect2.SetControlPoint(1, upos);
effect2.SetControlPoint(2, FindVector(upos, me.Rotation, 1200+aetherrange + 130));
VisibleUnit2.Add(unit, effect2);
}
else if (!unit.Modifiers.Any(y => y.Name == "modifier_boots_of_travel_incoming") || !me.HasModifier("modifier_teleporting") || !me.IsChanneling())// || Prediction.IsTurning(me))
{
if (!VisibleUnit2.TryGetValue(unit, out effect2)) return;
effect2.Dispose();
VisibleUnit2.Remove(unit);
}
*/
if (unit == null) return;
me = ObjectMgr.LocalHero;
if (me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Tinker)
return;
if (unit != null && unit.IsValid && unit.IsAlive && unit.Modifiers.Any(y => y.Name == "modifier_boots_of_travel_incoming") && me.HasModifier("modifier_teleporting"))// && !Prediction.IsTurning(me))
{
if (effect2 == null)
{
effect2 = new ParticleEffect(@"particles\ui_mouseactions\range_finder_d_glow.vpcf", unit);
effect2.SetControlPoint(1, unit.Position);
effect2.SetControlPoint(2, FindVector(unit.Position, me.Rotation, 1200+aetherrange + 130));
}
else
{
effect2.SetControlPoint(1, unit.Position);
effect2.SetControlPoint(2, FindVector(unit.Position, me.Rotation, 1200+aetherrange + 130));
}
}
//else if (effect2 != null)
if (!me.HasModifier("modifier_teleporting") && effect2 != null)
{
effect2.Dispose();
effect2 = null;
}
}
示例9: SpellsUsage
private static void SpellsUsage(Hero me, Hero target, double distance,bool daggerIsReady)
{
var spellbook = me.Spellbook;
var q = spellbook.SpellQ;
var w = spellbook.SpellW;
var e = spellbook.SpellE;
if (q != null && q.CanBeCasted() && q.CastRange >= distance && Utils.SleepCheck(me.Handle+q.Name))
{
q.UseAbility(target);
Utils.Sleep(500, me.Handle + q.Name);
}
if (w != null && w.CanBeCasted() && Utils.SleepCheck(w.Name) && !me.HasModifier("modifier_arc_warden_magnetic_field") && distance <= 600 && !daggerIsReady)
{
w.UseAbility(Prediction.InFront(me,200));
Utils.Sleep(500, w.Name);
}
if (e != null && e.CanBeCasted() && Utils.SleepCheck(me.Handle + e.Name) && !daggerIsReady)
{
var predVector3 = target.NetworkActivity == NetworkActivity.Move && Menu.Item("usePrediction").GetValue<bool>()
? Prediction.InFront(target, target.MovementSpeed * 3 + Game.Ping / 1000)
: target.Position;
e.UseAbility(predVector3);
Utils.Sleep(500, me.Handle + e.Name);
}
var r = me.Spellbook.SpellR;
if (r == null || !r.CanBeCasted() || !Utils.SleepCheck(me.Handle + r.Name) || distance>900) return;
r.UseAbility();
Utils.Sleep(500, me.Handle + r.Name);
}
示例10: CloneUseHealItems
private static void CloneUseHealItems(Hero clone, Hero me, float distance)
{
var handle = clone.Handle;
var items = clone.Inventory.Items.Where(x => CloneHealItems.Contains(x.Name) && x.CanBeCasted() && x.CastRange+200>distance && Utils.SleepCheck(handle+x.Name));
foreach (var item in items)
{
switch (item.Name)
{
case "item_flask":
item.UseAbility(me);
Utils.Sleep(500,(handle+item.Name).ToString(CultureInfo.InvariantCulture));
break;
case "item_clarity":
item.UseAbility(me);
Utils.Sleep(500, (handle + item.Name).ToString(CultureInfo.InvariantCulture));
break;
case "item_enchanted_mango":
item.UseAbility(me);
Utils.Sleep(500, (handle + item.Name).ToString(CultureInfo.InvariantCulture));
break;
case "item_sphere":
item.UseAbility(me);
Utils.Sleep(500, (handle + item.Name).ToString(CultureInfo.InvariantCulture));
break;
case "item_bottle":
var bottlemod = me.HasModifier("modifier_bottle_regeneration");
if (!bottlemod && item.CurrentCharges > 0)
{
item.UseAbility(me);
Utils.Sleep(500, (handle + item.Name).ToString(CultureInfo.InvariantCulture));
}
break;
default:
item.UseAbility();
Utils.Sleep(500, (handle + item.Name).ToString(CultureInfo.InvariantCulture));
break;
}
}
}
示例11: SpellsUsage
private static void SpellsUsage(Hero me, Hero target, double distance, bool daggerIsReady, bool tempest)
{
var spellbook = me.Spellbook;
var q = spellbook.SpellQ;
var w = spellbook.SpellW;
var e = spellbook.SpellE;
if (q != null && IsAbilityEnable(q.StoredName(), tempest) && q.CanBeCasted() && q.CanHit(target) &&
Utils.SleepCheck(me.Handle + q.Name))
{
q.UseAbility(target);
Utils.Sleep(500, me.Handle + q.Name);
}
if (w != null && IsAbilityEnable(w.StoredName(), tempest) && w.CanBeCasted() && Utils.SleepCheck(w.Name) &&
!me.HasModifier("modifier_arc_warden_magnetic_field") && distance <= 600 && !daggerIsReady)
{
if (!Menu.Item("MagneticField").GetValue<bool>() && target.IsMelee)
{
Utils.Sleep(500, "magField");
w.UseAbility(Prediction.InFront(me, -250));
}
else
w.UseAbility(Prediction.InFront(me, 250));
Utils.Sleep(500, w.Name);
}
if (e != null && IsAbilityEnable(e.StoredName(), tempest) && e.CanBeCasted() &&
Utils.SleepCheck(me.Handle + e.Name) && !daggerIsReady && !Prediction.IsTurning(target) && (!SparkUsage || me.IsVisibleToEnemies))
{
var predVector3 = target.NetworkActivity == NetworkActivity.Move &&
Menu.Item("usePrediction").GetValue<bool>()
? Prediction.InFront(target, target.MovementSpeed*3 + Game.Ping/1000)
: target.Position;
e.UseAbility(predVector3);
Utils.Sleep(1000, me.Handle + e.Name);
}
var r = me.Spellbook.SpellR;
if (!IsAbilityEnable(r.StoredName(), tempest))
return;
if (r == null || !IsAbilityEnable(r.StoredName(), tempest) || !r.CanBeCasted() ||
!Utils.SleepCheck(me.Handle + r.Name) || distance > 900 || Objects.Tempest.GetCloneList(me).Any())
return;
r.UseAbility();
Utils.Sleep(500, me.Handle + r.Name);
}
示例12: 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}");
//.........这里部分代码省略.........
示例13: Player_OnExecuteAction
private static void Player_OnExecuteAction(Player sender, ExecuteOrderEventArgs args)
{
if (!Menu.Item("PB.Enable").GetValue<bool>()) return;
/*if (args.Order == Order.AbilityTarget || args.Order == Order.AbilityLocation)
if (args.Ability.Name == "item_tpscroll" || args.Ability.Name == "item_travel_boots" ||
args.Ability.Name == "item_travel_boots_2")
TpPos = args.TargetPosition;*/
if (args.Order == Order.Stop || args.Order == Order.Hold)
_shouldCheckForModifier = false;
if (args.Order != Order.AbilityLocation) return;
if (args.Ability.Name != "item_blink") return;
_me = args.Entities.FirstOrDefault() as Hero;//ObjectMgr.LocalHero);
if (_me==null) return;
var safeRange = _me.FindItem("item_aether_lens") == null ? 1200 : 1400;
if (!(_me.Distance2D(args.TargetPosition) > safeRange))
return;
var tpos = _me.Position;
var a = tpos.ToVector2().FindAngleBetween(args.TargetPosition.ToVector2(), true);
safeRange -= (int)_me.HullRadius;
var p = new Vector3(
tpos.X + safeRange * (float)Math.Cos(a),
tpos.Y + safeRange * (float)Math.Sin(a),
100);
if (_me.HasModifier("modifier_teleporting"))
{
if (!EnableAfterTp)
return;
_shouldCheckForModifier = true;
_myAbility = args.Ability;
args.Process = false;
_mySelectedPos = args.TargetPosition.ToVector2();
/*DelayAction.Add(new DelayActionItem((int) _me.FindModifier("modifier_teleporting").RemainingTime*1000+750, () =>
{
tpos = _me.Position;;//TpPos;
a = tpos.ToVector2().FindAngleBetween(args.TargetPosition.ToVector2(), true);
p = new Vector3(
tpos.X + safeRange * (float)Math.Cos(a),
tpos.Y + safeRange * (float)Math.Sin(a),
100);
Print("extra action");
args.Ability.UseAbility(p);
}, CancellationToken.None));*/
return;
}
_shouldCheckForModifier = false;
args.Ability.UseAbility(p,_me.IsChanneling());
args.Process = false;
}
示例14: RunScript
//.........这里部分代码省略.........
e = TargetSelector.ClosestToMouse(me, 5000);
break;
case 1:
var EnemyHero = ObjectManager.GetEntities<Hero>().Where(enemy => enemy.Team == me.GetEnemyTeam() && enemy.IsAlive && !enemy.IsIllusion && enemy.Distance2D(Game.MousePosition) <= TargetFindRange).ToList();
e = EnemyHero.MinOrDefault(x => x.Health);
break;
}
}
if (Utils.SleepCheck("delay"))
{
if (me.IsAlive)
{
var count = units.Count();
if (count <= 0) return;
for (int i = 0; i < count; ++i)
{
var v = ObjectManager.GetEntities<Hero>()
.Where(x => x.Team == me.Team && x.IsAlive && x.IsVisible && !x.IsIllusion).ToList();
if (units[i].Name == "npc_dota_juggernaut_healing_ward")
{
if (me.Position.Distance2D(units[i].Position) > 5 && Utils.SleepCheck(units[i].Handle.ToString()))
{
units[i].Move(me.Position);
Utils.Sleep(50, units[i].Handle.ToString());
}
}
else if (units[i].Name == "npc_dota_neutral_ogre_magi")
{
for (int z = 0; z < v.Count(); ++z)
{
var armor = units[i].Spellbook.SpellQ;
if ((!v[z].HasModifier("modifier_ogre_magi_frost_armor") || !me.HasModifier("modifier_ogre_magi_frost_armor")) && armor.CanBeCasted() && units[i].Position.Distance2D(v[z]) <= 900
&& Utils.SleepCheck(units[i].Handle.ToString()))
{
armor.UseAbility(v[z]);
Utils.Sleep(400, units[i].Handle.ToString());
}
}
}
else if (units[i].Name == "npc_dota_neutral_forest_troll_high_priest")
{
if (units[i].Spellbook.SpellQ.CanBeCasted())
{
for (int z = 0; z < v.Count(); ++z)
{
if (units[i].Position.Distance2D(v[z]) <= 900
&& Utils.SleepCheck(units[i].Handle + "high_priest"))
{
units[i].Spellbook.SpellQ.UseAbility(v[z]);
Utils.Sleep(350, units[i].Handle + "high_priest");
}
}
}
}
if (e == null) return;
if (e.IsAlive && !e.IsInvul() && (holdKey || toggleKey))
{
//spell
var CheckStun = e.HasModifier("modifier_centaur_hoof_stomp");
var CheckSetka = e.HasModifier("modifier_dark_troll_warlord_ensnare");
if (units[i].Name == "npc_dota_neutral_dark_troll_warlord")
示例15: CalculateMyDamage
public static float CalculateMyDamage(Hero globalTarget)
{
var mana = Members.MyHero.MaximumMana;
var rearm = Abilities.FindAbility("tinker_rearm");
var laser = Abilities.FindAbility("tinker_laser");
var rocked = Abilities.FindAbility("tinker_heat_seeking_missile");
var allItems = new List<Ability>();
var allItems2 = new List<Ability>(Members.MyHero.Inventory.Items.Where(x =>
IsItemEnable(x.StoredName()) && (x.ManaCost > 0 || x.StoredName() == "item_soul_ring"))
.OrderByDescending(PriorityHelper)
.ToList());
allItems.AddRange(allItems2);
if (rocked.Level > 0 && IsAbilityEnable(rocked.StoredName()))
allItems.Add(rocked);
if (laser.Level > 0 && IsAbilityEnable(laser.StoredName()))
allItems.Add(laser);
if (rearm.Level > 0)
allItems.Add(rearm);
var haveEb = allItems.Any(x => x.StoredName() == "item_ethereal_blade" && x.CanBeCasted());
var haveVeil = allItems.Any(x => x.StoredName() == "item_veil_of_discord" && x.CanBeCasted());
var myDmg = 0f;
var extraDamage = haveEb && !globalTarget.HasModifier("modifier_item_ethereal_blade_ethereal") ? 40 : 0;
extraDamage += haveVeil && !globalTarget.HasModifier("modifier_item_veil_of_discord_debuff") ? 25 : 0;
if (allItems.Count == 0 || (rearm.Level == 0))
{
myDmg=allItems.Sum(
x =>
AbilityDamage.CalculateDamage(x, Members.MyHero, globalTarget,
minusMagicResistancePerc: extraDamage));
return (int) (globalTarget.Health - myDmg);
}
//Printer.Print($"[mana]: init");
Printer.ConsolePrint($"[mana]: Init. [count]: {allItems.Count}. [possible]: {allItems.Count(x => mana > x.ManaCost)}");
var wasRearmed = true;
var templarStacks = globalTarget.FindModifier("modifier_templar_assassin_refraction_absorb_stacks");
var stacks = templarStacks?.StackCount ?? 0;
var hasRainDrop = globalTarget.FindItem("item_infused_raindrop", true)?.Cooldown <= 0;
var wasNama = mana;
while (mana>5 && allItems.Count(x=>mana>x.ManaCost)>0 && wasRearmed && wasNama>=mana)
{
wasRearmed = false;
foreach (var x in allItems)
{
if (mana > x.ManaCost)
{
//Printer.ConsolePrint($"[mana]: {x.StoredName()} -> {x.ManaCost}/{mana}");
if (x.StoredName() == "item_soul_ring")
{
mana += 150;
Printer.ConsolePrint($"[mana]: {mana} (+150) soul ring");
continue;
}
var mCost = x.ManaCost;
if (!(mana - mCost > 0)) break;
mana -= mCost;
var dmgFromSpell = AbilityDamage.CalculateDamage(x, Members.MyHero, globalTarget,
minusMagicResistancePerc: extraDamage);
if (stacks > 0)
{
stacks--;
myDmg += 0;
}
else
{
if (AbilityDamage.GetDamageType(x) == DamageType.Magical && hasRainDrop && dmgFromSpell > 120)
{
hasRainDrop = false;
dmgFromSpell = -120;
dmgFromSpell = Math.Max(dmgFromSpell, 0);
}
myDmg += dmgFromSpell;
}
//Printer.Print($"[mana]: {mana} (-{mCost}) {x.StoredName()} -> damage: {myDmg}");
if (x.StoredName() == rearm.StoredName())
{
Printer.ConsolePrint($"[mana]: {mana} (-{mCost}) {x.StoredName()}");
wasRearmed = true;
continue;
}
Printer.ConsolePrint($"[mana]: {mana} (-{mCost}) {x.StoredName()} -> damage: {dmgFromSpell} || total:{myDmg}");
}
else
{
Printer.ConsolePrint($"[mana]: {x.StoredName()} -> {x.ManaCost}/{mana} cant cast this!");
}
}
/*Printer.ConsolePrint($"[mana]: {rearm.StoredName()} -> {rearm.ManaCost}/{mana}");
mana -= rearm.ManaCost;*/
}
var healthAfterShit = (int) (globalTarget.Health - myDmg);
return healthAfterShit;
}