moved ground interceptions to the frontline; added ka-50; added close to the CP ground attack operations; added missing loadouts

This commit is contained in:
Vasyl Horbachenko
2018-06-24 00:52:14 +03:00
parent 25e2681665
commit 5d02f7ad4d
90 changed files with 30267 additions and 394 deletions

View File

@@ -4,6 +4,7 @@ from dcs.vehicles import *
from dcs.unitgroup import *
from dcs.ships import *
from dcs.planes import *
from dcs.helicopters import *
from dcs.task import *
from dcs.unittype import *
@@ -38,6 +39,11 @@ PRICES = {
A_10A: 18,
A_10C: 20,
# heli
Ka_50: 13,
UH_1H: 5,
Mi_8MT: 5,
# special
IL_76MD: 13,
An_26B: 13,
@@ -60,6 +66,11 @@ PRICES = {
Armor.ATGM_M1134_Stryker: 6,
Armor.APC_BTR_80: 6,
Unarmed.Transport_UAZ_469: 3,
Unarmed.Transport_Ural_375: 3,
Unarmed.Transport_M818: 3,
AirDefence.AAA_Vulcan_M163: 5,
AirDefence.SAM_Avenger_M1097: 10,
AirDefence.SAM_Patriot_ICC: 15,
@@ -106,6 +117,7 @@ UNIT_BY_TASK = {
Su_17M4,
MiG_29G,
Su_34,
Ka_50,
],
Transport: [
@@ -117,9 +129,11 @@ UNIT_BY_TASK = {
S_3B_Tanker,
C_130,
],
AWACS: [E_3A, A_50, ],
PinpointStrike: [Armor.MBT_T_90, Armor.MBT_T_80U, Armor.MBT_T_55, Armor.MBT_M1A2_Abrams, Armor.MBT_M60A3_Patton, Armor.ATGM_M1134_Stryker, Armor.APC_BTR_80, ],
Reconnaissance: [Unarmed.Transport_M818, Unarmed.Transport_Ural_375, Unarmed.Transport_UAZ_469],
AirDefence: [
AirDefence.AAA_Vulcan_M163,
AirDefence.AAA_Vulcan_M163,
@@ -190,6 +204,9 @@ UNIT_BY_COUNTRY = {
Yak_40,
A_50,
Ka_50,
Mi_8MT,
AirDefence.AAA_ZU_23_on_Ural_375,
AirDefence.SAM_SA_18_Igla_MANPADS,
AirDefence.SAM_SA_19_Tunguska_2S6,
@@ -199,6 +216,8 @@ UNIT_BY_COUNTRY = {
Armor.MBT_T_90,
Armor.MBT_T_80U,
Armor.MBT_T_55,
Unarmed.Transport_Ural_375,
Unarmed.Transport_UAZ_469,
CV_1143_5_Admiral_Kuznetsov,
Bulk_cargo_ship_Yakushev,
Dry_cargo_ship_Ivanov,
@@ -222,9 +241,13 @@ UNIT_BY_COUNTRY = {
C_130,
E_3A,
Ka_50,
UH_1H,
Armor.MBT_M1A2_Abrams,
Armor.MBT_M60A3_Patton,
Armor.ATGM_M1134_Stryker,
Unarmed.Transport_M818,
AirDefence.AAA_Vulcan_M163,
AirDefence.SAM_Avenger_M1097,
@@ -244,6 +267,10 @@ PLANE_PAYLOAD_OVERRIDES = {
CAS: "AS 2",
},
Ka_50: {
"*": "12x9A4172, 40xS-8",
},
# TODO: figure out a way to setup su33 loadout
Su_33: FighterSweep,
@@ -262,6 +289,7 @@ PLANE_LIVERY_OVERRIDES = {
UnitsDict = typing.Dict[UnitType, int]
PlaneDict = typing.Dict[FlyingType, int]
HeliDict = typing.Dict[HelicopterType, int]
ArmorDict = typing.Dict[VehicleType, int]
ShipDict = typing.Dict[ShipType, int]
AirDefenseDict = typing.Dict[AirDefence, int]
@@ -324,4 +352,4 @@ def _validate_db():
assert unit_type in PRICES, "{} not in prices".format(unit_type)
_validate_db()
_validate_db()

View File

@@ -3,4 +3,5 @@ from .groundintercept import *
from .intercept import *
from .capture import *
from .navalintercept import *
from .antiaastrike import *
from .antiaastrike import *
from .groundattack import *

View File

@@ -0,0 +1,36 @@
import math
import random
from dcs.task import *
from game import *
from game.event import *
from game.event.groundintercept import GroundInterceptEvent
from game.operation.groundattack import GroundAttackOperation
class GroundAttackEvent(GroundInterceptEvent):
def __str__(self):
return "Destroy insurgents at {}".format(self.to_cp)
def player_defending(self, strikegroup: db.PlaneDict, clients: db.PlaneDict):
suitable_unittypes = db.find_unittype(Reconnaissance, self.attacker_name)
random.shuffle(suitable_unittypes)
unittypes = suitable_unittypes[:self.TARGET_VARIETY]
typecount = max(math.floor(self.difficulty * self.TARGET_AMOUNT_FACTOR), 1)
self.targets = {unittype: typecount for unittype in unittypes}
op = GroundAttackOperation(game=self.game,
attacker_name=self.attacker_name,
defender_name=self.defender_name,
attacker_clients=clients,
defender_clients={},
from_cp=self.from_cp,
to_cp=self.to_cp)
op.setup(target=self.targets,
strikegroup=strikegroup)
self.operation = op
def player_attacking(self, interceptors: db.PlaneDict, clients: db.PlaneDict):
assert False

View File

@@ -19,7 +19,7 @@ class GroundInterceptEvent(Event):
targets = None # type: db.ArmorDict
def __str__(self):
return "Ground intercept from {} at {}".format(self.from_cp, self.to_cp)
return "Fontline CAS from {} at {}".format(self.from_cp, self.to_cp)
def is_successfull(self, debriefing: Debriefing):
total_targets = sum(self.targets.values())

View File

@@ -35,6 +35,7 @@ EVENT_PROBABILITIES = {
CaptureEvent: [100, 4],
InterceptEvent: [35, 5],
GroundInterceptEvent: [35, 5],
GroundAttackEvent: [0, 35],
NavalInterceptEvent: [35, 5],
AntiAAStrikeEvent: [35, 5],
}
@@ -62,7 +63,7 @@ class Game:
self.enemy = enemy_name
def _roll(self, prob, mult):
return random.randint(0, 100) <= prob * mult
return random.randint(1, 100) <= prob * mult
def _generate_globalinterceptions(self):
global_count = len([x for x in self.theater.player_points() if x.is_global])
@@ -80,6 +81,8 @@ class Game:
def _generate_events(self):
enemy_cap_generated = False
enemy_generated_types = []
for player_cp, enemy_cp in self.theater.conflicts(True):
if player_cp.is_global or enemy_cp.is_global:
continue
@@ -92,6 +95,9 @@ class Game:
self.events.append(event_class(self.player, self.enemy, player_cp, enemy_cp, self))
elif self._roll(enemy_probability, enemy_cp.base.strength):
if event_class in enemy_generated_types:
continue
if player_cp in self.ignored_cps:
continue
@@ -111,6 +117,7 @@ class Game:
if player_cp.base.total_aa == 0:
continue
enemy_generated_types.append(event_class)
self.events.append(event_class(self.enemy, self.player, enemy_cp, player_cp, self))
def _commision_units(self, cp: ControlPoint):
@@ -173,7 +180,8 @@ class Game:
def pass_turn(self, no_action=False, ignored_cps: typing.Collection[ControlPoint]=None):
for event in self.events:
event.skip()
if type(event) is UnitsDeliveryEvent:
event.skip()
if not no_action:
self._budget_player()

View File

@@ -32,10 +32,9 @@ class AntiAAStrikeOperation(Operation):
self.attackers_starting_position = None
self.defenders_starting_position = None
conflict = Conflict.ground_intercept_conflict(
conflict = Conflict.ground_base_attack(
attacker=self.mission.country(self.attacker_name),
defender=self.mission.country(self.defender_name),
heading=self.to_cp.position.heading_between_point(self.from_cp.position),
from_cp=self.from_cp,
to_cp=self.to_cp,
theater=self.game.theater

View File

@@ -0,0 +1,44 @@
from dcs.terrain import Terrain
from game import db
from gen.armor import *
from gen.aircraft import *
from gen.aaa import *
from gen.shipgen import *
from gen.settingsgen import *
from gen.awacsgen import *
from gen.visualgen import *
from gen.conflictgen import Conflict
from .operation import Operation
class GroundAttackOperation(Operation):
strikegroup = None # type: db.PlaneDict
target = None # type: db.ArmorDict
def setup(self,
target: db.ArmorDict,
strikegroup: db.PlaneDict):
self.strikegroup = strikegroup
self.target = target
def prepare(self, terrain: Terrain, is_quick: bool):
super(GroundAttackOperation, self).prepare(terrain, is_quick)
conflict = Conflict.ground_attack_conflict(
attacker=self.mission.country(self.attacker_name),
defender=self.mission.country(self.defender_name),
from_cp=self.from_cp,
to_cp=self.to_cp,
theater=self.game.theater
)
self.initialize(mission=self.mission,
conflict=conflict)
def generate(self):
self.airgen.generate_defense(self.strikegroup, self.defender_clients, self.defenders_starting_position)
self.armorgen.generate(self.target, {})
super(GroundAttackOperation, self).generate()

View File

@@ -12,6 +12,7 @@ from gen.conflictgen import Conflict
from .operation import Operation
class GroundInterceptOperation(Operation):
strikegroup = None # type: db.PlaneDict
interceptors = None # type: db.PlaneDict
@@ -34,7 +35,6 @@ class GroundInterceptOperation(Operation):
conflict = Conflict.ground_intercept_conflict(
attacker=self.mission.country(self.attacker_name),
defender=self.mission.country(self.defender_name),
heading=self.to_cp.position.heading_between_point(self.from_cp.position),
from_cp=self.from_cp,
to_cp=self.to_cp,
theater=self.game.theater