当前位置: 首页>>代码示例>>C#>>正文


C# Hero.GetEnemyTeam方法代码示例

本文整理汇总了C#中Hero.GetEnemyTeam方法的典型用法代码示例。如果您正苦于以下问题:C# Hero.GetEnemyTeam方法的具体用法?C# Hero.GetEnemyTeam怎么用?C# Hero.GetEnemyTeam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Hero的用法示例。


在下文中一共展示了Hero.GetEnemyTeam方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HighestHealthPointsTarget

 /// <summary>
 /// The highest health points target.
 /// </summary>
 /// <param name="source">
 /// The source hero (LocalHero).
 /// </param>
 /// <param name="range">
 /// The range.
 /// </param>
 /// <returns>
 /// The <see cref="Hero"/>.
 /// </returns>
 public static Hero HighestHealthPointsTarget(Hero source, float range)
 {
     return
         Heroes.GetByTeam(source.GetEnemyTeam())
             .Where(hero => hero.IsValid && hero.IsAlive && hero.IsVisible && hero.Distance2D(source) <= range)
             .MaxOrDefault(hero => hero.Health);
 }
开发者ID:nbIxMaN,项目名称:Ensage.Common,代码行数:19,代码来源:TargetSelector.cs

示例2: BestAutoAttackTarget

 /// <summary>
 ///     Find enemy hero that takes least hits to kill
 /// </summary>
 /// <param name="source">Source hero</param>
 /// <returns></returns>
 public static Hero BestAutoAttackTarget(Hero source)
 {
     var attackRange = source.GetAttackRange();
     var enemyHeroes =
         ObjectMgr.GetEntities<Hero>()
             .Where(
                 x =>
                 x.Team == source.GetEnemyTeam() && !x.IsIllusion && x.IsAlive && x.IsVisible
                 && x.Distance2D(source) <= (attackRange + x.HullRadius + source.HullRadius + 50));
     var aaDmg = source.MinimumDamage + source.BonusDamage;
     Hero bestTarget = null;
     var lastHitsToKill = 0f;
     foreach (var enemyHero in enemyHeroes)
     {
         var takenDmg = enemyHero.DamageTaken(aaDmg, DamageType.Physical, source, false);
         var hitsToKill = enemyHero.Health / takenDmg;
         if (bestTarget != null && !(lastHitsToKill > hitsToKill))
         {
             continue;
         }
         bestTarget = enemyHero;
         lastHitsToKill = hitsToKill;
     }
     return bestTarget;
 }
开发者ID:MarkHC,项目名称:Ensage.Common,代码行数:30,代码来源:TargetSelector.cs

示例3: GetComplexDamage

 private static double GetComplexDamage(uint level, Hero enemy, Hero me, double damage)
 {
     switch (me.ClassID)
     {
         case ClassID.CDOTA_Unit_Hero_AntiMage:
             return Math.Floor((enemy.MaximumMana - enemy.Mana)*damage);
         case ClassID.CDOTA_Unit_Hero_DoomBringer:
             var lvldeath = new[] {new[] { 6, 125 }, new[] { 5, 175 }, new[] { 4, 225 }, new[] { 3, 275 }};
             return Math.Floor((enemy.Level == 25 || enemy.Level % lvldeath[level][0] == 0) ? (enemy.MaximumHealth * 0.20 + lvldeath[level][1]) : (lvldeath[level][1]));
         case ClassID.CDOTA_Unit_Hero_Mirana:
             if (me.Distance2D(enemy) < 200)
                 return (damage * 1.75);
             return damage;
         case ClassID.CDOTA_Unit_Hero_Necrolyte:
             return Math.Floor((enemy.MaximumHealth - enemy.Health) * damage);
         case ClassID.CDOTA_Unit_Hero_Nyx_Assassin:
             var tempBurn = damage*Math.Floor(enemy.TotalIntelligence);
             return enemy.Mana < tempBurn ? enemy.Mana : tempBurn;
         case ClassID.CDOTA_Unit_Hero_Obsidian_Destroyer:
             if (me.TotalIntelligence > enemy.TotalIntelligence)
                 return ((Math.Floor(me.TotalIntelligence) - Math.Floor(enemy.TotalIntelligence))*damage);
             return 0;
         case ClassID.CDOTA_Unit_Hero_Elder_Titan:
             var pasDmg = new[] {1.12, 1.19, 1.25, 1.25};
             var pas = me.Spellbook.Spell3.Level;
             if (pas != 0)
             {
                 if (enemy.Modifiers.FirstOrDefault(modifier => modifier.Name == "modifier_elder_titan_natural_order") == null)
                     return (pasDmg[pas] * damage);
                 return damage;
             }
             return damage;
         case ClassID.CDOTA_Unit_Hero_Shadow_Demon:
             var actDmg = new[] {1, 2, 4, 8, 16};
             var poison = enemy.Modifiers.FirstOrDefault(modifier => modifier.Name == "modifier_shadow_demon_shadow_poison");
             if (poison != null)
             {
                 var poisonStack = poison.StackCount;
                 if (poisonStack != 0 && poisonStack < 6)
                     return (actDmg[poisonStack])*damage;
                 if (poisonStack > 5)
                     return (damage * 16) + ((poisonStack - 5) * 50);
             }
             return 0;
         case ClassID.CDOTA_Unit_Hero_Legion_Commander:
             var bonusCreep = new[] {14, 16, 18, 20};
             var bonusHero = new[] {20, 35, 50, 65};
             var heroDmg = ObjectMgr.GetEntities<Hero>().Where(hero => hero.IsAlive && hero.Team == me.GetEnemyTeam() && hero.IsVisible && hero.Health > 0 && enemy.Distance2D(hero) < 330).ToList().Count * bonusHero[level];
             var creepDmg = ObjectMgr.GetEntities<Unit>().Where(unit => ((unit.ClassID == ClassID.CDOTA_BaseNPC_Creep && unit.ClassID != ClassID.CDOTA_BaseNPC_Creature && !unit.IsAncient) || unit.ClassID == ClassID.CDOTA_Unit_VisageFamiliar || unit.ClassID == ClassID.CDOTA_Unit_Undying_Zombie || unit.ClassID == ClassID.CDOTA_Unit_SpiritBear || unit.ClassID == ClassID.CDOTA_Unit_Broodmother_Spiderling || unit.ClassID == ClassID.CDOTA_Unit_Hero_Beastmaster_Boar || unit.ClassID == ClassID.CDOTA_Unit_Hero_Beastmaster_Hawk || unit.ClassID == ClassID.CDOTA_BaseNPC_Invoker_Forged_Spirit) && unit.Team != me.Team && unit.IsAlive && unit.IsVisible && unit.Health > 0 && enemy.Distance2D(unit) < 350).ToList().Count * bonusCreep[level];
             return  Math.Floor((damage + heroDmg + creepDmg));
         case ClassID.CDOTA_Unit_Hero_Zuus:
             var hp = new[] {.05, .07, .09, .11};
             if (me.Spellbook.Spell3.Level > 0 && me.Distance2D(enemy) < 1000)
                 damage = (damage + ((hp[me.Spellbook.Spell3.Level]) * enemy.Health));
             return damage;
     }
     return damage;
 }
