Exemple #1
0
        private async Task DoActionAsync(IDialogContext context, string command)
        {
            if (Commands.O(command)) // OBSERVAR
            {
                var explore = _rpg.Explore();

                var points = explore.Status;

                if (points > 0)
                {
                    _score          += points;
                    explore.Response = explore.Response + "\n\nVocê ganhou " + points + "!";
                }

                await context.PostAsync(explore.Response);
            }
            else if (Commands.A(command)) // ATACAR
            {
                var battle = _rpg.Battle();

                var rounds = battle.Status;
                if (rounds > 0)
                {
                    var points = 10 - rounds;

                    if (points < 0)
                    {
                        points = 0;
                    }

                    _score += points;

                    battle.Response = battle.Response + "\n\nVocê ganhou " + points + "!";
                }

                await context.PostAsync(battle.Response);
            }
            else if (Commands.H(command)) // AJUDA
            {
                await context.PostAsync(new Commands().ToString());
            }
            else
            {
                PromptDialog.Confirm(context, CallBackQuit, "Você quer realmente sair?");
            }

            if (_score >= _nextLevel)
            {
                _rpg.SetLevel(_rpg.GetLevel() + 1);
                _nextLevel = _rpg.GetLevel() * 10;

                await context.PostAsync("Sua maravilhosa experiência ganhou um level! Level " + _rpg.GetLevel());
            }

            if (!Commands.S(command))
            {
                PromptDialog.Text(context, CallBack, $"{Emoji.BlueField} Pontuação [**{_score}**] Nível [**{_rpg.GetLevel()}**] Action [O,A,S]: ");
            }
        }
        private static void Main(string[] args)
        {
            Text.Clear();

            Console.WindowWidth  = ConsoleWidth;
            Console.WindowHeight = ConsoleHeight;
            Console.BufferHeight = ConsoleHeight;
            Console.BufferWidth  = ConsoleWidth;

            while (RunningGame)
            {
                switch (GameState)
                {
                case GameState.Menu:
                    RpgController.MainMenu();
                    break;

                case GameState.Start:
                    RpgController.StartNewGame();
                    break;

                case GameState.Playing:
                    if (Player.Instance.CurrentGladiator.CurrentZone == null)
                    {
                        IZone currentZone = ZoneFactory.GetZone(ZoneLevel.One);
                        Header.Map = currentZone.Map;
                        Player.Instance.CurrentGladiator.CurrentZone = currentZone;
                    }

                    Player.Instance.CurrentGladiator.CurrentZone.StateChanged(GameEvent.ZoneEnter);
                    Text.WriteLine("Welcome to the Arena Of Death!.\nNavigate through the arena to kill enemies.\n");
                    RpgController.Navigate();
                    break;

                case GameState.Interacting:
                    InteractionController.Interact(Player.Instance.CurrentGladiator, Player.Instance.CurrentGladiator.Target);
                    break;

                case GameState.Battle:
                    Text.ClearWithAbilities();
                    RpgController.Battle();
                    break;

                case GameState.Quit:
                    RpgController.QuitGame();
                    break;

                case GameState.GameOver:
                    Zone1.Instance.Dispose();
                    var repo = new MongoRepository();
                    //display ladder board
                    repo.AddGladiatorToHistory(Player.Instance.CurrentGladiator);
                    //repo.AddGladiator(Player.Instance.CurrentGladiator);
                    Thread.Sleep(2000);
                    //Console.WriteLine(repo.GetGladiatorHistory("YOMAN").Result.kills);
                    //repo.RemoveGladiatorHistoryRecord("JAVY");
                    GameState = GameState.Menu;
                    Text.Clear();
                    break;
                }
            }
        }