base menu updated; balance tweaks

This commit is contained in:
Vasyl Horbachenko 2018-06-26 04:14:53 +03:00
parent c329c806df
commit a251ad5965
4 changed files with 19 additions and 12 deletions

View File

@ -258,7 +258,6 @@ PLANE_PAYLOAD_OVERRIDES = {
Su_33: { Su_33: {
"*": "R-73*4,R-27R*2,R-27ER*6", "*": "R-73*4,R-27R*2,R-27ER*6",
"_carrier": "R-73*4",
}, },
AV8BNA: { AV8BNA: {

View File

@ -66,9 +66,6 @@ class AircraftConflictGenerator:
if for_task in db.PLANE_PAYLOAD_OVERRIDES[unit_type]: if for_task in db.PLANE_PAYLOAD_OVERRIDES[unit_type]:
group.load_loadout(db.PLANE_PAYLOAD_OVERRIDES[unit_type][for_task]) group.load_loadout(db.PLANE_PAYLOAD_OVERRIDES[unit_type][for_task])
did_load_loadout = True 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]: elif "*" in db.PLANE_PAYLOAD_OVERRIDES[unit_type]:
group.load_loadout(db.PLANE_PAYLOAD_OVERRIDES[unit_type]["*"]) group.load_loadout(db.PLANE_PAYLOAD_OVERRIDES[unit_type]["*"])
did_load_loadout = True did_load_loadout = True

View File

@ -12,7 +12,7 @@ from dcs.task import *
STRENGTH_AA_ASSEMBLE_MIN = 0.2 STRENGTH_AA_ASSEMBLE_MIN = 0.2
PLANES_SCRAMBLE_MIN_BASE = 4 PLANES_SCRAMBLE_MIN_BASE = 4
PLANES_SCRAMBLE_MAX_BASE = 8 PLANES_SCRAMBLE_MAX_BASE = 8
PLANES_SCRAMBLE_FACTOR = 0.5 PLANES_SCRAMBLE_FACTOR = 0.6
class Base: class Base:
@ -141,7 +141,7 @@ class Base:
self.strength = 0.001 self.strength = 0.001
def scramble_count(self, multiplier: float) -> int: 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) return min(min(max(count, PLANES_SCRAMBLE_MIN_BASE), int(PLANES_SCRAMBLE_MAX_BASE * multiplier)), self.total_planes)
def assemble_count(self): def assemble_count(self):

View File

@ -4,6 +4,9 @@ from game.game import *
class BaseMenu(Menu): 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): def __init__(self, window: Window, parent, game: Game, cp: ControlPoint):
super(BaseMenu, self).__init__(window, parent, game) super(BaseMenu, self).__init__(window, parent, game)
@ -11,6 +14,7 @@ class BaseMenu(Menu):
self.base = cp.base self.base = cp.base
self.frame = window.right_pane self.frame = window.right_pane
self.event = self.game.units_delivery_event(cp) self.event = self.game.units_delivery_event(cp)
self.bought_amount_labels = {}
def display(self): def display(self):
self.window.clear_right_pane() self.window.clear_right_pane()
@ -23,8 +27,10 @@ class BaseMenu(Menu):
scheduled_units = self.event.units.get(unit_type, 0) 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(db.unit_type_name(unit_type))).grid(row=row, sticky=W)
Label(self.frame, text="({})".format(existing_units)).grid(column=1, row=row) label = Label(self.frame, text="({})".format(existing_units))
Label(self.frame, text="{}m {}".format(unit_price, scheduled_units and "(bought {})".format(scheduled_units) or "")).grid(column=2, row=row) 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.buy(unit_type)).grid(column=3, row=row)
Button(self.frame, text="-", command=self.sell(unit_type)).grid(column=4, row=row) Button(self.frame, text="-", command=self.sell(unit_type)).grid(column=4, row=row)
row += 1 row += 1
@ -37,7 +43,8 @@ class BaseMenu(Menu):
AirDefence: db.find_unittype(AirDefence, self.game.player), 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) Button(self.frame, text="Back", command=self.dismiss).grid(column=4, row=row)
row += 1 row += 1
@ -61,8 +68,9 @@ class BaseMenu(Menu):
if self.game.budget >= price: if self.game.budget >= price:
self.event.deliver({unit_type: 1}) self.event.deliver({unit_type: 1})
self.game.budget -= price self.game.budget -= price
label = self.bought_amount_labels[unit_type] # type: Label
#self.display() 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 return action
@ -76,6 +84,9 @@ class BaseMenu(Menu):
price = db.PRICES[unit_type] price = db.PRICES[unit_type]
self.game.budget += price self.game.budget += price
self.base.commit_losses({unit_type: 1}) 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 return action