Ejemplo n.º 1
0
        private static void AutoReload()
        {
            if (Heroes.Any(x => x.IsMyHero && x.IsValid && x.Id != HeroId.npc_dota_hero_base))
            {
                return;
            }

            ForceReload();
        }
Ejemplo n.º 2
0
        private void OnNewHero(object sender, Hero hero)
        {
            DelayAction.Add(350, () =>
            {
                if (hero == null || !hero.IsValid)
                {
                    return;
                }
                if (hero.IsIllusion)
                {
                    return;
                }
                if (Heroes.Any(x => x.Hero.Equals(hero)))
                {
                    Log.Error($"Cant init New Hero -> {hero.GetDisplayName()} [{hero.Handle}]");
                    return;
                }

                if (hero.HeroId == HeroId.npc_dota_hero_monkey_king)
                {
                    if (!hero.Spellbook.Spells.Any())
                    {
                        Log.Error($"Monkey king bugisoft (ubishit) -> [{hero.Handle}]");
                        return;
                    }
                }

                var myTeam     = Main.Context.Value.Owner.Team;
                var targetTeam = hero.Team;
                var isAlly     = myTeam == targetTeam;

                var newHero = new HeroContainer(hero, isAlly, Main);
                if (hero.HeroId == HeroId.npc_dota_hero_phantom_assassin && !isAlly)
                {
                    Main.Config.ShowMeMore.InitPhantomAssiasin(newHero);
                }
                try
                {
                    Heroes.Add(newHero);

                    if (isAlly)
                    {
                        AllyHeroes.Add(newHero);
                    }
                    else
                    {
                        EnemyHeroes.Add(newHero);
                    }

                    Log.Info($"New Hero -> {hero.GetDisplayName()} [{hero.Handle}] [{(isAlly ? "Ally" : "Enemy")}]");
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            });
        }
Ejemplo n.º 3
0
        private void OnNewHero(object sender, Hero hero)
        {
            DelayAction.Add(100, () =>
            {
                if (hero == null || !hero.IsValid)
                {
                    return;
                }
                if (hero.IsIllusion)
                {
                    return;
                }
                if (Heroes.Any(x => x.Hero.Equals(hero)))
                {
                    Log.Error($"Cant init New Hero -> {hero.GetDisplayName()} [{hero.Handle}]");
                    return;
                }
                if (hero.ClassId == ClassId.CDOTA_Unit_Hero_MonkeyKing)
                {
                    if (!hero.Spellbook.Spells.Any())
                    {
                        Log.Error($"Monkey king bugisoft (ubishit) -> [{hero.Handle}]");
                        return;
                    }
                }
                var myTeam     = Main.Context.Value.Owner.Team;
                var targetTeam = hero.Team;
                var isAlly     = myTeam == targetTeam;
                var newHero    = new HeroContainer(hero, isAlly, Main);
                try
                {
                    Heroes.Add(newHero);

                    if (isAlly)
                    {
                        AllyHeroes.Add(newHero);
                    }
                    else
                    {
                        EnemyHeroes.Add(newHero);
                    }

                    Log.Info($"New Hero -> {hero.GetDisplayName()} [{hero.Handle}] [{(isAlly ? "Ally" : "Enemy")}]");
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            });
        }
Ejemplo n.º 4
0
        private void OnGameEvent(object sender, GameEventArgs e)
        {
            int n;

            switch (e.EventType)
            {
            case EventType.Death:
                if (Heroes.Any(x => x.IsAlive))
                {
                    n = rnd.Next(0, Heroes.Count);
                    for (; ; n = (n + 1) % Heroes.Count)
                    {
                        if (Heroes[n].IsAlive)
                        {
                            Heroes[n].Die();
                            break;
                        }
                    }
                }
                else
                {
                    AllDied?.Invoke(this, new EventArgs());
                }
                break;

            case EventType.TreasureFound:
                n      = rnd.Next(10, 100);
                Money += n;
                Console.WriteLine($"HellYeah! Your party found some gold coins: {n}.\n");
                break;

            case EventType.TreasureLost:
                n      = rnd.Next(Money / 4, Money / 2);
                Money -= n;
                Console.WriteLine($"Oopsie! One of your party members dropped a sack of coins.\n" +
                                  $"Your lost {n} gold ({Money} left).\n");
                break;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void PlayButton_Selected(object sender, EventArgs e)
        {
            if (Heroes.Any(hero => hero == null))
            {
                return;
            }
            var screen = new GameScreen();

            // Generate the team
            GameSettings.SaveGameName = string.Empty;

            Team gsteam = new Team();

            for (int i = 0; i < 4; i++)
            {
                gsteam.AddHero(Heroes[i], (HeroPosition)i);
            }

            screen.NewGame(gsteam);

            ScreenManager.AddScreen(screen);

            ExitScreen();
        }
Ejemplo n.º 6
0
 public bool AnyAlive()
 {
     return(Heroes.Any(x => x.IsAlive));
 }