mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
fixes & updates
This commit is contained in:
37
game/db.py
37
game/db.py
@@ -9,21 +9,23 @@ from dcs.unittype import *
|
||||
|
||||
PRICES = {
|
||||
# fighter
|
||||
C_101CC: 10,
|
||||
AJS37: 15,
|
||||
F_5E: 12,
|
||||
MiG_23MLD: 15,
|
||||
MiG_25PD: 20,
|
||||
MiG_31: 30,
|
||||
Su_27: 30,
|
||||
Su_33: 33,
|
||||
MiG_15bis: 8,
|
||||
MiG_21Bis: 13,
|
||||
MiG_29A: 23,
|
||||
FA_18C_hornet: 18,
|
||||
AV8BNA: 15,
|
||||
F_15C: 30,
|
||||
M_2000C: 15,
|
||||
C_101CC: 8,
|
||||
MiG_23MLD: 20,
|
||||
MiG_25PD: 24,
|
||||
MiG_31: 28,
|
||||
Su_27: 24,
|
||||
Su_33: 25,
|
||||
MiG_29A: 28,
|
||||
|
||||
AJS37: 13,
|
||||
F_5E: 8,
|
||||
MiG_15bis: 5,
|
||||
MiG_21Bis: 8,
|
||||
|
||||
M_2000C: 18,
|
||||
FA_18C_hornet: 22,
|
||||
AV8BNA: 18,
|
||||
F_15C: 28,
|
||||
|
||||
# bomber
|
||||
Su_25T: 15,
|
||||
@@ -141,6 +143,11 @@ SAM_BAN = [
|
||||
AirDefence.SAM_SA_8_Osa_9A33,
|
||||
]
|
||||
|
||||
EXTRA_AA = {
|
||||
"Russia": AirDefence.SAM_SA_9_Strela_1_9P31,
|
||||
"USA": AirDefence.SAM_Patriot_EPP_III,
|
||||
}
|
||||
|
||||
UNIT_BY_COUNTRY = {
|
||||
"Russia": [
|
||||
C_101CC,
|
||||
|
||||
@@ -18,6 +18,21 @@ class Event:
|
||||
self.from_cp = from_cp
|
||||
self.game = game
|
||||
|
||||
@property
|
||||
def is_player_attacking(self) -> bool:
|
||||
return self.attacker_name == self.game.player
|
||||
|
||||
@property
|
||||
def enemy_cp(self) -> ControlPoint:
|
||||
if self.attacker_name == self.game.player:
|
||||
return self.to_cp
|
||||
else:
|
||||
return self.from_cp
|
||||
|
||||
@property
|
||||
def threat_description(self) -> str:
|
||||
return ""
|
||||
|
||||
def bonus(self) -> int:
|
||||
return math.ceil(math.log(self.difficulty, DIFFICULTY_LOG_BASE) * self.BONUS_BASE)
|
||||
|
||||
@@ -109,7 +124,6 @@ class GroundInterceptEvent(Event):
|
||||
|
||||
|
||||
class InterceptEvent(Event):
|
||||
ESCORT_AMOUNT_FACTOR = 2
|
||||
BONUS_BASE = 5
|
||||
STRENGTH_INFLUENCE = 0.25
|
||||
GLOBAL_STRENGTH_INFLUENCE = 0.05
|
||||
@@ -120,12 +134,16 @@ class InterceptEvent(Event):
|
||||
def __str__(self):
|
||||
return "Intercept from {} at {}".format(self.from_cp, self.to_cp)
|
||||
|
||||
@property
|
||||
def threat_description(self):
|
||||
return "{} aircraft".format(self.enemy_cp.base.scramble_count())
|
||||
|
||||
def is_successfull(self, debriefing: Debriefing):
|
||||
intercepted = self.transport_unit in debriefing.destroyed_units[self.defender_name].keys()
|
||||
units_destroyed = debriefing.destroyed_units[self.defender_name].get(self.transport_unit, 0)
|
||||
if self.from_cp.captured:
|
||||
return intercepted
|
||||
return units_destroyed > 0
|
||||
else:
|
||||
return not intercepted
|
||||
return units_destroyed == 0
|
||||
|
||||
def commit(self, debriefing: Debriefing):
|
||||
super(InterceptEvent, self).commit(debriefing)
|
||||
@@ -144,12 +162,12 @@ class InterceptEvent(Event):
|
||||
self.to_cp.base.affect_strength(-self.STRENGTH_INFLUENCE)
|
||||
|
||||
def player_attacking(self, interceptors: db.PlaneDict, clients: db.PlaneDict):
|
||||
escort = self.to_cp.base.scramble_sweep(self.to_cp)
|
||||
escort = self.to_cp.base.scramble_sweep()
|
||||
|
||||
self.transport_unit = random.choice(db.find_unittype(Transport, self.defender_name))
|
||||
assert self.transport_unit is not None
|
||||
|
||||
airdefense_unit = db.find_unittype(AirDefence, self.defender_name)[0]
|
||||
|
||||
airdefense_unit = db.find_unittype(AirDefence, self.defender_name)[-1]
|
||||
op = InterceptOperation(game=self.game,
|
||||
attacker_name=self.attacker_name,
|
||||
defender_name=self.defender_name,
|
||||
@@ -166,7 +184,8 @@ class InterceptEvent(Event):
|
||||
self.operation = op
|
||||
|
||||
def player_defending(self, escort: db.PlaneDict, clients: db.PlaneDict):
|
||||
interceptors = self.from_cp.base.scramble_interceptors_count(self.difficulty * self.ESCORT_AMOUNT_FACTOR)
|
||||
interceptors = self.from_cp.base.scramble_interceptors()
|
||||
|
||||
self.transport_unit = random.choice(db.find_unittype(Transport, self.defender_name))
|
||||
assert self.transport_unit is not None
|
||||
|
||||
@@ -194,6 +213,18 @@ class CaptureEvent(Event):
|
||||
def __str__(self):
|
||||
return "Attack from {} to {}".format(self.from_cp, self.to_cp)
|
||||
|
||||
@property
|
||||
def threat_description(self):
|
||||
descr = "{} aircraft + CAS, {} vehicles".format(
|
||||
self.enemy_cp.base.scramble_count(),
|
||||
self.enemy_cp.base.assemble_count()
|
||||
)
|
||||
|
||||
if self.is_player_attacking:
|
||||
descr += ", {} AA".format(self.enemy_cp.base.assemble_aa_count())
|
||||
|
||||
return descr
|
||||
|
||||
def is_successfull(self, debriefing: Debriefing):
|
||||
alive_attackers = sum(debriefing.alive_units[self.attacker_name].values())
|
||||
alive_defenders = sum(debriefing.alive_units[self.defender_name].values())
|
||||
@@ -221,9 +252,9 @@ class CaptureEvent(Event):
|
||||
self.to_cp.captured = False
|
||||
|
||||
def player_defending(self, interceptors: db.PlaneDict, clients: db.PlaneDict):
|
||||
cas = self.from_cp.base.scramble_cas(self.to_cp)
|
||||
escort = self.from_cp.base.scramble_sweep(self.to_cp)
|
||||
attackers = self.from_cp.base.assemble_cap(self.to_cp)
|
||||
cas = self.from_cp.base.scramble_cas()
|
||||
escort = self.from_cp.base.scramble_sweep()
|
||||
attackers = self.from_cp.base.assemble_cap()
|
||||
|
||||
op = CaptureOperation(game=self.game,
|
||||
attacker_name=self.attacker_name,
|
||||
@@ -243,7 +274,7 @@ class CaptureEvent(Event):
|
||||
self.operation = op
|
||||
|
||||
def player_attacking(self, cas: db.PlaneDict, escort: db.PlaneDict, armor: db.ArmorDict, clients: db.PlaneDict):
|
||||
interceptors = self.to_cp.base.scramble_sweep(for_target=self.to_cp)
|
||||
interceptors = self.to_cp.base.scramble_sweep()
|
||||
|
||||
op = CaptureOperation(game=self.game,
|
||||
attacker_name=self.attacker_name,
|
||||
|
||||
@@ -29,10 +29,10 @@ PLAYER_INTERCEPT_GLOBAL_PROBABILITY_BASE = 10
|
||||
PLAYER_INTERCEPT_GLOBAL_PROBABILITY_LOG = 2
|
||||
|
||||
PLAYER_BUDGET_INITIAL = 90
|
||||
PLAYER_BUDGET_BASE = 20
|
||||
PLAYER_BUDGET_BASE = 30
|
||||
PLAYER_BUDGET_IMPORTANCE_LOG = 2
|
||||
|
||||
AWACS_BUDGET_COST = 8
|
||||
AWACS_BUDGET_COST = 4
|
||||
|
||||
|
||||
class Game:
|
||||
|
||||
@@ -85,7 +85,8 @@ class Operation:
|
||||
if not global_cp.is_global:
|
||||
continue
|
||||
|
||||
ship = self.shipgen.generate(type=db.find_unittype(Carriage, self.attacker_name)[0],
|
||||
ship = self.shipgen.generate(type=db.find_unittype(Carriage, self.game.player)[0],
|
||||
country=self.game.player,
|
||||
at=global_cp.at)
|
||||
|
||||
if global_cp == self.from_cp and not self.is_quick:
|
||||
@@ -164,6 +165,8 @@ class InterceptOperation(Operation):
|
||||
def prepare(self, terrain: dcs.terrain.Terrain, is_quick: bool):
|
||||
super(InterceptOperation, self).prepare(terrain, is_quick)
|
||||
self.defenders_starting_position = None
|
||||
if self.defender_name == self.game.player:
|
||||
self.attackers_starting_position = None
|
||||
|
||||
conflict = Conflict.intercept_conflict(
|
||||
attacker=self.mission.country(self.attacker_name),
|
||||
|
||||
Reference in New Issue
Block a user