Exemplo n.º 1
0
        /// <summary>
        /// Used to add an effect to a character.
        /// </summary>
        /// <param name="callerId">The user identifier of the caller.</param>
        /// <param name="effectName">The name of the effect to add to the character.</param>
        public async Task <IResult> AddEffectAsync(ulong callerId, string effectName)
        {
            var character = await _charProvider.GetActiveCharacterAsync(callerId);

            if (character == null)
            {
                return(CharacterResult.CharacterNotFound());
            }

            var effect = await _effectProvider.GetEffectAsync(effectName);

            if (effect == null)
            {
                return(EffectResult.EffectNotFound());
            }

            if (character.Effects == null)
            {
                character.Effects = new List <Effect>();
            }

            if (character.Effects.Count(x => x.Id == effect.Id) > 0)
            {
                return(EffectResult.EffectAlreadyAdded());
            }

            character.Effects.Add(effect);
            await _charProvider.UpdateCharacterAsync(character);

            return(EffectResult.EffectAdded());
        }
Exemplo n.º 2
0
            public async Task <RuntimeResult> TagSkillsAsync(Skill tag1, Skill tag2, Skill tag3)
            {
                if (!_progOptions.UseOldProgression ||
                    !_progOptions.OldProgression.UseNewVegasRules)
                {
                    return(StatisticResult.NotUsingNewVegasRules());
                }

                var userInfo  = Context.User;
                var character = await _charService.GetCharacterAsync(userInfo.Id);

                if (character == null)
                {
                    return(CharacterResult.CharacterNotFound());
                }

                if (_skillsService.AreSkillsSet(character))
                {
                    return(StatisticResult.SkillsAlreadyTagged());
                }

                try
                {
                    await _skillsService.TagSkills(character, tag1, tag2, tag3);

                    return(GenericResult.FromSuccess(Messages.SKILLS_SET_SUCCESS));
                }
                catch (Exception e)
                {
                    return(GenericResult.FromError($"{Messages.FAILURE_EMOJI} {e.Message}"));
                }
            }
Exemplo n.º 3
0
            public async Task <RuntimeResult> SetSkillsAsync(Skill tag, int points)
            {
                if (ExperienceService.UseOldProgression)
                {
                    return(StatisticResult.UsingOldProgression());
                }

                var userInfo  = Context.User;
                var character = await _charService.GetCharacterAsync(userInfo.Id);

                if (character == null)
                {
                    return(CharacterResult.CharacterNotFound());
                }
                if (_skillsService.AreSkillsSet(character))
                {
                    return(StatisticResult.SkillsAlreadyTagged());
                }

                try
                {
                    await _skillsService.TagSkill(character, tag, points);

                    return(GenericResult.FromSuccess(Messages.SKILLS_SET_SUCCESS));
                }
                catch (Exception e)
                {
                    return(GenericResult.FromError($"{Messages.FAILURE_EMOJI} {e.Message}"));
                }
            }
Exemplo n.º 4
0
        /// <summary>
        /// Performs a duel between two characters rolling a statistic and returns the result.
        /// </summary>
        /// <param name="callerId">Discord ID of the caller.</param>
        /// <param name="targetId">Discord ID of the target.</param>
        /// <param name="statName">The statistic name.</param>
        /// <returns>The result of the roll.</returns>
        public async Task <IResult> RollStatisticAgainstAsync(ulong callerId, ulong targetId, string statName, bool useEffects = false)
        {
            var caller = await _provider.GetActiveCharacterAsync(callerId);

            if (caller == null)
            {
                return(CharacterResult.CharacterNotFound());
            }

            var target = await _provider.GetActiveCharacterAsync(targetId);

            if (target == null)
            {
                return(CharacterResult.CharacterNotFound());
            }

            var stat = await _statProvider.GetStatisticAsync(statName);

            if (stat == null)
            {
                return(StatisticResult.StatisticNotFound());
            }

            double?callerRoll = _strategy.RollStatistic(stat, caller, useEffects);
            double?targetRoll = _strategy.RollStatistic(stat, target, useEffects);

            if (callerRoll.HasValue && targetRoll.HasValue)
            {
                return(RollResult.RollAgainst(caller.Name, target.Name, callerRoll.Value, targetRoll.Value));
            }

            return(RollResult.RollFailed());
        }
