mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Remove random purchase pessimization.
Aircraft variety is now handled by explicit squadron selection, so no longer needed.
This commit is contained in:
parent
9768fb3493
commit
357487b767
@ -227,7 +227,6 @@ class ProcurementAi:
|
|||||||
def affordable_aircraft_for(
|
def affordable_aircraft_for(
|
||||||
self, request: AircraftProcurementRequest, airbase: ControlPoint, budget: float
|
self, request: AircraftProcurementRequest, airbase: ControlPoint, budget: float
|
||||||
) -> Optional[AircraftType]:
|
) -> Optional[AircraftType]:
|
||||||
best_choice: Optional[AircraftType] = None
|
|
||||||
for unit in aircraft_for_task(request.task_capability):
|
for unit in aircraft_for_task(request.task_capability):
|
||||||
if unit.price * request.number > budget:
|
if unit.price * request.number > budget:
|
||||||
continue
|
continue
|
||||||
@ -242,13 +241,9 @@ class ProcurementAi:
|
|||||||
if distance_to_target > unit.max_mission_range:
|
if distance_to_target > unit.max_mission_range:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Affordable, compatible, and we have a squadron capable of the task. To
|
# Affordable, compatible, and we have a squadron capable of the task.
|
||||||
# keep some variety, skip with a 50/50 chance. Might be a good idea to have
|
return unit
|
||||||
# the chance to skip based on the price compared to the rest of the choices.
|
return None
|
||||||
best_choice = unit
|
|
||||||
if random.choice([True, False]):
|
|
||||||
break
|
|
||||||
return best_choice
|
|
||||||
|
|
||||||
def fulfill_aircraft_request(
|
def fulfill_aircraft_request(
|
||||||
self, request: AircraftProcurementRequest, budget: float
|
self, request: AircraftProcurementRequest, budget: float
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user