Added new campaign generation settings. Added Helicopter Carrier to China faction.

This commit is contained in:
Khopa
2020-08-04 00:14:42 +02:00
parent 4060039440
commit a76962e206
14 changed files with 200 additions and 57 deletions

View File

@@ -1,11 +1,8 @@
import re
from dcs.terrain import caucasus
from dcs import mapping
from dcs.terrain import caucasus
from .landmap import *
from .conflicttheater import *
from .base import *
from .landmap import *
class CaucasusTheater(ConflictTheater):
@@ -63,15 +60,17 @@ class CaucasusTheater(ConflictTheater):
self.add_controlpoint(self.gudauta, connected_to=[self.sochi, self.sukhumi])
self.add_controlpoint(self.sochi, connected_to=[self.gudauta, self.gelendzhik])
self.add_controlpoint(self.gelendzhik, connected_to=[self.sochi, ])
self.add_controlpoint(self.krymsk, connected_to=[self.anapa, self.krasnodar])
self.add_controlpoint(self.gelendzhik, connected_to=[self.sochi, self.krymsk])
self.add_controlpoint(self.krymsk, connected_to=[self.anapa, self.krasnodar, self.gelendzhik])
self.add_controlpoint(self.anapa, connected_to=[self.krymsk])
self.add_controlpoint(self.krasnodar, connected_to=[self.krymsk, self.maykop])
self.add_controlpoint(self.carrier_1)
self.carrier_1.captured = True
self.carrier_1.captured_invert = True
self.batumi.captured = True
self.anapa.captured_invert = True
"""
@@ -113,7 +112,9 @@ class WesternGeorgia(ConflictTheater):
self.add_controlpoint(self.carrier_1)
self.carrier_1.captured = True
self.carrier_1.captured_invert = True
self.kobuleti.captured = True
self.sochi.captured_invert = True
"""
@@ -158,8 +159,6 @@ class WesternGeorgiaInverted(ConflictTheater):
self.sochi.captured = True
class NorthCaucasus(ConflictTheater):
terrain = caucasus.Caucasus()
overview_image = "caumap.gif"
@@ -203,3 +202,7 @@ class NorthCaucasus(ConflictTheater):
self.carrier_1.captured = True
self.vaziani.captured = True
self.kutaisi.captured = True
self.carrier_1.captured_invert = True
self.maykop.captured_invert = True
self.mineralnye.captured_invert = True

View File

@@ -4,7 +4,7 @@ from enum import Enum
from dcs.mapping import *
from dcs.terrain import Airport
from dcs.ships import CVN_74_John_C__Stennis, LHA_1_Tarawa, CV_1143_5_Admiral_Kuznetsov
from dcs.ships import CVN_74_John_C__Stennis, LHA_1_Tarawa, CV_1143_5_Admiral_Kuznetsov, Type_071_Amphibious_Transport_Dock
from game import db
from gen.ground_forces.combat_stance import CombatStance
@@ -55,6 +55,7 @@ class ControlPoint:
self.size = size
self.importance = importance
self.captured = False
self.captured_invert = False
self.has_frontline = has_frontline
self.radials = radials
self.connected_points = []
@@ -148,7 +149,7 @@ class ControlPoint:
if g.dcs_identifier in ["CARRIER", "LHA"]:
for group in g.groups:
for u in group.units:
if db.unit_type_from_name(u.type) in [CVN_74_John_C__Stennis, LHA_1_Tarawa, CV_1143_5_Admiral_Kuznetsov]:
if db.unit_type_from_name(u.type) in [CVN_74_John_C__Stennis, LHA_1_Tarawa, CV_1143_5_Admiral_Kuznetsov, Type_071_Amphibious_Transport_Dock]:
return True
return False
elif self.cptype in [ControlPointType.AIRBASE, ControlPointType.FARP]:

View File

@@ -46,4 +46,5 @@ class NevadaTheater(ConflictTheater):
self.add_controlpoint(self.mesquite, connected_to=[self.lincoln_conty, self.groom_lake, self.creech])
self.tonopah.captured = True
self.mesquite.captured_invert = True

View File