Exemplo n.º 5
0
        public List <Character> GetCharactersByJson(int?offset = 0)
        {
            List <Character> heroes = new List <Character>();

            Dictionary <string, string> arguments = new Dictionary <string, string>();

            /*
             * Api.AddArgument(arguments, "apikey", privatekey);
             * Api.AddArgument(arguments, "offset", "10");
             * Api.AddArgument(arguments, "limit", "50");
             */
            String          resultJson = Api.SendPostRequest("http://gateway.marvel.com:80/v1/public/characters?limit=10&offset=" + offset + "&apikey=" + publickey, arguments, "application/json");
            CharacterResult resultCall = new CharacterResult();

            if (resultJson != "")
            {
                resultCall = (CharacterResult)JsonConvert.DeserializeObject(resultJson, typeof(CharacterResult));
            }

            int i = 1;

            foreach (Character c in resultCall.Data.Results)
            {
                if (c.Name == "" || c.Description == "" || c.Thumbnail == null && i > 10)
                {
                    continue;
                }
                heroes.Add(c);
                i++;
            }
            return(heroes);
        }
Exemplo n.º 6
0
        public async Task <RuntimeResult> ApplyEffectAsync(string npcName, [Remainder] string name)
        {
            var character = _npcService.FindNpc(npcName);

            if (character == null)
            {
                return(CharacterResult.NpcNotFound());
            }

            var effect = await _effectsService.GetEffectAsync(name);

            if (effect == null)
            {
                return(GenericResult.FromError(Messages.ERR_EFFECT_NOT_FOUND));
            }

            if (character.EffectCharacters == null)
            {
                character.EffectCharacters = new List <EffectCharacter>();
            }

            if (character.EffectCharacters.Any(x => x.Effect.Equals(effect)))
            {
                return(GenericResult.FromError(Messages.ERR_EFFECT_ALREADY_APPLIED));
            }

            character.EffectCharacters.Add(new EffectCharacter {
                Character = character, Effect = effect
            });

            return(GenericResult.FromSuccess(String.Format(Messages.EFFECT_APPLY_SUCCESS, effect.Name, character.Name)));
        }
Exemplo n.º 7
0
            public async Task <RuntimeResult> ShowCharacterStoryAsync(IUser targetUser = null)
            {
                var userInfo  = Context.User;
                var character = targetUser == null
                    ? await _charService.GetCharacterAsync(userInfo.Id)
                    : await _charService.GetCharacterAsync(targetUser.Id);

                if (character == null)
                {
                    return(CharacterResult.CharacterNotFound());
                }

                if (character.Story == null || character.Story.Equals(""))
                {
                    return(GenericResult.FromError(Messages.ERR_STORY_NOT_FOUND));
                }

                var embed = EmbedHelper.BuildBasicEmbed("Command: $character story",
                                                        $"**Name:** {character.Name}\n" +
                                                        $"**Story:** {character.Story}");

                await ReplyAsync(userInfo.Mention, embed : embed);

                return(GenericResult.FromSilentSuccess());
            }
Exemplo n.º 8
0
        /// <summary>
        /// Gets the character associated with the id and checks
        /// if their specified statistic is higher than the given value.
        /// </summary>
        /// <param name="id">The id of the character to get.</param>
        /// <param name="statName">The name of the statistic to get.</param>
        /// <param name="minimum">Checks if the character's StatisticValue is greater than or equal to this value.</param>
        /// <returns>
        /// A result detailing if the operation was successful or why it failed.
        /// </returns>
        public async Task <IResult> CheckStatisticAsync(ulong id, string statName)
        {
            var character = await _charProvider.GetActiveCharacterAsync(id);

            if (character == null)
            {
                return(CharacterResult.CharacterNotFound());
            }

            var stat = await _statProvider.GetStatisticAsync(statName);

            if (stat == null)
            {
                return(StatisticResult.StatisticNotFound());
            }

            var statValue = character.GetStatistic(stat);

            if (statValue == null)
            {
                return(StatisticResult.StatisticNotFound());
            }

            return(StatisticResult.StatisticCheck(character.Name, stat.Name, statValue.Value));
        }
