persistent time and weather between regular and quick missions; defense AA for frontline CAS

This commit is contained in:
Vasyl Horbachenko
2018-06-28 21:27:04 +03:00
parent 2323f481c5
commit f8c1956614
12 changed files with 147 additions and 70 deletions

View File

@@ -2,6 +2,7 @@ from dcs.unittype import UnitType
from game import *
from theater import *
from gen.environmentgen import EnvironmentSettings
from userdata.debriefing import Debriefing
@@ -15,6 +16,7 @@ class Event:
operation = None # type: Operation
difficulty = 1 # type: int
game = None # type: Game
environment_settings = None # type: EnvironmentSettings
BONUS_BASE = 3
def __init__(self, attacker_name: str, defender_name: str, from_cp: ControlPoint, to_cp: ControlPoint, game):
@@ -47,12 +49,16 @@ class Event:
def generate(self):
self.operation.is_awacs_enabled = self.is_awacs_enabled
self.operation.prepare(self.game.theater.terrain, is_quick=False)
self.operation.generate()
self.operation.mission.save("build/nextturn.miz")
self.environment_settings = self.operation.environment_settings
def generate_quick(self):
self.operation.is_awacs_enabled = self.is_awacs_enabled
self.operation.environment_settings = self.environment_settings
self.operation.prepare(self.game.theater.terrain, is_quick=True)
self.operation.generate()
self.operation.mission.save('build/nextturn_quick.miz')

View File

@@ -2,6 +2,7 @@ import math
import random
from dcs.task import *
from dcs.vehicles import AirDefence
from game import *
from game.event import *
@@ -57,6 +58,9 @@ class GroundInterceptEvent(Event):
typecount = max(math.floor(self.difficulty * self.TARGET_AMOUNT_FACTOR), 1)
self.targets = {unittype: typecount for unittype in unittypes}
defense_aa_unit = random.choice(self.game.commision_unit_types(self.to_cp, AirDefence))
self.targets[defense_aa_unit] = 1
op = GroundInterceptOperation(game=self.game,
attacker_name=self.attacker_name,
defender_name=self.defender_name,