Esempio n. 1
0
 /// <summary>
 /// Wandering monsters tend to bleed out from their starting hex.
 /// They don't leave the table from the hexes they migrate from, only
 /// add to the tables of the hexes they migrate too.
 /// </summary>
 public void MigrateNaturals()
 {
     foreach (var hex in _worldMap.HexList)
     {
         foreach (var creature in hex.NaturalEncounterPool)
         {
             int roll = _dice.Roll(1, 100);
             if (roll > 15)
             {
                 continue;
             }
             int migrationDireciton = _dice.Roll(1, 6);
             var neighborLocation   =
                 hex.FindNeighborByIndex(migrationDireciton);
             var targetHex =
                 _worldMap.GetHexByCoordinates(neighborLocation);
             targetHex.NaturalEncounterPool.Add(creature);
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Losers of a battle will try to search their home hex for a like
        /// race to join, or and adjacent hex if that fails.
        /// If that fails, they are eliminated.
        /// </summary>
        /// <param name="losers"></param>
        /// <param name="loserHome"></param>
        /// <param name="baseName">The name of the home base that the refugees
        /// just left. They can't go back here.</param>
        void MoveLosers(Civilization losers, HexData loserHome,
                        string baseName)
        {
            bool isFoundHex = RefugeesSearchHex(losers, loserHome, baseName);

            if (isFoundHex)
            {
                return;
            }
            int  nextIndex = _dice.Roll(1, 6);
            bool isFound   = false;

            for (int i = 0; i < 6; ++i)
            {
                ++nextIndex;
                if (nextIndex > 6)
                {
                    nextIndex = 1;
                }
                var nextCoords = loserHome.FindNeighborByIndex(nextIndex);
                var nextHex    = _worldMap.GetHexByCoordinates(nextCoords.Item1,
                                                               nextCoords.Item2);
                if (nextHex is null)
                {
                    continue;
                }
                isFound = RefugeesSearchHex(losers, nextHex, baseName);
                if (isFound)
                {
                    break;
                }
            }
            if (isFound)
            {
                return;
            }

            // no available place to go!
            string report = "The " + losers.GetPluralName()
                            + " could not find refuge.";

            losers.History.addRecord(report);

            losers.DissolvePopulation();
        }