Exemplo n.º 9
0
        public async Task <RuntimeResult> ActivateCharacterAsync([Remainder] string name)
        {
            var chars = await _charService.GetAllCharactersAsync(Context.User.Id);

            if (chars == null)
            {
                return(CharacterResult.CharacterNotFound());
            }

            //var charMatch = chars.Find(x => x.Name.Equals(name, StringComparison.OrdinalIgnoreCase));
            var charMatch = chars.Find(x => x.Name.Contains(name, StringComparison.OrdinalIgnoreCase));

            if (charMatch == null)
            {
                return(CharacterResult.CharacterNotFound());
            }

            if (charMatch.Active)
            {
                return(GenericResult.FromError(String.Format(Messages.ERR_CHAR_ALREADY_ACTIVE, charMatch.Name)));
            }

            foreach (var character in chars.FindAll(x => x.Active))
            {
                character.Active = false;
                await _charService.SaveCharacterAsync(character);
            }

            charMatch.Active = true;
            await _charService.SaveCharacterAsync(charMatch);

            return(GenericResult.FromSuccess(String.Format(Messages.CHAR_ACTIVATED, charMatch.Name)));
        }
Exemplo n.º 10
0
    void SetSavedTeamData()
    {
        if (PF_PlayerData.MyTeamsCharacterId == null || PF_PlayerData.MyTeamsCharacterId.Count == 0)
        {
            return;
        }

        PF_PlayerData.SavedTeam = new List <FG_SavedCharacter>();
        PF_GamePlay.AllSavedCharacterUnitData = new Dictionary <string, FG_SavedCharacter>();
        int count = 1;

        foreach (var id in PF_PlayerData.MyTeamsCharacterId["CurrentTeam"])
        {
            CharacterResult   cha   = PF_PlayerData.playerCharacters.Find(x => x.CharacterId.Contains(id));
            FG_SavedCharacter saved = new FG_SavedCharacter()
            {
                characterDetails = cha,
                baseClass        = PF_GameData.Classes[cha.CharacterType],
                characterData    = PF_PlayerData.playerCharacterData[id]
            };
            PF_PlayerData.SavedTeam.Add(saved);
            PF_GamePlay.AllSavedCharacterUnitData.Add(saved.baseClass.CatalogCode + "_" + count, saved);
            count++;
        }
    }
Exemplo n.º 11
0
        public async Task <CharacterResult> GetSimilarCharacters(Character character)
        {
            var obj = new CharacterResult();
            // Select ID of Planet and Film form chracter resposne
            var planetId = Convert.ToInt32(character.homeworld.Substring((character.homeworld.Length - 2), 1));
            var filmId   = Convert.ToInt32(character.films[0].Substring((character.films[0].Length - 2), 1));
            // GET Planet based on ID
            var planet = await _planetClient.GetPlanetByIdAsync(planetId);

            if (planet != null)
            {
                // Get residents of the planet - limiting to 3 residents
                var tasks         = planet.residents.Take(3).Select(r => _characterClient.GetCharacterByIdAsync(Convert.ToInt32(r.Substring((r.Length - 2), 1))));
                var characterList = (await Task.WhenAll(tasks)).Where(c => c != null);
                obj.MainCharacter      = character;
                obj.SuggestedCharacter = characterList.Where(cl => cl.name != character.name).Take(3).ToList();
            }
            else
            {
                // Get characters film  - limiting to 3 characters
                var film = await _filmClient.GetFilmByIdAsync(filmId);

                var tasks         = film.characters.Take(3).Select(c => _characterClient.GetCharacterByIdAsync(Convert.ToInt32(c.Substring((c.Length - 2), 1))));
                var characterList = (await Task.WhenAll(tasks)).Where(c => c != null);
                obj.MainCharacter      = character;
                obj.SuggestedCharacter = characterList.Where(cl => cl.name != character.name).Take(3).ToList();
            }
            return(obj);
        }
Exemplo n.º 12
0
        public async Task <RuntimeResult> ShowCharacterAsync(IUser targetUser = null)
        {
            var userInfo  = Context.User;
            var character = targetUser == null
                ? await _charService.GetCharacterAsync(userInfo.Id)
                : await _charService.GetCharacterAsync(targetUser.Id);

            if (character == null)
            {
                return(CharacterResult.CharacterNotFound());
            }

            var level          = _expService.CalculateLevelForExperience(character.Experience);
            var expToNextLevel = _expService.CalculateRemainingExperienceToNextLevel(character.Experience);

            if (!ExperienceService.UseOldProgression)
            {
                expToNextLevel = (level + 1) * 1000 - character.Experience;
            }

            var description = string.IsNullOrEmpty(character.Description) ? "No description." : character.Description;
            var story       = string.IsNullOrEmpty(character.Story) ? "No story." : character.Story;

            var embed = EmbedHelper.BuildBasicEmbed($"{character.Name}",
                                                    $"**Description:** {description}\n" +
                                                    $"**Story:** ($char story)\n" +
                                                    $"**Level:** {level}\n" +
                                                    $"**Experience:** {character.Experience}\n" +
                                                    $"**To Next Level:** {expToNextLevel}\n" +
                                                    $"**Caps:** {character.Money}");

            await ReplyAsync(userInfo.Mention, embed : embed);

            return(GenericResult.FromSilentSuccess());
        }
