Upload 22 files
Browse files- Shadows_of_Empires/LICENSE +20 -0
- Shadows_of_Empires/config.py +60 -0
- Shadows_of_Empires/data/countries/base_countries.py +1326 -0
- Shadows_of_Empires/data/tech/tech_definitions.py +373 -0
- Shadows_of_Empires/game/achievements/achievement_definitions.py +194 -0
- Shadows_of_Empires/game/achievements/achievements_system.py +362 -0
- Shadows_of_Empires/game/calendar/calendar_system.py +169 -0
- Shadows_of_Empires/game/climate/climate_system.py +176 -0
- Shadows_of_Empires/game/crisis/crisis_management.py +386 -0
- Shadows_of_Empires/game/demographics/population_system.py +261 -0
- Shadows_of_Empires/game/game.py +740 -0
- Shadows_of_Empires/game/game_state.py +314 -0
- Shadows_of_Empires/game/succession/succession_system.py +310 -0
- Shadows_of_Empires/game/technology/research_system.py +700 -0
- Shadows_of_Empires/main.py +53 -0
- Shadows_of_Empires/plugins/advanced_diplomacy_plugin.py +395 -0
- Shadows_of_Empires/plugins/plugin_manager.py +143 -0
- Shadows_of_Empires/st_txt.text +0 -0
- Shadows_of_Empires/structure.txt +194 -0
- Shadows_of_Empires/ui/colors.py +140 -0
- Shadows_of_Empires/ui/console_ui.py +430 -0
- Shadows_of_Empires/utils/helpers.py +180 -0
Shadows_of_Empires/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright 2025 ysnrfd
|
| 2 |
+
|
| 3 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 4 |
+
of this software and associated documentation files (the "Software"), to use,
|
| 5 |
+
copy, modify, and distribute the Software, subject to the following conditions:
|
| 6 |
+
|
| 7 |
+
1. The copyright notice, this permission notice, and all attribution information
|
| 8 |
+
regarding the original author (ysnrfd) must be preserved in their entirety
|
| 9 |
+
and must not be removed, altered, or obscured in any copies or derivative works.
|
| 10 |
+
|
| 11 |
+
2. Any modifications or derivative works must be clearly documented in a "CHANGELOG" or
|
| 12 |
+
"NOTICE" file included with the Software. This documentation must include a detailed
|
| 13 |
+
description of the changes made, the date of the modification, and the identity of
|
| 14 |
+
the modifier.
|
| 15 |
+
|
| 16 |
+
3. The Software is provided "as is", without warranty of any kind, express or implied.
|
| 17 |
+
The author shall not be liable for any damages arising from use of the Software.
|
| 18 |
+
|
| 19 |
+
4. Any attempt to remove or alter the original attribution or copyright information
|
| 20 |
+
constitutes a violation of this license and may result in legal action.
|
Shadows_of_Empires/config.py
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
فایل تنظیمات مرکزی برای بازی
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
# تنظیمات کلی بازی
|
| 6 |
+
GAME_CONFIG = {
|
| 7 |
+
"initial_year": 1500,
|
| 8 |
+
"max_year": 2000,
|
| 9 |
+
"victory_conditions": {
|
| 10 |
+
"world_domination": 12, # تعداد کشورهای تحت کنترل
|
| 11 |
+
"economic_domination": 500000, # حداقل سکه طلا
|
| 12 |
+
"cultural_domination": 90, # حداقل امتیاز فرهنگی
|
| 13 |
+
"technological_domination": 8, # حداقل سطح فناوری
|
| 14 |
+
"religious_domination": 75 # درصد گسترش دین
|
| 15 |
+
},
|
| 16 |
+
"event_probability": {
|
| 17 |
+
"common": 0.7, # احتمال وقوع رویدادهای رایج
|
| 18 |
+
"rare": 0.3, # احتمال وقوع رویدادهای نادر
|
| 19 |
+
"historical": 0.1 # احتمال وقوع رویدادهای تاریخی
|
| 20 |
+
},
|
| 21 |
+
"auto_save_interval": 1, # هر چند سال ذخیره خودکار انجام شود
|
| 22 |
+
"max_history_length": 100, # حداکثر طول تاریخچه رویدادها
|
| 23 |
+
"difficulty_levels": {
|
| 24 |
+
"easy": {
|
| 25 |
+
"stability_factor": 1.2,
|
| 26 |
+
"economy_factor": 1.3,
|
| 27 |
+
"military_factor": 0.8
|
| 28 |
+
},
|
| 29 |
+
"normal": {
|
| 30 |
+
"stability_factor": 1.0,
|
| 31 |
+
"economy_factor": 1.0,
|
| 32 |
+
"military_factor": 1.0
|
| 33 |
+
},
|
| 34 |
+
"hard": {
|
| 35 |
+
"stability_factor": 0.8,
|
| 36 |
+
"economy_factor": 0.9,
|
| 37 |
+
"military_factor": 1.2
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
# تنظیمات رابط کاربری
|
| 43 |
+
UI_CONFIG = {
|
| 44 |
+
"use_color": True,
|
| 45 |
+
"display_width": 120,
|
| 46 |
+
"animation_speed": 0.03,
|
| 47 |
+
"show_tooltips": True,
|
| 48 |
+
"language": "fa" # fa: فارسی، en: انگلیسی
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
# تنظیمات پیشرفته
|
| 52 |
+
ADVANCED_CONFIG = {
|
| 53 |
+
"debug_mode": False,
|
| 54 |
+
"save_file": "saves/latest_save.json",
|
| 55 |
+
"log_file": "logs/game.log",
|
| 56 |
+
"max_save_slots": 10,
|
| 57 |
+
"autosave_slots": 5,
|
| 58 |
+
"max_undo_steps": 5,
|
| 59 |
+
"random_seed": None
|
| 60 |
+
}
|
Shadows_of_Empires/data/countries/base_count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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
تعریف کشورهای پایه برای بازی
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
COUNTRIES = [
|
| 6 |
+
{
|
| 7 |
+
"id": 1,
|
| 8 |
+
"name": "پرتغال",
|
| 9 |
+
"description": "کشور پیشرو در اکتشافات دریایی، دارای ثروت و قدرت تجاری",
|
| 10 |
+
"region": "Mediterranean",
|
| 11 |
+
"calendar": "Gregorian",
|
| 12 |
+
"starting_year": 1500,
|
| 13 |
+
"base_attributes": {
|
| 14 |
+
"population": 1.5,
|
| 15 |
+
"economy": {"trade": 85, "agriculture": 40, "industry": 30},
|
| 16 |
+
"military": {"army": 40, "navy": 90, "tech": 60},
|
| 17 |
+
"stability": 75,
|
| 18 |
+
"gold": 18000,
|
| 19 |
+
"culture": 65,
|
| 20 |
+
"religion": "مسیحی",
|
| 21 |
+
"birth_rate": 28,
|
| 22 |
+
"death_rate": 12,
|
| 23 |
+
"migration_rate": 5
|
| 24 |
+
},
|
| 25 |
+
"population_profile": {
|
| 26 |
+
"age_distribution": {"0-14": 30, "15-64": 62, "65+": 8}
|
| 27 |
+
},
|
| 28 |
+
"starting_relations": {
|
| 29 |
+
"اسپانیا": -30,
|
| 30 |
+
"انگلستان": 50,
|
| 31 |
+
"فرانسه": 40
|
| 32 |
+
},
|
| 33 |
+
"unique_trait": "اکتشافگر دریایی: +20% درآمد تجاری",
|
| 34 |
+
"historical_events": [
|
| 35 |
+
{
|
| 36 |
+
"year": 1500,
|
| 37 |
+
"name": "کشف سواحل برزیل",
|
| 38 |
+
"description": "کاشفان پرتغالی سواحل برزیل را کشف کردند.",
|
| 39 |
+
"choices": [
|
| 40 |
+
{
|
| 41 |
+
"text": "ارسال اکسپدیسیون بزرگ برای استعمار",
|
| 42 |
+
"effects": {
|
| 43 |
+
"gold": -8000,
|
| 44 |
+
"economy": {"trade": 15},
|
| 45 |
+
"controlled_territories": 1
|
| 46 |
+
},
|
| 47 |
+
"description": "سرمایهگذاری در استعمار برزیل با هزینه بالا."
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"text": "مذاکره با اسپانیا برای تقسیم مناطق",
|
| 51 |
+
"effects": {
|
| 52 |
+
"gold": -3000,
|
| 53 |
+
"relations": {"+": 10},
|
| 54 |
+
"economy": {"trade": 5}
|
| 55 |
+
},
|
| 56 |
+
"description": "استفاده از دیپلماسی برای کاهش هزینههای استعمار."
|
| 57 |
+
}
|
| 58 |
+
]
|
| 59 |
+
}
|
| 60 |
+
]
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"id": 2,
|
| 64 |
+
"name": "اسپانیا",
|
| 65 |
+
"description": "امپراتوری بزرگ با مستعمرات گسترده، دارای ارتش قدرتمند",
|
| 66 |
+
"region": "Mediterranean",
|
| 67 |
+
"calendar": "Gregorian",
|
| 68 |
+
"starting_year": 1500,
|
| 69 |
+
"base_attributes": {
|
| 70 |
+
"population": 5.0,
|
| 71 |
+
"economy": {"trade": 70, "agriculture": 60, "industry": 40},
|
| 72 |
+
"military": {"army": 85, "navy": 75, "tech": 50},
|
| 73 |
+
"stability": 65,
|
| 74 |
+
"gold": 22000,
|
| 75 |
+
"culture": 70,
|
| 76 |
+
"religion": "مسیحی",
|
| 77 |
+
"birth_rate": 30,
|
| 78 |
+
"death_rate": 15,
|
| 79 |
+
"migration_rate": -2
|
| 80 |
+
},
|
| 81 |
+
"population_profile": {
|
| 82 |
+
"age_distribution": {"0-14": 32, "15-64": 60, "65+": 8}
|
| 83 |
+
},
|
| 84 |
+
"starting_relations": {
|
| 85 |
+
"پرتغال": -30,
|
| 86 |
+
"فرانسه": -20,
|
| 87 |
+
"انگلستان": -40
|
| 88 |
+
},
|
| 89 |
+
"unique_trait": "امپراتوری مستعمرهای: +15% درآمد از مناطق تحت کنترل",
|
| 90 |
+
"historical_events": [
|
| 91 |
+
{
|
| 92 |
+
"year": 1492,
|
| 93 |
+
"name": "اکتشاف آمریکا",
|
| 94 |
+
"description": "کریستف کلمب سرزمینهای آمریکایی را کشف کرد.",
|
| 95 |
+
"choices": [
|
| 96 |
+
{
|
| 97 |
+
"text": "سرمایهگذاری گسترده در استعمار",
|
| 98 |
+
"effects": {
|
| 99 |
+
"gold": -10000,
|
| 100 |
+
"economy": {"trade": 20},
|
| 101 |
+
"controlled_territories": 2
|
| 102 |
+
},
|
| 103 |
+
"description": "ایجاد مستعمرات گسترده در آمریکا با هزینه بالا."
|
| 104 |
+
},
|
| 105 |
+
{
|
| 106 |
+
"text": "تمرکز بر استخراج منابع طلا و نقره",
|
| 107 |
+
"effects": {
|
| 108 |
+
"gold": 15000,
|
| 109 |
+
"public_dissatisfaction": 15,
|
| 110 |
+
"relations": {"-": 10}
|
| 111 |
+
},
|
| 112 |
+
"description": "استخراج سریع منابع با پیامدهای اجتماعی و دیپلماتیک."
|
| 113 |
+
}
|
| 114 |
+
]
|
| 115 |
+
}
|
| 116 |
+
]
|
| 117 |
+
},
|
| 118 |
+
{
|
| 119 |
+
"id": 3,
|
| 120 |
+
"name": "انگلستان",
|
| 121 |
+
"description": "کشور در حال رشد با ناوگان دریایی قوی، دارای پتانسیل تجاری بالا",
|
| 122 |
+
"region": "Temperate",
|
| 123 |
+
"calendar": "Gregorian",
|
| 124 |
+
"starting_year": 1500,
|
| 125 |
+
"base_attributes": {
|
| 126 |
+
"population": 3.0,
|
| 127 |
+
"economy": {"trade": 90, "agriculture": 50, "industry": 50},
|
| 128 |
+
"military": {"army": 60, "navy": 85, "tech": 70},
|
| 129 |
+
"stability": 80,
|
| 130 |
+
"gold": 16000,
|
| 131 |
+
"culture": 75,
|
| 132 |
+
"religion": "مسیحی",
|
| 133 |
+
"birth_rate": 25,
|
| 134 |
+
"death_rate": 10,
|
| 135 |
+
"migration_rate": 8
|
| 136 |
+
},
|
| 137 |
+
"population_profile": {
|
| 138 |
+
"age_distribution": {"0-14": 28, "15-64": 65, "65+": 7}
|
| 139 |
+
},
|
| 140 |
+
"starting_relations": {
|
| 141 |
+
"اسپانیا": -40,
|
| 142 |
+
"فرانسه": -30,
|
| 143 |
+
"پرتغال": 50
|
| 144 |
+
},
|
| 145 |
+
"unique_trait": "ناوگان دریایی برتر: +25% قدرت نظامی در دریا",
|
| 146 |
+
"historical_events": [
|
| 147 |
+
{
|
| 148 |
+
"year": 1534,
|
| 149 |
+
"name": "انفصال از کلیسای کاتولیک",
|
| 150 |
+
"description": "هنری هشتم انگلستان را از کلیسای کاتولیک جدا کرد.",
|
| 151 |
+
"choices": [
|
| 152 |
+
{
|
| 153 |
+
"text": "تقویت کلیسای انگلیسی",
|
| 154 |
+
"effects": {
|
| 155 |
+
"religion": "Anglicanism",
|
| 156 |
+
"political_stability": 10,
|
| 157 |
+
"relations": {"-": 20}
|
| 158 |
+
},
|
| 159 |
+
"description": "ایجاد کلیسای ملی انگلیسی با تأثیرات سیاسی و دیپلماتیک."
|
| 160 |
+
},
|
| 161 |
+
{
|
| 162 |
+
"text": "حفظ روابط با پاپ",
|
| 163 |
+
"effects": {
|
| 164 |
+
"public_dissatisfaction": 25,
|
| 165 |
+
"political_stability": -15
|
| 166 |
+
},
|
| 167 |
+
"description": "تلاش برای حفظ روابط با کلیسای کاتولیک با پیامدهای داخلی."
|
| 168 |
+
}
|
| 169 |
+
]
|
| 170 |
+
}
|
| 171 |
+
]
|
| 172 |
+
},
|
| 173 |
+
{
|
| 174 |
+
"id": 4,
|
| 175 |
+
"name": "فرانسه",
|
| 176 |
+
"description": "کشور قدرتمند با ارتش قوی و فرهنگ غنی، دارای قلمرو گسترده",
|
| 177 |
+
"region": "Mediterranean",
|
| 178 |
+
"calendar": "Gregorian",
|
| 179 |
+
"starting_year": 1500,
|
| 180 |
+
"base_attributes": {
|
| 181 |
+
"population": 6.0,
|
| 182 |
+
"economy": {"trade": 60, "agriculture": 70, "industry": 60},
|
| 183 |
+
"military": {"army": 80, "navy": 50, "tech": 65},
|
| 184 |
+
"stability": 70,
|
| 185 |
+
"gold": 20000,
|
| 186 |
+
"culture": 85,
|
| 187 |
+
"religion": "مسیحی",
|
| 188 |
+
"birth_rate": 26,
|
| 189 |
+
"death_rate": 12,
|
| 190 |
+
"migration_rate": 3
|
| 191 |
+
},
|
| 192 |
+
"population_profile": {
|
| 193 |
+
"age_distribution": {"0-14": 26, "15-64": 66, "65+": 8}
|
| 194 |
+
},
|
| 195 |
+
"starting_relations": {
|
| 196 |
+
"اسپانیا": -20,
|
| 197 |
+
"انگلستان": -30,
|
| 198 |
+
"پادشاهی مقدس روم": 40
|
| 199 |
+
},
|
| 200 |
+
"unique_trait": "فرهنگ تأثیرگذار: +20% سرعت گسترش فرهنگ",
|
| 201 |
+
"historical_events": [
|
| 202 |
+
{
|
| 203 |
+
"year": 1562,
|
| 204 |
+
"name": "جنگهای دینی",
|
| 205 |
+
"description": "جنگهای داخلی بین کاتولیکها و پروتستانها آغاز شد.",
|
| 206 |
+
"choices": [
|
| 207 |
+
{
|
| 208 |
+
"text": "حمایت از کاتولیکها",
|
| 209 |
+
"effects": {
|
| 210 |
+
"religion": "Catholicism",
|
| 211 |
+
"political_stability": 5,
|
| 212 |
+
"public_dissatisfaction": 15
|
| 213 |
+
},
|
| 214 |
+
"description": "حمایت از گروه اکثریت با ایجاد نارضایتی در گروه اقلیت."
|
| 215 |
+
},
|
| 216 |
+
{
|
| 217 |
+
"text": "حمایت از پروتستانها",
|
| 218 |
+
"effects": {
|
| 219 |
+
"religion": "Protestantism",
|
| 220 |
+
"relations": {"-": 25},
|
| 221 |
+
"political_stability": -10
|
| 222 |
+
},
|
| 223 |
+
"description": "حمایت از گروه اقلیت با خطر شورش و تنشهای بینالمللی."
|
| 224 |
+
},
|
| 225 |
+
{
|
| 226 |
+
"text": "اعلان بیطرفی و تلاش برای صلح",
|
| 227 |
+
"effects": {
|
| 228 |
+
"political_stability": -5,
|
| 229 |
+
"diplomacy_points": 10
|
| 230 |
+
},
|
| 231 |
+
"description": "تلاش برای حل و فصل صلحآمیز با پیامدهای سیاسی."
|
| 232 |
+
}
|
| 233 |
+
]
|
| 234 |
+
}
|
| 235 |
+
]
|
| 236 |
+
},
|
| 237 |
+
{
|
| 238 |
+
"id": 5,
|
| 239 |
+
"name": "آلمان",
|
| 240 |
+
"description": "کشور در حال ظهور با اقتصاد قوی، دارای پتانسیل نظامی بالا",
|
| 241 |
+
"region": "Temperate",
|
| 242 |
+
"calendar": "Gregorian",
|
| 243 |
+
"starting_year": 1500,
|
| 244 |
+
"base_attributes": {
|
| 245 |
+
"population": 4.0,
|
| 246 |
+
"economy": {"trade": 50, "agriculture": 45, "industry": 75},
|
| 247 |
+
"military": {"army": 70, "navy": 30, "tech": 80},
|
| 248 |
+
"stability": 60,
|
| 249 |
+
"gold": 14000,
|
| 250 |
+
"culture": 60,
|
| 251 |
+
"religion": "مسیحی",
|
| 252 |
+
"birth_rate": 24,
|
| 253 |
+
"death_rate": 11,
|
| 254 |
+
"migration_rate": 2
|
| 255 |
+
},
|
| 256 |
+
"population_profile": {
|
| 257 |
+
"age_distribution": {"0-14": 27, "15-64": 64, "65+": 9}
|
| 258 |
+
},
|
| 259 |
+
"starting_relations": {
|
| 260 |
+
"پادشاهی مقدس روم": 50,
|
| 261 |
+
"فرانسه": -30,
|
| 262 |
+
"روسیه": 20
|
| 263 |
+
},
|
| 264 |
+
"unique_trait": "صنعت پیشرفته: +15% سرعت فناوری صنعتی",
|
| 265 |
+
"historical_events": [
|
| 266 |
+
{
|
| 267 |
+
"year": 1517,
|
| 268 |
+
"name": "اصلاحات مارتن لوتر",
|
| 269 |
+
"description": "مارتن لوتر با انتشار 95 مقاله، اصلاحات پروتستانتی را آغاز کرد.",
|
| 270 |
+
"choices": [
|
| 271 |
+
{
|
| 272 |
+
"text": "حمایت از اصلاحات",
|
| 273 |
+
"effects": {
|
| 274 |
+
"religion": "Protestantism",
|
| 275 |
+
"political_stability": -10,
|
| 276 |
+
"culture_score": 10
|
| 277 |
+
},
|
| 278 |
+
"description": "حمایت از اصلاحات با خطر شورش و تغییرات فرهنگی."
|
| 279 |
+
},
|
| 280 |
+
{
|
| 281 |
+
"text": "مبارزه با اصلاحات",
|
| 282 |
+
"effects": {
|
| 283 |
+
"religion": "Catholicism",
|
| 284 |
+
"relations": {"-": 15},
|
| 285 |
+
"public_dissatisfaction": 10
|
| 286 |
+
},
|
| 287 |
+
"description": "مبارزه با اصلاحات با ایجاد تنشهای داخلی و خارجی."
|
| 288 |
+
}
|
| 289 |
+
]
|
| 290 |
+
}
|
| 291 |
+
]
|
| 292 |
+
},
|
| 293 |
+
{
|
| 294 |
+
"id": 6,
|
| 295 |
+
"name": "پایمان",
|
| 296 |
+
"description": "کشور ثروتمند و با فرهنگ غنی در اروپای شرقی",
|
| 297 |
+
"region": "Temperate",
|
| 298 |
+
"calendar": "Gregorian",
|
| 299 |
+
"starting_year": 1500,
|
| 300 |
+
"base_attributes": {
|
| 301 |
+
"population": 2.0,
|
| 302 |
+
"economy": {"trade": 40, "agriculture": 55, "industry": 40},
|
| 303 |
+
"military": {"army": 50, "navy": 20, "tech": 45},
|
| 304 |
+
"stability": 65,
|
| 305 |
+
"gold": 12000,
|
| 306 |
+
"culture": 70,
|
| 307 |
+
"religion": "مسیحی ارتدوکس",
|
| 308 |
+
"birth_rate": 27,
|
| 309 |
+
"death_rate": 13,
|
| 310 |
+
"migration_rate": 0
|
| 311 |
+
},
|
| 312 |
+
"population_profile": {
|
| 313 |
+
"age_distribution": {"0-14": 29, "15-64": 63, "65+": 8}
|
| 314 |
+
},
|
| 315 |
+
"starting_relations": {
|
| 316 |
+
"روسیه": 30,
|
| 317 |
+
"ترکیه": -40,
|
| 318 |
+
"یونان": 20
|
| 319 |
+
},
|
| 320 |
+
"unique_trait": "مرزهای استراتژیک: +10% دفاع در جنگ",
|
| 321 |
+
"historical_events": [
|
| 322 |
+
{
|
| 323 |
+
"year": 1526,
|
| 324 |
+
"name": "نبرد موحاس",
|
| 325 |
+
"description": "نبرد مهم با امپراتوری عثمانی در موحاس رخ داد.",
|
| 326 |
+
"choices": [
|
| 327 |
+
{
|
| 328 |
+
"text": "شکست عثمانیها",
|
| 329 |
+
"effects": {
|
| 330 |
+
"military_strength": 15,
|
| 331 |
+
"controlled_territories": 1,
|
| 332 |
+
"public_dissatisfaction": -10
|
| 333 |
+
},
|
| 334 |
+
"description": "پیروزی در نبرد با افزایش قلمرو و معنویه."
|
| 335 |
+
},
|
| 336 |
+
{
|
| 337 |
+
"text": "شکست و اشغال توسط عثمانیها",
|
| 338 |
+
"effects": {
|
| 339 |
+
"controlled_territories": -1,
|
| 340 |
+
"political_stability": -20,
|
| 341 |
+
"gold": -5000
|
| 342 |
+
},
|
| 343 |
+
"description": "شکست در نبرد با کاهش قلمرو و ثبات."
|
| 344 |
+
}
|
| 345 |
+
]
|
| 346 |
+
}
|
| 347 |
+
]
|
| 348 |
+
},
|
| 349 |
+
{
|
| 350 |
+
"id": 7,
|
| 351 |
+
"name": "پادشاهی مقدس روم",
|
| 352 |
+
"description": "مجموعهای از دولتهای کوچک، با قدرت سیاسی محدود",
|
| 353 |
+
"region": "Temperate",
|
| 354 |
+
"calendar": "Gregorian",
|
| 355 |
+
"starting_year": 1500,
|
| 356 |
+
"base_attributes": {
|
| 357 |
+
"population": 8.0,
|
| 358 |
+
"economy": {"trade": 55, "agriculture": 60, "industry": 35},
|
| 359 |
+
"military": {"army": 65, "navy": 25, "tech": 50},
|
| 360 |
+
"stability": 50,
|
| 361 |
+
"gold": 10000,
|
| 362 |
+
"culture": 65,
|
| 363 |
+
"religion": "مسیحی",
|
| 364 |
+
"birth_rate": 25,
|
| 365 |
+
"death_rate": 14,
|
| 366 |
+
"migration_rate": -1
|
| 367 |
+
},
|
| 368 |
+
"population_profile": {
|
| 369 |
+
"age_distribution": {"0-14": 30, "15-64": 60, "65+": 10}
|
| 370 |
+
},
|
| 371 |
+
"starting_relations": {
|
| 372 |
+
"فرانسه": 40,
|
| 373 |
+
"آلمان": 50,
|
| 374 |
+
"اسپانیا": -20
|
| 375 |
+
},
|
| 376 |
+
"unique_trait": "اتحاد سیاسی: +5 امتیاز دیپلماسی در مذاکرات",
|
| 377 |
+
"historical_events": [
|
| 378 |
+
{
|
| 379 |
+
"year": 1555,
|
| 380 |
+
"name": "صلح آوسپورگ",
|
| 381 |
+
"description": "صلح آوسپورگ برای خاتمه دادن به جنگهای دینی امضا شد.",
|
| 382 |
+
"choices": [
|
| 383 |
+
{
|
| 384 |
+
"text": "پذیرش آزادی دینی",
|
| 385 |
+
"effects": {
|
| 386 |
+
"political_stability": 15,
|
| 387 |
+
"public_dissatisfaction": -10,
|
| 388 |
+
"religion": "Multi-religious"
|
| 389 |
+
},
|
| 390 |
+
"description": "پذیرش تنوع دینی با افزایش ثبات داخلی."
|
| 391 |
+
},
|
| 392 |
+
{
|
| 393 |
+
"text": "ادامه سیاست یکدستی دینی",
|
| 394 |
+
"effects": {
|
| 395 |
+
"political_stability": -10,
|
| 396 |
+
"relations": {"-": 15},
|
| 397 |
+
"public_dissatisfaction": 15
|
| 398 |
+
},
|
| 399 |
+
"description": "ادامه سیاست یکدستی دینی با خطر شورش و تنشهای خارجی."
|
| 400 |
+
}
|
| 401 |
+
]
|
| 402 |
+
}
|
| 403 |
+
]
|
| 404 |
+
},
|
| 405 |
+
{
|
| 406 |
+
"id": 8,
|
| 407 |
+
"name": "پادشاهی نپال",
|
| 408 |
+
"description": "کشوری کوهستانی با فرهنگ غنی و موقعیت استراتژیک",
|
| 409 |
+
"region": "Tropical",
|
| 410 |
+
"calendar": "Vikram Samvat",
|
| 411 |
+
"starting_year": 1957, # تقویم ویکرام سمبات
|
| 412 |
+
"base_attributes": {
|
| 413 |
+
"population": 1.0,
|
| 414 |
+
"economy": {"trade": 30, "agriculture": 40, "industry": 20},
|
| 415 |
+
"military": {"army": 55, "navy": 5, "tech": 30},
|
| 416 |
+
"stability": 70,
|
| 417 |
+
"gold": 8000,
|
| 418 |
+
"culture": 75,
|
| 419 |
+
"religion": "هندو",
|
| 420 |
+
"birth_rate": 35,
|
| 421 |
+
"death_rate": 18,
|
| 422 |
+
"migration_rate": -3
|
| 423 |
+
},
|
| 424 |
+
"population_profile": {
|
| 425 |
+
"age_distribution": {"0-14": 35, "15-64": 58, "65+": 7}
|
| 426 |
+
},
|
| 427 |
+
"starting_relations": {
|
| 428 |
+
"هندوستان": 60,
|
| 429 |
+
"چین": 40,
|
| 430 |
+
"روسیه": 20
|
| 431 |
+
},
|
| 432 |
+
"unique_trait": "دفاع کوهستانی: +20% قدرت دفاعی",
|
| 433 |
+
"historical_events": [
|
| 434 |
+
{
|
| 435 |
+
"year": 1814,
|
| 436 |
+
"name": "جنگ انگلیس و نپال",
|
| 437 |
+
"description": "جنگ با امپراتوری بریتانیا بر سر مرزها آغاز شد.",
|
| 438 |
+
"choices": [
|
| 439 |
+
{
|
| 440 |
+
"text": "مقاومت کامل",
|
| 441 |
+
"effects": {
|
| 442 |
+
"military_strength": -15,
|
| 443 |
+
"controlled_territories": -1,
|
| 444 |
+
"political_stability": -10
|
| 445 |
+
},
|
| 446 |
+
"description": "مقاومت در برابر نیروهای بریتانیایی با خسارات قابل توجه."
|
| 447 |
+
},
|
| 448 |
+
{
|
| 449 |
+
"text": "مذاکره برای صلح",
|
| 450 |
+
"effects": {
|
| 451 |
+
"relations": {"+": 5},
|
| 452 |
+
"controlled_territories": 0,
|
| 453 |
+
"gold": 2000
|
| 454 |
+
},
|
| 455 |
+
"description": "مذاکره برای صلح با حفظ قلمرو و دریافت غرامت."
|
| 456 |
+
}
|
| 457 |
+
]
|
| 458 |
+
}
|
| 459 |
+
]
|
| 460 |
+
},
|
| 461 |
+
{
|
| 462 |
+
"id": 9,
|
| 463 |
+
"name": "پادشاهی ژاپن",
|
| 464 |
+
"description": "کشوری جزیرهای با فرهنگ سنتی و ارتش قدرتمند",
|
| 465 |
+
"region": "Temperate",
|
| 466 |
+
"calendar": "Japanese era name system",
|
| 467 |
+
"starting_year": 1500,
|
| 468 |
+
"base_attributes": {
|
| 469 |
+
"population": 7.0,
|
| 470 |
+
"economy": {"trade": 65, "agriculture": 50, "industry": 60},
|
| 471 |
+
"military": {"army": 75, "navy": 70, "tech": 75},
|
| 472 |
+
"stability": 75,
|
| 473 |
+
"gold": 15000,
|
| 474 |
+
"culture": 80,
|
| 475 |
+
"religion": "شینتو",
|
| 476 |
+
"birth_rate": 22,
|
| 477 |
+
"death_rate": 10,
|
| 478 |
+
"migration_rate": -2
|
| 479 |
+
},
|
| 480 |
+
"population_profile": {
|
| 481 |
+
"age_distribution": {"0-14": 24, "15-64": 68, "65+": 8}
|
| 482 |
+
},
|
| 483 |
+
"starting_relations": {
|
| 484 |
+
"چین": -30,
|
| 485 |
+
"روسیه": -20,
|
| 486 |
+
"هندوستان": 40
|
| 487 |
+
},
|
| 488 |
+
"unique_trait": "سنتهای نظامی: +15% قدرت ارتش",
|
| 489 |
+
"historical_events": [
|
| 490 |
+
{
|
| 491 |
+
"year": 1543,
|
| 492 |
+
"name": "ورود اولین اروپاییها",
|
| 493 |
+
"description": "اولین اروپاییها (پرتغالیها) به ژاپن وارد شدند.",
|
| 494 |
+
"choices": [
|
| 495 |
+
{
|
| 496 |
+
"text": "باز کردن روابط تجاری",
|
| 497 |
+
"effects": {
|
| 498 |
+
"economy": {"trade": 15},
|
| 499 |
+
"technology": {"trade": 1},
|
| 500 |
+
"religion": "Mixed"
|
| 501 |
+
},
|
| 502 |
+
"description": "گشودن روابط تجاری با اروپا و ورود فناوریهای جدید."
|
| 503 |
+
},
|
| 504 |
+
{
|
| 505 |
+
"text": "بستن مرزها به اروپاییها",
|
| 506 |
+
"effects": {
|
| 507 |
+
"economy": {"trade": -5},
|
| 508 |
+
"political_stability": 5,
|
| 509 |
+
"technology": {"trade": -1}
|
| 510 |
+
},
|
| 511 |
+
"description": "بستن مرزها برای حفظ فرهنگ و ثبات داخلی."
|
| 512 |
+
}
|
| 513 |
+
]
|
| 514 |
+
}
|
| 515 |
+
]
|
| 516 |
+
},
|
| 517 |
+
{
|
| 518 |
+
"id": 10,
|
| 519 |
+
"name": "امپراتوری عثمانی",
|
| 520 |
+
"description": "امپراتوری بزرگ با قلمرو گسترده در خاورمیانه و شمال آفریقا",
|
| 521 |
+
"region": "Mediterranean",
|
| 522 |
+
"calendar": "Islamic calendar",
|
| 523 |
+
"starting_year": 1500,
|
| 524 |
+
"base_attributes": {
|
| 525 |
+
"population": 12.0,
|
| 526 |
+
"economy": {"trade": 60, "agriculture": 55, "industry": 40},
|
| 527 |
+
"military": {"army": 80, "navy": 65, "tech": 55},
|
| 528 |
+
"stability": 60,
|
| 529 |
+
"gold": 25000,
|
| 530 |
+
"culture": 70,
|
| 531 |
+
"religion": "اسلام",
|
| 532 |
+
"birth_rate": 32,
|
| 533 |
+
"death_rate": 16,
|
| 534 |
+
"migration_rate": 5
|
| 535 |
+
},
|
| 536 |
+
"population_profile": {
|
| 537 |
+
"age_distribution": {"0-14": 34, "15-64": 58, "65+": 8}
|
| 538 |
+
},
|
| 539 |
+
"starting_relations": {
|
| 540 |
+
"ایران": -50,
|
| 541 |
+
"مصر": 40,
|
| 542 |
+
"روسیه": -30
|
| 543 |
+
},
|
| 544 |
+
"unique_trait": "امپراتوری چندفرهنگی: +10% سرعت گسترش فرهنگ",
|
| 545 |
+
"historical_events": [
|
| 546 |
+
{
|
| 547 |
+
"year": 1520,
|
| 548 |
+
"name": "دوران طلایی عثمانیها",
|
| 549 |
+
"description": "دوران طلایی امپراتوری عثمانی تحت حکومت سلیمان قانونی آغاز شد.",
|
| 550 |
+
"choices": [
|
| 551 |
+
{
|
| 552 |
+
"text": "گسترش نظامی به اروپا",
|
| 553 |
+
"effects": {
|
| 554 |
+
"controlled_territories": 2,
|
| 555 |
+
"military_strength": -10,
|
| 556 |
+
"public_dissatisfaction": 15
|
| 557 |
+
},
|
| 558 |
+
"description": "حمله به اروپا برای گسترش قلمرو با هزینههای نظامی و اجتماعی."
|
| 559 |
+
},
|
| 560 |
+
{
|
| 561 |
+
"text": "تقویت اقتصاد و فرهنگ",
|
| 562 |
+
"effects": {
|
| 563 |
+
"economy": {"trade": 15, "industry": 10},
|
| 564 |
+
"culture_score": 15,
|
| 565 |
+
"political_stability": 10
|
| 566 |
+
},
|
| 567 |
+
"description": "تمرکز بر توسعه داخلی به جای گسترش نظامی."
|
| 568 |
+
}
|
| 569 |
+
]
|
| 570 |
+
}
|
| 571 |
+
]
|
| 572 |
+
},
|
| 573 |
+
{
|
| 574 |
+
"id": 11,
|
| 575 |
+
"name": "پادشاهی هندوستان",
|
| 576 |
+
"description": "کشوری با جمعیت زیاد و اقتصاد رو به رشد",
|
| 577 |
+
"region": "Tropical",
|
| 578 |
+
"calendar": "Vikram Samvat",
|
| 579 |
+
"starting_year": 1500,
|
| 580 |
+
"base_attributes": {
|
| 581 |
+
"population": 15.0,
|
| 582 |
+
"economy": {"trade": 50, "agriculture": 70, "industry": 35},
|
| 583 |
+
"military": {"army": 65, "navy": 50, "tech": 45},
|
| 584 |
+
"stability": 55,
|
| 585 |
+
"gold": 18000,
|
| 586 |
+
"culture": 85,
|
| 587 |
+
"religion": "هندو",
|
| 588 |
+
"birth_rate": 38,
|
| 589 |
+
"death_rate": 20,
|
| 590 |
+
"migration_rate": 2
|
| 591 |
+
},
|
| 592 |
+
"population_profile": {
|
| 593 |
+
"age_distribution": {"0-14": 36, "15-64": 57, "65+": 7}
|
| 594 |
+
},
|
| 595 |
+
"starting_relations": {
|
| 596 |
+
"نپال": 60,
|
| 597 |
+
"چین": 30,
|
| 598 |
+
"پرتغال": 20
|
| 599 |
+
},
|
| 600 |
+
"unique_trait": "جمعیت عظیم: +5% رشد جمعیت",
|
| 601 |
+
"historical_events": [
|
| 602 |
+
{
|
| 603 |
+
"year": 1526,
|
| 604 |
+
"name": "تاسیس امپراتوری گورکانی",
|
| 605 |
+
"description": "بابر امپراتوری گورکانی را در هند تأسیس کرد.",
|
| 606 |
+
"choices": [
|
| 607 |
+
{
|
| 608 |
+
"text": "حمایت از امپراتوری گورکانی",
|
| 609 |
+
"effects": {
|
| 610 |
+
"controlled_territories": 3,
|
| 611 |
+
"political_stability": -5,
|
| 612 |
+
"religion": "Mixed"
|
| 613 |
+
},
|
| 614 |
+
"description": "حمایت از امپراتوری گورکانی با گسترش قلمرو و تغییرات دینی."
|
| 615 |
+
},
|
| 616 |
+
{
|
| 617 |
+
"text": "مقاومت در برابر گورکانیها",
|
| 618 |
+
"effects": {
|
| 619 |
+
"controlled_territories": -1,
|
| 620 |
+
"military_strength": -10,
|
| 621 |
+
"public_dissatisfaction": 10
|
| 622 |
+
},
|
| 623 |
+
"description": "مقاومت در برابر گورکانیها با کاهش قلمرو و قدرت نظامی."
|
| 624 |
+
}
|
| 625 |
+
]
|
| 626 |
+
}
|
| 627 |
+
]
|
| 628 |
+
},
|
| 629 |
+
{
|
| 630 |
+
"id": 12,
|
| 631 |
+
"name": "پادشاهی چین",
|
| 632 |
+
"description": "امپراتوری باستانی با فرهنگ غنی و ارتش بزرگ",
|
| 633 |
+
"region": "Temperate",
|
| 634 |
+
"calendar": "Chinese calendar",
|
| 635 |
+
"starting_year": 1500,
|
| 636 |
+
"base_attributes": {
|
| 637 |
+
"population": 20.0,
|
| 638 |
+
"economy": {"trade": 55, "agriculture": 65, "industry": 50},
|
| 639 |
+
"military": {"army": 75, "navy": 45, "tech": 60},
|
| 640 |
+
"stability": 65,
|
| 641 |
+
"gold": 22000,
|
| 642 |
+
"culture": 90,
|
| 643 |
+
"religion": "کنفوسیوسی",
|
| 644 |
+
"birth_rate": 28,
|
| 645 |
+
"death_rate": 14,
|
| 646 |
+
"migration_rate": -1
|
| 647 |
+
},
|
| 648 |
+
"population_profile": {
|
| 649 |
+
"age_distribution": {"0-14": 30, "15-64": 62, "65+": 8}
|
| 650 |
+
},
|
| 651 |
+
"starting_relations": {
|
| 652 |
+
"ژاپن": -30,
|
| 653 |
+
"هندوستان": 30,
|
| 654 |
+
"روسیه": 20
|
| 655 |
+
},
|
| 656 |
+
"unique_trait": "فرهنگ باستانی: +25% سرعت گسترش فرهنگ",
|
| 657 |
+
"historical_events": [
|
| 658 |
+
{
|
| 659 |
+
"year": 1550,
|
| 660 |
+
"name": "حملات ژاپنیها",
|
| 661 |
+
"description": "قزاقان ژاپنی (واکو) به سواحل چین حمله کردند.",
|
| 662 |
+
"choices": [
|
| 663 |
+
{
|
| 664 |
+
"text": "ساخت دیوار چین",
|
| 665 |
+
"effects": {
|
| 666 |
+
"gold": -10000,
|
| 667 |
+
"military_strength": 15,
|
| 668 |
+
"economy": {"agriculture": -5}
|
| 669 |
+
},
|
| 670 |
+
"description": "ساخت دیوار چین برای دفاع با هزینههای اقتصادی."
|
| 671 |
+
},
|
| 672 |
+
{
|
| 673 |
+
"text": "مذاکره با ژاپن",
|
| 674 |
+
"effects": {
|
| 675 |
+
"relations": {"+": 10},
|
| 676 |
+
"economy": {"trade": 10},
|
| 677 |
+
"public_dissatisfaction": 5
|
| 678 |
+
},
|
| 679 |
+
"description": "مذاکره برای صلح و گشایش روابط تجاری."
|
| 680 |
+
}
|
| 681 |
+
]
|
| 682 |
+
}
|
| 683 |
+
]
|
| 684 |
+
},
|
| 685 |
+
{
|
| 686 |
+
"id": 13,
|
| 687 |
+
"name": "پادشاهی روسیه",
|
| 688 |
+
"description": "کشوری بزرگ با قلمرو وسیع و منابع طبیعی فراوان",
|
| 689 |
+
"region": "Polar",
|
| 690 |
+
"calendar": "Julian calendar",
|
| 691 |
+
"starting_year": 1500,
|
| 692 |
+
"base_attributes": {
|
| 693 |
+
"population": 10.0,
|
| 694 |
+
"economy": {"trade": 40, "agriculture": 50, "industry": 45},
|
| 695 |
+
"military": {"army": 70, "navy": 40, "tech": 50},
|
| 696 |
+
"stability": 50,
|
| 697 |
+
"gold": 14000,
|
| 698 |
+
"culture": 60,
|
| 699 |
+
"religion": "مسیحی ارتدوکس",
|
| 700 |
+
"birth_rate": 26,
|
| 701 |
+
"death_rate": 15,
|
| 702 |
+
"migration_rate": 0
|
| 703 |
+
},
|
| 704 |
+
"population_profile": {
|
| 705 |
+
"age_distribution": {"0-14": 28, "15-64": 63, "65+": 9}
|
| 706 |
+
},
|
| 707 |
+
"starting_relations": {
|
| 708 |
+
"ترکیه": -30,
|
| 709 |
+
"سوئد": -20,
|
| 710 |
+
"چین": 20
|
| 711 |
+
},
|
| 712 |
+
"unique_trait": "منابع طبیعی فراوان: +15% درآمد از منابع",
|
| 713 |
+
"historical_events": [
|
| 714 |
+
{
|
| 715 |
+
"year": 1547,
|
| 716 |
+
"name": "تاجگذاری ایوان سوم",
|
| 717 |
+
"description": "ایوان سوم خود را به عنوان تزار روسیه تاجگذاری کرد.",
|
| 718 |
+
"choices": [
|
| 719 |
+
{
|
| 720 |
+
"text": "گسترش به سمت آسیا",
|
| 721 |
+
"effects": {
|
| 722 |
+
"controlled_territories": 2,
|
| 723 |
+
"military_strength": -10,
|
| 724 |
+
"public_dissatisfaction": 10
|
| 725 |
+
},
|
| 726 |
+
"description": "گسترش قلمرو به سمت سیبری و آسیا."
|
| 727 |
+
},
|
| 728 |
+
{
|
| 729 |
+
"text": "تمرکز بر اروپا",
|
| 730 |
+
"effects": {
|
| 731 |
+
"relations": {"+": 15},
|
| 732 |
+
"economy": {"trade": 10},
|
| 733 |
+
"political_stability": 5
|
| 734 |
+
},
|
| 735 |
+
"description": "تقویت روابط با کشورهای اروپایی."
|
| 736 |
+
}
|
| 737 |
+
]
|
| 738 |
+
}
|
| 739 |
+
]
|
| 740 |
+
},
|
| 741 |
+
{
|
| 742 |
+
"id": 14,
|
| 743 |
+
"name": "پادشاهی یونان",
|
| 744 |
+
"description": "کشوری باستانی با فرهنگ غنی و موقعیت استراتژیک",
|
| 745 |
+
"region": "Mediterranean",
|
| 746 |
+
"calendar": "Gregorian",
|
| 747 |
+
"starting_year": 1500,
|
| 748 |
+
"base_attributes": {
|
| 749 |
+
"population": 2.5,
|
| 750 |
+
"economy": {"trade": 50, "agriculture": 45, "industry": 35},
|
| 751 |
+
"military": {"army": 45, "navy": 55, "tech": 40},
|
| 752 |
+
"stability": 60,
|
| 753 |
+
"gold": 11000,
|
| 754 |
+
"culture": 80,
|
| 755 |
+
"religion": "مسیحی ارتدوکس",
|
| 756 |
+
"birth_rate": 24,
|
| 757 |
+
"death_rate": 12,
|
| 758 |
+
"migration_rate": 3
|
| 759 |
+
},
|
| 760 |
+
"population_profile": {
|
| 761 |
+
"age_distribution": {"0-14": 26, "15-64": 65, "65+": 9}
|
| 762 |
+
},
|
| 763 |
+
"starting_relations": {
|
| 764 |
+
"مصر": 30,
|
| 765 |
+
"ترکیه": -40,
|
| 766 |
+
"ایران": 20
|
| 767 |
+
},
|
| 768 |
+
"unique_trait": "فرهنگ باستانی: +15% سرعت گسترش فرهنگ",
|
| 769 |
+
"historical_events": [
|
| 770 |
+
{
|
| 771 |
+
"year": 1453,
|
| 772 |
+
"name": "فتاح قسطنطنیه",
|
| 773 |
+
"description": "قسطنطنیه توسط امپراتوری عثمانی فتح شد.",
|
| 774 |
+
"choices": [
|
| 775 |
+
{
|
| 776 |
+
"text": "مقاومت در برابر عثمانیها",
|
| 777 |
+
"effects": {
|
| 778 |
+
"controlled_territories": -2,
|
| 779 |
+
"military_strength": -15,
|
| 780 |
+
"political_stability": -20
|
| 781 |
+
},
|
| 782 |
+
"description": "شکست در مقابل عثمانیها و از دست دادن قلمرو."
|
| 783 |
+
},
|
| 784 |
+
{
|
| 785 |
+
"text": "همکاری با عثمانیها",
|
| 786 |
+
"effects": {
|
| 787 |
+
"relations": {"+": 20},
|
| 788 |
+
"political_stability": 10,
|
| 789 |
+
"culture_score": -10
|
| 790 |
+
},
|
| 791 |
+
"description": "همکاری با عثمانیها برای حفظ بقیه قلمرو."
|
| 792 |
+
}
|
| 793 |
+
]
|
| 794 |
+
}
|
| 795 |
+
]
|
| 796 |
+
},
|
| 797 |
+
{
|
| 798 |
+
"id": 15,
|
| 799 |
+
"name": "پادشاهی مصر",
|
| 800 |
+
"description": "کشوری باستانی با تاریخ طولانی و منابع طبیعی فراوان",
|
| 801 |
+
"region": "Desert",
|
| 802 |
+
"calendar": "Coptic calendar",
|
| 803 |
+
"starting_year": 1500,
|
| 804 |
+
"base_attributes": {
|
| 805 |
+
"population": 4.0,
|
| 806 |
+
"economy": {"trade": 45, "agriculture": 65, "industry": 30},
|
| 807 |
+
"military": {"army": 50, "navy": 40, "tech": 35},
|
| 808 |
+
"stability": 65,
|
| 809 |
+
"gold": 13000,
|
| 810 |
+
"culture": 75,
|
| 811 |
+
"religion": "اسلام",
|
| 812 |
+
"birth_rate": 33,
|
| 813 |
+
"death_rate": 17,
|
| 814 |
+
"migration_rate": 1
|
| 815 |
+
},
|
| 816 |
+
"population_profile": {
|
| 817 |
+
"age_distribution": {"0-14": 33, "15-64": 60, "65+": 7}
|
| 818 |
+
},
|
| 819 |
+
"starting_relations": {
|
| 820 |
+
"ترکیه": 40,
|
| 821 |
+
"یونان": 30,
|
| 822 |
+
"ایران": 10
|
| 823 |
+
},
|
| 824 |
+
"unique_trait": "کشاورزی غنی: +10% درآمد کشاورزی",
|
| 825 |
+
"historical_events": [
|
| 826 |
+
{
|
| 827 |
+
"year": 1517,
|
| 828 |
+
"name": "فرمانروایی عثم��نیها",
|
| 829 |
+
"description": "مصر توسط امپراتوری عثمانی فتح شد.",
|
| 830 |
+
"choices": [
|
| 831 |
+
{
|
| 832 |
+
"text": "مقاومت در برابر عثمانیها",
|
| 833 |
+
"effects": {
|
| 834 |
+
"controlled_territories": -1,
|
| 835 |
+
"military_strength": -15,
|
| 836 |
+
"political_stability": -25
|
| 837 |
+
},
|
| 838 |
+
"description": "شکست در مقابل عثمانیها و از دست دادن استقلال."
|
| 839 |
+
},
|
| 840 |
+
{
|
| 841 |
+
"text": "همکاری با عثمانیها",
|
| 842 |
+
"effects": {
|
| 843 |
+
"relations": {"+": 25},
|
| 844 |
+
"political_stability": 5,
|
| 845 |
+
"gold": 3000
|
| 846 |
+
},
|
| 847 |
+
"description": "همکاری با عثمانیها برای حفظ خودمختاری نسبی."
|
| 848 |
+
}
|
| 849 |
+
]
|
| 850 |
+
}
|
| 851 |
+
]
|
| 852 |
+
},
|
| 853 |
+
{
|
| 854 |
+
"id": 16,
|
| 855 |
+
"name": "پادشاهی ایران",
|
| 856 |
+
"description": "کشوری باستانی با فرهنگ غنی و موقعیت استراتژیک",
|
| 857 |
+
"region": "Desert",
|
| 858 |
+
"calendar": "Jalali calendar",
|
| 859 |
+
"starting_year": 1500,
|
| 860 |
+
"base_attributes": {
|
| 861 |
+
"population": 8.0,
|
| 862 |
+
"economy": {"trade": 55, "agriculture": 50, "industry": 40},
|
| 863 |
+
"military": {"army": 60, "navy": 25, "tech": 45},
|
| 864 |
+
"stability": 70,
|
| 865 |
+
"gold": 15000,
|
| 866 |
+
"culture": 85,
|
| 867 |
+
"religion": "شیعه",
|
| 868 |
+
"birth_rate": 30,
|
| 869 |
+
"death_rate": 14,
|
| 870 |
+
"migration_rate": -2
|
| 871 |
+
},
|
| 872 |
+
"population_profile": {
|
| 873 |
+
"age_distribution": {"0-14": 31, "15-64": 62, "65+": 7}
|
| 874 |
+
},
|
| 875 |
+
"starting_relations": {
|
| 876 |
+
"ترکیه": -50,
|
| 877 |
+
"مصر": 10,
|
| 878 |
+
"چین": 30
|
| 879 |
+
},
|
| 880 |
+
"unique_trait": "فرهنگ تاریخی: +20% سرعت گسترش فرهنگ",
|
| 881 |
+
"historical_events": [
|
| 882 |
+
{
|
| 883 |
+
"year": 1501,
|
| 884 |
+
"name": "تاسیس صفویه",
|
| 885 |
+
"description": "ایشاعق صفوی توانست ایران را متحد کند و سلسله صفویه را تأسیس کند.",
|
| 886 |
+
"choices": [
|
| 887 |
+
{
|
| 888 |
+
"text": "گسترش شیعه",
|
| 889 |
+
"effects": {
|
| 890 |
+
"religion": "Shia Islam",
|
| 891 |
+
"relations": {"-": 20},
|
| 892 |
+
"culture_score": 15
|
| 893 |
+
},
|
| 894 |
+
"description": "تلاش برای گسترش شیعه در منطقه با تنشهای دیپلماتیک."
|
| 895 |
+
},
|
| 896 |
+
{
|
| 897 |
+
"text": "سیاست چند دینی",
|
| 898 |
+
"effects": {
|
| 899 |
+
"religion": "Multi-religious",
|
| 900 |
+
"political_stability": 10,
|
| 901 |
+
"public_dissatisfaction": 5
|
| 902 |
+
},
|
| 903 |
+
"description": "سیاست چند دینی برای حفظ ثبات داخلی."
|
| 904 |
+
}
|
| 905 |
+
]
|
| 906 |
+
},
|
| 907 |
+
{
|
| 908 |
+
"year": 1514,
|
| 909 |
+
"name": "نبرد چالدران",
|
| 910 |
+
"description": "نبرد مهم بین ایران و عثمانیها در چالدران رخ داد.",
|
| 911 |
+
"choices": [
|
| 912 |
+
{
|
| 913 |
+
"text": "شکست عثمانیها",
|
| 914 |
+
"effects": {
|
| 915 |
+
"military_strength": 15,
|
| 916 |
+
"controlled_territories": 1,
|
| 917 |
+
"relations": {"-": 10}
|
| 918 |
+
},
|
| 919 |
+
"description": "پیروزی در نبرد چالدران و گسترش قلمرو."
|
| 920 |
+
},
|
| 921 |
+
{
|
| 922 |
+
"text": "شکست و عقبنشینی",
|
| 923 |
+
"effects": {
|
| 924 |
+
"military_strength": -10,
|
| 925 |
+
"controlled_territories": -1,
|
| 926 |
+
"political_stability": -15
|
| 927 |
+
},
|
| 928 |
+
"description": "شکست در نبرد چالدران و کاهش قلمرو."
|
| 929 |
+
}
|
| 930 |
+
]
|
| 931 |
+
}
|
| 932 |
+
]
|
| 933 |
+
},
|
| 934 |
+
{
|
| 935 |
+
"id": 17,
|
| 936 |
+
"name": "پادشاهی سوئد",
|
| 937 |
+
"description": "کشوری با منابع طبیعی فراوان و ارتش قدرتمند",
|
| 938 |
+
"region": "Temperate",
|
| 939 |
+
"calendar": "Gregorian",
|
| 940 |
+
"starting_year": 1500,
|
| 941 |
+
"base_attributes": {
|
| 942 |
+
"population": 1.5,
|
| 943 |
+
"economy": {"trade": 40, "agriculture": 35, "industry": 50},
|
| 944 |
+
"military": {"army": 55, "navy": 60, "tech": 55},
|
| 945 |
+
"stability": 75,
|
| 946 |
+
"gold": 12000,
|
| 947 |
+
"culture": 65,
|
| 948 |
+
"religion": "مسیحی",
|
| 949 |
+
"birth_rate": 23,
|
| 950 |
+
"death_rate": 10,
|
| 951 |
+
"migration_rate": 2
|
| 952 |
+
},
|
| 953 |
+
"population_profile": {
|
| 954 |
+
"age_distribution": {"0-14": 25, "15-64": 67, "65+": 8}
|
| 955 |
+
},
|
| 956 |
+
"starting_relations": {
|
| 957 |
+
"روسیه": -20,
|
| 958 |
+
"دانمارک": 40,
|
| 959 |
+
"نروژ": 50
|
| 960 |
+
},
|
| 961 |
+
"unique_trait": "منابع معدنی: +10% درآمد از منابع",
|
| 962 |
+
"historical_events": [
|
| 963 |
+
{
|
| 964 |
+
"year": 1523,
|
| 965 |
+
"name": "استقلال سوئد",
|
| 966 |
+
"description": "سوئد از اتحاد کالمار استقلال یافت.",
|
| 967 |
+
"choices": [
|
| 968 |
+
{
|
| 969 |
+
"text": "تقویت نظام پادشاهی",
|
| 970 |
+
"effects": {
|
| 971 |
+
"political_stability": 15,
|
| 972 |
+
"relations": {"-": 10},
|
| 973 |
+
"gold": -2000
|
| 974 |
+
},
|
| 975 |
+
"description": "تقویت نظام پادشاهی با هزینههای سیاسی و مالی."
|
| 976 |
+
},
|
| 977 |
+
{
|
| 978 |
+
"text": "تشکیل جمهوری",
|
| 979 |
+
"effects": {
|
| 980 |
+
"government_type": "Republic",
|
| 981 |
+
"political_stability": -5,
|
| 982 |
+
"public_dissatisfaction": -10
|
| 983 |
+
},
|
| 984 |
+
"description": "تلاش برای تشکیل جمهوری با خطرات سیاسی."
|
| 985 |
+
}
|
| 986 |
+
]
|
| 987 |
+
}
|
| 988 |
+
]
|
| 989 |
+
},
|
| 990 |
+
{
|
| 991 |
+
"id": 18,
|
| 992 |
+
"name": "پادشاهی دانمارک",
|
| 993 |
+
"description": "کشوری با موقعیت استراتژیک در اسکاندیناوی",
|
| 994 |
+
"region": "Temperate",
|
| 995 |
+
"calendar": "Gregorian",
|
| 996 |
+
"starting_year": 1500,
|
| 997 |
+
"base_attributes": {
|
| 998 |
+
"population": 1.0,
|
| 999 |
+
"economy": {"trade": 50, "agriculture": 30, "industry": 45},
|
| 1000 |
+
"military": {"army": 45, "navy": 65, "tech": 50},
|
| 1001 |
+
"stability": 70,
|
| 1002 |
+
"gold": 10000,
|
| 1003 |
+
"culture": 60,
|
| 1004 |
+
"religion": "مسیحی",
|
| 1005 |
+
"birth_rate": 22,
|
| 1006 |
+
"death_rate": 9,
|
| 1007 |
+
"migration_rate": 3
|
| 1008 |
+
},
|
| 1009 |
+
"population_profile": {
|
| 1010 |
+
"age_distribution": {"0-14": 24, "15-64": 68, "65+": 8}
|
| 1011 |
+
},
|
| 1012 |
+
"starting_relations": {
|
| 1013 |
+
"سوئد": 40,
|
| 1014 |
+
"نروژ": 50,
|
| 1015 |
+
"انگلستان": 30
|
| 1016 |
+
},
|
| 1017 |
+
"unique_trait": "موقعیت دریایی: +15% درآمد تجاری",
|
| 1018 |
+
"historical_events": [
|
| 1019 |
+
{
|
| 1020 |
+
"year": 1536,
|
| 1021 |
+
"name": "پروتستان شدن دانمارک",
|
| 1022 |
+
"description": "دانمارک به دین پروتستان میگراید.",
|
| 1023 |
+
"choices": [
|
| 1024 |
+
{
|
| 1025 |
+
"text": "پذیرش پروتستانیسم",
|
| 1026 |
+
"effects": {
|
| 1027 |
+
"religion": "Protestantism",
|
| 1028 |
+
"relations": {"+": 20},
|
| 1029 |
+
"political_stability": 10
|
| 1030 |
+
},
|
| 1031 |
+
"description": "پذیرش پروتستانیسم و تقویت روابط با کشورهای شمال اروپا."
|
| 1032 |
+
},
|
| 1033 |
+
{
|
| 1034 |
+
"text": "حفظ کاتولیسیسم",
|
| 1035 |
+
"effects": {
|
| 1036 |
+
"religion": "Catholicism",
|
| 1037 |
+
"relations": {"-": 25},
|
| 1038 |
+
"public_dissatisfaction": 15
|
| 1039 |
+
},
|
| 1040 |
+
"description": "حفظ کاتولیسیسم با تنشهای بینالمللی و داخلی."
|
| 1041 |
+
}
|
| 1042 |
+
]
|
| 1043 |
+
}
|
| 1044 |
+
]
|
| 1045 |
+
},
|
| 1046 |
+
{
|
| 1047 |
+
"id": 19,
|
| 1048 |
+
"name": "پادشاهی نروژ",
|
| 1049 |
+
"description": "کشوری با منابع طبیعی فراوان و اقتصاد رو به رشد",
|
| 1050 |
+
"region": "Temperate",
|
| 1051 |
+
"calendar": "Gregorian",
|
| 1052 |
+
"starting_year": 1500,
|
| 1053 |
+
"base_attributes": {
|
| 1054 |
+
"population": 0.8,
|
| 1055 |
+
"economy": {"trade": 45, "agriculture": 25, "industry": 40},
|
| 1056 |
+
"military": {"army": 40, "navy": 60, "tech": 45},
|
| 1057 |
+
"stability": 75,
|
| 1058 |
+
"gold": 9000,
|
| 1059 |
+
"culture": 55,
|
| 1060 |
+
"religion": "مسیحی",
|
| 1061 |
+
"birth_rate": 21,
|
| 1062 |
+
"death_rate": 8,
|
| 1063 |
+
"migration_rate": 1
|
| 1064 |
+
},
|
| 1065 |
+
"population_profile": {
|
| 1066 |
+
"age_distribution": {"0-14": 23, "15-64": 69, "65+": 8}
|
| 1067 |
+
},
|
| 1068 |
+
"starting_relations": {
|
| 1069 |
+
"سوئد": 50,
|
| 1070 |
+
"دانمارک": 50,
|
| 1071 |
+
"روسیه": 20
|
| 1072 |
+
},
|
| 1073 |
+
"unique_trait": "منابع طبیعی: +10% درآمد از منابع",
|
| 1074 |
+
"historical_events": [
|
| 1075 |
+
{
|
| 1076 |
+
"year": 1537,
|
| 1077 |
+
"name": "پروتستان شدن نروژ",
|
| 1078 |
+
"description": "نروژ به دین پروتستان میگراید.",
|
| 1079 |
+
"choices": [
|
| 1080 |
+
{
|
| 1081 |
+
"text": "پذیرش پروتستانیسم",
|
| 1082 |
+
"effects": {
|
| 1083 |
+
"religion": "Protestantism",
|
| 1084 |
+
"relations": {"+": 15},
|
| 1085 |
+
"political_stability": 5
|
| 1086 |
+
},
|
| 1087 |
+
"description": "پذیرش پروتستانیسم و تقویت روابط با کشورهای شمال اروپا."
|
| 1088 |
+
},
|
| 1089 |
+
{
|
| 1090 |
+
"text": "حفظ کاتولیسیسم",
|
| 1091 |
+
"effects": {
|
| 1092 |
+
"religion": "Catholicism",
|
| 1093 |
+
"relations": {"-": 20},
|
| 1094 |
+
"public_dissatisfaction": 10
|
| 1095 |
+
},
|
| 1096 |
+
"description": "حفظ کاتولیسیسم با تنشهای بینالمللی."
|
| 1097 |
+
}
|
| 1098 |
+
]
|
| 1099 |
+
}
|
| 1100 |
+
]
|
| 1101 |
+
},
|
| 1102 |
+
{
|
| 1103 |
+
"id": 20,
|
| 1104 |
+
"name": "پادشاهی ونیز",
|
| 1105 |
+
"description": "مرکز تجاری اروپا با ناوگان دریایی قدرتمند",
|
| 1106 |
+
"region": "Mediterranean",
|
| 1107 |
+
"calendar": "Gregorian",
|
| 1108 |
+
"starting_year": 1500,
|
| 1109 |
+
"base_attributes": {
|
| 1110 |
+
"population": 0.3,
|
| 1111 |
+
"economy": {"trade": 95, "agriculture": 20, "industry": 30},
|
| 1112 |
+
"military": {"army": 30, "navy": 85, "tech": 60},
|
| 1113 |
+
"stability": 65,
|
| 1114 |
+
"gold": 20000,
|
| 1115 |
+
"culture": 70,
|
| 1116 |
+
"religion": "مسیحی",
|
| 1117 |
+
"birth_rate": 20,
|
| 1118 |
+
"death_rate": 10,
|
| 1119 |
+
"migration_rate": 5
|
| 1120 |
+
},
|
| 1121 |
+
"population_profile": {
|
| 1122 |
+
"age_distribution": {"0-14": 22, "15-64": 70, "65+": 8}
|
| 1123 |
+
},
|
| 1124 |
+
"starting_relations": {
|
| 1125 |
+
"ترکیه": -40,
|
| 1126 |
+
"فرانسه": 30,
|
| 1127 |
+
"پرتغال": 40
|
| 1128 |
+
},
|
| 1129 |
+
"unique_trait": "مرکز تجارت جهانی: +30% درآمد تجاری",
|
| 1130 |
+
"historical_events": [
|
| 1131 |
+
{
|
| 1132 |
+
"year": 1500,
|
| 1133 |
+
"name": "رقابت با پرتغال",
|
| 1134 |
+
"description": "پرتغال مسیر دریایی به هند را کشف کرد و رقابت تجاری شدیدی آغاز شد.",
|
| 1135 |
+
"choices": [
|
| 1136 |
+
{
|
| 1137 |
+
"text": "سرمایهگذاری در ناوگان جدید",
|
| 1138 |
+
"effects": {
|
| 1139 |
+
"gold": -8000,
|
| 1140 |
+
"military_strength": 10,
|
| 1141 |
+
"economy": {"trade": 5}
|
| 1142 |
+
},
|
| 1143 |
+
"description": "سرمایهگذاری در ناوگان جدید برای رقابت با پرتغال."
|
| 1144 |
+
},
|
| 1145 |
+
{
|
| 1146 |
+
"text": "مذاکره برای تقسیم بازارها",
|
| 1147 |
+
"effects": {
|
| 1148 |
+
"gold": -3000,
|
| 1149 |
+
"relations": {"+": 10},
|
| 1150 |
+
"economy": {"trade": -5}
|
| 1151 |
+
},
|
| 1152 |
+
"description": "مذاکره برای تقسیم بازارهای تجاری با پرتغال."
|
| 1153 |
+
}
|
| 1154 |
+
]
|
| 1155 |
+
}
|
| 1156 |
+
]
|
| 1157 |
+
},
|
| 1158 |
+
{
|
| 1159 |
+
"id": 21,
|
| 1160 |
+
"name": "پادشاهی مجارستان",
|
| 1161 |
+
"description": "کشوری با فرهنگ ترکیبی و موقعیت مرکزی اروپا",
|
| 1162 |
+
"region": "Temperate",
|
| 1163 |
+
"calendar": "Gregorian",
|
| 1164 |
+
"starting_year": 1500,
|
| 1165 |
+
"base_attributes": {
|
| 1166 |
+
"population": 3.0,
|
| 1167 |
+
"economy": {"trade": 50, "agriculture": 55, "industry": 40},
|
| 1168 |
+
"military": {"army": 60, "navy": 20, "tech": 40},
|
| 1169 |
+
"stability": 55,
|
| 1170 |
+
"gold": 11000,
|
| 1171 |
+
"culture": 65,
|
| 1172 |
+
"religion": "مسیحی",
|
| 1173 |
+
"birth_rate": 25,
|
| 1174 |
+
"death_rate": 13,
|
| 1175 |
+
"migration_rate": 0
|
| 1176 |
+
},
|
| 1177 |
+
"population_profile": {
|
| 1178 |
+
"age_distribution": {"0-14": 27, "15-64": 64, "65+": 9}
|
| 1179 |
+
},
|
| 1180 |
+
"starting_relations": {
|
| 1181 |
+
"پادشاهی مقدس روم": 40,
|
| 1182 |
+
"روسیه": 20,
|
| 1183 |
+
"ترکیه": -30
|
| 1184 |
+
},
|
| 1185 |
+
"unique_trait": "موقعیت مرکزی: +5% رشد ا��تصادی",
|
| 1186 |
+
"historical_events": [
|
| 1187 |
+
{
|
| 1188 |
+
"year": 1526,
|
| 1189 |
+
"name": "نبرد موحاس",
|
| 1190 |
+
"description": "نبرد مهم با امپراتوری عثمانی در موحاس رخ داد.",
|
| 1191 |
+
"choices": [
|
| 1192 |
+
{
|
| 1193 |
+
"text": "شکست عثمانیها",
|
| 1194 |
+
"effects": {
|
| 1195 |
+
"military_strength": 15,
|
| 1196 |
+
"controlled_territories": 1,
|
| 1197 |
+
"public_dissatisfaction": -10
|
| 1198 |
+
},
|
| 1199 |
+
"description": "پیروزی در نبرد با افزایش قلمرو و معنویه."
|
| 1200 |
+
},
|
| 1201 |
+
{
|
| 1202 |
+
"text": "شکست و اشغال توسط عثمانیها",
|
| 1203 |
+
"effects": {
|
| 1204 |
+
"controlled_territories": -1,
|
| 1205 |
+
"political_stability": -20,
|
| 1206 |
+
"gold": -5000
|
| 1207 |
+
},
|
| 1208 |
+
"description": "شکست در نبرد با کاهش قلمرو و ثبات."
|
| 1209 |
+
}
|
| 1210 |
+
]
|
| 1211 |
+
}
|
| 1212 |
+
]
|
| 1213 |
+
},
|
| 1214 |
+
{
|
| 1215 |
+
"id": 22,
|
| 1216 |
+
"name": "پادشاهی پولند",
|
| 1217 |
+
"description": "اتحاد با لیتوانی، با ارتش سواره نظام قوی",
|
| 1218 |
+
"region": "Temperate",
|
| 1219 |
+
"calendar": "Gregorian",
|
| 1220 |
+
"starting_year": 1500,
|
| 1221 |
+
"base_attributes": {
|
| 1222 |
+
"population": 5.0,
|
| 1223 |
+
"economy": {"trade": 45, "agriculture": 60, "industry": 35},
|
| 1224 |
+
"military": {"army": 65, "navy": 15, "tech": 40},
|
| 1225 |
+
"stability": 60,
|
| 1226 |
+
"gold": 12000,
|
| 1227 |
+
"culture": 60,
|
| 1228 |
+
"religion": "مسیحی",
|
| 1229 |
+
"birth_rate": 26,
|
| 1230 |
+
"death_rate": 12,
|
| 1231 |
+
"migration_rate": 0
|
| 1232 |
+
},
|
| 1233 |
+
"population_profile": {
|
| 1234 |
+
"age_distribution": {"0-14": 28, "15-64": 63, "65+": 9}
|
| 1235 |
+
},
|
| 1236 |
+
"starting_relations": {
|
| 1237 |
+
"روسیه": -20,
|
| 1238 |
+
"پادشاهی مقدس روم": 30,
|
| 1239 |
+
"ترکیه": -10
|
| 1240 |
+
},
|
| 1241 |
+
"unique_trait": "سواره نظام قوی: +10% قدرت ارتش",
|
| 1242 |
+
"historical_events": [
|
| 1243 |
+
{
|
| 1244 |
+
"year": 1569,
|
| 1245 |
+
"name": "اتحاد لوبلین",
|
| 1246 |
+
"description": "اتحاد رسمی پولند و لیتوانی شکل گرفت.",
|
| 1247 |
+
"choices": [
|
| 1248 |
+
{
|
| 1249 |
+
"text": "اتحاد کامل",
|
| 1250 |
+
"effects": {
|
| 1251 |
+
"controlled_territories": 1,
|
| 1252 |
+
"political_stability": 10,
|
| 1253 |
+
"military_strength": 15
|
| 1254 |
+
},
|
| 1255 |
+
"description": "ایجاد کشور متحد پولند-لیتوانی با افزایش قدرت."
|
| 1256 |
+
},
|
| 1257 |
+
{
|
| 1258 |
+
"text": "اتحاد محدود",
|
| 1259 |
+
"effects": {
|
| 1260 |
+
"controlled_territories": 0,
|
| 1261 |
+
"political_stability": 5,
|
| 1262 |
+
"relations": {"+": 15}
|
| 1263 |
+
},
|
| 1264 |
+
"description": "اتحاد محدود با لیتوانی برای حفظ خودمختاری."
|
| 1265 |
+
}
|
| 1266 |
+
]
|
| 1267 |
+
}
|
| 1268 |
+
]
|
| 1269 |
+
},
|
| 1270 |
+
{
|
| 1271 |
+
"id": 23,
|
| 1272 |
+
"name": "پادشاهی مالی",
|
| 1273 |
+
"description": "امپراتوری غنی آفریقا با منابع طلا و نمک",
|
| 1274 |
+
"region": "Tropical",
|
| 1275 |
+
"calendar": "Islamic calendar",
|
| 1276 |
+
"starting_year": 1500,
|
| 1277 |
+
"base_attributes": {
|
| 1278 |
+
"population": 4.0,
|
| 1279 |
+
"economy": {"trade": 70, "agriculture": 40, "industry": 20},
|
| 1280 |
+
"military": {"army": 50, "navy": 10, "tech": 30},
|
| 1281 |
+
"stability": 50,
|
| 1282 |
+
"gold": 16000,
|
| 1283 |
+
"culture": 55,
|
| 1284 |
+
"religion": "اسلام",
|
| 1285 |
+
"birth_rate": 35,
|
| 1286 |
+
"death_rate": 22,
|
| 1287 |
+
"migration_rate": 3
|
| 1288 |
+
},
|
| 1289 |
+
"population_profile": {
|
| 1290 |
+
"age_distribution": {"0-14": 37, "15-64": 56, "65+": 7}
|
| 1291 |
+
},
|
| 1292 |
+
"starting_relations": {
|
| 1293 |
+
"پرتغال": 20,
|
| 1294 |
+
"مصر": 30,
|
| 1295 |
+
"اسپانیا": -10
|
| 1296 |
+
},
|
| 1297 |
+
"unique_trait": "منابع طلا: +15% درآمد از منابع",
|
| 1298 |
+
"historical_events": [
|
| 1299 |
+
{
|
| 1300 |
+
"year": 1591,
|
| 1301 |
+
"name": "حمله مرینها",
|
| 1302 |
+
"description": "امپراتوری مرین از مراکش به مالی حمله کرد.",
|
| 1303 |
+
"choices": [
|
| 1304 |
+
{
|
| 1305 |
+
"text": "مقاومت در برابر مرینها",
|
| 1306 |
+
"effects": {
|
| 1307 |
+
"military_strength": -15,
|
| 1308 |
+
"controlled_territories": -2,
|
| 1309 |
+
"political_stability": -25
|
| 1310 |
+
},
|
| 1311 |
+
"description": "شکست در مقابل مرینها و از دست دادن قلمرو."
|
| 1312 |
+
},
|
| 1313 |
+
{
|
| 1314 |
+
"text": "مذاکره برای صلح",
|
| 1315 |
+
"effects": {
|
| 1316 |
+
"relations": {"+": 10},
|
| 1317 |
+
"gold": -5000,
|
| 1318 |
+
"political_stability": -5
|
| 1319 |
+
},
|
| 1320 |
+
"description": "مذاکره برای صلح با پرداخت غرامت."
|
| 1321 |
+
}
|
| 1322 |
+
]
|
| 1323 |
+
}
|
| 1324 |
+
]
|
| 1325 |
+
}
|
| 1326 |
+
]
|
Shadows_of_Empires/data/tech/tech_definitions.py
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
تعریف فناوریهای بازی
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
TECHNOLOGIES = {
|
| 6 |
+
# فناوریهای نظامی
|
| 7 |
+
"military_1": {
|
| 8 |
+
"name": "سلاحهای گرم",
|
| 9 |
+
"description": "استفاده از باروت و سلاحهای گرم در جنگ",
|
| 10 |
+
"base_cost": 5000,
|
| 11 |
+
"tech_level_req": 1,
|
| 12 |
+
"prerequisites": [],
|
| 13 |
+
"effects": {
|
| 14 |
+
"military": 10,
|
| 15 |
+
"economy": {"industry": 5}
|
| 16 |
+
},
|
| 17 |
+
"category": "military"
|
| 18 |
+
},
|
| 19 |
+
"military_2": {
|
| 20 |
+
"name": "تکتیکهای جنگی پیشرفته",
|
| 21 |
+
"description": "استفاده از تاکتیکهای پیچیده در جنگ",
|
| 22 |
+
"base_cost": 8000,
|
| 23 |
+
"tech_level_req": 2,
|
| 24 |
+
"prerequisites": ["military_1"],
|
| 25 |
+
"effects": {
|
| 26 |
+
"military": 15,
|
| 27 |
+
"economy": {"trade": 5}
|
| 28 |
+
},
|
| 29 |
+
"category": "military"
|
| 30 |
+
},
|
| 31 |
+
"military_3": {
|
| 32 |
+
"name": "ساخت کشتیهای جنگی",
|
| 33 |
+
"description": "ساخت کشتیهای جنگی پیشرفته برای نیروی دریایی",
|
| 34 |
+
"base_cost": 10000,
|
| 35 |
+
"tech_level_req": 3,
|
| 36 |
+
"prerequisites": ["military_1"],
|
| 37 |
+
"effects": {
|
| 38 |
+
"military": {"navy": 20},
|
| 39 |
+
"economy": {"trade": 10}
|
| 40 |
+
},
|
| 41 |
+
"category": "military"
|
| 42 |
+
},
|
| 43 |
+
"military_4": {
|
| 44 |
+
"name": "ساختارهای دفاعی پیشرفته",
|
| 45 |
+
"description": "ساخت ساختارهای دفاعی پیشرفته برای محافظت از شهرها",
|
| 46 |
+
"base_cost": 12000,
|
| 47 |
+
"tech_level_req": 4,
|
| 48 |
+
"prerequisites": ["military_2"],
|
| 49 |
+
"effects": {
|
| 50 |
+
"military": {"defense": 25},
|
| 51 |
+
"economy": {"industry": 10}
|
| 52 |
+
},
|
| 53 |
+
"category": "military"
|
| 54 |
+
},
|
| 55 |
+
"military_5": {
|
| 56 |
+
"name": "ارتش حرفهای",
|
| 57 |
+
"description": "تشکیل ارتش حرفهای به جای نیروهای سربازی",
|
| 58 |
+
"base_cost": 15000,
|
| 59 |
+
"tech_level_req": 5,
|
| 60 |
+
"prerequisites": ["military_2", "military_4"],
|
| 61 |
+
"effects": {
|
| 62 |
+
"military": 30,
|
| 63 |
+
"economy": {"industry": 15, "trade": -5}
|
| 64 |
+
},
|
| 65 |
+
"category": "military"
|
| 66 |
+
},
|
| 67 |
+
|
| 68 |
+
# فناوریهای کشاورزی
|
| 69 |
+
"agriculture_1": {
|
| 70 |
+
"name": "کشاورزی پیشرفته",
|
| 71 |
+
"description": "استفاده از روشهای پیشرفته کشاورزی برای افزایش تولید",
|
| 72 |
+
"base_cost": 4000,
|
| 73 |
+
"tech_level_req": 1,
|
| 74 |
+
"prerequisites": [],
|
| 75 |
+
"effects": {
|
| 76 |
+
"economy": {"agriculture": 15},
|
| 77 |
+
"population": 5
|
| 78 |
+
},
|
| 79 |
+
"category": "agriculture"
|
| 80 |
+
},
|
| 81 |
+
"agriculture_2": {
|
| 82 |
+
"name": "آبیاری پیشرفته",
|
| 83 |
+
"description": "سیستمهای آبیاری پیشرفته برای کشاورزی",
|
| 84 |
+
"base_cost": 6000,
|
| 85 |
+
"tech_level_req": 2,
|
| 86 |
+
"prerequisites": ["agriculture_1"],
|
| 87 |
+
"effects": {
|
| 88 |
+
"economy": {"agriculture": 20},
|
| 89 |
+
"environment": {"water_usage": 10}
|
| 90 |
+
},
|
| 91 |
+
"category": "agriculture"
|
| 92 |
+
},
|
| 93 |
+
"agriculture_3": {
|
| 94 |
+
"name": "کشاورزی صنعتی",
|
| 95 |
+
"description": "استفاده از ماشینآلات در کشاورزی",
|
| 96 |
+
"base_cost": 9000,
|
| 97 |
+
"tech_level_req": 3,
|
| 98 |
+
"prerequisites": ["agriculture_2"],
|
| 99 |
+
"effects": {
|
| 100 |
+
"economy": {"agriculture": 25, "industry": 10},
|
| 101 |
+
"environment": {"pollution": 15}
|
| 102 |
+
},
|
| 103 |
+
"category": "agriculture"
|
| 104 |
+
},
|
| 105 |
+
"agriculture_4": {
|
| 106 |
+
"name": "ژنتیک گیاهان",
|
| 107 |
+
"description": "استفاده از ژنتیک برای بهبود محصولات کشاورزی",
|
| 108 |
+
"base_cost": 12000,
|
| 109 |
+
"tech_level_req": 4,
|
| 110 |
+
"prerequisites": ["agriculture_3"],
|
| 111 |
+
"effects": {
|
| 112 |
+
"economy": {"agriculture": 30},
|
| 113 |
+
"technology": {"agriculture": 5}
|
| 114 |
+
},
|
| 115 |
+
"category": "agriculture"
|
| 116 |
+
},
|
| 117 |
+
|
| 118 |
+
# فناوریهای تجارت
|
| 119 |
+
"trade_1": {
|
| 120 |
+
"name": "شبکههای تجاری",
|
| 121 |
+
"description": "ایجاد شبکههای تجاری برای گسترش تجارت",
|
| 122 |
+
"base_cost": 5000,
|
| 123 |
+
"tech_level_req": 1,
|
| 124 |
+
"prerequisites": [],
|
| 125 |
+
"effects": {
|
| 126 |
+
"economy": {"trade": 15},
|
| 127 |
+
"diplomacy_points": 5
|
| 128 |
+
},
|
| 129 |
+
"category": "trade"
|
| 130 |
+
},
|
| 131 |
+
"trade_2": {
|
| 132 |
+
"name": "ناوگان تجاری",
|
| 133 |
+
"description": "ساخت ناوگان تجاری برای گسترش تجارت دریایی",
|
| 134 |
+
"base_cost": 8000,
|
| 135 |
+
"tech_level_req": 2,
|
| 136 |
+
"prerequisites": ["trade_1"],
|
| 137 |
+
"effects": {
|
| 138 |
+
"economy": {"trade": 20},
|
| 139 |
+
"military": {"navy": 10}
|
| 140 |
+
},
|
| 141 |
+
"category": "trade"
|
| 142 |
+
},
|
| 143 |
+
"trade_3": {
|
| 144 |
+
"name": "بیمه تجاری",
|
| 145 |
+
"description": "سیستم بیمه برای کاهش ریسکهای تجاری",
|
| 146 |
+
"base_cost": 10000,
|
| 147 |
+
"tech_level_req": 3,
|
| 148 |
+
"prerequisites": ["trade_1", "trade_2"],
|
| 149 |
+
"effects": {
|
| 150 |
+
"economy": {"trade": 25, "industry": 5},
|
| 151 |
+
"gold": 2000 # درآمد سالانه
|
| 152 |
+
},
|
| 153 |
+
"category": "trade"
|
| 154 |
+
},
|
| 155 |
+
"trade_4": {
|
| 156 |
+
"name": "بازارهای جهانی",
|
| 157 |
+
"description": "عضویت در بازارهای جهانی برای گسترش تجارت",
|
| 158 |
+
"base_cost": 15000,
|
| 159 |
+
"tech_level_req": 4,
|
| 160 |
+
"prerequisites": ["trade_3"],
|
| 161 |
+
"effects": {
|
| 162 |
+
"economy": {"trade": 30},
|
| 163 |
+
"relations": {"+": 10}
|
| 164 |
+
},
|
| 165 |
+
"category": "trade"
|
| 166 |
+
},
|
| 167 |
+
|
| 168 |
+
# فناوریهای صنعتی
|
| 169 |
+
"industry_1": {
|
| 170 |
+
"name": "صنعت پیشرفته",
|
| 171 |
+
"description": "استفاده از روشهای پیشرفته در صنعت",
|
| 172 |
+
"base_cost": 6000,
|
| 173 |
+
"tech_level_req": 2,
|
| 174 |
+
"prerequisites": [],
|
| 175 |
+
"effects": {
|
| 176 |
+
"economy": {"industry": 15},
|
| 177 |
+
"environment": {"pollution": 10}
|
| 178 |
+
},
|
| 179 |
+
"category": "industry"
|
| 180 |
+
},
|
| 181 |
+
"industry_2": {
|
| 182 |
+
"name": "انقلاب صنعتی",
|
| 183 |
+
"description": "شروع انقلاب صنعتی و استفاده از ماشینآلات",
|
| 184 |
+
"base_cost": 10000,
|
| 185 |
+
"tech_level_req": 3,
|
| 186 |
+
"prerequisites": ["industry_1"],
|
| 187 |
+
"effects": {
|
| 188 |
+
"economy": {"industry": 25, "trade": 10},
|
| 189 |
+
"environment": {"pollution": 20}
|
| 190 |
+
},
|
| 191 |
+
"category": "industry"
|
| 192 |
+
},
|
| 193 |
+
"industry_3": {
|
| 194 |
+
"name": "تولید انبوه",
|
| 195 |
+
"description": "تولید انبوه کالاها با استفاده از خط تولید",
|
| 196 |
+
"base_cost": 14000,
|
| 197 |
+
"tech_level_req": 4,
|
| 198 |
+
"prerequisites": ["industry_2"],
|
| 199 |
+
"effects": {
|
| 200 |
+
"economy": {"industry": 35, "trade": 15},
|
| 201 |
+
"environment": {"pollution": 30}
|
| 202 |
+
},
|
| 203 |
+
"category": "industry"
|
| 204 |
+
},
|
| 205 |
+
"industry_4": {
|
| 206 |
+
"name": "فناوریهای پاک",
|
| 207 |
+
"description": "استفاده از فناوریهای پاک برای کاهش آلایندگی",
|
| 208 |
+
"base_cost": 18000,
|
| 209 |
+
"tech_level_req": 5,
|
| 210 |
+
"prerequisites": ["industry_3"],
|
| 211 |
+
"effects": {
|
| 212 |
+
"economy": {"industry": 25, "trade": 10},
|
| 213 |
+
"environment": {"pollution": -20}
|
| 214 |
+
},
|
| 215 |
+
"category": "industry"
|
| 216 |
+
},
|
| 217 |
+
|
| 218 |
+
# فناوریهای پزشکی
|
| 219 |
+
"medicine_1": {
|
| 220 |
+
"name": "پزشکی مدرن",
|
| 221 |
+
"description": "استفاده از روشهای مدرن در پزشکی",
|
| 222 |
+
"base_cost": 5000,
|
| 223 |
+
"tech_level_req": 2,
|
| 224 |
+
"prerequisites": [],
|
| 225 |
+
"effects": {
|
| 226 |
+
"health_index": 15,
|
| 227 |
+
"population": 10
|
| 228 |
+
},
|
| 229 |
+
"category": "medicine"
|
| 230 |
+
},
|
| 231 |
+
"medicine_2": {
|
| 232 |
+
"name": "واکسیناسیون",
|
| 233 |
+
"description": "سیستم واکسیناسیون برای پیشگیری از بیماریها",
|
| 234 |
+
"base_cost": 8000,
|
| 235 |
+
"tech_level_req": 3,
|
| 236 |
+
"prerequisites": ["medicine_1"],
|
| 237 |
+
"effects": {
|
| 238 |
+
"health_index": 25,
|
| 239 |
+
"population": 15
|
| 240 |
+
},
|
| 241 |
+
"category": "medicine"
|
| 242 |
+
},
|
| 243 |
+
"medicine_3": {
|
| 244 |
+
"name": "پزشکی پیشرفته",
|
| 245 |
+
"description": "استفاده از فناوریهای پیشرفته در پزشکی",
|
| 246 |
+
"base_cost": 12000,
|
| 247 |
+
"tech_level_req": 4,
|
| 248 |
+
"prerequisites": ["medicine_2"],
|
| 249 |
+
"effects": {
|
| 250 |
+
"health_index": 35,
|
| 251 |
+
"population": 20,
|
| 252 |
+
"happiness": 10
|
| 253 |
+
},
|
| 254 |
+
"category": "medicine"
|
| 255 |
+
},
|
| 256 |
+
|
| 257 |
+
# فناوریهای آموزشی
|
| 258 |
+
"education_1": {
|
| 259 |
+
"name": "سیستم آموزشی",
|
| 260 |
+
"description": "ایجاد سیستم آموزشی برای افزایش سواد",
|
| 261 |
+
"base_cost": 4000,
|
| 262 |
+
"tech_level_req": 1,
|
| 263 |
+
"prerequisites": [],
|
| 264 |
+
"effects": {
|
| 265 |
+
"literacy_rate": 15,
|
| 266 |
+
"happiness": 5
|
| 267 |
+
},
|
| 268 |
+
"category": "education"
|
| 269 |
+
},
|
| 270 |
+
"education_2": {
|
| 271 |
+
"name": "دانشگاهها",
|
| 272 |
+
"description": "تاسیس دانشگاهها برای پژوهش و آموزش عالی",
|
| 273 |
+
"base_cost": 7000,
|
| 274 |
+
"tech_level_req": 2,
|
| 275 |
+
"prerequisites": ["education_1"],
|
| 276 |
+
"effects": {
|
| 277 |
+
"literacy_rate": 25,
|
| 278 |
+
"happiness": 10,
|
| 279 |
+
"technology": {"education": 5}
|
| 280 |
+
},
|
| 281 |
+
"category": "education"
|
| 282 |
+
},
|
| 283 |
+
"education_3": {
|
| 284 |
+
"name": "آموزش حرفهای",
|
| 285 |
+
"description": "سیستم آموزش حرفهای برای نیروی کار ماهر",
|
| 286 |
+
"base_cost": 10000,
|
| 287 |
+
"tech_level_req": 3,
|
| 288 |
+
"prerequisites": ["education_2"],
|
| 289 |
+
"effects": {
|
| 290 |
+
"literacy_rate": 35,
|
| 291 |
+
"economy": {"industry": 10, "trade": 5}
|
| 292 |
+
},
|
| 293 |
+
"category": "education"
|
| 294 |
+
},
|
| 295 |
+
|
| 296 |
+
# فناوریهای محیط زیست
|
| 297 |
+
"environment_1": {
|
| 298 |
+
"name": "مدیریت پسماند",
|
| 299 |
+
"description": "سیستم مدیریت پسماند برای کاهش آلودگی",
|
| 300 |
+
"base_cost": 6000,
|
| 301 |
+
"tech_level_req": 2,
|
| 302 |
+
"prerequisites": [],
|
| 303 |
+
"effects": {
|
| 304 |
+
"environment": {"pollution": -10},
|
| 305 |
+
"happiness": 5
|
| 306 |
+
},
|
| 307 |
+
"category": "environment"
|
| 308 |
+
},
|
| 309 |
+
"environment_2": {
|
| 310 |
+
"name": "انرژیهای تجدیدپذیر",
|
| 311 |
+
"description": "استفاده از انرژیهای تجدیدپذیر مانند خورشیدی و بادی",
|
| 312 |
+
"base_cost": 10000,
|
| 313 |
+
"tech_level_req": 3,
|
| 314 |
+
"prerequisites": ["environment_1"],
|
| 315 |
+
"effects": {
|
| 316 |
+
"environment": {"pollution": -20, "renewable_energy": 30},
|
| 317 |
+
"economy": {"industry": 5}
|
| 318 |
+
},
|
| 319 |
+
"category": "environment"
|
| 320 |
+
},
|
| 321 |
+
"environment_3": {
|
| 322 |
+
"name": "حفاظت از محیط زیست",
|
| 323 |
+
"description": "برنامههای جامع برای حفاظت از محیط زیست",
|
| 324 |
+
"base_cost": 15000,
|
| 325 |
+
"tech_level_req": 4,
|
| 326 |
+
"prerequisites": ["environment_2"],
|
| 327 |
+
"effects": {
|
| 328 |
+
"environment": {"pollution": -30, "deforestation": -20},
|
| 329 |
+
"happiness": 15
|
| 330 |
+
},
|
| 331 |
+
"category": "environment"
|
| 332 |
+
},
|
| 333 |
+
|
| 334 |
+
# فناوریهای ارتباطی
|
| 335 |
+
"communication_1": {
|
| 336 |
+
"name": "سیستم پست",
|
| 337 |
+
"description": "ایجاد سیستم پست برای ارتباطات سریعتر",
|
| 338 |
+
"base_cost": 3000,
|
| 339 |
+
"tech_level_req": 1,
|
| 340 |
+
"prerequisites": [],
|
| 341 |
+
"effects": {
|
| 342 |
+
"diplomacy_points": 5,
|
| 343 |
+
"economy": {"trade": 5}
|
| 344 |
+
},
|
| 345 |
+
"category": "communication"
|
| 346 |
+
},
|
| 347 |
+
"communication_2": {
|
| 348 |
+
"name": "تلگراف",
|
| 349 |
+
"description": "استفاده از تلگراف برای ارتباطات فوری",
|
| 350 |
+
"base_cost": 7000,
|
| 351 |
+
"tech_level_req": 2,
|
| 352 |
+
"prerequisites": ["communication_1"],
|
| 353 |
+
"effects": {
|
| 354 |
+
"diplomacy_points": 10,
|
| 355 |
+
"economy": {"trade": 10},
|
| 356 |
+
"military": {"communication": 15}
|
| 357 |
+
},
|
| 358 |
+
"category": "communication"
|
| 359 |
+
},
|
| 360 |
+
"communication_3": {
|
| 361 |
+
"name": "اینترنت",
|
| 362 |
+
"description": "دسترسی به اینترنت برای ارتباطات جهانی",
|
| 363 |
+
"base_cost": 20000,
|
| 364 |
+
"tech_level_req": 5,
|
| 365 |
+
"prerequisites": ["communication_2"],
|
| 366 |
+
"effects": {
|
| 367 |
+
"diplomacy_points": 20,
|
| 368 |
+
"economy": {"trade": 20, "industry": 15},
|
| 369 |
+
"culture_score": 15
|
| 370 |
+
},
|
| 371 |
+
"category": "communication"
|
| 372 |
+
}
|
| 373 |
+
}
|
Shadows_of_Empires/game/achievements/achievement_definitions.py
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
تعریف دستاوردها و اهداف شخصی برای بازی
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
ACHIEVEMENTS = [
|
| 6 |
+
{
|
| 7 |
+
"id": "WORLD_DOMINATION_1",
|
| 8 |
+
"name": "تسلط بر منطقه",
|
| 9 |
+
"description": "کنترل 3 کشور همسایه",
|
| 10 |
+
"category": "Military",
|
| 11 |
+
"points": 50,
|
| 12 |
+
"condition": lambda gs: gs.controlled_territories >= 4
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"id": "WORLD_DOMINATION_2",
|
| 16 |
+
"name": "امپراتور",
|
| 17 |
+
"description": "کنترل 6 کشور",
|
| 18 |
+
"category": "Military",
|
| 19 |
+
"points": 100,
|
| 20 |
+
"condition": lambda gs: gs.controlled_territories >= 7
|
| 21 |
+
},
|
| 22 |
+
{
|
| 23 |
+
"id": "WORLD_DOMINATION_3",
|
| 24 |
+
"name": "تسلط جهانی",
|
| 25 |
+
"description": "کنترل بیش از نصف کشورهای جهان",
|
| 26 |
+
"category": "Military",
|
| 27 |
+
"points": 200,
|
| 28 |
+
"condition": lambda gs: gs.controlled_territories >= 12
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"id": "ECONOMIC_1",
|
| 32 |
+
"name": "تجارتگر ماهر",
|
| 33 |
+
"description": "درآمد تجاری بیش از 70%",
|
| 34 |
+
"category": "Economy",
|
| 35 |
+
"points": 30,
|
| 36 |
+
"condition": lambda gs: gs.economy["trade"] >= 70
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"id": "ECONOMIC_2",
|
| 40 |
+
"name": "ثروتمند جهان",
|
| 41 |
+
"description": "دارایی بیش از 100,000 سکه طلا",
|
| 42 |
+
"category": "Economy",
|
| 43 |
+
"points": 75,
|
| 44 |
+
"condition": lambda gs: gs.gold >= 100000
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
"id": "CULTURAL_1",
|
| 48 |
+
"name": "فرهنگگستر",
|
| 49 |
+
"description": "نفوذ فرهنگی بیش از 60%",
|
| 50 |
+
"category": "Culture",
|
| 51 |
+
"points": 40,
|
| 52 |
+
"condition": lambda gs: gs.cultural_influence >= 60
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
"id": "CULTURAL_2",
|
| 56 |
+
"name": "فرهنگ جهانی",
|
| 57 |
+
"description": "نفوذ فرهنگی بیش از 80%",
|
| 58 |
+
"category": "Culture",
|
| 59 |
+
"points": 100,
|
| 60 |
+
"condition": lambda gs: gs.cultural_influence >= 80
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"id": "TECHNOLOGY_1",
|
| 64 |
+
"name": "پیشرو فناوری",
|
| 65 |
+
"description": "دستیابی به سطح فناوری 5",
|
| 66 |
+
"category": "Technology",
|
| 67 |
+
"points": 50,
|
| 68 |
+
"condition": lambda gs: gs.technology_level >= 5
|
| 69 |
+
},
|
| 70 |
+
{
|
| 71 |
+
"id": "RELIGIOUS_1",
|
| 72 |
+
"name": "دینگستر",
|
| 73 |
+
"description": "نفوذ دینی بیش از 50%",
|
| 74 |
+
"category": "Religion",
|
| 75 |
+
"points": 40,
|
| 76 |
+
"condition": lambda gs: gs.religious_influence >= 50
|
| 77 |
+
},
|
| 78 |
+
{
|
| 79 |
+
"id": "RELIGIOUS_2",
|
| 80 |
+
"name": "دین جهانی",
|
| 81 |
+
"description": "نفوذ دینی بیش از 75%",
|
| 82 |
+
"category": "Religion",
|
| 83 |
+
"points": 100,
|
| 84 |
+
"condition": lambda gs: gs.religious_influence >= 75
|
| 85 |
+
},
|
| 86 |
+
{
|
| 87 |
+
"id": "STABILITY_1",
|
| 88 |
+
"name": "پایداری سیاسی",
|
| 89 |
+
"description": "ثبات سیاسی بیش از 80% برای 10 سال متوالی",
|
| 90 |
+
"category": "Politics",
|
| 91 |
+
"points": 60,
|
| 92 |
+
"condition": lambda gs: gs.political_stability >= 80,
|
| 93 |
+
"consecutive_years": 0
|
| 94 |
+
},
|
| 95 |
+
{
|
| 96 |
+
"id": "HAPPINESS_1",
|
| 97 |
+
"name": "سرزمین شادی",
|
| 98 |
+
"description": "شادی مردم بیش از 75% برای 5 سال متوالی",
|
| 99 |
+
"category": "Society",
|
| 100 |
+
"points": 50,
|
| 101 |
+
"condition": lambda gs: gs.happiness >= 75,
|
| 102 |
+
"consecutive_years": 0
|
| 103 |
+
},
|
| 104 |
+
{
|
| 105 |
+
"id": "ENVIRONMENT_1",
|
| 106 |
+
"name": "حفاظت از محیط زیست",
|
| 107 |
+
"description": "کاهش آلودگی به کمتر از 30%",
|
| 108 |
+
"category": "Environment",
|
| 109 |
+
"points": 40,
|
| 110 |
+
"condition": lambda gs: gs.environment["pollution"] <= 30
|
| 111 |
+
},
|
| 112 |
+
{
|
| 113 |
+
"id": "EDUCATION_1",
|
| 114 |
+
"name": "آموزش عالی",
|
| 115 |
+
"description": "نرخ سواد بیش از 90%",
|
| 116 |
+
"category": "Education",
|
| 117 |
+
"points": 50,
|
| 118 |
+
"condition": lambda gs: gs.literacy_rate >= 90
|
| 119 |
+
},
|
| 120 |
+
{
|
| 121 |
+
"id": "HEALTH_1",
|
| 122 |
+
"name": "سلامت جامعه",
|
| 123 |
+
"description": "شاخص سلامت بیش از 85",
|
| 124 |
+
"category": "Health",
|
| 125 |
+
"points": 45,
|
| 126 |
+
"condition": lambda gs: gs.health_index >= 85
|
| 127 |
+
}
|
| 128 |
+
]
|
| 129 |
+
|
| 130 |
+
# اهداف شخصی برای کشورهای خاص
|
| 131 |
+
PERSONAL_OBJECTIVES = {
|
| 132 |
+
"پادشاهی ایران": [
|
| 133 |
+
{
|
| 134 |
+
"id": "IRAN_1",
|
| 135 |
+
"name": "اتحاد با همسایگان",
|
| 136 |
+
"description": "ارتقای روابط با مصر و چین به سطح متحد",
|
| 137 |
+
"target_value": 70,
|
| 138 |
+
"reward": {"relations": {"+": 20}, "culture_score": 10}
|
| 139 |
+
},
|
| 140 |
+
{
|
| 141 |
+
"id": "IRAN_2",
|
| 142 |
+
"name": "گسترش فرهنگ",
|
| 143 |
+
"description": "افزایش نفوذ فرهنگی به 60%",
|
| 144 |
+
"target_value": 60,
|
| 145 |
+
"reward": {"cultural_influence": 15, "culture_score": 15}
|
| 146 |
+
},
|
| 147 |
+
{
|
| 148 |
+
"id": "IRAN_3",
|
| 149 |
+
"name": "تسلط بر منطقه",
|
| 150 |
+
"description": "کنترل 4 کشور همسایه",
|
| 151 |
+
"target_value": 4,
|
| 152 |
+
"reward": {"controlled_territories": 2, "military_strength": 10}
|
| 153 |
+
}
|
| 154 |
+
],
|
| 155 |
+
"امپراتوری عثمانی": [
|
| 156 |
+
{
|
| 157 |
+
"id": "OTTOMAN_1",
|
| 158 |
+
"name": "تسلط بر منطقه",
|
| 159 |
+
"description": "کنترل 5 کشور همسایه",
|
| 160 |
+
"target_value": 5,
|
| 161 |
+
"reward": {"controlled_territories": 2, "military_strength": 15}
|
| 162 |
+
},
|
| 163 |
+
{
|
| 164 |
+
"id": "OTTOMAN_2",
|
| 165 |
+
"name": "تقویت نیروی دریایی",
|
| 166 |
+
"description": "افزایش نیروی دریایی به 70%",
|
| 167 |
+
"target_value": 70,
|
| 168 |
+
"reward": {"military": {"navy": 20}, "economy": {"trade": 10}}
|
| 169 |
+
},
|
| 170 |
+
{
|
| 171 |
+
"id": "OTTOMAN_3",
|
| 172 |
+
"name": "گسترش دین",
|
| 173 |
+
"description": "نفوذ دینی به 65%",
|
| 174 |
+
"target_value": 65,
|
| 175 |
+
"reward": {"religion": 15, "relations": {"+": 10}}
|
| 176 |
+
}
|
| 177 |
+
],
|
| 178 |
+
"پادشاهی ایران": [
|
| 179 |
+
{
|
| 180 |
+
"id": "SAFRAVID_1",
|
| 181 |
+
"name": "تاسیس صفویه",
|
| 182 |
+
"description": "تثبیت حکومت صفویه",
|
| 183 |
+
"target_value": 80,
|
| 184 |
+
"reward": {"political_stability": 15, "culture_score": 20}
|
| 185 |
+
},
|
| 186 |
+
{
|
| 187 |
+
"id": "SAFRAVID_2",
|
| 188 |
+
"name": "نبرد چالدران",
|
| 189 |
+
"description": "برنده شدن در نبرد چالدران",
|
| 190 |
+
"target_value": 1, # شرط بولین
|
| 191 |
+
"reward": {"controlled_territories": 1, "military_strength": 10}
|
| 192 |
+
}
|
| 193 |
+
]
|
| 194 |
+
}
|
Shadows_of_Empires/game/achievements/achievements_system.py
ADDED
|
@@ -0,0 +1,362 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
سیستم دستاوردها و اهداف شخصی برای بازیکن
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
class AchievementsSystem:
|
| 6 |
+
"""سیستم دستاوردها و اهداف شخصی برای بازیکن"""
|
| 7 |
+
|
| 8 |
+
def __init__(self, game_state):
|
| 9 |
+
"""ساخت یک نمونه جدید از سیستم دستاوردها"""
|
| 10 |
+
self.game_state = game_state
|
| 11 |
+
self.achievements = []
|
| 12 |
+
self.personal_objectives = []
|
| 13 |
+
self.completed_achievements = []
|
| 14 |
+
|
| 15 |
+
def initialize(self):
|
| 16 |
+
"""راهاندازی اولیه سیستم دستاوردها"""
|
| 17 |
+
# بارگیری دستاوردهای پیشفرض
|
| 18 |
+
self._load_default_achievements()
|
| 19 |
+
|
| 20 |
+
# ایجاد اهداف شخصی بر اساس کشور انتخابی
|
| 21 |
+
self._create_personal_objectives()
|
| 22 |
+
|
| 23 |
+
def _load_default_achievements(self):
|
| 24 |
+
"""بارگیری دستاوردهای پیشفرض"""
|
| 25 |
+
self.achievements = [
|
| 26 |
+
{
|
| 27 |
+
"id": "WORLD_DOMINATION_1",
|
| 28 |
+
"name": "تسلط بر منطقه",
|
| 29 |
+
"description": "کنترل 3 کشور همسایه",
|
| 30 |
+
"category": "Military",
|
| 31 |
+
"points": 50,
|
| 32 |
+
"condition": lambda gs: gs.controlled_territories >= 4,
|
| 33 |
+
"unlocked": False
|
| 34 |
+
},
|
| 35 |
+
{
|
| 36 |
+
"id": "WORLD_DOMINATION_2",
|
| 37 |
+
"name": "امپراتور",
|
| 38 |
+
"description": "کنترل 6 کشور",
|
| 39 |
+
"category": "Military",
|
| 40 |
+
"points": 100,
|
| 41 |
+
"condition": lambda gs: gs.controlled_territories >= 7,
|
| 42 |
+
"unlocked": False
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"id": "WORLD_DOMINATION_3",
|
| 46 |
+
"name": "تسلط جهانی",
|
| 47 |
+
"description": "کنترل بیش از نصف کشورهای جهان",
|
| 48 |
+
"category": "Military",
|
| 49 |
+
"points": 200,
|
| 50 |
+
"condition": lambda gs: gs.controlled_territories >= 12,
|
| 51 |
+
"unlocked": False
|
| 52 |
+
},
|
| 53 |
+
{
|
| 54 |
+
"id": "ECONOMIC_1",
|
| 55 |
+
"name": "تجارتگر ماهر",
|
| 56 |
+
"description": "درآمد تجاری بیش از 70%",
|
| 57 |
+
"category": "Economy",
|
| 58 |
+
"points": 30,
|
| 59 |
+
"condition": lambda gs: gs.economy["trade"] >= 70,
|
| 60 |
+
"unlocked": False
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"id": "ECONOMIC_2",
|
| 64 |
+
"name": "ثروتمند جهان",
|
| 65 |
+
"description": "دارایی بیش از 100,000 سکه طلا",
|
| 66 |
+
"category": "Economy",
|
| 67 |
+
"points": 75,
|
| 68 |
+
"condition": lambda gs: gs.gold >= 100000,
|
| 69 |
+
"unlocked": False
|
| 70 |
+
},
|
| 71 |
+
{
|
| 72 |
+
"id": "CULTURAL_1",
|
| 73 |
+
"name": "فرهنگگستر",
|
| 74 |
+
"description": "نفوذ فرهنگی بیش از 60%",
|
| 75 |
+
"category": "Culture",
|
| 76 |
+
"points": 40,
|
| 77 |
+
"condition": lambda gs: gs.cultural_influence >= 60,
|
| 78 |
+
"unlocked": False
|
| 79 |
+
},
|
| 80 |
+
{
|
| 81 |
+
"id": "CULTURAL_2",
|
| 82 |
+
"name": "فرهنگ جهانی",
|
| 83 |
+
"description": "نفوذ فرهنگی بیش از 80%",
|
| 84 |
+
"category": "Culture",
|
| 85 |
+
"points": 100,
|
| 86 |
+
"condition": lambda gs: gs.cultural_influence >= 80,
|
| 87 |
+
"unlocked": False
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
"id": "TECHNOLOGY_1",
|
| 91 |
+
"name": "پیشرو فناوری",
|
| 92 |
+
"description": "دستیابی به سطح فناوری 5",
|
| 93 |
+
"category": "Technology",
|
| 94 |
+
"points": 50,
|
| 95 |
+
"condition": lambda gs: gs.technology_level >= 5,
|
| 96 |
+
"unlocked": False
|
| 97 |
+
},
|
| 98 |
+
{
|
| 99 |
+
"id": "RELIGIOUS_1",
|
| 100 |
+
"name": "دینگستر",
|
| 101 |
+
"description": "نفوذ دینی بیش از 50%",
|
| 102 |
+
"category": "Religion",
|
| 103 |
+
"points": 40,
|
| 104 |
+
"condition": lambda gs: gs.religious_influence >= 50,
|
| 105 |
+
"unlocked": False
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
"id": "RELIGIOUS_2",
|
| 109 |
+
"name": "دین جهانی",
|
| 110 |
+
"description": "نفوذ دینی بیش از 75%",
|
| 111 |
+
"category": "Religion",
|
| 112 |
+
"points": 100,
|
| 113 |
+
"condition": lambda gs: gs.religious_influence >= 75,
|
| 114 |
+
"unlocked": False
|
| 115 |
+
},
|
| 116 |
+
{
|
| 117 |
+
"id": "STABILITY_1",
|
| 118 |
+
"name": "پایداری سیاسی",
|
| 119 |
+
"description": "ثبات سیاسی بیش از 80% برای 10 سال متوالی",
|
| 120 |
+
"category": "Politics",
|
| 121 |
+
"points": 60,
|
| 122 |
+
"condition": lambda gs: gs.political_stability >= 80,
|
| 123 |
+
"unlocked": False,
|
| 124 |
+
"consecutive_years": 0
|
| 125 |
+
},
|
| 126 |
+
{
|
| 127 |
+
"id": "HAPPINESS_1",
|
| 128 |
+
"name": "سرزمین شادی",
|
| 129 |
+
"description": "شادی مردم بیش از 75% برای 5 سال متوالی",
|
| 130 |
+
"category": "Society",
|
| 131 |
+
"points": 50,
|
| 132 |
+
"condition": lambda gs: gs.happiness >= 75,
|
| 133 |
+
"unlocked": False,
|
| 134 |
+
"consecutive_years": 0
|
| 135 |
+
}
|
| 136 |
+
]
|
| 137 |
+
|
| 138 |
+
def _create_personal_objectives(self):
|
| 139 |
+
"""ایجاد اهداف شخصی بر اساس کشور انتخابی"""
|
| 140 |
+
country = self.game_state.player_country["name"]
|
| 141 |
+
|
| 142 |
+
# اهداف عمومی
|
| 143 |
+
general_objectives = [
|
| 144 |
+
{
|
| 145 |
+
"id": "GENERAL_1",
|
| 146 |
+
"name": "توسعه اقتصادی",
|
| 147 |
+
"description": "افزایش درآمد تجاری به 70%",
|
| 148 |
+
"target_value": 70,
|
| 149 |
+
"current_value": self.game_state.economy["trade"],
|
| 150 |
+
"reward": {"gold": 5000, "culture_score": 5},
|
| 151 |
+
"completed": False
|
| 152 |
+
},
|
| 153 |
+
{
|
| 154 |
+
"id": "GENERAL_2",
|
| 155 |
+
"name": "تثبیت حکومت",
|
| 156 |
+
"description": "افزایش ثبات سیاسی به 80%",
|
| 157 |
+
"target_value": 80,
|
| 158 |
+
"current_value": self.game_state.political_stability,
|
| 159 |
+
"reward": {"political_stability": 10, "diplomacy_points": 5},
|
| 160 |
+
"completed": False
|
| 161 |
+
}
|
| 162 |
+
]
|
| 163 |
+
|
| 164 |
+
# اهداف خاص کشور
|
| 165 |
+
country_objectives = []
|
| 166 |
+
if country == "پادشاهی ایران":
|
| 167 |
+
country_objectives = [
|
| 168 |
+
{
|
| 169 |
+
"id": "IRAN_1",
|
| 170 |
+
"name": "اتحاد با همسایگان",
|
| 171 |
+
"description": "ارتقای روابط با مصر و چین به سطح متحد",
|
| 172 |
+
"target_value": 70,
|
| 173 |
+
"current_value": min(
|
| 174 |
+
self.game_state.relations.get("مصر", 0),
|
| 175 |
+
self.game_state.relations.get("چین", 0)
|
| 176 |
+
),
|
| 177 |
+
"reward": {"relations": {"+": 20}, "culture_score": 10},
|
| 178 |
+
"completed": False
|
| 179 |
+
},
|
| 180 |
+
{
|
| 181 |
+
"id": "IRAN_2",
|
| 182 |
+
"name": "گسترش فرهنگ",
|
| 183 |
+
"description": "افزایش نفوذ فرهنگی به 60%",
|
| 184 |
+
"target_value": 60,
|
| 185 |
+
"current_value": self.game_state.cultural_influence,
|
| 186 |
+
"reward": {"cultural_influence": 15, "culture_score": 15},
|
| 187 |
+
"completed": False
|
| 188 |
+
}
|
| 189 |
+
]
|
| 190 |
+
elif country == "امپراتوری عثمانی":
|
| 191 |
+
country_objectives = [
|
| 192 |
+
{
|
| 193 |
+
"id": "OTTOMAN_1",
|
| 194 |
+
"name": "تسلط بر منطقه",
|
| 195 |
+
"description": "کنترل 5 کشور همسایه",
|
| 196 |
+
"target_value": 5,
|
| 197 |
+
"current_value": self.game_state.controlled_territories - 1,
|
| 198 |
+
"reward": {"controlled_territories": 2, "military_strength": 15},
|
| 199 |
+
"completed": False
|
| 200 |
+
},
|
| 201 |
+
{
|
| 202 |
+
"id": "OTTOMAN_2",
|
| 203 |
+
"name": "تقویت نیروی دریایی",
|
| 204 |
+
"description": "افزایش نیروی دریایی به 70%",
|
| 205 |
+
"target_value": 70,
|
| 206 |
+
"current_value": self.game_state.military_strength * 0.6, # فرض میکنیم 60% نیروی دریایی است
|
| 207 |
+
"reward": {"military": {"navy": 20}, "economy": {"trade": 10}},
|
| 208 |
+
"completed": False
|
| 209 |
+
}
|
| 210 |
+
]
|
| 211 |
+
|
| 212 |
+
self.personal_objectives = general_objectives + country_objectives
|
| 213 |
+
|
| 214 |
+
def display_achievements(self):
|
| 215 |
+
"""نمایش دستاوردها به بازیکن"""
|
| 216 |
+
from ui.console_ui import ConsoleUI
|
| 217 |
+
|
| 218 |
+
ConsoleUI.clear_screen()
|
| 219 |
+
ConsoleUI.display_section_title("دستاوردها")
|
| 220 |
+
|
| 221 |
+
# نمایش دستاوردهای بازشده
|
| 222 |
+
ConsoleUI.display_section_title("دستاوردهای کسب شده", width=60)
|
| 223 |
+
unlocked = [a for a in self.achievements if a["unlocked"]]
|
| 224 |
+
|
| 225 |
+
if not unlocked:
|
| 226 |
+
ConsoleUI.display_message("شما هنوز هیچ دستاوردی کسب نکردهاید.", indent=2)
|
| 227 |
+
else:
|
| 228 |
+
total_points = sum(a["points"] for a in unlocked)
|
| 229 |
+
ConsoleUI.display_message(f"مجموع امتیازات: {total_points}", indent=2)
|
| 230 |
+
|
| 231 |
+
for achievement in unlocked:
|
| 232 |
+
ConsoleUI.display_message(f"✓ {achievement['name']} ({achievement['points']} امتیاز)", indent=2)
|
| 233 |
+
ConsoleUI.display_message(f" {achievement['description']}", indent=4)
|
| 234 |
+
|
| 235 |
+
# نمایش دستاوردهای قابل کسب
|
| 236 |
+
ConsoleUI.display_section_title("دستاوردهای قابل کسب", width=60)
|
| 237 |
+
locked = [a for a in self.achievements if not a["unlocked"]]
|
| 238 |
+
|
| 239 |
+
if not locked:
|
| 240 |
+
ConsoleUI.display_message("شما تمام دستاوردها را کسب کردهاید!", indent=2)
|
| 241 |
+
else:
|
| 242 |
+
for achievement in locked:
|
| 243 |
+
ConsoleUI.display_message(f"□ {achievement['name']} ({achievement['points']} امتیاز)", indent=2)
|
| 244 |
+
ConsoleUI.display_message(f" {achievement['description']}", indent=4)
|
| 245 |
+
|
| 246 |
+
ConsoleUI.wait_for_enter()
|
| 247 |
+
|
| 248 |
+
def display_personal_objectives(self):
|
| 249 |
+
"""نمایش اهداف شخصی به بازیکن"""
|
| 250 |
+
from ui.console_ui import ConsoleUI
|
| 251 |
+
|
| 252 |
+
ConsoleUI.clear_screen()
|
| 253 |
+
ConsoleUI.display_section_title("اهداف شخصی")
|
| 254 |
+
|
| 255 |
+
if not self.personal_objectives:
|
| 256 |
+
ConsoleUI.display_message("شما هیچ هدف شخصی ندارید.", indent=2)
|
| 257 |
+
ConsoleUI.wait_for_enter()
|
| 258 |
+
return
|
| 259 |
+
|
| 260 |
+
for objective in self.personal_objectives:
|
| 261 |
+
status = "✓" if objective["completed"] else "□"
|
| 262 |
+
progress = min(100, int((objective["current_value"] / objective["target_value"]) * 100))
|
| 263 |
+
|
| 264 |
+
ConsoleUI.display_message(f"{status} {objective['name']}", indent=2)
|
| 265 |
+
ConsoleUI.display_message(f" {objective['description']}", indent=4)
|
| 266 |
+
ConsoleUI.display_message(f" پیشرفت: {progress}% ({objective['current_value']}/{objective['target_value']})", indent=4)
|
| 267 |
+
|
| 268 |
+
# نمایش پاداش در صورت تکمیل
|
| 269 |
+
if objective["completed"]:
|
| 270 |
+
ConsoleUI.display_message(" پاداش کسب شده:", indent=4)
|
| 271 |
+
for reward, value in objective["reward"].items():
|
| 272 |
+
if isinstance(value, dict) and "+" in value:
|
| 273 |
+
ConsoleUI.display_message(f" • {reward}: +{value['+']}", indent=6)
|
| 274 |
+
else:
|
| 275 |
+
ConsoleUI.display_message(f" • {reward}: +{value}", indent=6)
|
| 276 |
+
|
| 277 |
+
ConsoleUI.wait_for_enter()
|
| 278 |
+
|
| 279 |
+
def check_achievements(self):
|
| 280 |
+
"""بررسی و بهروزرسانی دستاوردها"""
|
| 281 |
+
for achievement in self.achievements:
|
| 282 |
+
if achievement["unlocked"]:
|
| 283 |
+
continue
|
| 284 |
+
|
| 285 |
+
# برای دستاوردهایی که نیاز به سالهای متوالی دارند
|
| 286 |
+
if "consecutive_years" in achievement:
|
| 287 |
+
if achievement["condition"](self.game_state):
|
| 288 |
+
achievement["consecutive_years"] += 1
|
| 289 |
+
if achievement["consecutive_years"] >= 5: # فرض میکنیم 5 سال متوالی لازم است
|
| 290 |
+
self._unlock_achievement(achievement)
|
| 291 |
+
else:
|
| 292 |
+
achievement["consecutive_years"] = 0
|
| 293 |
+
|
| 294 |
+
# برای دستاوردهای معمولی
|
| 295 |
+
elif achievement["condition"](self.game_state):
|
| 296 |
+
self._unlock_achievement(achievement)
|
| 297 |
+
|
| 298 |
+
def _unlock_achievement(self, achievement):
|
| 299 |
+
"""باز کردن یک دستاورد"""
|
| 300 |
+
achievement["unlocked"] = True
|
| 301 |
+
self.completed_achievements.append(achievement)
|
| 302 |
+
|
| 303 |
+
from ui.console_ui import ConsoleUI
|
| 304 |
+
ConsoleUI.display_success(f"دستاورد جدید کسب شد: {achievement['name']}!")
|
| 305 |
+
ConsoleUI.display_message(f"{achievement['description']}")
|
| 306 |
+
ConsoleUI.display_message(f"امتیاز: {achievement['points']}")
|
| 307 |
+
ConsoleUI.wait_for_enter()
|
| 308 |
+
|
| 309 |
+
def check_personal_objectives(self):
|
| 310 |
+
"""بررسی و بهروزرسانی اهداف شخصی"""
|
| 311 |
+
for objective in self.personal_objectives:
|
| 312 |
+
if objective["completed"]:
|
| 313 |
+
continue
|
| 314 |
+
|
| 315 |
+
# بهروزرسانی مقدار فعلی
|
| 316 |
+
if objective["id"] == "GENERAL_1":
|
| 317 |
+
objective["current_value"] = self.game_state.economy["trade"]
|
| 318 |
+
elif objective["id"] == "GENERAL_2":
|
| 319 |
+
objective["current_value"] = self.game_state.political_stability
|
| 320 |
+
elif objective["id"] == "IRAN_1" or objective["id"] == "OTTOMAN_1":
|
| 321 |
+
objective["current_value"] = self.game_state.controlled_territories - 1
|
| 322 |
+
elif objective["id"] == "IRAN_2":
|
| 323 |
+
objective["current_value"] = self.game_state.cultural_influence
|
| 324 |
+
|
| 325 |
+
# بررسی تکمیل هدف
|
| 326 |
+
if objective["current_value"] >= objective["target_value"]:
|
| 327 |
+
self._complete_objective(objective)
|
| 328 |
+
|
| 329 |
+
def _complete_objective(self, objective):
|
| 330 |
+
"""تکمیل یک هدف شخصی و اعمال پاداش"""
|
| 331 |
+
objective["completed"] = True
|
| 332 |
+
|
| 333 |
+
# اعمال پاداش
|
| 334 |
+
for reward_type, value in objective["reward"].items():
|
| 335 |
+
if reward_type == "relations" and isinstance(value, dict) and "+" in value:
|
| 336 |
+
for country in self.game_state.relations:
|
| 337 |
+
if country != self.game_state.player_country["name"]:
|
| 338 |
+
self.game_state.relations[country] = min(100, self.game_state.relations[country] + value["+"])
|
| 339 |
+
elif reward_type in self.game_state:
|
| 340 |
+
self.game_state[reward_type] = min(100, self.game_state[reward_type] + value)
|
| 341 |
+
elif reward_type in self.game_state.economy:
|
| 342 |
+
self.game_state.economy[reward_type] = min(100, self.game_state.economy[reward_type] + value)
|
| 343 |
+
elif reward_type == "military" and isinstance(value, dict):
|
| 344 |
+
for tech, val in value.items():
|
| 345 |
+
self.game_state.technology[tech] = min(10, self.game_state.technology[tech] + val)
|
| 346 |
+
elif reward_type == "gold":
|
| 347 |
+
self.game_state.gold += value
|
| 348 |
+
|
| 349 |
+
from ui.console_ui import ConsoleUI
|
| 350 |
+
ConsoleUI.display_success(f"هدف شخصی کامل شد: {objective['name']}!")
|
| 351 |
+
ConsoleUI.display_message("پاداش:")
|
| 352 |
+
for reward, value in objective["reward"].items():
|
| 353 |
+
if isinstance(value, dict) and "+" in value:
|
| 354 |
+
ConsoleUI.display_message(f"• {reward}: +{value['+']}")
|
| 355 |
+
else:
|
| 356 |
+
ConsoleUI.display_message(f"• {reward}: +{value}")
|
| 357 |
+
ConsoleUI.wait_for_enter()
|
| 358 |
+
|
| 359 |
+
def annual_update(self):
|
| 360 |
+
"""بهروزرسانیهای سالانه سیستم دستاوردها"""
|
| 361 |
+
self.check_achievements()
|
| 362 |
+
self.check_personal_objectives()
|
Shadows_of_Empires/game/calendar/calendar_system.py
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
سیستم تقویم و رویدادهای تاریخی
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
from data.events.event_definitions import EVENTS
|
| 6 |
+
from data.events.historical_events import HISTORICAL_EVENTS
|
| 7 |
+
|
| 8 |
+
class CalendarSystem:
|
| 9 |
+
"""سیستم مدیریت تقویم و رویدادهای تاریخی"""
|
| 10 |
+
|
| 11 |
+
def __init__(self, game_state):
|
| 12 |
+
"""ساخت یک نمونه جدید از سیستم تقویم"""
|
| 13 |
+
self.game_state = game_state
|
| 14 |
+
|
| 15 |
+
def initialize(self):
|
| 16 |
+
"""راهاندازی اولیه سیستم تقویم"""
|
| 17 |
+
# تنظیم تقویم بر اساس کشور انتخابی
|
| 18 |
+
country = self.game_state.player_country
|
| 19 |
+
self.calendar_type = country.get("calendar", "Gregorian")
|
| 20 |
+
self.starting_year = country.get("starting_year", 1500)
|
| 21 |
+
|
| 22 |
+
# تنظیم رویدادهای تاریخی خاص کشور
|
| 23 |
+
self.country_historical_events = []
|
| 24 |
+
if "historical_events" in country:
|
| 25 |
+
self.country_historical_events = country["historical_events"]
|
| 26 |
+
|
| 27 |
+
def select_random_event(self):
|
| 28 |
+
"""انتخاب یک رویداد تصادفی بر اساس شرایط فعلی"""
|
| 29 |
+
eligible_events = []
|
| 30 |
+
|
| 31 |
+
for event in EVENTS:
|
| 32 |
+
# بررسی شرایط فعالسازی رویداد
|
| 33 |
+
if self._check_event_trigger(event):
|
| 34 |
+
eligible_events.append(event)
|
| 35 |
+
|
| 36 |
+
# اگر رویداد مناسبی وجود نداشت، یک رویداد تصادفی انتخاب کن
|
| 37 |
+
if not eligible_events:
|
| 38 |
+
return self.game_state.random.choice(EVENTS)
|
| 39 |
+
|
| 40 |
+
return self.game_state.random.choice(eligible_events)
|
| 41 |
+
|
| 42 |
+
def select_historical_event(self):
|
| 43 |
+
"""انتخاب یک رویداد تاریخی بر اساس سال فعلی"""
|
| 44 |
+
# ابتدا رویدادهای کشور خاص را بررسی میکنیم
|
| 45 |
+
for event in self.country_historical_events:
|
| 46 |
+
if event["year"] == self.game_state.current_year:
|
| 47 |
+
return event
|
| 48 |
+
|
| 49 |
+
# سپس رویدادهای جهانی را بررسی میکنیم
|
| 50 |
+
for event in HISTORICAL_EVENTS:
|
| 51 |
+
if event["year"] == self.game_state.current_year:
|
| 52 |
+
return event
|
| 53 |
+
|
| 54 |
+
# اگر رویدادی برای این سال وجود نداشت، یک رویداد تصادفی انتخاب کن
|
| 55 |
+
return self.game_state.random.choice(HISTORICAL_EVENTS)
|
| 56 |
+
|
| 57 |
+
def _check_event_trigger(self, event):
|
| 58 |
+
"""بررسی شرایط فعالسازی رویداد"""
|
| 59 |
+
# اگر تریگری تعریف نشده باشد، همیشه فعال است
|
| 60 |
+
if "trigger" not in event:
|
| 61 |
+
return True
|
| 62 |
+
|
| 63 |
+
# ارزیابی تریگر
|
| 64 |
+
return event["trigger"](self.game_state)
|
| 65 |
+
|
| 66 |
+
def apply_event_choice(self, event, choice_idx):
|
| 67 |
+
"""اعمال انتخاب بازیکن برای رویداد"""
|
| 68 |
+
choice = event["choices"][choice_idx-1]
|
| 69 |
+
effects = choice["effects"]
|
| 70 |
+
|
| 71 |
+
# اعمال اثرات انتخاب
|
| 72 |
+
self._apply_effects(effects)
|
| 73 |
+
|
| 74 |
+
# ذخیره رویداد در تاریخچه
|
| 75 |
+
self.game_state.events_history.append({
|
| 76 |
+
"year": self.game_state.current_year,
|
| 77 |
+
"event": event["name"],
|
| 78 |
+
"choice": choice["text"]
|
| 79 |
+
})
|
| 80 |
+
|
| 81 |
+
def apply_historical_event_choice(self, event, choice_idx):
|
| 82 |
+
"""اعمال انتخاب بازیکن برای رویداد تاریخی"""
|
| 83 |
+
choice = event["choices"][choice_idx-1]
|
| 84 |
+
effects = choice["effects"]
|
| 85 |
+
|
| 86 |
+
# اعمال اثرات انتخاب
|
| 87 |
+
self._apply_effects(effects)
|
| 88 |
+
|
| 89 |
+
# ذخیره رویداد در تاریخچه
|
| 90 |
+
self.game_state.events_history.append({
|
| 91 |
+
"year": self.game_state.current_year,
|
| 92 |
+
"event": f"[تاریخی] {event['name']}",
|
| 93 |
+
"choice": choice["text"]
|
| 94 |
+
})
|
| 95 |
+
|
| 96 |
+
def _apply_effects(self, effects):
|
| 97 |
+
"""اعمال اثرات به وضعیت بازی"""
|
| 98 |
+
# اثرات مالی
|
| 99 |
+
if "gold" in effects:
|
| 100 |
+
self.game_state.gold += effects["gold"]
|
| 101 |
+
|
| 102 |
+
# اثرات نارضایتی عمومی
|
| 103 |
+
if "public_dissatisfaction" in effects:
|
| 104 |
+
self.game_state.public_dissatisfaction = max(0, min(100,
|
| 105 |
+
self.game_state.public_dissatisfaction + effects["public_dissatisfaction"]))
|
| 106 |
+
|
| 107 |
+
# اثرات ثبات سیاسی
|
| 108 |
+
if "political_stability" in effects:
|
| 109 |
+
self.game_state.political_stability = max(0, min(100,
|
| 110 |
+
self.game_state.political_stability + effects["political_stability"]))
|
| 111 |
+
|
| 112 |
+
# اثرات اقتصادی
|
| 113 |
+
if "economy" in effects:
|
| 114 |
+
for sector, value in effects["economy"].items():
|
| 115 |
+
if sector in self.game_state.economy:
|
| 116 |
+
self.game_state.economy[sector] = max(0, min(100,
|
| 117 |
+
self.game_state.economy[sector] + value))
|
| 118 |
+
|
| 119 |
+
# اثرات روابط
|
| 120 |
+
if "relations" in effects:
|
| 121 |
+
change = effects["relations"].get("+", 0) - effects["relations"].get("-", 0)
|
| 122 |
+
for name in self.game_state.relations:
|
| 123 |
+
if name != self.game_state.player_country["name"]:
|
| 124 |
+
self.game_state.relations[name] = max(-100, min(100,
|
| 125 |
+
self.game_state.relations[name] + change))
|
| 126 |
+
|
| 127 |
+
# اثرات دیپلماسی
|
| 128 |
+
if "diplomacy_points" in effects:
|
| 129 |
+
self.game_state.diplomacy_points = max(0,
|
| 130 |
+
self.game_state.diplomacy_points + effects["diplomacy_points"])
|
| 131 |
+
|
| 132 |
+
# اثرات فرهنگی
|
| 133 |
+
if "culture_score" in effects:
|
| 134 |
+
self.game_state.culture_score = max(0, min(100,
|
| 135 |
+
self.game_state.culture_score + effects["culture_score"]))
|
| 136 |
+
|
| 137 |
+
# اثرات دینی
|
| 138 |
+
if "religious_influence" in effects:
|
| 139 |
+
self.game_state.religious_influence = max(0, min(100,
|
| 140 |
+
self.game_state.religious_influence + effects["religious_influence"]))
|
| 141 |
+
|
| 142 |
+
# اثرات فناوری
|
| 143 |
+
if "technology" in effects:
|
| 144 |
+
for tech, value in effects["technology"].items():
|
| 145 |
+
if tech in self.game_state.technology:
|
| 146 |
+
self.game_state.technology[tech] = max(1,
|
| 147 |
+
self.game_state.technology[tech] + value)
|
| 148 |
+
|
| 149 |
+
# اثرات جمعیت
|
| 150 |
+
if "population" in effects:
|
| 151 |
+
self.game_state.population = max(100000,
|
| 152 |
+
self.game_state.population + effects["population"])
|
| 153 |
+
|
| 154 |
+
# اثرات محیط زیست
|
| 155 |
+
if "environment" in effects:
|
| 156 |
+
for factor, value in effects["environment"].items():
|
| 157 |
+
if factor in self.game_state.environment:
|
| 158 |
+
self.game_state.environment[factor] = max(0, min(100,
|
| 159 |
+
self.game_state.environment[factor] + value))
|
| 160 |
+
|
| 161 |
+
def annual_update(self):
|
| 162 |
+
"""بهروزرسانیهای سالانه تقویم"""
|
| 163 |
+
# بررسی رویدادهای سالانه تاریخی
|
| 164 |
+
historical_event = self.select_historical_event()
|
| 165 |
+
if historical_event and historical_event["year"] == self.game_state.current_year:
|
| 166 |
+
from ui.console_ui import ConsoleUI
|
| 167 |
+
ConsoleUI.display_historical_event(historical_event)
|
| 168 |
+
choice = ConsoleUI.get_player_choice(historical_event["choices"])
|
| 169 |
+
self.apply_historical_event_choice(historical_event, choice)
|
Shadows_of_Empires/game/climate/climate_system.py
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
سیستم مدیریت آبوهوایی و تغییرات اقلیمی
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
import random
|
| 6 |
+
from data.events.weather_events import WEATHER_EVENTS
|
| 7 |
+
|
| 8 |
+
class ClimateSystem:
|
| 9 |
+
"""سیستم مدیریت آبوهوایی و تغییرات اقلیمی"""
|
| 10 |
+
|
| 11 |
+
def __init__(self, game_state):
|
| 12 |
+
"""ساخت یک نمونه جدید از سیستم آبوهوایی"""
|
| 13 |
+
self.game_state = game_state
|
| 14 |
+
self.season = "Spring"
|
| 15 |
+
self.season_progress = 0
|
| 16 |
+
self.year_progress = 0
|
| 17 |
+
self.season_length = 0.25 # هر فصل 0.25 سال
|
| 18 |
+
|
| 19 |
+
def initialize(self):
|
| 20 |
+
"""راهاندازی اولیه سیستم آبوهوایی"""
|
| 21 |
+
# تعیین موقعیت جغرافیایی بر اساس کشور انتخابی
|
| 22 |
+
country = self.game_state.player_country
|
| 23 |
+
self.region = country.get("region", "Temperate")
|
| 24 |
+
|
| 25 |
+
# تنظیم پارامترهای اقلیمی اولیه
|
| 26 |
+
self.temperature = self._get_base_temperature()
|
| 27 |
+
self.humidity = random.randint(40, 70)
|
| 28 |
+
self.precipitation = random.randint(20, 50)
|
| 29 |
+
self.season = self._determine_season()
|
| 30 |
+
|
| 31 |
+
# تنظیم تأثیرات اقلیمی بر کشور
|
| 32 |
+
self._apply_climate_effects()
|
| 33 |
+
|
| 34 |
+
def _get_base_temperature(self):
|
| 35 |
+
"""دریافت دمای پایه بر اساس منطقه جغرافیایی"""
|
| 36 |
+
if self.region == "Tropical":
|
| 37 |
+
return random.randint(25, 35)
|
| 38 |
+
elif self.region == "Desert":
|
| 39 |
+
return random.randint(20, 40)
|
| 40 |
+
elif self.region == "Polar":
|
| 41 |
+
return random.randint(-20, 10)
|
| 42 |
+
elif self.region == "Mediterranean":
|
| 43 |
+
return random.randint(15, 28)
|
| 44 |
+
else: # Temperate
|
| 45 |
+
return random.randint(10, 25)
|
| 46 |
+
|
| 47 |
+
def _determine_season(self):
|
| 48 |
+
"""تعیین فصل فعلی بر اساس پیشرفت سال"""
|
| 49 |
+
if 0 <= self.year_progress < 0.25:
|
| 50 |
+
return "Spring"
|
| 51 |
+
elif 0.25 <= self.year_progress < 0.5:
|
| 52 |
+
return "Summer"
|
| 53 |
+
elif 0.5 <= self.year_progress < 0.75:
|
| 54 |
+
return "Autumn"
|
| 55 |
+
else:
|
| 56 |
+
return "Winter"
|
| 57 |
+
|
| 58 |
+
def _apply_climate_effects(self):
|
| 59 |
+
"""اعمال تأثیرات آبوهوایی بر وضعیت بازی"""
|
| 60 |
+
# تأثیر دما بر کشاورزی
|
| 61 |
+
if self.temperature < 10:
|
| 62 |
+
self.game_state.economy["agriculture"] = max(0,
|
| 63 |
+
self.game_state.economy["agriculture"] - 5)
|
| 64 |
+
elif self.temperature > 30:
|
| 65 |
+
self.game_state.economy["agriculture"] = max(0,
|
| 66 |
+
self.game_state.economy["agriculture"] - 10)
|
| 67 |
+
|
| 68 |
+
# تأثیر بارش بر کشاورزی
|
| 69 |
+
if self.precipitation < 20:
|
| 70 |
+
self.game_state.economy["agriculture"] = max(0,
|
| 71 |
+
self.game_state.economy["agriculture"] - 8)
|
| 72 |
+
elif self.precipitation > 60:
|
| 73 |
+
self.game_state.economy["agriculture"] = min(100,
|
| 74 |
+
self.game_state.economy["agriculture"] + 5)
|
| 75 |
+
|
| 76 |
+
# تأثیر رطوبت بر بهداشت
|
| 77 |
+
if self.humidity > 70:
|
| 78 |
+
self.game_state.health_index = max(0,
|
| 79 |
+
self.game_state.health_index - 3)
|
| 80 |
+
|
| 81 |
+
def select_weather_event(self):
|
| 82 |
+
"""انتخاب یک رویداد آبوهوایی بر اساس شرایط فعلی"""
|
| 83 |
+
eligible_events = []
|
| 84 |
+
|
| 85 |
+
for event in WEATHER_EVENTS:
|
| 86 |
+
# بررسی شرایط فعالسازی رویداد
|
| 87 |
+
if self._check_event_trigger(event):
|
| 88 |
+
eligible_events.append(event)
|
| 89 |
+
|
| 90 |
+
# اگر رویداد مناسبی وجود نداشت، یک رویداد تصادفی انتخاب کن
|
| 91 |
+
if not eligible_events:
|
| 92 |
+
return random.choice(WEATHER_EVENTS)
|
| 93 |
+
|
| 94 |
+
return random.choice(eligible_events)
|
| 95 |
+
|
| 96 |
+
def _check_event_trigger(self, event):
|
| 97 |
+
"""بررسی شرایط فعالسازی رویداد آبوهوایی"""
|
| 98 |
+
# اگر تریگری تعریف نشده باشد، همیشه فعال است
|
| 99 |
+
if "trigger" not in event:
|
| 100 |
+
return True
|
| 101 |
+
|
| 102 |
+
# ارزیابی تریگر
|
| 103 |
+
return event["trigger"](self)
|
| 104 |
+
|
| 105 |
+
def apply_weather_event_choice(self, event, choice_idx):
|
| 106 |
+
"""اعمال انتخاب بازیکن برای رویداد آبوهوایی"""
|
| 107 |
+
choice = event["choices"][choice_idx-1]
|
| 108 |
+
effects = choice["effects"]
|
| 109 |
+
|
| 110 |
+
# اعمال اثرات انتخاب
|
| 111 |
+
self._apply_effects(effects)
|
| 112 |
+
|
| 113 |
+
# ذخیره رویداد در تاریخچه
|
| 114 |
+
self.game_state.events_history.append({
|
| 115 |
+
"year": self.game_state.current_year,
|
| 116 |
+
"event": f"[آبوهوایی] {event['name']}",
|
| 117 |
+
"choice": choice["text"]
|
| 118 |
+
})
|
| 119 |
+
|
| 120 |
+
def _apply_effects(self, effects):
|
| 121 |
+
"""اعمال اثرات به وضعیت بازی"""
|
| 122 |
+
# اثرات مالی
|
| 123 |
+
if "gold" in effects:
|
| 124 |
+
self.game_state.gold += effects["gold"]
|
| 125 |
+
|
| 126 |
+
# اثرات کشاورزی
|
| 127 |
+
if "agriculture" in effects:
|
| 128 |
+
self.game_state.economy["agriculture"] = max(0, min(100,
|
| 129 |
+
self.game_state.economy["agriculture"] + effects["agriculture"]))
|
| 130 |
+
|
| 131 |
+
# اثرات بهداشت
|
| 132 |
+
if "health_index" in effects:
|
| 133 |
+
self.game_state.health_index = max(0, min(100,
|
| 134 |
+
self.game_state.health_index + effects["health_index"]))
|
| 135 |
+
|
| 136 |
+
# اثرات محیط زیست
|
| 137 |
+
if "environment" in effects:
|
| 138 |
+
for factor, value in effects["environment"].items():
|
| 139 |
+
if factor in self.game_state.environment:
|
| 140 |
+
self.game_state.environment[factor] = max(0, min(100,
|
| 141 |
+
self.game_state.environment[factor] + value))
|
| 142 |
+
|
| 143 |
+
def annual_update(self):
|
| 144 |
+
"""بهروزرسانیهای سالانه سیستم آبوهوایی"""
|
| 145 |
+
# پیشرفت فصل
|
| 146 |
+
self.season_progress += 0.01
|
| 147 |
+
self.year_progress += 0.01
|
| 148 |
+
|
| 149 |
+
# تغییر فصل
|
| 150 |
+
if self.season_progress >= self.season_length:
|
| 151 |
+
self.season_progress = 0
|
| 152 |
+
self.season = self._determine_season()
|
| 153 |
+
|
| 154 |
+
# تغییرات تصادفی دما
|
| 155 |
+
temp_change = random.randint(-2, 2)
|
| 156 |
+
self.temperature = max(-30, min(50, self.temperature + temp_change))
|
| 157 |
+
|
| 158 |
+
# تغییرات تصادفی رطوبت
|
| 159 |
+
humidity_change = random.randint(-5, 5)
|
| 160 |
+
self.humidity = max(0, min(100, self.humidity + humidity_change))
|
| 161 |
+
|
| 162 |
+
# تغییرات تصادفی بارش
|
| 163 |
+
precip_change = random.randint(-10, 10)
|
| 164 |
+
self.precipitation = max(0, min(100, self.precipitation + precip_change))
|
| 165 |
+
|
| 166 |
+
# اعمال تأثیرات جدید آبوهوایی
|
| 167 |
+
self._apply_climate_effects()
|
| 168 |
+
|
| 169 |
+
# بررسی رویدادهای آبوهوایی
|
| 170 |
+
if random.random() < 0.2: # 20% احتمال وقوع رویداد آبوهوایی
|
| 171 |
+
weather_event = self.select_weather_event()
|
| 172 |
+
if weather_event:
|
| 173 |
+
from ui.console_ui import ConsoleUI
|
| 174 |
+
ConsoleUI.display_weather_event(weather_event)
|
| 175 |
+
choice = ConsoleUI.get_player_choice(weather_event["choices"])
|
| 176 |
+
self.apply_weather_event_choice(weather_event, choice)
|
Shadows_of_Empires/game/crisis/crisis_management.py
ADDED
|
@@ -0,0 +1,386 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
سیستم مدیریت بحرانها و پاسخ به حوادث غیرمنتظره
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
class CrisisManagement:
|
| 6 |
+
"""سیستم مدیریت بحرانها و پاسخ به حوادث غیرمنتظره"""
|
| 7 |
+
|
| 8 |
+
def __init__(self, game_state):
|
| 9 |
+
"""ساخت یک نمونه جدید از سیستم مدیریت بحران"""
|
| 10 |
+
self.game_state = game_state
|
| 11 |
+
self.active_crises = []
|
| 12 |
+
self.crisis_history = []
|
| 13 |
+
|
| 14 |
+
def initialize(self):
|
| 15 |
+
"""راهاندازی اولیه سیستم مدیریت بحران"""
|
| 16 |
+
# تنظیم سطح بحران اولیه
|
| 17 |
+
self.game_state.crisis_level = 0
|
| 18 |
+
|
| 19 |
+
# افزودن بحرانهای اولیه بر اساس کشور
|
| 20 |
+
country = self.game_state.player_country
|
| 21 |
+
if "initial_crises" in country:
|
| 22 |
+
self.active_crises.extend(country["initial_crises"])
|
| 23 |
+
|
| 24 |
+
def display_crisis_status(self):
|
| 25 |
+
"""نمایش وضعیت بحرانهای فعلی"""
|
| 26 |
+
from ui.console_ui import ConsoleUI
|
| 27 |
+
|
| 28 |
+
ConsoleUI.clear_screen()
|
| 29 |
+
ConsoleUI.display_section_title("وضعیت بحرانها")
|
| 30 |
+
|
| 31 |
+
if not self.active_crises:
|
| 32 |
+
ConsoleUI.display_message("هیچ بحران فعالی در حال حاضر وجود ندارد.", indent=2)
|
| 33 |
+
else:
|
| 34 |
+
ConsoleUI.display_message(f"تعداد بحرانهای فعال: {len(self.active_crises)}", indent=2)
|
| 35 |
+
ConsoleUI.display_message(f"سطح کلی بحران: {self.game_state.crisis_level}/100", indent=2)
|
| 36 |
+
|
| 37 |
+
ConsoleUI.display_section_title("بحرانهای فعال", width=60)
|
| 38 |
+
for i, crisis in enumerate(self.active_crises, 1):
|
| 39 |
+
ConsoleUI.display_message(f"{i}. {crisis['name']}", indent=2)
|
| 40 |
+
ConsoleUI.display_message(f" شدت: {crisis['severity']}/100", indent=4)
|
| 41 |
+
ConsoleUI.display_message(f" توضیحات: {crisis['description']}", indent=4)
|
| 42 |
+
|
| 43 |
+
ConsoleUI.wait_for_enter()
|
| 44 |
+
|
| 45 |
+
def manage_city_crises(self):
|
| 46 |
+
"""مدیریت بحرانهای شهری"""
|
| 47 |
+
from ui.console_ui import ConsoleUI
|
| 48 |
+
|
| 49 |
+
ConsoleUI.clear_screen()
|
| 50 |
+
ConsoleUI.display_section_title("بحرانهای شهری")
|
| 51 |
+
|
| 52 |
+
# فیلتر شهرهایی که بحران دارند
|
| 53 |
+
crisis_cities = [city for city in self.game_state.cities
|
| 54 |
+
if city.get("crisis_level", 0) > 30]
|
| 55 |
+
|
| 56 |
+
if not crisis_cities:
|
| 57 |
+
ConsoleUI.display_message("هیچ شهری در وضعیت بحرانی نیست.", indent=2)
|
| 58 |
+
ConsoleUI.wait_for_enter()
|
| 59 |
+
return
|
| 60 |
+
|
| 61 |
+
# نمایش گزینهها
|
| 62 |
+
city_names = [city["name"] for city in crisis_cities]
|
| 63 |
+
city_names.append("برگشت")
|
| 64 |
+
|
| 65 |
+
choice = ConsoleUI.get_menu_choice(city_names)
|
| 66 |
+
|
| 67 |
+
if choice == len(city_names):
|
| 68 |
+
return # برگشت
|
| 69 |
+
|
| 70 |
+
city = crisis_cities[choice-1]
|
| 71 |
+
self.handle_city_crisis(city)
|
| 72 |
+
|
| 73 |
+
def handle_city_crisis(self, city):
|
| 74 |
+
"""مدیریت بحران یک شهر خاص"""
|
| 75 |
+
from ui.console_ui import ConsoleUI
|
| 76 |
+
|
| 77 |
+
ConsoleUI.clear_screen()
|
| 78 |
+
ConsoleUI.display_section_title(f"بحران در {city['name']}")
|
| 79 |
+
|
| 80 |
+
crisis_level = city.get("crisis_level", 50)
|
| 81 |
+
crisis_type = city.get("crisis_type", "Unknown")
|
| 82 |
+
|
| 83 |
+
ConsoleUI.display_message(f"نوع بحران: {crisis_type}", indent=2)
|
| 84 |
+
ConsoleUI.display_message(f"شدت بحران: {crisis_level}/100", indent=2)
|
| 85 |
+
ConsoleUI.display_message("گزینههای پاسخ به بحران:", indent=2)
|
| 86 |
+
|
| 87 |
+
# تعیین گزینههای پاسخ بر اساس نوع بحران
|
| 88 |
+
if crisis_type == "Famine":
|
| 89 |
+
options = [
|
| 90 |
+
"توزیع غذای اضطراری (5000 سکه)",
|
| 91 |
+
"واردات غذا از کشورهای دیگر (3000 سکه)",
|
| 92 |
+
"سرمایهگذاری در کشاورزی (8000 سکه)",
|
| 93 |
+
"بیتفاوتی"
|
| 94 |
+
]
|
| 95 |
+
costs = [5000, 3000, 8000, 0]
|
| 96 |
+
effects = [
|
| 97 |
+
{"crisis_level": -30, "public_dissatisfaction": -15},
|
| 98 |
+
{"crisis_level": -20, "relations": {"+": 5}},
|
| 99 |
+
{"crisis_level": -40, "economy": {"agriculture": 10}},
|
| 100 |
+
{"crisis_level": 20, "public_dissatisfaction": 25}
|
| 101 |
+
]
|
| 102 |
+
elif crisis_type == "Rebellion":
|
| 103 |
+
options = [
|
| 104 |
+
"سرکوب نظامی (7000 سکه)",
|
| 105 |
+
"مذاکره با شورشیان (2000 سکه)",
|
| 106 |
+
"اصلاحات اجتماعی (5000 سکه)",
|
| 107 |
+
"بیتفاوتی"
|
| 108 |
+
]
|
| 109 |
+
costs = [7000, 2000, 5000, 0]
|
| 110 |
+
effects = [
|
| 111 |
+
{"crisis_level": -40, "military_strength": -10, "public_dissatisfaction": 10},
|
| 112 |
+
{"crisis_level": -25, "public_dissatisfaction": -15},
|
| 113 |
+
{"crisis_level": -35, "political_stability": 10},
|
| 114 |
+
{"crisis_level": 30, "public_dissatisfaction": 30}
|
| 115 |
+
]
|
| 116 |
+
elif crisis_type == "Disease":
|
| 117 |
+
options = [
|
| 118 |
+
"تخصیص بودجه به سیستم بهداشت (6000 سکه)",
|
| 119 |
+
"همکاری با سازمان جهانی بهداشت (4000 سکه)",
|
| 120 |
+
"محدودیتهای شدید (0 سکه)",
|
| 121 |
+
"بیتفاوتی"
|
| 122 |
+
]
|
| 123 |
+
costs = [6000, 4000, 0, 0]
|
| 124 |
+
effects = [
|
| 125 |
+
{"crisis_level": -35, "health_index": 15},
|
| 126 |
+
{"crisis_level": -25, "relations": {"+": 10}},
|
| 127 |
+
{"crisis_level": -20, "economy": {"trade": -10, "industry": -5}},
|
| 128 |
+
{"crisis_level": 35, "health_index": -20}
|
| 129 |
+
]
|
| 130 |
+
else: # Unknown crisis
|
| 131 |
+
options = [
|
| 132 |
+
"ارسال تیم ارزیابی (2000 سکه)",
|
| 133 |
+
"درخواست کمک بینالمللی (1000 سکه)",
|
| 134 |
+
"بررسی داخلی (0 سکه)",
|
| 135 |
+
"بیتفاوتی"
|
| 136 |
+
]
|
| 137 |
+
costs = [2000, 1000, 0, 0]
|
| 138 |
+
effects = [
|
| 139 |
+
{"crisis_level": -10, "diplomacy_points": 5},
|
| 140 |
+
{"crisis_level": -15, "relations": {"+": 5}},
|
| 141 |
+
{"crisis_level": -5},
|
| 142 |
+
{"crisis_level": 20}
|
| 143 |
+
]
|
| 144 |
+
|
| 145 |
+
# نمایش گزینهها
|
| 146 |
+
options.append("برگشت")
|
| 147 |
+
costs.append(0)
|
| 148 |
+
effects.append({})
|
| 149 |
+
|
| 150 |
+
choice = ConsoleUI.get_menu_choice(options)
|
| 151 |
+
|
| 152 |
+
if choice == len(options):
|
| 153 |
+
return # برگشت
|
| 154 |
+
|
| 155 |
+
# بررسی موجودی برای گزینههای هزینهدار
|
| 156 |
+
if costs[choice-1] > 0 and self.game_state.gold < costs[choice-1]:
|
| 157 |
+
ConsoleUI.display_error("موجودی طلا کافی نیست!")
|
| 158 |
+
ConsoleUI.wait_for_enter()
|
| 159 |
+
return
|
| 160 |
+
|
| 161 |
+
# اعمال تغییرات
|
| 162 |
+
self._apply_crisis_response(city, costs[choice-1], effects[choice-1])
|
| 163 |
+
|
| 164 |
+
def _apply_crisis_response(self, city, cost, effects):
|
| 165 |
+
"""اعمال پاسخ به بحران و اثرات آن"""
|
| 166 |
+
from ui.console_ui import ConsoleUI
|
| 167 |
+
|
| 168 |
+
# کسر هزینه
|
| 169 |
+
if cost > 0:
|
| 170 |
+
self.game_state.gold -= cost
|
| 171 |
+
|
| 172 |
+
# اعمال اثرات
|
| 173 |
+
for effect_type, value in effects.items():
|
| 174 |
+
if effect_type == "crisis_level":
|
| 175 |
+
city["crisis_level"] = max(0, city["crisis_level"] + value)
|
| 176 |
+
self.game_state.crisis_level = max(0, self.game_state.crisis_level + value // 2)
|
| 177 |
+
elif effect_type == "relations":
|
| 178 |
+
for country in self.game_state.relations:
|
| 179 |
+
if country != self.game_state.player_country["name"]:
|
| 180 |
+
self.game_state.relations[country] = min(100, self.game_state.relations[country] + value["+"])
|
| 181 |
+
elif effect_type == "economy":
|
| 182 |
+
for sector, val in value.items():
|
| 183 |
+
self.game_state.economy[sector] = max(0, min(100, self.game_state.economy[sector] + val))
|
| 184 |
+
else:
|
| 185 |
+
if effect_type in self.game_state:
|
| 186 |
+
self.game_state[effect_type] = max(0, min(100, self.game_state[effect_type] + value))
|
| 187 |
+
elif effect_type in self.game_state.economy:
|
| 188 |
+
self.game_state.economy[effect_type] = max(0, min(100, self.game_state.economy[effect_type] + value))
|
| 189 |
+
|
| 190 |
+
# بررسی اگر بحران حل شده است
|
| 191 |
+
if city["crisis_level"] <= 0:
|
| 192 |
+
ConsoleUI.display_success(f"بحران در {city['name']} با موفقیت حل شد!")
|
| 193 |
+
if "crisis_type" in city:
|
| 194 |
+
del city["crisis_type"]
|
| 195 |
+
if "crisis_level" in city:
|
| 196 |
+
del city["crisis_level"]
|
| 197 |
+
else:
|
| 198 |
+
ConsoleUI.display_message(f"بحران در {city['name']} کاهش یافت، اما هنوز وجود دارد.")
|
| 199 |
+
|
| 200 |
+
ConsoleUI.wait_for_enter()
|
| 201 |
+
|
| 202 |
+
def generate_random_crisis(self):
|
| 203 |
+
"""تولید یک بحران تصادفی"""
|
| 204 |
+
import random
|
| 205 |
+
|
| 206 |
+
crisis_types = [
|
| 207 |
+
{
|
| 208 |
+
"name": "قحطی",
|
| 209 |
+
"description": "خشکسالی شدید باعث کاهش تولیدات کشاورزی شده است.",
|
| 210 |
+
"severity": random.randint(30, 70),
|
| 211 |
+
"type": "Famine",
|
| 212 |
+
"effects": {
|
| 213 |
+
"public_dissatisfaction": 5,
|
| 214 |
+
"economy": {"agriculture": -10}
|
| 215 |
+
}
|
| 216 |
+
},
|
| 217 |
+
{
|
| 218 |
+
"name": "شورش",
|
| 219 |
+
"description": "گروهی از مردم علیه دولت شورش کردهاند.",
|
| 220 |
+
"severity": random.randint(40, 80),
|
| 221 |
+
"type": "Rebellion",
|
| 222 |
+
"effects": {
|
| 223 |
+
"political_stability": -8,
|
| 224 |
+
"public_dissatisfaction": 10
|
| 225 |
+
}
|
| 226 |
+
},
|
| 227 |
+
{
|
| 228 |
+
"name": "بیماری همهگیر",
|
| 229 |
+
"description": "یک بیماری واگیردار در کشور شیوع یافته است.",
|
| 230 |
+
"severity": random.randint(35, 75),
|
| 231 |
+
"type": "Disease",
|
| 232 |
+
"effects": {
|
| 233 |
+
"health_index": -10,
|
| 234 |
+
"population": -5
|
| 235 |
+
}
|
| 236 |
+
},
|
| 237 |
+
{
|
| 238 |
+
"name": "بحران اقتصادی",
|
| 239 |
+
"description": "رکود اقتصادی شدید رخ داده است.",
|
| 240 |
+
"severity": random.randint(25, 65),
|
| 241 |
+
"type": "Economic",
|
| 242 |
+
"effects": {
|
| 243 |
+
"economy": {"inflation": 15, "unemployment": 10},
|
| 244 |
+
"gold": -2000
|
| 245 |
+
}
|
| 246 |
+
}
|
| 247 |
+
]
|
| 248 |
+
|
| 249 |
+
return random.choice(crisis_types)
|
| 250 |
+
|
| 251 |
+
def handle_national_crisis(self):
|
| 252 |
+
"""مدیریت بحرانهای ملی"""
|
| 253 |
+
from ui.console_ui import ConsoleUI
|
| 254 |
+
|
| 255 |
+
# اگر بحرانی وجود نداشت، یک بحران تصادفی ایجاد کن
|
| 256 |
+
if self.game_state.crisis_level < 20:
|
| 257 |
+
crisis = self.generate_random_crisis()
|
| 258 |
+
self.active_crises.append(crisis)
|
| 259 |
+
self.game_state.crisis_level = crisis["severity"]
|
| 260 |
+
|
| 261 |
+
ConsoleUI.clear_screen()
|
| 262 |
+
ConsoleUI.display_section_title("بحران ملی")
|
| 263 |
+
|
| 264 |
+
# نمایش اطلاعات بحران
|
| 265 |
+
crisis = self.active_crises[0] # فرض میکنیم فقط یک بحران ملی وجود دارد
|
| 266 |
+
ConsoleUI.display_message(f"نوع بحران: {crisis['name']}", indent=2)
|
| 267 |
+
ConsoleUI.display_message(f"شرح: {crisis['description']}", indent=2)
|
| 268 |
+
ConsoleUI.display_message(f"شدت: {self.game_state.crisis_level}/100", indent=2)
|
| 269 |
+
|
| 270 |
+
# گزینههای پاسخ به بحران
|
| 271 |
+
options = [
|
| 272 |
+
"تخصیص منابع مالی (8000 سکه)",
|
| 273 |
+
"درخواست کمک بینالمللی (3000 سکه)",
|
| 274 |
+
"اصلاحات ساختاری (5000 سکه)",
|
| 275 |
+
"بیتفاوتی"
|
| 276 |
+
]
|
| 277 |
+
costs = [8000, 3000, 5000, 0]
|
| 278 |
+
effects = [
|
| 279 |
+
{"crisis_level": -30, "gold": -8000},
|
| 280 |
+
{"crisis_level": -20, "relations": {"+": 10}},
|
| 281 |
+
{"crisis_level": -40, "political_stability": 15},
|
| 282 |
+
{"crisis_level": 25, "public_dissatisfaction": 20}
|
| 283 |
+
]
|
| 284 |
+
|
| 285 |
+
# نمایش گزینهها
|
| 286 |
+
options.append("برگشت")
|
| 287 |
+
costs.append(0)
|
| 288 |
+
effects.append({})
|
| 289 |
+
|
| 290 |
+
choice = ConsoleUI.get_menu_choice(options)
|
| 291 |
+
|
| 292 |
+
if choice == len(options):
|
| 293 |
+
return # برگشت
|
| 294 |
+
|
| 295 |
+
# بررسی موجودی برای گزینههای هزینهدار
|
| 296 |
+
if costs[choice-1] > 0 and self.game_state.gold < costs[choice-1]:
|
| 297 |
+
ConsoleUI.display_error("موجودی طلا کافی نیست!")
|
| 298 |
+
ConsoleUI.wait_for_enter()
|
| 299 |
+
return
|
| 300 |
+
|
| 301 |
+
# اعمال تغییرات
|
| 302 |
+
self._apply_national_crisis_response(costs[choice-1], effects[choice-1], crisis)
|
| 303 |
+
|
| 304 |
+
def _apply_national_crisis_response(self, cost, effects, crisis):
|
| 305 |
+
"""اعمال پاسخ به بحران ملی و اثرات آن"""
|
| 306 |
+
from ui.console_ui import ConsoleUI
|
| 307 |
+
|
| 308 |
+
# کسر هزینه
|
| 309 |
+
if cost > 0:
|
| 310 |
+
self.game_state.gold -= cost
|
| 311 |
+
|
| 312 |
+
# اعمال اثرات
|
| 313 |
+
for effect_type, value in effects.items():
|
| 314 |
+
if effect_type == "crisis_level":
|
| 315 |
+
self.game_state.crisis_level = max(0, self.game_state.crisis_level + value)
|
| 316 |
+
elif effect_type == "relations":
|
| 317 |
+
for country in self.game_state.relations:
|
| 318 |
+
if country != self.game_state.player_country["name"]:
|
| 319 |
+
self.game_state.relations[country] = min(100, self.game_state.relations[country] + value["+"])
|
| 320 |
+
elif effect_type == "economy":
|
| 321 |
+
for sector, val in value.items():
|
| 322 |
+
self.game_state.economy[sector] = max(0, min(100, self.game_state.economy[sector] + val))
|
| 323 |
+
else:
|
| 324 |
+
if effect_type in self.game_state:
|
| 325 |
+
self.game_state[effect_type] = max(0, min(100, self.game_state[effect_type] + value))
|
| 326 |
+
elif effect_type in self.game_state.economy:
|
| 327 |
+
self.game_state.economy[effect_type] = max(0, min(100, self.game_state.economy[effect_type] + value))
|
| 328 |
+
|
| 329 |
+
# بررسی اگر بحران حل شده است
|
| 330 |
+
if self.game_state.crisis_level <= 0:
|
| 331 |
+
ConsoleUI.display_success("بحران ملی با موفقیت حل شد!")
|
| 332 |
+
self.active_crises = []
|
| 333 |
+
self.game_state.crisis_level = 0
|
| 334 |
+
else:
|
| 335 |
+
ConsoleUI.display_message("بحران کاهش یافت، اما هنوز وجود دارد.")
|
| 336 |
+
|
| 337 |
+
ConsoleUI.wait_for_enter()
|
| 338 |
+
|
| 339 |
+
def annual_update(self):
|
| 340 |
+
"""بهروزرسانیهای سالانه سیستم بحران"""
|
| 341 |
+
# افزایش تدریجی بحرانها
|
| 342 |
+
for crisis in self.active_crises:
|
| 343 |
+
crisis["severity"] = min(100, crisis["severity"] + random.randint(1, 3))
|
| 344 |
+
|
| 345 |
+
# بهروزرسانی سطح بحران کلی
|
| 346 |
+
if self.active_crises:
|
| 347 |
+
total_severity = sum(crisis["severity"] for crisis in self.active_crises)
|
| 348 |
+
self.game_state.crisis_level = min(100, total_severity // len(self.active_crises))
|
| 349 |
+
else:
|
| 350 |
+
self.game_state.crisis_level = max(0, self.game_state.crisis_level - 5)
|
| 351 |
+
|
| 352 |
+
# اعمال اثرات بحران بر وضعیت کلی
|
| 353 |
+
self._apply_crisis_effects()
|
| 354 |
+
|
| 355 |
+
# بررسی ایجاد بحرانهای جدید
|
| 356 |
+
self._check_for_new_crises()
|
| 357 |
+
|
| 358 |
+
def _apply_crisis_effects(self):
|
| 359 |
+
"""اعمال اثرات بحرانها بر وضعیت کلی بازی"""
|
| 360 |
+
if self.game_state.crisis_level > 70:
|
| 361 |
+
self.game_state.political_stability = max(0, self.game_state.political_stability - 5)
|
| 362 |
+
self.game_state.public_dissatisfaction = min(100, self.game_state.public_dissatisfaction + 8)
|
| 363 |
+
elif self.game_state.crisis_level > 40:
|
| 364 |
+
self.game_state.political_stability = max(0, self.game_state.political_stability - 3)
|
| 365 |
+
self.game_state.public_dissatisfaction = min(100, self.game_state.public_dissatisfaction + 4)
|
| 366 |
+
elif self.game_state.crisis_level > 20:
|
| 367 |
+
self.game_state.political_stability = max(0, self.game_state.political_stability - 1)
|
| 368 |
+
self.game_state.public_dissatisfaction = min(100, self.game_state.public_dissatisfaction + 2)
|
| 369 |
+
|
| 370 |
+
def _check_for_new_crises(self):
|
| 371 |
+
"""بررسی ایجاد بحرانهای جدید بر اساس وضعیت فعلی"""
|
| 372 |
+
import random
|
| 373 |
+
|
| 374 |
+
# شانس ایجاد بحران جدید بر اساس سطح بحران فعلی
|
| 375 |
+
base_chance = 0.1
|
| 376 |
+
if self.game_state.crisis_level > 50:
|
| 377 |
+
base_chance += 0.2
|
| 378 |
+
if self.game_state.political_stability < 40:
|
| 379 |
+
base_chance += 0.15
|
| 380 |
+
if self.game_state.public_dissatisfaction > 60:
|
| 381 |
+
base_chance += 0.1
|
| 382 |
+
|
| 383 |
+
if random.random() < base_chance:
|
| 384 |
+
new_crisis = self.generate_random_crisis()
|
| 385 |
+
self.active_crises.append(new_crisis)
|
| 386 |
+
self.game_state.crisis_level = max(self.game_state.crisis_level, new_crisis["severity"])
|
Shadows_of_Empires/game/demographics/population_system.py
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
سیستم جمعیتشناسی پیشرفته با رشد جمعیت، مهاجرت و ساختار سنی
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
class PopulationSystem:
|
| 6 |
+
"""سیستم جمعیتشناسی پیشرفته"""
|
| 7 |
+
|
| 8 |
+
def __init__(self, game_state):
|
| 9 |
+
"""ساخت یک نمونه جدید از سیستم جمعیت"""
|
| 10 |
+
self.game_state = game_state
|
| 11 |
+
self.age_distribution = {
|
| 12 |
+
"0-14": 35,
|
| 13 |
+
"15-64": 60,
|
| 14 |
+
"65+": 5
|
| 15 |
+
}
|
| 16 |
+
self.birth_rate = 25
|
| 17 |
+
self.death_rate = 10
|
| 18 |
+
self.migration_rate = 0
|
| 19 |
+
|
| 20 |
+
def initialize(self):
|
| 21 |
+
"""راهاندازی اولیه سیستم جمعیت"""
|
| 22 |
+
# تنظیم توزیع سنی بر اساس کشور انتخابی
|
| 23 |
+
country = self.game_state.player_country
|
| 24 |
+
if "population_profile" in country:
|
| 25 |
+
self.age_distribution = country["population_profile"]["age_distribution"]
|
| 26 |
+
|
| 27 |
+
# تنظیم نرخهای جمعیتی
|
| 28 |
+
self.birth_rate = country["base_attributes"].get("birth_rate", 25)
|
| 29 |
+
self.death_rate = country["base_attributes"].get("death_rate", 10)
|
| 30 |
+
self.migration_rate = country["base_attributes"].get("migration_rate", 0)
|
| 31 |
+
|
| 32 |
+
def display_population_structure(self):
|
| 33 |
+
"""نمایش ساختار جمعیت کشور"""
|
| 34 |
+
from ui.console_ui import ConsoleUI
|
| 35 |
+
|
| 36 |
+
ConsoleUI.clear_screen()
|
| 37 |
+
ConsoleUI.display_section_title("ساختار جمعیت")
|
| 38 |
+
|
| 39 |
+
# نمایش اطلاعات کلی جمعیت
|
| 40 |
+
ConsoleUI.display_message(f"جمعیت کل: {self.game_state.population:,} نفر")
|
| 41 |
+
ConsoleUI.display_message(f"رشد جمعیت: {self.game_state.population_growth:.1f}%")
|
| 42 |
+
ConsoleUI.display_message(f"نرخ باروری: {self.birth_rate} در هزار")
|
| 43 |
+
ConsoleUI.display_message(f"نرخ مرگومیر: {self.death_rate} در هزار")
|
| 44 |
+
ConsoleUI.display_message(f"نرخ مهاجرت: {self.migration_rate} در هزار")
|
| 45 |
+
ConsoleUI.display_message(f"جمعیت شهری: {self.game_state.urban_population}%")
|
| 46 |
+
|
| 47 |
+
# نمایش توزیع سنی
|
| 48 |
+
ConsoleUI.display_section_title("توزیع سنی")
|
| 49 |
+
for age_group, percentage in self.age_distribution.items():
|
| 50 |
+
ConsoleUI.display_message(f"{age_group}: {percentage}%")
|
| 51 |
+
|
| 52 |
+
# نمایش سطح سواد
|
| 53 |
+
ConsoleUI.display_section_title("آموزش")
|
| 54 |
+
ConsoleUI.display_message(f"نرخ سواد: {self.game_state.literacy_rate}%")
|
| 55 |
+
|
| 56 |
+
ConsoleUI.wait_for_enter()
|
| 57 |
+
|
| 58 |
+
def manage_migration(self):
|
| 59 |
+
"""مدیریت سیاستهای مهاجرتی"""
|
| 60 |
+
from ui.console_ui import ConsoleUI
|
| 61 |
+
|
| 62 |
+
ConsoleUI.clear_screen()
|
| 63 |
+
ConsoleUI.display_section_title("مدیریت مهاجرت")
|
| 64 |
+
|
| 65 |
+
migration_options = [
|
| 66 |
+
"سیاست مهاجرت آزاد (افزایش جمعیت و تنوع فرهنگی)",
|
| 67 |
+
"محدودیتهای شدید مهاجرتی (حفاظت از هویت ملی)",
|
| 68 |
+
"سیاست مهاجرت انتخابی (جذب نیروهای متخصص)",
|
| 69 |
+
"برگشت"
|
| 70 |
+
]
|
| 71 |
+
|
| 72 |
+
choice = ConsoleUI.get_menu_choice(migration_options)
|
| 73 |
+
|
| 74 |
+
if choice == 1:
|
| 75 |
+
self._apply_open_migration_policy()
|
| 76 |
+
elif choice == 2:
|
| 77 |
+
self._apply_restricted_migration_policy()
|
| 78 |
+
elif choice == 3:
|
| 79 |
+
self._apply_selective_migration_policy()
|
| 80 |
+
# choice == 4: برگشت
|
| 81 |
+
|
| 82 |
+
def _apply_open_migration_policy(self):
|
| 83 |
+
"""اعمال سیاست مهاجرت آزاد"""
|
| 84 |
+
from ui.console_ui import ConsoleUI
|
| 85 |
+
|
| 86 |
+
self.migration_rate = 15
|
| 87 |
+
self.game_state.population_growth += 0.8
|
| 88 |
+
self.game_state.cultural_influence += 5
|
| 89 |
+
self.game_state.public_dissatisfaction += 3
|
| 90 |
+
|
| 91 |
+
ConsoleUI.display_success("سیاست مهاجرت آزاد اعمال شد.")
|
| 92 |
+
ConsoleUI.display_message("• نرخ مهاجرت به 15 در هزار افزایش یافت")
|
| 93 |
+
ConsoleUI.display_message("• رشد جمعیت 0.8% افزایش یافت")
|
| 94 |
+
ConsoleUI.display_message("• نفوذ فرهنگی 5% افزایش یافت")
|
| 95 |
+
ConsoleUI.display_warning("• نارضایتی عمومی 3% افزایش یافت (به دلیل تنشهای فرهنگی)")
|
| 96 |
+
|
| 97 |
+
ConsoleUI.wait_for_enter()
|
| 98 |
+
|
| 99 |
+
def _apply_restricted_migration_policy(self):
|
| 100 |
+
"""اعمال سیاست مهاجرت محدود"""
|
| 101 |
+
from ui.console_ui import ConsoleUI
|
| 102 |
+
|
| 103 |
+
self.migration_rate = -5
|
| 104 |
+
self.game_state.population_growth -= 0.5
|
| 105 |
+
self.game_state.cultural_influence -= 3
|
| 106 |
+
self.game_state.political_stability += 2
|
| 107 |
+
|
| 108 |
+
ConsoleUI.display_success("سیاست مهاجرت محدود اعمال شد.")
|
| 109 |
+
ConsoleUI.display_message("• نرخ مهاجرت به -5 در هزار کاهش یافت")
|
| 110 |
+
ConsoleUI.display_message("• رشد جمعیت 0.5% کاهش یافت")
|
| 111 |
+
ConsoleUI.display_message("• نفوذ فرهنگی 3% کاهش یافت")
|
| 112 |
+
ConsoleUI.display_success("• ثبات سیاسی 2% افزایش یافت (به دلیل کاهش تنشهای فرهنگی)")
|
| 113 |
+
|
| 114 |
+
ConsoleUI.wait_for_enter()
|
| 115 |
+
|
| 116 |
+
def _apply_selective_migration_policy(self):
|
| 117 |
+
"""اعمال سیاست مهاجرت انتخابی"""
|
| 118 |
+
from ui.console_ui import ConsoleUI
|
| 119 |
+
|
| 120 |
+
self.migration_rate = 5
|
| 121 |
+
self.game_state.population_growth += 0.3
|
| 122 |
+
self.game_state.technology["education"] += 1
|
| 123 |
+
self.game_state.technology["industry"] += 1
|
| 124 |
+
self.game_state.public_dissatisfaction += 1
|
| 125 |
+
|
| 126 |
+
ConsoleUI.display_success("سیاست مهاجرت انتخابی اعمال شد.")
|
| 127 |
+
ConsoleUI.display_message("• نرخ مهاجرت به 5 در هزار افزایش یافت")
|
| 128 |
+
ConsoleUI.display_message("• رشد جمعیت 0.3% افزایش یافت")
|
| 129 |
+
ConsoleUI.display_message("• فناوری آموزشی 1 سطح افزایش یافت")
|
| 130 |
+
ConsoleUI.display_message("• فناوری صنعتی 1 سطح افزایش یافت")
|
| 131 |
+
ConsoleUI.display_warning("• نارضایتی عمومی 1% افزایش یافت (به دلیل رقابت برای شغل)")
|
| 132 |
+
|
| 133 |
+
ConsoleUI.wait_for_enter()
|
| 134 |
+
|
| 135 |
+
def family_planning(self):
|
| 136 |
+
"""مدیریت برنامهریزی خانواده و سیاستهای جمعیتی"""
|
| 137 |
+
from ui.console_ui import ConsoleUI
|
| 138 |
+
|
| 139 |
+
ConsoleUI.clear_screen()
|
| 140 |
+
ConsoleUI.display_section_title("برنامهریزی خانواده")
|
| 141 |
+
|
| 142 |
+
planning_options = [
|
| 143 |
+
"سیاست افزایش جمعیت (تشویق به افزایش تولد)",
|
| 144 |
+
"سیاست کنترل جمعیت (کاهش نرخ باروری)",
|
| 145 |
+
"برنامهریزی خانواده خنثی",
|
| 146 |
+
"برگشت"
|
| 147 |
+
]
|
| 148 |
+
|
| 149 |
+
choice = ConsoleUI.get_menu_choice(planning_options)
|
| 150 |
+
|
| 151 |
+
if choice == 1:
|
| 152 |
+
self._apply_population_growth_policy()
|
| 153 |
+
elif choice == 2:
|
| 154 |
+
self._apply_population_control_policy()
|
| 155 |
+
elif choice == 3:
|
| 156 |
+
self._apply_neutral_family_policy()
|
| 157 |
+
# choice == 4: برگشت
|
| 158 |
+
|
| 159 |
+
def _apply_population_growth_policy(self):
|
| 160 |
+
"""اعمال سیاست افزایش جمعیت"""
|
| 161 |
+
from ui.console_ui import ConsoleUI
|
| 162 |
+
|
| 163 |
+
self.birth_rate += 5
|
| 164 |
+
self.game_state.population_growth += 0.7
|
| 165 |
+
self.game_state.resources["food"] -= 10
|
| 166 |
+
self.game_state.public_dissatisfaction += 2
|
| 167 |
+
|
| 168 |
+
ConsoleUI.display_success("سیاست افزایش جمعیت اعمال شد.")
|
| 169 |
+
ConsoleUI.display_message("• نرخ باروری 5 واحد افزایش یافت")
|
| 170 |
+
ConsoleUI.display_message("• رشد جمعیت 0.7% افزایش یافت")
|
| 171 |
+
ConsoleUI.display_warning("• منابع غذایی 10 واحد کاهش یافت")
|
| 172 |
+
ConsoleUI.display_warning("• نارضایتی عمومی 2% افزایش یافت (به دلیل فشار بر منابع)")
|
| 173 |
+
|
| 174 |
+
ConsoleUI.wait_for_enter()
|
| 175 |
+
|
| 176 |
+
def _apply_population_control_policy(self):
|
| 177 |
+
"""اعمال سیاست کنترل جمعیت"""
|
| 178 |
+
from ui.console_ui import ConsoleUI
|
| 179 |
+
|
| 180 |
+
self.birth_rate -= 8
|
| 181 |
+
self.game_state.population_growth -= 0.5
|
| 182 |
+
self.game_state.literacy_rate += 3
|
| 183 |
+
self.game_state.happiness += 2
|
| 184 |
+
|
| 185 |
+
ConsoleUI.display_success("سیاست کنترل جمعیت اعمال شد.")
|
| 186 |
+
ConsoleUI.display_message("• نرخ باروری 8 واحد کاهش یافت")
|
| 187 |
+
ConsoleUI.display_message("• رشد جمعیت 0.5% کاهش یافت")
|
| 188 |
+
ConsoleUI.display_success("• نرخ سواد 3% افزایش یافت")
|
| 189 |
+
ConsoleUI.display_success("• شادی مردم 2% افزایش یافت")
|
| 190 |
+
|
| 191 |
+
ConsoleUI.wait_for_enter()
|
| 192 |
+
|
| 193 |
+
def _apply_neutral_family_policy(self):
|
| 194 |
+
"""اعمال سیاست خنثی برنامهریزی خانواده"""
|
| 195 |
+
from ui.console_ui import ConsoleUI
|
| 196 |
+
|
| 197 |
+
self.birth_rate = max(15, self.birth_rate - 2)
|
| 198 |
+
self.game_state.population_growth = max(0.2, self.game_state.population_growth - 0.2)
|
| 199 |
+
self.game_state.literacy_rate += 1
|
| 200 |
+
|
| 201 |
+
ConsoleUI.display_success("سیاست خنثی برنامهریزی خانواده اعمال شد.")
|
| 202 |
+
ConsoleUI.display_message("• نرخ باروری کمی کاهش یافت")
|
| 203 |
+
ConsoleUI.display_message("• رشد جمعیت کمی کاهش یافت")
|
| 204 |
+
ConsoleUI.display_success("• نرخ سواد 1% افزایش یافت")
|
| 205 |
+
|
| 206 |
+
ConsoleUI.wait_for_enter()
|
| 207 |
+
|
| 208 |
+
def annual_update(self):
|
| 209 |
+
"""بهروزرسانیهای سالانه سیستم جمعیت"""
|
| 210 |
+
# محاسبه رشد جمعیت
|
| 211 |
+
natural_growth = (self.birth_rate - self.death_rate) / 10
|
| 212 |
+
migration_effect = self.migration_rate / 10
|
| 213 |
+
total_growth = natural_growth + migration_effect
|
| 214 |
+
|
| 215 |
+
# اعمال رشد جمعیت
|
| 216 |
+
population_increase = int(self.game_state.population * total_growth / 100)
|
| 217 |
+
self.game_state.population += population_increase
|
| 218 |
+
self.game_state.population_growth = total_growth
|
| 219 |
+
|
| 220 |
+
# بهروزرسانی توزیع سنی
|
| 221 |
+
self._update_age_distribution()
|
| 222 |
+
|
| 223 |
+
# تأثیرات اجتماعی
|
| 224 |
+
self._apply_social_effects()
|
| 225 |
+
|
| 226 |
+
def _update_age_distribution(self):
|
| 227 |
+
"""بهروزرسانی توزیع سنی جمعیت"""
|
| 228 |
+
# تغییرات طبیعی توزیع سنی
|
| 229 |
+
self.age_distribution["0-14"] = max(15, self.age_distribution["0-14"] - 0.5)
|
| 230 |
+
self.age_distribution["15-64"] = min(70, self.age_distribution["15-64"] + 0.3)
|
| 231 |
+
self.age_distribution["65+"] = min(20, self.age_distribution["65+"] + 0.2)
|
| 232 |
+
|
| 233 |
+
# تأثیر نرخ باروری
|
| 234 |
+
if self.birth_rate > 20:
|
| 235 |
+
self.age_distribution["0-14"] = min(40, self.age_distribution["0-14"] + 0.3)
|
| 236 |
+
self.age_distribution["15-64"] = max(50, self.age_distribution["15-64"] - 0.2)
|
| 237 |
+
|
| 238 |
+
# تأثیر نرخ مرگومیر
|
| 239 |
+
if self.death_rate < 8:
|
| 240 |
+
self.age_distribution["65+"] = min(25, self.age_distribution["65+"] + 0.3)
|
| 241 |
+
self.age_distribution["0-14"] = max(10, self.age_distribution["0-14"] - 0.1)
|
| 242 |
+
|
| 243 |
+
def _apply_social_effects(self):
|
| 244 |
+
"""اعمال تأثیرات اجتماعی تغییرات جمعیتی"""
|
| 245 |
+
# تأثیر جمعیت پیر شونده
|
| 246 |
+
if self.age_distribution["65+"] > 15:
|
| 247 |
+
self.game_state.health_index = max(0, self.game_state.health_index - 1)
|
| 248 |
+
self.game_state.resources["food"] -= 2
|
| 249 |
+
self.game_state.public_dissatisfaction += 1
|
| 250 |
+
|
| 251 |
+
# تأثیر جمعیت جوان
|
| 252 |
+
if self.age_distribution["0-14"] > 30:
|
| 253 |
+
self.game_state.literacy_rate = min(100, self.game_state.literacy_rate + 0.5)
|
| 254 |
+
self.game_state.resources["food"] += 3
|
| 255 |
+
self.game_state.happiness += 1
|
| 256 |
+
|
| 257 |
+
# تأثیر جمعیت شهری
|
| 258 |
+
if self.game_state.urban_population > 50:
|
| 259 |
+
self.game_state.economy["industry"] = min(100, self.game_state.economy["industry"] + 1)
|
| 260 |
+
self.game_state.economy["agriculture"] = max(0, self.game_state.economy["agri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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
کلاس اصلی بازی که سیستمهای مختلف را مدیریت میکند
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
import time
|
| 6 |
+
from game_state import GameState
|
| 7 |
+
from calendar.calendar_system import CalendarSystem
|
| 8 |
+
from climate.climate_system import ClimateSystem
|
| 9 |
+
from demographics.population_system import PopulationSystem
|
| 10 |
+
from technology.research_system import ResearchSystem
|
| 11 |
+
from religion.religious_system import ReligiousSystem
|
| 12 |
+
from espionage.espionage_system import EspionageSystem
|
| 13 |
+
from cities.city_management import CityManagement
|
| 14 |
+
from warfare.warfare_system import WarfareSystem
|
| 15 |
+
from trade.trade_system import TradeSystem
|
| 16 |
+
from politics.domestic_policy import DomesticPolicy
|
| 17 |
+
from society.happiness_system import HappinessSystem
|
| 18 |
+
from culture.cultural_system import CulturalSystem
|
| 19 |
+
from diplomacy.diplomacy_system import DiplomacySystem
|
| 20 |
+
from economy.macro_economy import MacroEconomy
|
| 21 |
+
from military.army_management import ArmyManagement
|
| 22 |
+
from health.healthcare_system import HealthcareSystem
|
| 23 |
+
from education.education_system import EducationSystem
|
| 24 |
+
from environment.environmental_system import EnvironmentalSystem
|
| 25 |
+
from crisis.crisis_management import CrisisManagement
|
| 26 |
+
from succession.succession_system import SuccessionSystem
|
| 27 |
+
from achievements.achievements_system import AchievementsSystem
|
| 28 |
+
from ui.console_ui import ConsoleUI
|
| 29 |
+
from utils.save_load import SaveLoadManager
|
| 30 |
+
from config import GAME_CONFIG, UI_CONFIG, ADVANCED_CONFIG
|
| 31 |
+
|
| 32 |
+
class EmpireGame:
|
| 33 |
+
"""کلاس اصلی بازی سایههای امپراتوری"""
|
| 34 |
+
|
| 35 |
+
def __init__(self):
|
| 36 |
+
"""ساخت یک نمونه جدید از بازی"""
|
| 37 |
+
self.game_state = GameState()
|
| 38 |
+
self.calendar = CalendarSystem(self.game_state)
|
| 39 |
+
self.climate = ClimateSystem(self.game_state)
|
| 40 |
+
self.population = PopulationSystem(self.game_state)
|
| 41 |
+
self.technology = ResearchSystem(self.game_state)
|
| 42 |
+
self.religion = ReligiousSystem(self.game_state)
|
| 43 |
+
self.espionage = EspionageSystem(self.game_state)
|
| 44 |
+
self.cities = CityManagement(self.game_state)
|
| 45 |
+
self.warfare = WarfareSystem(self.game_state)
|
| 46 |
+
self.trade = TradeSystem(self.game_state)
|
| 47 |
+
self.politics = DomesticPolicy(self.game_state)
|
| 48 |
+
self.society = HappinessSystem(self.game_state)
|
| 49 |
+
self.culture = CulturalSystem(self.game_state)
|
| 50 |
+
self.diplomacy = DiplomacySystem(self.game_state)
|
| 51 |
+
self.economy = MacroEconomy(self.game_state)
|
| 52 |
+
self.military = ArmyManagement(self.game_state)
|
| 53 |
+
self.health = HealthcareSystem(self.game_state)
|
| 54 |
+
self.education = EducationSystem(self.game_state)
|
| 55 |
+
self.environment = EnvironmentalSystem(self.game_state)
|
| 56 |
+
self.crisis = CrisisManagement(self.game_state)
|
| 57 |
+
self.succession = SuccessionSystem(self.game_state)
|
| 58 |
+
self.achievements = AchievementsSystem(self.game_state)
|
| 59 |
+
self.save_manager = SaveLoadManager()
|
| 60 |
+
self.running = False
|
| 61 |
+
self.plugins = []
|
| 62 |
+
self.difficulty = "normal"
|
| 63 |
+
self.undo_stack = []
|
| 64 |
+
self.redo_stack = []
|
| 65 |
+
|
| 66 |
+
def start(self):
|
| 67 |
+
"""شروع بازی و ورود به حلقه اصلی"""
|
| 68 |
+
self.running = True
|
| 69 |
+
ConsoleUI.clear_screen()
|
| 70 |
+
|
| 71 |
+
# نمایش مقدمه بازی
|
| 72 |
+
ConsoleUI.display_intro()
|
| 73 |
+
|
| 74 |
+
# انتخاب سطح دشواری
|
| 75 |
+
self.select_difficulty()
|
| 76 |
+
|
| 77 |
+
# انتخاب کشور توسط بازیکن
|
| 78 |
+
self.game_state.select_country()
|
| 79 |
+
|
| 80 |
+
# راهاندازی سیستمهای بازی
|
| 81 |
+
self.initialize_game_systems()
|
| 82 |
+
|
| 83 |
+
# نمایش راهنما
|
| 84 |
+
self.show_tutorial()
|
| 85 |
+
|
| 86 |
+
# ورود به حلقه اصلی بازی
|
| 87 |
+
self.game_loop()
|
| 88 |
+
|
| 89 |
+
def select_difficulty(self):
|
| 90 |
+
"""انتخاب سطح دشواری بازی"""
|
| 91 |
+
ConsoleUI.clear_screen()
|
| 92 |
+
ConsoleUI.display_section_title("انتخاب سطح دشواری")
|
| 93 |
+
|
| 94 |
+
difficulties = ["آسان", "معمولی", "سخت"]
|
| 95 |
+
choice = ConsoleUI.get_menu_choice(difficulties)
|
| 96 |
+
|
| 97 |
+
if choice == 1:
|
| 98 |
+
self.difficulty = "easy"
|
| 99 |
+
elif choice == 2:
|
| 100 |
+
self.difficulty = "normal"
|
| 101 |
+
else:
|
| 102 |
+
self.difficulty = "hard"
|
| 103 |
+
|
| 104 |
+
# اعمال ضرایب دشواری
|
| 105 |
+
self.game_state.difficulty = self.difficulty
|
| 106 |
+
self.game_state.difficulty_factors = GAME_CONFIG["difficulty_levels"][self.difficulty]
|
| 107 |
+
|
| 108 |
+
ConsoleUI.display_success(f"سطح دشواری '{difficulties[choice-1]}' انتخاب شد.")
|
| 109 |
+
time.sleep(1)
|
| 110 |
+
|
| 111 |
+
def initialize_game_systems(self):
|
| 112 |
+
"""راهاندازی اولیه سیستمهای بازی"""
|
| 113 |
+
# راهاندازی سیستمهای مختلف بازی
|
| 114 |
+
self.calendar.initialize()
|
| 115 |
+
self.climate.initialize()
|
| 116 |
+
self.population.initialize()
|
| 117 |
+
self.technology.initialize()
|
| 118 |
+
self.religion.initialize()
|
| 119 |
+
self.espionage.initialize()
|
| 120 |
+
self.cities.initialize()
|
| 121 |
+
self.warfare.initialize()
|
| 122 |
+
self.trade.initialize()
|
| 123 |
+
self.politics.initialize()
|
| 124 |
+
self.society.initialize()
|
| 125 |
+
self.culture.initialize()
|
| 126 |
+
self.diplomacy.initialize()
|
| 127 |
+
self.economy.initialize()
|
| 128 |
+
self.military.initialize()
|
| 129 |
+
self.health.initialize()
|
| 130 |
+
self.education.initialize()
|
| 131 |
+
self.environment.initialize()
|
| 132 |
+
self.crisis.initialize()
|
| 133 |
+
self.succession.initialize()
|
| 134 |
+
self.achievements.initialize()
|
| 135 |
+
|
| 136 |
+
# نمایش وضعیت اولیه
|
| 137 |
+
ConsoleUI.display_country_info(self.game_state.player_country)
|
| 138 |
+
|
| 139 |
+
def game_loop(self):
|
| 140 |
+
"""حلقه اصلی بازی"""
|
| 141 |
+
while self.running:
|
| 142 |
+
try:
|
| 143 |
+
ConsoleUI.clear_screen()
|
| 144 |
+
|
| 145 |
+
# نمایش وضعیت فعلی بازی
|
| 146 |
+
ConsoleUI.display_game_status(self.game_state)
|
| 147 |
+
|
| 148 |
+
# بررسی شرایط پایان بازی
|
| 149 |
+
if self.check_victory_conditions():
|
| 150 |
+
break
|
| 151 |
+
|
| 152 |
+
# پردازش رویدادهای سالانه
|
| 153 |
+
self.process_yearly_events()
|
| 154 |
+
|
| 155 |
+
# پردازش اقدامات بازیکن
|
| 156 |
+
self.process_player_actions()
|
| 157 |
+
|
| 158 |
+
# بهروزرسانیهای سالانه
|
| 159 |
+
self.annual_updates()
|
| 160 |
+
|
| 161 |
+
# افزایش سال
|
| 162 |
+
self.game_state.current_year += 1
|
| 163 |
+
|
| 164 |
+
# ذخیره خودکار
|
| 165 |
+
if self.game_state.current_year % GAME_CONFIG["auto_save_interval"] == 0:
|
| 166 |
+
self.save_manager.auto_save(self.game_state)
|
| 167 |
+
|
| 168 |
+
except KeyboardInterrupt:
|
| 169 |
+
# مدیریت خروج با Ctrl+C
|
| 170 |
+
if ConsoleUI.confirm_action("آیا میخواهید بازی را ذخیره و خارج شوید؟"):
|
| 171 |
+
self.save_manager.save_game(self.game_state)
|
| 172 |
+
ConsoleUI.display_message("بازی ذخیره شد. خداحافظ!")
|
| 173 |
+
break
|
| 174 |
+
else:
|
| 175 |
+
ConsoleUI.display_warning("ادامه بازی...")
|
| 176 |
+
except Exception as e:
|
| 177 |
+
ConsoleUI.display_error(f"خطای غیرمنتظره: {str(e)}")
|
| 178 |
+
if ConsoleUI.confirm_action("آیا میخواهید بازی را ذخیره و خارج شوید؟"):
|
| 179 |
+
self.save_manager.save_game(self.game_state)
|
| 180 |
+
break
|
| 181 |
+
|
| 182 |
+
def process_yearly_events(self):
|
| 183 |
+
"""پردازش رویدادهای سالانه"""
|
| 184 |
+
# بررسی احتمال وقوع رویدادهای مختلف
|
| 185 |
+
if self.game_state.random.random() < GAME_CONFIG["event_probability"]["common"]:
|
| 186 |
+
event = self.calendar.select_random_event()
|
| 187 |
+
if event:
|
| 188 |
+
ConsoleUI.display_event(event)
|
| 189 |
+
choice = ConsoleUI.get_player_choice(event["choices"])
|
| 190 |
+
self.calendar.apply_event_choice(event, choice)
|
| 191 |
+
|
| 192 |
+
# بررسی احتمال وقوع رویدادهای آبوهوایی
|
| 193 |
+
if self.game_state.random.random() < GAME_CONFIG["event_probability"]["rare"]:
|
| 194 |
+
event = self.climate.select_weather_event()
|
| 195 |
+
if event:
|
| 196 |
+
ConsoleUI.display_weather_event(event)
|
| 197 |
+
choice = ConsoleUI.get_player_choice(event["choices"])
|
| 198 |
+
self.climate.apply_weather_event_choice(event, choice)
|
| 199 |
+
|
| 200 |
+
# بررسی احتمال وقوع رویدادهای تاریخی
|
| 201 |
+
if self.game_state.random.random() < GAME_CONFIG["event_probability"]["historical"]:
|
| 202 |
+
event = self.calendar.select_historical_event()
|
| 203 |
+
if event:
|
| 204 |
+
ConsoleUI.display_historical_event(event)
|
| 205 |
+
choice = ConsoleUI.get_player_choice(event["choices"])
|
| 206 |
+
self.calendar.apply_historical_event_choice(event, choice)
|
| 207 |
+
|
| 208 |
+
def process_player_actions(self):
|
| 209 |
+
"""پردازش اقدامات بازیکن"""
|
| 210 |
+
main_actions = [
|
| 211 |
+
"مشاهده وضعیت کشور",
|
| 212 |
+
"مدیریت اقتصاد",
|
| 213 |
+
"دیپلماسی و روابط خارجی",
|
| 214 |
+
"مدیریت نظامی",
|
| 215 |
+
"سیاست داخلی",
|
| 216 |
+
"مدیریت شهرها",
|
| 217 |
+
"سیستم فناوری",
|
| 218 |
+
"سیستم فرهنگی",
|
| 219 |
+
"سیستم دینی",
|
| 220 |
+
"سیستم جمعیت",
|
| 221 |
+
"ذخیره بازی",
|
| 222 |
+
"بازیابی آخرین اقدام (Undo)",
|
| 223 |
+
"خروج از بازی"
|
| 224 |
+
]
|
| 225 |
+
|
| 226 |
+
while True:
|
| 227 |
+
ConsoleUI.clear_screen()
|
| 228 |
+
ConsoleUI.display_game_status(self.game_state)
|
| 229 |
+
ConsoleUI.display_section_title("اقدامات اصلی")
|
| 230 |
+
|
| 231 |
+
choice = ConsoleUI.get_menu_choice(main_actions)
|
| 232 |
+
|
| 233 |
+
if choice == 1:
|
| 234 |
+
self.handle_country_status()
|
| 235 |
+
elif choice == 2:
|
| 236 |
+
self.handle_economy_management()
|
| 237 |
+
elif choice == 3:
|
| 238 |
+
self.handle_diplomacy()
|
| 239 |
+
elif choice == 4:
|
| 240 |
+
self.handle_military()
|
| 241 |
+
elif choice == 5:
|
| 242 |
+
self.handle_domestic_policy()
|
| 243 |
+
elif choice == 6:
|
| 244 |
+
self.handle_city_management()
|
| 245 |
+
elif choice == 7:
|
| 246 |
+
self.handle_technology()
|
| 247 |
+
elif choice == 8:
|
| 248 |
+
self.handle_culture()
|
| 249 |
+
elif choice == 9:
|
| 250 |
+
self.handle_religion()
|
| 251 |
+
elif choice == 10:
|
| 252 |
+
self.handle_population()
|
| 253 |
+
elif choice == 11:
|
| 254 |
+
self.save_manager.save_game(self.game_state)
|
| 255 |
+
ConsoleUI.display_success("بازی با موفقیت ذخیره شد!")
|
| 256 |
+
time.sleep(1)
|
| 257 |
+
elif choice == 12:
|
| 258 |
+
self.undo_last_action()
|
| 259 |
+
elif choice == 13:
|
| 260 |
+
if ConsoleUI.confirm_action("آیا میخواهید بازی را ذخیره و خارج شوید؟"):
|
| 261 |
+
self.save_manager.save_game(self.game_state)
|
| 262 |
+
self.running = False
|
| 263 |
+
return
|
| 264 |
+
|
| 265 |
+
def handle_country_status(self):
|
| 266 |
+
"""مدیریت نمایش وضعیت کشور"""
|
| 267 |
+
ConsoleUI.clear_screen()
|
| 268 |
+
ConsoleUI.display_section_title("وضعیت کشور")
|
| 269 |
+
ConsoleUI.display_country_status(self.game_state)
|
| 270 |
+
ConsoleUI.wait_for_enter()
|
| 271 |
+
|
| 272 |
+
def handle_economy_management(self):
|
| 273 |
+
"""مدیریت اقتصاد کشور"""
|
| 274 |
+
economy_actions = [
|
| 275 |
+
"مدیریت مالیات و بودجه",
|
| 276 |
+
"سرمایهگذاری در زیرساخت",
|
| 277 |
+
"تجارت با کشورهای دیگر",
|
| 278 |
+
"مدیریت منابع طبیعی",
|
| 279 |
+
"سیاستهای اقتصادی کلان",
|
| 280 |
+
"برگشت"
|
| 281 |
+
]
|
| 282 |
+
|
| 283 |
+
while True:
|
| 284 |
+
ConsoleUI.clear_screen()
|
| 285 |
+
ConsoleUI.display_game_status(self.game_state)
|
| 286 |
+
ConsoleUI.display_section_title("مدیریت اقتصاد")
|
| 287 |
+
|
| 288 |
+
choice = ConsoleUI.get_menu_choice(economy_actions)
|
| 289 |
+
|
| 290 |
+
if choice == 1:
|
| 291 |
+
self.economy.manage_taxes()
|
| 292 |
+
elif choice == 2:
|
| 293 |
+
self.economy.invest_in_infrastructure()
|
| 294 |
+
elif choice == 3:
|
| 295 |
+
self.trade.trade_with_countries()
|
| 296 |
+
elif choice == 4:
|
| 297 |
+
self.economy.manage_resources()
|
| 298 |
+
elif choice == 5:
|
| 299 |
+
self.economy.set_economic_policy()
|
| 300 |
+
elif choice == 6:
|
| 301 |
+
return
|
| 302 |
+
|
| 303 |
+
def handle_diplomacy(self):
|
| 304 |
+
"""مدیریت دیپلماسی و روابط خارجی"""
|
| 305 |
+
diplomacy_actions = [
|
| 306 |
+
"مشاهده روابط فعلی",
|
| 307 |
+
"پیشنهاد اتحاد یا پیمان",
|
| 308 |
+
"مذاکره برای صلح",
|
| 309 |
+
"ارسال سفیر و ایجاد سفارتخانه",
|
| 310 |
+
"عضویت در سازمانهای بینالمللی",
|
| 311 |
+
"برگشت"
|
| 312 |
+
]
|
| 313 |
+
|
| 314 |
+
while True:
|
| 315 |
+
ConsoleUI.clear_screen()
|
| 316 |
+
ConsoleUI.display_game_status(self.game_state)
|
| 317 |
+
ConsoleUI.display_section_title("دیپلماسی")
|
| 318 |
+
|
| 319 |
+
choice = ConsoleUI.get_menu_choice(diplomacy_actions)
|
| 320 |
+
|
| 321 |
+
if choice == 1:
|
| 322 |
+
self.diplomacy.display_relations()
|
| 323 |
+
elif choice == 2:
|
| 324 |
+
self.diplomacy.propose_alliance()
|
| 325 |
+
elif choice == 3:
|
| 326 |
+
self.diplomacy.negotiate_peace()
|
| 327 |
+
elif choice == 4:
|
| 328 |
+
self.diplomacy.send_envoy()
|
| 329 |
+
elif choice == 5:
|
| 330 |
+
self.diplomacy.join_international_orgs()
|
| 331 |
+
elif choice == 6:
|
| 332 |
+
return
|
| 333 |
+
|
| 334 |
+
def handle_military(self):
|
| 335 |
+
"""مدیریت امور نظامی"""
|
| 336 |
+
military_actions = [
|
| 337 |
+
"مشاهده نیروهای نظامی",
|
| 338 |
+
"آموزش ارتش",
|
| 339 |
+
"تولید تسلیحات",
|
| 340 |
+
"حمله به کشور دیگر",
|
| 341 |
+
"دفاع از قلمرو",
|
| 342 |
+
"استراتژیهای نظامی",
|
| 343 |
+
"برگشت"
|
| 344 |
+
]
|
| 345 |
+
|
| 346 |
+
while True:
|
| 347 |
+
ConsoleUI.clear_screen()
|
| 348 |
+
ConsoleUI.display_game_status(self.game_state)
|
| 349 |
+
ConsoleUI.display_section_title("مدیریت نظامی")
|
| 350 |
+
|
| 351 |
+
choice = ConsoleUI.get_menu_choice(military_actions)
|
| 352 |
+
|
| 353 |
+
if choice == 1:
|
| 354 |
+
self.military.display_forces()
|
| 355 |
+
elif choice == 2:
|
| 356 |
+
self.military.train_army()
|
| 357 |
+
elif choice == 3:
|
| 358 |
+
self.military.produce_weapons()
|
| 359 |
+
elif choice == 4:
|
| 360 |
+
self.warfare.attack_country()
|
| 361 |
+
elif choice == 5:
|
| 362 |
+
self.warfare.defend_territory()
|
| 363 |
+
elif choice == 6:
|
| 364 |
+
self.warfare.select_military_tactics()
|
| 365 |
+
elif choice == 7:
|
| 366 |
+
return
|
| 367 |
+
|
| 368 |
+
def handle_domestic_policy(self):
|
| 369 |
+
"""مدیریت سیاست داخلی"""
|
| 370 |
+
politics_actions = [
|
| 371 |
+
"مدیریت احزاب و گروههای فشار",
|
| 372 |
+
"اجرای اصلاحات اجتماعی",
|
| 373 |
+
"سیاستهای بهداشت و درمان",
|
| 374 |
+
"سیاستهای آموزشی",
|
| 375 |
+
"انتخابات و حکومتهای مردمی",
|
| 376 |
+
"برگشت"
|
| 377 |
+
]
|
| 378 |
+
|
| 379 |
+
while True:
|
| 380 |
+
ConsoleUI.clear_screen()
|
| 381 |
+
ConsoleUI.display_game_status(self.game_state)
|
| 382 |
+
ConsoleUI.display_section_title("سیاست داخلی")
|
| 383 |
+
|
| 384 |
+
choice = ConsoleUI.get_menu_choice(politics_actions)
|
| 385 |
+
|
| 386 |
+
if choice == 1:
|
| 387 |
+
self.politics.manage_political_parties()
|
| 388 |
+
elif choice == 2:
|
| 389 |
+
self.politics.implement_social_reforms()
|
| 390 |
+
elif choice == 3:
|
| 391 |
+
self.health.manage_healthcare()
|
| 392 |
+
elif choice == 4:
|
| 393 |
+
self.education.manage_education()
|
| 394 |
+
elif choice == 5:
|
| 395 |
+
self.politics.hold_elections()
|
| 396 |
+
elif choice == 6:
|
| 397 |
+
return
|
| 398 |
+
|
| 399 |
+
def handle_city_management(self):
|
| 400 |
+
"""مدیریت شهرها"""
|
| 401 |
+
city_actions = [
|
| 402 |
+
"مشاهده شهرها",
|
| 403 |
+
"ساخت بناهای جدید",
|
| 404 |
+
"مدیریت جمعیت شهری",
|
| 405 |
+
"برنامهریزی شهری",
|
| 406 |
+
"مدیریت بحرانهای شهری",
|
| 407 |
+
"برگشت"
|
| 408 |
+
]
|
| 409 |
+
|
| 410 |
+
while True:
|
| 411 |
+
ConsoleUI.clear_screen()
|
| 412 |
+
ConsoleUI.display_game_status(self.game_state)
|
| 413 |
+
ConsoleUI.display_section_title("مدیریت شهرها")
|
| 414 |
+
|
| 415 |
+
choice = ConsoleUI.get_menu_choice(city_actions)
|
| 416 |
+
|
| 417 |
+
if choice == 1:
|
| 418 |
+
self.cities.display_cities()
|
| 419 |
+
elif choice == 2:
|
| 420 |
+
self.cities.build_new_structures()
|
| 421 |
+
elif choice == 3:
|
| 422 |
+
self.population.manage_urban_population()
|
| 423 |
+
elif choice == 4:
|
| 424 |
+
self.cities.city_planning()
|
| 425 |
+
elif choice == 5:
|
| 426 |
+
self.crisis.manage_city_crises()
|
| 427 |
+
elif choice == 6:
|
| 428 |
+
return
|
| 429 |
+
|
| 430 |
+
def handle_technology(self):
|
| 431 |
+
"""مدیریت سیستم فناوری"""
|
| 432 |
+
tech_actions = [
|
| 433 |
+
"مشاهده درخت فناوری",
|
| 434 |
+
"تحقیق در فناوریهای جدید",
|
| 435 |
+
"مدیریت مراکز تحقیقاتی",
|
| 436 |
+
"همکاریهای فناوری",
|
| 437 |
+
"برگشت"
|
| 438 |
+
]
|
| 439 |
+
|
| 440 |
+
while True:
|
| 441 |
+
ConsoleUI.clear_screen()
|
| 442 |
+
ConsoleUI.display_game_status(self.game_state)
|
| 443 |
+
ConsoleUI.display_section_title("سیستم فناوری")
|
| 444 |
+
|
| 445 |
+
choice = ConsoleUI.get_menu_choice(tech_actions)
|
| 446 |
+
|
| 447 |
+
if choice == 1:
|
| 448 |
+
self.technology.display_tech_tree()
|
| 449 |
+
elif choice == 2:
|
| 450 |
+
self.technology.conduct_research()
|
| 451 |
+
elif choice == 3:
|
| 452 |
+
self.technology.manage_research_centers()
|
| 453 |
+
elif choice == 4:
|
| 454 |
+
self.technology.technology_cooperation()
|
| 455 |
+
elif choice == 5:
|
| 456 |
+
return
|
| 457 |
+
|
| 458 |
+
def handle_culture(self):
|
| 459 |
+
"""مدیریت سیستم فرهنگی"""
|
| 460 |
+
culture_actions = [
|
| 461 |
+
"مشاهده وضعیت فرهنگی",
|
| 462 |
+
"سرمایهگذاری در گسترش فرهنگ",
|
| 463 |
+
"فرهنگسازی در کشورهای تحت کنترل",
|
| 464 |
+
"مدیریت زبان و هنر",
|
| 465 |
+
"برگشت"
|
| 466 |
+
]
|
| 467 |
+
|
| 468 |
+
while True:
|
| 469 |
+
ConsoleUI.clear_screen()
|
| 470 |
+
ConsoleUI.display_game_status(self.game_state)
|
| 471 |
+
ConsoleUI.display_section_title("گسترش فرهنگ")
|
| 472 |
+
|
| 473 |
+
choice = ConsoleUI.get_menu_choice(culture_actions)
|
| 474 |
+
|
| 475 |
+
if choice == 1:
|
| 476 |
+
self.culture.display_culture_status()
|
| 477 |
+
elif choice == 2:
|
| 478 |
+
self.culture.invest_in_cultural_spread()
|
| 479 |
+
elif choice == 3:
|
| 480 |
+
self.culture.cultural_assimilation()
|
| 481 |
+
elif choice == 4:
|
| 482 |
+
self.culture.manage_language_and_art()
|
| 483 |
+
elif choice == 5:
|
| 484 |
+
return
|
| 485 |
+
|
| 486 |
+
def handle_religion(self):
|
| 487 |
+
"""مدیریت سیستم دینی"""
|
| 488 |
+
religion_actions = [
|
| 489 |
+
"مشاهده وضعیت دینی",
|
| 490 |
+
"گسترش دین",
|
| 491 |
+
"مدیریت گروههای مذهبی",
|
| 492 |
+
"اجرای سیاستهای دینی",
|
| 493 |
+
"برگشت"
|
| 494 |
+
]
|
| 495 |
+
|
| 496 |
+
while True:
|
| 497 |
+
ConsoleUI.clear_screen()
|
| 498 |
+
ConsoleUI.display_game_status(self.game_state)
|
| 499 |
+
ConsoleUI.display_section_title("سیستم دینی")
|
| 500 |
+
|
| 501 |
+
choice = ConsoleUI.get_menu_choice(religion_actions)
|
| 502 |
+
|
| 503 |
+
if choice == 1:
|
| 504 |
+
self.religion.display_religious_status()
|
| 505 |
+
elif choice == 2:
|
| 506 |
+
self.religion.spread_religion()
|
| 507 |
+
elif choice == 3:
|
| 508 |
+
self.religion.manage_religious_groups()
|
| 509 |
+
elif choice == 4:
|
| 510 |
+
self.religion.implement_religious_policies()
|
| 511 |
+
elif choice == 5:
|
| 512 |
+
return
|
| 513 |
+
|
| 514 |
+
def handle_population(self):
|
| 515 |
+
"""مدیریت سیستم جمعیت"""
|
| 516 |
+
population_actions = [
|
| 517 |
+
"مشاهده ساختار جمعیت",
|
| 518 |
+
"مدیریت مهاجرت",
|
| 519 |
+
"برنامهریزی خانواده",
|
| 520 |
+
"مدیریت طبقات اجتماعی",
|
| 521 |
+
"برگشت"
|
| 522 |
+
]
|
| 523 |
+
|
| 524 |
+
while True:
|
| 525 |
+
ConsoleUI.clear_screen()
|
| 526 |
+
ConsoleUI.display_game_status(self.game_state)
|
| 527 |
+
ConsoleUI.display_section_title("سیستم جمعیت")
|
| 528 |
+
|
| 529 |
+
choice = ConsoleUI.get_menu_choice(population_actions)
|
| 530 |
+
|
| 531 |
+
if choice == 1:
|
| 532 |
+
self.population.display_population_structure()
|
| 533 |
+
elif choice == 2:
|
| 534 |
+
self.population.manage_migration()
|
| 535 |
+
elif choice == 3:
|
| 536 |
+
self.population.family_planning()
|
| 537 |
+
elif choice == 4:
|
| 538 |
+
self.society.manage_social_classes()
|
| 539 |
+
elif choice == 5:
|
| 540 |
+
return
|
| 541 |
+
|
| 542 |
+
def annual_updates(self):
|
| 543 |
+
"""بهروزرسانیهای سالانه بازی"""
|
| 544 |
+
# بهروزرسانی تقویم
|
| 545 |
+
self.calendar.annual_update()
|
| 546 |
+
|
| 547 |
+
# بهروزرسانی آبوهوایی
|
| 548 |
+
self.climate.annual_update()
|
| 549 |
+
|
| 550 |
+
# بهروزرسانی جمعیت
|
| 551 |
+
self.population.annual_update()
|
| 552 |
+
|
| 553 |
+
# بهروزرسانی فناوری
|
| 554 |
+
self.technology.annual_update()
|
| 555 |
+
|
| 556 |
+
# بهروزرسانی دینی
|
| 557 |
+
self.religion.annual_update()
|
| 558 |
+
|
| 559 |
+
# بهروزرسانی جاسوسی
|
| 560 |
+
self.espionage.annual_update()
|
| 561 |
+
|
| 562 |
+
# بهروزرسانی شهرها
|
| 563 |
+
self.cities.annual_update()
|
| 564 |
+
|
| 565 |
+
# بهروزرسانی نظامی
|
| 566 |
+
self.warfare.annual_update()
|
| 567 |
+
|
| 568 |
+
# بهروزرسانی تجارت
|
| 569 |
+
self.trade.annual_update()
|
| 570 |
+
|
| 571 |
+
# بهروزرسانی سیاست داخلی
|
| 572 |
+
self.politics.annual_update()
|
| 573 |
+
|
| 574 |
+
# بهروزرسانی اجتماعی
|
| 575 |
+
self.society.annual_update()
|
| 576 |
+
|
| 577 |
+
# بهروزرسانی فرهنگی
|
| 578 |
+
self.culture.annual_update()
|
| 579 |
+
|
| 580 |
+
# بهروزرسانی دیپلماسی
|
| 581 |
+
self.diplomacy.annual_update()
|
| 582 |
+
|
| 583 |
+
# بهروزرسانی اقتصاد کلان
|
| 584 |
+
self.economy.annual_update()
|
| 585 |
+
|
| 586 |
+
# بهروزرسانی نظامی
|
| 587 |
+
self.military.annual_update()
|
| 588 |
+
|
| 589 |
+
# بهروزرسانی بهداشت
|
| 590 |
+
self.health.annual_update()
|
| 591 |
+
|
| 592 |
+
# بهروزرسانی آموزش
|
| 593 |
+
self.education.annual_update()
|
| 594 |
+
|
| 595 |
+
# بهروزرسانی محیط زیست
|
| 596 |
+
self.environment.annual_update()
|
| 597 |
+
|
| 598 |
+
# بهروزرسانی مدیریت بحران
|
| 599 |
+
self.crisis.annual_update()
|
| 600 |
+
|
| 601 |
+
# بهروزرسانی جانشینی
|
| 602 |
+
self.succession.annual_update()
|
| 603 |
+
|
| 604 |
+
# بهروزرسانی دستاوردها
|
| 605 |
+
self.achievements.annual_update()
|
| 606 |
+
|
| 607 |
+
# بررسی شرایط پایان بازی
|
| 608 |
+
self.check_victory_conditions()
|
| 609 |
+
|
| 610 |
+
def check_victory_conditions(self):
|
| 611 |
+
"""بررسی شرایط پیروزی یا شکست"""
|
| 612 |
+
# تسلط جهانی
|
| 613 |
+
if self.game_state.controlled_territories >= GAME_CONFIG["victory_conditions"]["world_domination"]:
|
| 614 |
+
self.show_victory_screen("تسلط جهانی",
|
| 615 |
+
"شما موفق شدید بیش از نصف کشورهای جهان را تحت کنترل خود درآورید!")
|
| 616 |
+
return True
|
| 617 |
+
|
| 618 |
+
# تسلط اقتصادی
|
| 619 |
+
if self.game_state.gold >= GAME_CONFIG["victory_conditions"]["economic_domination"]:
|
| 620 |
+
self.show_victory_screen("تسلط اقتصادی",
|
| 621 |
+
"شما به غنیترین کشور جهان تبدیل شدید و اقتصاد جهانی را کنترل میکنید!")
|
| 622 |
+
return True
|
| 623 |
+
|
| 624 |
+
# تسلط فرهنگی
|
| 625 |
+
if self.game_state.culture_score >= GAME_CONFIG["victory_conditions"]["cultural_domination"]:
|
| 626 |
+
self.show_victory_screen("تسلط فرهنگی",
|
| 627 |
+
"فرهنگ و زبان شما به تمام نقاط جهان گسترش یافت!")
|
| 628 |
+
return True
|
| 629 |
+
|
| 630 |
+
# تسلط فناوری
|
| 631 |
+
if self.game_state.technology_level >= GAME_CONFIG["victory_conditions"]["technological_domination"]:
|
| 632 |
+
self.show_victory_screen("تسلط فناوری",
|
| 633 |
+
"شما به پیشرفتهترین کشور جهان تبدیل شدید و فناوری را کنترل میکنید!")
|
| 634 |
+
return True
|
| 635 |
+
|
| 636 |
+
# تسلط دینی
|
| 637 |
+
if self.game_state.religious_influence >= GAME_CONFIG["victory_conditions"]["religious_domination"]:
|
| 638 |
+
self.show_victory_screen("تسلط دینی",
|
| 639 |
+
"دین شما به بیش از 75% جمعیت جهان گسترش یافت!")
|
| 640 |
+
return True
|
| 641 |
+
|
| 642 |
+
# شرایط شکست
|
| 643 |
+
if self.game_state.political_stability <= 0:
|
| 644 |
+
self.show_defeat_screen("ناپایداری سیاسی",
|
| 645 |
+
"ثبات سیاسی شما به صفر رسید و مردم علیه شما شورش کردند!")
|
| 646 |
+
return True
|
| 647 |
+
|
| 648 |
+
if self.game_state.gold <= 0:
|
| 649 |
+
self.show_defeat_screen("ورشکستگی مالی",
|
| 650 |
+
"منابع مالی شما به پایان رسید و امپراتوری شما از بین رفت!")
|
| 651 |
+
return True
|
| 652 |
+
|
| 653 |
+
# بررسی سال پایانی
|
| 654 |
+
if self.game_state.current_year >= GAME_CONFIG["max_year"]:
|
| 655 |
+
self.show_defeat_screen("پایان دوره تاریخی",
|
| 656 |
+
f"شما توانستید تا سال {GAME_CONFIG['max_year']} دوام بیاورید، اما هنوز به پیروزی نرسیدید.")
|
| 657 |
+
return True
|
| 658 |
+
|
| 659 |
+
return False
|
| 660 |
+
|
| 661 |
+
def show_victory_screen(self, victory_type, description):
|
| 662 |
+
"""نمایش صفحه پیروزی"""
|
| 663 |
+
ConsoleUI.clear_screen()
|
| 664 |
+
ConsoleUI.display_section_title("پیروزی!")
|
| 665 |
+
ConsoleUI.display_success(f"تبریک! شما با {victory_type} پیروز شدید!")
|
| 666 |
+
ConsoleUI.display_message(description)
|
| 667 |
+
ConsoleUI.display_message(f"سال پایانی: {self.game_state.current_year}")
|
| 668 |
+
ConsoleUI.display_message(f"ثروت نهایی: {self.game_state.gold} سکه طلا")
|
| 669 |
+
ConsoleUI.display_message(f"امتیاز فرهنگی: {self.game_state.culture_score}/100")
|
| 670 |
+
ConsoleUI.display_message(f"سطح فناوری: {self.game_state.technology_level}")
|
| 671 |
+
ConsoleUI.display_message(f"نفوذ دینی: {self.game_state.religious_influence}%")
|
| 672 |
+
|
| 673 |
+
# ذخیره نتیجه بازی
|
| 674 |
+
self.save_manager.save_game_result(self.game_state, victory_type)
|
| 675 |
+
|
| 676 |
+
ConsoleUI.wait_for_enter()
|
| 677 |
+
self.running = False
|
| 678 |
+
|
| 679 |
+
def show_defeat_screen(self, defeat_type, description):
|
| 680 |
+
"""نمایش صفحه شکست"""
|
| 681 |
+
ConsoleUI.clear_screen()
|
| 682 |
+
ConsoleUI.display_section_title("شکست")
|
| 683 |
+
ConsoleUI.display_error(f"متأسفانه با {defeat_type} باختید!")
|
| 684 |
+
ConsoleUI.display_message(description)
|
| 685 |
+
ConsoleUI.display_message(f"سال پایانی: {self.game_state.current_year}")
|
| 686 |
+
ConsoleUI.display_message(f"ثروت نهایی: {self.game_state.gold} سکه طلا")
|
| 687 |
+
ConsoleUI.display_message(f"امتیاز فرهنگی: {self.game_state.culture_score}/100")
|
| 688 |
+
ConsoleUI.display_message(f"سطح فناوری: {self.game_state.technology_level}")
|
| 689 |
+
ConsoleUI.display_message(f"نفوذ دینی: {self.game_state.religious_influence}%")
|
| 690 |
+
|
| 691 |
+
# ذخیره نتیجه بازی
|
| 692 |
+
self.save_manager.save_game_result(self.game_state, f"شکست: {defeat_type}")
|
| 693 |
+
|
| 694 |
+
ConsoleUI.wait_for_enter()
|
| 695 |
+
self.running = False
|
| 696 |
+
|
| 697 |
+
def undo_last_action(self):
|
| 698 |
+
"""بازگرداندن آخرین اقدام"""
|
| 699 |
+
if not self.undo_stack:
|
| 700 |
+
ConsoleUI.display_warning("هیچ اقدامی برای بازگرداندن وجود ندارد.")
|
| 701 |
+
time.sleep(1)
|
| 702 |
+
return
|
| 703 |
+
|
| 704 |
+
# ذخیره وضعیت فعلی برای redo
|
| 705 |
+
self.redo_stack.append(self.game_state.copy())
|
| 706 |
+
|
| 707 |
+
# بازگرداندن آخرین وضعیت
|
| 708 |
+
self.game_state = self.undo_stack.pop()
|
| 709 |
+
|
| 710 |
+
ConsoleUI.display_success("آ��رین اقدام با موفقیت بازگردانده شد.")
|
| 711 |
+
time.sleep(1)
|
| 712 |
+
|
| 713 |
+
def save_state_for_undo(self):
|
| 714 |
+
"""ذخیره وضعیت فعلی برای امکان undo"""
|
| 715 |
+
if len(self.undo_stack) >= GAME_CONFIG["max_undo_steps"]:
|
| 716 |
+
self.undo_stack.pop(0) # حذف قدیمیترین وضعیت
|
| 717 |
+
|
| 718 |
+
self.undo_stack.append(self.game_state.copy())
|
| 719 |
+
self.redo_stack = [] # پاک کردن redo stack
|
| 720 |
+
|
| 721 |
+
def show_tutorial(self):
|
| 722 |
+
"""نمایش راهنمای اولیه بازی"""
|
| 723 |
+
if ConsoleUI.confirm_action("آیا میخواهید راهنمای اولیه بازی را ببینید؟"):
|
| 724 |
+
ConsoleUI.clear_screen()
|
| 725 |
+
ConsoleUI.display_section_title("راهنمای اولیه بازی")
|
| 726 |
+
|
| 727 |
+
tutorial_steps = [
|
| 728 |
+
"در این بازی شما رهبر یک کشور تاریخی هستید که باید با تصمیمات استراتژیک، کشور خود را گسترش دهید.",
|
| 729 |
+
"در هر سال میتوانید اقدامات مختلفی انجام دهید: مدیریت اقتصاد، دیپلماسی، نظامی، و...",
|
| 730 |
+
"توجه به تعادل بین ثبات سیاسی، نارضایتی عمومی و منابع مالی بسیار مهم است.",
|
| 731 |
+
"رویدادهای تصادفی و تاریخی در طول بازی رخ خواهند داد که باید به آنها پاسخ دهید.",
|
| 732 |
+
"هدف نهایی شما رسیدن به یکی از شرایط پیروزی است: تسلط جهانی، اقتصادی، فرهنگی یا فناوری."
|
| 733 |
+
]
|
| 734 |
+
|
| 735 |
+
for step in tutorial_steps:
|
| 736 |
+
ConsoleUI.typewriter_effect(step)
|
| 737 |
+
time.sleep(0.5)
|
| 738 |
+
print()
|
| 739 |
+
|
| 740 |
+
ConsoleUI.wait_for_enter()
|
Shadows_of_Empires/game/game_state.py
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
مدیریت وضعیت فعلی بازی و اطلاعات کشور بازیکن
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
import random
|
| 6 |
+
import copy
|
| 7 |
+
from data.countries.base_countries import COUNTRIES
|
| 8 |
+
from data.tech.tech_trees import TECH_TREES
|
| 9 |
+
from data.religion.religions import RELIGIONS
|
| 10 |
+
|
| 11 |
+
class GameState:
|
| 12 |
+
"""کلاس مدیریت وضعیت بازی"""
|
| 13 |
+
|
| 14 |
+
def __init__(self):
|
| 15 |
+
"""ساخت یک نمونه جدید از وضعیت بازی"""
|
| 16 |
+
# اطلاعات پایه
|
| 17 |
+
self.current_year = 1500
|
| 18 |
+
self.player_country = None
|
| 19 |
+
self.difficulty = "normal"
|
| 20 |
+
self.difficulty_factors = {
|
| 21 |
+
"stability_factor": 1.0,
|
| 22 |
+
"economy_factor": 1.0,
|
| 23 |
+
"military_factor": 1.0
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
# منابع مالی
|
| 27 |
+
self.gold = 15000
|
| 28 |
+
self.tax_rate = 20
|
| 29 |
+
self.budget = {
|
| 30 |
+
"military": 40,
|
| 31 |
+
"infrastructure": 20,
|
| 32 |
+
"education": 15,
|
| 33 |
+
"healthcare": 15,
|
| 34 |
+
"welfare": 10
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
# وضعیت سیاسی
|
| 38 |
+
self.public_dissatisfaction = 20
|
| 39 |
+
self.political_stability = 75
|
| 40 |
+
self.government_type = "Absolute Monarchy"
|
| 41 |
+
self.ruling_party = None
|
| 42 |
+
self.political_parties = []
|
| 43 |
+
self.loyalty_levels = {}
|
| 44 |
+
|
| 45 |
+
# نظامی
|
| 46 |
+
self.military_strength = 50
|
| 47 |
+
self.army = {
|
| 48 |
+
"infantry": 10000,
|
| 49 |
+
"cavalry": 5000,
|
| 50 |
+
"artillery": 2000,
|
| 51 |
+
"navy": 3000
|
| 52 |
+
}
|
| 53 |
+
self.military_tech = 1
|
| 54 |
+
self.fortifications = 30
|
| 55 |
+
|
| 56 |
+
# اقتصاد
|
| 57 |
+
self.controlled_territories = 1
|
| 58 |
+
self.economy = {
|
| 59 |
+
"trade": 50,
|
| 60 |
+
"agriculture": 50,
|
| 61 |
+
"industry": 30,
|
| 62 |
+
"inflation": 5,
|
| 63 |
+
"unemployment": 8,
|
| 64 |
+
"gdp_growth": 2.5
|
| 65 |
+
}
|
| 66 |
+
self.resources = {
|
| 67 |
+
"food": 100,
|
| 68 |
+
"wood": 80,
|
| 69 |
+
"stone": 60,
|
| 70 |
+
"iron": 40,
|
| 71 |
+
"gold": 20,
|
| 72 |
+
"oil": 0
|
| 73 |
+
}
|
| 74 |
+
self.trade_routes = []
|
| 75 |
+
|
| 76 |
+
# جمعیت
|
| 77 |
+
self.population = 8000000
|
| 78 |
+
self.population_growth = 1.2
|
| 79 |
+
self.urban_population = 25
|
| 80 |
+
self.literacy_rate = 15
|
| 81 |
+
self.health_index = 60
|
| 82 |
+
self.happiness = 70
|
| 83 |
+
|
| 84 |
+
# فرهنگ و دین
|
| 85 |
+
self.culture_score = 40
|
| 86 |
+
self.cultural_influence = 30
|
| 87 |
+
self.religious_influence = 50
|
| 88 |
+
self.religion = "Shia Islam"
|
| 89 |
+
self.religious_groups = {}
|
| 90 |
+
|
| 91 |
+
# فناوری
|
| 92 |
+
self.technology_level = 1
|
| 93 |
+
self.technology = {
|
| 94 |
+
"military": 1,
|
| 95 |
+
"agriculture": 1,
|
| 96 |
+
"trade": 1,
|
| 97 |
+
"industry": 1,
|
| 98 |
+
"medicine": 1,
|
| 99 |
+
"education": 1
|
| 100 |
+
}
|
| 101 |
+
self.research_progress = {}
|
| 102 |
+
self.unlocked_technologies = []
|
| 103 |
+
|
| 104 |
+
# روابط بینالمللی
|
| 105 |
+
self.controlled_countries = []
|
| 106 |
+
self.relations = {}
|
| 107 |
+
self.alliances = []
|
| 108 |
+
self.international_orgs = []
|
| 109 |
+
|
| 110 |
+
# سیستمهای پیشرفته
|
| 111 |
+
self.diplomacy_points = 10
|
| 112 |
+
self.spy_network = {
|
| 113 |
+
"size": 5,
|
| 114 |
+
"effectiveness": 30,
|
| 115 |
+
"targets": []
|
| 116 |
+
}
|
| 117 |
+
self.cities = []
|
| 118 |
+
self.environment = {
|
| 119 |
+
"pollution": 20,
|
| 120 |
+
"deforestation": 15,
|
| 121 |
+
"climate_impact": 10
|
| 122 |
+
}
|
| 123 |
+
self.crisis_level = 0
|
| 124 |
+
self.achievements = []
|
| 125 |
+
self.royal_family = {
|
| 126 |
+
"ruler": {"name": "Unknown", "age": 40, "health": 80},
|
| 127 |
+
"heir": {"name": "Unknown", "age": 20, "popularity": 50},
|
| 128 |
+
"family_members": []
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
# سایر
|
| 132 |
+
self.events_history = []
|
| 133 |
+
self.random = random.Random()
|
| 134 |
+
self.plugins = []
|
| 135 |
+
|
| 136 |
+
def select_country(self):
|
| 137 |
+
"""انتخاب کشور توسط بازیکن"""
|
| 138 |
+
from ui.console_ui import ConsoleUI
|
| 139 |
+
|
| 140 |
+
ConsoleUI.display_section_title("انتخاب کشور")
|
| 141 |
+
ConsoleUI.display_message("لطفاً یکی از کشورهای زیر را انتخاب کنید:")
|
| 142 |
+
|
| 143 |
+
# نمایش لیست کشورها
|
| 144 |
+
country_names = [country["name"] for country in COUNTRIES]
|
| 145 |
+
choice = ConsoleUI.get_menu_choice(country_names)
|
| 146 |
+
|
| 147 |
+
# تنظیم کشور انتخابی
|
| 148 |
+
self.player_country = COUNTRIES[choice-1]
|
| 149 |
+
self.controlled_countries = [self.player_country["name"]]
|
| 150 |
+
|
| 151 |
+
# راهاندازی اولیه بر اساس کشور انتخابی
|
| 152 |
+
self.initialize_country()
|
| 153 |
+
|
| 154 |
+
def initialize_country(self):
|
| 155 |
+
"""راهاندازی اولیه وضعیت بازی بر اساس کشور انتخابی"""
|
| 156 |
+
country = self.player_country
|
| 157 |
+
base = country["base_attributes"]
|
| 158 |
+
|
| 159 |
+
# تنظیم اولیه وضعیت بازی
|
| 160 |
+
self.gold = base["gold"]
|
| 161 |
+
self.political_stability = base["stability"]
|
| 162 |
+
self.military_strength = base["military"]["army"] * 0.6 + base["military"]["navy"] * 0.4
|
| 163 |
+
self.culture_score = base["culture"]
|
| 164 |
+
self.diplomacy_points = 10
|
| 165 |
+
self.population = int(base["population"] * 1000000)
|
| 166 |
+
|
| 167 |
+
# تنظیم روابط اولیه
|
| 168 |
+
self.relations = {}
|
| 169 |
+
for c in COUNTRIES:
|
| 170 |
+
if c["name"] == country["name"]:
|
| 171 |
+
self.relations[c["name"]] = 100 # رابطه با خود
|
| 172 |
+
elif c["name"] in country["starting_relations"]:
|
| 173 |
+
self.relations[c["name"]] = country["starting_relations"][c["name"]]
|
| 174 |
+
else:
|
| 175 |
+
self.relations[c["name"]] = self.random.randint(-20, 30)
|
| 176 |
+
|
| 177 |
+
# تنظیم اقتصاد اولیه
|
| 178 |
+
self.economy = {
|
| 179 |
+
"trade": base["economy"]["trade"],
|
| 180 |
+
"agriculture": base["economy"]["agriculture"],
|
| 181 |
+
"industry": base["economy"]["industry"],
|
| 182 |
+
"inflation": 5,
|
| 183 |
+
"unemployment": 10,
|
| 184 |
+
"gdp_growth": 2.0
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
# تنظیم دین
|
| 188 |
+
self.religion = base["religion"]
|
| 189 |
+
self.religious_influence = 50
|
| 190 |
+
|
| 191 |
+
# تنظیم شهرها
|
| 192 |
+
self.cities = [{
|
| 193 |
+
"name": "Tehran",
|
| 194 |
+
"population": 500000,
|
| 195 |
+
"development": 50,
|
| 196 |
+
"happiness": 70,
|
| 197 |
+
"buildings": ["Castle", "Market"]
|
| 198 |
+
}]
|
| 199 |
+
|
| 200 |
+
# تنظیم فناوری
|
| 201 |
+
self.technology_level = 1
|
| 202 |
+
self.unlocked_technologies = []
|
| 203 |
+
if self.player_country["name"] in TECH_TREES:
|
| 204 |
+
self.unlocked_technologies = TECH_TREES[self.player_country["name"]]["starting_technologies"]
|
| 205 |
+
|
| 206 |
+
# تنظیم گروههای مذهبی
|
| 207 |
+
if self.religion in RELIGIONS:
|
| 208 |
+
self.religious_groups = {group: 100 for group in RELIGIONS[self.religion]["groups"]}
|
| 209 |
+
|
| 210 |
+
# تنظیم خاندان سلطنتی
|
| 211 |
+
self.royal_family = {
|
| 212 |
+
"ruler": {
|
| 213 |
+
"name": self.random.choice(["Ismail I", "Tahmasp I", "Abbas I"]),
|
| 214 |
+
"age": self.random.randint(30, 50),
|
| 215 |
+
"health": self.random.randint(60, 90),
|
| 216 |
+
"popularity": self.random.randint(40, 70)
|
| 217 |
+
},
|
| 218 |
+
"heir": {
|
| 219 |
+
"name": "Unknown",
|
| 220 |
+
"age": self.random.randint(10, 25),
|
| 221 |
+
"popularity": self.random.randint(30, 60)
|
| 222 |
+
},
|
| 223 |
+
"family_members": []
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
def apply_plugin(self, plugin):
|
| 227 |
+
"""اعمال تغییرات پلاگین به وضعیت بازی"""
|
| 228 |
+
if hasattr(plugin, 'modify_game_state'):
|
| 229 |
+
plugin.modify_game_state(self)
|
| 230 |
+
self.plugins.append(plugin)
|
| 231 |
+
|
| 232 |
+
def copy(self):
|
| 233 |
+
"""ساخت کپی از وضعیت فعلی بازی برای سیستم undo/redo"""
|
| 234 |
+
new_state = GameState()
|
| 235 |
+
|
| 236 |
+
# کپی اطلاعات پایه
|
| 237 |
+
new_state.current_year = self.current_year
|
| 238 |
+
new_state.player_country = self.player_country
|
| 239 |
+
new_state.difficulty = self.difficulty
|
| 240 |
+
new_state.difficulty_factors = self.difficulty_factors.copy()
|
| 241 |
+
|
| 242 |
+
# کپی منابع مالی
|
| 243 |
+
new_state.gold = self.gold
|
| 244 |
+
new_state.tax_rate = self.tax_rate
|
| 245 |
+
new_state.budget = self.budget.copy()
|
| 246 |
+
|
| 247 |
+
# کپی وضعیت سیاسی
|
| 248 |
+
new_state.public_dissatisfaction = self.public_dissatisfaction
|
| 249 |
+
new_state.political_stability = self.political_stability
|
| 250 |
+
new_state.government_type = self.government_type
|
| 251 |
+
new_state.ruling_party = self.ruling_party
|
| 252 |
+
new_state.political_parties = self.political_parties.copy()
|
| 253 |
+
new_state.loyalty_levels = self.loyalty_levels.copy()
|
| 254 |
+
|
| 255 |
+
# کپی نظامی
|
| 256 |
+
new_state.military_strength = self.military_strength
|
| 257 |
+
new_state.army = self.army.copy()
|
| 258 |
+
new_state.military_tech = self.military_tech
|
| 259 |
+
new_state.fortifications = self.fortifications
|
| 260 |
+
|
| 261 |
+
# کپی اقتصاد
|
| 262 |
+
new_state.controlled_territories = self.controlled_territories
|
| 263 |
+
new_state.economy = self.economy.copy()
|
| 264 |
+
new_state.resources = self.resources.copy()
|
| 265 |
+
new_state.trade_routes = self.trade_routes.copy()
|
| 266 |
+
|
| 267 |
+
# کپی جمعیت
|
| 268 |
+
new_state.population = self.population
|
| 269 |
+
new_state.population_growth = self.population_growth
|
| 270 |
+
new_state.urban_population = self.urban_population
|
| 271 |
+
new_state.literacy_rate = self.literacy_rate
|
| 272 |
+
new_state.health_index = self.health_index
|
| 273 |
+
new_state.happiness = self.happiness
|
| 274 |
+
|
| 275 |
+
# کپی فرهنگ و دین
|
| 276 |
+
new_state.culture_score = self.culture_score
|
| 277 |
+
new_state.cultural_influence = self.cultural_influence
|
| 278 |
+
new_state.religious_influence = self.religious_influence
|
| 279 |
+
new_state.religion = self.religion
|
| 280 |
+
new_state.religious_groups = self.religious_groups.copy()
|
| 281 |
+
|
| 282 |
+
# کپی فناوری
|
| 283 |
+
new_state.technology_level = self.technology_level
|
| 284 |
+
new_state.technology = self.technology.copy()
|
| 285 |
+
new_state.research_progress = self.research_progress.copy()
|
| 286 |
+
new_state.unlocked_technologies = self.unlocked_technologies.copy()
|
| 287 |
+
|
| 288 |
+
# کپی روابط بینالمللی
|
| 289 |
+
new_state.controlled_countries = self.controlled_countries.copy()
|
| 290 |
+
new_state.relations = self.relations.copy()
|
| 291 |
+
new_state.alliances = self.alliances.copy()
|
| 292 |
+
new_state.international_orgs = self.international_orgs.copy()
|
| 293 |
+
|
| 294 |
+
# کپی سیستمهای پیشرفته
|
| 295 |
+
new_state.diplomacy_points = self.diplomacy_points
|
| 296 |
+
new_state.spy_network = {
|
| 297 |
+
"size": self.spy_network["size"],
|
| 298 |
+
"effectiveness": self.spy_network["effectiveness"],
|
| 299 |
+
"targets": self.spy_network["targets"].copy()
|
| 300 |
+
}
|
| 301 |
+
new_state.cities = [city.copy() for city in self.cities]
|
| 302 |
+
new_state.environment = self.environment.copy()
|
| 303 |
+
new_state.crisis_level = self.crisis_level
|
| 304 |
+
new_state.achievements = self.achievements.copy()
|
| 305 |
+
new_state.royal_family = {
|
| 306 |
+
"ruler": self.royal_family["ruler"].copy(),
|
| 307 |
+
"heir": self.royal_family["heir"].copy(),
|
| 308 |
+
"family_members": [member.copy() for member in self.royal_family["family_members"]]
|
| 309 |
+
}
|
| 310 |
+
|
| 311 |
+
# کپی سایر
|
| 312 |
+
new_state.events_history = self.events_history.copy()
|
| 313 |
+
|
| 314 |
+
return new_state
|
Shadows_of_Empires/game/succession/succession_system.py
ADDED
|
@@ -0,0 +1,310 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
سیستم جانشینی و مدیریت خاندان سلطنتی
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
import random
|
| 6 |
+
|
| 7 |
+
class SuccessionSystem:
|
| 8 |
+
"""سیستم جانشینی و مدیریت خاندان سلطنتی"""
|
| 9 |
+
|
| 10 |
+
def __init__(self, game_state):
|
| 11 |
+
"""ساخت یک نمونه جدید از سیستم جانشینی"""
|
| 12 |
+
self.game_state = game_state
|
| 13 |
+
self.succession_rules = self._determine_succession_rules()
|
| 14 |
+
|
| 15 |
+
def _determine_succession_rules(self):
|
| 16 |
+
"""تعیین قوانین جانشینی بر اساس کشور انتخابی"""
|
| 17 |
+
country = self.game_state.player_country
|
| 18 |
+
government_type = self.game_state.government_type
|
| 19 |
+
|
| 20 |
+
# تعیین قوانین جانشینی بر اساس نوع حکومت
|
| 21 |
+
if "Monarchy" in government_type:
|
| 22 |
+
return {
|
| 23 |
+
"type": "Hereditary",
|
| 24 |
+
"rules": ["Primogeniture", "Agnatic"], # نخستزادگی، از طریق مردان
|
| 25 |
+
"heir_selection": "Oldest son"
|
| 26 |
+
}
|
| 27 |
+
elif government_type == "Republic":
|
| 28 |
+
return {
|
| 29 |
+
"type": "Elective",
|
| 30 |
+
"rules": ["Popular_vote", "Parliamentary"],
|
| 31 |
+
"heir_selection": "Election"
|
| 32 |
+
}
|
| 33 |
+
else:
|
| 34 |
+
return {
|
| 35 |
+
"type": "Mixed",
|
| 36 |
+
"rules": ["Council_decision", "Military_support"],
|
| 37 |
+
"heir_selection": "Council"
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
def initialize(self):
|
| 41 |
+
"""راهاندازی اولیه سیستم جانشینی"""
|
| 42 |
+
# ایجاد خاندان سلطنتی اولیه
|
| 43 |
+
self._create_royal_family()
|
| 44 |
+
|
| 45 |
+
# تنظیم جانشین اولیه
|
| 46 |
+
self._determine_heir()
|
| 47 |
+
|
| 48 |
+
def _create_royal_family(self):
|
| 49 |
+
"""ایجاد خاندان سلطنتی اولیه"""
|
| 50 |
+
# اگر خاندان سلطنتی از قبل وجود داشت، استفاده میکنیم
|
| 51 |
+
if not self.game_state.royal_family["ruler"]["name"]:
|
| 52 |
+
# ایجاد پادشاه جدید
|
| 53 |
+
names = ["Ismail", "Tahmasp", "Abbas", "Mohammad", "Nader", "Karim"]
|
| 54 |
+
self.game_state.royal_family["ruler"] = {
|
| 55 |
+
"name": random.choice(names),
|
| 56 |
+
"age": random.randint(30, 50),
|
| 57 |
+
"health": random.randint(60, 90),
|
| 58 |
+
"popularity": random.randint(40, 70)
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
# ایجاد جانشین
|
| 62 |
+
if not self.game_state.royal_family["heir"]["name"]:
|
| 63 |
+
heir_names = ["Mohammad", "Hossein", "Reza", "Ali", "Mahmoud"]
|
| 64 |
+
self.game_state.royal_family["heir"] = {
|
| 65 |
+
"name": random.choice(heir_names),
|
| 66 |
+
"age": random.randint(10, 25),
|
| 67 |
+
"popularity": random.randint(30, 60)
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
# ایجاد اعضای خانواده
|
| 71 |
+
if not self.game_state.royal_family["family_members"]:
|
| 72 |
+
family_names = ["Fatima", "Zahra", "Maryam", "Hassan", "Hussein"]
|
| 73 |
+
for _ in range(random.randint(3, 6)):
|
| 74 |
+
self.game_state.royal_family["family_members"].append({
|
| 75 |
+
"name": random.choice(family_names),
|
| 76 |
+
"age": random.randint(5, 40),
|
| 77 |
+
"influence": random.randint(10, 50),
|
| 78 |
+
"loyalty": random.randint(20, 80)
|
| 79 |
+
})
|
| 80 |
+
|
| 81 |
+
def _determine_heir(self):
|
| 82 |
+
"""تعیین جانشین بر اساس قوانین جانشینی"""
|
| 83 |
+
rules = self.succession_rules
|
| 84 |
+
|
| 85 |
+
if rules["type"] == "Hereditary":
|
| 86 |
+
# در سیستم نخستزادگی، جانشین پسر بزرگتر است
|
| 87 |
+
self.game_state.royal_family["heir"]["name"] = f"{self.game_state.royal_family['ruler']['name']} Jr."
|
| 88 |
+
self.game_state.royal_family["heir"]["age"] = max(18, self.game_state.royal_family["ruler"]["age"] - 25)
|
| 89 |
+
|
| 90 |
+
elif rules["type"] == "Elective":
|
| 91 |
+
# در سیستم انتخابی، جانشین بر اساس محبوبیت انتخاب میشود
|
| 92 |
+
candidates = [member for member in self.game_state.royal_family["family_members"]
|
| 93 |
+
if member["age"] > 18]
|
| 94 |
+
if candidates:
|
| 95 |
+
candidate = max(candidates, key=lambda x: x["influence"])
|
| 96 |
+
self.game_state.royal_family["heir"] = {
|
| 97 |
+
"name": candidate["name"],
|
| 98 |
+
"age": candidate["age"],
|
| 99 |
+
"popularity": candidate["influence"]
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
else: # Mixed system
|
| 103 |
+
# در سیستم ترکیبی، جانشین توسط شورایی انتخاب میشود
|
| 104 |
+
potential_heirs = [
|
| 105 |
+
self.game_state.royal_family["heir"],
|
| 106 |
+
*self.game_state.royal_family["family_members"]
|
| 107 |
+
]
|
| 108 |
+
potential_heirs = [h for h in potential_heirs if h.get("age", 0) > 18]
|
| 109 |
+
|
| 110 |
+
if potential_heirs:
|
| 111 |
+
# انتخاب تصادفی با احتمال متناسب با محبوبیت
|
| 112 |
+
weights = [h.get("popularity", 50) for h in potential_heirs]
|
| 113 |
+
total = sum(weights)
|
| 114 |
+
if total > 0:
|
| 115 |
+
weights = [w/total for w in weights]
|
| 116 |
+
selected = random.choices(potential_heirs, weights=weights, k=1)[0]
|
| 117 |
+
self.game_state.royal_family["heir"] = {
|
| 118 |
+
"name": selected["name"],
|
| 119 |
+
"age": selected.get("age", 30),
|
| 120 |
+
"popularity": selected.get("popularity", 50)
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
def display_succession_status(self):
|
| 124 |
+
"""نمایش وضعیت جانشینی و خاندان سلطنتی"""
|
| 125 |
+
from ui.console_ui import ConsoleUI
|
| 126 |
+
|
| 127 |
+
ConsoleUI.clear_screen()
|
| 128 |
+
ConsoleUI.display_section_title("وضعیت خاندان سلطنتی")
|
| 129 |
+
|
| 130 |
+
# نمایش اطلاعات پادشاه فعلی
|
| 131 |
+
ruler = self.game_state.royal_family["ruler"]
|
| 132 |
+
ConsoleUI.display_message(f"پادشاه فعلی: {ruler['name']}", indent=2)
|
| 133 |
+
ConsoleUI.display_message(f"سن: {ruler['age']}", indent=4)
|
| 134 |
+
ConsoleUI.display_message(f"وضعیت سلامت: {ruler['health']}%", indent=4)
|
| 135 |
+
ConsoleUI.display_message(f"محبوبیت: {ruler['popularity']}%", indent=4)
|
| 136 |
+
|
| 137 |
+
# نمایش اطلاعات جانشین
|
| 138 |
+
heir = self.game_state.royal_family["heir"]
|
| 139 |
+
ConsoleUI.display_section_title("جانشین", width=60)
|
| 140 |
+
ConsoleUI.display_message(f"نام: {heir['name']}", indent=2)
|
| 141 |
+
ConsoleUI.display_message(f"سن: {heir['age']}", indent=2)
|
| 142 |
+
ConsoleUI.display_message(f"محبوبیت: {heir['popularity']}%", indent=2)
|
| 143 |
+
|
| 144 |
+
# نمایش اعضای خانواده
|
| 145 |
+
ConsoleUI.display_section_title("اعضای خانواده", width=60)
|
| 146 |
+
for i, member in enumerate(self.game_state.royal_family["family_members"], 1):
|
| 147 |
+
ConsoleUI.display_message(f"{i}. {member['name']}", indent=2)
|
| 148 |
+
ConsoleUI.display_message(f" سن: {member['age']}", indent=4)
|
| 149 |
+
ConsoleUI.display_message(f" تأثیر: {member['influence']}%", indent=4)
|
| 150 |
+
ConsoleUI.display_message(f" وفاداری: {member['loyalty']}%", indent=4)
|
| 151 |
+
|
| 152 |
+
ConsoleUI.wait_for_enter()
|
| 153 |
+
|
| 154 |
+
def handle_succession_crisis(self):
|
| 155 |
+
"""مدیریت بحران جانشینی"""
|
| 156 |
+
from ui.console_ui import ConsoleUI
|
| 157 |
+
|
| 158 |
+
ConsoleUI.clear_screen()
|
| 159 |
+
ConsoleUI.display_section_title("بحران جانشینی")
|
| 160 |
+
|
| 161 |
+
# بررسی وضعیت سلامت پادشاه
|
| 162 |
+
ruler_health = self.game_state.royal_family["ruler"]["health"]
|
| 163 |
+
|
| 164 |
+
if ruler_health < 30:
|
| 165 |
+
ConsoleUI.display_warning("وضعیت سلامت پادشاه بسیار بد است و بحران جانشینی ایجاد شده است!", indent=2)
|
| 166 |
+
else:
|
| 167 |
+
ConsoleUI.display_warning("یک توطئه برای تغییر جانشینی رخ داده است!", indent=2)
|
| 168 |
+
|
| 169 |
+
# گزینههای پاسخ به بحران
|
| 170 |
+
options = [
|
| 171 |
+
"تقویت جانشین قانونی",
|
| 172 |
+
"مذاکره با گروههای متخاصم",
|
| 173 |
+
"استفاده از نیروی نظامی",
|
| 174 |
+
"بیتفاوتی"
|
| 175 |
+
]
|
| 176 |
+
costs = [5000, 3000, 7000, 0]
|
| 177 |
+
effects = [
|
| 178 |
+
{"political_stability": 10, "public_dissatisfaction": -5},
|
| 179 |
+
{"political_stability": 5, "relations": {"+": 5}},
|
| 180 |
+
{"political_stability": 15, "military_strength": -10, "public_dissatisfaction": 10},
|
| 181 |
+
{"political_stability": -20, "public_dissatisfaction": 25}
|
| 182 |
+
]
|
| 183 |
+
|
| 184 |
+
# نمایش گزینهها
|
| 185 |
+
options.append("برگشت")
|
| 186 |
+
costs.append(0)
|
| 187 |
+
effects.append({})
|
| 188 |
+
|
| 189 |
+
choice = ConsoleUI.get_menu_choice(options)
|
| 190 |
+
|
| 191 |
+
if choice == len(options):
|
| 192 |
+
return # برگشت
|
| 193 |
+
|
| 194 |
+
# بررسی موجودی برای گزینههای هزینهدار
|
| 195 |
+
if costs[choice-1] > 0 and self.game_state.gold < costs[choice-1]:
|
| 196 |
+
ConsoleUI.display_error("موجودی طلا کافی نیست!")
|
| 197 |
+
ConsoleUI.wait_for_enter()
|
| 198 |
+
return
|
| 199 |
+
|
| 200 |
+
# اعمال تغییرات
|
| 201 |
+
self._apply_succession_crisis_response(costs[choice-1], effects[choice-1])
|
| 202 |
+
|
| 203 |
+
def _apply_succession_crisis_response(self, cost, effects):
|
| 204 |
+
"""اعمال پاسخ به بحران جانشینی و اثرات آن"""
|
| 205 |
+
from ui.console_ui import ConsoleUI
|
| 206 |
+
|
| 207 |
+
# کسر هزینه
|
| 208 |
+
if cost > 0:
|
| 209 |
+
self.game_state.gold -= cost
|
| 210 |
+
|
| 211 |
+
# اعمال اثرات
|
| 212 |
+
for effect_type, value in effects.items():
|
| 213 |
+
if effect_type == "relations":
|
| 214 |
+
for country in self.game_state.relations:
|
| 215 |
+
if country != self.game_state.player_country["name"]:
|
| 216 |
+
self.game_state.relations[country] = min(100, self.game_state.relations[country] + value["+"])
|
| 217 |
+
else:
|
| 218 |
+
if effect_type in self.game_state:
|
| 219 |
+
self.game_state[effect_type] = max(0, min(100, self.game_state[effect_type] + value))
|
| 220 |
+
|
| 221 |
+
ConsoleUI.display_success("بحران جانشینی مدیریت شد.")
|
| 222 |
+
ConsoleUI.wait_for_enter()
|
| 223 |
+
|
| 224 |
+
def simulate_death(self):
|
| 225 |
+
"""شبیهسازی مرگ پادشاه و جانشینی"""
|
| 226 |
+
from ui.console_ui import ConsoleUI
|
| 227 |
+
|
| 228 |
+
ConsoleUI.clear_screen()
|
| 229 |
+
ConsoleUI.display_section_title("مرگ پادشاه")
|
| 230 |
+
|
| 231 |
+
ruler = self.game_state.royal_family["ruler"]
|
| 232 |
+
ConsoleUI.display_warning(f"{ruler['name']} پادشاه {self.game_state.player_country['name']} درگذشت!", indent=2)
|
| 233 |
+
|
| 234 |
+
# انتخاب جانشین جدید
|
| 235 |
+
heir = self.game_state.royal_family["heir"]
|
| 236 |
+
ConsoleUI.display_success(f"{heir['name']} به پادشاهی رسید!", indent=2)
|
| 237 |
+
|
| 238 |
+
# اعمال تغییرات
|
| 239 |
+
self.game_state.royal_family["ruler"] = heir
|
| 240 |
+
|
| 241 |
+
# ایجاد جانشین جدید
|
| 242 |
+
self._determine_heir()
|
| 243 |
+
|
| 244 |
+
# تأثیرات سیاسی
|
| 245 |
+
ConsoleUI.display_section_title("تأثیرات سیاسی", width=60)
|
| 246 |
+
ConsoleUI.display_message("• ثبات سیاسی موقتاً کاهش یافت", indent=2)
|
| 247 |
+
ConsoleUI.display_message("• روابط بینالمللی ممکن است تغییر کند", indent=2)
|
| 248 |
+
|
| 249 |
+
self.game_state.political_stability = max(0, self.game_state.political_stability - 15)
|
| 250 |
+
|
| 251 |
+
ConsoleUI.wait_for_enter()
|
| 252 |
+
|
| 253 |
+
def manage_succession_crisis(self):
|
| 254 |
+
"""مدیریت بحرانهای مربوط به جانشینی"""
|
| 255 |
+
from ui.console_ui import ConsoleUI
|
| 256 |
+
|
| 257 |
+
# بررسی احتمال بحران جانشینی
|
| 258 |
+
ruler_health = self.game_state.royal_family["ruler"]["health"]
|
| 259 |
+
if ruler_health < 40 or random.random() < 0.1:
|
| 260 |
+
self.handle_succession_crisis()
|
| 261 |
+
|
| 262 |
+
def annual_update(self):
|
| 263 |
+
"""بهروزرسانیهای سالانه سیستم جانشینی"""
|
| 264 |
+
# افزایش سن اعضای خانواده
|
| 265 |
+
self._age_family_members()
|
| 266 |
+
|
| 267 |
+
# کاهش سلامت پادشاه
|
| 268 |
+
self._update_ruler_health()
|
| 269 |
+
|
| 270 |
+
# بررسی بحرانهای جانشینی
|
| 271 |
+
self.manage_succession_crisis()
|
| 272 |
+
|
| 273 |
+
# بررسی مرگ پادشاه
|
| 274 |
+
self._check_for_ruler_death()
|
| 275 |
+
|
| 276 |
+
def _age_family_members(self):
|
| 277 |
+
"""افزایش سن اعضای خانواده سلطنتی"""
|
| 278 |
+
# افزایش سن پادشاه
|
| 279 |
+
self.game_state.royal_family["ruler"]["age"] += 1
|
| 280 |
+
|
| 281 |
+
# افزایش سن جانشین
|
| 282 |
+
self.game_state.royal_family["heir"]["age"] += 1
|
| 283 |
+
|
| 284 |
+
# افزایش سن اعضای خانواده
|
| 285 |
+
for member in self.game_state.royal_family["family_members"]:
|
| 286 |
+
member["age"] += 1
|
| 287 |
+
|
| 288 |
+
def _update_ruler_health(self):
|
| 289 |
+
"""بهروزرسانی سلامت پادشاه"""
|
| 290 |
+
ruler = self.game_state.royal_family["ruler"]
|
| 291 |
+
|
| 292 |
+
# کاهش سلامت بر اساس سن
|
| 293 |
+
age_factor = max(0, ruler["age"] - 40) * 0.5
|
| 294 |
+
stress_factor = (100 - self.game_state.political_stability) * 0.1
|
| 295 |
+
|
| 296 |
+
ruler["health"] = max(0, min(100, ruler["health"] - age_factor - stress_factor))
|
| 297 |
+
|
| 298 |
+
def _check_for_ruler_death(self):
|
| 299 |
+
"""بررسی مرگ پادشاه بر اساس سلامت و سن"""
|
| 300 |
+
ruler = self.game_state.royal_family["ruler"]
|
| 301 |
+
|
| 302 |
+
# محاسبه احتمال مرگ
|
| 303 |
+
base_chance = 0.01
|
| 304 |
+
age_factor = max(0, ruler["age"] - 50) * 0.02
|
| 305 |
+
health_factor = (100 - ruler["health"]) * 0.01
|
| 306 |
+
|
| 307 |
+
death_chance = base_chance + age_factor + health_factor
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
سیستم تحقیق و توسعه فناوری با درخت فناوری و پیشنیازها
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
from data.tech.tech_definitions import TECHNOLOGIES
|
| 6 |
+
from data.tech.tech_trees import TECH_TREES
|
| 7 |
+
|
| 8 |
+
class ResearchSystem:
|
| 9 |
+
"""سیستم تحقیق و توسعه فناوری"""
|
| 10 |
+
|
| 11 |
+
def __init__(self, game_state):
|
| 12 |
+
"""ساخت یک نمونه جدید از سیستم تحقیق"""
|
| 13 |
+
self.game_state = game_state
|
| 14 |
+
self.research_fields = ["military", "agriculture", "trade", "industry", "medicine", "education"]
|
| 15 |
+
self.current_research = None
|
| 16 |
+
self.research_progress = 0
|
| 17 |
+
self.research_efficiency = 1.0
|
| 18 |
+
|
| 19 |
+
def initialize(self):
|
| 20 |
+
"""راهاندازی اولیه سیستم تحقیق"""
|
| 21 |
+
# تنظیم درخت فناوری بر اساس کشور انتخابی
|
| 22 |
+
country_name = self.game_state.player_country["name"]
|
| 23 |
+
if country_name in TECH_TREES:
|
| 24 |
+
self.tech_tree = TECH_TREES[country_name]
|
| 25 |
+
else:
|
| 26 |
+
self.tech_tree = TECH_TREES["Generic"]
|
| 27 |
+
|
| 28 |
+
# تنظیم فناوریهای اولیه
|
| 29 |
+
self.game_state.unlocked_technologies = self.tech_tree["starting_technologies"].copy()
|
| 30 |
+
|
| 31 |
+
# محاسبه سطح فناوری
|
| 32 |
+
self._calculate_technology_level()
|
| 33 |
+
|
| 34 |
+
def display_tech_tree(self):
|
| 35 |
+
"""نمایش درخت فناوری و پیشرفت فعلی"""
|
| 36 |
+
from ui.console_ui import ConsoleUI
|
| 37 |
+
|
| 38 |
+
ConsoleUI.clear_screen()
|
| 39 |
+
ConsoleUI.display_section_title("درخت فناوری")
|
| 40 |
+
|
| 41 |
+
# نمایش سطح فناوری کلی
|
| 42 |
+
ConsoleUI.display_message(f"سطح فناوری کلی: {self.game_state.technology_level}")
|
| 43 |
+
ConsoleUI.display_message(f"فناوری جاری در دست تحقیق: {self.current_research or 'هیچکدام'}")
|
| 44 |
+
ConsoleUI.display_message(f"پیشرفت تحقیق: {self.research_progress}%")
|
| 45 |
+
ConsoleUI.display_message(f"کارایی تحقیق: {self.research_efficiency:.1f}x")
|
| 46 |
+
|
| 47 |
+
# نمایش فناوریهای قابل تحقیق
|
| 48 |
+
ConsoleUI.display_section_title("فناوریهای قابل تحقیق")
|
| 49 |
+
|
| 50 |
+
available_techs = self.get_available_technologies()
|
| 51 |
+
if not available_techs:
|
| 52 |
+
ConsoleUI.display_message("هیچ فناوری جدیدی برای تحقیق در دسترس نیست.")
|
| 53 |
+
else:
|
| 54 |
+
for i, tech_id in enumerate(available_techs, 1):
|
| 55 |
+
tech = TECHNOLOGIES[tech_id]
|
| 56 |
+
cost = self.calculate_research_cost(tech_id)
|
| 57 |
+
ConsoleUI.display_message(f"{i}. {tech['name']} - هزینه: {cost} واحد تحقیق")
|
| 58 |
+
ConsoleUI.display_message(f" {tech['description']}")
|
| 59 |
+
|
| 60 |
+
ConsoleUI.wait_for_enter()
|
| 61 |
+
|
| 62 |
+
def get_available_technologies(self):
|
| 63 |
+
"""دریافت لیست فناوریهای قابل تحقیق"""
|
| 64 |
+
available = []
|
| 65 |
+
|
| 66 |
+
for tech_id, tech in TECHNOLOGIES.items():
|
| 67 |
+
# بررسی آنکه فناوری قبلاً تحقیق نشده باشد
|
| 68 |
+
if tech_id in self.game_state.unlocked_technologies:
|
| 69 |
+
continue
|
| 70 |
+
|
| 71 |
+
# بررسی پیشنیازها
|
| 72 |
+
if not self._check_technology_prerequisites(tech_id):
|
| 73 |
+
continue
|
| 74 |
+
|
| 75 |
+
available.append(tech_id)
|
| 76 |
+
|
| 77 |
+
return available
|
| 78 |
+
|
| 79 |
+
def _check_technology_prerequisites(self, tech_id):
|
| 80 |
+
"""بررسی پیشنیازهای فناوری"""
|
| 81 |
+
tech = TECHNOLOGIES[tech_id]
|
| 82 |
+
|
| 83 |
+
# بررسی پیشنیازهای فناوری
|
| 84 |
+
for prereq in tech.get("prerequisites", []):
|
| 85 |
+
if prereq not in self.game_state.unlocked_technologies:
|
| 86 |
+
return False
|
| 87 |
+
|
| 88 |
+
# بررسی پیشنیازهای سطح فناوری
|
| 89 |
+
if "tech_level_req" in tech and self.game_state.technology_level < tech["tech_level_req"]:
|
| 90 |
+
return False
|
| 91 |
+
|
| 92 |
+
return True
|
| 93 |
+
|
| 94 |
+
def conduct_research(self):
|
| 95 |
+
"""شروع یا ادامه تحقیق در یک فناوری"""
|
| 96 |
+
from ui.console_ui import ConsoleUI
|
| 97 |
+
|
| 98 |
+
available_techs = self.get_available_technologies()
|
| 99 |
+
|
| 100 |
+
if not available_techs:
|
| 101 |
+
ConsoleUI.display_warning("هیچ فناوری جدیدی برای تحقیق در دسترس نیست.")
|
| 102 |
+
ConsoleUI.wait_for_enter()
|
| 103 |
+
return
|
| 104 |
+
|
| 105 |
+
# نمایش گزینهها
|
| 106 |
+
tech_options = [TECHNOLOGIES[tech_id]["name"] for tech_id in available_techs]
|
| 107 |
+
tech_options.append("برگشت")
|
| 108 |
+
|
| 109 |
+
ConsoleUI.clear_screen()
|
| 110 |
+
ConsoleUI.display_section_title("تحقیق فناوری")
|
| 111 |
+
choice = ConsoleUI.get_menu_choice(tech_options)
|
| 112 |
+
|
| 113 |
+
if choice == len(tech_options):
|
| 114 |
+
return # برگشت
|
| 115 |
+
|
| 116 |
+
selected_tech = available_techs[choice-1]
|
| 117 |
+
self.start_research(selected_tech)
|
| 118 |
+
|
| 119 |
+
def start_research(self, tech_id):
|
| 120 |
+
"""شروع تحقیق در یک فناوری جدید"""
|
| 121 |
+
from ui.console_ui import ConsoleUI
|
| 122 |
+
|
| 123 |
+
tech = TECHNOLOGIES[tech_id]
|
| 124 |
+
cost = self.calculate_research_cost(tech_id)
|
| 125 |
+
|
| 126 |
+
# بررسی هزینه تحقیق
|
| 127 |
+
if self.game_state.gold < cost:
|
| 128 |
+
ConsoleUI.display_error(f"موجودی طلا کافی نیست! هزینه تحقیق: {cost} سکه")
|
| 129 |
+
ConsoleUI.wait_for_enter()
|
| 130 |
+
return
|
| 131 |
+
|
| 132 |
+
# کسر هزینه و شروع تحقیق
|
| 133 |
+
self.game_state.gold -= cost
|
| 134 |
+
self.current_research = tech_id
|
| 135 |
+
self.research_progress = 0
|
| 136 |
+
|
| 137 |
+
ConsoleUI.display_success(f"تحقیق در '{tech['name']}' آغاز شد.")
|
| 138 |
+
ConsoleUI.display_message(f"هزینه: {cost} سکه طلا")
|
| 139 |
+
ConsoleUI.display_message(f"شرح: {tech['description']}")
|
| 140 |
+
ConsoleUI.wait_for_enter()
|
| 141 |
+
|
| 142 |
+
def calculate_research_cost(self, tech_id):
|
| 143 |
+
"""محاسبه هزینه تحقیق برای یک فناوری"""
|
| 144 |
+
tech = TECHNOLOGIES[tech_id]
|
| 145 |
+
base_cost = tech["base_cost"]
|
| 146 |
+
|
| 147 |
+
# تأثیر سطح فناوری فعلی
|
| 148 |
+
level_factor = 1 + (self.game_state.technology_level * 0.1)
|
| 149 |
+
|
| 150 |
+
# تأثیر کارایی تحقیق
|
| 151 |
+
efficiency_factor = 1 / self.research_efficiency
|
| 152 |
+
|
| 153 |
+
# تأثیر سیاستهای آموزشی
|
| 154 |
+
education_factor = 1 - (self.game_state.budget["education"] * 0.01)
|
| 155 |
+
|
| 156 |
+
return int(base_cost * level_factor * efficiency_factor * education_factor)
|
| 157 |
+
|
| 158 |
+
def manage_research_centers(self):
|
| 159 |
+
"""مدیریت مراکز تحقیقاتی و افزایش کارایی تحقیق"""
|
| 160 |
+
from ui.console_ui import ConsoleUI
|
| 161 |
+
|
| 162 |
+
ConsoleUI.clear_screen()
|
| 163 |
+
ConsoleUI.display_section_title("مدیریت مراکز تحقیقاتی")
|
| 164 |
+
|
| 165 |
+
options = [
|
| 166 |
+
f"افزایش بودجه تحقیقات ({self.game_state.budget['education']}%)",
|
| 167 |
+
"ساخت مرکز تحقیقاتی جدید",
|
| 168 |
+
"همکاری تحقیقاتی با کشورهای دیگر",
|
| 169 |
+
"برگشت"
|
| 170 |
+
]
|
| 171 |
+
|
| 172 |
+
choice = ConsoleUI.get_menu_choice(options)
|
| 173 |
+
|
| 174 |
+
if choice == 1:
|
| 175 |
+
self.increase_research_budget()
|
| 176 |
+
elif choice == 2:
|
| 177 |
+
self.build_research_center()
|
| 178 |
+
elif choice == 3:
|
| 179 |
+
self.research_cooperation()
|
| 180 |
+
# choice == 4: برگشت
|
| 181 |
+
|
| 182 |
+
def increase_research_budget(self):
|
| 183 |
+
"""افزایش بودجه تحقیقات از طریق بودجه آموزش"""
|
| 184 |
+
from ui.console_ui import ConsoleUI
|
| 185 |
+
|
| 186 |
+
ConsoleUI.clear_screen()
|
| 187 |
+
ConsoleUI.display_section_title("افزایش بودجه تحقیقات")
|
| 188 |
+
|
| 189 |
+
# محاسبه هزینه و تأثیر
|
| 190 |
+
current_budget = self.game_state.budget["education"]
|
| 191 |
+
increase_amount = min(5, 100 - current_budget)
|
| 192 |
+
cost = increase_amount * 500
|
| 193 |
+
|
| 194 |
+
ConsoleUI.display_message(f"افزایش بودجه آموزش از {current_budget}% به {current_budget + increase_amount}%")
|
| 195 |
+
ConsoleUI.display_message(f"هزینه: {cost} سکه طلا")
|
| 196 |
+
ConsoleUI.display_message("تأثیرات:")
|
| 197 |
+
ConsoleUI.display_message("• کارایی تحقیق 0.1x افزایش مییابد")
|
| 198 |
+
ConsoleUI.display_message("• نرخ سواد 1% افزایش مییابد")
|
| 199 |
+
|
| 200 |
+
if not ConsoleUI.confirm_action("آیا مایل به انجام این تغییر هستید؟"):
|
| 201 |
+
return
|
| 202 |
+
|
| 203 |
+
# بررسی موجودی
|
| 204 |
+
if self.game_state.gold < cost:
|
| 205 |
+
ConsoleUI.display_error("موجودی طلا کافی نیست!")
|
| 206 |
+
ConsoleUI.wait_for_enter()
|
| 207 |
+
return
|
| 208 |
+
|
| 209 |
+
# اعمال تغییرات
|
| 210 |
+
self.game_state.gold -= cost
|
| 211 |
+
self.game_state.budget["education"] += increase_amount
|
| 212 |
+
self.research_efficiency += 0.1
|
| 213 |
+
self.game_state.literacy_rate = min(100, self.game_state.literacy_rate + 1)
|
| 214 |
+
|
| 215 |
+
ConsoleUI.display_success("بودجه آموزش افزایش یافت.")
|
| 216 |
+
ConsoleUI.wait_for_enter()
|
| 217 |
+
|
| 218 |
+
def build_research_center(self):
|
| 219 |
+
"""ساخت مرکز تحقیقاتی جدید"""
|
| 220 |
+
from ui.console_ui import ConsoleUI
|
| 221 |
+
|
| 222 |
+
cost = 10000
|
| 223 |
+
ConsoleUI.clear_screen()
|
| 224 |
+
ConsoleUI.display_section_title("ساخت مرکز تحقیقاتی")
|
| 225 |
+
|
| 226 |
+
ConsoleUI.display_message(f"هزینه: {cost} سکه طلا")
|
| 227 |
+
ConsoleUI.display_message("تأثیرات:")
|
| 228 |
+
ConsoleUI.display_message("• کارایی تحقیق 0.3x افزایش مییابد")
|
| 229 |
+
ConsoleUI.display_message("• هزینه تحقیقات 5% کاهش مییابد")
|
| 230 |
+
ConsoleUI.display_message("• هزینه نگهداری سالانه: 500 سکه")
|
| 231 |
+
|
| 232 |
+
if not ConsoleUI.confirm_action("آیا مایل به ساخت مرکز تحقیقاتی هستید؟"):
|
| 233 |
+
return
|
| 234 |
+
|
| 235 |
+
# بررسی موجودی
|
| 236 |
+
if self.game_state.gold < cost:
|
| 237 |
+
ConsoleUI.display_error("موجودی طلا کافی نیست!")
|
| 238 |
+
ConsoleUI.wait_for_enter()
|
| 239 |
+
return
|
| 240 |
+
|
| 241 |
+
# اعمال تغییرات
|
| 242 |
+
self.game_state.gold -= cost
|
| 243 |
+
self.research_efficiency += 0.3
|
| 244 |
+
self.game_state.budget["education"] += 2 # هزینه نگهداری
|
| 245 |
+
|
| 246 |
+
ConsoleUI.display_success("مرکز تحقیقاتی جدید ساخته شد.")
|
| 247 |
+
ConsoleUI.wait_for_enter()
|
| 248 |
+
|
| 249 |
+
def research_cooperation(self):
|
| 250 |
+
"""همکاری تحقیقاتی با کشورهای دیگر"""
|
| 251 |
+
from ui.console_ui import ConsoleUI
|
| 252 |
+
|
| 253 |
+
ConsoleUI.clear_screen()
|
| 254 |
+
ConsoleUI.display_section_title("همکاری تحقیقاتی")
|
| 255 |
+
|
| 256 |
+
# فیلتر کشورهایی که روابط خوبی داریم
|
| 257 |
+
potential_partners = []
|
| 258 |
+
for country, relation in self.game_state.relations.items():
|
| 259 |
+
if relation > 50 and country != self.game_state.player_country["name"]:
|
| 260 |
+
potential_partners.append(country)
|
| 261 |
+
|
| 262 |
+
if not potential_partners:
|
| 263 |
+
ConsoleUI.display_warning("هیچ کشوری برای همکاری تحقیقاتی در دسترس نیست.")
|
| 264 |
+
ConsoleUI.wait_for_enter()
|
| 265 |
+
return
|
| 266 |
+
|
| 267 |
+
# نمایش گزینهها
|
| 268 |
+
potential_partners.append("برگشت")
|
| 269 |
+
choice = ConsoleUI.get_menu_choice(potential_partners)
|
| 270 |
+
|
| 271 |
+
if choice == len(potential_partners):
|
| 272 |
+
return # برگشت
|
| 273 |
+
|
| 274 |
+
partner = potential_partners[choice-1]
|
| 275 |
+
cost = 5000
|
| 276 |
+
|
| 277 |
+
ConsoleUI.display_message(f"همکاری تحقیقاتی با {partner}")
|
| 278 |
+
ConsoleUI.display_message(f"هزینه: {cost} سکه طلا")
|
| 279 |
+
ConsoleUI.display_message("تأثیرات:")
|
| 280 |
+
ConsoleUI.display_message("• زمان تحقیق 20% کاهش مییابد")
|
| 281 |
+
ConsoleUI.display_message("• امکان دسترسی به فناوریهای پیشرفتهتر")
|
| 282 |
+
ConsoleUI.display_message("• روابط با {partner} 10 واحد افزایش مییابد")
|
| 283 |
+
|
| 284 |
+
if not ConsoleUI.confirm_action("آیا مایل به انجام همکاری تحقیقاتی هستید؟"):
|
| 285 |
+
return
|
| 286 |
+
|
| 287 |
+
# بررسی موجودی
|
| 288 |
+
if self.game_state.gold < cost:
|
| 289 |
+
ConsoleUI.display_error("موجودی طلا کافی نیست!")
|
| 290 |
+
ConsoleUI.wait_for_enter()
|
| 291 |
+
return
|
| 292 |
+
|
| 293 |
+
# اعمال تغییرات
|
| 294 |
+
self.game_state.gold -= cost
|
| 295 |
+
self.research_efficiency += 0.2
|
| 296 |
+
self.game_state.relations[partner] = min(100, self.game_state.relations[partner] + 10)
|
| 297 |
+
|
| 298 |
+
ConsoleUI.display_success(f"همکاری تحقیقاتی با {partner} برقرار شد.")
|
| 299 |
+
ConsoleUI.wait_for_enter()
|
| 300 |
+
|
| 301 |
+
def technology_cooperation(self):
|
| 302 |
+
"""همکاریهای فناوری پیشرفته"""
|
| 303 |
+
from ui.console_ui import ConsoleUI
|
| 304 |
+
|
| 305 |
+
ConsoleUI.clear_screen()
|
| 306 |
+
ConsoleUI.display_section_title("همکاریهای فناوری")
|
| 307 |
+
|
| 308 |
+
options = [
|
| 309 |
+
"تبادل فناوری با کشورهای متحد",
|
| 310 |
+
"شرکت در پروژههای فناوری جهانی",
|
| 311 |
+
"گسترش فناوری به کشورهای در حال توسعه",
|
| 312 |
+
"برگشت"
|
| 313 |
+
]
|
| 314 |
+
|
| 315 |
+
choice = ConsoleUI.get_menu_choice(options)
|
| 316 |
+
|
| 317 |
+
if choice == 1:
|
| 318 |
+
self.technology_exchange()
|
| 319 |
+
elif choice == 2:
|
| 320 |
+
self.global_technology_projects()
|
| 321 |
+
elif choice == 3:
|
| 322 |
+
self.technology_aid()
|
| 323 |
+
# choice == 4: برگشت
|
| 324 |
+
|
| 325 |
+
def technology_exchange(self):
|
| 326 |
+
"""تبادل فناوری با کشورهای متحد"""
|
| 327 |
+
from ui.console_ui import ConsoleUI
|
| 328 |
+
|
| 329 |
+
# فیلتر کشورهایی که اتحاد با آنها برقرار است
|
| 330 |
+
allies = [c for c, relation in self.game_state.relations.items()
|
| 331 |
+
if relation > 70 and c != self.game_state.player_country["name"]]
|
| 332 |
+
|
| 333 |
+
if not allies:
|
| 334 |
+
ConsoleUI.display_warning("هیچ متحدی برای تبادل فناوری وجود ندارد.")
|
| 335 |
+
ConsoleUI.wait_for_enter()
|
| 336 |
+
return
|
| 337 |
+
|
| 338 |
+
# نمایش گزینهها
|
| 339 |
+
allies.append("برگشت")
|
| 340 |
+
choice = ConsoleUI.get_menu_choice(allies)
|
| 341 |
+
|
| 342 |
+
if choice == len(allies):
|
| 343 |
+
return # برگشت
|
| 344 |
+
|
| 345 |
+
ally = allies[choice-1]
|
| 346 |
+
|
| 347 |
+
# انتخاب فناوری برای تبادل
|
| 348 |
+
available_techs = self.game_state.unlocked_technologies.copy()
|
| 349 |
+
available_techs.append("برگشت")
|
| 350 |
+
|
| 351 |
+
ConsoleUI.clear_screen()
|
| 352 |
+
ConsoleUI.display_section_title(f"انتخاب فناوری برای تبادل با {ally}")
|
| 353 |
+
tech_choice = ConsoleUI.get_menu_choice(available_techs)
|
| 354 |
+
|
| 355 |
+
if tech_choice == len(available_techs):
|
| 356 |
+
return # برگشت
|
| 357 |
+
|
| 358 |
+
tech_id = available_techs[tech_choice-1]
|
| 359 |
+
tech = TECHNOLOGIES[tech_id]
|
| 360 |
+
|
| 361 |
+
ConsoleUI.display_message(f"شما فناوری '{tech['name']}' را برای تبادل انتخاب کردید.")
|
| 362 |
+
ConsoleUI.display_message("در ازای آن، ممکن است فناوریهای جدیدی دریافت کنید.")
|
| 363 |
+
|
| 364 |
+
if ConsoleUI.confirm_action("آیا مایل به انجام تبادل فناوری هستید؟"):
|
| 365 |
+
# شبیهسازی تبادل فناوری
|
| 366 |
+
self._simulate_technology_exchange(ally, tech_id)
|
| 367 |
+
|
| 368 |
+
def _simulate_technology_exchange(self, ally, tech_id):
|
| 369 |
+
"""شبیهسازی تبادل فناوری با یک کشور متحد"""
|
| 370 |
+
from ui.console_ui import ConsoleUI
|
| 371 |
+
import random
|
| 372 |
+
|
| 373 |
+
# انتخاب تصادفی فناوریهای دریافتی
|
| 374 |
+
possible_techs = [t for t in TECHNOLOGIES.keys()
|
| 375 |
+
if t not in self.game_state.unlocked_technologies
|
| 376 |
+
and self._check_technology_prerequisites(t)]
|
| 377 |
+
|
| 378 |
+
if not possible_techs:
|
| 379 |
+
ConsoleUI.display_warning("هیچ فناوری جدیدی برای دریافت وجود ندارد.")
|
| 380 |
+
ConsoleUI.wait_for_enter()
|
| 381 |
+
return
|
| 382 |
+
|
| 383 |
+
received_techs = random.sample(possible_techs, min(2, len(possible_techs)))
|
| 384 |
+
|
| 385 |
+
# اعمال تغییرات
|
| 386 |
+
for tech_id in received_techs:
|
| 387 |
+
self.game_state.unlocked_technologies.append(tech_id)
|
| 388 |
+
|
| 389 |
+
# بهروزرسانی سطح فناوری
|
| 390 |
+
self._calculate_technology_level()
|
| 391 |
+
|
| 392 |
+
# نمایش نتایج
|
| 393 |
+
ConsoleUI.display_success(f"تبادل فناوری با {ally} موفقیتآمیز بود!")
|
| 394 |
+
ConsoleUI.display_message("فناوریهای دریافتی:")
|
| 395 |
+
for tech_id in received_techs:
|
| 396 |
+
tech = TECHNOLOGIES[tech_id]
|
| 397 |
+
ConsoleUI.display_message(f"• {tech['name']}: {tech['description']}")
|
| 398 |
+
|
| 399 |
+
ConsoleUI.wait_for_enter()
|
| 400 |
+
|
| 401 |
+
def global_technology_projects(self):
|
| 402 |
+
"""شرکت در پروژههای فناوری جهانی"""
|
| 403 |
+
from ui.console_ui import ConsoleUI
|
| 404 |
+
|
| 405 |
+
ConsoleUI.clear_screen()
|
| 406 |
+
ConsoleUI.display_section_title("پروژههای فناوری جهانی")
|
| 407 |
+
|
| 408 |
+
projects = [
|
| 409 |
+
{
|
| 410 |
+
"name": "شبکه جهانی اینترنت",
|
| 411 |
+
"description": "مشارکت در ایجاد زیرساختهای اینترنت جهانی",
|
| 412 |
+
"cost": 20000,
|
| 413 |
+
"effects": {
|
| 414 |
+
"technology": {"trade": 2, "education": 1},
|
| 415 |
+
"relations": {"+": 5},
|
| 416 |
+
"economy": {"trade": 10}
|
| 417 |
+
}
|
| 418 |
+
},
|
| 419 |
+
{
|
| 420 |
+
"name": "پروژه ژنوم انسان",
|
| 421 |
+
"description": "مشارکت در تحقیقات ژنتیک انسان",
|
| 422 |
+
"cost": 25000,
|
| 423 |
+
"effects": {
|
| 424 |
+
"technology": {"medicine": 3},
|
| 425 |
+
"health_index": 15,
|
| 426 |
+
"gold": -500 # هزینه نگهداری سالانه
|
| 427 |
+
}
|
| 428 |
+
},
|
| 429 |
+
{
|
| 430 |
+
"name": "برنامه فضایی جهانی",
|
| 431 |
+
"description": "مشارکت در برنامههای فضایی بینالمللی",
|
| 432 |
+
"cost": 30000,
|
| 433 |
+
"effects": {
|
| 434 |
+
"technology": {"military": 2, "industry": 2},
|
| 435 |
+
"political_stability": 10,
|
| 436 |
+
"prestige": 20
|
| 437 |
+
}
|
| 438 |
+
}
|
| 439 |
+
]
|
| 440 |
+
|
| 441 |
+
# نمایش پروژهها
|
| 442 |
+
project_names = [p["name"] for p in projects]
|
| 443 |
+
project_names.append("برگشت")
|
| 444 |
+
|
| 445 |
+
choice = ConsoleUI.get_menu_choice(project_names)
|
| 446 |
+
|
| 447 |
+
if choice == len(project_names):
|
| 448 |
+
return # برگشت
|
| 449 |
+
|
| 450 |
+
project = projects[choice-1]
|
| 451 |
+
|
| 452 |
+
ConsoleUI.display_message(f"پروژه: {project['name']}")
|
| 453 |
+
ConsoleUI.display_message(f"شرح: {project['description']}")
|
| 454 |
+
ConsoleUI.display_message(f"هزینه: {project['cost']} سکه طلا")
|
| 455 |
+
ConsoleUI.display_message("تأثیرات:")
|
| 456 |
+
|
| 457 |
+
# نمایش تأثیرات
|
| 458 |
+
for effect_type, values in project["effects"].items():
|
| 459 |
+
if effect_type == "technology":
|
| 460 |
+
for tech, value in values.items():
|
| 461 |
+
ConsoleUI.display_message(f"• فناوری {tech}: +{value}")
|
| 462 |
+
elif effect_type == "relations":
|
| 463 |
+
ConsoleUI.display_message(f"• روابط بینالمللی: +{values['+']}")
|
| 464 |
+
else:
|
| 465 |
+
ConsoleUI.display_message(f"• {effect_type}: +{values}")
|
| 466 |
+
|
| 467 |
+
if ConsoleUI.confirm_action("آیا مایل به شرکت در این پروژه هستید؟"):
|
| 468 |
+
self._join_global_project(project)
|
| 469 |
+
|
| 470 |
+
def _join_global_project(self, project):
|
| 471 |
+
"""شرکت در یک پروژه فناوری جهانی"""
|
| 472 |
+
from ui.console_ui import ConsoleUI
|
| 473 |
+
|
| 474 |
+
# بررسی موجودی
|
| 475 |
+
if self.game_state.gold < project["cost"]:
|
| 476 |
+
ConsoleUI.display_error("موجودی طلا کافی نیست!")
|
| 477 |
+
ConsoleUI.wait_for_enter()
|
| 478 |
+
return
|
| 479 |
+
|
| 480 |
+
# اعمال تغییرات
|
| 481 |
+
self.game_state.gold -= project["cost"]
|
| 482 |
+
|
| 483 |
+
# اعمال تأثیرات
|
| 484 |
+
for effect_type, values in project["effects"].items():
|
| 485 |
+
if effect_type == "technology":
|
| 486 |
+
for tech, value in values.items():
|
| 487 |
+
self.game_state.technology[tech] = min(10, self.game_state.technology[tech] + value)
|
| 488 |
+
elif effect_type == "relations":
|
| 489 |
+
for country in self.game_state.relations:
|
| 490 |
+
if country != self.game_state.player_country["name"]:
|
| 491 |
+
self.game_state.relations[country] = min(100, self.game_state.relations[country] + values["+"])
|
| 492 |
+
elif effect_type == "prestige":
|
| 493 |
+
# پرستیژ را در جایی ذخیره کنیم
|
| 494 |
+
if not hasattr(self.game_state, 'prestige'):
|
| 495 |
+
self.game_state.prestige = 0
|
| 496 |
+
self.game_state.prestige += values
|
| 497 |
+
else:
|
| 498 |
+
if effect_type in self.game_state:
|
| 499 |
+
self.game_state[effect_type] = min(100, self.game_state[effect_type] + values)
|
| 500 |
+
elif effect_type in self.game_state.economy:
|
| 501 |
+
self.game_state.economy[effect_type] = min(100, self.game_state.economy[effect_type] + values)
|
| 502 |
+
|
| 503 |
+
ConsoleUI.display_success(f"شما در پروژه '{project['name']}' شرکت کردید.")
|
| 504 |
+
ConsoleUI.wait_for_enter()
|
| 505 |
+
|
| 506 |
+
def technology_aid(self):
|
| 507 |
+
"""گسترش فناوری به کشورهای در حال توسعه"""
|
| 508 |
+
from ui.console_ui import ConsoleUI
|
| 509 |
+
|
| 510 |
+
ConsoleUI.clear_screen()
|
| 511 |
+
ConsoleUI.display_section_title("کمک فناوری به کشورهای در حال توسعه")
|
| 512 |
+
|
| 513 |
+
# فیلتر کشورهایی که روابط خوبی داریم و سطح فناوری پایینی دارند
|
| 514 |
+
potential_recipients = []
|
| 515 |
+
for country, relation in self.game_state.relations.items():
|
| 516 |
+
if relation > 30 and country != self.game_state.player_country["name"]:
|
| 517 |
+
# فرض میکنیم سطح فناوری کشورها را میدانیم
|
| 518 |
+
potential_recipients.append(country)
|
| 519 |
+
|
| 520 |
+
if not potential_recipients:
|
| 521 |
+
ConsoleUI.display_warning("هیچ کشوری برای کمک فناوری در دسترس نیست.")
|
| 522 |
+
ConsoleUI.wait_for_enter()
|
| 523 |
+
return
|
| 524 |
+
|
| 525 |
+
# نمایش گزینهها
|
| 526 |
+
potential_recipients.append("برگشت")
|
| 527 |
+
choice = ConsoleUI.get_menu_choice(potential_recipients)
|
| 528 |
+
|
| 529 |
+
if choice == len(potential_recipients):
|
| 530 |
+
return # برگشت
|
| 531 |
+
|
| 532 |
+
recipient = potential_recipients[choice-1]
|
| 533 |
+
|
| 534 |
+
# انتخاب نوع کمک
|
| 535 |
+
aid_types = [
|
| 536 |
+
"کمک آموزشی (افزایش نرخ سواد)",
|
| 537 |
+
"کمک صنعتی (افزایش سطح صنعت)",
|
| 538 |
+
"کمک بهداشتی (افزایش شاخص سلامت)",
|
| 539 |
+
"برگشت"
|
| 540 |
+
]
|
| 541 |
+
|
| 542 |
+
aid_choice = ConsoleUI.get_menu_choice(aid_types)
|
| 543 |
+
|
| 544 |
+
if aid_choice == 4:
|
| 545 |
+
return # برگشت
|
| 546 |
+
|
| 547 |
+
costs = [3000, 4000, 3500]
|
| 548 |
+
effects = [
|
| 549 |
+
{"literacy_rate": 5, "relations": {"+": 3}},
|
| 550 |
+
{"economy": {"industry": 5}, "relations": {"+": 4}},
|
| 551 |
+
{"health_index": 8, "relations": {"+": 5}}
|
| 552 |
+
]
|
| 553 |
+
|
| 554 |
+
cost = costs[aid_choice-1]
|
| 555 |
+
effect = effects[aid_choice-1]
|
| 556 |
+
|
| 557 |
+
ConsoleUI.display_message(f"کمک فناوری به {recipient}")
|
| 558 |
+
ConsoleUI.display_message(f"نوع کمک: {aid_types[aid_choice-1]}")
|
| 559 |
+
ConsoleUI.display_message(f"هزینه: {cost} سکه طلا")
|
| 560 |
+
ConsoleUI.display_message("تأثیرات:")
|
| 561 |
+
|
| 562 |
+
# نمایش تأثیرات
|
| 563 |
+
for effect_type, value in effect.items():
|
| 564 |
+
if effect_type == "relations":
|
| 565 |
+
ConsoleUI.display_message(f"• روابط با {recipient}: +{value['+']}")
|
| 566 |
+
elif effect_type == "economy":
|
| 567 |
+
for sector, val in value.items():
|
| 568 |
+
ConsoleUI.display_message(f"• اقتصاد {sector}: +{val}")
|
| 569 |
+
else:
|
| 570 |
+
ConsoleUI.display_message(f"• {effect_type}: +{value}")
|
| 571 |
+
|
| 572 |
+
if ConsoleUI.confirm_action("آیا مایل به انجام این کمک فناوری هستید؟"):
|
| 573 |
+
self._provide_technology_aid(recipient, effect, cost)
|
| 574 |
+
|
| 575 |
+
def _provide_technology_aid(self, recipient, effect, cost):
|
| 576 |
+
"""ارائه کمک فناوری به یک کشور"""
|
| 577 |
+
from ui.console_ui import ConsoleUI
|
| 578 |
+
|
| 579 |
+
# بررسی موجودی
|
| 580 |
+
if self.game_state.gold < cost:
|
| 581 |
+
ConsoleUI.display_error("موجودی طلا کافی نیست!")
|
| 582 |
+
ConsoleUI.wait_for_enter()
|
| 583 |
+
return
|
| 584 |
+
|
| 585 |
+
# اعمال تغییرات
|
| 586 |
+
self.game_state.gold -= cost
|
| 587 |
+
|
| 588 |
+
# اعمال تأثیرات
|
| 589 |
+
for effect_type, value in effect.items():
|
| 590 |
+
if effect_type == "relations":
|
| 591 |
+
self.game_state.relations[recipient] = min(100, self.game_state.relations[recipient] + value["+"])
|
| 592 |
+
elif effect_type == "economy":
|
| 593 |
+
for sector, val in value.items():
|
| 594 |
+
# فرض میکنیم کشور گیرنده اطلاعات اقتصادی دارد
|
| 595 |
+
pass # در واقعیت، باید اطلاعات کشور گیرنده را بهروز کنیم
|
| 596 |
+
else:
|
| 597 |
+
if effect_type == "literacy_rate":
|
| 598 |
+
self.game_state.literacy_rate = min(100, self.game_state.literacy_rate + value)
|
| 599 |
+
elif effect_type == "health_index":
|
| 600 |
+
self.game_state.health_index = min(100, self.game_state.health_index + value)
|
| 601 |
+
|
| 602 |
+
ConsoleUI.display_success(f"کمک فناوری به {recipient} ارسال شد.")
|
| 603 |
+
ConsoleUI.wait_for_enter()
|
| 604 |
+
|
| 605 |
+
def annual_update(self):
|
| 606 |
+
"""بهروزرسانیهای سالانه سیستم تحقیق"""
|
| 607 |
+
# ادامه تحقیق جاری
|
| 608 |
+
if self.current_research:
|
| 609 |
+
research_speed = self._calculate_research_speed()
|
| 610 |
+
self.research_progress += research_speed
|
| 611 |
+
|
| 612 |
+
# بررسی تکمیل تحقیق
|
| 613 |
+
if self.research_progress >= 100:
|
| 614 |
+
self._complete_research()
|
| 615 |
+
|
| 616 |
+
def _calculate_research_speed(self):
|
| 617 |
+
"""محاسبه سرعت تحقیق فعلی"""
|
| 618 |
+
base_speed = 5
|
| 619 |
+
|
| 620 |
+
# تأثیر کارایی تحقیق
|
| 621 |
+
speed = base_speed * self.research_efficiency
|
| 622 |
+
|
| 623 |
+
# تأثیر بودجه آموزش
|
| 624 |
+
speed *= (1 + self.game_state.budget["education"] * 0.01)
|
| 625 |
+
|
| 626 |
+
# تأثیر مراکز تحقیقاتی
|
| 627 |
+
if "Research Centers" in self.game_state.unlocked_technologies:
|
| 628 |
+
speed *= 1.2
|
| 629 |
+
|
| 630 |
+
return speed
|
| 631 |
+
|
| 632 |
+
def _complete_research(self):
|
| 633 |
+
"""تکمیل تحقیق و اعمال اثرات فناوری"""
|
| 634 |
+
from ui.console_ui import ConsoleUI
|
| 635 |
+
|
| 636 |
+
tech = TECHNOLOGIES[self.current_research]
|
| 637 |
+
|
| 638 |
+
# اضافه کردن فناوری به لیست فناوریهای آشکار شده
|
| 639 |
+
self.game_state.unlocked_technologies.append(self.current_research)
|
| 640 |
+
|
| 641 |
+
# اعمال اثرات فناوری
|
| 642 |
+
self._apply_technology_effects(tech)
|
| 643 |
+
|
| 644 |
+
# محاسبه مجدد سطح فناوری
|
| 645 |
+
self._calculate_technology_level()
|
| 646 |
+
|
| 647 |
+
# نمایش پیام تکمیل تحقیق
|
| 648 |
+
ConsoleUI.display_success(f"تحقیق در '{tech['name']}' کامل شد!")
|
| 649 |
+
ConsoleUI.display_message(f"شرح: {tech['description']}")
|
| 650 |
+
|
| 651 |
+
# نمایش اثرات
|
| 652 |
+
ConsoleUI.display_section_title("اثرات فناوری")
|
| 653 |
+
for effect_type, value in tech["effects"].items():
|
| 654 |
+
if effect_type == "technology":
|
| 655 |
+
for tech_field, val in value.items():
|
| 656 |
+
ConsoleUI.display_message(f"• فناوری {tech_field}: +{val}")
|
| 657 |
+
elif effect_type == "economy":
|
| 658 |
+
for sector, val in value.items():
|
| 659 |
+
ConsoleUI.display_message(f"• اقتصاد {sector}: +{val}")
|
| 660 |
+
else:
|
| 661 |
+
ConsoleUI.display_message(f"• {effect_type}: +{value}")
|
| 662 |
+
|
| 663 |
+
ConsoleUI.wait_for_enter()
|
| 664 |
+
|
| 665 |
+
# ریست تحقیق جاری
|
| 666 |
+
self.current_research = None
|
| 667 |
+
self.research_progress = 0
|
| 668 |
+
|
| 669 |
+
def _apply_technology_effects(self, tech):
|
| 670 |
+
"""اعمال اثرات یک فناوری به وضعیت بازی"""
|
| 671 |
+
for effect_type, value in tech["effects"].items():
|
| 672 |
+
if effect_type == "technology":
|
| 673 |
+
for tech_field, val in value.items():
|
| 674 |
+
self.game_state.technology[tech_field] = min(10, self.game_state.technology[tech_field] + val)
|
| 675 |
+
elif effect_type == "economy":
|
| 676 |
+
for sector, val in value.items():
|
| 677 |
+
self.game_state.economy[sector] = min(100, self.game_state.economy[sector] + val)
|
| 678 |
+
elif effect_type == "military":
|
| 679 |
+
self.game_state.military_strength = min(100, self.game_state.military_strength + value)
|
| 680 |
+
elif effect_type == "culture":
|
| 681 |
+
self.game_state.culture_score = min(100, self.game_state.culture_score + value)
|
| 682 |
+
elif effect_type == "religion":
|
| 683 |
+
self.game_state.religious_influence = min(100, self.game_state.religious_influence + value)
|
| 684 |
+
elif effect_type == "population":
|
| 685 |
+
self.game_state.population = int(self.game_state.population * (1 + value/100))
|
| 686 |
+
elif effect_type == "environment":
|
| 687 |
+
for factor, val in value.items():
|
| 688 |
+
self.game_state.environment[factor] = max(0, min(100, self.game_state.environment[factor] + val))
|
| 689 |
+
|
| 690 |
+
def _calculate_technology_level(self):
|
| 691 |
+
"""محاسبه سطح فناوری کلی بر اساس فناوریهای آشکار شده"""
|
| 692 |
+
total_level = 0
|
| 693 |
+
count = 0
|
| 694 |
+
|
| 695 |
+
for tech_id in self.game_state.unlocked_technologies:
|
| 696 |
+
tech = TECHNOLOGIES[tech_id]
|
| 697 |
+
total_level += tech.get("level", 1)
|
| 698 |
+
count += 1
|
| 699 |
+
|
| 700 |
+
self.game_state.technology_level = total_level // count if count > 0 else 1
|
Shadows_of_Empires/main.py
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
فایل اصلی برای راهاندازی بازی "سایههای امپراتوری"
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
import sys
|
| 7 |
+
import os
|
| 8 |
+
import logging
|
| 9 |
+
from datetime import datetime
|
| 10 |
+
|
| 11 |
+
# اضافه کردن مسیر جاری به سیستم
|
| 12 |
+
current_dir = os.path.dirname(os.path.abspath(__file__))
|
| 13 |
+
sys.path.insert(0, current_dir)
|
| 14 |
+
|
| 15 |
+
from game.game import EmpireGame
|
| 16 |
+
from plugins.plugin_manager import PluginManager
|
| 17 |
+
from ui.console_ui import ConsoleUI
|
| 18 |
+
from utils.logger import setup_logger
|
| 19 |
+
from config import ADVANCED_CONFIG
|
| 20 |
+
|
| 21 |
+
def main():
|
| 22 |
+
"""تابع اصلی برای راهاندازی بازی"""
|
| 23 |
+
# راهاندازی سیستم لاگ
|
| 24 |
+
logger = setup_logger()
|
| 25 |
+
logger.info("شروع بازی 'سایههای امپراتوری'")
|
| 26 |
+
|
| 27 |
+
try:
|
| 28 |
+
# نمایش صفحه اصلی
|
| 29 |
+
ConsoleUI.display_title_screen()
|
| 30 |
+
|
| 31 |
+
# راهاندازی مدیر پلاگینها
|
| 32 |
+
plugin_manager = PluginManager()
|
| 33 |
+
plugin_manager.load_plugins()
|
| 34 |
+
logger.info(f"{len(plugin_manager.plugins)} پلاگین بارگیری شد")
|
| 35 |
+
|
| 36 |
+
# ایجاد نمونه بازی
|
| 37 |
+
game = EmpireGame()
|
| 38 |
+
|
| 39 |
+
# اعمال پلاگینها به بازی
|
| 40 |
+
for plugin in plugin_manager.plugins:
|
| 41 |
+
plugin.apply(game)
|
| 42 |
+
logger.info(f"پلاگین '{plugin.name}' به بازی اعمال شد")
|
| 43 |
+
|
| 44 |
+
# شروع بازی
|
| 45 |
+
game.start()
|
| 46 |
+
|
| 47 |
+
except Exception as e:
|
| 48 |
+
logger.exception("خطای غیرمنتظره در حین اجرای بازی")
|
| 49 |
+
ConsoleUI.display_error(f"خطای جدی رخ داد: {str(e)}")
|
| 50 |
+
sys.exit(1)
|
| 51 |
+
|
| 52 |
+
if __name__ == "__main__":
|
| 53 |
+
main()
|
Shadows_of_Empires/plugins/advanced_diplomacy_plugin.py
ADDED
|
@@ -0,0 +1,395 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
پلاگین دیپلماسی پیشرفته برای افزودن سیستمهای دیپلماسی پیچیدهتر
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
from plugins.base_plugin import BasePlugin
|
| 6 |
+
from data.events.event_definitions import EVENTS
|
| 7 |
+
|
| 8 |
+
class AdvancedDiplomacyPlugin(BasePlugin):
|
| 9 |
+
"""پلاگین برای گسترش سیستم دیپلماسی"""
|
| 10 |
+
|
| 11 |
+
def __init__(self):
|
| 12 |
+
"""ساخت یک نمونه جدید از پلاگین"""
|
| 13 |
+
super().__init__()
|
| 14 |
+
self.name = "دیپلماسی پیشرفته"
|
| 15 |
+
self.description = "سیستم دیپلماسی پیچیدهتر با امکانات بیشتر و سازمانهای بینالمللی"
|
| 16 |
+
self.version = "2.0.0"
|
| 17 |
+
self.compatible_versions = ["1.0.0"]
|
| 18 |
+
|
| 19 |
+
def apply(self, game):
|
| 20 |
+
"""
|
| 21 |
+
اعمال پلاگین به بازی
|
| 22 |
+
|
| 23 |
+
:param game: نمونه بازی که پلاگین باید به آن اعمال شود
|
| 24 |
+
"""
|
| 25 |
+
# افزودن ویژگیهای جدید به وضعیت بازی
|
| 26 |
+
if not hasattr(game.game_state, 'diplomacy_relations'):
|
| 27 |
+
game.game_state.diplomacy_relations = {}
|
| 28 |
+
|
| 29 |
+
if not hasattr(game.game_state, 'international_orgs'):
|
| 30 |
+
game.game_state.international_orgs = []
|
| 31 |
+
|
| 32 |
+
# افزودن رویدادهای جدید
|
| 33 |
+
self._add_diplomatic_events()
|
| 34 |
+
|
| 35 |
+
# افزودن روشهای جدید به سیستم دیپلماسی
|
| 36 |
+
self._extend_diplomacy_system(game)
|
| 37 |
+
|
| 38 |
+
# افزودن سازمانهای بینالمللی
|
| 39 |
+
self._add_international_organizations(game)
|
| 40 |
+
|
| 41 |
+
print(f"{self.name} با موفقیت اعمال شد.")
|
| 42 |
+
|
| 43 |
+
def _add_diplomatic_events(self):
|
| 44 |
+
"""افزودن رویدادهای دیپلماتیک جدید"""
|
| 45 |
+
new_events = [
|
| 46 |
+
{
|
| 47 |
+
"id": 100,
|
| 48 |
+
"name": "جنگ سایبری",
|
| 49 |
+
"description": "یک کشور دشمن اقدام به حمله سایبری به سیستمهای کشور شما کرده است.",
|
| 50 |
+
"trigger": lambda state: state.diplomacy_points > 15,
|
| 51 |
+
"choices": [
|
| 52 |
+
{
|
| 53 |
+
"text": "پاسخ سریع با تیم سایبری",
|
| 54 |
+
"effects": {
|
| 55 |
+
"gold": -3000,
|
| 56 |
+
"diplomacy_points": -5,
|
| 57 |
+
"political_stability": 5,
|
| 58 |
+
"technology": {"military": 1}
|
| 59 |
+
},
|
| 60 |
+
"description": "استفاده از تیم متخصص برای مقابله با حمله سایبری."
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"text": "مذاکره برای پایان دادن به تنشها",
|
| 64 |
+
"effects": {
|
| 65 |
+
"gold": -1000,
|
| 66 |
+
"diplomacy_points": -3,
|
| 67 |
+
"relations": {"+": 10},
|
| 68 |
+
"political_stability": 3
|
| 69 |
+
},
|
| 70 |
+
"description": "مذاکره برای کاهش تنشهای سایبری."
|
| 71 |
+
}
|
| 72 |
+
]
|
| 73 |
+
},
|
| 74 |
+
{
|
| 75 |
+
"id": 101,
|
| 76 |
+
"name": "بحران دیپلماتیک",
|
| 77 |
+
"description": "یک اشتباه دیپلماتیک باعث ایجاد تنش شدید با یک کشور متحد شده است.",
|
| 78 |
+
"trigger": lambda state: max(state.relations.values()) > 80 and min(state.relations.values()) < -40,
|
| 79 |
+
"choices": [
|
| 80 |
+
{
|
| 81 |
+
"text": "اصلاح فوری اشتباه",
|
| 82 |
+
"effects": {
|
| 83 |
+
"gold": -2000,
|
| 84 |
+
"relations": {"-": 15},
|
| 85 |
+
"diplomacy_points": 5
|
| 86 |
+
},
|
| 87 |
+
"description": "پرداخت غرامت و اصلاح فوری اشتباه دیپلماتیک."
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
"text": "اصرار بر مواضع فعلی",
|
| 91 |
+
"effects": {
|
| 92 |
+
"relations": {"-": 30},
|
| 93 |
+
"political_stability": -10
|
| 94 |
+
},
|
| 95 |
+
"description": "اصرار بر مواضع فعلی با خطر از دست دادن متحد."
|
| 96 |
+
}
|
| 97 |
+
]
|
| 98 |
+
}
|
| 99 |
+
]
|
| 100 |
+
|
| 101 |
+
# اضافه کردن رویدادها به لیست رویدادها
|
| 102 |
+
for event in new_events:
|
| 103 |
+
if event not in EVENTS:
|
| 104 |
+
EVENTS.append(event)
|
| 105 |
+
|
| 106 |
+
def _extend_diplomacy_system(self, game):
|
| 107 |
+
"""گسترش سیستم دیپلماسی با روشهای جدید"""
|
| 108 |
+
# افزودن روش برای پیوستن به سازمانهای بینالمللی
|
| 109 |
+
def join_international_orgs(self):
|
| 110 |
+
"""عضویت در سازمانهای بینالمللی"""
|
| 111 |
+
from ui.console_ui import ConsoleUI
|
| 112 |
+
|
| 113 |
+
ConsoleUI.clear_screen()
|
| 114 |
+
ConsoleUI.display_section_title("سازمانهای بینالمللی")
|
| 115 |
+
|
| 116 |
+
# لیست سازمانهای موجود
|
| 117 |
+
orgs = [
|
| 118 |
+
"سازمان ملل متحد (UN)",
|
| 119 |
+
"سازمان تجارت جهانی (WTO)",
|
| 120 |
+
"سازمان بهداشت جهانی (WHO)",
|
| 121 |
+
"سازمان نفت (OPEC)",
|
| 122 |
+
"سازمان کشورهای صادرکننده نفت",
|
| 123 |
+
"ناتو (NATO)"
|
| 124 |
+
]
|
| 125 |
+
|
| 126 |
+
# نمایش گزینهها
|
| 127 |
+
orgs.append("برگشت")
|
| 128 |
+
choice = ConsoleUI.get_menu_choice(orgs)
|
| 129 |
+
|
| 130 |
+
if choice == len(orgs):
|
| 131 |
+
return # برگشت
|
| 132 |
+
|
| 133 |
+
org = orgs[choice-1]
|
| 134 |
+
|
| 135 |
+
# محاسبه هزینه و تأثیرات
|
| 136 |
+
costs = {
|
| 137 |
+
"سازمان ملل متحد (UN)": 5000,
|
| 138 |
+
"سازمان تجارت جهانی (WTO)": 8000,
|
| 139 |
+
"سازمان بهداشت جهانی (WHO)": 6000,
|
| 140 |
+
"سازمان نفت (OPEC)": 10000,
|
| 141 |
+
"سازمان کشورهای صادرکننده نفت": 9000,
|
| 142 |
+
"ناتو (NATO)": 12000
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
effects = {
|
| 146 |
+
"سازمان ملل متحد (UN)": {
|
| 147 |
+
"relations": {"+": 10},
|
| 148 |
+
"political_stability": 5,
|
| 149 |
+
"diplomacy_points": 10
|
| 150 |
+
},
|
| 151 |
+
"سازمان تجارت جهانی (WTO)": {
|
| 152 |
+
"economy": {"trade": 15},
|
| 153 |
+
"gold": -500 # هزینه نگهداری سالانه
|
| 154 |
+
},
|
| 155 |
+
"سازمان بهداشت جهانی (WHO)": {
|
| 156 |
+
"health_index": 10,
|
| 157 |
+
"relations": {"+": 5}
|
| 158 |
+
},
|
| 159 |
+
"سازمان نفت (OPEC)": {
|
| 160 |
+
"resources": {"oil": 20},
|
| 161 |
+
"economy": {"industry": 10}
|
| 162 |
+
},
|
| 163 |
+
"سازمان کشورهای صادرکننده نفت": {
|
| 164 |
+
"resources": {"oil": 25},
|
| 165 |
+
"relations": {"+": 15}
|
| 166 |
+
},
|
| 167 |
+
"ناتو (NATO)": {
|
| 168 |
+
"military_strength": 20,
|
| 169 |
+
"relations": {"+": 25}
|
| 170 |
+
}
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
cost = costs[org]
|
| 174 |
+
effect = effects[org]
|
| 175 |
+
|
| 176 |
+
ConsoleUI.display_message(f"عضویت در {org}")
|
| 177 |
+
ConsoleUI.display_message(f"هزینه: {cost} سکه طلا")
|
| 178 |
+
ConsoleUI.display_message("تأثیرات:")
|
| 179 |
+
|
| 180 |
+
# نمایش تأثیرات
|
| 181 |
+
for effect_type, value in effect.items():
|
| 182 |
+
if effect_type == "relations":
|
| 183 |
+
ConsoleUI.display_message(f"• روابط بینالمللی: +{value['+']}")
|
| 184 |
+
elif effect_type == "economy":
|
| 185 |
+
for sector, val in value.items():
|
| 186 |
+
ConsoleUI.display_message(f"• اقتصاد {sector}: +{val}")
|
| 187 |
+
elif effect_type == "resources":
|
| 188 |
+
for resource, val in value.items():
|
| 189 |
+
ConsoleUI.display_message(f"• منابع {resource}: +{val}")
|
| 190 |
+
else:
|
| 191 |
+
ConsoleUI.display_message(f"• {effect_type}: +{value}")
|
| 192 |
+
|
| 193 |
+
if ConsoleUI.confirm_action("آیا مایل به عضویت در این سازمان هستید؟"):
|
| 194 |
+
self._join_organization(org, cost, effect)
|
| 195 |
+
|
| 196 |
+
# افزودن روش به سیستم دیپلماسی
|
| 197 |
+
from game.diplomacy.diplomacy_system import DiplomacySystem
|
| 198 |
+
DiplomacySystem.join_international_orgs = join_international_orgs
|
| 199 |
+
|
| 200 |
+
# افزودن روش برای مذاکره پیشرفته
|
| 201 |
+
def advanced_negotiation(self):
|
| 202 |
+
"""مذاکره پیشرفته با کشورهای دیگر"""
|
| 203 |
+
from ui.console_ui import ConsoleUI
|
| 204 |
+
|
| 205 |
+
ConsoleUI.clear_screen()
|
| 206 |
+
ConsoleUI.display_section_title("مذاکره پیشرفته")
|
| 207 |
+
|
| 208 |
+
# فیلتر کشورهایی که روابط خوبی داریم
|
| 209 |
+
potential_partners = []
|
| 210 |
+
for country, relation in self.game_state.relations.items():
|
| 211 |
+
if 20 < relation < 80 and country != self.game_state.player_country["name"]:
|
| 212 |
+
potential_partners.append(country)
|
| 213 |
+
|
| 214 |
+
if not potential_partners:
|
| 215 |
+
ConsoleUI.display_warning("هیچ کشوری برای مذاکره پیشرفته در دسترس نیست.")
|
| 216 |
+
ConsoleUI.wait_for_enter()
|
| 217 |
+
return
|
| 218 |
+
|
| 219 |
+
# نمایش گزینهها
|
| 220 |
+
potential_partners.append("برگشت")
|
| 221 |
+
choice = ConsoleUI.get_menu_choice(potential_partners)
|
| 222 |
+
|
| 223 |
+
if choice == len(potential_partners):
|
| 224 |
+
return # برگشت
|
| 225 |
+
|
| 226 |
+
partner = potential_partners[choice-1]
|
| 227 |
+
|
| 228 |
+
# انتخاب نوع مذاکره
|
| 229 |
+
negotiation_types = [
|
| 230 |
+
"مذاکره برای اتحاد نظامی",
|
| 231 |
+
"مذاکره برای پیمان تجاری",
|
| 232 |
+
"مذاکره برای همکاری فناوری",
|
| 233 |
+
"برگشت"
|
| 234 |
+
]
|
| 235 |
+
|
| 236 |
+
neg_choice = ConsoleUI.get_menu_choice(negotiation_types)
|
| 237 |
+
|
| 238 |
+
if neg_choice == 4:
|
| 239 |
+
return # برگشت
|
| 240 |
+
|
| 241 |
+
# محاسبه هزینه و تأثیرات
|
| 242 |
+
costs = [7000, 5000, 6000]
|
| 243 |
+
effects = [
|
| 244 |
+
{"military_strength": 15, "relations": {"+": 20}},
|
| 245 |
+
{"economy": {"trade": 15}, "relations": {"+": 15}},
|
| 246 |
+
{"technology": {"trade": 1}, "relations": {"+": 10}}
|
| 247 |
+
]
|
| 248 |
+
|
| 249 |
+
cost = costs[neg_choice-1]
|
| 250 |
+
effect = effects[neg_choice-1]
|
| 251 |
+
|
| 252 |
+
ConsoleUI.display_message(f"مذاکره با {partner} برای {negotiation_types[neg_choice-1]}")
|
| 253 |
+
ConsoleUI.display_message(f"هزینه: {cost} سکه طلا")
|
| 254 |
+
ConsoleUI.display_message("تأثیرات:")
|
| 255 |
+
|
| 256 |
+
# نمایش تأثیرات
|
| 257 |
+
for effect_type, value in effect.items():
|
| 258 |
+
if effect_type == "relations":
|
| 259 |
+
ConsoleUI.display_message(f"• روابط با {partner}: +{value['+']}")
|
| 260 |
+
elif effect_type == "economy":
|
| 261 |
+
for sector, val in value.items():
|
| 262 |
+
ConsoleUI.display_message(f"• اقتصاد {sector}: +{val}")
|
| 263 |
+
elif effect_type == "technology":
|
| 264 |
+
for tech, val in value.items():
|
| 265 |
+
ConsoleUI.display_message(f"• فناوری {tech}: +{val}")
|
| 266 |
+
else:
|
| 267 |
+
ConsoleUI.display_message(f"• {effect_type}: +{value}")
|
| 268 |
+
|
| 269 |
+
if ConsoleUI.confirm_action("آیا مایل به انجام این مذاکره هستید؟"):
|
| 270 |
+
self._perform_advanced_negotiation(partner, cost, effect)
|
| 271 |
+
|
| 272 |
+
# افزودن روش به سیستم دیپلماسی
|
| 273 |
+
DiplomacySystem.advanced_negotiation = advanced_negotiation
|
| 274 |
+
|
| 275 |
+
def _join_organization(self, org, cost, effect):
|
| 276 |
+
"""عضویت در یک سازمان بینالمللی"""
|
| 277 |
+
from ui.console_ui import ConsoleUI
|
| 278 |
+
|
| 279 |
+
# بررسی موجودی
|
| 280 |
+
if self.game_state.gold < cost:
|
| 281 |
+
ConsoleUI.display_error("موجودی طلا کافی نیست!")
|
| 282 |
+
ConsoleUI.wait_for_enter()
|
| 283 |
+
return
|
| 284 |
+
|
| 285 |
+
# اعمال تغییرات
|
| 286 |
+
self.game_state.gold -= cost
|
| 287 |
+
self.game_state.international_orgs.append(org)
|
| 288 |
+
|
| 289 |
+
# اعمال تأثیرات
|
| 290 |
+
for effect_type, value in effect.items():
|
| 291 |
+
if effect_type == "relations":
|
| 292 |
+
for country in self.game_state.relations:
|
| 293 |
+
if country != self.game_state.player_country["name"]:
|
| 294 |
+
self.game_state.relations[country] = min(100, self.game_state.relations[country] + value["+"])
|
| 295 |
+
elif effect_type == "economy":
|
| 296 |
+
for sector, val in value.items():
|
| 297 |
+
self.game_state.economy[sector] = min(100, self.game_state.economy[sector] + val)
|
| 298 |
+
elif effect_type == "resources":
|
| 299 |
+
for resource, val in value.items():
|
| 300 |
+
self.game_state.resources[resource] = min(100, self.game_state.resources[resource] + val)
|
| 301 |
+
else:
|
| 302 |
+
if effect_type in self.game_state:
|
| 303 |
+
self.game_state[effect_type] = min(100, self.game_state[effect_type] + value)
|
| 304 |
+
elif effect_type in self.game_state.economy:
|
| 305 |
+
self.game_state.economy[effect_type] = min(100, self.game_state.economy[effect_type] + value)
|
| 306 |
+
|
| 307 |
+
ConsoleUI.display_success(f"شما عضو {org} شدید.")
|
| 308 |
+
ConsoleUI.wait_for_enter()
|
| 309 |
+
|
| 310 |
+
def _perform_advanced_negotiation(self, partner, cost, effect):
|
| 311 |
+
"""انجام مذاکره پیشرفته با یک کشور"""
|
| 312 |
+
from ui.console_ui import ConsoleUI
|
| 313 |
+
|
| 314 |
+
# بررسی موجودی
|
| 315 |
+
if self.game_state.gold < cost:
|
| 316 |
+
ConsoleUI.display_error("موجودی طلا کافی نیست!")
|
| 317 |
+
ConsoleUI.wait_for_enter()
|
| 318 |
+
return
|
| 319 |
+
|
| 320 |
+
# اعمال تغییرات
|
| 321 |
+
self.game_state.gold -= cost
|
| 322 |
+
|
| 323 |
+
# اعمال تأثیرات
|
| 324 |
+
for effect_type, value in effect.items():
|
| 325 |
+
if effect_type == "relations":
|
| 326 |
+
self.game_state.relations[partner] = min(100, self.game_state.relations[partner] + value["+"])
|
| 327 |
+
elif effect_type == "economy":
|
| 328 |
+
for sector, val in value.items():
|
| 329 |
+
self.game_state.economy[sector] = min(100, self.game_state.economy[sector] + val)
|
| 330 |
+
elif effect_type == "technology":
|
| 331 |
+
for tech, val in value.items():
|
| 332 |
+
self.game_state.technology[tech] = min(10, self.game_state.technology[tech] + val)
|
| 333 |
+
else:
|
| 334 |
+
if effect_type in self.game_state:
|
| 335 |
+
self.game_state[effect_type] = min(100, self.game_state[effect_type] + value)
|
| 336 |
+
elif effect_type in self.game_state.economy:
|
| 337 |
+
self.game_state.economy[effect_type] = min(100, self.game_state.economy[effect_type] + value)
|
| 338 |
+
|
| 339 |
+
ConsoleUI.display_success(f"مذاکره با {partner} موفقیتآمیز بود.")
|
| 340 |
+
ConsoleUI.wait_for_enter()
|
| 341 |
+
|
| 342 |
+
def _add_international_organizations(self, game):
|
| 343 |
+
"""افزودن سازمانهای بینالمللی به بازی"""
|
| 344 |
+
# افزودن سازمانها به وضعیت بازی
|
| 345 |
+
game.game_state.international_orgs = []
|
| 346 |
+
|
| 347 |
+
# افزودن روش برای نمایش سازمانها
|
| 348 |
+
def display_international_orgs(self):
|
| 349 |
+
"""نمایش سازمانهای بینالمللی عضو شده"""
|
| 350 |
+
from ui.console_ui import ConsoleUI
|
| 351 |
+
|
| 352 |
+
ConsoleUI.clear_screen()
|
| 353 |
+
ConsoleUI.display_section_title("سازمانهای بینالمللی")
|
| 354 |
+
|
| 355 |
+
if not self.game_state.international_orgs:
|
| 356 |
+
ConsoleUI.display_message("شما عضو هیچ سازمان بینالمللی نیستید.", indent=2)
|
| 357 |
+
else:
|
| 358 |
+
ConsoleUI.display_message("شما عضو سازمانهای زیر هستید:", indent=2)
|
| 359 |
+
for org in self.game_state.international_orgs:
|
| 360 |
+
ConsoleUI.display_message(f"• {org}", indent=4)
|
| 361 |
+
|
| 362 |
+
ConsoleUI.wait_for_enter()
|
| 363 |
+
|
| 364 |
+
# افزودن روش به سیستم دیپلماسی
|
| 365 |
+
from game.diplomacy.diplomacy_system import DiplomacySystem
|
| 366 |
+
DiplomacySystem.display_international_orgs = display_international_orgs
|
| 367 |
+
|
| 368 |
+
def remove(self, game):
|
| 369 |
+
"""
|
| 370 |
+
حذف اثرات پلاگین از بازی
|
| 371 |
+
|
| 372 |
+
:param game: نمونه بازی که پلاگین باید از آن حذف شود
|
| 373 |
+
"""
|
| 374 |
+
# حذف ویژگیهای اضافه شده
|
| 375 |
+
if hasattr(game.game_state, 'diplomacy_relations'):
|
| 376 |
+
del game.game_state.diplomacy_relations
|
| 377 |
+
|
| 378 |
+
if hasattr(game.game_state, 'international_orgs'):
|
| 379 |
+
del game.game_state.international_orgs
|
| 380 |
+
|
| 381 |
+
# حذف رویدادهای جدید
|
| 382 |
+
global EVENTS
|
| 383 |
+
EVENTS = [e for e in EVENTS if e.get("id") not in [100, 101]]
|
| 384 |
+
|
| 385 |
+
# حذف روشهای جدید
|
| 386 |
+
if hasattr(game.diplomacy, 'join_international_orgs'):
|
| 387 |
+
del game.diplomacy.join_international_orgs
|
| 388 |
+
|
| 389 |
+
if hasattr(game.diplomacy, 'advanced_negotiation'):
|
| 390 |
+
del game.diplomacy.advanced_negotiation
|
| 391 |
+
|
| 392 |
+
if hasattr(game.diplomacy, 'display_international_orgs'):
|
| 393 |
+
del game.diplomacy.display_international_orgs
|
| 394 |
+
|
| 395 |
+
print(f"{self.name} با موفقیت حذف شد.")
|
Shadows_of_Empires/plugins/plugin_manager.py
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
مدیریت بارگیری و اعمال پلاگینها
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
import os
|
| 6 |
+
import importlib
|
| 7 |
+
import sys
|
| 8 |
+
from base_plugin import BasePlugin
|
| 9 |
+
|
| 10 |
+
class PluginManager:
|
| 11 |
+
"""مدیریت بارگیری و اعمال پلاگینها"""
|
| 12 |
+
|
| 13 |
+
def __init__(self, plugins_dir="plugins"):
|
| 14 |
+
"""ساخت یک نمونه جدید از مدیر پلاگینها"""
|
| 15 |
+
self.plugins_dir = plugins_dir
|
| 16 |
+
self.plugins = []
|
| 17 |
+
self.loaded_modules = []
|
| 18 |
+
self.active_plugins = []
|
| 19 |
+
|
| 20 |
+
def load_plugins(self):
|
| 21 |
+
"""بارگیری تمام پلاگینها از پوشه مربوطه"""
|
| 22 |
+
# اضافه کردن پوشه پلاگینها به سیستم
|
| 23 |
+
plugins_path = os.path.join(os.path.dirname(__file__), self.plugins_dir)
|
| 24 |
+
sys.path.insert(0, plugins_path)
|
| 25 |
+
|
| 26 |
+
print(f"جستجوی پلاگینها در: {plugins_path}")
|
| 27 |
+
|
| 28 |
+
# لیست تمام فایلهای پایتون در پوشه پلاگینها
|
| 29 |
+
for filename in os.listdir(plugins_path):
|
| 30 |
+
if filename.endswith(".py") and not filename.startswith("__"):
|
| 31 |
+
module_name = filename[:-3] # حذف .py
|
| 32 |
+
|
| 33 |
+
try:
|
| 34 |
+
# بارگیری ماژول
|
| 35 |
+
print(f"بارگیری ماژول: {module_name}")
|
| 36 |
+
module = importlib.import_module(module_name)
|
| 37 |
+
self.loaded_modules.append(module)
|
| 38 |
+
|
| 39 |
+
# یافتن کلاسهای پلاگین
|
| 40 |
+
for attr_name in dir(module):
|
| 41 |
+
attr = getattr(module, attr_name)
|
| 42 |
+
if isinstance(attr, type) and issubclass(attr, BasePlugin) and attr != BasePlugin:
|
| 43 |
+
plugin = attr()
|
| 44 |
+
self.plugins.append(plugin)
|
| 45 |
+
print(f"پیدا شد: {plugin.name} v{plugin.version}")
|
| 46 |
+
except Exception as e:
|
| 47 |
+
print(f"خطا در بارگیری پلاگین {module_name}: {str(e)}")
|
| 48 |
+
|
| 49 |
+
# مرتبسازی پلاگینها بر اساس نام
|
| 50 |
+
self.plugins.sort(key=lambda p: p.name)
|
| 51 |
+
print(f"{len(self.plugins)} پلاگین بارگیری شد.")
|
| 52 |
+
|
| 53 |
+
def activate_plugins(self, game):
|
| 54 |
+
"""فعالسازی پلاگینها و اعمال آنها به بازی"""
|
| 55 |
+
for plugin in self.plugins:
|
| 56 |
+
if plugin not in self.active_plugins:
|
| 57 |
+
plugin.apply(game)
|
| 58 |
+
self.active_plugins.append(plugin)
|
| 59 |
+
print(f"فعالسازی پلاگین: {plugin.name}")
|
| 60 |
+
|
| 61 |
+
def deactivate_plugins(self, game):
|
| 62 |
+
"""غیرفعالسازی پلاگینها و حذف اثرات آنها از بازی"""
|
| 63 |
+
for plugin in self.active_plugins:
|
| 64 |
+
plugin.remove(game)
|
| 65 |
+
self.active_plugins = []
|
| 66 |
+
print("تمام پلاگینها غیرفعال شدند.")
|
| 67 |
+
|
| 68 |
+
def list_plugins(self):
|
| 69 |
+
"""لیست تمام پلاگینهای بارگیری شده"""
|
| 70 |
+
print("\nلیست پلاگینهای بارگیری شده:")
|
| 71 |
+
for i, plugin in enumerate(self.plugins, 1):
|
| 72 |
+
status = "فعال" if plugin in self.active_plugins else "غیرفعال"
|
| 73 |
+
print(f"{i}. {plugin.name} v{plugin.version} - {status}")
|
| 74 |
+
print(f" {plugin.description}")
|
| 75 |
+
|
| 76 |
+
def toggle_plugin(self, game, plugin_index):
|
| 77 |
+
"""فعال یا غیرفعال کردن یک پلاگین خاص"""
|
| 78 |
+
if 0 <= plugin_index < len(self.plugins):
|
| 79 |
+
plugin = self.plugins[plugin_index]
|
| 80 |
+
|
| 81 |
+
if plugin in self.active_plugins:
|
| 82 |
+
plugin.remove(game)
|
| 83 |
+
self.active_plugins.remove(plugin)
|
| 84 |
+
print(f"پلاگین '{plugin.name}' غیرفعال شد.")
|
| 85 |
+
else:
|
| 86 |
+
plugin.apply(game)
|
| 87 |
+
self.active_plugins.append(plugin)
|
| 88 |
+
print(f"پلاگین '{plugin.name}' فعال شد.")
|
| 89 |
+
else:
|
| 90 |
+
print("شماره پلاگین نامعتبر است.")
|
| 91 |
+
|
| 92 |
+
def get_plugin_info(self, plugin_index):
|
| 93 |
+
"""دریافت اطلاعات یک پلاگین خاص"""
|
| 94 |
+
if 0 <= plugin_index < len(self.plugins):
|
| 95 |
+
plugin = self.plugins[plugin_index]
|
| 96 |
+
info = {
|
| 97 |
+
"name": plugin.name,
|
| 98 |
+
"version": plugin.version,
|
| 99 |
+
"description": plugin.description,
|
| 100 |
+
"status": "active" if plugin in self.active_plugins else "inactive"
|
| 101 |
+
}
|
| 102 |
+
return info
|
| 103 |
+
return None
|
| 104 |
+
|
| 105 |
+
def save_plugin_configuration(self, filename="plugins_config.json"):
|
| 106 |
+
"""ذخیره پیکربندی پلاگینها"""
|
| 107 |
+
import json
|
| 108 |
+
|
| 109 |
+
config = {
|
| 110 |
+
"active_plugins": [plugin.name for plugin in self.active_plugins]
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
with open(filename, 'w') as f:
|
| 114 |
+
json.dump(config, f, indent=2)
|
| 115 |
+
print(f"پیکربندی پلاگینها در '{filename}' ذخیره شد.")
|
| 116 |
+
|
| 117 |
+
def load_plugin_configuration(self, filename="plugins_config.json"):
|
| 118 |
+
"""بارگیری پیکربندی پلاگینها"""
|
| 119 |
+
import json
|
| 120 |
+
import os
|
| 121 |
+
|
| 122 |
+
if not os.path.exists(filename):
|
| 123 |
+
print(f"فایل پیکربندی '{filename}' یافت نشد.")
|
| 124 |
+
return
|
| 125 |
+
|
| 126 |
+
try:
|
| 127 |
+
with open(filename, 'r') as f:
|
| 128 |
+
config = json.load(f)
|
| 129 |
+
|
| 130 |
+
# غیرفعالسازی تمام پلاگینها
|
| 131 |
+
self.deactivate_plugins(None)
|
| 132 |
+
|
| 133 |
+
# فعالسازی پلاگینهای ذخیره شده
|
| 134 |
+
for plugin_name in config.get("active_plugins", []):
|
| 135 |
+
for plugin in self.plugins:
|
| 136 |
+
if plugin.name == plugin_name:
|
| 137 |
+
plugin.apply(None) # این فقط برای بررسی سازگاری است
|
| 138 |
+
self.active_plugins.append(plugin)
|
| 139 |
+
break
|
| 140 |
+
|
| 141 |
+
print(f"پیکربندی پلاگینها از '{filename}' بارگیری شد.")
|
| 142 |
+
except Exception as e:
|
| 143 |
+
print(f"خطا در بارگیری پیکربندی پلاگینها: {str(e)}")
|
Shadows_of_Empires/st_txt.text
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
Shadows_of_Empires/structure.txt
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
empire_shadows/
|
| 2 |
+
│
|
| 3 |
+
├── main.py
|
| 4 |
+
├── config.py
|
| 5 |
+
├── requirements.txt
|
| 6 |
+
│
|
| 7 |
+
├── game/
|
| 8 |
+
│ ├── __init__.py
|
| 9 |
+
│ ├── game.py
|
| 10 |
+
│ ├── game_state.py
|
| 11 |
+
│ │
|
| 12 |
+
│ ├── calendar/
|
| 13 |
+
│ │ ├── __init__.py
|
| 14 |
+
│ │ ├── calendar_system.py
|
| 15 |
+
│ │ └── historical_events.py
|
| 16 |
+
│ │
|
| 17 |
+
│ ├── climate/
|
| 18 |
+
│ │ ├── __init__.py
|
| 19 |
+
│ │ ├── climate_system.py
|
| 20 |
+
│ │ └── weather_events.py
|
| 21 |
+
│ │
|
| 22 |
+
│ ├── demographics/
|
| 23 |
+
│ │ ├── __init__.py
|
| 24 |
+
│ │ ├── population_system.py
|
| 25 |
+
│ │ └── migration_system.py
|
| 26 |
+
│ │
|
| 27 |
+
│ ├── technology/
|
| 28 |
+
│ │ ├── __init__.py
|
| 29 |
+
│ │ ├── tech_tree.py
|
| 30 |
+
│ │ ├── research_system.py
|
| 31 |
+
│ │ └── tech_effects.py
|
| 32 |
+
│ │
|
| 33 |
+
│ ├── religion/
|
| 34 |
+
│ │ ├── __init__.py
|
| 35 |
+
│ │ ├── religious_system.py
|
| 36 |
+
│ │ └── religious_events.py
|
| 37 |
+
│ │
|
| 38 |
+
│ ├── espionage/
|
| 39 |
+
│ │ ├── __init__.py
|
| 40 |
+
│ │ ├── espionage_system.py
|
| 41 |
+
│ │ └── spy_network.py
|
| 42 |
+
│ │
|
| 43 |
+
│ ├── cities/
|
| 44 |
+
│ │ ├── __init__.py
|
| 45 |
+
│ │ ├── city_management.py
|
| 46 |
+
│ │ ├── construction_system.py
|
| 47 |
+
│ │ └── city_events.py
|
| 48 |
+
│ │
|
| 49 |
+
│ ├── warfare/
|
| 50 |
+
│ │ ├── __init__.py
|
| 51 |
+
│ │ ├── warfare_system.py
|
| 52 |
+
│ │ ├── battle_simulator.py
|
| 53 |
+
│ │ └── military_tactics.py
|
| 54 |
+
│ │
|
| 55 |
+
│ ├── trade/
|
| 56 |
+
│ │ ├── __init__.py
|
| 57 |
+
│ │ ├── trade_system.py
|
| 58 |
+
│ │ ├── global_market.py
|
| 59 |
+
│ │ └── trade_routes.py
|
| 60 |
+
│ │
|
| 61 |
+
│ ├── politics/
|
| 62 |
+
│ │ ├── __init__.py
|
| 63 |
+
│ │ ├── domestic_policy.py
|
| 64 |
+
│ │ ├── political_parties.py
|
| 65 |
+
│ │ └── election_system.py
|
| 66 |
+
│ │
|
| 67 |
+
│ ├── society/
|
| 68 |
+
│ │ ├── __init__.py
|
| 69 |
+
│ │ ├── social_classes.py
|
| 70 |
+
│ │ ├── social_issues.py
|
| 71 |
+
│ │ └── happiness_system.py
|
| 72 |
+
│ │
|
| 73 |
+
│ ├── culture/
|
| 74 |
+
│ │ ├── __init__.py
|
| 75 |
+
│ │ ├── cultural_system.py
|
| 76 |
+
│ │ ├── language_system.py
|
| 77 |
+
│ │ └── cultural_influence.py
|
| 78 |
+
│ │
|
| 79 |
+
│ ├── diplomacy/
|
| 80 |
+
│ │ ├── __init__.py
|
| 81 |
+
│ │ ├── diplomacy_system.py
|
| 82 |
+
│ │ ├── embassies.py
|
| 83 |
+
│ │ └── international_orgs.py
|
| 84 |
+
│ │
|
| 85 |
+
│ ├── economy/
|
| 86 |
+
│ │ ├── __init__.py
|
| 87 |
+
│ │ ├── macro_economy.py
|
| 88 |
+
│ │ ├── resource_management.py
|
| 89 |
+
│ │ └── economic_policies.py
|
| 90 |
+
│ │
|
| 91 |
+
│ ├── military/
|
| 92 |
+
│ │ ├── __init__.py
|
| 93 |
+
│ │ ├── army_management.py
|
| 94 |
+
│ │ ├── military_production.py
|
| 95 |
+
│ │ └── military_units.py
|
| 96 |
+
│ │
|
| 97 |
+
│ ├── health/
|
| 98 |
+
│ │ ├── __init__.py
|
| 99 |
+
│ │ ├── healthcare_system.py
|
| 100 |
+
│ │ └── disease_system.py
|
| 101 |
+
│ │
|
| 102 |
+
│ ├── education/
|
| 103 |
+
│ │ ├── __init__.py
|
| 104 |
+
│ │ ├── education_system.py
|
| 105 |
+
│ │ └── knowledge_system.py
|
| 106 |
+
│ │
|
| 107 |
+
│ ├── environment/
|
| 108 |
+
│ │ ├── __init__.py
|
| 109 |
+
│ │ ├── environmental_system.py
|
| 110 |
+
│ │ └── climate_change.py
|
| 111 |
+
│ │
|
| 112 |
+
│ ├── crisis/
|
| 113 |
+
│ │ ├── __init__.py
|
| 114 |
+
│ │ ├── crisis_management.py
|
| 115 |
+
│ │ └── disaster_response.py
|
| 116 |
+
│ │
|
| 117 |
+
│ ├── succession/
|
| 118 |
+
│ │ ├── __init__.py
|
| 119 |
+
│ │ ├── succession_system.py
|
| 120 |
+
│ │ └── royal_family.py
|
| 121 |
+
│ │
|
| 122 |
+
│ └── achievements/
|
| 123 |
+
│ ├── __init__.py
|
| 124 |
+
│ ├── achievements_system.py
|
| 125 |
+
│ └── personal_objectives.py
|
| 126 |
+
│
|
| 127 |
+
├── data/
|
| 128 |
+
│ ├── __init__.py
|
| 129 |
+
│ ├── countries/
|
| 130 |
+
│ │ ├── __init__.py
|
| 131 |
+
│ │ ├── base_countries.py
|
| 132 |
+
│ │ ├── historical_countries.py
|
| 133 |
+
│ │ └── custom_countries.py
|
| 134 |
+
│ │
|
| 135 |
+
│ ├── events/
|
| 136 |
+
│ │ ├── __init__.py
|
| 137 |
+
│ │ ├── event_definitions.py
|
| 138 |
+
│ │ ├── historical_events.py
|
| 139 |
+
│ │ └── dynamic_events.py
|
| 140 |
+
│ │
|
| 141 |
+
│ ├── tech/
|
| 142 |
+
│ │ ├── __init__.py
|
| 143 |
+
│ │ ├── tech_definitions.py
|
| 144 |
+
│ │ └── tech_trees.py
|
| 145 |
+
│ │
|
| 146 |
+
│ ├── religion/
|
| 147 |
+
│ │ ├── __init__.py
|
| 148 |
+
│ │ ├── religions.py
|
| 149 |
+
│ │ └── religious_groups.py
|
| 150 |
+
│ │
|
| 151 |
+
│ ├── military/
|
| 152 |
+
│ │ ├── __init__.py
|
| 153 |
+
│ │ ├── units.py
|
| 154 |
+
│ │ ├── weapons.py
|
| 155 |
+
│ │ └── fortifications.py
|
| 156 |
+
│ │
|
| 157 |
+
│ ├── resources/
|
| 158 |
+
│ │ ├── __init__.py
|
| 159 |
+
│ │ ├─��� natural_resources.py
|
| 160 |
+
│ │ └── resource_map.py
|
| 161 |
+
│ │
|
| 162 |
+
│ ├── cities/
|
| 163 |
+
│ │ ├── __init__.py
|
| 164 |
+
│ │ ├── city_templates.py
|
| 165 |
+
│ │ └── building_types.py
|
| 166 |
+
│ │
|
| 167 |
+
│ └── achievements/
|
| 168 |
+
│ ├── __init__.py
|
| 169 |
+
│ └── achievement_definitions.py
|
| 170 |
+
│
|
| 171 |
+
├── plugins/
|
| 172 |
+
│ ├── __init__.py
|
| 173 |
+
│ ├── base_plugin.py
|
| 174 |
+
│ ├── plugin_manager.py
|
| 175 |
+
│ ├── example_plugin.py
|
| 176 |
+
│ ├── advanced_diplomacy_plugin.py
|
| 177 |
+
│ ├── trade_expansion_plugin.py
|
| 178 |
+
│ └── climate_change_plugin.py
|
| 179 |
+
│
|
| 180 |
+
├── ui/
|
| 181 |
+
│ ├── __init__.py
|
| 182 |
+
│ ├── console_ui.py
|
| 183 |
+
│ ├── colors.py
|
| 184 |
+
│ ├── display.py
|
| 185 |
+
│ ├── menus.py
|
| 186 |
+
│ └── animations.py
|
| 187 |
+
│
|
| 188 |
+
└── utils/
|
| 189 |
+
├── __init__.py
|
| 190 |
+
├── save_load.py
|
| 191 |
+
├── logger.py
|
| 192 |
+
├── helpers.py
|
| 193 |
+
├── randomizer.py
|
| 194 |
+
└── data_loader.py
|
Shadows_of_Empires/ui/colors.py
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
تعریف رنگها برای رابط کاربری پیشرفته
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
from colorama import init, Fore, Style, Back
|
| 6 |
+
init(autoreset=True)
|
| 7 |
+
|
| 8 |
+
class Colors:
|
| 9 |
+
"""کلاس تعریف رنگها برای خروجی جذاب و حرفهای"""
|
| 10 |
+
|
| 11 |
+
# راهاندازی رنگها
|
| 12 |
+
HEADER = Fore.CYAN + Style.BRIGHT
|
| 13 |
+
TITLE = Fore.YELLOW + Style.BRIGHT
|
| 14 |
+
NEUTRAL = Style.RESET_ALL
|
| 15 |
+
PROMPT = Fore.GREEN + Style.BRIGHT
|
| 16 |
+
SUCCESS = Fore.GREEN + Style.BRIGHT
|
| 17 |
+
WARNING = Fore.YELLOW + Style.BRIGHT
|
| 18 |
+
ERROR = Fore.RED + Style.BRIGHT
|
| 19 |
+
GOLD = Fore.YELLOW + Style.BRIGHT
|
| 20 |
+
STABILITY = Fore.CYAN + Style.BRIGHT
|
| 21 |
+
DISSATISFACTION = Fore.MAGENTA + Style.BRIGHT
|
| 22 |
+
MENU = Fore.BLUE + Style.BRIGHT
|
| 23 |
+
ALLY = Fore.GREEN
|
| 24 |
+
FRIEND = Fore.CYAN
|
| 25 |
+
NEUTRAL_REL = Fore.WHITE
|
| 26 |
+
ENEMY = Fore.RED
|
| 27 |
+
|
| 28 |
+
# رنگهای اضافی برای سیستمهای خاص
|
| 29 |
+
MILITARY = Fore.RED + Style.BRIGHT
|
| 30 |
+
ECONOMY = Fore.GREEN + Style.BRIGHT
|
| 31 |
+
CULTURE = Fore.MAGENTA + Style.BRIGHT
|
| 32 |
+
RELIGION = Fore.YELLOW + Style.BRIGHT
|
| 33 |
+
TECHNOLOGY = Fore.CYAN + Style.BRIGHT
|
| 34 |
+
ENVIRONMENT = Fore.GREEN
|
| 35 |
+
|
| 36 |
+
# رنگهای سیستمهای خاص
|
| 37 |
+
HEALTH = Fore.LIGHTGREEN_EX
|
| 38 |
+
EDUCATION = Fore.LIGHTBLUE_EX
|
| 39 |
+
DIPLOMACY = Fore.LIGHTCYAN_EX
|
| 40 |
+
SPIES = Fore.LIGHTMAGENTA_EX
|
| 41 |
+
|
| 42 |
+
# رنگهای پیشرفته برای نمایش وضعیت
|
| 43 |
+
HIGH = Fore.GREEN + Style.BRIGHT
|
| 44 |
+
MEDIUM = Fore.YELLOW + Style.BRIGHT
|
| 45 |
+
LOW = Fore.RED + Style.BRIGHT
|
| 46 |
+
CRITICAL = Fore.RED + Style.BRIGHT + Style.DIM
|
| 47 |
+
|
| 48 |
+
# رنگهای برای شهرها و مناطق
|
| 49 |
+
CITY = Fore.CYAN
|
| 50 |
+
VILLAGE = Fore.GREEN
|
| 51 |
+
FARM = Fore.YELLOW
|
| 52 |
+
INDUSTRY = Fore.RED
|
| 53 |
+
FORTRESS = Fore.MAGENTA
|
| 54 |
+
|
| 55 |
+
# رنگهای برای فصلها
|
| 56 |
+
SPRING = Fore.GREEN
|
| 57 |
+
SUMMER = Fore.YELLOW
|
| 58 |
+
AUTUMN = Fore.RED
|
| 59 |
+
WINTER = Fore.WHITE
|
| 60 |
+
|
| 61 |
+
# رنگهای برای اقلیمها
|
| 62 |
+
TROPICAL = Fore.RED
|
| 63 |
+
DESERT = Fore.YELLOW
|
| 64 |
+
POLAR = Fore.WHITE
|
| 65 |
+
MEDITERRANEAN = Fore.CYAN
|
| 66 |
+
TEMPERATE = Fore.GREEN
|
| 67 |
+
|
| 68 |
+
# رنگهای برای دینها
|
| 69 |
+
ISLAM = Fore.GREEN
|
| 70 |
+
CHRISTIANITY = Fore.BLUE
|
| 71 |
+
HINDUISM = Fore.RED
|
| 72 |
+
BUDDHISM = Fore.YELLOW
|
| 73 |
+
OTHER_RELIGION = Fore.MAGENTA
|
| 74 |
+
|
| 75 |
+
@staticmethod
|
| 76 |
+
def get_resource_color(resource):
|
| 77 |
+
"""دریافت رنگ مناسب برای منابع مختلف"""
|
| 78 |
+
resource_colors = {
|
| 79 |
+
"food": Fore.GREEN,
|
| 80 |
+
"wood": Fore.YELLOW,
|
| 81 |
+
"stone": Fore.WHITE,
|
| 82 |
+
"iron": Fore.RED,
|
| 83 |
+
"gold": Fore.YELLOW + Style.BRIGHT,
|
| 84 |
+
"oil": Fore.BLACK + Back.YELLOW
|
| 85 |
+
}
|
| 86 |
+
return resource_colors.get(resource, Fore.WHITE)
|
| 87 |
+
|
| 88 |
+
@staticmethod
|
| 89 |
+
def get_environment_color(factor):
|
| 90 |
+
"""دریافت رنگ مناسب برای عوامل محیط زیستی"""
|
| 91 |
+
if factor == "pollution":
|
| 92 |
+
return Fore.RED
|
| 93 |
+
elif factor == "deforestation":
|
| 94 |
+
return Fore.YELLOW
|
| 95 |
+
elif factor == "climate_impact":
|
| 96 |
+
return Fore.MAGENTA
|
| 97 |
+
else:
|
| 98 |
+
return Fore.GREEN
|
| 99 |
+
|
| 100 |
+
@staticmethod
|
| 101 |
+
def get_technology_color(category):
|
| 102 |
+
"""دریافت رنگ مناسب برای دستهبندیهای فناوری"""
|
| 103 |
+
tech_colors = {
|
| 104 |
+
"military": Fore.RED,
|
| 105 |
+
"agriculture": Fore.GREEN,
|
| 106 |
+
"trade": Fore.YELLOW,
|
| 107 |
+
"industry": Fore.CYAN,
|
| 108 |
+
"medicine": Fore.MAGENTA,
|
| 109 |
+
"education": Fore.BLUE,
|
| 110 |
+
"environment": Fore.GREEN,
|
| 111 |
+
"communication": Fore.CYAN
|
| 112 |
+
}
|
| 113 |
+
return tech_colors.get(category, Fore.WHITE)
|
| 114 |
+
|
| 115 |
+
@staticmethod
|
| 116 |
+
def get_relation_color(value):
|
| 117 |
+
"""دریافت رنگ مناسب برای روابط بینالمللی"""
|
| 118 |
+
if value > 70:
|
| 119 |
+
return Colors.ALLY
|
| 120 |
+
elif value > 50:
|
| 121 |
+
return Colors.FRIEND
|
| 122 |
+
elif value > 0:
|
| 123 |
+
return Colors.NEUTRAL_REL
|
| 124 |
+
elif value > -30:
|
| 125 |
+
return Colors.NEUTRAL_REL
|
| 126 |
+
else:
|
| 127 |
+
return Colors.ENEMY
|
| 128 |
+
|
| 129 |
+
@staticmethod
|
| 130 |
+
def get_status_color(value, max_value=100):
|
| 131 |
+
"""دریافت رنگ مناسب بر اساس مقدار وضعیت"""
|
| 132 |
+
percentage = (value / max_value) * 100
|
| 133 |
+
if percentage >= 75:
|
| 134 |
+
return Colors.HIGH
|
| 135 |
+
elif percentage >= 50:
|
| 136 |
+
return Colors.MEDIUM
|
| 137 |
+
elif percentage >= 25:
|
| 138 |
+
return Colors.LOW
|
| 139 |
+
else:
|
| 140 |
+
return Colors.CRITICAL
|
Shadows_of_Empires/ui/console_ui.py
ADDED
|
@@ -0,0 +1,430 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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"""
|
| 2 |
+
رابط کاربری متنی پیشرفته برای بازی
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
from ui.colors import Colors
|
| 6 |
+
from utils.helpers import format_number, format_percentage
|
| 7 |
+
import time
|
| 8 |
+
import sys
|
| 9 |
+
import textwrap
|
| 10 |
+
|
| 11 |
+
class ConsoleUI:
|
| 12 |
+
"""کلاس برای مدیریت رابط کاربری متنی"""
|
| 13 |
+
|
| 14 |
+
@staticmethod
|
| 15 |
+
def clear_screen():
|
| 16 |
+
"""پاک کردن صفحه ترمینال"""
|
| 17 |
+
import os
|
| 18 |
+
os.system('cls' if os.name == 'nt' else 'clear')
|
| 19 |
+
|
| 20 |
+
@staticmethod
|
| 21 |
+
def display_title_screen():
|
| 22 |
+
"""نمایش صفحه عنوان بازی"""
|
| 23 |
+
ConsoleUI.clear_screen()
|
| 24 |
+
|
| 25 |
+
title = r"""
|
| 26 |
+
█████╗ ██████╗ ██╗ ██╗███████╗███╗ ██╗████████╗ ██████╗ ██████╗ ██████╗ ██╗ ██╗██████╗ ███████╗██████╗
|
| 27 |
+
██╔══██╗██╔══██╗██║ ██║██╔════╝████╗ ██║╚══██╔══╝ ██╔═══██╗██╔═══██╗██╔══██╗██║ ██║██╔══██╗██╔════╝██╔══██╗
|
| 28 |
+
███████║██████╔╝██║ ██║█████╗ ██╔██╗ ██║ ██║ ██║ ██║██║ ██║██████╔╝██║ ██║██████╔╝█████╗ ██████╔╝
|
| 29 |
+
██╔══██║██╔══██╗╚██╗ ██╔╝██╔══╝ ██║╚██╗██║ ██║ ██║ ██║██║ ██║██╔══██╗██║ ██║██╔══██╗██╔══╝ ██╔══██╗
|
| 30 |
+
██║ ██║██║ ██║ ╚████╔╝ ███████╗██║ ╚████║ ██║ ╚██████╔╝╚██████╔╝██║ ██║╚██████╔╝██║ ██║███████╗██║ ██║
|
| 31 |
+
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═══╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
| 32 |
+
"""
|
| 33 |
+
|
| 34 |
+
print(Colors.HEADER + title)
|
| 35 |
+
print(Colors.NEUTRAL + "════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════")
|
| 36 |
+
print(Colors.NEUTRAL + " به دنیای پویای 'سایههای امپراتوری' خوش آمدید! جایی که قدرت، سیاست و استراتژی، کلید پیروزی هستند.")
|
| 37 |
+
print(Colors.NEUTRAL + " شما رهبر یک کشور کوچک و نوظهور هستید و هدف شما، گسترش قلمرو، تقویت اقتصاد، و تسلط بر جهان است.")
|
| 38 |
+
print(Colors.NEUTRAL + "════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════")
|
| 39 |
+
print()
|
| 40 |
+
|
| 41 |
+
@staticmethod
|
| 42 |
+
def display_intro():
|
| 43 |
+
"""نمایش مقدمه بازی"""
|
| 44 |
+
ConsoleUI.clear_screen()
|
| 45 |
+
|
| 46 |
+
intro_text = [
|
| 47 |
+
"در سال ۱۵۰۰ میلادی، جهان لرزان است!",
|
| 48 |
+
"امپراتوریهای عظیم بر سر قدرت به رقابت پرداختهاند،",
|
| 49 |
+
"دریانوردان جسور به دنبال سرزمینهای ناشناخته میگردند،",
|
| 50 |
+
"و سرنوشت ملل در دست رهبرانی است که هوش سیاسی، شجاعت نظامی،",
|
| 51 |
+
"و دیپلماسی هوشمندانه را میآموزند.",
|
| 52 |
+
"",
|
| 53 |
+
"شما اکنون فرمانروای یک پادشاهی نوظهور هستید که در میان طوفان تاریخ،",
|
| 54 |
+
"باید با تصمیماتی تاریخساز از یک سرزمین کوچک، امپراتوریای جاودانه بسازید!",
|
| 55 |
+
"",
|
| 56 |
+
"آمادهاید تا در سال ۱۵۰۰ میلادی، سرنوشت تاریخ را رقم بزنید؟"
|
| 57 |
+
]
|
| 58 |
+
|
| 59 |
+
for line in intro_text:
|
| 60 |
+
ConsoleUI.typewriter_effect(line)
|
| 61 |
+
time.sleep(0.3)
|
| 62 |
+
|
| 63 |
+
print("\n")
|
| 64 |
+
ConsoleUI.wait_for_enter()
|
| 65 |
+
|
| 66 |
+
@staticmethod
|
| 67 |
+
def typewriter_effect(text, delay=None):
|
| 68 |
+
"""نمایش متن با افکت تایپ رایتر"""
|
| 69 |
+
if delay is None:
|
| 70 |
+
delay = 0.02 if len(text) > 50 else 0.03
|
| 71 |
+
|
| 72 |
+
for char in text:
|
| 73 |
+
sys.stdout.write(char)
|
| 74 |
+
sys.stdout.flush()
|
| 75 |
+
time.sleep(delay)
|
| 76 |
+
print()
|
| 77 |
+
|
| 78 |
+
@staticmethod
|
| 79 |
+
def display_section_title(title, width=80):
|
| 80 |
+
"""نمایش عنوان بخش با فرمت خاص"""
|
| 81 |
+
padding = (width - len(title) - 2) // 2
|
| 82 |
+
print(Colors.HEADER + "╔" + "═" * (width - 2) + "╗")
|
| 83 |
+
print(Colors.HEADER + "║" + " " * padding + Colors.TITLE + title + " " * (width - padding - len(title) - 2) + Colors.HEADER + "║")
|
| 84 |
+
print(Colors.HEADER + "╠" + "═" * (width - 2) + "╣")
|
| 85 |
+
|
| 86 |
+
@staticmethod
|
| 87 |
+
def display_message(message, indent=2, width=78):
|
| 88 |
+
"""نمایش یک پیام معمولی با قابلیت پیچش خط"""
|
| 89 |
+
prefix = " " * indent
|
| 90 |
+
wrapped_lines = textwrap.wrap(message, width=width-indent)
|
| 91 |
+
|
| 92 |
+
for line in wrapped_lines:
|
| 93 |
+
print(f"{prefix}{Colors.NEUTRAL}{line}")
|
| 94 |
+
|
| 95 |
+
@staticmethod
|
| 96 |
+
def display_success(message, indent=2, width=78):
|
| 97 |
+
"""نمایش پیام موفقیت با افکت"""
|
| 98 |
+
prefix = " " * indent
|
| 99 |
+
wrapped_lines = textwrap.wrap(message, width=width-indent)
|
| 100 |
+
|
| 101 |
+
for line in wrapped_lines:
|
| 102 |
+
print(f"{prefix}{Colors.SUCCESS}✓ {line}{Colors.NEUTRAL}")
|
| 103 |
+
|
| 104 |
+
@staticmethod
|
| 105 |
+
def display_warning(message, indent=2, width=78):
|
| 106 |
+
"""نمایش هشدار با افکت"""
|
| 107 |
+
prefix = " " * indent
|
| 108 |
+
wrapped_lines = textwrap.wrap(message, width=width-indent)
|
| 109 |
+
|
| 110 |
+
for line in wrapped_lines:
|
| 111 |
+
print(f"{prefix}{Colors.WARNING}⚠ {line}{Colors.NEUTRAL}")
|
| 112 |
+
|
| 113 |
+
@staticmethod
|
| 114 |
+
def display_error(message, indent=2, width=78):
|
| 115 |
+
"""نمایش خطا با افکت"""
|
| 116 |
+
prefix = " " * indent
|
| 117 |
+
wrapped_lines = textwrap.wrap(message, width=width-indent)
|
| 118 |
+
|
| 119 |
+
for line in wrapped_lines:
|
| 120 |
+
print(f"{prefix}{Colors.ERROR}✗ {line}{Colors.NEUTRAL}")
|
| 121 |
+
|
| 122 |
+
@staticmethod
|
| 123 |
+
def display_game_status(game_state, width=80):
|
| 124 |
+
"""نمایش وضعیت فعلی بازی با طراحی پیشرفته"""
|
| 125 |
+
country = game_state.player_country
|
| 126 |
+
year = game_state.current_year
|
| 127 |
+
|
| 128 |
+
# نمایش هدر
|
| 129 |
+
ConsoleUI.display_section_title(f"{country['name']} - سال {year}", width)
|
| 130 |
+
|
| 131 |
+
# نمایش اطلاعات کلی
|
| 132 |
+
status_lines = [
|
| 133 |
+
f"سکه طلا: {Colors.GOLD}{format_number(game_state.gold)}{Colors.NEUTRAL} | "
|
| 134 |
+
f"ثبات سیاسی: {Colors.STABILITY}{format_percentage(game_state.political_stability)}{Colors.NEUTRAL} | "
|
| 135 |
+
f"نارضایتی عمومی: {Colors.DISSATISFACTION}{format_percentage(game_state.public_dissatisfaction)}{Colors.NEUTRAL}",
|
| 136 |
+
|
| 137 |
+
f"اقتصاد: تجارت={format_percentage(game_state.economy['trade'])} | "
|
| 138 |
+
f"کشاورزی={format_percentage(game_state.economy['agriculture'])} | "
|
| 139 |
+
f"صنعت={format_percentage(game_state.economy['industry'])} | "
|
| 140 |
+
f"تورم={format_percentage(game_state.economy['inflation'])}",
|
| 141 |
+
|
| 142 |
+
f"روابط بینالمللی: {ConsoleUI.format_relations(game_state.relations, width-20)}",
|
| 143 |
+
|
| 144 |
+
f"پیشرفت: فرهنگ={format_percentage(game_state.culture_score)} | "
|
| 145 |
+
f"دین={format_percentage(game_state.religious_influence)} | "
|
| 146 |
+
f"قلمرو={game_state.controlled_territories}/23 کشور | "
|
| 147 |
+
f"فناوری={game_state.technology_level}"
|
| 148 |
+
]
|
| 149 |
+
|
| 150 |
+
for line in status_lines:
|
| 151 |
+
ConsoleUI.display_message(line, indent=2, width=width-2)
|
| 152 |
+
|
| 153 |
+
print(Colors.HEADER + "╚" + "═" * (width - 2) + "╝")
|
| 154 |
+
print()
|
| 155 |
+
|
| 156 |
+
@staticmethod
|
| 157 |
+
def format_relations(relations, width=60):
|
| 158 |
+
"""فرمتبندی روابط بینالمللی برای نمایش"""
|
| 159 |
+
# فیلتر کردن رابطه با خود
|
| 160 |
+
filtered = {k: v for k, v in relations.items() if v != 100 and abs(v) > 10}
|
| 161 |
+
|
| 162 |
+
# مرتبسازی بر اساس مقدار
|
| 163 |
+
sorted_relations = sorted(filtered.items(), key=lambda x: abs(x[1]), reverse=True)
|
| 164 |
+
|
| 165 |
+
# انتخاب 3 کشور برتر
|
| 166 |
+
top_relations = []
|
| 167 |
+
for name, value in sorted_relations[:3]:
|
| 168 |
+
if value > 50:
|
| 169 |
+
status = f"{Colors.ALLY}همپیمان{Colors.NEUTRAL}"
|
| 170 |
+
elif value > 0:
|
| 171 |
+
status = f"{Colors.FRIEND}دوست{Colors.NEUTRAL}"
|
| 172 |
+
elif value > -30:
|
| 173 |
+
status = f"{Colors.NEUTRAL}خنثی{Colors.NEUTRAL}"
|
| 174 |
+
else:
|
| 175 |
+
status = f"{Colors.ENEMY}دشمن{Colors.NEUTRAL}"
|
| 176 |
+
|
| 177 |
+
top_relations.append(f"{name}({status}{format_percentage(value)}{Colors.NEUTRAL})")
|
| 178 |
+
|
| 179 |
+
return ", ".join(top_relations) + ("..." if len(sorted_relations) > 3 else "")
|
| 180 |
+
|
| 181 |
+
@staticmethod
|
| 182 |
+
def display_country_info(country):
|
| 183 |
+
"""نمایش اطلاعات کشور انتخابی با جزئیات بیشتر"""
|
| 184 |
+
ConsoleUI.clear_screen()
|
| 185 |
+
ConsoleUI.display_section_title(f"اطلاعات {country['name']}")
|
| 186 |
+
|
| 187 |
+
info_lines = [
|
| 188 |
+
f"شرح: {country['description']}",
|
| 189 |
+
"",
|
| 190 |
+
f"ویژگی منحصربهفرد: {Colors.SUCCESS}{country['unique_trait']}{Colors.NEUTRAL}",
|
| 191 |
+
"",
|
| 192 |
+
"ویژگیهای اولیه:",
|
| 193 |
+
f"- جمعیت: {country['base_attributes']['population']} میلیون نفر",
|
| 194 |
+
f"- اقتصاد: تجارت={country['base_attributes']['economy']['trade']}, "
|
| 195 |
+
f"کشاورزی={country['base_attributes']['economy']['agriculture']}, "
|
| 196 |
+
f"صنعت={country['base_attributes']['economy']['industry']}",
|
| 197 |
+
f"- ارتش: ارتش={country['base_attributes']['military']['army']}, "
|
| 198 |
+
f"نیروی دریایی={country['base_attributes']['military']['navy']}, "
|
| 199 |
+
f"فناوری={country['base_attributes']['military']['tech']}",
|
| 200 |
+
f"- ثبات سیاسی: {country['base_attributes']['stability']}",
|
| 201 |
+
f"- مذهب: {country['base_attributes']['religion']}",
|
| 202 |
+
f"- نرخ باروری: {country['base_attributes']['birth_rate']}",
|
| 203 |
+
f"- نرخ مرگومیر: {country['base_attributes']['death_rate']}"
|
| 204 |
+
]
|
| 205 |
+
|
| 206 |
+
for line in info_lines:
|
| 207 |
+
ConsoleUI.display_message(line)
|
| 208 |
+
|
| 209 |
+
print()
|
| 210 |
+
|
| 211 |
+
# نمایش تاریخچه کشور
|
| 212 |
+
if "historical_events" in country and country["historical_events"]:
|
| 213 |
+
ConsoleUI.display_section_title("تاریخچه کلیدی", width=60)
|
| 214 |
+
for event in country["historical_events"][:2]: # فقط 2 رویداد اول
|
| 215 |
+
ConsoleUI.display_message(f"• {event['year']}: {event['name']}", indent=2)
|
| 216 |
+
|
| 217 |
+
ConsoleUI.wait_for_enter()
|
| 218 |
+
|
| 219 |
+
@staticmethod
|
| 220 |
+
def display_event(event):
|
| 221 |
+
"""نمایش رویداد و گزینههای آن با طراحی پیشرفته"""
|
| 222 |
+
ConsoleUI.display_section_title(f"رویداد: {event['name']}")
|
| 223 |
+
ConsoleUI.display_message(event["description"], indent=2)
|
| 224 |
+
print()
|
| 225 |
+
|
| 226 |
+
# نمایش گزینهها
|
| 227 |
+
for i, choice in enumerate(event["choices"], 1):
|
| 228 |
+
ConsoleUI.display_message(f"{i}. {choice['text']}", indent=2)
|
| 229 |
+
ConsoleUI.display_message(f" - {choice['description']}", indent=4)
|
| 230 |
+
|
| 231 |
+
print()
|
| 232 |
+
|
| 233 |
+
@staticmethod
|
| 234 |
+
def display_weather_event(event):
|
| 235 |
+
"""نمایش رویداد آبوهوایی با طراحی مخصوص"""
|
| 236 |
+
ConsoleUI.display_section_title(f"رویداد آبوهوایی: {event['name']}", width=80)
|
| 237 |
+
ConsoleUI.display_warning(event["description"], indent=2)
|
| 238 |
+
print()
|
| 239 |
+
|
| 240 |
+
# نمایش وضعیت آبوهوایی فعلی
|
| 241 |
+
from game.climate.climate_system import ClimateSystem
|
| 242 |
+
climate = ClimateSystem(None) # فقط برای رنگها
|
| 243 |
+
ConsoleUI.display_message("وضعیت فعلی آبوهوایی:", indent=2)
|
| 244 |
+
ConsoleUI.display_message(f"- دما: {climate.temperature}°C", indent=4)
|
| 245 |
+
ConsoleUI.display_message(f"- رطوبت: {climate.humidity}%", indent=4)
|
| 246 |
+
ConsoleUI.display_message(f"- بارش: {climate.precipitation}%", indent=4)
|
| 247 |
+
ConsoleUI.display_message(f"- فصل: {climate.season}", indent=4)
|
| 248 |
+
|
| 249 |
+
print()
|
| 250 |
+
|
| 251 |
+
# نمایش گزینهها
|
| 252 |
+
for i, choice in enumerate(event["choices"], 1):
|
| 253 |
+
ConsoleUI.display_message(f"{i}. {choice['text']}", indent=2)
|
| 254 |
+
ConsoleUI.display_message(f" - {choice['description']}", indent=4)
|
| 255 |
+
|
| 256 |
+
print()
|
| 257 |
+
|
| 258 |
+
@staticmethod
|
| 259 |
+
def display_historical_event(event):
|
| 260 |
+
"""نمایش رویداد تاریخی با طراحی مخصوص"""
|
| 261 |
+
ConsoleUI.display_section_title(f"رویداد تاریخی: {event['year']} - {event['name']}", width=80)
|
| 262 |
+
ConsoleUI.display_success(event["description"], indent=2)
|
| 263 |
+
print()
|
| 264 |
+
|
| 265 |
+
# نمایش اهمیت تاریخی
|
| 266 |
+
ConsoleUI.display_message("اهمیت تاریخی:", indent=2)
|
| 267 |
+
ConsoleUI.display_message("- این رویداد تأثیر عمدهای بر سرنوشت کشور شما داشت", indent=4)
|
| 268 |
+
ConsoleUI.display_message("- انتخابهای شما میتواند مسیر تاریخ را تغییر دهد", indent=4)
|
| 269 |
+
|
| 270 |
+
print()
|
| 271 |
+
|
| 272 |
+
# نمایش گزینهها
|
| 273 |
+
for i, choice in enumerate(event["choices"], 1):
|
| 274 |
+
ConsoleUI.display_message(f"{i}. {choice['text']}", indent=2)
|
| 275 |
+
ConsoleUI.display_message(f" - {choice['description']}", indent=4)
|
| 276 |
+
|
| 277 |
+
print()
|
| 278 |
+
|
| 279 |
+
@staticmethod
|
| 280 |
+
def get_player_choice(choices):
|
| 281 |
+
"""دریافت انتخاب بازیکن از بین گزینهها با اعتبارسنجی پیشرفته"""
|
| 282 |
+
while True:
|
| 283 |
+
try:
|
| 284 |
+
choice = input(Colors.PROMPT + "لطفاً شماره انتخاب خود را وارد کنید: " + Colors.NEUTRAL)
|
| 285 |
+
choice_idx = int(choice)
|
| 286 |
+
|
| 287 |
+
if 1 <= choice_idx <= len(choices):
|
| 288 |
+
return choice_idx
|
| 289 |
+
else:
|
| 290 |
+
ConsoleUI.display_warning(f"لطفاً یک عدد بین 1 تا {len(choices)} انتخاب کنید.")
|
| 291 |
+
except ValueError:
|
| 292 |
+
ConsoleUI.display_warning("لطفاً یک عدد معتبر وارد کنید.")
|
| 293 |
+
|
| 294 |
+
@staticmethod
|
| 295 |
+
def get_menu_choice(options, width=78):
|
| 296 |
+
"""نمایش منو و دریافت انتخاب بازیکن با پیچش خط"""
|
| 297 |
+
for i, option in enumerate(options, 1):
|
| 298 |
+
wrapped_lines = textwrap.wrap(option, width=width-5)
|
| 299 |
+
print(f"{Colors.MENU}{i}. {Colors.NEUTRAL}{wrapped_lines[0]}")
|
| 300 |
+
for line in wrapped_lines[1:]:
|
| 301 |
+
print(f" {line}")
|
| 302 |
+
|
| 303 |
+
print()
|
| 304 |
+
return ConsoleUI.get_player_choice(options)
|
| 305 |
+
|
| 306 |
+
@staticmethod
|
| 307 |
+
def confirm_action(prompt):
|
| 308 |
+
"""دریافت تأیید از بازیکن برای یک اقدام با گزینههای فارسی"""
|
| 309 |
+
while True:
|
| 310 |
+
response = input(Colors.PROMPT + f"{prompt} (بله/خیر): " + Colors.NEUTRAL).lower()
|
| 311 |
+
if response in ['بله', 'b', 'y', 'yes']:
|
| 312 |
+
return True
|
| 313 |
+
elif response in ['خیر', 'n', 'no']:
|
| 314 |
+
return False
|
| 315 |
+
else:
|
| 316 |
+
ConsoleUI.display_warning("لطفاً 'بله' یا 'خیر' را وارد کنید.")
|
| 317 |
+
|
| 318 |
+
@staticmethod
|
| 319 |
+
def wait_for_enter():
|
| 320 |
+
"""منتظر ماندن تا بازیکن Enter بزند با پیام پویا"""
|
| 321 |
+
print(Colors.PROMPT + "\nبرای ادامه، ", end="")
|
| 322 |
+
for char in "Enter را فشار دهید...":
|
| 323 |
+
sys.stdout.write(char)
|
| 324 |
+
sys.stdout.flush()
|
| 325 |
+
time.sleep(0.05)
|
| 326 |
+
print(Colors.NEUTRAL)
|
| 327 |
+
input()
|
| 328 |
+
|
| 329 |
+
@staticmethod
|
| 330 |
+
def display_country_status(game_state):
|
| 331 |
+
"""نمایش وضعیت کامل کشور با جزئیات"""
|
| 332 |
+
ConsoleUI.clear_screen()
|
| 333 |
+
ConsoleUI.display_section_title(f"وضعیت کامل {game_state.player_country['name']}")
|
| 334 |
+
|
| 335 |
+
# نمایش اطلاعات پایه
|
| 336 |
+
ConsoleUI.display_section_title("اطلاعات پایه", width=60)
|
| 337 |
+
ConsoleUI.display_message(f"سال: {game_state.current_year}", indent=2)
|
| 338 |
+
ConsoleUI.display_message(f"جمعیت: {format_number(game_state.population)} نفر", indent=2)
|
| 339 |
+
ConsoleUI.display_message(f"رشد جمعیت: {game_state.population_growth:.1f}%", indent=2)
|
| 340 |
+
ConsoleUI.display_message(f"نرخ سواد: {game_state.literacy_rate}%", indent=2)
|
| 341 |
+
ConsoleUI.display_message(f"شاخص سلامت: {game_state.health_index}", indent=2)
|
| 342 |
+
ConsoleUI.display_message(f"شادی مردم: {game_state.happiness}%", indent=2)
|
| 343 |
+
|
| 344 |
+
# نمایش اطلاعات اقتصادی
|
| 345 |
+
ConsoleUI.display_section_title("وضعیت اقتصادی", width=60)
|
| 346 |
+
ConsoleUI.display_message(f"سکه طلا: {format_number(game_state.gold)}", indent=2)
|
| 347 |
+
ConsoleUI.display_message(f"بودجه: مالیات={game_state.tax_rate}%", indent=2)
|
| 348 |
+
ConsoleUI.display_message(f"تجزیه بودجه:", indent=2)
|
| 349 |
+
for sector, percent in game_state.budget.items():
|
| 350 |
+
ConsoleUI.display_message(f"- {sector}: {percent}%", indent=4)
|
| 351 |
+
|
| 352 |
+
ConsoleUI.display_message(f"اقتصاد:", indent=2)
|
| 353 |
+
ConsoleUI.display_message(f"- تجارت: {game_state.economy['trade']}%", indent=4)
|
| 354 |
+
ConsoleUI.display_message(f"- کشاورزی: {game_state.economy['agriculture']}%", indent=4)
|
| 355 |
+
ConsoleUI.display_message(f"- صنعت: {game_state.economy['industry']}%", indent=4)
|
| 356 |
+
ConsoleUI.display_message(f"- تورم: {game_state.economy['inflation']}%", indent=4)
|
| 357 |
+
ConsoleUI.display_message(f"- بیکاری: {game_state.economy['unemployment']}%", indent=4)
|
| 358 |
+
ConsoleUI.display_message(f"- رشد GDP: {game_state.economy['gdp_growth']}%", indent=4)
|
| 359 |
+
|
| 360 |
+
# نمایش منابع
|
| 361 |
+
ConsoleUI.display_section_title("منابع طبیعی", width=60)
|
| 362 |
+
for resource, amount in game_state.resources.items():
|
| 363 |
+
ConsoleUI.display_message(f"{resource}: {amount}", indent=2)
|
| 364 |
+
|
| 365 |
+
ConsoleUI.wait_for_enter()
|
| 366 |
+
|
| 367 |
+
@staticmethod
|
| 368 |
+
def display_cultural_status(game_state):
|
| 369 |
+
"""نمایش وضعیت فرهنگی کشور"""
|
| 370 |
+
ConsoleUI.clear_screen()
|
| 371 |
+
ConsoleUI.display_section_title("وضعیت فرهنگی")
|
| 372 |
+
|
| 373 |
+
# نمایش اطلاعات فرهنگی
|
| 374 |
+
ConsoleUI.display_message(f"امتیاز فرهنگی: {game_state.culture_score}/100", indent=2)
|
| 375 |
+
ConsoleUI.display_message(f"نفوذ فرهنگی: {game_state.cultural_influence}%", indent=2)
|
| 376 |
+
ConsoleUI.display_message(f"زبان رسمی: {game_state.player_country.get('language', 'فارسی')}", indent=2)
|
| 377 |
+
|
| 378 |
+
# نمایش سطح فناوری فرهنگی
|
| 379 |
+
ConsoleUI.display_section_title("سطح فناوری فرهنگی", width=60)
|
| 380 |
+
ConsoleUI.display_message(f"ادبیات: {game_state.technology.get('literature', 1)}/5", indent=2)
|
| 381 |
+
ConsoleUI.display_message(f"هنر: {game_state.technology.get('art', 1)}/5", indent=2)
|
| 382 |
+
ConsoleUI.display_message(f"موسیقی: {game_state.technology.get('music', 1)}/5", indent=2)
|
| 383 |
+
ConsoleUI.display_message(f"معماری: {game_state.technology.get('architecture', 1)}/5", indent=2)
|
| 384 |
+
|
| 385 |
+
# نمایش فرهنگهای تحت تأثیر
|
| 386 |
+
ConsoleUI.display_section_title("کشورهای تحت تأثیر فرهنگی", width=60)
|
| 387 |
+
influenced_countries = [c for c, rel in game_state.relations.items()
|
| 388 |
+
if rel > 50 and c != game_state.player_country["name"]]
|
| 389 |
+
|
| 390 |
+
if influenced_countries:
|
| 391 |
+
for country in influenced_countries[:5]: # فقط 5 کشور اول
|
| 392 |
+
influence = min(100, 50 + (game_state.relations[country] - 50) * 2)
|
| 393 |
+
ConsoleUI.display_message(f"- {country}: {influence}%", indent=2)
|
| 394 |
+
else:
|
| 395 |
+
ConsoleUI.display_message("هیچ کشوری تحت تأثیر فرهنگی شما نیست.", indent=2)
|
| 396 |
+
|
| 397 |
+
ConsoleUI.wait_for_enter()
|
| 398 |
+
|
| 399 |
+
@staticmethod
|
| 400 |
+
def display_technology_tree(game_state):
|
| 401 |
+
"""نمایش درخت فناوری با پیشرفت فعلی"""
|
| 402 |
+
ConsoleUI.clear_screen()
|
| 403 |
+
ConsoleUI.display_section_title("درخت فناوری")
|
| 404 |
+
|
| 405 |
+
# نمایش سطح فناوری کلی
|
| 406 |
+
ConsoleUI.display_message(f"سطح فناوری کلی: {game_state.technology_level}", indent=2)
|
| 407 |
+
ConsoleUI.display_message(f"فناوری جاری در دست تحقیق: {game_state.current_research or 'هیچکدام'}", indent=2)
|
| 408 |
+
ConsoleUI.display_message(f"پیشرفت تحقیق: {game_state.research_progress}%", indent=2)
|
| 409 |
+
ConsoleUI.display_message(f"کارایی تحقیق: {game_state.research_efficiency:.1f}x", indent=2)
|
| 410 |
+
|
| 411 |
+
# نمایش دستهبندیهای فناوری
|
| 412 |
+
categories = ["military", "agriculture", "trade", "industry", "medicine", "education"]
|
| 413 |
+
for category in categories:
|
| 414 |
+
ConsoleUI.display_section_title(f"فناوریهای {category}", width=60)
|
| 415 |
+
|
| 416 |
+
# فیلتر فناوریها بر اساس دستهبندی
|
| 417 |
+
category_techs = [tech_id for tech_id, tech in TECHNOLOGIES.items()
|
| 418 |
+
if tech["category"] == category]
|
| 419 |
+
|
| 420 |
+
for tech_id in category_techs:
|
| 421 |
+
tech = TECHNOLOGIES[tech_id]
|
| 422 |
+
is_unlocked = tech_id in game_state.unlocked_technologies
|
| 423 |
+
|
| 424 |
+
status = Colors.SUCCESS + "آشکار شده" if is_unlocked else Colors.NEUTRAL + "مخفی"
|
| 425 |
+
symbol = "✓" if is_unlocked else "✗"
|
| 426 |
+
|
| 427 |
+
ConsoleUI.display_message(f"{symbol} {tech['name']} [{status}{Colors.NEUTRAL}]", indent=2)
|
| 428 |
+
ConsoleUI.display_message(f" {tech['description']}", indent=4)
|
| 429 |
+
|
| 430 |
+
ConsoleUI.wait_for_enter()
|
Shadows_of_Empires/utils/helpers.py
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
تابعهای کمکی پیشرفته برای بازی
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
def format_number(number):
|
| 6 |
+
"""فرمتبندی اعداد بزرگ برای نمایش خوانا"""
|
| 7 |
+
if number >= 1000000:
|
| 8 |
+
return f"{number//1000000}M"
|
| 9 |
+
elif number >= 1000:
|
| 10 |
+
return f"{number//1000}K"
|
| 11 |
+
else:
|
| 12 |
+
return str(number)
|
| 13 |
+
|
| 14 |
+
def format_percentage(value):
|
| 15 |
+
"""فرمتبندی درصدها برای نمایش خوانا"""
|
| 16 |
+
return f"{value}%"
|
| 17 |
+
|
| 18 |
+
def calculate_inflation_effect(inflation_rate):
|
| 19 |
+
"""محاسبه تأثیر تورم بر اقتصاد"""
|
| 20 |
+
return 1 - (inflation_rate / 100)
|
| 21 |
+
|
| 22 |
+
def calculate_population_growth(birth_rate, death_rate, migration_rate):
|
| 23 |
+
"""محاسبه رشد جمعیت بر اساس نرخهای مختلف"""
|
| 24 |
+
return (birth_rate - death_rate + migration_rate) / 10
|
| 25 |
+
|
| 26 |
+
def calculate_technology_progress(current_level, research_speed):
|
| 27 |
+
"""محاسبه پیشرفت فناوری"""
|
| 28 |
+
return min(100, current_level + research_speed)
|
| 29 |
+
|
| 30 |
+
def format_date(year, calendar_type="Gregorian"):
|
| 31 |
+
"""فرمتبندی تاریخ بر اساس نوع تقویم"""
|
| 32 |
+
if calendar_type == "Gregorian":
|
| 33 |
+
return f"{year} میلادی"
|
| 34 |
+
elif calendar_type == "Jalali":
|
| 35 |
+
return f"{year-621} شمسی"
|
| 36 |
+
elif calendar_type == "Islamic":
|
| 37 |
+
return f"{year-570} هجری قمری"
|
| 38 |
+
elif calendar_type == "Vikram Samvat":
|
| 39 |
+
return f"{year+57} ویکرام سمبات"
|
| 40 |
+
else:
|
| 41 |
+
return str(year)
|
| 42 |
+
|
| 43 |
+
def get_season(month, calendar_type="Gregorian"):
|
| 44 |
+
"""دریافت فصل بر اساس ماه و نوع تقویم"""
|
| 45 |
+
if calendar_type == "Gregorian":
|
| 46 |
+
if 3 <= month <= 5:
|
| 47 |
+
return "Spring"
|
| 48 |
+
elif 6 <= month <= 8:
|
| 49 |
+
return "Summer"
|
| 50 |
+
elif 9 <= month <= 11:
|
| 51 |
+
return "Autumn"
|
| 52 |
+
else:
|
| 53 |
+
return "Winter"
|
| 54 |
+
# سایر تقویمها را میتوان اضافه کرد
|
| 55 |
+
return "Unknown"
|
| 56 |
+
|
| 57 |
+
def calculate_military_strength(army, navy, tech_level):
|
| 58 |
+
"""محاسبه قدرت نظامی کلی"""
|
| 59 |
+
infantry_value = army["infantry"] * 0.5
|
| 60 |
+
cavalry_value = army["cavalry"] * 1.0
|
| 61 |
+
artillery_value = army["artillery"] * 1.5
|
| 62 |
+
navy_value = navy * 1.2
|
| 63 |
+
|
| 64 |
+
total = infantry_value + cavalry_value + artillery_value + navy_value
|
| 65 |
+
return int(total * (1 + tech_level * 0.1))
|
| 66 |
+
|
| 67 |
+
def calculate_cultural_influence(base_influence, diplomacy_points, cultural_tech):
|
| 68 |
+
"""محاسبه نفوذ فرهنگی"""
|
| 69 |
+
diplomacy_factor = 1 + (diplomacy_points * 0.05)
|
| 70 |
+
tech_factor = 1 + (cultural_tech * 0.1)
|
| 71 |
+
|
| 72 |
+
return min(100, int(base_influence * diplomacy_factor * tech_factor))
|
| 73 |
+
|
| 74 |
+
def calculate_religious_spread(base_influence, religious_tech, education_level):
|
| 75 |
+
"""محاسبه گسترش دین"""
|
| 76 |
+
tech_factor = 1 + (religious_tech * 0.08)
|
| 77 |
+
education_factor = 1 + (education_level * 0.05)
|
| 78 |
+
|
| 79 |
+
return min(100, int(base_influence * tech_factor * education_factor))
|
| 80 |
+
|
| 81 |
+
def get_environment_impact(pollution, deforestation, climate_impact):
|
| 82 |
+
"""دریافت تأثیر کلی محیط زیست"""
|
| 83 |
+
total_impact = pollution * 0.4 + deforestation * 0.3 + climate_impact * 0.3
|
| 84 |
+
if total_impact < 30:
|
| 85 |
+
return "Minimal"
|
| 86 |
+
elif total_impact < 60:
|
| 87 |
+
return "Moderate"
|
| 88 |
+
elif total_impact < 85:
|
| 89 |
+
return "Severe"
|
| 90 |
+
else:
|
| 91 |
+
return "Critical"
|
| 92 |
+
|
| 93 |
+
def calculate_crisis_severity(current_level, base_level, time_factor):
|
| 94 |
+
"""محاسبه شدت بحران"""
|
| 95 |
+
severity = current_level * (1 + time_factor * 0.1)
|
| 96 |
+
return min(100, int(severity))
|
| 97 |
+
|
| 98 |
+
def format_resource_amount(amount, resource_type):
|
| 99 |
+
"""فرمتبندی مقدار منابع با نمادهای ویژه"""
|
| 100 |
+
symbols = {
|
| 101 |
+
"food": "🌾",
|
| 102 |
+
"wood": "🌲",
|
| 103 |
+
"stone": "🪨",
|
| 104 |
+
"iron": "⛏️",
|
| 105 |
+
"gold": "💰",
|
| 106 |
+
"oil": "🛢️"
|
| 107 |
+
}
|
| 108 |
+
symbol = symbols.get(resource_type, "")
|
| 109 |
+
return f"{symbol} {amount}"
|
| 110 |
+
|
| 111 |
+
def get_happiness_level(happiness_score):
|
| 112 |
+
"""دریافت سطح شادی بر اساس امتیاز"""
|
| 113 |
+
if happiness_score >= 80:
|
| 114 |
+
return "عالی"
|
| 115 |
+
elif happiness_score >= 60:
|
| 116 |
+
return "خوب"
|
| 117 |
+
elif happiness_score >= 40:
|
| 118 |
+
return "متوسط"
|
| 119 |
+
elif happiness_score >= 20:
|
| 120 |
+
return "بد"
|
| 121 |
+
else:
|
| 122 |
+
return "بسیار بد"
|
| 123 |
+
|
| 124 |
+
def get_stability_level(stability_score):
|
| 125 |
+
"""دریافت سطح ثبات بر اساس امتیاز"""
|
| 126 |
+
if stability_score >= 80:
|
| 127 |
+
return "بسیار پایدار"
|
| 128 |
+
elif stability_score >= 60:
|
| 129 |
+
return "پایدار"
|
| 130 |
+
elif stability_score >= 40:
|
| 131 |
+
return "ناآرام"
|
| 132 |
+
elif stability_score >= 20:
|
| 133 |
+
return "ناپایدار"
|
| 134 |
+
else:
|
| 135 |
+
return "بحرانی"
|
| 136 |
+
|
| 137 |
+
def calculate_trade_value(base_value, relations, trade_tech):
|
| 138 |
+
"""محاسبه ارزش تجارت با توجه به عوامل مختلف"""
|
| 139 |
+
relations_factor = 1 + (relations / 100) * 0.5
|
| 140 |
+
tech_factor = 1 + (trade_tech * 0.05)
|
| 141 |
+
|
| 142 |
+
return int(base_value * relations_factor * tech_factor)
|
| 143 |
+
|
| 144 |
+
def get_technology_category_color(category):
|
| 145 |
+
"""دریافت رنگ دستهبندی فناوری"""
|
| 146 |
+
colors = {
|
| 147 |
+
"military": "\033[91m", # قرمز روشن
|
| 148 |
+
"agriculture": "\033[92m", # سبز روشن
|
| 149 |
+
"trade": "\033[93m", # زرد روشن
|
| 150 |
+
"industry": "\033[94m", # آبی روشن
|
| 151 |
+
"medicine": "\033[95m", # بنفش روشن
|
| 152 |
+
"education": "\033[96m", # فیروزهای روشن
|
| 153 |
+
"environment": "\033[92m", # سبز روشن
|
| 154 |
+
"communication": "\033[94m" # آبی روشن
|
| 155 |
+
}
|
| 156 |
+
return colors.get(category, "\033[0m") # رنگ پیشفرض
|
| 157 |
+
|
| 158 |
+
def format_technology_name(name, category):
|
| 159 |
+
"""فرمتبندی نام فناوری با رنگ دستهبندی"""
|
| 160 |
+
color = get_technology_category_color(category)
|
| 161 |
+
return f"{color}{name}\033[0m"
|
| 162 |
+
|
| 163 |
+
def get_military_unit_strength(unit_type, tech_level):
|
| 164 |
+
"""محاسبه قدرت واحد نظامی بر اساس نوع و سطح فناوری"""
|
| 165 |
+
base_strength = {
|
| 166 |
+
"infantry": 1.0,
|
| 167 |
+
"cavalry": 1.5,
|
| 168 |
+
"artillery": 2.0,
|
| 169 |
+
"navy": 1.2
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
return base_strength.get(unit_type, 1.0) * (1 + tech_level * 0.1)
|
| 173 |
+
|
| 174 |
+
def calculate_city_development(population, resources, technology):
|
| 175 |
+
"""محاسبه توسعه شهر بر اساس عوامل مختلف"""
|
| 176 |
+
population_factor = min(1.0, population / 1000000) * 50
|
| 177 |
+
resource_factor = sum(resources.values()) / 10
|
| 178 |
+
tech_factor = technology * 5
|
| 179 |
+
|
| 180 |
+
return min(100, int(population_factor + resource_factor + tech_factor))
|