示例#1
0
        /// <summary>
        /// Another civilization joins this one.
        /// Mostly just records the merger with this civ's history.
        /// </summary>
        /// <param name="otherCivName"></param>
        public void JoinOurCivilization(string otherCivName)
        {
            string record = RandomName.Pluralize(GetFullName())
                            + " have assimilated the " + otherCivName
                            + " Civilization.";

            History.addRecord(record, isLogged: true);
        }
示例#2
0
        public void DissolvePopulation()
        {
            Patricians.Members = 0;
            string record = "The " + RandomName.Pluralize(GetFullName())
                            + " have disbanded.";

            History.addRecord(record);
        }
示例#3
0
        /// <summary>
        /// Merge this civ into another one.
        /// This civ will lose its identity and take on the identity of the
        /// civ they join.
        /// </summary>
        /// <param name="otherCivName"></param>
        public void JoinOtherCivilization(string otherCivName)
        {
            string record = RandomName.Pluralize(GetFullName())
                            + " have been assimilated into the " + otherCivName
                            + " Civilization.";

            CulturalIdentity = otherCivName;
            History.addRecord(record, isLogged: false);
        }
示例#4
0
        public void InitializeAsRandomPop(int tier)
        {
            var ancestryGen = AncestryIndex.Instance;

            ancestryGen.LoadAllSources();
            BaseAncestry = ancestryGen.GetRandomAncestry(tier);
            Members      = _dice.RandomNumber(BaseAncestry.MinAppearing,
                                              BaseAncestry.MaxAppearing);
            if (Members < 1)
            {
                Members = 1;
            }
            string record = Members + " "
                            + RandomName.Pluralize(BaseAncestry.Name)
                            + " have entered the world.";

            History.addRecord(record);
        }
示例#5
0
        /// <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);
        }
示例#6
0
        /// <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);
        }
示例#7
0
 public string GetPluralName()
 {
     return(RandomName.Pluralize(GetFullName()));
 }