Exemplo n.º 13
0
        public async Task <IResult> GiveMoneyToOtherAsync(ulong callerId, ulong targetId, int moneyToGive)
        {
            var caller = await _provider.GetActiveCharacterAsync(callerId);

            if (caller == null)
            {
                return(CharacterResult.CharacterNotFound());
            }

            var target = await _provider.GetActiveCharacterAsync(targetId);

            if (target == null)
            {
                return(CharacterResult.CharacterNotFound());
            }

            if (caller.Money - moneyToGive >= 0)
            {
                caller.Money -= moneyToGive;
                target.Money += moneyToGive;

                await _provider.UpdateCharacterAsync(caller);

                await _provider.UpdateCharacterAsync(target);

                return(CharacterResult.MoneyGiven(moneyToGive, target.Name));
            }
            else
            {
                return(GenericResult.ValueTooHigh());
            }
        }
Exemplo n.º 14
0
        public async Task <RuntimeResult> RemoveEffectAsync(string npcName, [Remainder] string name)
        {
            var character = _npcService.FindNpc(npcName);

            if (character == null)
            {
                return(CharacterResult.NpcNotFound());
            }

            var effect = await _effectsService.GetEffectAsync(name);

            if (effect == null)
            {
                return(GenericResult.FromError(Messages.ERR_EFFECT_NOT_FOUND));
            }

            //if (character.Effects == null) character.Effects = new List<Effect>();
            if (character.EffectCharacters == null)
            {
                character.EffectCharacters = new List <EffectCharacter>();
            }

            character.EffectCharacters.Remove(character.EffectCharacters.Where(x => x.Effect.Equals(effect)).FirstOrDefault());

            return(GenericResult.FromSuccess(String.Format(Messages.EFFECT_REMOVE_SUCCESS, effect.Name, character.Name)));
        }
Exemplo n.º 15
0
        public async Task <RuntimeResult> ChangeCharacterNameAsync([Remainder] string name)
        {
            var character = await _charService.GetCharacterAsync(Context.User.Id);

            if (character == null)
            {
                return(CharacterResult.CharacterNotFound());
            }

            if (!StringHelper.IsOnlyLetters(name))
            {
                return(GenericResult.FromError("Name contained non-alphabetic characters."));
            }

            if (name.Length > 24 || name.Length < 2)
            {
                return(GenericResult.FromError("Name was too long or short."));
            }

            var fixedName = StringHelper.ToTitleCase(name);

            if (await _charService.HasDuplicateName(Context.User.Id, fixedName))
            {
                return(GenericResult.FromError("Name is a duplicate."));
            }

            character.Name = fixedName;

            await _charService.SaveCharacterAsync(character);

            return(GenericResult.FromSuccess(Messages.CHAR_CHANGED_NAME));
        }
Exemplo n.º 16
0
        /// <summary>
        /// Performs a roll on a character's statistic and returns the result.
        /// </summary>
        /// <param name="callerId">Discord ID of the caller.</param>
        /// <param name="statName">The statistic name.</param>
        /// <returns>The result of the roll.</returns>
        public async Task <IResult> RollStatisticAsync(ulong callerId, string statName, bool useEffects = false)
        {
            var character = await _provider.GetActiveCharacterAsync(callerId);

            if (character == null)
            {
                return(CharacterResult.CharacterNotFound());
            }

            var stat = await _statProvider.GetStatisticAsync(statName);

            if (stat == null)
            {
                return(StatisticResult.StatisticNotFound());
            }

            string result = _strategy.GetRollMessage(stat, character, useEffects);

            if (!string.IsNullOrEmpty(result))
            {
                return(RollResult.Roll(result));
            }

            return(RollResult.RollFailed());
        }
Exemplo n.º 17
0
        /// <summary>
        /// Used to remove an effect from a character.
        /// </summary>
        /// <param name="callerId">The user identifier of the caller.</param>
        /// <param name="effectName">The name of the effect to remove from the character.</param>
        public async Task <IResult> RemoveEffectAsync(ulong callerId, string effectName)
        {
            var character = await _charProvider.GetActiveCharacterAsync(callerId);

            if (character == null)
            {
                return(CharacterResult.CharacterNotFound());
            }

            var effect = await _effectProvider.GetEffectAsync(effectName);

            if (effect == null)
            {
                return(EffectResult.EffectNotFound());
            }

            var match = character.Effects.FirstOrDefault(x => x.Id == effect.Id);

            if (match == null)
            {
                return(EffectResult.EffectNotFound());
            }

            character.Effects.Remove(match);
            await _charProvider.UpdateCharacterAsync(character);

            return(EffectResult.EffectRemoved());
        }
