| | """
|
| | کلاس اصلی بازی که سیستمهای مختلف را مدیریت میکند
|
| | """
|
| |
|
| | import time
|
| | from game_state import GameState
|
| | from calendar.calendar_system import CalendarSystem
|
| | from climate.climate_system import ClimateSystem
|
| | from demographics.population_system import PopulationSystem
|
| | from technology.research_system import ResearchSystem
|
| | from religion.religious_system import ReligiousSystem
|
| | from espionage.espionage_system import EspionageSystem
|
| | from cities.city_management import CityManagement
|
| | from warfare.warfare_system import WarfareSystem
|
| | from trade.trade_system import TradeSystem
|
| | from politics.domestic_policy import DomesticPolicy
|
| | from society.happiness_system import HappinessSystem
|
| | from culture.cultural_system import CulturalSystem
|
| | from diplomacy.diplomacy_system import DiplomacySystem
|
| | from economy.macro_economy import MacroEconomy
|
| | from military.army_management import ArmyManagement
|
| | from health.healthcare_system import HealthcareSystem
|
| | from education.education_system import EducationSystem
|
| | from environment.environmental_system import EnvironmentalSystem
|
| | from crisis.crisis_management import CrisisManagement
|
| | from succession.succession_system import SuccessionSystem
|
| | from achievements.achievements_system import AchievementsSystem
|
| | from ui.console_ui import ConsoleUI
|
| | from utils.save_load import SaveLoadManager
|
| | from config import GAME_CONFIG, UI_CONFIG, ADVANCED_CONFIG
|
| |
|
| | class EmpireGame:
|
| | """کلاس اصلی بازی سایههای امپراتوری"""
|
| |
|
| | def __init__(self):
|
| | """ساخت یک نمونه جدید از بازی"""
|
| | self.game_state = GameState()
|
| | self.calendar = CalendarSystem(self.game_state)
|
| | self.climate = ClimateSystem(self.game_state)
|
| | self.population = PopulationSystem(self.game_state)
|
| | self.technology = ResearchSystem(self.game_state)
|
| | self.religion = ReligiousSystem(self.game_state)
|
| | self.espionage = EspionageSystem(self.game_state)
|
| | self.cities = CityManagement(self.game_state)
|
| | self.warfare = WarfareSystem(self.game_state)
|
| | self.trade = TradeSystem(self.game_state)
|
| | self.politics = DomesticPolicy(self.game_state)
|
| | self.society = HappinessSystem(self.game_state)
|
| | self.culture = CulturalSystem(self.game_state)
|
| | self.diplomacy = DiplomacySystem(self.game_state)
|
| | self.economy = MacroEconomy(self.game_state)
|
| | self.military = ArmyManagement(self.game_state)
|
| | self.health = HealthcareSystem(self.game_state)
|
| | self.education = EducationSystem(self.game_state)
|
| | self.environment = EnvironmentalSystem(self.game_state)
|
| | self.crisis = CrisisManagement(self.game_state)
|
| | self.succession = SuccessionSystem(self.game_state)
|
| | self.achievements = AchievementsSystem(self.game_state)
|
| | self.save_manager = SaveLoadManager()
|
| | self.running = False
|
| | self.plugins = []
|
| | self.difficulty = "normal"
|
| | self.undo_stack = []
|
| | self.redo_stack = []
|
| |
|
| | def start(self):
|
| | """شروع بازی و ورود به حلقه اصلی"""
|
| | self.running = True
|
| | ConsoleUI.clear_screen()
|
| |
|
| |
|
| | ConsoleUI.display_intro()
|
| |
|
| |
|
| | self.select_difficulty()
|
| |
|
| |
|
| | self.game_state.select_country()
|
| |
|
| |
|
| | self.initialize_game_systems()
|
| |
|
| |
|
| | self.show_tutorial()
|
| |
|
| |
|
| | self.game_loop()
|
| |
|
| | def select_difficulty(self):
|
| | """انتخاب سطح دشواری بازی"""
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_section_title("انتخاب سطح دشواری")
|
| |
|
| | difficulties = ["آسان", "معمولی", "سخت"]
|
| | choice = ConsoleUI.get_menu_choice(difficulties)
|
| |
|
| | if choice == 1:
|
| | self.difficulty = "easy"
|
| | elif choice == 2:
|
| | self.difficulty = "normal"
|
| | else:
|
| | self.difficulty = "hard"
|
| |
|
| |
|
| | self.game_state.difficulty = self.difficulty
|
| | self.game_state.difficulty_factors = GAME_CONFIG["difficulty_levels"][self.difficulty]
|
| |
|
| | ConsoleUI.display_success(f"سطح دشواری '{difficulties[choice-1]}' انتخاب شد.")
|
| | time.sleep(1)
|
| |
|
| | def initialize_game_systems(self):
|
| | """راهاندازی اولیه سیستمهای بازی"""
|
| |
|
| | self.calendar.initialize()
|
| | self.climate.initialize()
|
| | self.population.initialize()
|
| | self.technology.initialize()
|
| | self.religion.initialize()
|
| | self.espionage.initialize()
|
| | self.cities.initialize()
|
| | self.warfare.initialize()
|
| | self.trade.initialize()
|
| | self.politics.initialize()
|
| | self.society.initialize()
|
| | self.culture.initialize()
|
| | self.diplomacy.initialize()
|
| | self.economy.initialize()
|
| | self.military.initialize()
|
| | self.health.initialize()
|
| | self.education.initialize()
|
| | self.environment.initialize()
|
| | self.crisis.initialize()
|
| | self.succession.initialize()
|
| | self.achievements.initialize()
|
| |
|
| |
|
| | ConsoleUI.display_country_info(self.game_state.player_country)
|
| |
|
| | def game_loop(self):
|
| | """حلقه اصلی بازی"""
|
| | while self.running:
|
| | try:
|
| | ConsoleUI.clear_screen()
|
| |
|
| |
|
| | ConsoleUI.display_game_status(self.game_state)
|
| |
|
| |
|
| | if self.check_victory_conditions():
|
| | break
|
| |
|
| |
|
| | self.process_yearly_events()
|
| |
|
| |
|
| | self.process_player_actions()
|
| |
|
| |
|
| | self.annual_updates()
|
| |
|
| |
|
| | self.game_state.current_year += 1
|
| |
|
| |
|
| | if self.game_state.current_year % GAME_CONFIG["auto_save_interval"] == 0:
|
| | self.save_manager.auto_save(self.game_state)
|
| |
|
| | except KeyboardInterrupt:
|
| |
|
| | if ConsoleUI.confirm_action("آیا میخواهید بازی را ذخیره و خارج شوید؟"):
|
| | self.save_manager.save_game(self.game_state)
|
| | ConsoleUI.display_message("بازی ذخیره شد. خداحافظ!")
|
| | break
|
| | else:
|
| | ConsoleUI.display_warning("ادامه بازی...")
|
| | except Exception as e:
|
| | ConsoleUI.display_error(f"خطای غیرمنتظره: {str(e)}")
|
| | if ConsoleUI.confirm_action("آیا میخواهید بازی را ذخیره و خارج شوید؟"):
|
| | self.save_manager.save_game(self.game_state)
|
| | break
|
| |
|
| | def process_yearly_events(self):
|
| | """پردازش رویدادهای سالانه"""
|
| |
|
| | if self.game_state.random.random() < GAME_CONFIG["event_probability"]["common"]:
|
| | event = self.calendar.select_random_event()
|
| | if event:
|
| | ConsoleUI.display_event(event)
|
| | choice = ConsoleUI.get_player_choice(event["choices"])
|
| | self.calendar.apply_event_choice(event, choice)
|
| |
|
| |
|
| | if self.game_state.random.random() < GAME_CONFIG["event_probability"]["rare"]:
|
| | event = self.climate.select_weather_event()
|
| | if event:
|
| | ConsoleUI.display_weather_event(event)
|
| | choice = ConsoleUI.get_player_choice(event["choices"])
|
| | self.climate.apply_weather_event_choice(event, choice)
|
| |
|
| |
|
| | if self.game_state.random.random() < GAME_CONFIG["event_probability"]["historical"]:
|
| | event = self.calendar.select_historical_event()
|
| | if event:
|
| | ConsoleUI.display_historical_event(event)
|
| | choice = ConsoleUI.get_player_choice(event["choices"])
|
| | self.calendar.apply_historical_event_choice(event, choice)
|
| |
|
| | def process_player_actions(self):
|
| | """پردازش اقدامات بازیکن"""
|
| | main_actions = [
|
| | "مشاهده وضعیت کشور",
|
| | "مدیریت اقتصاد",
|
| | "دیپلماسی و روابط خارجی",
|
| | "مدیریت نظامی",
|
| | "سیاست داخلی",
|
| | "مدیریت شهرها",
|
| | "سیستم فناوری",
|
| | "سیستم فرهنگی",
|
| | "سیستم دینی",
|
| | "سیستم جمعیت",
|
| | "ذخیره بازی",
|
| | "بازیابی آخرین اقدام (Undo)",
|
| | "خروج از بازی"
|
| | ]
|
| |
|
| | while True:
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_game_status(self.game_state)
|
| | ConsoleUI.display_section_title("اقدامات اصلی")
|
| |
|
| | choice = ConsoleUI.get_menu_choice(main_actions)
|
| |
|
| | if choice == 1:
|
| | self.handle_country_status()
|
| | elif choice == 2:
|
| | self.handle_economy_management()
|
| | elif choice == 3:
|
| | self.handle_diplomacy()
|
| | elif choice == 4:
|
| | self.handle_military()
|
| | elif choice == 5:
|
| | self.handle_domestic_policy()
|
| | elif choice == 6:
|
| | self.handle_city_management()
|
| | elif choice == 7:
|
| | self.handle_technology()
|
| | elif choice == 8:
|
| | self.handle_culture()
|
| | elif choice == 9:
|
| | self.handle_religion()
|
| | elif choice == 10:
|
| | self.handle_population()
|
| | elif choice == 11:
|
| | self.save_manager.save_game(self.game_state)
|
| | ConsoleUI.display_success("بازی با موفقیت ذخیره شد!")
|
| | time.sleep(1)
|
| | elif choice == 12:
|
| | self.undo_last_action()
|
| | elif choice == 13:
|
| | if ConsoleUI.confirm_action("آیا میخواهید بازی را ذخیره و خارج شوید؟"):
|
| | self.save_manager.save_game(self.game_state)
|
| | self.running = False
|
| | return
|
| |
|
| | def handle_country_status(self):
|
| | """مدیریت نمایش وضعیت کشور"""
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_section_title("وضعیت کشور")
|
| | ConsoleUI.display_country_status(self.game_state)
|
| | ConsoleUI.wait_for_enter()
|
| |
|
| | def handle_economy_management(self):
|
| | """مدیریت اقتصاد کشور"""
|
| | economy_actions = [
|
| | "مدیریت مالیات و بودجه",
|
| | "سرمایهگذاری در زیرساخت",
|
| | "تجارت با کشورهای دیگر",
|
| | "مدیریت منابع طبیعی",
|
| | "سیاستهای اقتصادی کلان",
|
| | "برگشت"
|
| | ]
|
| |
|
| | while True:
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_game_status(self.game_state)
|
| | ConsoleUI.display_section_title("مدیریت اقتصاد")
|
| |
|
| | choice = ConsoleUI.get_menu_choice(economy_actions)
|
| |
|
| | if choice == 1:
|
| | self.economy.manage_taxes()
|
| | elif choice == 2:
|
| | self.economy.invest_in_infrastructure()
|
| | elif choice == 3:
|
| | self.trade.trade_with_countries()
|
| | elif choice == 4:
|
| | self.economy.manage_resources()
|
| | elif choice == 5:
|
| | self.economy.set_economic_policy()
|
| | elif choice == 6:
|
| | return
|
| |
|
| | def handle_diplomacy(self):
|
| | """مدیریت دیپلماسی و روابط خارجی"""
|
| | diplomacy_actions = [
|
| | "مشاهده روابط فعلی",
|
| | "پیشنهاد اتحاد یا پیمان",
|
| | "مذاکره برای صلح",
|
| | "ارسال سفیر و ایجاد سفارتخانه",
|
| | "عضویت در سازمانهای بینالمللی",
|
| | "برگشت"
|
| | ]
|
| |
|
| | while True:
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_game_status(self.game_state)
|
| | ConsoleUI.display_section_title("دیپلماسی")
|
| |
|
| | choice = ConsoleUI.get_menu_choice(diplomacy_actions)
|
| |
|
| | if choice == 1:
|
| | self.diplomacy.display_relations()
|
| | elif choice == 2:
|
| | self.diplomacy.propose_alliance()
|
| | elif choice == 3:
|
| | self.diplomacy.negotiate_peace()
|
| | elif choice == 4:
|
| | self.diplomacy.send_envoy()
|
| | elif choice == 5:
|
| | self.diplomacy.join_international_orgs()
|
| | elif choice == 6:
|
| | return
|
| |
|
| | def handle_military(self):
|
| | """مدیریت امور نظامی"""
|
| | military_actions = [
|
| | "مشاهده نیروهای نظامی",
|
| | "آموزش ارتش",
|
| | "تولید تسلیحات",
|
| | "حمله به کشور دیگر",
|
| | "دفاع از قلمرو",
|
| | "استراتژیهای نظامی",
|
| | "برگشت"
|
| | ]
|
| |
|
| | while True:
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_game_status(self.game_state)
|
| | ConsoleUI.display_section_title("مدیریت نظامی")
|
| |
|
| | choice = ConsoleUI.get_menu_choice(military_actions)
|
| |
|
| | if choice == 1:
|
| | self.military.display_forces()
|
| | elif choice == 2:
|
| | self.military.train_army()
|
| | elif choice == 3:
|
| | self.military.produce_weapons()
|
| | elif choice == 4:
|
| | self.warfare.attack_country()
|
| | elif choice == 5:
|
| | self.warfare.defend_territory()
|
| | elif choice == 6:
|
| | self.warfare.select_military_tactics()
|
| | elif choice == 7:
|
| | return
|
| |
|
| | def handle_domestic_policy(self):
|
| | """مدیریت سیاست داخلی"""
|
| | politics_actions = [
|
| | "مدیریت احزاب و گروههای فشار",
|
| | "اجرای اصلاحات اجتماعی",
|
| | "سیاستهای بهداشت و درمان",
|
| | "سیاستهای آموزشی",
|
| | "انتخابات و حکومتهای مردمی",
|
| | "برگشت"
|
| | ]
|
| |
|
| | while True:
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_game_status(self.game_state)
|
| | ConsoleUI.display_section_title("سیاست داخلی")
|
| |
|
| | choice = ConsoleUI.get_menu_choice(politics_actions)
|
| |
|
| | if choice == 1:
|
| | self.politics.manage_political_parties()
|
| | elif choice == 2:
|
| | self.politics.implement_social_reforms()
|
| | elif choice == 3:
|
| | self.health.manage_healthcare()
|
| | elif choice == 4:
|
| | self.education.manage_education()
|
| | elif choice == 5:
|
| | self.politics.hold_elections()
|
| | elif choice == 6:
|
| | return
|
| |
|
| | def handle_city_management(self):
|
| | """مدیریت شهرها"""
|
| | city_actions = [
|
| | "مشاهده شهرها",
|
| | "ساخت بناهای جدید",
|
| | "مدیریت جمعیت شهری",
|
| | "برنامهریزی شهری",
|
| | "مدیریت بحرانهای شهری",
|
| | "برگشت"
|
| | ]
|
| |
|
| | while True:
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_game_status(self.game_state)
|
| | ConsoleUI.display_section_title("مدیریت شهرها")
|
| |
|
| | choice = ConsoleUI.get_menu_choice(city_actions)
|
| |
|
| | if choice == 1:
|
| | self.cities.display_cities()
|
| | elif choice == 2:
|
| | self.cities.build_new_structures()
|
| | elif choice == 3:
|
| | self.population.manage_urban_population()
|
| | elif choice == 4:
|
| | self.cities.city_planning()
|
| | elif choice == 5:
|
| | self.crisis.manage_city_crises()
|
| | elif choice == 6:
|
| | return
|
| |
|
| | def handle_technology(self):
|
| | """مدیریت سیستم فناوری"""
|
| | tech_actions = [
|
| | "مشاهده درخت فناوری",
|
| | "تحقیق در فناوریهای جدید",
|
| | "مدیریت مراکز تحقیقاتی",
|
| | "همکاریهای فناوری",
|
| | "برگشت"
|
| | ]
|
| |
|
| | while True:
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_game_status(self.game_state)
|
| | ConsoleUI.display_section_title("سیستم فناوری")
|
| |
|
| | choice = ConsoleUI.get_menu_choice(tech_actions)
|
| |
|
| | if choice == 1:
|
| | self.technology.display_tech_tree()
|
| | elif choice == 2:
|
| | self.technology.conduct_research()
|
| | elif choice == 3:
|
| | self.technology.manage_research_centers()
|
| | elif choice == 4:
|
| | self.technology.technology_cooperation()
|
| | elif choice == 5:
|
| | return
|
| |
|
| | def handle_culture(self):
|
| | """مدیریت سیستم فرهنگی"""
|
| | culture_actions = [
|
| | "مشاهده وضعیت فرهنگی",
|
| | "سرمایهگذاری در گسترش فرهنگ",
|
| | "فرهنگسازی در کشورهای تحت کنترل",
|
| | "مدیریت زبان و هنر",
|
| | "برگشت"
|
| | ]
|
| |
|
| | while True:
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_game_status(self.game_state)
|
| | ConsoleUI.display_section_title("گسترش فرهنگ")
|
| |
|
| | choice = ConsoleUI.get_menu_choice(culture_actions)
|
| |
|
| | if choice == 1:
|
| | self.culture.display_culture_status()
|
| | elif choice == 2:
|
| | self.culture.invest_in_cultural_spread()
|
| | elif choice == 3:
|
| | self.culture.cultural_assimilation()
|
| | elif choice == 4:
|
| | self.culture.manage_language_and_art()
|
| | elif choice == 5:
|
| | return
|
| |
|
| | def handle_religion(self):
|
| | """مدیریت سیستم دینی"""
|
| | religion_actions = [
|
| | "مشاهده وضعیت دینی",
|
| | "گسترش دین",
|
| | "مدیریت گروههای مذهبی",
|
| | "اجرای سیاستهای دینی",
|
| | "برگشت"
|
| | ]
|
| |
|
| | while True:
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_game_status(self.game_state)
|
| | ConsoleUI.display_section_title("سیستم دینی")
|
| |
|
| | choice = ConsoleUI.get_menu_choice(religion_actions)
|
| |
|
| | if choice == 1:
|
| | self.religion.display_religious_status()
|
| | elif choice == 2:
|
| | self.religion.spread_religion()
|
| | elif choice == 3:
|
| | self.religion.manage_religious_groups()
|
| | elif choice == 4:
|
| | self.religion.implement_religious_policies()
|
| | elif choice == 5:
|
| | return
|
| |
|
| | def handle_population(self):
|
| | """مدیریت سیستم جمعیت"""
|
| | population_actions = [
|
| | "مشاهده ساختار جمعیت",
|
| | "مدیریت مهاجرت",
|
| | "برنامهریزی خانواده",
|
| | "مدیریت طبقات اجتماعی",
|
| | "برگشت"
|
| | ]
|
| |
|
| | while True:
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_game_status(self.game_state)
|
| | ConsoleUI.display_section_title("سیستم جمعیت")
|
| |
|
| | choice = ConsoleUI.get_menu_choice(population_actions)
|
| |
|
| | if choice == 1:
|
| | self.population.display_population_structure()
|
| | elif choice == 2:
|
| | self.population.manage_migration()
|
| | elif choice == 3:
|
| | self.population.family_planning()
|
| | elif choice == 4:
|
| | self.society.manage_social_classes()
|
| | elif choice == 5:
|
| | return
|
| |
|
| | def annual_updates(self):
|
| | """بهروزرسانیهای سالانه بازی"""
|
| |
|
| | self.calendar.annual_update()
|
| |
|
| |
|
| | self.climate.annual_update()
|
| |
|
| |
|
| | self.population.annual_update()
|
| |
|
| |
|
| | self.technology.annual_update()
|
| |
|
| |
|
| | self.religion.annual_update()
|
| |
|
| |
|
| | self.espionage.annual_update()
|
| |
|
| |
|
| | self.cities.annual_update()
|
| |
|
| |
|
| | self.warfare.annual_update()
|
| |
|
| |
|
| | self.trade.annual_update()
|
| |
|
| |
|
| | self.politics.annual_update()
|
| |
|
| |
|
| | self.society.annual_update()
|
| |
|
| |
|
| | self.culture.annual_update()
|
| |
|
| |
|
| | self.diplomacy.annual_update()
|
| |
|
| |
|
| | self.economy.annual_update()
|
| |
|
| |
|
| | self.military.annual_update()
|
| |
|
| |
|
| | self.health.annual_update()
|
| |
|
| |
|
| | self.education.annual_update()
|
| |
|
| |
|
| | self.environment.annual_update()
|
| |
|
| |
|
| | self.crisis.annual_update()
|
| |
|
| |
|
| | self.succession.annual_update()
|
| |
|
| |
|
| | self.achievements.annual_update()
|
| |
|
| |
|
| | self.check_victory_conditions()
|
| |
|
| | def check_victory_conditions(self):
|
| | """بررسی شرایط پیروزی یا شکست"""
|
| |
|
| | if self.game_state.controlled_territories >= GAME_CONFIG["victory_conditions"]["world_domination"]:
|
| | self.show_victory_screen("تسلط جهانی",
|
| | "شما موفق شدید بیش از نصف کشورهای جهان را تحت کنترل خود درآورید!")
|
| | return True
|
| |
|
| |
|
| | if self.game_state.gold >= GAME_CONFIG["victory_conditions"]["economic_domination"]:
|
| | self.show_victory_screen("تسلط اقتصادی",
|
| | "شما به غنیترین کشور جهان تبدیل شدید و اقتصاد جهانی را کنترل میکنید!")
|
| | return True
|
| |
|
| |
|
| | if self.game_state.culture_score >= GAME_CONFIG["victory_conditions"]["cultural_domination"]:
|
| | self.show_victory_screen("تسلط فرهنگی",
|
| | "فرهنگ و زبان شما به تمام نقاط جهان گسترش یافت!")
|
| | return True
|
| |
|
| |
|
| | if self.game_state.technology_level >= GAME_CONFIG["victory_conditions"]["technological_domination"]:
|
| | self.show_victory_screen("تسلط فناوری",
|
| | "شما به پیشرفتهترین کشور جهان تبدیل شدید و فناوری را کنترل میکنید!")
|
| | return True
|
| |
|
| |
|
| | if self.game_state.religious_influence >= GAME_CONFIG["victory_conditions"]["religious_domination"]:
|
| | self.show_victory_screen("تسلط دینی",
|
| | "دین شما به بیش از 75% جمعیت جهان گسترش یافت!")
|
| | return True
|
| |
|
| |
|
| | if self.game_state.political_stability <= 0:
|
| | self.show_defeat_screen("ناپایداری سیاسی",
|
| | "ثبات سیاسی شما به صفر رسید و مردم علیه شما شورش کردند!")
|
| | return True
|
| |
|
| | if self.game_state.gold <= 0:
|
| | self.show_defeat_screen("ورشکستگی مالی",
|
| | "منابع مالی شما به پایان رسید و امپراتوری شما از بین رفت!")
|
| | return True
|
| |
|
| |
|
| | if self.game_state.current_year >= GAME_CONFIG["max_year"]:
|
| | self.show_defeat_screen("پایان دوره تاریخی",
|
| | f"شما توانستید تا سال {GAME_CONFIG['max_year']} دوام بیاورید، اما هنوز به پیروزی نرسیدید.")
|
| | return True
|
| |
|
| | return False
|
| |
|
| | def show_victory_screen(self, victory_type, description):
|
| | """نمایش صفحه پیروزی"""
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_section_title("پیروزی!")
|
| | ConsoleUI.display_success(f"تبریک! شما با {victory_type} پیروز شدید!")
|
| | ConsoleUI.display_message(description)
|
| | ConsoleUI.display_message(f"سال پایانی: {self.game_state.current_year}")
|
| | ConsoleUI.display_message(f"ثروت نهایی: {self.game_state.gold} سکه طلا")
|
| | ConsoleUI.display_message(f"امتیاز فرهنگی: {self.game_state.culture_score}/100")
|
| | ConsoleUI.display_message(f"سطح فناوری: {self.game_state.technology_level}")
|
| | ConsoleUI.display_message(f"نفوذ دینی: {self.game_state.religious_influence}%")
|
| |
|
| |
|
| | self.save_manager.save_game_result(self.game_state, victory_type)
|
| |
|
| | ConsoleUI.wait_for_enter()
|
| | self.running = False
|
| |
|
| | def show_defeat_screen(self, defeat_type, description):
|
| | """نمایش صفحه شکست"""
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_section_title("شکست")
|
| | ConsoleUI.display_error(f"متأسفانه با {defeat_type} باختید!")
|
| | ConsoleUI.display_message(description)
|
| | ConsoleUI.display_message(f"سال پایانی: {self.game_state.current_year}")
|
| | ConsoleUI.display_message(f"ثروت نهایی: {self.game_state.gold} سکه طلا")
|
| | ConsoleUI.display_message(f"امتیاز فرهنگی: {self.game_state.culture_score}/100")
|
| | ConsoleUI.display_message(f"سطح فناوری: {self.game_state.technology_level}")
|
| | ConsoleUI.display_message(f"نفوذ دینی: {self.game_state.religious_influence}%")
|
| |
|
| |
|
| | self.save_manager.save_game_result(self.game_state, f"شکست: {defeat_type}")
|
| |
|
| | ConsoleUI.wait_for_enter()
|
| | self.running = False
|
| |
|
| | def undo_last_action(self):
|
| | """بازگرداندن آخرین اقدام"""
|
| | if not self.undo_stack:
|
| | ConsoleUI.display_warning("هیچ اقدامی برای بازگرداندن وجود ندارد.")
|
| | time.sleep(1)
|
| | return
|
| |
|
| |
|
| | self.redo_stack.append(self.game_state.copy())
|
| |
|
| |
|
| | self.game_state = self.undo_stack.pop()
|
| |
|
| | ConsoleUI.display_success("آخرین اقدام با موفقیت بازگردانده شد.")
|
| | time.sleep(1)
|
| |
|
| | def save_state_for_undo(self):
|
| | """ذخیره وضعیت فعلی برای امکان undo"""
|
| | if len(self.undo_stack) >= GAME_CONFIG["max_undo_steps"]:
|
| | self.undo_stack.pop(0)
|
| |
|
| | self.undo_stack.append(self.game_state.copy())
|
| | self.redo_stack = []
|
| |
|
| | def show_tutorial(self):
|
| | """نمایش راهنمای اولیه بازی"""
|
| | if ConsoleUI.confirm_action("آیا میخواهید راهنمای اولیه بازی را ببینید؟"):
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_section_title("راهنمای اولیه بازی")
|
| |
|
| | tutorial_steps = [
|
| | "در این بازی شما رهبر یک کشور تاریخی هستید که باید با تصمیمات استراتژیک، کشور خود را گسترش دهید.",
|
| | "در هر سال میتوانید اقدامات مختلفی انجام دهید: مدیریت اقتصاد، دیپلماسی، نظامی، و...",
|
| | "توجه به تعادل بین ثبات سیاسی، نارضایتی عمومی و منابع مالی بسیار مهم است.",
|
| | "رویدادهای تصادفی و تاریخی در طول بازی رخ خواهند داد که باید به آنها پاسخ دهید.",
|
| | "هدف نهایی شما رسیدن به یکی از شرایط پیروزی است: تسلط جهانی، اقتصادی، فرهنگی یا فناوری."
|
| | ]
|
| |
|
| | for step in tutorial_steps:
|
| | ConsoleUI.typewriter_effect(step)
|
| | time.sleep(0.5)
|
| | print()
|
| |
|
| | ConsoleUI.wait_for_enter() |