Beispiel #1
0
 private static string CalcFirstName(City baseCity, bool isMale)
 {
     if (isMale)
     {
         return(baseCity.Name switch
         {
             "Firenze" => EnumExtensionMethod.RandomString <FirenzeMalesEnum>(), // a.k.a. Florence
             "Genova" => EnumExtensionMethod.RandomString <GenovaMalesEnum>(),   // a.k.a. Genoa,
             "Mantua" => EnumExtensionMethod.RandomString <MantuaMalesEnum>(),   // a.k.a. Mantua,
             "Milano" => EnumExtensionMethod.RandomString <MilanoMalesEnum>(),   // a.k.a. Milan,
             "Siena" => EnumExtensionMethod.RandomString <SienaMalesEnum>(),     // a.k.a. Siena,
             "Venezia" => EnumExtensionMethod.RandomString <VeneziaMalesEnum>(), // a.k.a. Venice,
             _ => throw new Exception("Names for city not prepared.")
         });
Beispiel #2
0
        public FamilyMember(FamilyMemberTypeEnum type, City baseCity, bool isMale, DateTime gameDate, string forceSurname, bool isDead, DateTime?birthDate, int?age)
        {
            Type               = type;
            IsMale             = isMale;
            FamilyMemberStatus = FamilyMemberStatusEnum.AliveAndFree;
            LifestyleTraits    = new List <LifestyleTraitsEnum> {
                EnumExtensionMethod.Random <LifestyleTraitsEnum>()
            };                                                                                                     // randomly pick one

            if ((isDead) && (type != FamilyMemberTypeEnum.Father))
            {
                BirthDate = null;
                Age       = null;
            }
            else
            {
                if (birthDate == null)
                {
                    BirthDate = gameDate.SubtractYears(age.GetValueOrDefault());
                    Age       = age.GetValueOrDefault();
                }
                else
                {
                    BirthDate = birthDate.GetValueOrDefault();
                    Age       = FamilyToolbox.DiffYears(BirthDate.GetValueOrDefault(), gameDate);
                }
            }

            if (string.IsNullOrWhiteSpace(forceSurname))
            {
                Surname = CalcSurname(baseCity); // generate random one for focal person
            }
            else
            {
                Surname = forceSurname; // we want father's and siblings surnames to match focal person's
            }

            Name = CalcFirstName(baseCity, isMale) + " " + Surname;
        }