mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Adjust income based on control point type.
* Navies and off map spawns generate no income * FOBs generate 10 instead of 20 Fixes https://github.com/Khopa/dcs_liberation/issues/662
This commit is contained in:
parent
e861e5b3d6
commit
d634fd3236
@ -13,6 +13,8 @@ Saves from 2.3 are not compatible with 2.4.
|
|||||||
* **[Mission Generator]** Multiple groups are created for complex SAM sites (SAMs with additional point defense or SHORADS), improving Skynet behavior.
|
* **[Mission Generator]** Multiple groups are created for complex SAM sites (SAMs with additional point defense or SHORADS), improving Skynet behavior.
|
||||||
* **[Skynet]** Point defenses are now configured to remain on to protect the site they accompany.
|
* **[Skynet]** Point defenses are now configured to remain on to protect the site they accompany.
|
||||||
* **[Balance]** Opfor now gains income using the same rules as the player, significantly increasing their income relative to the player for most campaigns.
|
* **[Balance]** Opfor now gains income using the same rules as the player, significantly increasing their income relative to the player for most campaigns.
|
||||||
|
* **[Economy]** FOBs generate only $10M per turn (previously $20M like airbases).
|
||||||
|
* **[Economy]** Carriers and off-map spawns generate no income (previously $20M like airbases).
|
||||||
|
|
||||||
# 2.3.3
|
# 2.3.3
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,6 @@ from dataclasses import dataclass
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from game.db import REWARDS
|
from game.db import REWARDS
|
||||||
from game.theater import ControlPoint
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from game import Game
|
from game import Game
|
||||||
@ -22,12 +21,6 @@ class BuildingIncome:
|
|||||||
return self.number * self.income_per_building
|
return self.number * self.income_per_building
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
class ControlPointIncome:
|
|
||||||
control_point: ControlPoint
|
|
||||||
income: int
|
|
||||||
|
|
||||||
|
|
||||||
class Income:
|
class Income:
|
||||||
def __init__(self, game: Game, player: bool) -> None:
|
def __init__(self, game: Game, player: bool) -> None:
|
||||||
if player:
|
if player:
|
||||||
@ -37,12 +30,10 @@ class Income:
|
|||||||
self.control_points = []
|
self.control_points = []
|
||||||
self.buildings = []
|
self.buildings = []
|
||||||
|
|
||||||
self.income_per_base = 20
|
|
||||||
|
|
||||||
names = set()
|
names = set()
|
||||||
for cp in game.theater.control_points_for(player):
|
for cp in game.theater.control_points_for(player):
|
||||||
self.control_points.append(
|
if cp.income_per_turn:
|
||||||
ControlPointIncome(cp, self.income_per_base))
|
self.control_points.append(cp)
|
||||||
for tgo in cp.ground_objects:
|
for tgo in cp.ground_objects:
|
||||||
names.add(tgo.obj_name)
|
names.add(tgo.obj_name)
|
||||||
|
|
||||||
@ -58,7 +49,7 @@ class Income:
|
|||||||
self.buildings.append(BuildingIncome(name, category, count,
|
self.buildings.append(BuildingIncome(name, category, count,
|
||||||
REWARDS[category]))
|
REWARDS[category]))
|
||||||
|
|
||||||
self.from_bases = sum(cp.income for cp in self.control_points)
|
self.from_bases = sum(cp.income_per_turn for cp in self.control_points)
|
||||||
self.total_buildings = sum(b.income for b in self.buildings)
|
self.total_buildings = sum(b.income for b in self.buildings)
|
||||||
self.total = ((self.total_buildings + self.from_bases) *
|
self.total = ((self.total_buildings + self.from_bases) *
|
||||||
self.multiplier)
|
self.multiplier)
|
||||||
|
|||||||
@ -478,6 +478,10 @@ class ControlPoint(MissionTarget, ABC):
|
|||||||
else:
|
else:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@property
|
||||||
|
def income_per_turn(self) -> int:
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
class Airfield(ControlPoint):
|
class Airfield(ControlPoint):
|
||||||
|
|
||||||
@ -542,6 +546,10 @@ class Airfield(ControlPoint):
|
|||||||
def can_deploy_ground_units(self) -> bool:
|
def can_deploy_ground_units(self) -> bool:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@property
|
||||||
|
def income_per_turn(self) -> int:
|
||||||
|
return 20
|
||||||
|
|
||||||
|
|
||||||
class NavalControlPoint(ControlPoint, ABC):
|
class NavalControlPoint(ControlPoint, ABC):
|
||||||
|
|
||||||
@ -741,3 +749,7 @@ class Fob(ControlPoint):
|
|||||||
@property
|
@property
|
||||||
def can_deploy_ground_units(self) -> bool:
|
def can_deploy_ground_units(self) -> bool:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@property
|
||||||
|
def income_per_turn(self) -> int:
|
||||||
|
return 10
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
|
import itertools
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
from PySide2.QtWidgets import (
|
from PySide2.QtWidgets import (
|
||||||
QDialog,
|
QDialog,
|
||||||
QFrame,
|
QFrame,
|
||||||
@ -8,7 +11,8 @@ from PySide2.QtWidgets import (
|
|||||||
|
|
||||||
import qt_ui.uiconstants as CONST
|
import qt_ui.uiconstants as CONST
|
||||||
from game.game import Game
|
from game.game import Game
|
||||||
from game.income import Income
|
from game.income import BuildingIncome, Income
|
||||||
|
from game.theater import ControlPoint
|
||||||
|
|
||||||
|
|
||||||
class QHorizontalSeparationLine(QFrame):
|
class QHorizontalSeparationLine(QFrame):
|
||||||
@ -25,44 +29,65 @@ class QHorizontalSeparationLine(QFrame):
|
|||||||
class FinancesLayout(QGridLayout):
|
class FinancesLayout(QGridLayout):
|
||||||
def __init__(self, game: Game, player: bool) -> None:
|
def __init__(self, game: Game, player: bool) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
self.row = itertools.count(0)
|
||||||
|
|
||||||
income = Income(game, player)
|
income = Income(game, player)
|
||||||
|
|
||||||
self.addWidget(QLabel("<b>Control Points</b>"), 0, 0)
|
control_points = reversed(
|
||||||
self.addWidget(QLabel(
|
sorted(income.control_points, key=lambda c: c.income_per_turn))
|
||||||
f"{len(income.control_points)} bases x {income.income_per_base}M"),
|
for control_point in control_points:
|
||||||
0, 1)
|
self.add_control_point(control_point)
|
||||||
self.addWidget(QLabel(f"{income.from_bases}M"), 0, 2)
|
|
||||||
|
|
||||||
self.addWidget(QHorizontalSeparationLine(), 1, 0, 1, 3)
|
self.add_line()
|
||||||
|
|
||||||
buildings = reversed(sorted(income.buildings, key=lambda b: b.income))
|
buildings = reversed(sorted(income.buildings, key=lambda b: b.income))
|
||||||
row = 2
|
for building in buildings:
|
||||||
for row, building in enumerate(buildings, row):
|
self.add_building(building)
|
||||||
self.addWidget(
|
|
||||||
QLabel(f"<b>{building.category.upper()} [{building.name}]</b>"),
|
|
||||||
row, 0)
|
|
||||||
self.addWidget(QLabel(
|
|
||||||
f"{building.number} buildings x {building.income_per_building}M"),
|
|
||||||
row, 1)
|
|
||||||
rlabel = QLabel(f"{building.income}M")
|
|
||||||
rlabel.setProperty("style", "green")
|
|
||||||
self.addWidget(rlabel, row, 2)
|
|
||||||
|
|
||||||
self.addWidget(QHorizontalSeparationLine(), row + 1, 0, 1, 3)
|
self.add_line()
|
||||||
self.addWidget(QLabel(
|
|
||||||
f"Income multiplier: {income.multiplier:.1f}"),
|
self.add_row(middle=f"Income multiplier: {income.multiplier:.1f}",
|
||||||
row + 2, 1
|
right=f"<b>{income.total}M</b>")
|
||||||
)
|
|
||||||
self.addWidget(QLabel(f"<b>{income.total}M</b>"), row + 2, 2)
|
|
||||||
|
|
||||||
if player:
|
if player:
|
||||||
budget = game.budget
|
budget = game.budget
|
||||||
else:
|
else:
|
||||||
budget = game.enemy_budget
|
budget = game.enemy_budget
|
||||||
self.addWidget(QLabel(f"Balance"), row + 3, 1)
|
|
||||||
self.addWidget(QLabel(f"<b>{budget}M</b>"), row + 3, 2)
|
self.add_row(middle="Balance", right=f"<b>{budget}M</b>")
|
||||||
self.setRowStretch(row + 4, 1)
|
self.setRowStretch(next(self.row), 1)
|
||||||
|
|
||||||
|
def add_row(self, left: Optional[str] = None, middle: Optional[str] = None,
|
||||||
|
right: Optional[str] = None) -> None:
|
||||||
|
if not any([left, middle, right]):
|
||||||
|
raise ValueError
|
||||||
|
|
||||||
|
row = next(self.row)
|
||||||
|
if left is not None:
|
||||||
|
self.addWidget(QLabel(left), row, 0)
|
||||||
|
if middle is not None:
|
||||||
|
self.addWidget(QLabel(middle), row, 1)
|
||||||
|
if right is not None:
|
||||||
|
self.addWidget(QLabel(right), row, 2)
|
||||||
|
|
||||||
|
def add_control_point(self, control_point: ControlPoint) -> None:
|
||||||
|
self.add_row(left=f"<b>{control_point.name}</b>",
|
||||||
|
right=f"{control_point.income_per_turn}M")
|
||||||
|
|
||||||
|
def add_building(self, building: BuildingIncome) -> None:
|
||||||
|
row = next(self.row)
|
||||||
|
self.addWidget(
|
||||||
|
QLabel(f"<b>{building.category.upper()} [{building.name}]</b>"),
|
||||||
|
row, 0)
|
||||||
|
self.addWidget(QLabel(
|
||||||
|
f"{building.number} buildings x {building.income_per_building}M"),
|
||||||
|
row, 1)
|
||||||
|
rlabel = QLabel(f"{building.income}M")
|
||||||
|
rlabel.setProperty("style", "green")
|
||||||
|
self.addWidget(rlabel, row, 2)
|
||||||
|
|
||||||
|
def add_line(self) -> None:
|
||||||
|
self.addWidget(QHorizontalSeparationLine(), next(self.row), 0, 1, 3)
|
||||||
|
|
||||||
|
|
||||||
class QFinancesMenu(QDialog):
|
class QFinancesMenu(QDialog):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user