public Settler.Settler GenerateParent(bool isMale) { int age = (int)(Math.Pow(new Random().NextDouble(), 0.2) * Varsk.VarskElderYears + Varsk.VarskAdultYears) * Date.DaysInYear; NameFactory name = isMale ? VarskNameFactories.Male() : VarskNameFactories.Female(); var settler = new Varsk(new Date(-1 * age), name.Generate(), $"{VarskNameFactories.Male().Generate()}sson", isMale ? BinaryGender.Male : BinaryGender.Female); TraitGenerator.GenerateTraits(settler); return(settler); }
public Settler.Settler GenerateChild(Varsk father, Varsk mother) { int minParentAge = Math.Min(-1 * father.Birthday.DaysSinceSettlement, -1 * mother.Birthday.DaysSinceSettlement); int age = new Random().Next(minParentAge - Varsk.VarskAdultYears * Date.DaysInYear); bool isMale = new Random().Next(2) == 0; NameFactory name = isMale ? VarskNameFactories.Male() : VarskNameFactories.Female(); var child = new Varsk(new Date(-1 * age), name.Generate(), $"{(father.PrestigeLevel >= mother.PrestigeLevel ? father.GivenName : mother.GivenName)}sson", isMale ? BinaryGender.Male : BinaryGender.Female); ParentChildRelationship.Make(_manager, 0, father, child); ParentChildRelationship.Make(_manager, 0, mother, child); Inheritor.GenerateChildTraits(child); return(child); }
public Family Generate() { //Generate parents Varsk father = _factory.GenerateParent(true) as Varsk; Varsk mother = _factory.GenerateParent(false) as Varsk; //Generate family Family family = new Family($"{(father.PrestigeLevel >= mother.PrestigeLevel ? father.GivenName : mother.GivenName)}sson"); family.AddMember(father); family.AddMember(mother); MarriedRelationship.Make(_manager, 15, father, mother); //Generate kids var children = new Random().Next(5); for (var i = 0; i < children; i++) { family.AddMember(_factory.GenerateChild(father, mother)); } return(family); }