Exemplo n.º 18
0
 void Start()
 {
     answers                   = FindObjectOfType <Answers>();
     characterManager          = FindObjectOfType <CharacterManager>();
     characterResult           = FindObjectOfType <CharacterResult>();
     charArray                 = characterManager.charArray;
     storyImageSlideController = FindObjectOfType <StoryImageSlideController>();
 }
        public static string AsAByteString(this CharacterResult characterResult /*this byte[] buffer*/)
        {
            if (characterResult == null)
            {
                return("");
            }

            // Ansi as default
            Encoding encoding = Encoding.UTF8;

#if FRAMEWORK
            return(encoding.GetString(buffer));
#else
            if (characterResult == null /* || characterResult.Length == 0*/)
            {
                return("");
            }

            /*
             *      EF BB BF		UTF-8
             *      FF FE UTF-16	little endian
             *      FE FF UTF-16	big endian
             *      FF FE 00 00		UTF-32, little endian
             *      00 00 FE FF		UTF-32, big-endian
             */

            //if (characterResult[0] == 0xef && characterResult[1] == 0xbb && characterResult[2] == 0xbf)
            //{
            //	encoding = Encoding.UTF8;
            //}
            //else if (characterResult[0] == 0xfe && characterResult[1] == 0xff)
            //{
            //	encoding = Encoding.Unicode;
            //}
            //else if (characterResult[0] == 0xfe && characterResult[1] == 0xff)
            //{
            //	encoding = Encoding.BigEndianUnicode; // utf-16be
            //}

            using (MemoryStream stream = new MemoryStream())
            {
                string characterResultString = characterResult.ToString();
                // Convert a C# string to a byte array
                byte[] characterResultByteArray = Encoding.ASCII.GetBytes(characterResultString);
                //foreach (byte b in characterResultByteArray)
                //{
                //	Console.WriteLine(b);
                //}

                stream.Write(characterResultByteArray /*.Code.*//*.AsAByteString()*/, 0, characterResult.Data.Count.Length /*, characterResult.Length*/);
                stream.Seek(0, SeekOrigin.Begin);
                using (StreamReader reader = new StreamReader(stream, encoding))
                {
                    return(reader.ReadToEnd());
                }
            }
#endif
        }
Exemplo n.º 20
0
        /// <summary>
        /// Gets the caller's active character and returns the result.
        /// </summary>
        /// <param name="callerId">Discord ID of the caller.</param>
        /// <returns>A new CharacterResult object.</returns>
        public async Task <IResult> ShowCharacterAsync(ulong callerId)
        {
            var character = await _provider.GetActiveCharacterAsync(callerId);

            if (character == null)
            {
                return(CharacterResult.CharacterNotFound());
            }
            return(CharacterResult.Show(character, _progStrategy.GetCharacterLevel(character), await _progStrategy.GetCharacterInfo(character)));
        }
Exemplo n.º 21
0
        private async Task <RuntimeResult> RollPlayerAsync(Statistic statToRoll, IUser user, bool useEffects = false)
        {
            var character = await _charService.GetCharacterAsync(user.Id);

            if (character == null)
            {
                return(CharacterResult.CharacterNotFound());
            }

            return(_rollService.RollStatistic(character, statToRoll, useEffects));
        }
 private void GetCharsCallback(ListUsersCharactersResult result)
 {
     lastReceivedMessage = "Get Chars Successful";
     foreach (var eachCharacter in result.Characters)
     {
         if (eachCharacter.CharacterName == CHAR_NAME)
         {
             targetCharacter = eachCharacter;
         }
     }
 }
Exemplo n.º 23
0
        public async Task SetStory_InvalidCharacter_ReturnCharacterNotFound()
        {
            // Arrange
            var provider   = new MockCharacterProvider();
            var controller = new CharacterController(provider, new MockProgressionStrategy(), new GeneralOptions());

            // Act
            var result = await controller.SetCharacterStoryAsync(1000, "description");

            // Assert
            Assert.True(CharacterResult.CharacterNotFound().Equals(result));
        }
