mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Merge branch 'develop' into new_frontline
This commit is contained in:
commit
0b4e2d3b6b
24
game/game.py
24
game/game.py
@ -147,30 +147,6 @@ class Game:
|
|||||||
front_line.control_point_a,
|
front_line.control_point_a,
|
||||||
front_line.control_point_b)
|
front_line.control_point_b)
|
||||||
|
|
||||||
def commision_unit_types(self, cp: ControlPoint, for_task: Task) -> List[UnitType]:
|
|
||||||
importance_factor = (cp.importance - IMPORTANCE_LOW) / (IMPORTANCE_HIGH - IMPORTANCE_LOW)
|
|
||||||
|
|
||||||
if for_task == AirDefence and not self.settings.sams:
|
|
||||||
return [x for x in db.find_unittype(AirDefence, self.enemy_name) if x not in db.SAM_BAN]
|
|
||||||
else:
|
|
||||||
return db.choose_units(for_task, importance_factor, COMMISION_UNIT_VARIETY, self.enemy_name)
|
|
||||||
|
|
||||||
def _commision_units(self, cp: ControlPoint):
|
|
||||||
for for_task in [CAS, CAP, AirDefence]:
|
|
||||||
limit = COMMISION_LIMITS_FACTORS[for_task] * math.pow(cp.importance,
|
|
||||||
COMMISION_LIMITS_SCALE) * self.settings.multiplier
|
|
||||||
missing_units = limit - cp.base.total_units(for_task)
|
|
||||||
if missing_units > 0:
|
|
||||||
awarded_points = COMMISION_AMOUNTS_FACTORS[for_task] * math.pow(cp.importance,
|
|
||||||
COMMISION_AMOUNTS_SCALE) * self.settings.multiplier
|
|
||||||
points_to_spend = cp.base.append_commision_points(for_task, awarded_points)
|
|
||||||
if points_to_spend > 0:
|
|
||||||
unittypes = self.commision_unit_types(cp, for_task)
|
|
||||||
if len(unittypes) > 0:
|
|
||||||
d = {random.choice(unittypes): points_to_spend}
|
|
||||||
logging.info("Commision {}: {}".format(cp, d))
|
|
||||||
cp.base.commision_units(d)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def budget_reward_amount(self):
|
def budget_reward_amount(self):
|
||||||
reward = 0
|
reward = 0
|
||||||
|
|||||||
@ -177,10 +177,17 @@ class QLiberationMap(QGraphicsView):
|
|||||||
if unit is None:
|
if unit is None:
|
||||||
logging.error(f"Unknown unit type {u.type}")
|
logging.error(f"Unknown unit type {u.type}")
|
||||||
continue
|
continue
|
||||||
detection_range = max(detection_range,
|
|
||||||
getattr(unit, "detection_range"))
|
# Some units in pydcs have detection_range and threat_range
|
||||||
threat_range = max(threat_range,
|
# defined, but explicitly set to None.
|
||||||
getattr(unit, "threat_range"))
|
unit_detection_range = getattr(unit, "detection_range", None)
|
||||||
|
if unit_detection_range is not None:
|
||||||
|
detection_range = max(detection_range, unit_detection_range)
|
||||||
|
|
||||||
|
unit_threat_range = getattr(unit, "threat_range", None)
|
||||||
|
if unit_threat_range is not None:
|
||||||
|
threat_range = max(threat_range, unit_threat_range)
|
||||||
|
|
||||||
return detection_range, threat_range
|
return detection_range, threat_range
|
||||||
|
|
||||||
def reload_scene(self):
|
def reload_scene(self):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user