Esempio n. 1
0
        protected override Task <(bool Success, string Message)> CheckCustomPreconditionsAsync()
        {
            var baseResult = base.CheckCustomPreconditionsAsync();

            if (!baseResult.Result.Success)
            {
                return(baseResult);
            }

            if (!BattleService.UserInBattle(Context.User.Id))
            {
                return(Task.FromResult((false, "You aren't in a battle.")));
            }

            Player = Battle.GetPlayer(Context.User.Id);
            if (Player == null)
            {
                return(Task.FromResult((false, "You aren't in this battle.")));
            }

            if (!Battle.IsUsersMessage(Player, Context.Message))
            {
                return(Task.FromResult((false, "Click your own message!")));
            }

            if (Battle.IsProcessing)
            {
                return(Task.FromResult((false, "Too fast.")));
            }

            if (!Player.IsAlive)
            {
                return(Task.FromResult((false, "You are dead.")));
            }

            return(baseResult);
        }