mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
a
This commit is contained in:
14
game/game.py
14
game/game.py
@@ -23,7 +23,7 @@ COMMISION_AMOUNTS_FACTORS = {
|
||||
}
|
||||
|
||||
|
||||
ENEMY_INTERCEPT_PROBABILITY_BASE = 25
|
||||
ENEMY_INTERCEPT_PROBABILITY_BASE = 15
|
||||
ENEMY_CAPTURE_PROBABILITY_BASE = 5
|
||||
|
||||
PLAYER_INTERCEPT_PROBABILITY_BASE = 30
|
||||
@@ -107,12 +107,17 @@ class Game:
|
||||
unit_type = random.choice(db.find_unittype(for_task, self.enemy))
|
||||
cp.base.commision_units({unit_type: points_to_spend})
|
||||
|
||||
def _budget_player(self):
|
||||
@property
|
||||
def budget_reward_amount(self):
|
||||
if len(self.theater.player_points()) > 0:
|
||||
total_importance = sum([x.importance for x in self.theater.player_points()])
|
||||
total_strength = sum([x.base.strength for x in self.theater.player_points()]) / len(self.theater.player_points())
|
||||
return math.ceil(math.log(total_importance * total_strength + 1, PLAYER_BUDGET_IMPORTANCE_LOG) * PLAYER_BUDGET_BASE)
|
||||
else:
|
||||
return 0
|
||||
|
||||
self.budget += math.ceil(math.log(total_importance * total_strength + 1, PLAYER_BUDGET_IMPORTANCE_LOG) * PLAYER_BUDGET_BASE)
|
||||
def _budget_player(self):
|
||||
self.budget += self.budget_reward_amount
|
||||
|
||||
def units_delivery_event(self, to_cp: ControlPoint) -> UnitsDeliveryEvent:
|
||||
event = UnitsDeliveryEvent(attacker_name=self.player,
|
||||
@@ -122,6 +127,9 @@ class Game:
|
||||
self.events.append(event)
|
||||
return event
|
||||
|
||||
def units_delivery_remove(self, event: Event):
|
||||
self.events.remove(event)
|
||||
|
||||
def initiate_event(self, event: Event):
|
||||
event.operation.generate()
|
||||
event.mission.save("build/next_mission.miz")
|
||||
|
||||
Reference in New Issue
Block a user