Exemplo n.º 24
0
        public async Task ShowCharacter_InvalidId_ReturnCharacterNotFound()
        {
            // Arrange
            var provider   = new MockCharacterProvider();
            var controller = new CharacterController(provider, null, new GeneralOptions());

            // Act
            var result = await controller.ShowCharacterAsync(0);

            // Assert
            Assert.Equal(CharacterResult.CharacterNotFound(), result);
        }
Exemplo n.º 25
0
        public async Task CreateCharacter_ValidValues_ReturnSuccess()
        {
            // Arrange
            var provider   = new MockCharacterProvider();
            var controller = new CharacterController(provider, null, new GeneralOptions());

            // Act
            var result = await controller.CreateCharacterAsync(1, "c");

            // Assert
            Assert.Equal(CharacterResult.CharacterCreatedSuccessfully(), result);
        }
Exemplo n.º 26
0
        public async Task CreateCharacter_PlayerHasExistingName_ReturnNameAlreadyExists()
        {
            // Arrange
            var provider   = new MockCharacterProvider();
            var controller = new CharacterController(provider, null, new GeneralOptions());

            // Act
            var result = await controller.CreateCharacterAsync(1, "c1"); // Existing

            // Assert
            Assert.Equal(CharacterResult.NameAlreadyExists(), result);
        }
Exemplo n.º 27
0
        public async Task CreateCharacter_ExistingNameButNotBelongingToPlayer_ReturnSuccess()
        {
            // Arrange
            var provider   = new MockCharacterProvider();
            var controller = new CharacterController(provider, null, new GeneralOptions());

            // Act
            var result = await controller.CreateCharacterAsync(1, "c2"); // Existing

            // Assert
            Assert.Equal(CharacterResult.CharacterCreatedSuccessfully(), result);
        }
Exemplo n.º 28
0
    //[SerializeField] List<int> statement = new List<int>();
    //[SerializeField] List<int> character = new List<int>();
    //[SerializeField] List<int> answers = new List<int>();


    void Start()
    {
        answers            = FindObjectOfType <Answers>();
        testingArrayOrList = FindObjectOfType <TestingArrayOrList>();
        characterResult    = FindObjectOfType <CharacterResult>();
        charArray          = testingArrayOrList.charArray;
        //acceptChoice = FindObjectOfType<AcceptChoice>();

        //charArray = acceptChoice.charArray;
        //  int indexChar = character.IndexOf(120);
        // List.IndexOf(character);


        //    statement.Add(1);
        //    statement.Add(2);
        //    statement.Add(3);
        //    statement.Add(4);
        //    statement.Add(5);
        //    statement.Add(6);
        //    statement.Add(7);
        //    statement.Add(8);
        //    statement.Add(9);
        //    statement.Add(10);
        //    statement.Add(11);
        //    statement.Add(12);
        //    statement.Add(13);
        //    statement.Add(14);
        //    statement.Add(15);
        //    statement.Add(16);
        //    statement.Add(17);
        //    statement.Add(18);
        //    statement.Add(19);
        //    statement.Add(20);

        //    foreach (int o in statement)
        //    {
        //        for (int i = 0; i< 6; i++)
        //        {
        //            character.Add(i);
        //        }
        //    }

        //    foreach (int p in character)
        //    {
        //        for (int i = 0; i< 4; i++)
        //        {
        //            answers.Add(i);
        //        }
        //    }
        //    currentStatement = 1;
        //    lastStatement = 1;
    }
Exemplo n.º 29
0
        public async Task Roll_InvalidId_ReturnCharacterNotFound()
        {
            // Arrange
            var provider     = new MockCharacterProvider();
            var statProvider = new MockStatisticProvider();
            var controller   = new RollController(provider, statProvider, new MockRollStrategy());

            // Act
            var result = await controller.RollStatisticAsync(0, "strength");

            // Assert
            Assert.Equal(CharacterResult.CharacterNotFound(), result);
        }
Exemplo n.º 30
0
        private async Task <RuntimeResult> RollVsPlayers(IUser user1, IUser user2, Statistic stat1, Statistic stat2, bool useEffects = false)
        {
            var char1 = await _charService.GetCharacterAsync(user1.Id);

            var char2 = await _charService.GetCharacterAsync(user2.Id);

            if (char1 == null || char2 == null)
            {
                return(CharacterResult.CharacterNotFound());
            }

            return(_rollService.RollVsStatistic(char1, char2, stat1, stat2, useEffects));
        }