mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Improve the replenish rate function in squadron.py
reword and reuse
This commit is contained in:
parent
2af274dc77
commit
b533633494
@ -183,15 +183,8 @@ class Squadron:
|
|||||||
self.deliver_orders()
|
self.deliver_orders()
|
||||||
|
|
||||||
def replenish_lost_pilots(self) -> None:
|
def replenish_lost_pilots(self) -> None:
|
||||||
if not self.pilot_limits_enabled:
|
if self.pilot_limits_enabled and self.replenish_count > 0:
|
||||||
return
|
self._recruit_pilots(self.replenish_count)
|
||||||
|
|
||||||
replenish_count = min(
|
|
||||||
self.settings.squadron_replenishment_rate,
|
|
||||||
self._number_of_unfilled_pilot_slots,
|
|
||||||
)
|
|
||||||
if replenish_count > 0:
|
|
||||||
self._recruit_pilots(replenish_count)
|
|
||||||
|
|
||||||
def return_all_pilots_and_aircraft(self) -> None:
|
def return_all_pilots_and_aircraft(self) -> None:
|
||||||
self.available_pilots = list(self.active_pilots)
|
self.available_pilots = list(self.active_pilots)
|
||||||
@ -224,10 +217,10 @@ class Squadron:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def expected_pilots_next_turn(self) -> int:
|
def expected_pilots_next_turn(self) -> int:
|
||||||
return len(self.active_pilots) + self.replenish_rate
|
return len(self.active_pilots) + self.replenish_count
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def replenish_rate(self) -> int:
|
def replenish_count(self) -> int:
|
||||||
return min(
|
return min(
|
||||||
self.settings.squadron_replenishment_rate,
|
self.settings.squadron_replenishment_rate,
|
||||||
self._number_of_unfilled_pilot_slots,
|
self._number_of_unfilled_pilot_slots,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user