本文整理汇总了C#中Hero.FindModifier方法的典型用法代码示例。如果您正苦于以下问题:C# Hero.FindModifier方法的具体用法?C# Hero.FindModifier怎么用?C# Hero.FindModifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hero
的用法示例。
在下文中一共展示了Hero.FindModifier方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalculateDamage
//.........这里部分代码省略.........
// Console.WriteLine(minusArmor);
var damageIncrease = 1 - 0.06 * meldminusArmor / (1 + 0.06 * Math.Abs(meldminusArmor));
// Console.WriteLine(damageIncrease);
outgoingDamage =
(float)
(target.DamageTaken(
source.MaximumDamage + source.BonusDamage,
DamageType.Physical,
source,
data.MagicImmunityPierce,
minusMagicResistancePerc: minusMagicResistancePerc) + bonusDamage * damageIncrease);
break;
case "undying_decay":
var strengthSteal = ability.GetAbilityData("str_steal");
if (source.AghanimState())
{
strengthSteal = ability.GetAbilityData("str_Steal_scepter");
}
outgoingDamage = strengthSteal * 19
+ target.DamageTaken(
ability.GetAbilityData(data.DamageString),
DamageType.Magical,
source,
false,
minusMagicResistancePerc: minusMagicResistancePerc);
// Console.WriteLine(outgoingDamage);
break;
case "visage_soul_assumption":
var dmg = ability.GetAbilityData(data.DamageString);
var modif = source.FindModifier("modifier_visage_soul_assumption");
if (modif != null)
{
dmg += modif.StackCount * ability.GetAbilityData("soul_charge_damage");
}
outgoingDamage = target.DamageTaken(
dmg,
DamageType.Magical,
source,
false,
minusMagicResistancePerc: minusMagicResistancePerc);
// Console.WriteLine(outgoingDamage);
break;
case "morphling_adaptive_strike":
if (!DamageDictionary.TryGetValue(ability, out bonusDamage))
{
bonusDamage = ability.GetAbilityData(data.DamageString);
DamageDictionary.Add(ability, bonusDamage);
LevelDictionary.Add(ability, level);
}
else if (LevelDictionary[ability] != level)
{
LevelDictionary[ability] = level;
bonusDamage = ability.GetAbilityData(data.DamageString);
DamageDictionary[ability] = bonusDamage;
}
hero = source;
var agi = Math.Floor(hero.TotalAgility);
var str = Math.Floor(hero.TotalStrength);
var difference = agi / str;
示例2: DoCombo
private static void DoCombo(Hero target)
{
var theClosestMeepo = _meepoList.OrderBy(target.Distance2D).First();
var dist = theClosestMeepo.Distance2D(target)+MyHero.HullRadius+target.HullRadius;
var targetPos = target.Position;
#region GetItems&Spells
if (OrderStates[MyHero.Handle] != OrderState.Escape)
{
if (_blink != null && _blink.CanBeCasted() && dist <= 1150 && dist >= 250 && Utils.SleepCheck("Blink"))
{
_blink.UseAbility(targetPos);
Utils.Sleep(250, "Blink");
}
var bkb = target.FindItem("item_black_king_bar");
if (bkb != null && bkb.CanBeCasted() && _hex != null && _hex.CanBeCasted(target) &&
Utils.SleepCheck("hex"))
{
_hex.UseAbility(target);
Utils.Sleep(250, "hex");
}
if (_orchid != null && _orchid.CanBeCasted(target) && !target.IsHexed() && Utils.SleepCheck("orchid") &&
Utils.SleepCheck("hex"))
{
_orchid.UseAbility(target);
Utils.Sleep(250, "orchid");
}
if (_hex != null && _hex.CanBeCasted(target) && !target.IsSilenced() && Utils.SleepCheck("hex") &&
Utils.SleepCheck("orchid"))
{
_hex.UseAbility(target);
Utils.Sleep(250, "hex");
}
if (_eb != null && _eb.CanBeCasted(target) && Utils.SleepCheck("eb"))
{
_eb.UseAbility(target);
Utils.Sleep(250, "eb");
}
}
#endregion
foreach (
var handle in
_meepoList.Where(x => x.IsAlive && OrderStates[x.Handle] != OrderState.Escape)
.Select(meepo => meepo.Handle))
{
OrderStates[handle] = OrderState.InCombo;
}
foreach (var meepo in _meepoList.Where(x => x.IsAlive && OrderStates[x.Handle] == OrderState.InCombo).OrderBy(y=>y.Distance2D(target)))
{
#region gettings spells and drawing effects
var handle = meepo.Handle;
DrawEffects(meepo, target);
Ability q, w;
if (!SpellQ.TryGetValue(handle, out q))
SpellQ[handle] = meepo.Spellbook.Spell1;
if (!SpellW.TryGetValue(handle, out w))
SpellW[handle] = meepo.Spellbook.Spell2;
#region Change Orders
if (SafeTp(meepo, w))
continue;
#endregion
#endregion
#region CastQ
var mod = target.FindModifier("modifier_meepo_earthbind");
var remTime = mod?.RemainingTime ?? 0;
if ((_blink==null || !_blink.CanBeCasted()) && q != null && q.CanBeCasted() && dist <= q.CastRange &&
(mod == null || remTime <= .7) &&
Utils.SleepCheck("Period_q"))
{
if (q.CastSkillShot(target))
//if (q.CastStun(target))
{
Utils.Sleep(q.GetHitDelay(target)*1000+100, "Period_q");
}
}
#endregion
#region CastW
if (w != null)
{
var castRange = w.GetRealCastRange();
if ((!Equals(theClosestMeepo, meepo) || target.IsHexed() || target.IsStunned() ||
target.MovementSpeed <= 200 || (remTime > 1.3)) && w.CanBeCasted() &&
dist <= castRange &&
Utils.SleepCheck("Period_w" + handle))
{
w.UseAbility(theClosestMeepo);
Utils.Sleep(1500, "Period_w" + handle);
//.........这里部分代码省略.........
示例3: Game_OnUpdate
private static void Game_OnUpdate(EventArgs args)
{
me = ObjectManager.LocalHero;
if (!Game.IsInGame || Game.IsWatchingGame || me==null || me.ClassID != ClassID.CDOTA_Unit_Hero_EmberSpirit) return;
Active = Game.IsKeyDown(Menu.Item("keyBind").GetValue<KeyBind>().Key);
Push = Game.IsKeyDown(Menu.Item("keyEscape").GetValue<KeyBind>().Key);
wKey = Game.IsKeyDown(Menu.Item("wKey").GetValue<KeyBind>().Key);
oneULT = Menu.Item("oneult").IsActive();
if (!Menu.Item("enabled").IsActive())
return;
e = me.ClosestToMouseTarget(1800);
if (Push)
{
Unit fount = ObjectManager.GetEntities<Unit>().FirstOrDefault(x => x.Team == me.Team && x.ClassID == ClassID.CDOTA_Unit_Fountain);
var remnant = ObjectManager.GetEntities<Unit>().Where(unit => unit.IsValid && unit.IsAlive && unit.Team == me.Team && unit.Name == "npc_dota_ember_spirit_remnant").ToList();
if (fount != null)
{
float angle = me.FindAngleBetween(fount.Position, true);
Vector3 pos = new Vector3((float)(me.Position.X + R.GetCastRange() * Math.Cos(angle)),
(float)(me.Position.Y + R.GetCastRange() * Math.Sin(angle)), 0);
if (remnant.Count(x => x.Distance2D(me) <= 10000) == 0)
{
if (R != null && R.CanBeCasted()
&& me.FindModifier("modifier_ember_spirit_fire_remnant_charge_counter").StackCount >= 1
&& Utils.SleepCheck("z"))
{
R.UseAbility(pos);
Utils.Sleep(1000, "z");
}
}
if (remnant.Count(x => x.Distance2D(me) <= 10000) > 0)
{
if (D != null && D.CanBeCasted())
{
for (int i = 0; i < remnant.Count; ++i)
{
var kill =
remnant[i].Modifiers.Where(y => y.Name == "modifier_ember_spirit_fire_remnant_thinker")
.DefaultIfEmpty(null)
.FirstOrDefault();
if (kill != null
&& kill.RemainingTime < 44
&& Utils.SleepCheck("Rem"))
{
D.UseAbility(fount.Position);
Utils.Sleep(300, "Rem");
}
}
}
}
}
}
Q = me.Spellbook.SpellQ;
W = me.Spellbook.SpellW;
E = me.Spellbook.SpellE;
R = me.Spellbook.SpellR;
D = me.Spellbook.SpellD;
ethereal = me.FindItem("item_ethereal_blade");
mom = me.FindItem("item_mask_of_madness");
urn = me.FindItem("item_urn_of_shadows");
dagon =
me.Inventory.Items.FirstOrDefault(
item =>
item.Name.Contains("item_dagon"));
halberd = me.FindItem("item_heavens_halberd");
mjollnir = me.FindItem("item_mjollnir");
orchid = me.FindItem("item_orchid") ?? me.FindItem("item_bloodthorn");
abyssal = me.FindItem("item_abyssal_blade");
mail = me.FindItem("item_blade_mail");
bkb = me.FindItem("item_black_king_bar");
satanic = me.FindItem("item_satanic");
blink = me.FindItem("item_blink");
medall = me.FindItem("item_medallion_of_courage") ?? me.FindItem("item_solar_crest");
if (e == null) return;
sheep = e.ClassID == ClassID.CDOTA_Unit_Hero_Tidehunter ? null : me.FindItem("item_sheepstick");
vail = me.FindItem("item_veil_of_discord");
cheese = me.FindItem("item_cheese");
ghost = me.FindItem("item_ghost");
atos = me.FindItem("item_rod_of_atos");
soul = me.FindItem("item_soul_ring");
arcane = me.FindItem("item_arcane_boots");
stick = me.FindItem("item_magic_stick") ?? me.FindItem("item_magic_wand");
Shiva = me.FindItem("item_shivas_guard");
var stoneModif = e.Modifiers.Any(y => y.Name == "modifier_medusa_stone_gaze_stone");
var v =
ObjectManager.GetEntities<Hero>()
//.........这里部分代码省略.........
示例4: Execute
public static bool Execute(
Hero target,
Hero[] enemyHeroes,
float ping,
bool onlyDamage,
bool onlyDisable,
Hero me,
float mana)
{
var toggler = MainMenu.ComboKeysMenu.Item("comboAbilitiesToggler").GetValue<AbilityToggler>();
if (Utils.SleepCheck("UpdateCombo"))
{
MyAbilities.Combo =
MyAbilities.OffensiveAbilities.Where(
x => x.Value.IsValid && x.Value.Owner.Equals(me) && toggler.IsEnabled(NameManager.Name(x.Value)))
.OrderBy(x => ComboOrder.GetComboOrder(x.Value, onlyDisable));
Utils.Sleep(500, "UpdateCombo");
}
if (Utils.SleepCheck("casting") && MyAbilities.Combo != null)
{
if (target != null)
{
if (Dictionaries.HitDamageDictionary.ContainsKey(target.Handle)
&& Dictionaries.HitDamageDictionary[target.Handle] * 1.5 >= target.Health
&& target.Distance2D(MyHeroInfo.Position) <= me.GetAttackRange() + 150)
{
return false;
}
if (!Utils.SleepCheck(target.Handle + "KeyCombo"))
{
return false;
}
if (AbilityMain.Me.ClassID == ClassID.CDOTA_Unit_Hero_TemplarAssassin)
{
var r = MyAbilities.Combo.FirstOrDefault(x => x.Key == "templar_assassin_psionic_trapslow");
var modifier = target.FindModifier("modifier_templar_assassin_trap_slow");
if (modifier == null || modifier.RemainingTime < r.Value.GetHitDelay(target))
{
Slow.TemplarAssasinUseTrap(target);
}
}
if (me.ClassID == ClassID.CDOTA_Unit_Hero_Tinker && toggler.IsEnabled("tinker_rearm")
&& MyAbilities.TinkerRearm.CanBeCasted() && Utils.SleepCheck("Ability.TinkerRearm")
&& !MyAbilities.Combo.Any(
x =>
x.Value.CanBeCasted()
|| (x.Value.CanBeCasted(SoulRing.ManaGained) && SoulRing.Check(x.Value))))
{
MyAbilities.TinkerRearm.UseAbility();
Utils.Sleep(
MyAbilities.TinkerRearm.FindCastPoint() * 1000 + Game.Ping
+ MyAbilities.TinkerRearm.GetChannelTime(MyAbilities.TinkerRearm.Level - 1) * 1000 + 500,
"Ability.TinkerRearm");
Utils.Sleep(
MyAbilities.TinkerRearm.FindCastPoint() * 1000 + Game.Ping
+ MyAbilities.TinkerRearm.GetChannelTime(MyAbilities.TinkerRearm.Level - 1) * 1000,
"GlobalCasting");
Utils.Sleep(
MyAbilities.TinkerRearm.FindCastPoint() * 1000 + Game.Ping
+ MyAbilities.TinkerRearm.GetChannelTime(MyAbilities.TinkerRearm.Level - 1) * 1000,
"casting");
Utils.Sleep(
MyAbilities.TinkerRearm.FindCastPoint() * 1000 + Game.Ping
+ MyAbilities.TinkerRearm.GetChannelTime(MyAbilities.TinkerRearm.Level - 1) * 1000,
"cancelorder");
return true;
}
foreach (var data in
MyAbilities.Combo.Where(
x =>
x.Value.IsValid
&& (x.Value.CanBeCasted()
|| (x.Value.CanBeCasted(SoulRing.ManaGained) && SoulRing.Check(x.Value)))
&& !x.Value.IsAbilityBehavior(AbilityBehavior.Hidden)
&& ((x.Value is Item && me.CanUseItems()) || (!(x.Value is Item) && me.CanCast()))
&& (Utils.SleepCheck(x.Value.Handle.ToString())
|| (!x.Value.IsInAbilityPhase && x.Value.FindCastPoint() > 0))))
{
var ability = data.Value;
var name = NameManager.Name(ability);
var category = (name == "lion_impale") ? "disable" : data.Key.Substring(name.Length);
// if (category == "special" || category == "buff")
// {
// continue;
// }
// if (onlyDamage && (category == "disable" || category == "slow" || category == "silence"))
// {
// continue;
// }
// if (onlyDisable && (category == "nuke" || category == "harras"))
// {
// continue;
// }
if (category != "buff" && target.IsMagicImmune() && ability.ImmunityType != (ImmunityType)3)
//.........这里部分代码省略.........
示例5: 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;
}
示例6: LetsTryCastSpell
private static void LetsTryCastSpell(Hero me, Hero target, Ability spellForCast, bool nextSpell=false)
{
var ss = Abilities.FindAbility("invoker_sun_strike");
var icewall = Abilities.FindAbility("invoker_ice_wall");
var blast = Abilities.FindAbility("invoker_deafening_blast");
var tornado = Abilities.FindAbility("invoker_tornado");
var emp = Abilities.FindAbility("invoker_emp");
/*
var coldsnap = me.FindSpell("invoker_cold_snap");
var ghostwalk = me.FindSpell("invoker_ghost_walk");
var forge = me.FindSpell("invoker_forge_spirit");
var emp = me.FindSpell("invoker_emp");
var alacrity = me.FindSpell("invoker_alacrity");
*/
var meteor = Abilities.FindAbility("invoker_chaos_meteor");
var eulmodif = target.FindModifier("modifier_eul_cyclone") ??
target.FindModifier("modifier_invoker_tornado");
/*foreach (var source in target.Modifiers.ToList())
{
PrintInfo(source.StoredName()+": "+source.RemainingTime);
}*/
var timing = Equals(spellForCast, ss)
? 1.7
: Equals(spellForCast, meteor)
? 1.3
: Equals(spellForCast, blast)
? me.Distance2D(target)/1100 + Game.Ping/1000
: (Equals(spellForCast, icewall))
? 2.5
: Equals(spellForCast, emp) ? 2.9 : 0;
if (eulmodif!=null && eulmodif.RemainingTime<=timing)
{
if (icewall != null && Equals(spellForCast, icewall))
{
CastIceWall(me, target, me.Distance2D(target) <= 250,icewall);
}
else
{
UseSpell(spellForCast, target,me);
//Game.PrintMessage(spellForCast.StoredName()+" (2)", MessageType.ChatMessage);
//PrintInfo("caster "+spellForCast.StoredName()+" with timing "+timing);
Utils.Sleep(250, "StageCheck");
_stage++;
}
}
else if (eulmodif == null /*&& !Equals(spellForCast, ss)*/)
{
if (icewall != null && Equals(spellForCast, icewall))
{
CastIceWall(me, target, me.Distance2D(target) <= 300, icewall);
}
else
{
if (me.Distance2D(target) <= 800)
{
var time = 250f;
if (Equals(spellForCast, tornado))
{
if (nextSpell)
time += me.Distance2D(target)/spellForCast.GetProjectileSpeed()*1000 + Game.Ping + 150;
spellForCast.CastSkillShot(target, me.Position, spellForCast.StoredName());
//Game.PrintMessage("CastSkillShot "+spellForCast.CastSkillShot(target, me.Position,spellForCast.StoredName()),MessageType.ChatMessage);
}
else
{
//Game.PrintMessage("suka: " + spellForCast.StoredName(),MessageType.ChatMessage);
UseSpell(spellForCast, target, me);
}
Utils.Sleep(time, "StageCheck");
_stage++;
}
else if (Utils.SleepCheck("range_moving"))
{
Utils.Sleep(200, "range_moving");
me.Move(target.Position);
}
}
}
}