updated weather generation - now including rain

This commit is contained in:
Vasyl Horbachenko 2018-06-14 19:24:13 +03:00
parent 064b9ba877
commit a4145154af
4 changed files with 26 additions and 4 deletions

View File

@ -4,7 +4,7 @@
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.6 (venv)" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.6" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TestRunnerService">

2
.idea/misc.xml generated
View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6 (venv)" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6" project-jdk-type="Python SDK" />
</project>

View File

@ -14,6 +14,12 @@ RANDOM_TIME = {
"day": 100,
}
RANDOM_WEATHER = {
0: 0, # thunderstorm
1: 5, # heavy rain
2: 15, # rain
3: 35, # random dynamic
}
class EnvironmentSettingsGenerator:
def __init__(self, mission: Mission, game):
@ -29,7 +35,23 @@ class EnvironmentSettingsGenerator:
break
self.mission.random_daytime(time_period)
self.mission.weather.random(self.mission.start_time, self.mission.terrain)
weather_roll = random.randint(0, 100)
weather_type = None
for k, v in RANDOM_TIME.items():
if v >= weather_roll:
weather_type = k
break
if weather_type == 0:
self.mission.weather.random_thunderstorm()
elif weather_type == 1:
self.mission.weather.heavy_rain()
elif weather_type == 2:
self.mission.weather.heavy_rain()
self.mission.weather.enable_fog = False
elif weather_type == 3:
self.mission.weather.random(self.mission.start_time, self.mission.terrain)
for cp in self.game.theater.controlpoints:
if cp.is_global:

View File

@ -68,7 +68,7 @@ class OverviewCanvas:
for cp in self.game.theater.controlpoints:
coords = self.cp_coordinates(cp)
arc_size = 28 * math.pow(cp.importance, 1)
arc_size = 22 * math.pow(cp.importance, 1)
extent = max(cp.base.strength * 180, 10)
start = (180 - extent) / 2
color = cp.captured and 'blue' or 'red'