本文整理汇总了C#中Unit.IsMagicImmune方法的典型用法代码示例。如果您正苦于以下问题:C# Unit.IsMagicImmune方法的具体用法?C# Unit.IsMagicImmune怎么用?C# Unit.IsMagicImmune使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Unit
的用法示例。
在下文中一共展示了Unit.IsMagicImmune方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckTarget
private static bool CheckTarget(Unit enemy, bool doubleOwnage = false)
{
if (enemy.IsIllusion || !enemy.IsValidTarget(dagon.GetCastRange(), true, hero.NetworkPosition))
{
return false;
}
if (enemy.IsLinkensProtected() || enemy.IsMagicImmune())
{
return false;
}
if (!enemy.CanDie() || enemy.Modifiers.Any(x => IgnoreModifiers.Any(x.Name.Equals)))
{
return false;
}
var damage = AbilityDamage.CalculateDamage(dagon, hero, enemy);
if (doubleOwnage)
{
damage *= 2;
}
return enemy.Health < damage;
}
示例2: CheckTarget
private static bool CheckTarget(Unit enemy)
{
if (enemy == null || enemy.IsIllusion || !enemy.IsValidTarget(dagon.GetCastRange(), true, me.NetworkPosition) || enemy.IsLinkensProtected() || enemy.IsMagicImmune() || !enemy.CanDie() || enemy.Modifiers.Any(x => IgnoreModifiers.Any(x.Name.Equals)))
return false;
return enemy.Health <
enemy.SpellDamageTaken(dagon.GetAbilityData("damage"), DamageType.Magical, me, dagon.Name);
}
示例3: CanBeCasted
/// <summary>
/// Checks if given ability can be used
/// </summary>
/// <param name="ability"></param>
/// <param name="target"></param>
/// <returns>returns true in case ability can be used</returns>
public static bool CanBeCasted(this Ability ability, Unit target)
{
if (!target.IsValidTarget())
{
return false;
}
var canBeCasted = ability.CanBeCasted();
if (!target.IsMagicImmune())
{
return canBeCasted;
}
var data = AbilityDatabase.Find(ability.Name);
return data == null ? canBeCasted : data.MagicImmunityPierce;
}
示例4: Attack
/// <summary>
/// Attacks target, uses spell UniqueAttackModifiers if enabled
/// </summary>
/// <param name="target"></param>
/// <param name="useModifiers"></param>
public static void Attack(Unit target, bool useModifiers)
{
if (target is Hero && me.CanCast() && useModifiers)
{
if (me.ClassID == ClassID.CDOTA_Unit_Hero_Clinkz)
{
var searinga = me.Spellbook.Spell2;
if (searinga.Level > 0 && me.Mana > searinga.ManaCost)
{
searinga.UseAbility(target);
return;
}
}
else if (me.ClassID == ClassID.CDOTA_Unit_Hero_DrowRanger && !target.IsMagicImmune())
{
var frost = me.Spellbook.Spell1;
if (frost.Level > 0 && me.Mana > frost.ManaCost)
{
frost.UseAbility(target);
return;
}
}
else if (me.ClassID == ClassID.CDOTA_Unit_Hero_Viper && !target.IsMagicImmune())
{
var poison = me.Spellbook.Spell1;
if (poison.Level > 0 && me.Mana > poison.ManaCost)
{
poison.UseAbility(target);
return;
}
}
else if (me.ClassID == ClassID.CDOTA_Unit_Hero_Huskar && !target.IsMagicImmune())
{
var burning = me.Spellbook.Spell2;
if (burning.Level > 0 && me.Health > me.MaximumHealth * 0.35)
{
burning.UseAbility(target);
return;
}
}
else if (me.ClassID == ClassID.CDOTA_Unit_Hero_Silencer && !target.IsMagicImmune())
{
var glaives = me.Spellbook.Spell2;
if (glaives.Level > 0 && me.Mana > glaives.ManaCost)
{
glaives.UseAbility(target);
return;
}
}
else if (me.ClassID == ClassID.CDOTA_Unit_Hero_Jakiro && !target.IsMagicImmune())
{
var liquid = me.Spellbook.Spell3;
if (liquid.Level > 0 && liquid.CanBeCasted())
{
liquid.UseAbility(target);
return;
}
}
else if (me.ClassID == ClassID.CDOTA_Unit_Hero_Obsidian_Destroyer && !target.IsMagicImmune())
{
var arcane = me.Spellbook.Spell1;
if (arcane.Level > 0 && me.Mana > arcane.ManaCost)
{
arcane.UseAbility(target);
return;
}
}
else if (me.ClassID == ClassID.CDOTA_Unit_Hero_Enchantress && !target.IsMagicImmune())
{
var impetus = me.Spellbook.Spell4;
if (impetus.Level > 0 && me.Mana > impetus.ManaCost)
{
impetus.UseAbility(target);
return;
}
}
}
me.Attack(target);
}
示例5: UseOnTarget
private static bool UseOnTarget(IEnumerable<string> abilitiesNames, Unit target, double castpoint = 5) {
if (!Menu.Item("disable").GetValue<bool>())
return false;
foreach (
var ability in
abilitiesNames.Select(ability => hero.FindItem(ability) ?? hero.FindSpell(ability))
.Where(
ability => ability != null && ability.CanBeCasted() && (ability is Item || hero.CanCast()))) {
if (ability.IsAbilityBehavior(AbilityBehavior.NoTarget)) {
if (ability.GetCastDelay(hero, target, true) <= castpoint &&
target.IsValidTarget(ability.GetCastRange(), false, hero.NetworkPosition) &&
(!target.IsMagicImmune() || IgnoresMagicImmunity.Any(ability.Name.Equals))) {
ability.UseAbility();
} else continue;
} else if (ability.IsAbilityBehavior(AbilityBehavior.UnitTarget)) {
if (ability.GetCastDelay(hero, target, true) <= castpoint &&
target.IsValidTarget(ability.GetCastRange(), false, hero.NetworkPosition) &&
(!target.IsMagicImmune() || IgnoresMagicImmunity.Any(ability.Name.Equals))) {
ability.UseAbility(target);
} else continue;
} else {
if (ability.GetCastDelay(hero, target, true) <= castpoint &&
target.IsValidTarget(ability.GetCastRange(), false, hero.NetworkPosition) &&
(!target.IsMagicImmune() || IgnoresMagicImmunity.Any(ability.Name.Equals))) {
ability.UseAbility(hero.Position);
} else continue;
}
Utils.Sleep(1000, "CounterDelay");
return true;
}
return false;
}
示例6: CanBeCasted
/// <summary>
/// Checks if given ability can be used
/// </summary>
/// <param name="ability">
/// The ability.
/// </param>
/// <param name="target">
/// The target.
/// </param>
/// <returns>
/// returns true in case ability can be used
/// </returns>
public static bool CanBeCasted(this Ability ability, Unit target)
{
if (ability == null || !ability.IsValid)
{
return false;
}
if (target == null || !target.IsValid)
{
return false;
}
if (!target.IsValidTarget())
{
return false;
}
var canBeCasted = ability.CanBeCasted();
if (!target.IsMagicImmune())
{
return canBeCasted;
}
var data = ability.CommonProperties();
return data == null ? canBeCasted : data.MagicImmunityPierce;
}
示例7: CanBeCasted
/// <summary>
/// Checks if given ability can be used
/// </summary>
/// <param name="ability"></param>
/// <param name="target"></param>
/// <returns>returns true in case ability can be used</returns>
public static bool CanBeCasted(this Ability ability, Unit target)
{
if (!target.IsValidTarget())
{
return false;
}
var canBeCasted = ability.CanBeCasted();
if (!target.IsMagicImmune())
{
return canBeCasted;
}
AbilityInfo data;
if (!AbilityDamage.DataDictionary.TryGetValue(ability, out data))
{
data = AbilityDatabase.Find(ability.Name);
AbilityDamage.DataDictionary.Add(ability, data);
}
return data == null ? canBeCasted : data.MagicImmunityPierce;
}
示例8: UseOnTarget
private static bool UseOnTarget(Unit target, double castpoint, params string[][] abilitiesNames) {
if (!Program.Menu.Item("disable").GetValue<bool>())
return false;
var canCast = Program.Hero.CanCast();
var magicImmune = target.IsMagicImmune();
var castDelay = 0d;
var ability =
abilitiesNames.SelectMany(
x =>
x.Select(y => Program.Hero.FindItem(y) ?? Program.Hero.FindSpell(y))
.Where(
y =>
y.CanBeCasted() && (castDelay = y.GetCastDelay(Program.Hero, target)) < castpoint &&
target.IsValidTarget(y.GetCastRange(), false, Program.Hero.NetworkPosition) &&
(!magicImmune || y.PiercesMagicImmunity()) &&
(y is Item || canCast))).FirstOrDefault();
if (ability == null)
return false;
if (ability.IsAbilityBehavior(AbilityBehavior.NoTarget))
ability.UseAbility();
else if (ability.IsAbilityBehavior(AbilityBehavior.UnitTarget))
ability.UseAbility(target);
else
ability.UseAbility(target.NetworkPosition);
Utils.Sleep(castDelay * 1000 + Program.Menu.Item("delay").GetValue<Slider>().Value, "CounterDelay");
return true;
}
示例9: CheckTarget
private static bool CheckTarget(Unit enemy, bool doubleOwnage = false) {
if (enemy.IsIllusion || !enemy.IsValidTarget(dagon.GetCastRange(), true, hero.NetworkPosition))
return false;
if (enemy.IsLinkensProtected() || enemy.IsMagicImmune())
return false;
if (!enemy.CanDie() || enemy.Modifiers.Any(x => IgnoreModifiers.Any(x.Name.Equals)))
return false;
return enemy.Health <
enemy.DamageTaken(DagonDamage[dagon.Level - 1] * (doubleOwnage ? 2 : 1), DamageType.Magical, hero);
}
示例10: CheckEnemy
protected virtual bool CheckEnemy(Unit unit)
{
return !unit.IsInvul()
&& (CanBeUsedOnAlly || unit.Equals(Hero)
|| ((PiercesMagicImmunity || !unit.IsMagicImmune())
&& (IgnoresLinkensSphere || !unit.IsLinkensProtected())));
}