@@ -44,6 +44,8 @@ class NormandyTheater(ConflictTheater):
self.chailey.captured = True
self.needOarPoint.captured = True
self.evreux.captured_invert = True
class NormandySmall(ConflictTheater):
terrain = dcs.terrain.Normandy()
@@ -77,3 +79,5 @@ class NormandySmall(ConflictTheater):
self.deuxjumeaux.captured = True
self.needOarPoint.captured = True
self.evreux.captured_invert = True

View File

@@ -84,6 +84,10 @@ class PersianGulfTheater(ConflictTheater):
self.east_carrier.captured = True
self.liwa.captured = True
self.west_carrier.captured_invert = True
self.east_carrier.captured_invert = True
self.shiraz.captured_invert = True
class IranianCampaign(ConflictTheater):
@@ -154,6 +158,8 @@ class IranianCampaign(ConflictTheater):
self.havadarya.captured = True
self.bandar_abbas.captured = True
self.shiraz.captured_invert = True
class Emirates(ConflictTheater):
terrain = dcs.terrain.PersianGulf()
@@ -199,3 +205,7 @@ class Emirates(ConflictTheater):
self.tarawa_carrier.captured = True
self.east_carrier.captured = True
self.fujairah.captured = True
self.tarawa_carrier.captured_invert = True
self.east_carrier.captured_invert = True
self.fujairah.captured_invert = True

View File

@@ -5,6 +5,7 @@ import typing
import logging
from game.data.building_data import DEFAULT_AVAILABLE_BUILDINGS
from game.settings import Settings
from gen import namegen, TheaterGroundObject
from gen.defenses.armor_group_generator import generate_armor_group
from gen.fleet.ship_group_generator import generate_carrier_group, generate_lha_group, generate_ship_group
@@ -153,8 +154,15 @@ def generate_groundobjects(theater: ConflictTheater, game):
for ground_object in cp.ground_objects:
logging.info(ground_object.groups)
# Generate navy groups
if "boat" in db.FACTIONS[faction_name].keys():
if cp.captured and game.settings.do_not_generate_player_navy:
continue
if not cp.captured and game.settings.do_not_generate_enemy_navy:
continue
boat_count = 1
if "boat_count" in db.FACTIONS[faction_name].keys():
boat_count = int(db.FACTIONS[faction_name]["boat_count"])
@@ -378,3 +386,37 @@ def generate_cp_ground_points(cp: ControlPoint, theater, game, group_id, templat
cp.ground_objects.append(g)
return group_id
def prepare_theater(theater: ConflictTheater, settings:Settings, midgame):
to_remove = []
# autocapture half the base if midgame
if midgame:
for i in range(0, int(len(theater.controlpoints) / 2)):
theater.controlpoints[i].captured = True
# Remove carrier and lha, invert situation if needed
for cp in theater.controlpoints:
if cp.cptype is ControlPointType.AIRCRAFT_CARRIER_GROUP and settings.do_not_generate_carrier:
to_remove.append(cp)
elif cp.cptype is ControlPointType.LHA_GROUP and settings.do_not_generate_lha:
to_remove.append(cp)
if settings.inverted:
cp.captured = cp.captured_invert
# do remove
for cp in to_remove:
theater.controlpoints.remove(cp)
# reapply midgame inverted if needed
if midgame and settings.inverted:
for i, cp in enumerate(reversed(theater.controlpoints)):
if i > len(theater.controlpoints):
break
else:
cp.captured = True

View File

@@ -50,6 +50,12 @@ class ChannelTheater(ConflictTheater):
self.lympne.captured = True
self.manston.captured = True
self.manston.captured_invert = True
self.dunkirk.captured_invert = True
self.stomer.captured_invert = True
self.merville.captured_invert = True
self.abeville.captured_invert = True
class ChannelTheaterComplete(ConflictTheater):
terrain = dcs.terrain.TheChannel()
@@ -95,4 +101,9 @@ class ChannelTheaterComplete(ConflictTheater):
#self.dunkirk.captured = True
self.highhalden.captured = True
self.lympne.captured = True
self.manston.captured = True
self.manston.captured = True
self.dunkirk.captured_invert = True
self.stomer.captured_invert = True
self.merville.captured_invert = True
self.abeville.captured_invert = True