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]: ");
            }
        }