Esempio n. 1
0
        public bool RoomIsDark(Room room, Player player)
        {
            if (room.RoomLit)
            {
                return(false);
            }

            if (room.Type == Room.RoomType.Inside || room.Type == Room.RoomType.Town || room.Type == Room.RoomType.Shop || room.Type == Room.RoomType.Guild)
            {
                return(false);
            }

            if (room.Terrain == Room.TerrainType.Inside)
            {
                return(false);
            }

            if (player.Equipped.Light != null)
            {
                return(false);
            }

            if (!_time.IsNightTime())
            {
                return(true);
            }

            return(false);
        }
Esempio n. 2
0
        public string SimulateWeatherTransitions()
        {
            var currentRoll = _dice.Roll(1, 1, 100);

            var states = new List <string>()
            {
                "Sunny",
                "SunnyToCloudy",
                "Cloudy",
                "CloudyToSunny",
                "CloudyToRain",
                "LightRain",
                "HeavyRain",
                "ThunderStorm"
            };

            var sunnyStates = new List <Tuple <string, string> >()
            {
                new Tuple <string, string>("It's a beautiful clear blue sky", "It's a beautiful clear night sky with twinkling stars"),
                new Tuple <string, string>("The sun blazes brightly in the sky", "The moon illuminates the night sky"),
            };


            var weatherText = string.Empty;

            if (currentRoll <= 10 && WeatherState == "Sunny")
            {
                WeatherState = "SunnyToCloudy";
            }

            if (WeatherState == "Cloudy")
            {
                weatherText = _time.IsNightTime() ? CloudyStates[0].Item1 : CloudyStates[0].Item2;


                if (currentRoll <= 70)
                {
                    WeatherState = "Cloudy";
                }

                if (currentRoll > 70 && currentRoll < 85)
                {
                    WeatherState = "CloudyToSunny";
                }

                if (currentRoll >= 85 && currentRoll <= 100)
                {
                    WeatherState = "CloudyToRain";
                }

                return(weatherText);
            }

            if (WeatherState == "LightRain")
            {
                weatherText = _time.IsNightTime() ? LightRainState[_dice.Roll(1, 0, 1)].Item1 : LightRainState[_dice.Roll(1, 0, 1)].Item2;

                if (currentRoll <= 25)
                {
                    WeatherState = "RainToCloudy";
                }

                if (currentRoll >= 75)
                {
                    WeatherState = "RainToHeavyRain";
                }


                return(weatherText);
            }

            if (WeatherState == "HeavyRain")
            {
                weatherText = _time.IsNightTime() ? HeavyRainState[_dice.Roll(1, 0, 1)].Item1 : HeavyRainState[_dice.Roll(1, 0, 1)].Item2;

                if (currentRoll <= 45)
                {
                    WeatherState = "HeavyToLightRain";
                }

                if (currentRoll >= 75)
                {
                    WeatherState = "HeavyRainToThunder";
                }


                return(weatherText);
            }

            if (WeatherState == "Thunder")
            {
                weatherText = _time.IsNightTime() ? ThunderState[_dice.Roll(1, 0, 2)].Item1 : ThunderState[_dice.Roll(1, 0, 2)].Item2;

                if (currentRoll <= 35)
                {
                    WeatherState = "ThunderToLightRain";
                }


                return(weatherText);
            }



            // transitions


            if (WeatherState == "SunnyToCloudy")
            {
                weatherText = WeatherTransition("Cloudy", sunnyToCloudyTransitionStates, ref SunnyToCloudyTransitionState);

                return(weatherText);
            }
            if (WeatherState == "CloudyToSunny")
            {
                weatherText = WeatherTransition("Sunny", cloudyToSunnyTransitionStates, ref CloudyToSunnyTransitionState);

                return(weatherText);
            }

            if (WeatherState == "CloudyToRain")
            {
                weatherText = WeatherTransition("LightRain", cloudyToRainyTransitionStates, ref CloudyToLightRainTransitionState);

                return(weatherText);
            }

            if (WeatherState == "RainToCloudy")
            {
                weatherText = WeatherTransition("Cloudy", LightRainToCloudTransitionStates, ref LightRainToCloudyTransitionState);

                return(weatherText);
            }

            if (WeatherState == "RainToHeavyRain")
            {
                weatherText = WeatherTransition("HeavyRain", LightRainToHeavyRainTransitionStates, ref LightRainToHeavyRainTransitionState);

                return(weatherText);
            }

            if (WeatherState == "HeavyToLightRain")
            {
                weatherText = WeatherTransition("LightRain", HeavyRainToLightRainTransitionStates, ref HeavyRainToLightRainTransitionState);

                return(weatherText);
            }

            if (WeatherState == "HeavyRainToThunder")
            {
                weatherText = WeatherTransition("Thunder", HeavyRainToThunderTransitionStates, ref HeavyRainToThunderTransitionState);

                return(weatherText);
            }

            if (WeatherState == "ThunderToLightRain")
            {
                weatherText = WeatherTransition("LightRain", ThunderToLightRainTransitionStates, ref ThunderToLightRainTransitionState);

                return(weatherText);
            }


            return(_time.IsNightTime() ? "It's a beautiful clear blue sky" : "It's a beautiful clear night sky");
        }