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:
@@ -4,7 +4,6 @@ from dataclasses import dataclass
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from game.db import REWARDS
|
||||
from game.theater import ControlPoint
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from game import Game
|
||||
@@ -22,12 +21,6 @@ class BuildingIncome:
|
||||
return self.number * self.income_per_building
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ControlPointIncome:
|
||||
control_point: ControlPoint
|
||||
income: int
|
||||
|
||||
|
||||
class Income:
|
||||
def __init__(self, game: Game, player: bool) -> None:
|
||||
if player:
|
||||
@@ -37,12 +30,10 @@ class Income:
|
||||
self.control_points = []
|
||||
self.buildings = []
|
||||
|
||||
self.income_per_base = 20
|
||||
|
||||
names = set()
|
||||
for cp in game.theater.control_points_for(player):
|
||||
self.control_points.append(
|
||||
ControlPointIncome(cp, self.income_per_base))
|
||||
if cp.income_per_turn:
|
||||
self.control_points.append(cp)
|
||||
for tgo in cp.ground_objects:
|
||||
names.add(tgo.obj_name)
|
||||
|
||||
@@ -58,7 +49,7 @@ class Income:
|
||||
self.buildings.append(BuildingIncome(name, category, count,
|
||||
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 = ((self.total_buildings + self.from_bases) *
|
||||
self.multiplier)
|
||||
|
||||
@@ -478,6 +478,10 @@ class ControlPoint(MissionTarget, ABC):
|
||||
else:
|
||||
return 0
|
||||
|
||||
@property
|
||||
def income_per_turn(self) -> int:
|
||||
return 0
|
||||
|
||||
|
||||
class Airfield(ControlPoint):
|
||||
|
||||
@@ -542,6 +546,10 @@ class Airfield(ControlPoint):
|
||||
def can_deploy_ground_units(self) -> bool:
|
||||
return True
|
||||
|
||||
@property
|
||||
def income_per_turn(self) -> int:
|
||||
return 20
|
||||
|
||||
|
||||
class NavalControlPoint(ControlPoint, ABC):
|
||||
|
||||
@@ -741,3 +749,7 @@ class Fob(ControlPoint):
|
||||
@property
|
||||
def can_deploy_ground_units(self) -> bool:
|
||||
return True
|
||||
|
||||
@property
|
||||
def income_per_turn(self) -> int:
|
||||
return 10
|
||||
|
||||
Reference in New Issue
Block a user