Пример #1
0
        public void SetPlayer(int id)
        {
            Dead     = false;
            GameText = new GameText();
            PlayerRepo repo = new PlayerRepo(new PlayerQuery());

            CurrentPlayer              = repo.GetPlayer(id);
            CurrentPlayer.UsedMagic    = repo.EquipedMagic(CurrentPlayer.Id);
            CurrentPlayer.CurrentMagic = repo.PlayerMagic(CurrentPlayer.Id);
            GameText.AddText(CurrentPlayer.Name);
            CurrentEnemy = null;
        }
Пример #2
0
        public void Endturn()
        {
            if (CurrentPlayer.Health <= 0)
            {
                GameText.AddText("You Died");
                Dead = true;
            }
            else
            {
                PlayerRepo repo   = new PlayerRepo(new PlayerQuery());
                GameRepo   g_repo = new GameRepo(new GameQuery());
                CurrentPlayer.Mana   += CurrentPlayer.ManaRegen;
                CurrentPlayer.Health += CurrentPlayer.HealthRegen;
                repo.UpdatePlayer(CurrentPlayer);
                CurrentPlayer              = repo.GetPlayer(CurrentPlayer.Id);
                CurrentPlayer.UsedMagic    = repo.EquipedMagic(CurrentPlayer.Id);
                CurrentPlayer.CurrentMagic = repo.PlayerMagic(CurrentPlayer.Id);
                if (CurrentEnemy != null)
                {
                    if (CurrentEnemy.Health <= 0)
                    {
                        GameText.AddText(CurrentPlayer.Name + " Defeated " + CurrentEnemy.Name + " And gained " +
                                         CurrentEnemy.ExperienceDrop + " experience");

                        List <int> items = new List <int>();
                        Item       item  = g_repo.GetItem(CurrentPlayer.Level);

                        GameText.AddText(CurrentEnemy.Name + " Dropped a " + item.Name);

                        items.Add(item.Id);
                        items.Add(200);
                        g_repo.SetItem(items, CurrentPlayer.Id);

                        int enemyspawn = g_repo.EnemyDefeated(CurrentEnemy.Id, CurrentPlayer.Id);
                        if (enemyspawn != 0 && new Random().Next(1, 100) > 80)
                        {
                            CurrentEnemy = g_repo.EnemybyId(enemyspawn);
                            GameText.AddText("A " + CurrentEnemy.Name + "Jumps at you!");
                        }
                        else
                        {
                            CurrentEnemy = null;
                        }
                    }
                }
            }
        }