开发者ID:YukinoAguria,项目名称:ensagesharp,代码行数:58,代码来源:Program.cs

示例4: ClosestToMouse

 public static Hero ClosestToMouse(Hero source, float range = 600)
 {
     var mousePosition = Game.MousePosition;
     var enemyHeroes = ObjectManager.GetEntities<Hero>()
         .Where(
             x =>
                 x.Team == source.GetEnemyTeam() && !x.IsIllusion && x.IsAlive && x.IsVisible &&
                 EntityExtensions.Distance2D(x, mousePosition) <= range /*&& !x.IsMagicImmune()*/)
         .OrderBy(x => x.Distance2D(mousePosition));
     return enemyHeroes.FirstOrDefault();
 }
开发者ID:JumpAttacker,项目名称:EnsageSharp,代码行数:11,代码来源:Helper.cs

示例5: ClosestToMouse

 public static Hero ClosestToMouse(Hero source, float range = 600)
 {
     var mousePosition = Game.MousePosition;
     var enemyHeroes =
         ObjectMgr.GetEntities<Hero>()
             .Where(
                 x =>
                     x.Team == source.GetEnemyTeam() && !x.IsIllusion && x.IsAlive && x.IsVisible
                     && x.Distance2D(mousePosition) <= range && !x.IsMagicImmune());
     Hero[] closestHero = { null };
     foreach (var enemyHero in enemyHeroes.Where(enemyHero => closestHero[0] == null || closestHero[0].Distance2D(mousePosition) > enemyHero.Distance2D(mousePosition)))
     {
         closestHero[0] = enemyHero;
     }
     return closestHero[0];
 }
开发者ID:JumpAttacker,项目名称:EnsageSharp,代码行数:16,代码来源:Program.cs

示例6: ClosestToMouse

 /// <summary>
 ///     Finds target closest to mouse in specified range
 /// </summary>
 /// <param name="source"></param>
 /// <param name="range"></param>
 /// <returns></returns>
 public static Hero ClosestToMouse(Hero source, float range = 1000)
 {
     var mousePosition = Game.MousePosition;
     var enemyHeroes =
         ObjectMgr.GetEntities<Hero>()
             .Where(
                 x =>
                 x.Team == source.GetEnemyTeam() && !x.IsIllusion && x.IsAlive && x.IsVisible
                 && x.Distance2D(mousePosition) <= range);
     Hero closestHero = null;
     foreach (var enemyHero in enemyHeroes)
     {
         if (closestHero == null || closestHero.Distance2D(mousePosition) > enemyHero.Distance2D(mousePosition))
         {
             closestHero = enemyHero;
         }
     }
     return closestHero;
 }
开发者ID:MarkHC,项目名称:Ensage.Common,代码行数:25,代码来源:TargetSelector.cs

