This commit is contained in:
2026-02-11 17:44:26 +03:00
parent baeaea69f8
commit 1388a5fd6b
17 changed files with 2188 additions and 177 deletions

View File

@@ -0,0 +1,11 @@
from game_balance.test_balance.easy_mode import EasyBalance
from game_balance.test_balance.hard_mode import HardBalance
from game_balance.test_balance.tournament import TournamentBalance
from game_balance.test_balance.standard_mode import StandardBalance
__all__ = [
'EasyBalance',
'HardBalance',
'TournamentBalance',
'StandardBalance'
]

View File

@@ -0,0 +1,73 @@
"""
ЛЕГКИЙ РЕЖИМ БАЛАНСА
Для новичков
"""
from game_balance.test_balance.standard_mode import StandardBalance
class EasyBalance(StandardBalance):
"""Облегченный режим"""
@classmethod
def get_assets_config(cls):
config = super().get_assets_config()
# Делаем активы дешевле и стабильнее
for asset_id, asset_data in config.items():
if asset_data.get('base_price'):
asset_data['base_price'] *= 0.5
if asset_data.get('volatility'):
asset_data['volatility'] *= 0.7
if asset_data.get('income_per_month'):
asset_data['income_per_month'] *= 1.3
return config
@classmethod
def get_players_config(cls):
config = super().get_players_config()
config['STARTING_CAPITAL'] = 200000
config['TARGET_CAPITAL'] = 25000000
# Более мягкие ограничения
config['MAX_ASSETS_PER_TYPE'] = {
'bonds': None,
'stocks': 0.6,
'real_estate': 0.7,
'crypto': None,
'commodities': 0.5,
'business': 0.6,
'unique': 1.0,
}
# Быстрое снятие лимитов
config['PURCHASE_LIMITS_BY_MONTH'] = {
1: 0.3,
2: 0.6,
3: 1.0,
}
return config
@classmethod
def get_economy_config(cls):
config = super().get_economy_config()
# Меньше налогов
config['TAX_SYSTEM']['income_tax'] = [
{'threshold': 0, 'rate': 0.00},
{'threshold': 100000, 'rate': 0.05},
{'threshold': 500000, 'rate': 0.10},
{'threshold': 2000000, 'rate': 0.15},
{'threshold': 5000000, 'rate': 0.20},
]
config['TAX_SYSTEM']['wealth_tax']['threshold'] = 10000000
# Ниже ставки по кредитам
config['LOAN_SYSTEM']['interest_rates']['standard'] = 0.03
# Меньше инфляции
config['MACROECONOMICS']['base_inflation'] = 0.002
return config

View File

@@ -0,0 +1,73 @@
"""
ЛЕГКИЙ РЕЖИМ БАЛАНСА
Для новичков
"""
from game_balance.test_balance.standard_mode import StandardBalance
class HardBalance(StandardBalance):
"""Облегченный режим"""
@classmethod
def get_assets_config(cls):
config = super().get_assets_config()
# Делаем активы дешевле и стабильнее
for asset_id, asset_data in config.items():
if asset_data.get('base_price'):
asset_data['base_price'] *= 0.5
if asset_data.get('volatility'):
asset_data['volatility'] *= 0.7
if asset_data.get('income_per_month'):
asset_data['income_per_month'] *= 1.3
return config
@classmethod
def get_players_config(cls):
config = super().get_players_config()
config['STARTING_CAPITAL'] = 200000
config['TARGET_CAPITAL'] = 25000000
# Более мягкие ограничения
config['MAX_ASSETS_PER_TYPE'] = {
'bonds': None,
'stocks': 0.6,
'real_estate': 0.7,
'crypto': None,
'commodities': 0.5,
'business': 0.6,
'unique': 1.0,
}
# Быстрое снятие лимитов
config['PURCHASE_LIMITS_BY_MONTH'] = {
1: 0.3,
2: 0.6,
3: 1.0,
}
return config
@classmethod
def get_economy_config(cls):
config = super().get_economy_config()
# Меньше налогов
config['TAX_SYSTEM']['income_tax'] = [
{'threshold': 0, 'rate': 0.00},
{'threshold': 100000, 'rate': 0.05},
{'threshold': 500000, 'rate': 0.10},
{'threshold': 2000000, 'rate': 0.15},
{'threshold': 5000000, 'rate': 0.20},
]
config['TAX_SYSTEM']['wealth_tax']['threshold'] = 10000000
# Ниже ставки по кредитам
config['LOAN_SYSTEM']['interest_rates']['standard'] = 0.03
# Меньше инфляции
config['MACROECONOMICS']['base_inflation'] = 0.002
return config

View File

