/// <summary> /// Generates a random population and uses that as the basis of this civ. /// </summary> public void InitializeAsRandomCiv(int tier) { var nameGen = new RandomName(); CulturalIdentity = nameGen.CreateWord(); var founders = new Population(); founders.InitializeAsRandomPop(tier); Patricians = founders; LeaderCompetency = (_dice.Roll(2, 6) / 2); string record = "The " + GetFullName() + " Civilization has emerged, with a starting population of " + founders.Members; History.addRecord(record); }
/// <summary> /// Sets this hex up with random components /// </summary> /// <param name="x"></param> /// <param name="y"></param> public void InitializeAsRandomHex(int x, int y, Tuple <int, int> origin, int tierWidth) { var nameGen = new RandomName(); Name = nameGen.CreateWord(); XCoord = x; YCoord = y; _setTier(origin.Item1, origin.Item2, tierWidth); var creatureSource = AncestryIndex.Instance; creatureSource.LoadAllSources(); // init nature int numNatural = _dice.Roll(2, 4) + 1; for (int i = 0; i < numNatural; ++i) { var naturalCreature = creatureSource.GetRandomNaturalAncestry(Tier); var tier = Tier; while (naturalCreature is null && tier > 0) { --tier; naturalCreature = creatureSource.GetRandomAncestry(tier); } if (naturalCreature is null) { break; } NaturalEncounterPool.Add(naturalCreature.Name); } // init dungeons int numMonsters = _dice.Roll(2, 4) + 1; for (int i = 0; i < numMonsters; ++i) { var dungeonLurkers = creatureSource.GetRandomDungeonAncestry(Tier); var tier = Tier; while (dungeonLurkers is null && tier > 0) { --tier; dungeonLurkers = creatureSource.GetRandomDungeonAncestry(tier); } if (dungeonLurkers is null) { break; } DungeonEcologyPool.Add(dungeonLurkers.Name); } // init lairs int numLairs = _dice.Roll(1, 6) - 1; for (int i = 0; i < numLairs; ++i) { var lair = new Lair(); lair.InitializeAsRandomLair(this); // resolve any conflicting locations Battle results = ResolveSettlementConflicts(lair); if (results is null) { // there was no battle. Just add the new lair. LairList.Add(lair); continue; } if ( (results.AttackerState == Battle.CombatantState.COMBATANT_STATE_ELIMINATED) || (results.AttackerState == Battle.CombatantState.COMBATANT_STATE_ROUTED) ) { // dont even save the lair. continue; } // attackers win, and are moved into existing lair. } string record = Name + " (" + x + ", " + y + ") has been discovered."; if (LairList.Count > 0) { record += " The following lairs are found within: "; for (int i = 0; i < LairList.Count; ++i) { var lair = LairList[i]; int lastIndex = LairList.Count - 1; int secondToLastIndex = lastIndex - 1; record += lair.GetFullName(); if (i == secondToLastIndex) { record += ", and "; continue; } if (i == lastIndex) { continue; } record += ", "; } } History.addRecord(record); }