public void CharacterBuilder_Build_MapsCorrectly()
        {
            var character = _builder.Build(_cardDefinition, 2);

            Assert.AreEqual(_cardDefinition.Affiliation, character.Affiliation);
            Assert.AreEqual(_cardDefinition.Faction, character.Faction);
            Assert.AreEqual(_cardDefinition.IsUnique, character.IsUnique);
            Assert.AreEqual(_cardDefinition.Health, character.Health);
            Assert.AreEqual(_cardDefinition.ElitePoints, character.TotalPoints);
            Assert.AreEqual(2, character.Dice.Count);
        }
Ejemplo n.º 2
0
        protected async Task <Passenger> PassengerDetailAsync(Dice random, string travelType, bool advancedCharacters)
        {
            var user = await m_NameService.CreateRandomPersonAsync(random);

            bool isPatron = false;

            var result = new Passenger()
            {
                TravelType  = travelType,
                Name        = $"{user.FirstName} {user.LastName}",
                Gender      = user.Gender,
                ApparentAge = 12 + random.D(1, 60),
            };

            Passenger.AddPassengerType(result, random);

            SimpleCharacterEngine.AddTrait(result, random);

            if (!advancedCharacters)
            {
                SimpleCharacterEngine.AddCharacteristics(result, random);

                //Add personality
                int personalityTraits = random.D(3);
                for (var i = 0; i < personalityTraits; i++)
                {
                    result.Personality.Add(random.Choose(m_Personalities));
                }
            }
            else
            {
                result.Seed = random.Next();
                var options = new CharacterBuilderOptions()
                {
                    MaxAge = result.ApparentAge, Name = result.Name, Seed = result.Seed
                };
                var character = m_CharacterBuilder.Build(options);

                result.Strength  += character.Strength;
                result.Dexterity += character.Dexterity;
                result.Endurance += character.Endurance;
                result.Intellect += character.Intellect;
                result.Education += character.Education;
                result.Social    += character.SocialStanding;

                result.Skills = string.Join(", ", character.Skills.Where(s => s.Level > 0).Select(s => s.ToString()).OrderBy(s => s));

                result.Title = character.Title;
                result.Personality.AddRange(character.Personality);
            }


            if (isPatron)
            {
                //TODO: add support for patron features
            }

            return(result);
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            try
            {
                //на английской версии винды выводит ? вместо кирилицы
                //смена кодировки фиксит проблему
                Console.OutputEncoding = Encoding.UTF8;

                CharacterBuilder characterBuilder = new CharacterBuilder(25, new Operations());
                InputHelper      inputHelper      = new InputHelper();


                Console.WriteLine("Добро пожаловать в меню выбора создания персонажа!");
                Console.WriteLine("У вас есть 25 очков, которые вы можете распределить по умениям");
                Console.WriteLine("Нажмите любую клавишу чтобы продолжить...");
                Console.ReadKey();

                while (characterBuilder.AvailablePoints > 0)
                {
                    try
                    {
                        Console.Clear();

                        Console.WriteLine(characterBuilder.ToString());

                        Console.WriteLine("Какую характеристику вы хотите изменить?");
                        AbilityType abilityType = inputHelper.GetAbilityType();

                        Console.WriteLine(@"Что вы хотите сделать? +\-");
                        OperationType operationType = inputHelper.GetOperationType();

                        Console.WriteLine(@"Колличество поинтов которые следует {0}", operationType == OperationType.Add ? "прибавить" : "отнять");

                        int operandPoints = inputHelper.GetPositiveNumberWithLimit(characterBuilder.AvailablePoints);

                        characterBuilder.SpendPonts(operandPoints, operationType, abilityType);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine($"Ошибка при распределении очков: {e.Message}");
                    }
                }

                Console.WriteLine("Вы распределили все очки. Введите возраст персонажа:");

                Character character = characterBuilder.Build(inputHelper.GetPositiveNumber());

                Console.Clear();

                Console.WriteLine(character.ToString());
            }
            catch (Exception e)
            {
                Console.WriteLine($"Произошла ошибка: {e.Message}");
            }

            Console.ReadKey();
        }
 public SeiyuuComparisonSubEntry Build()
 => new SeiyuuComparisonSubEntry
 (
     _characterBuilder?.Build() ?? _character,
     _seiyuuBuilder?.Build() ?? _seiyuu
 );
 public SeasonSummaryEntry Build()
 => new SeasonSummaryEntry(
     _seiyuuBuilder?.Build() ?? _seiyuu,
     _animeBuilder?.Build() ?? _anime,
     _characterBuilder?.Build() ?? _character
     );