示例7: Game_OnUpdate

        public static void Game_OnUpdate(EventArgs args)
        {	var me = ObjectMgr.LocalHero;
			if (!Game.IsInGame || me == null)
			{
				return;
			}
		
            me = ObjectMgr.LocalHero;
            var target = me.ClosestToMouseTarget(1200);
			var targets = ObjectMgr.GetEntities<Hero>().Where(enemy => enemy.Team == me.GetEnemyTeam() && !enemy.IsIllusion() && enemy.IsVisible && enemy.IsAlive && enemy.Health > 0).ToList();
							








            if (target.IsAlive && !target.IsInvul() && (Game.MousePosition.Distance2D(target) <= 1000 || target.Distance2D(me) <= 600))
            {
			var CheckDrunken = target.Modifiers.Any(y => y.Name == "modifier_brewmaster_drunken_haze");
			var CheckClap = target.Modifiers.Any(y => y.Name == "modifier_brewmaster_thunder_clap");












				
                
                var Necronomicons = ObjectMgr.GetEntities<Creep>().Where(x => (x.ClassID == ClassID.CDOTA_BaseNPC_Creep)
                        && x.IsAlive && x.IsControllable);
                if (Necronomicons == null)
                {
                    return;
                }
                    foreach (var v in Necronomicons)
                    {


                        var archer = ObjectMgr.GetEntities<Unit>().Where(unit => unit.Name == "npc_dota_necronomicon_archer" && unit.IsAlive && unit.IsControllable).ToList();
                        if (archer != null && target.Position.Distance2D(v.Position) <= 650 && v.Spellbook.SpellQ.CanBeCasted() && activated &&
                            Utils.SleepCheck(v.Handle.ToString()))

                        {
                            v.Spellbook.SpellQ.UseAbility(target);
                            Utils.Sleep(300, v.Handle.ToString());
                        }

                        if (target.Position.Distance2D(v.Position) < 1550 && activated &&
                           Utils.SleepCheck(v.Handle.ToString()))
                        {
                            v.Attack(target);
                            Utils.Sleep(700, v.Handle.ToString());
                        }
                    }
				
				//Necronomicon Warrior
				var Necrowarrior = ObjectMgr.GetEntities<Creep>().Where(x => (x.ClassID == ClassID.CDOTA_BaseNPC_Creep)
                        && x.IsAlive && x.IsControllable);
                if (Necrowarrior == null)
                {
                    return;
                }
                    foreach (var v in Necrowarrior)
                    {


                        var warrior = ObjectMgr.GetEntities<Unit>().Where(unit => unit.Name == "npc_dota_necronomicon_warrior" && unit.IsAlive && unit.IsControllable).ToList();
                        

                        if (target.Position.Distance2D(v.Position) < 1550 && activated &&
                           Utils.SleepCheck(v.Handle.ToString()))
                        {
                            v.Attack(target);
                            Utils.Sleep(700, v.Handle.ToString());
                        }
                    }
				//Illusions	
                var illus = ObjectMgr.GetEntities<Hero>().Where(x => x.IsAlive && x.IsControllable && x.Team == me.Team && x.IsIllusion).ToList();
				if (illus == null)
                {
                    return;
                }
				if (activated)
				{
	            foreach (Unit illusion in illus.TakeWhile(illusion => Utils.SleepCheck("illu")))
                        {
                            illusion.Attack(target);
                            Utils.Sleep(1000, "illu");
                        }
				}
				
//.........这里部分代码省略.........
开发者ID:Rgern100,项目名称:memes,代码行数:101,代码来源:Program.cs

示例8: AD

		public static void AD(EventArgs args)
		{
			if (!Game.IsInGame || Game.IsPaused || Game.IsWatchingGame)
                return;
            me = ObjectMgr.LocalHero;
            if (me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Tinker)
                return;
		
			aether = me.FindItem("item_aether_lens");
			//cyclone = me.FindItem("item_cyclone");
			//ghost = me.FindItem("item_ghost");
            //sheep = me.FindItem("item_sheepstick");
            //atos = me.FindItem("item_rod_of_atos");
            FindItems();



			
			if (aether == null)
				aetherrange = 0;
			else
				aetherrange = 200;

				
				
			if (bottle != null && !me.IsInvisible() && !me.IsChanneling() && !me.Spellbook.Spells.Any(x => x.IsInAbilityPhase) && !March.IsInAbilityPhase && me.Modifiers.Any(x => x.Name == "modifier_fountain_aura_buff") && Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(bottle.Name) && Utils.SleepCheck("bottle1"))
			{
				if(!me.Modifiers.Any(x => x.Name == "modifier_bottle_regeneration") && (me.Health < me.MaximumHealth || me.Mana < me.MaximumMana))
					bottle.UseAbility();
				Alies = ObjectMgr.GetEntities<Hero>().Where(x => x.Team == me.Team && x != me && (x.Health < x.MaximumHealth || x.Mana < x.MaximumMana) && !x.Modifiers.Any(y => y.Name == "modifier_bottle_regeneration") && x.IsAlive && !x.IsIllusion && x.Distance2D(me) <= bottle.CastRange).ToList();
				foreach (Hero v in Alies)
					if (v != null)
						bottle.UseAbility(v);
				Utils.Sleep(255, "bottle1");
			}
				

			var enemies = ObjectMgr.GetEntities<Hero>().Where(x => x.IsVisible && x.IsAlive && x.Team == me.GetEnemyTeam() && !x.IsIllusion);
			
				
			foreach (var e in enemies)
			{
				if (e == null)
					return;
				//distance = me.Distance2D(e);
				angle = Math.Abs(e.FindAngleR() - Utils.DegreeToRadian(e.FindAngleForTurnTime(me.NetworkPosition)));

				if (Menu.Item("autoDisable").GetValue<bool>() && me.IsAlive && me.IsVisibleToEnemies)
				{		
					
					
					
					//break linken if tp
					if (!me.IsChanneling()
						&& me.Distance2D(e) <= 800 + aetherrange + ensage_error
						&& me.Distance2D(e) >= 300 + ensage_error
						&& e.Modifiers.Any(y => y.Name == "modifier_teleporting")
						&& e.IsLinkensProtected()
						&& Utils.SleepCheck("tplink")
						)
					{
						if ((cyclone != null && cyclone.CanBeCasted()) || (sheep != null && sheep.CanBeCasted()))
						{ 
							if (atos != null && atos.CanBeCasted())
								atos.UseAbility(e);
							else if (me.Spellbook.SpellQ != null && me.Spellbook.SpellQ.CanBeCasted())
								me.Spellbook.SpellQ.UseAbility(e);
							else if (ethereal != null && ethereal.CanBeCasted())
								ethereal.UseAbility(e);
							else if (dagon != null && dagon.CanBeCasted())
								dagon.UseAbility(e);
							else if ((sheep != null && sheep.CanBeCasted()) && (cyclone != null && cyclone.CanBeCasted()))
								sheep.UseAbility(e);
							//else if (cyclone != null && cyclone.CanBeCasted())
							//    cyclone.UseAbility(e);
						}

						Utils.Sleep(150, "tplink");
					}
					

					
					
						//break TP 
						if (!me.IsChanneling()
							&& me.Distance2D(e) <= 800 + aetherrange + ensage_error
							&& e.Modifiers.Any(y => y.Name == "modifier_teleporting")
							//&& e.IsChanneling()
							&& !e.IsHexed()
							&& !e.Modifiers.Any(y => y.Name == "modifier_eul_cyclone")
							&& !e.IsLinkensProtected()
							&& Utils.SleepCheck("tplink1")
							)
						{
							if (sheep != null && sheep.CanBeCasted())
								sheep.UseAbility(e);
							else if (cyclone != null && cyclone.CanBeCasted())
								cyclone.UseAbility(e);
								
							Utils.Sleep(150, "tplink1");
//.........这里部分代码省略.........
开发者ID:Air13,项目名称:ESharp,代码行数:101,代码来源:Tinker_Air13.cs

示例9: Player_OnExecuteAction


//.........这里部分代码省略.........
						var a = tpos.ToVector2().FindAngleBetween(Game.MousePosition.ToVector2(), true);
						
						safeRange -= (int)me.HullRadius;
						p = new Vector3(
							tpos.X + safeRange * (float)Math.Cos(a),
							tpos.Y + safeRange * (float)Math.Sin(a),
							100);
					}
					else p = Game.MousePosition;				
				
					blink.UseAbility(p);
                    Utils.Sleep(50, "Blinks");

				}
						
				/*
				if (soulring != null && soulring.CanBeCasted() && !me.IsChanneling() && (blink!=null && me.Distance2D(Game.MousePosition) > 650+ aetherrange  + ensage_error) && Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(soulring.Name) && Utils.SleepCheck("Rearms"))
				{
					soulring.UseAbility();
				}
				*/
				if (bottle != null && bottle.CanBeCasted() && !me.IsChanneling() && (blink==null || (blink!=null && me.Distance2D(Game.MousePosition) <= 650+ aetherrange  + ensage_error)) && !me.Modifiers.Any(x => x.Name == "modifier_bottle_regeneration") && (me.MaximumMana-me.Mana)>60 && Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(bottle.Name) && Utils.SleepCheck("Rearms"))
				{
					bottle.UseAbility();
				}
				
				/*
				if (ghost != null && ghost.CanBeCasted() && !me.IsChanneling() && Menu.Item("Items2: ").GetValue<AbilityToggler>().IsEnabled(ghost.Name) && Utils.SleepCheck("Rearms"))
				{
					ghost.UseAbility(false);
				}
				*/

				var enemies = ObjectMgr.GetEntities<Hero>().Where(x => x.IsVisible && x.IsAlive && x.Team == me.GetEnemyTeam() && !x.IsIllusion);
				foreach (var e in enemies)
				{
					if (Rocket != null && Rocket.CanBeCasted() 
						&&  me.Distance2D(e) < 2500 
						&& (blink == null || !blink.CanBeCasted() || me.Distance2D(Game.MousePosition) <= 650+ aetherrange + ensage_error || (me.Modifiers.Any(y => y.Name == "modifier_bloodseeker_rupture") && (me.Distance2D(Game.MousePosition)<=1325 || aetherrange==0)))
						&& !me.IsChanneling() 
						&& !me.Spellbook.Spells.Any(x => x.IsInAbilityPhase) 
						&& Menu.Item("Skills: ").GetValue<AbilityToggler>().IsEnabled(Rocket.Name) 
						&& Utils.SleepCheck("Rearms")
						//&& me.Mana >= Rocket.ManaCost + 75 
						)
					{	
						
						if (soulring != null && soulring.CanBeCasted() && !me.IsChanneling() && Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(soulring.Name) && Utils.SleepCheck("Rearms"))
						{
							soulring.UseAbility();
						}
						
						Rocket.UseAbility();
					}
					
						
					if ((soulring == null || !soulring.CanBeCasted() || !Menu.Item("Items: ").GetValue<AbilityToggler>().IsEnabled(soulring.Name)) && me.Distance2D(e) <= 2500 && (!Rocket.CanBeCasted()  || Rocket.Level <= 0 || !Menu.Item("Skills: ").GetValue<AbilityToggler>().IsEnabled(Rocket.Name)) && (blink == null || !blink.CanBeCasted() || me.Distance2D(Game.MousePosition) <= 650+ aetherrange  + ensage_error) && (Refresh.Level >= 0 && Refresh.CanBeCasted()) && !me.IsChanneling() && !me.Spellbook.Spells.Any(x => x.IsInAbilityPhase)  && Utils.SleepCheck("Rearms") && Utils.SleepCheck("Blinks"))
					{

						Refresh.UseAbility();
						if (Refresh.Level == 1)
							Utils.Sleep(3010, "Rearms");
						if (Refresh.Level == 2)
							Utils.Sleep(1510, "Rearms");
						if (Refresh.Level == 3)
							Utils.Sleep(760, "Rearms");
开发者ID:Air13,项目名称:ESharp,代码行数:67,代码来源:Tinker_Air13.cs

示例10: Game_OnUpdate

        private static void Game_OnUpdate(EventArgs args)
        {
            _mainHero = ObjectMgr.LocalHero;
            //Print($"_mainHero: {_mainHero.Position.X}/{_mainHero.Position.Y}/{_mainHero.Position.Z}");
            if (!_loaded)
            {
                if (!Game.IsInGame || _mainHero == null || _mainHero.ClassID != ClassID.CDOTA_Unit_Hero_ArcWarden)
                {
                    return;
                }
                _loaded = true;
                Game.PrintMessage(
                    "<font face='Comic Sans MS, cursive'><font color='#00aaff'>" + Menu.DisplayName + " By Jumpering" +
                    " loaded!</font> <font color='#aa0000'>v" + Assembly.GetExecutingAssembly().GetName().Version,
                    MessageType.LogMessage);
                LastAttackStart.Clear();
                LastActivity.Clear();
            }

            if (!Game.IsInGame || _mainHero == null)
            {
                _loaded = false;
                return;
            }
            if (Game.IsPaused) return;

            _tick = Environment.TickCount;
            NetworkActivity act;
            var handle = _mainHero.Handle;
            if (!LastActivity.TryGetValue(handle, out act) || _mainHero.NetworkActivity != act)
            {
                LastActivity.Remove(handle);
                LastActivity.Add(handle, _mainHero.NetworkActivity);
                if (_mainHero.IsAttacking())
                {
                    LastAttackStart.Remove(handle);
                    LastAttackStart.Add(handle,_tick);
                }
            }
            foreach (var clone in Objects.Tempest.GetCloneList(_mainHero))
            {
                if (Menu.Item("AutoHeal.Enable").GetValue<KeyBind>().Active)
                {
                    var enemy =
                        ObjectMgr.GetEntities<Unit>()
                            .Any(
                                x =>
                                    x.Team == _mainHero.GetEnemyTeam() && x.IsAlive && x.IsVisible &&
                                    x.Distance2D(_mainHero) < Menu.Item("AutoHeal.Range").GetValue<Slider>().Value);
                    if (!enemy) 
                    {
                        CloneUseHealItems(clone, _mainHero, clone.Distance2D(_mainHero));
                    }
                }
                handle = clone.Handle;
                if (LastActivity.TryGetValue(handle, out act) && clone.NetworkActivity == act) continue;
                LastActivity.Remove(handle);
                LastActivity.Add(handle, clone.NetworkActivity);
                if (!clone.IsAttacking()) continue;
                LastAttackStart.Remove(handle);
                LastAttackStart.Add(handle, _tick);
            }
            if (Menu.Item("spamHotkey").GetValue<KeyBind>().Active)
            {
                SparkSpam(_mainHero);
                return;
            }
            if (Menu.Item("hotkeyClone").GetValue<KeyBind>().Active)
            {
                if (_globalTarget2 == null || !_globalTarget2.IsValid)
                {
                    _globalTarget2 = ClosestToMouse(_mainHero, 500);
                }
                if (_globalTarget2 != null && _globalTarget2.IsValid && _globalTarget2.IsAlive)
                {
                    DoCombo2(_mainHero, _globalTarget2);
                }
            }
            else
            {
                _globalTarget2 = null;
                if (Menu.Item("AutoPush.Enable").GetValue<KeyBind>().Active)
                    AutoPush(_mainHero);
            }

            //if (!me.IsAlive) return;

            var midas = _mainHero.FindItem("item_hand_of_midas");
            if (midas != null && Menu.Item("AutoMidas").GetValue<bool>())
            {
                if (midas.CanBeCasted() && Utils.SleepCheck(_mainHero.Handle + "midas") && _mainHero.IsAlive && !_mainHero.IsInvisible())
                {
                    var enemy =
                        ObjectMgr.GetEntities<Unit>()
                            .Where(
                                x =>
                                    !x.IsMagicImmune() && x.Team != _mainHero.Team &&
                                    (x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Lane ||
                                     x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege ||
                                     x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Neutral) && x.IsSpawned && x.IsAlive &&
//.........这里部分代码省略.........
开发者ID:DevGdos,项目名称:EnsageSharp,代码行数:101,代码来源:Program.cs

示例11: CalculateDamage


//.........这里部分代码省略.........
                    var agiMultiplier = backstab.GetAbilityData("damage_multiplier");
                    var blinkdamage = target.DamageTaken(
                        damage, 
                        DamageType.Magical, 
                        source, 
                        data.MagicImmunityPierce, 
                        minusMagicResistancePerc: minusMagicResistancePerc);
                    outgoingDamage = blinkdamage
                                     + target.DamageTaken(
                                         agiMultiplier * source.TotalAgility
                                         + (source.MinimumDamage + source.BonusDamage), 
                                         DamageType.Physical, 
                                         source, 
                                         data.MagicImmunityPierce, 
                                         minusMagicResistancePerc: minusMagicResistancePerc);
                    break;
                case "undying_soul_rip":
                    var radius = ability.GetAbilityData("radius");
                    var nearUnits =
                        ObjectMgr.GetEntities<Unit>()
                            .Where(
                                x =>
                                !x.Equals(source) && !x.Equals(target)
                                && (x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Lane
                                    || x.ClassID == ClassID.CDOTA_BaseNPC_Creep
                                    || x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Neutral
                                    || x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege
                                    || x.ClassID == ClassID.CDOTA_BaseNPC_Creature
                                    || x.ClassID == ClassID.CDOTA_BaseNPC_Invoker_Forged_Spirit
                                    || x.ClassID == ClassID.CDOTA_Unit_Undying_Zombie
                                    || x.ClassID == ClassID.CDOTA_BaseNPC_Warlock_Golem
                                    || (x is Hero
                                        && (x.Team == source.Team
                                            || (x.Team == source.GetEnemyTeam() && !x.IsMagicImmune())))) && x.IsAlive
                                && x.IsVisible && x.Distance2D(source) < radius + x.HullRadius);
                    var damagePerUnit = ability.GetAbilityData("damage_per_unit");
                    var maxUnits = ability.GetAbilityData("max_units");
                    outgoingDamage = Math.Min(nearUnits.Count(), maxUnits) * damagePerUnit;
                    outgoingDamage = target.DamageTaken(
                        outgoingDamage, 
                        DamageType.Magical, 
                        source, 
                        data.MagicImmunityPierce, 
                        minusMagicResistancePerc: minusMagicResistancePerc);
                    break;
                default:
                    var damageString = data.DamageString;
                    if (damageString == null)
                    {
                        outgoingDamage = ability.GetDamage(level - 1);

                        // Convert.ToSingle(
                        // Game.FindKeyValues(name + "/AbilityDamage", KeyValueSource.Ability)
                        // .StringValue.Split(' ')[level - 1]);
                    }
                    else
                    {
                        if (ability.AbilityType.HasFlag(AbilityType.Ultimate) && level > 0 && source.AghanimState())
                        {
                            level -= 1;
                        }

                        if (data.SpellLevel != null)
                        {
                            var spellLevel = source.FindSpell(data.SpellLevel);
                            level = spellLevel.Level;
开发者ID:nbIxMaN,项目名称:Ensage.Common,代码行数:67,代码来源:AbilityDamage.cs

示例12: FastestKillable

 private static Hero FastestKillable(Hero source, float range = 600)
 {
     var mousePosition = Game.MousePosition;
     var enemyHeroes = ObjectManager.GetEntities<Hero>()
         .Where(
             x =>
                 x.Team == source.GetEnemyTeam() && !x.IsIllusion && x.IsAlive && x.IsVisible &&
                 x.Distance2D(mousePosition) <= range /*&& !x.IsMagicImmune()*/)
         .OrderBy(x => x.Health);
     return enemyHeroes.FirstOrDefault();
 }
开发者ID:JumpAttacker,项目名称:EnsageSharp,代码行数:11,代码来源:Core.cs

示例13: Game_OnUpdate

        public static void Game_OnUpdate(EventArgs args)
        {
            me = ObjectMgr.LocalHero;
            var targets = ObjectMgr.GetEntities<Hero>().Where(enemy => enemy.Team == me.GetEnemyTeam() && !enemy.IsIllusion() && enemy.IsVisible && enemy.IsAlive && enemy.Health > 0).ToList();
            if (!Game.IsInGame || Game.IsPaused || Game.IsWatchingGame)
                return;

            if (me.ClassID != ClassID.CDOTA_Unit_Hero_AntiMage)
                return;

            if (me == null)
                return;
            if (ulti == null)
                ulti = me.Spellbook.Spell4;

            if (Menu.Item("Killsteal").GetValue<bool>())
            {
                double modif = 0;
                switch (ulti.Level)
                {
                    case 1:
                        modif = .6;
                        break;

                    case 2:
                        modif = .85;
                        break;

                    case 3:
                        modif = 1.1;
                        break;
                    default:
                        break;
                }

                foreach (var target in targets)
                {
                    double damage = 0;
                    damage = Math.Floor((target.MaximumMana - target.Mana) * modif);
                    double damagefinal = target.DamageTaken((float)damage, DamageType.Magical, me, false);
                    double damageNeeded = target.Health - damagefinal + ulti.GetCastPoint(ulti.Level) * target.HealthRegeneration;
                    if (damageNeeded < 0 && ulti.CanBeCasted() && Utils.SleepCheck("ulti") && GetDistance2D(target.Position, me.Position) < 600)
                    {
                        ulti.UseAbility(target);
                        Utils.Sleep(150 + Game.Ping, "ulti");
                    }
                }
            }

            if (blink == null)
                blink = me.Spellbook.Spell2;

            if (armlet == null)
                armlet = me.FindItem("item_armlet");
            if (manta == null)
                manta = me.FindItem("item_manta");
            if (mjollnir == null)
                mjollnir = me.FindItem("item_mjollnir");
            if (dust == null)
                dust = me.FindItem("item_dust");
            if (bladeMail == null)
                bladeMail = me.FindItem("item_blade_mail");
            if (mom == null)
                mom = me.FindItem("item_mask_of_madness");
            if (medallion == null)
                medallion = me.FindItem("item_medallion_of_courage");
            if (solar == null)
                solar = me.FindItem("item_solar_crest");
            if (abyssal == null)
                abyssal = me.FindItem("item_abyssal_blade");

            if (manta != null && manta.CanBeCasted() && Menu.Item("Manta").GetValue<bool>() && me.IsSilenced())
            {
                manta.UseAbility();
                Utils.Sleep(150 + Game.Ping, "manta");
            }

            var illus = ObjectMgr.GetEntities<Hero>().Where(x => x.IsAlive && x.IsControllable && x.Team == me.Team && x.IsIllusion && x.Modifiers.Any(y => y.Name != "modifier_kill")).ToList();

            if (Menu.Item("Illusion").GetValue<bool>())
            {
                foreach (var enemy in targets)
                {
                    if (enemy.Health > 0)
                    {
                        foreach (var illusion in illus)
                        {
                            if (GetDistance2D(enemy.Position, illusion.Position) < 400 && Utils.SleepCheck(illusion.Handle.ToString()))
                            {
                                illusion.Attack(enemy);
                                Utils.Sleep(1000, illusion.Handle.ToString());
                            }
                        }
                    }
                }
            }
            if (combo && Menu.Item("enable").GetValue<bool>())
            {
                target = me.ClosestToMouseTarget(1000);

//.........这里部分代码省略.........
开发者ID:spyware293,项目名称:Ensage,代码行数:101,代码来源:Program.cs

示例14: Game_OnUpdate

        public static void Game_OnUpdate(EventArgs args)
        {
            _source = ObjectMgr.LocalHero;

            if (!Game.IsInGame||Game.IsPaused||Game.IsWatchingGame)
            {
                return;
            }
            if (_source.ClassID != ClassID.CDOTA_Unit_Hero_Bristleback)
            {
                return;
            }
            var _enemy = ObjectMgr.GetEntities<Hero>().Where(hero => hero.IsAlive && !hero.IsIllusion && hero.IsVisible && hero.Team != _source.Team);
            var _creep = ObjectMgr.GetEntities<Creep>().Where(x => (x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Lane || x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege) && x.IsAlive && x.IsSpawned && x.IsVisible).ToList();
            if (_source == null)
            {
                return;
            }
            if (Quill == null)
            {
                Quill = _source.Spellbook.Spell2;
            }
            if (Goo == null)
            {
                Goo = _source.Spellbook.Spell1;
            }
            if (abyssal == null)
            {
                abyssal = _source.FindItem("item_abyssal_blade");
            }
            if (dust == null)
            {
                dust = _source.FindItem("item_dust");
            }
            if (atos == null)
            {
                atos = _source.FindItem("item_rod_of_atos");
            }
            if (solar == null)
            {
                solar = _source.FindItem("item_solar_crest");
            }
            if (medallion == null)
            {
                medallion = _source.FindItem("item_medallion_of_courage");
            }
            if (halberd == null)
            {
                halberd = _source.FindItem("item_heavens_halberd");
            }
            if (Menu.Item("Quill").GetValue<StringList>().SelectedIndex == 3 && Quill.CanBeCasted() && _source.CanCast() && Utils.SleepCheck("quill") && !_source.IsChanneling() && !_source.IsInvisible())
            {

                foreach (var x in _creep)
                {
                    if (x.Team == _source.GetEnemyTeam() && x.Health > 0 && x.Health < (Quilldmg[Quill.Level-1] * (1-x.DamageResist)+20) && GetDistance2D(x.Position, _source.Position) < Quill.CastRange && Utils.SleepCheck("quill"))
                    {
                        Quill.UseAbility();
                        Utils.Sleep(150 + Game.Ping, "quill");
                    }
                }
            }
            if (Menu.Item("Quill").GetValue<StringList>().SelectedIndex == 0 && Quill.CanBeCasted() && _source.CanCast() && Utils.SleepCheck("quill") && !_source.IsChanneling() && !_source.IsInvisible())
            {
                Quill.UseAbility();
                Utils.Sleep(150 + Game.Ping, "quill");
            }
            if (Menu.Item("Quill").GetValue<StringList>().SelectedIndex == 1 && Quill.CanBeCasted() && _source.CanCast() && Utils.SleepCheck("quill") && !_source.IsChanneling() && !_source.IsInvisible())
            {
                foreach (var enemy in _enemy)
                {
                    if (GetDistance2D(enemy.Position, _source.Position) < Quill.CastRange)
                    {
                        Quill.UseAbility();
                        Utils.Sleep(150 + Game.Ping, "quill");
                    }
                }

            }
            if (chase && Menu.Item("enable").GetValue<bool>())
            {
                _target = _source.ClosestToMouseTarget(1000);
                if (_source.CanAttack() && _source.CanCast())
                {
                    var linken = _target.Modifiers.Any(x => x.Name == "modifier_item_spheretarget") || _target.Inventory.Items.Any(x => x.Name == "item_sphere");
                    if (abyssal != null && abyssal.CanBeCasted() && Utils.SleepCheck("item_abyssal") && !linken)
                    {
                        abyssal.UseAbility(_target);
                        Utils.Sleep(400 + Game.Ping, "item_abyssal");
                    }
                    if (abyssal != null)
                    {
                        Utils.ChainStun(_source, 310, null, false);
                    }
                    if (medallion != null && medallion.CanBeCasted() && Utils.SleepCheck("item_medal") && !linken)
                    {
                        medallion.UseAbility(_target);
                        Utils.Sleep(150 + Game.Ping, "item_medal");
                    }
                    if (atos != null && atos.CanBeCasted() && Utils.SleepCheck("item_atos") && !linken)
//.........这里部分代码省略.........
开发者ID:spyware293,项目名称:Ensage,代码行数:101,代码来源:Program.cs

示例15: Game_OnUpdate

        private static void Game_OnUpdate(EventArgs args)
        {
            if (!loaded)
            {
                me = ObjectMgr.LocalHero;
                if (!Game.IsInGame || me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Techies)
                {
                    return;
                }
                loaded = true;
                remoteMines = me.Spellbook.SpellR;
                suicideAttack = me.Spellbook.SpellE;
                landMines = me.Spellbook.SpellQ;
                forceStaff = null;
                //enemyHeroes = null;
                players = null;
                remoteMinesDb = new Dictionary<Unit, float>();
                heroTopPanel = new Dictionary<ClassID, double[]>();
                landMinesHeroDmg = new Dictionary<ClassID, double>();
                suicideHeroDmg = new Dictionary<ClassID, float>();
                enabledHeroes = new Dictionary<ClassID, bool>();
                var screenSize = new Vector2(Drawing.Width, Drawing.Height);
                monitor = screenSize.X / 1280;
                if (me.AghanimState())
                {
                    var firstOrDefault = remoteMines.AbilityData.FirstOrDefault(x => x.Name == "damage_scepter");
                    if (firstOrDefault != null)
                    {
                        remoteMinesDmg = firstOrDefault.GetValue(remoteMines.Level - 1);
                    }
                }
                else
                {
                    var firstOrDefault = remoteMines.AbilityData.FirstOrDefault(x => x.Name == "damage");
                    if (firstOrDefault != null)
                    {
                        remoteMinesDmg = firstOrDefault.GetValue(remoteMines.Level - 1);
                    }
                }
                foreach (var bomb in
                    ObjectMgr.GetEntities<Unit>()
                        .Where(
                            x =>
                            x.ClassID == ClassID.CDOTA_NPC_TechiesMines && x.Spellbook.Spell1 != null
                            && x.Spellbook.Spell1.IsValid && x.Spellbook.Spell1.CanBeCasted() && x.IsAlive)
                        .Where(bomb => !remoteMinesDb.ContainsKey(bomb)))
                {
                    remoteMinesDb.Add(bomb, remoteMinesDmg);
                }
                //enemyHeroes =
                //    ObjectMgr.GetEntities<Hero>()
                //        .Where(x => x != null && x.IsValid && x.Team == me.GetEnemyTeam() && !x.IsIllusion);
                players =
                    ObjectMgr.GetEntities<Player>()
                        .Where(x => x != null && x.Hero != null && x.Hero.Team == me.GetEnemyTeam());
                Game.PrintMessage(
                    "<font face='Tahoma'><font color='#993311'>#TECHIES</font> by MOON<font color='#ff9900'>ES</font> loaded!</font> ",
                    MessageType.LogMessage);
            }
            if (!Game.IsInGame || me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Techies)
            {
                loaded = false;
                return;
            }

            if (Game.IsPaused)
            {
                return;
            }

            if (forceStaff == null && Menu.Item("useForceStaff").GetValue<bool>())
            {
                forceStaff = me.Inventory.Items.FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Item_ForceStaff);
            }

            var suicideLevel = suicideAttack.Level;

            if (suicideAttackLevel != suicideLevel)
            {
                var firstOrDefault = suicideAttack.AbilityData.FirstOrDefault(x => x.Name == "damage");
                if (firstOrDefault != null)
                {
                    suicideAttackDmg = firstOrDefault.GetValue(suicideLevel - 1);
                }
                var abilityData = suicideAttack.AbilityData.FirstOrDefault(x => x.Name == "small_radius");
                if (abilityData != null)
                {
                    suicideAttackRadius = abilityData.Value;
                }
                suicideAttackLevel = suicideLevel;
            }

            var bombLevel = remoteMines.Level;

            if (remoteMinesLevel != bombLevel)
            {
                if (me.AghanimState())
                {
                    var firstOrDefault = remoteMines.AbilityData.FirstOrDefault(x => x.Name == "damage_scepter");
                    if (firstOrDefault != null)
//.........这里部分代码省略.........
开发者ID:xzyxzy,项目名称:EnsageSharp-1,代码行数:101,代码来源:Techies.cs


注:本文中的Hero.GetEnemyTeam方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。