@@ -0,0 +1,61 @@
"""
СТАНДАРТНЫЙ РЕЖИМ БАЛАНСА
Используется по умолчанию
"""
from game_balance.assets_config import AssetsConfig
from game_balance.players_config import PlayersConfig
from game_balance.economy_config import EconomyConfig
from game_balance.events_config import EventsConfig
from game_balance.game_config import GameConfig
class StandardBalance:
"""Стандартный сбалансированный режим"""
@classmethod
def get_assets_config(cls):
"""Возвращает конфигурацию активов"""
return AssetsConfig.ASSETS.copy()
@classmethod
def get_players_config(cls):
"""Возвращает конфигурацию игроков"""
return {
'STARTING_CAPITAL': PlayersConfig.STARTING_CAPITAL,
'TARGET_CAPITAL': PlayersConfig.TARGET_CAPITAL,
'MAX_ASSETS_PER_TYPE': PlayersConfig.MAX_ASSETS_PER_TYPE.copy(),
'PURCHASE_LIMITS_BY_MONTH': PlayersConfig.PURCHASE_LIMITS_BY_MONTH.copy(),
'ABILITIES': PlayersConfig.ABILITIES.copy()
}
@classmethod
def get_economy_config(cls):
"""Возвращает экономическую конфигурацию"""
return {
'TAX_SYSTEM': EconomyConfig.TAX_SYSTEM.copy(),
'LOAN_SYSTEM': EconomyConfig.LOAN_SYSTEM.copy(),
'MACROECONOMICS': EconomyConfig.MACROECONOMICS.copy(),
'ASSET_CORRELATIONS': EconomyConfig.ASSET_CORRELATIONS.copy()
}
@classmethod
def get_events_config(cls):
"""Возвращает конфигурацию событий"""
return {
'EVENT_TYPES': EventsConfig.EVENT_TYPES.copy(),
'EVENTS': EventsConfig.EVENTS.copy(),
'CRISES': EventsConfig.CRISES.copy()
}
@classmethod
def get_game_config(cls):
"""Возвращает игровую конфигурацию"""
return {
'PHASE_DURATIONS': GameConfig.PHASE_DURATIONS.copy(),
'SPEED_MODES': GameConfig.SPEED_MODES.copy(),
'MAX_PLAYERS_PER_ROOM': GameConfig.MAX_PLAYERS_PER_ROOM,
'MIN_PLAYERS_TO_START': GameConfig.MIN_PLAYERS_TO_START,
'MIN_PLAYERS_TO_CONTINUE': GameConfig.MIN_PLAYERS_TO_CONTINUE,
'MAX_TRANSACTIONS_PER_PHASE': GameConfig.MAX_TRANSACTIONS_PER_PHASE,
'MIN_BID_AMOUNT': GameConfig.MIN_BID_AMOUNT
}

View File

@@ -0,0 +1,83 @@
"""
ТУРНИРНЫЙ РЕЖИМ БАЛАНСА
Для соревнований
"""
from game_balance.test_balance.standard_mode import StandardBalance
class TournamentBalance(StandardBalance):
"""Турнирный режим"""
@classmethod
def get_assets_config(cls):
config = super().get_assets_config()
# Балансировка цен
price_adjustments = {
'gov_bonds': 1.0,
'stock_gazprom': 0.8,
'stock_sberbank': 0.8,
'apartment_small': 0.7,
'apartment_elite': 0.6,
'bitcoin': 1.2,
'oil': 1.0,
'coffee_shop': 0.8,
'it_startup': 1.0,
'shopping_mall': 0.5,
'oil_field': 0.4,
}
for asset_id, multiplier in price_adjustments.items():
if asset_id in config and config[asset_id].get('base_price'):
config[asset_id]['base_price'] *= multiplier
return config
@classmethod
def get_players_config(cls):
config = super().get_players_config()
config['STARTING_CAPITAL'] = 500000
config['TARGET_CAPITAL'] = 100000000
# Жесткие ограничения против монополий
config['MAX_ASSETS_PER_TYPE'] = {
'bonds': 0.5,
'stocks': 0.3,
'real_estate': 0.4,
'crypto': 0.5,
'commodities': 0.3,
'business': 0.4,
'unique': 0.5,
}
# Быстрый старт
config['PURCHASE_LIMITS_BY_MONTH'] = {
1: 0.5,
2: 1.0,
}
return config
@classmethod
def get_economy_config(cls):
config = super().get_economy_config()
# Высокие налоги
config['TAX_SYSTEM']['income_tax'] = [
{'threshold': 0, 'rate': 0.00},
{'threshold': 100000, 'rate': 0.15},
{'threshold': 500000, 'rate': 0.25},
{'threshold': 2000000, 'rate': 0.35},
{'threshold': 5000000, 'rate': 0.45},
]
config['TAX_SYSTEM']['wealth_tax']['rate'] = 0.02
config['TAX_SYSTEM']['transaction_fee'] = 0.02
# Высокие ставки
config['LOAN_SYSTEM']['interest_rates']['standard'] = 0.08
# Высокая инфляция
config['MACROECONOMICS']['base_inflation'] = 0.01
return config