| | """
|
| | سیستم تحقیق و توسعه فناوری با درخت فناوری و پیشنیازها
|
| | """
|
| |
|
| | from data.tech.tech_definitions import TECHNOLOGIES
|
| | from data.tech.tech_trees import TECH_TREES
|
| |
|
| | class ResearchSystem:
|
| | """سیستم تحقیق و توسعه فناوری"""
|
| |
|
| | def __init__(self, game_state):
|
| | """ساخت یک نمونه جدید از سیستم تحقیق"""
|
| | self.game_state = game_state
|
| | self.research_fields = ["military", "agriculture", "trade", "industry", "medicine", "education"]
|
| | self.current_research = None
|
| | self.research_progress = 0
|
| | self.research_efficiency = 1.0
|
| |
|
| | def initialize(self):
|
| | """راهاندازی اولیه سیستم تحقیق"""
|
| |
|
| | country_name = self.game_state.player_country["name"]
|
| | if country_name in TECH_TREES:
|
| | self.tech_tree = TECH_TREES[country_name]
|
| | else:
|
| | self.tech_tree = TECH_TREES["Generic"]
|
| |
|
| |
|
| | self.game_state.unlocked_technologies = self.tech_tree["starting_technologies"].copy()
|
| |
|
| |
|
| | self._calculate_technology_level()
|
| |
|
| | def display_tech_tree(self):
|
| | """نمایش درخت فناوری و پیشرفت فعلی"""
|
| | from ui.console_ui import ConsoleUI
|
| |
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_section_title("درخت فناوری")
|
| |
|
| |
|
| | ConsoleUI.display_message(f"سطح فناوری کلی: {self.game_state.technology_level}")
|
| | ConsoleUI.display_message(f"فناوری جاری در دست تحقیق: {self.current_research or 'هیچکدام'}")
|
| | ConsoleUI.display_message(f"پیشرفت تحقیق: {self.research_progress}%")
|
| | ConsoleUI.display_message(f"کارایی تحقیق: {self.research_efficiency:.1f}x")
|
| |
|
| |
|
| | ConsoleUI.display_section_title("فناوریهای قابل تحقیق")
|
| |
|
| | available_techs = self.get_available_technologies()
|
| | if not available_techs:
|
| | ConsoleUI.display_message("هیچ فناوری جدیدی برای تحقیق در دسترس نیست.")
|
| | else:
|
| | for i, tech_id in enumerate(available_techs, 1):
|
| | tech = TECHNOLOGIES[tech_id]
|
| | cost = self.calculate_research_cost(tech_id)
|
| | ConsoleUI.display_message(f"{i}. {tech['name']} - هزینه: {cost} واحد تحقیق")
|
| | ConsoleUI.display_message(f" {tech['description']}")
|
| |
|
| | ConsoleUI.wait_for_enter()
|
| |
|
| | def get_available_technologies(self):
|
| | """دریافت لیست فناوریهای قابل تحقیق"""
|
| | available = []
|
| |
|
| | for tech_id, tech in TECHNOLOGIES.items():
|
| |
|
| | if tech_id in self.game_state.unlocked_technologies:
|
| | continue
|
| |
|
| |
|
| | if not self._check_technology_prerequisites(tech_id):
|
| | continue
|
| |
|
| | available.append(tech_id)
|
| |
|
| | return available
|
| |
|
| | def _check_technology_prerequisites(self, tech_id):
|
| | """بررسی پیشنیازهای فناوری"""
|
| | tech = TECHNOLOGIES[tech_id]
|
| |
|
| |
|
| | for prereq in tech.get("prerequisites", []):
|
| | if prereq not in self.game_state.unlocked_technologies:
|
| | return False
|
| |
|
| |
|
| | if "tech_level_req" in tech and self.game_state.technology_level < tech["tech_level_req"]:
|
| | return False
|
| |
|
| | return True
|
| |
|
| | def conduct_research(self):
|
| | """شروع یا ادامه تحقیق در یک فناوری"""
|
| | from ui.console_ui import ConsoleUI
|
| |
|
| | available_techs = self.get_available_technologies()
|
| |
|
| | if not available_techs:
|
| | ConsoleUI.display_warning("هیچ فناوری جدیدی برای تحقیق در دسترس نیست.")
|
| | ConsoleUI.wait_for_enter()
|
| | return
|
| |
|
| |
|
| | tech_options = [TECHNOLOGIES[tech_id]["name"] for tech_id in available_techs]
|
| | tech_options.append("برگشت")
|
| |
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_section_title("تحقیق فناوری")
|
| | choice = ConsoleUI.get_menu_choice(tech_options)
|
| |
|
| | if choice == len(tech_options):
|
| | return
|
| |
|
| | selected_tech = available_techs[choice-1]
|
| | self.start_research(selected_tech)
|
| |
|
| | def start_research(self, tech_id):
|
| | """شروع تحقیق در یک فناوری جدید"""
|
| | from ui.console_ui import ConsoleUI
|
| |
|
| | tech = TECHNOLOGIES[tech_id]
|
| | cost = self.calculate_research_cost(tech_id)
|
| |
|
| |
|
| | if self.game_state.gold < cost:
|
| | ConsoleUI.display_error(f"موجودی طلا کافی نیست! هزینه تحقیق: {cost} سکه")
|
| | ConsoleUI.wait_for_enter()
|
| | return
|
| |
|
| |
|
| | self.game_state.gold -= cost
|
| | self.current_research = tech_id
|
| | self.research_progress = 0
|
| |
|
| | ConsoleUI.display_success(f"تحقیق در '{tech['name']}' آغاز شد.")
|
| | ConsoleUI.display_message(f"هزینه: {cost} سکه طلا")
|
| | ConsoleUI.display_message(f"شرح: {tech['description']}")
|
| | ConsoleUI.wait_for_enter()
|
| |
|
| | def calculate_research_cost(self, tech_id):
|
| | """محاسبه هزینه تحقیق برای یک فناوری"""
|
| | tech = TECHNOLOGIES[tech_id]
|
| | base_cost = tech["base_cost"]
|
| |
|
| |
|
| | level_factor = 1 + (self.game_state.technology_level * 0.1)
|
| |
|
| |
|
| | efficiency_factor = 1 / self.research_efficiency
|
| |
|
| |
|
| | education_factor = 1 - (self.game_state.budget["education"] * 0.01)
|
| |
|
| | return int(base_cost * level_factor * efficiency_factor * education_factor)
|
| |
|
| | def manage_research_centers(self):
|
| | """مدیریت مراکز تحقیقاتی و افزایش کارایی تحقیق"""
|
| | from ui.console_ui import ConsoleUI
|
| |
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_section_title("مدیریت مراکز تحقیقاتی")
|
| |
|
| | options = [
|
| | f"افزایش بودجه تحقیقات ({self.game_state.budget['education']}%)",
|
| | "ساخت مرکز تحقیقاتی جدید",
|
| | "همکاری تحقیقاتی با کشورهای دیگر",
|
| | "برگشت"
|
| | ]
|
| |
|
| | choice = ConsoleUI.get_menu_choice(options)
|
| |
|
| | if choice == 1:
|
| | self.increase_research_budget()
|
| | elif choice == 2:
|
| | self.build_research_center()
|
| | elif choice == 3:
|
| | self.research_cooperation()
|
| |
|
| |
|
| | def increase_research_budget(self):
|
| | """افزایش بودجه تحقیقات از طریق بودجه آموزش"""
|
| | from ui.console_ui import ConsoleUI
|
| |
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_section_title("افزایش بودجه تحقیقات")
|
| |
|
| |
|
| | current_budget = self.game_state.budget["education"]
|
| | increase_amount = min(5, 100 - current_budget)
|
| | cost = increase_amount * 500
|
| |
|
| | ConsoleUI.display_message(f"افزایش بودجه آموزش از {current_budget}% به {current_budget + increase_amount}%")
|
| | ConsoleUI.display_message(f"هزینه: {cost} سکه طلا")
|
| | ConsoleUI.display_message("تأثیرات:")
|
| | ConsoleUI.display_message("• کارایی تحقیق 0.1x افزایش مییابد")
|
| | ConsoleUI.display_message("• نرخ سواد 1% افزایش مییابد")
|
| |
|
| | if not ConsoleUI.confirm_action("آیا مایل به انجام این تغییر هستید؟"):
|
| | return
|
| |
|
| |
|
| | if self.game_state.gold < cost:
|
| | ConsoleUI.display_error("موجودی طلا کافی نیست!")
|
| | ConsoleUI.wait_for_enter()
|
| | return
|
| |
|
| |
|
| | self.game_state.gold -= cost
|
| | self.game_state.budget["education"] += increase_amount
|
| | self.research_efficiency += 0.1
|
| | self.game_state.literacy_rate = min(100, self.game_state.literacy_rate + 1)
|
| |
|
| | ConsoleUI.display_success("بودجه آموزش افزایش یافت.")
|
| | ConsoleUI.wait_for_enter()
|
| |
|
| | def build_research_center(self):
|
| | """ساخت مرکز تحقیقاتی جدید"""
|
| | from ui.console_ui import ConsoleUI
|
| |
|
| | cost = 10000
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_section_title("ساخت مرکز تحقیقاتی")
|
| |
|
| | ConsoleUI.display_message(f"هزینه: {cost} سکه طلا")
|
| | ConsoleUI.display_message("تأثیرات:")
|
| | ConsoleUI.display_message("• کارایی تحقیق 0.3x افزایش مییابد")
|
| | ConsoleUI.display_message("• هزینه تحقیقات 5% کاهش مییابد")
|
| | ConsoleUI.display_message("• هزینه نگهداری سالانه: 500 سکه")
|
| |
|
| | if not ConsoleUI.confirm_action("آیا مایل به ساخت مرکز تحقیقاتی هستید؟"):
|
| | return
|
| |
|
| |
|
| | if self.game_state.gold < cost:
|
| | ConsoleUI.display_error("موجودی طلا کافی نیست!")
|
| | ConsoleUI.wait_for_enter()
|
| | return
|
| |
|
| |
|
| | self.game_state.gold -= cost
|
| | self.research_efficiency += 0.3
|
| | self.game_state.budget["education"] += 2
|
| |
|
| | ConsoleUI.display_success("مرکز تحقیقاتی جدید ساخته شد.")
|
| | ConsoleUI.wait_for_enter()
|
| |
|
| | def research_cooperation(self):
|
| | """همکاری تحقیقاتی با کشورهای دیگر"""
|
| | from ui.console_ui import ConsoleUI
|
| |
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_section_title("همکاری تحقیقاتی")
|
| |
|
| |
|
| | potential_partners = []
|
| | for country, relation in self.game_state.relations.items():
|
| | if relation > 50 and country != self.game_state.player_country["name"]:
|
| | potential_partners.append(country)
|
| |
|
| | if not potential_partners:
|
| | ConsoleUI.display_warning("هیچ کشوری برای همکاری تحقیقاتی در دسترس نیست.")
|
| | ConsoleUI.wait_for_enter()
|
| | return
|
| |
|
| |
|
| | potential_partners.append("برگشت")
|
| | choice = ConsoleUI.get_menu_choice(potential_partners)
|
| |
|
| | if choice == len(potential_partners):
|
| | return
|
| |
|
| | partner = potential_partners[choice-1]
|
| | cost = 5000
|
| |
|
| | ConsoleUI.display_message(f"همکاری تحقیقاتی با {partner}")
|
| | ConsoleUI.display_message(f"هزینه: {cost} سکه طلا")
|
| | ConsoleUI.display_message("تأثیرات:")
|
| | ConsoleUI.display_message("• زمان تحقیق 20% کاهش مییابد")
|
| | ConsoleUI.display_message("• امکان دسترسی به فناوریهای پیشرفتهتر")
|
| | ConsoleUI.display_message("• روابط با {partner} 10 واحد افزایش مییابد")
|
| |
|
| | if not ConsoleUI.confirm_action("آیا مایل به انجام همکاری تحقیقاتی هستید؟"):
|
| | return
|
| |
|
| |
|
| | if self.game_state.gold < cost:
|
| | ConsoleUI.display_error("موجودی طلا کافی نیست!")
|
| | ConsoleUI.wait_for_enter()
|
| | return
|
| |
|
| |
|
| | self.game_state.gold -= cost
|
| | self.research_efficiency += 0.2
|
| | self.game_state.relations[partner] = min(100, self.game_state.relations[partner] + 10)
|
| |
|
| | ConsoleUI.display_success(f"همکاری تحقیقاتی با {partner} برقرار شد.")
|
| | ConsoleUI.wait_for_enter()
|
| |
|
| | def technology_cooperation(self):
|
| | """همکاریهای فناوری پیشرفته"""
|
| | from ui.console_ui import ConsoleUI
|
| |
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_section_title("همکاریهای فناوری")
|
| |
|
| | options = [
|
| | "تبادل فناوری با کشورهای متحد",
|
| | "شرکت در پروژههای فناوری جهانی",
|
| | "گسترش فناوری به کشورهای در حال توسعه",
|
| | "برگشت"
|
| | ]
|
| |
|
| | choice = ConsoleUI.get_menu_choice(options)
|
| |
|
| | if choice == 1:
|
| | self.technology_exchange()
|
| | elif choice == 2:
|
| | self.global_technology_projects()
|
| | elif choice == 3:
|
| | self.technology_aid()
|
| |
|
| |
|
| | def technology_exchange(self):
|
| | """تبادل فناوری با کشورهای متحد"""
|
| | from ui.console_ui import ConsoleUI
|
| |
|
| |
|
| | allies = [c for c, relation in self.game_state.relations.items()
|
| | if relation > 70 and c != self.game_state.player_country["name"]]
|
| |
|
| | if not allies:
|
| | ConsoleUI.display_warning("هیچ متحدی برای تبادل فناوری وجود ندارد.")
|
| | ConsoleUI.wait_for_enter()
|
| | return
|
| |
|
| |
|
| | allies.append("برگشت")
|
| | choice = ConsoleUI.get_menu_choice(allies)
|
| |
|
| | if choice == len(allies):
|
| | return
|
| |
|
| | ally = allies[choice-1]
|
| |
|
| |
|
| | available_techs = self.game_state.unlocked_technologies.copy()
|
| | available_techs.append("برگشت")
|
| |
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_section_title(f"انتخاب فناوری برای تبادل با {ally}")
|
| | tech_choice = ConsoleUI.get_menu_choice(available_techs)
|
| |
|
| | if tech_choice == len(available_techs):
|
| | return
|
| |
|
| | tech_id = available_techs[tech_choice-1]
|
| | tech = TECHNOLOGIES[tech_id]
|
| |
|
| | ConsoleUI.display_message(f"شما فناوری '{tech['name']}' را برای تبادل انتخاب کردید.")
|
| | ConsoleUI.display_message("در ازای آن، ممکن است فناوریهای جدیدی دریافت کنید.")
|
| |
|
| | if ConsoleUI.confirm_action("آیا مایل به انجام تبادل فناوری هستید؟"):
|
| |
|
| | self._simulate_technology_exchange(ally, tech_id)
|
| |
|
| | def _simulate_technology_exchange(self, ally, tech_id):
|
| | """شبیهسازی تبادل فناوری با یک کشور متحد"""
|
| | from ui.console_ui import ConsoleUI
|
| | import random
|
| |
|
| |
|
| | possible_techs = [t for t in TECHNOLOGIES.keys()
|
| | if t not in self.game_state.unlocked_technologies
|
| | and self._check_technology_prerequisites(t)]
|
| |
|
| | if not possible_techs:
|
| | ConsoleUI.display_warning("هیچ فناوری جدیدی برای دریافت وجود ندارد.")
|
| | ConsoleUI.wait_for_enter()
|
| | return
|
| |
|
| | received_techs = random.sample(possible_techs, min(2, len(possible_techs)))
|
| |
|
| |
|
| | for tech_id in received_techs:
|
| | self.game_state.unlocked_technologies.append(tech_id)
|
| |
|
| |
|
| | self._calculate_technology_level()
|
| |
|
| |
|
| | ConsoleUI.display_success(f"تبادل فناوری با {ally} موفقیتآمیز بود!")
|
| | ConsoleUI.display_message("فناوریهای دریافتی:")
|
| | for tech_id in received_techs:
|
| | tech = TECHNOLOGIES[tech_id]
|
| | ConsoleUI.display_message(f"• {tech['name']}: {tech['description']}")
|
| |
|
| | ConsoleUI.wait_for_enter()
|
| |
|
| | def global_technology_projects(self):
|
| | """شرکت در پروژههای فناوری جهانی"""
|
| | from ui.console_ui import ConsoleUI
|
| |
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_section_title("پروژههای فناوری جهانی")
|
| |
|
| | projects = [
|
| | {
|
| | "name": "شبکه جهانی اینترنت",
|
| | "description": "مشارکت در ایجاد زیرساختهای اینترنت جهانی",
|
| | "cost": 20000,
|
| | "effects": {
|
| | "technology": {"trade": 2, "education": 1},
|
| | "relations": {"+": 5},
|
| | "economy": {"trade": 10}
|
| | }
|
| | },
|
| | {
|
| | "name": "پروژه ژنوم انسان",
|
| | "description": "مشارکت در تحقیقات ژنتیک انسان",
|
| | "cost": 25000,
|
| | "effects": {
|
| | "technology": {"medicine": 3},
|
| | "health_index": 15,
|
| | "gold": -500
|
| | }
|
| | },
|
| | {
|
| | "name": "برنامه فضایی جهانی",
|
| | "description": "مشارکت در برنامههای فضایی بینالمللی",
|
| | "cost": 30000,
|
| | "effects": {
|
| | "technology": {"military": 2, "industry": 2},
|
| | "political_stability": 10,
|
| | "prestige": 20
|
| | }
|
| | }
|
| | ]
|
| |
|
| |
|
| | project_names = [p["name"] for p in projects]
|
| | project_names.append("برگشت")
|
| |
|
| | choice = ConsoleUI.get_menu_choice(project_names)
|
| |
|
| | if choice == len(project_names):
|
| | return
|
| |
|
| | project = projects[choice-1]
|
| |
|
| | ConsoleUI.display_message(f"پروژه: {project['name']}")
|
| | ConsoleUI.display_message(f"شرح: {project['description']}")
|
| | ConsoleUI.display_message(f"هزینه: {project['cost']} سکه طلا")
|
| | ConsoleUI.display_message("تأثیرات:")
|
| |
|
| |
|
| | for effect_type, values in project["effects"].items():
|
| | if effect_type == "technology":
|
| | for tech, value in values.items():
|
| | ConsoleUI.display_message(f"• فناوری {tech}: +{value}")
|
| | elif effect_type == "relations":
|
| | ConsoleUI.display_message(f"• روابط بینالمللی: +{values['+']}")
|
| | else:
|
| | ConsoleUI.display_message(f"• {effect_type}: +{values}")
|
| |
|
| | if ConsoleUI.confirm_action("آیا مایل به شرکت در این پروژه هستید؟"):
|
| | self._join_global_project(project)
|
| |
|
| | def _join_global_project(self, project):
|
| | """شرکت در یک پروژه فناوری جهانی"""
|
| | from ui.console_ui import ConsoleUI
|
| |
|
| |
|
| | if self.game_state.gold < project["cost"]:
|
| | ConsoleUI.display_error("موجودی طلا کافی نیست!")
|
| | ConsoleUI.wait_for_enter()
|
| | return
|
| |
|
| |
|
| | self.game_state.gold -= project["cost"]
|
| |
|
| |
|
| | for effect_type, values in project["effects"].items():
|
| | if effect_type == "technology":
|
| | for tech, value in values.items():
|
| | self.game_state.technology[tech] = min(10, self.game_state.technology[tech] + value)
|
| | elif effect_type == "relations":
|
| | for country in self.game_state.relations:
|
| | if country != self.game_state.player_country["name"]:
|
| | self.game_state.relations[country] = min(100, self.game_state.relations[country] + values["+"])
|
| | elif effect_type == "prestige":
|
| |
|
| | if not hasattr(self.game_state, 'prestige'):
|
| | self.game_state.prestige = 0
|
| | self.game_state.prestige += values
|
| | else:
|
| | if effect_type in self.game_state:
|
| | self.game_state[effect_type] = min(100, self.game_state[effect_type] + values)
|
| | elif effect_type in self.game_state.economy:
|
| | self.game_state.economy[effect_type] = min(100, self.game_state.economy[effect_type] + values)
|
| |
|
| | ConsoleUI.display_success(f"شما در پروژه '{project['name']}' شرکت کردید.")
|
| | ConsoleUI.wait_for_enter()
|
| |
|
| | def technology_aid(self):
|
| | """گسترش فناوری به کشورهای در حال توسعه"""
|
| | from ui.console_ui import ConsoleUI
|
| |
|
| | ConsoleUI.clear_screen()
|
| | ConsoleUI.display_section_title("کمک فناوری به کشورهای در حال توسعه")
|
| |
|
| |
|
| | potential_recipients = []
|
| | for country, relation in self.game_state.relations.items():
|
| | if relation > 30 and country != self.game_state.player_country["name"]:
|
| |
|
| | potential_recipients.append(country)
|
| |
|
| | if not potential_recipients:
|
| | ConsoleUI.display_warning("هیچ کشوری برای کمک فناوری در دسترس نیست.")
|
| | ConsoleUI.wait_for_enter()
|
| | return
|
| |
|
| |
|
| | potential_recipients.append("برگشت")
|
| | choice = ConsoleUI.get_menu_choice(potential_recipients)
|
| |
|
| | if choice == len(potential_recipients):
|
| | return
|
| |
|
| | recipient = potential_recipients[choice-1]
|
| |
|
| |
|
| | aid_types = [
|
| | "کمک آموزشی (افزایش نرخ سواد)",
|
| | "کمک صنعتی (افزایش سطح صنعت)",
|
| | "کمک بهداشتی (افزایش شاخص سلامت)",
|
| | "برگشت"
|
| | ]
|
| |
|
| | aid_choice = ConsoleUI.get_menu_choice(aid_types)
|
| |
|
| | if aid_choice == 4:
|
| | return
|
| |
|
| | costs = [3000, 4000, 3500]
|
| | effects = [
|
| | {"literacy_rate": 5, "relations": {"+": 3}},
|
| | {"economy": {"industry": 5}, "relations": {"+": 4}},
|
| | {"health_index": 8, "relations": {"+": 5}}
|
| | ]
|
| |
|
| | cost = costs[aid_choice-1]
|
| | effect = effects[aid_choice-1]
|
| |
|
| | ConsoleUI.display_message(f"کمک فناوری به {recipient}")
|
| | ConsoleUI.display_message(f"نوع کمک: {aid_types[aid_choice-1]}")
|
| | ConsoleUI.display_message(f"هزینه: {cost} سکه طلا")
|
| | ConsoleUI.display_message("تأثیرات:")
|
| |
|
| |
|
| | for effect_type, value in effect.items():
|
| | if effect_type == "relations":
|
| | ConsoleUI.display_message(f"• روابط با {recipient}: +{value['+']}")
|
| | elif effect_type == "economy":
|
| | for sector, val in value.items():
|
| | ConsoleUI.display_message(f"• اقتصاد {sector}: +{val}")
|
| | else:
|
| | ConsoleUI.display_message(f"• {effect_type}: +{value}")
|
| |
|
| | if ConsoleUI.confirm_action("آیا مایل به انجام این کمک فناوری هستید؟"):
|
| | self._provide_technology_aid(recipient, effect, cost)
|
| |
|
| | def _provide_technology_aid(self, recipient, effect, cost):
|
| | """ارائه کمک فناوری به یک کشور"""
|
| | from ui.console_ui import ConsoleUI
|
| |
|
| |
|
| | if self.game_state.gold < cost:
|
| | ConsoleUI.display_error("موجودی طلا کافی نیست!")
|
| | ConsoleUI.wait_for_enter()
|
| | return
|
| |
|
| |
|
| | self.game_state.gold -= cost
|
| |
|
| |
|
| | for effect_type, value in effect.items():
|
| | if effect_type == "relations":
|
| | self.game_state.relations[recipient] = min(100, self.game_state.relations[recipient] + value["+"])
|
| | elif effect_type == "economy":
|
| | for sector, val in value.items():
|
| |
|
| | pass
|
| | else:
|
| | if effect_type == "literacy_rate":
|
| | self.game_state.literacy_rate = min(100, self.game_state.literacy_rate + value)
|
| | elif effect_type == "health_index":
|
| | self.game_state.health_index = min(100, self.game_state.health_index + value)
|
| |
|
| | ConsoleUI.display_success(f"کمک فناوری به {recipient} ارسال شد.")
|
| | ConsoleUI.wait_for_enter()
|
| |
|
| | def annual_update(self):
|
| | """بهروزرسانیهای سالانه سیستم تحقیق"""
|
| |
|
| | if self.current_research:
|
| | research_speed = self._calculate_research_speed()
|
| | self.research_progress += research_speed
|
| |
|
| |
|
| | if self.research_progress >= 100:
|
| | self._complete_research()
|
| |
|
| | def _calculate_research_speed(self):
|
| | """محاسبه سرعت تحقیق فعلی"""
|
| | base_speed = 5
|
| |
|
| |
|
| | speed = base_speed * self.research_efficiency
|
| |
|
| |
|
| | speed *= (1 + self.game_state.budget["education"] * 0.01)
|
| |
|
| |
|
| | if "Research Centers" in self.game_state.unlocked_technologies:
|
| | speed *= 1.2
|
| |
|
| | return speed
|
| |
|
| | def _complete_research(self):
|
| | """تکمیل تحقیق و اعمال اثرات فناوری"""
|
| | from ui.console_ui import ConsoleUI
|
| |
|
| | tech = TECHNOLOGIES[self.current_research]
|
| |
|
| |
|
| | self.game_state.unlocked_technologies.append(self.current_research)
|
| |
|
| |
|
| | self._apply_technology_effects(tech)
|
| |
|
| |
|
| | self._calculate_technology_level()
|
| |
|
| |
|
| | ConsoleUI.display_success(f"تحقیق در '{tech['name']}' کامل شد!")
|
| | ConsoleUI.display_message(f"شرح: {tech['description']}")
|
| |
|
| |
|
| | ConsoleUI.display_section_title("اثرات فناوری")
|
| | for effect_type, value in tech["effects"].items():
|
| | if effect_type == "technology":
|
| | for tech_field, val in value.items():
|
| | ConsoleUI.display_message(f"• فناوری {tech_field}: +{val}")
|
| | elif effect_type == "economy":
|
| | for sector, val in value.items():
|
| | ConsoleUI.display_message(f"• اقتصاد {sector}: +{val}")
|
| | else:
|
| | ConsoleUI.display_message(f"• {effect_type}: +{value}")
|
| |
|
| | ConsoleUI.wait_for_enter()
|
| |
|
| |
|
| | self.current_research = None
|
| | self.research_progress = 0
|
| |
|
| | def _apply_technology_effects(self, tech):
|
| | """اعمال اثرات یک فناوری به وضعیت بازی"""
|
| | for effect_type, value in tech["effects"].items():
|
| | if effect_type == "technology":
|
| | for tech_field, val in value.items():
|
| | self.game_state.technology[tech_field] = min(10, self.game_state.technology[tech_field] + val)
|
| | elif effect_type == "economy":
|
| | for sector, val in value.items():
|
| | self.game_state.economy[sector] = min(100, self.game_state.economy[sector] + val)
|
| | elif effect_type == "military":
|
| | self.game_state.military_strength = min(100, self.game_state.military_strength + value)
|
| | elif effect_type == "culture":
|
| | self.game_state.culture_score = min(100, self.game_state.culture_score + value)
|
| | elif effect_type == "religion":
|
| | self.game_state.religious_influence = min(100, self.game_state.religious_influence + value)
|
| | elif effect_type == "population":
|
| | self.game_state.population = int(self.game_state.population * (1 + value/100))
|
| | elif effect_type == "environment":
|
| | for factor, val in value.items():
|
| | self.game_state.environment[factor] = max(0, min(100, self.game_state.environment[factor] + val))
|
| |
|
| | def _calculate_technology_level(self):
|
| | """محاسبه سطح فناوری کلی بر اساس فناوریهای آشکار شده"""
|
| | total_level = 0
|
| | count = 0
|
| |
|
| | for tech_id in self.game_state.unlocked_technologies:
|
| | tech = TECHNOLOGIES[tech_id]
|
| | total_level += tech.get("level", 1)
|
| | count += 1
|
| |
|
| | self.game_state.technology_level = total_level // count if count > 0 else 1 |