Example #1
0
        public TileExplorationResults ExploreTile(HumanEntity entity, WorldTile tile)
        {
            var results = new TileExplorationResults();

            //Determine tile properties
            RevealTile(entity, tile);
            //Determine foraging haul
            results.ExplorationInventory = ForageTile(entity, tile);
            //Determine events (lost, special, etc...)
            DetermineExplorationEvents(entity, tile, results);
            //Determine effects of events
            return(results);
        }
Example #2
0
        private void DetermineExplorationEvents(HumanEntity entity, WorldTile tile,
                                                TileExplorationResults explorationResults)
        {
            var roll = 0f;
            var baseExplorationTime = GetExplorationTime(tile, entity);

            //Do we get lost?
            roll = random.NextFloatInRange(0f, .5f);
            roll = roll + DetermineTileLostAndSpecialDiscoveryModifier(tile);
            if (roll > entity.AdjustedNavigationSkill)
            {
                //Lost, what happened to us based on our survival skill?
            }
            roll = random.NextFloatInRange(0f, .5f);
            roll = roll + DetermineTileLostAndSpecialDiscoveryModifier(tile, true);
            if (roll < entity.AdjustedExplorationSkill)
            {
                //We made a special discovery
            }

            DetermineCatastrophe(tile, entity, explorationResults);
        }
Example #3
0
        private void DetermineCatastrophe(WorldTile tile, HumanEntity entity,
                                          TileExplorationResults explorationResults)
        {
            var severityPercent = random.NextFloatInRange(0f, 1f);
            var roll            = 0f;
            var biomeType       = tile.TerrainData.BiomeType;
            var heightType      = tile.TerrainData.HeightType;

            var elapsedTime = 0f;
            var healthLost  = 0f;
            var fatigueLost = 0f;
            var moraleLost  = 0f;

            if (heightType == HeightType.River)
            {
                //TODO: Account for river.
            }
            else if (heightType >= HeightType.Rock)
            {
                roll = random.NextFloatInRange(0f, .5f);
                var mountainCatastrophe = false;
                if (heightType > HeightType.Rock)
                {
                    if (roll + .5f > entity.AdjustedMountaineeringSkill)
                    {
                        mountainCatastrophe = true;
                    }
                }
                else
                {
                    if (roll + .45f > entity.AdjustedMountaineeringSkill)
                    {
                        mountainCatastrophe = true;
                    }
                }
                if (mountainCatastrophe)
                {
                    explorationResults.ExplorationEntries.Add(
                        new ExplorationStoryEntry()
                    {
                        Title       = "The mountains were not kind.",
                        Description = "During your exploration in the mountains you suffered a fall and were injured."
                    });

                    elapsedTime = MathUtilities.GetFloatAtPercentBetween(3f, 24f, severityPercent);
                    healthLost  = MathUtilities.GetFloatAtPercentBetween(1f, 3f, severityPercent);
                    fatigueLost = MathUtilities.GetFloatAtPercentBetween(1f, 3f, severityPercent);
                    moraleLost  = MathUtilities.GetFloatAtPercentBetween(2f, 4f, severityPercent);
                }
            }
            else
            {
                roll = random.NextFloatInRange(0f, 1f);
                switch (biomeType)
                {
                case BiomeType.Desert:
                    if (roll > .9f)
                    {
                        explorationResults.ExplorationEntries.Add(
                            new ExplorationStoryEntry()
                        {
                            Title       = "The desert was not kind.",
                            Description = "During your exploration in the desert you were stung by an extremely poisonous snake and grew ill."
                        });

                        elapsedTime = MathUtilities.GetFloatAtPercentBetween(1f, 6f, severityPercent);
                        healthLost  = MathUtilities.GetFloatAtPercentBetween(.5f, 1f, severityPercent);
                        fatigueLost = MathUtilities.GetFloatAtPercentBetween(1f, 2f, severityPercent);
                        moraleLost  = MathUtilities.GetFloatAtPercentBetween(1f, 2f, severityPercent);
                    }
                    break;

                case BiomeType.Savanna:
                    if (roll > .9f)
                    {
                    }
                    break;

                case BiomeType.TropicalRainforest:
                    break;

                case BiomeType.Grassland:
                    break;

                case BiomeType.Woodland:
                    break;

                case BiomeType.SeasonalForest:
                    break;

                case BiomeType.TemperateRainforest:
                    break;

                case BiomeType.BorealForest:
                    break;

                case BiomeType.Tundra:
                    break;

                case BiomeType.Ice:
                    break;
                }
            }
            explorationResults.ElapsedTimeHours += elapsedTime;
            entity.Health  -= healthLost;
            entity.Fatigue -= fatigueLost;
            entity.Morale  -= moraleLost;
        }