From a251ad596561de0251dfc58f85446c4e0ed48be3 Mon Sep 17 00:00:00 2001 From: Vasyl Horbachenko Date: Tue, 26 Jun 2018 04:14:53 +0300 Subject: [PATCH] base menu updated; balance tweaks --- game/db.py | 1 - gen/aircraft.py | 3 --- theater/base.py | 4 ++-- ui/basemenu.py | 23 +++++++++++++++++------ 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/game/db.py b/game/db.py index f7dce96b..88922d12 100644 --- a/game/db.py +++ b/game/db.py @@ -258,7 +258,6 @@ PLANE_PAYLOAD_OVERRIDES = { Su_33: { "*": "R-73*4,R-27R*2,R-27ER*6", - "_carrier": "R-73*4", }, AV8BNA: { diff --git a/gen/aircraft.py b/gen/aircraft.py index 23744eac..ec909bd6 100644 --- a/gen/aircraft.py +++ b/gen/aircraft.py @@ -66,9 +66,6 @@ class AircraftConflictGenerator: if for_task in db.PLANE_PAYLOAD_OVERRIDES[unit_type]: group.load_loadout(db.PLANE_PAYLOAD_OVERRIDES[unit_type][for_task]) did_load_loadout = True - elif "_carrier" in db.PLANE_PAYLOAD_OVERRIDES[unit_type] and isinstance(at, ShipGroup): - group.load_loadout(db.PLANE_PAYLOAD_OVERRIDES[unit_type]["_carrier"]) - did_load_loadout = True elif "*" in db.PLANE_PAYLOAD_OVERRIDES[unit_type]: group.load_loadout(db.PLANE_PAYLOAD_OVERRIDES[unit_type]["*"]) did_load_loadout = True diff --git a/theater/base.py b/theater/base.py index e38448d6..4997728a 100644 --- a/theater/base.py +++ b/theater/base.py @@ -12,7 +12,7 @@ from dcs.task import * STRENGTH_AA_ASSEMBLE_MIN = 0.2 PLANES_SCRAMBLE_MIN_BASE = 4 PLANES_SCRAMBLE_MAX_BASE = 8 -PLANES_SCRAMBLE_FACTOR = 0.5 +PLANES_SCRAMBLE_FACTOR = 0.6 class Base: @@ -141,7 +141,7 @@ class Base: self.strength = 0.001 def scramble_count(self, multiplier: float) -> int: - count = int(self.total_planes * PLANES_SCRAMBLE_FACTOR * self.strength) + count = int(math.ceil(self.total_planes * PLANES_SCRAMBLE_FACTOR * self.strength)) return min(min(max(count, PLANES_SCRAMBLE_MIN_BASE), int(PLANES_SCRAMBLE_MAX_BASE * multiplier)), self.total_planes) def assemble_count(self): diff --git a/ui/basemenu.py b/ui/basemenu.py index 1a3684fa..4c6b6d37 100644 --- a/ui/basemenu.py +++ b/ui/basemenu.py @@ -4,6 +4,9 @@ from game.game import * class BaseMenu(Menu): + bought_amount_labels = None # type: typing.Collection[Label] + budget_label = None # type: Label + def __init__(self, window: Window, parent, game: Game, cp: ControlPoint): super(BaseMenu, self).__init__(window, parent, game) @@ -11,6 +14,7 @@ class BaseMenu(Menu): self.base = cp.base self.frame = window.right_pane self.event = self.game.units_delivery_event(cp) + self.bought_amount_labels = {} def display(self): self.window.clear_right_pane() @@ -23,8 +27,10 @@ class BaseMenu(Menu): scheduled_units = self.event.units.get(unit_type, 0) Label(self.frame, text="{}".format(db.unit_type_name(unit_type))).grid(row=row, sticky=W) - Label(self.frame, text="({})".format(existing_units)).grid(column=1, row=row) - Label(self.frame, text="{}m {}".format(unit_price, scheduled_units and "(bought {})".format(scheduled_units) or "")).grid(column=2, row=row) + label = Label(self.frame, text="({})".format(existing_units)) + self.bought_amount_labels[unit_type] = label + label.grid(column=1, row=row) + Label(self.frame, text="{}m".format(unit_price)).grid(column=2, row=row) Button(self.frame, text="+", command=self.buy(unit_type)).grid(column=3, row=row) Button(self.frame, text="-", command=self.sell(unit_type)).grid(column=4, row=row) row += 1 @@ -37,7 +43,8 @@ class BaseMenu(Menu): AirDefence: db.find_unittype(AirDefence, self.game.player), } - Label(self.frame, text="Budget: {}m".format(self.game.budget)).grid(row=row, sticky=W) + self.budget_label = Label(self.frame, text="Budget: {}m".format(self.game.budget)) + self.budget_label.grid(row=row, sticky=W) Button(self.frame, text="Back", command=self.dismiss).grid(column=4, row=row) row += 1 @@ -61,8 +68,9 @@ class BaseMenu(Menu): if self.game.budget >= price: self.event.deliver({unit_type: 1}) self.game.budget -= price - - #self.display() + label = self.bought_amount_labels[unit_type] # type: Label + label["text"] = "({}, bought {})".format(self.cp.base.total_units_of_type(unit_type), self.event.units[unit_type]) + self.budget_label["text"] = "Budget: {}m".format(self.game.budget) return action @@ -76,6 +84,9 @@ class BaseMenu(Menu): price = db.PRICES[unit_type] self.game.budget += price self.base.commit_losses({unit_type: 1}) - #self.display() + + label = self.bought_amount_labels[unit_type] # type: Label + label["text"] = "({}, bought {})".format(self.cp.base.total_units_of_type(unit_type), self.event.units[unit_type]) + self.budget_label["text"] = "Budget: {}m".format(self.game.budget) return action \ No newline at end of file