Exemplo n.º 1
0
        public void End()
        {
            Completed.Add(Active);
            var oldActive1 = Active;

            Console.WriteLine($"Turns - {oldActive1} ends turn - Start");
            bool containsEveryone = Enemies.All(enemy => enemy.EnemyType == EnemyType.Enviroment || Completed.Contains(enemy) || enemy.IsDead);
            bool containsHeroes   = Heroes.Where(hero => hero is Hero && hero.Actions.Count() > 0)
                                    .All((hero) => Completed.Contains(hero));

            if (Heroes.Where(hero => hero is Hero && hero.Actions.Count() > 0).All((hero) => Completed.Contains(hero)) && !containsEveryone)
            {
                Active = Enemies.First(enemy => enemy.EnemyType != EnemyType.Enviroment && !Completed.Contains(enemy) && enemy.IsAlive());
            }
            else
            {
                var oldActive = Active;
                foreach (Hero hero in Heroes)
                {
                    Console.WriteLine($"------  {hero}");
                }

                if (containsEveryone && containsHeroes)
                {
                    Completed.Clear();
                    Console.WriteLine($"-------- yoyo");
                    oldActive = null;
                }
                var nextTurn = Heroes.First((hero) => hero != oldActive && hero.Actions.Length > 0);
                Console.WriteLine($"-------- next Turn = {nextTurn}");
                Active = nextTurn;
            }
            Console.WriteLine($"--------- {oldActive1} ends turn, new active is now {Active} - END");
        }
Exemplo n.º 2
0
        public async void OnSelectHero(object sender, ItemClickEventArgs e)
        {
            LoadingComics = true;

            var clickedItem = (MarvelCharacter)e.ClickedItem;

            SelectedHero = Heroes.First(a => a.Id == clickedItem.Id);
            var data = await GetCharacterComicsDataAysnc(SelectedHero.Id);

            Comics = data;

            LoadingComics = false;
        }
Exemplo n.º 3
0
 public int?HeroLevel(string name) => Heroes.First(h => h.Name == name).Level;