|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+import random
|
|
|
2
|
+
|
|
|
3
|
+class Actions:
|
|
|
4
|
+ def __init__(self, game):
|
|
|
5
|
+ self.game = game
|
|
|
6
|
+
|
|
|
7
|
+ def _perform_action(self, action_name, description, cost, success_effect, failure_effect, success_chance, influence_required=0, success_policy=None):
|
|
|
8
|
+ print(f"Scenario: {description}")
|
|
|
9
|
+ if self.game.money < cost:
|
|
|
10
|
+ print(f"Not enough money to {action_name.lower()}.")
|
|
|
11
|
+ return
|
|
|
12
|
+ if self.game.influence < influence_required:
|
|
|
13
|
+ print(f"Not enough influence to {action_name.lower()}.")
|
|
|
14
|
+ return
|
|
|
15
|
+
|
|
|
16
|
+ self.game.money -= cost
|
|
|
17
|
+ if random.randint(1, 100) <= success_chance:
|
|
|
18
|
+ for key, value in success_effect.items():
|
|
|
19
|
+ setattr(self.game, key, getattr(self.game, key) + value)
|
|
|
20
|
+ if success_policy:
|
|
|
21
|
+ self.game.policies.append(success_policy)
|
|
|
22
|
+ print(f"Success! {description} was successful.")
|
|
|
23
|
+ else:
|
|
|
24
|
+ for key, value in failure_effect.items():
|
|
|
25
|
+ setattr(self.game, key, getattr(self.game, key) + value)
|
|
|
26
|
+ print(f"Failure! {description} was unsuccessful.")
|
|
|
27
|
+
|
|
|
28
|
+ def campaign(self):
|
|
|
29
|
+ self._perform_action(
|
|
|
30
|
+ action_name="Campaign",
|
|
|
31
|
+ description="Door-to-Door Campaigning",
|
|
|
32
|
+ cost=10,
|
|
|
33
|
+ success_effect={"public_support": 10},
|
|
|
34
|
+ failure_effect={"public_support": -5},
|
|
|
35
|
+ success_chance=60
|
|
|
36
|
+ )
|
|
|
37
|
+
|
|
|
38
|
+ def pass_legislation(self):
|
|
|
39
|
+ self._perform_action(
|
|
|
40
|
+ action_name="Pass Legislation",
|
|
|
41
|
+ description="Healthcare Reform Bill",
|
|
|
42
|
+ cost=20,
|
|
|
43
|
+ influence_required=30,
|
|
|
44
|
+ success_effect={"public_support": 20},
|
|
|
45
|
+ success_policy="Healthcare Reform Bill",
|
|
|
46
|
+ failure_effect={},
|
|
|
47
|
+ success_chance=100
|
|
|
48
|
+ )
|
|
|
49
|
+
|
|
|
50
|
+ def hold_rally(self):
|
|
|
51
|
+ self._perform_action(
|
|
|
52
|
+ action_name="Hold Rally",
|
|
|
53
|
+ description="Community Unity Rally",
|
|
|
54
|
+ cost=15,
|
|
|
55
|
+ success_effect={"public_support": 15},
|
|
|
56
|
+ failure_effect={"public_support": -5},
|
|
|
57
|
+ success_chance=70
|
|
|
58
|
+ )
|
|
|
59
|
+
|
|
|
60
|
+ def media_campaign(self):
|
|
|
61
|
+ print("Scenario: Media Campaign")
|
|
|
62
|
+ print("Choose the type of media campaign:")
|
|
|
63
|
+ print("1. Online (Facebook)")
|
|
|
64
|
+ print("2. Online (TikTok)")
|
|
|
65
|
+ print("3. Online (Twitter)")
|
|
|
66
|
+ print("4. Online (Instagram)")
|
|
|
67
|
+ print("5. Offline (TV, Radio, Newspapers)")
|
|
|
68
|
+ choice = input("Enter the number of your choice: ")
|
|
|
69
|
+
|
|
|
70
|
+ demographics_effect = {
|
|
|
71
|
+ "1": {"age": "young", "gender": "female", "education": "medium"},
|
|
|
72
|
+ "2": {"age": "young", "gender": "female", "education": "low"},
|
|
|
73
|
+ "3": {"age": "middle-aged", "gender": "male", "education": "high"},
|
|
|
74
|
+ "4": {"age": "young", "gender": "female", "education": "high"},
|
|
|
75
|
+ "5": {"age": "senior", "gender": "male", "education": "low"}
|
|
|
76
|
+ }
|
|
|
77
|
+
|
|
|
78
|
+ if choice in demographics_effect:
|
|
|
79
|
+ cost = 25
|
|
|
80
|
+ success_chance = random.randint(1, 100)
|
|
|
81
|
+
|
|
|
82
|
+ if self.game.money < cost:
|
|
|
83
|
+ print("Not enough money to launch a media campaign.")
|
|
|
84
|
+ return
|
|
|
85
|
+
|
|
|
86
|
+ self.game.money -= cost
|
|
|
87
|
+ if success_chance <= 80:
|
|
|
88
|
+ self.game.public_support += 25
|
|
|
89
|
+ dem = demographics_effect[choice]
|
|
|
90
|
+ self.game.supporters.increase_support(dem)
|
|
|
91
|
+ print(f"The {choice} campaign resonates with the public, increasing support by 25% and boosting support among {dem}.")
|
|
|
92
|
+ else:
|
|
|
93
|
+ self.game.public_support -= 10
|
|
|
94
|
+ print(f"The {choice} campaign backfires, leading to a decrease in support by 10%.")
|
|
|
95
|
+ else:
|
|
|
96
|
+ print("Invalid choice. Please try again.")
|
|
|
97
|
+
|
|
|
98
|
+ def fundraise(self):
|
|
|
99
|
+ print("Scenario: High-Profile Fundraiser Dinner")
|
|
|
100
|
+ print("You host an exclusive fundraiser dinner with influential donors and supporters.")
|
|
|
101
|
+ success_chance = random.randint(1, 100)
|
|
|
102
|
+
|
|
|
103
|
+ if success_chance <= 50:
|
|
|
104
|
+ funds_raised = random.randint(20, 50)
|
|
|
105
|
+ self.game.money += funds_raised
|
|
|
106
|
+ print(f"The event is a success, raising ${funds_raised}.")
|
|
|
107
|
+ else:
|
|
|
108
|
+ print("Poor attendance results in no funds being raised.")
|
|
|
109
|
+
|
|
|
110
|
+ def debate(self):
|
|
|
111
|
+ print("Scenario: Televised Debate with Opponent")
|
|
|
112
|
+ print("You participate in a live televised debate against a key opponent, addressing critical issues and defending your policies.")
|
|
|
113
|
+ opponent = random.choice(self.game.opponents)
|
|
|
114
|
+ success_chance = random.randint(1, 100)
|
|
|
115
|
+
|
|
|
116
|
+ if success_chance <= 50:
|
|
|
117
|
+ self.game.influence += 20
|
|
|
118
|
+ self.game.public_support += 10
|
|
|
119
|
+ print(f"You outshine your opponent, increasing influence by 20 and public support by 10%.")
|
|
|
120
|
+ else:
|
|
|
121
|
+ self.game.influence -= 10
|
|
|
122
|
+ self.game.public_support -= 5
|
|
|
123
|
+ print(f"The debate goes poorly, decreasing influence by 10 and public support by 5% as voters favor {opponent}'s arguments.")
|
|
|
124
|
+
|
|
|
125
|
+ def set_tax_policy(self):
|
|
|
126
|
+ print("Scenario: Set Tax Policy")
|
|
|
127
|
+ new_tax_rate = int(input("Enter the new tax rate (0-100): "))
|
|
|
128
|
+ if 0 <= new_tax_rate <= 100:
|
|
|
129
|
+ self.game.tax_rate = new_tax_rate
|
|
|
130
|
+ print(f"Tax rate set to {self.game.tax_rate}%.")
|
|
|
131
|
+ if new_tax_rate > 30:
|
|
|
132
|
+ self.game.public_support -= 10
|
|
|
133
|
+ print("High tax rate decreases public support by 10%.")
|
|
|
134
|
+ elif new_tax_rate < 10:
|
|
|
135
|
+ self.game.public_support += 10
|
|
|
136
|
+ print("Low tax rate increases public support by 10%.")
|
|
|
137
|
+ else:
|
|
|
138
|
+ print("Invalid tax rate. Please enter a value between 0 and 100.")
|
|
|
139
|
+
|
|
|
140
|
+ def invest_in_sector(self):
|
|
|
141
|
+ print("Scenario: Invest in a Sector")
|
|
|
142
|
+ sectors = ["Infrastructure", "Education", "Healthcare"]
|
|
|
143
|
+ print(f"Sectors available for investment: {', '.join(sectors)}")
|
|
|
144
|
+ sector_choice = input("Enter the sector you want to invest in: ")
|
|
|
145
|
+
|
|
|
146
|
+ if sector_choice in sectors:
|
|
|
147
|
+ investment_amount = int(input("Enter the amount you want to invest: "))
|
|
|
148
|
+ if self.game.money >= investment_amount:
|
|
|
149
|
+ self.game.money -= investment_amount
|
|
|
150
|
+ self.game.gdp += investment_amount * 1.5 # Example multiplier
|
|
|
151
|
+ self.game.unemployment_rate -= 1 # Reduce unemployment
|
|
|
152
|
+ print(f"Invested ${investment_amount} in {sector_choice}. GDP increased by ${investment_amount * 1.5} and unemployment rate decreased.")
|
|
|
153
|
+ else:
|
|
|
154
|
+ print("Not enough money to invest.")
|
|
|
155
|
+ else:
|
|
|
156
|
+ print("Invalid sector choice.")
|
|
|
157
|
+
|
|
|
158
|
+ def allocate_military_budget(self):
|
|
|
159
|
+ print("Scenario: Allocate Military Budget")
|
|
|
160
|
+ additional_budget = int(input("Enter the additional military budget (0-100): "))
|
|
|
161
|
+ if 0 <= additional_budget <= self.game.money:
|
|
|
162
|
+ self.game.money -= additional_budget
|
|
|
163
|
+ self.game.military_budget += additional_budget
|
|
|
164
|
+ self.game.military_strength += additional_budget // 2 # Example conversion rate
|
|
|
165
|
+ print(f"Allocated an additional ${additional_budget} to the military budget. Military strength increased by {additional_budget // 2}.")
|
|
|
166
|
+ else:
|
|
|
167
|
+ print("Invalid budget allocation. Please enter a value within your available money.")
|
|
|
168
|
+
|
|
|
169
|
+ def opponent_friction(self):
|
|
|
170
|
+ actions = [
|
|
|
171
|
+ ("Negative Campaign", "Your opponent launches a negative campaign against you. Public support decreases by 10%.", -10, 0, 0),
|
|
|
172
|
+ ("Political Sabotage", "Your opponent sabotages your fundraising event. You raise no money.", 0, 0, -1),
|
|
|
173
|
+ ("Influence Loss", "Your opponent spreads rumors, reducing your influence. Influence decreases by 15%.", 0, -15, 0)
|
|
|
174
|
+ ]
|
|
|
175
|
+ action = random.choice(actions)
|
|
|
176
|
+ print(f"Opponent Action: {action[0]}")
|
|
|
177
|
+ print(f"{action[1]}")
|
|
|
178
|
+ self.game.public_support += action[2]
|
|
|
179
|
+ self.game.influence += action[3]
|
|
|
180
|
+ if action[0] == "Political Sabotage":
|
|
|
181
|
+ return False # Indicate that fundraising failed due to sabotage
|
|
|
182
|
+ return True
|
|
|
183
|
+
|
|
|
184
|
+ def foreign_interference(self):
|
|
|
185
|
+ actions = [
|
|
|
186
|
+ ("Russia", "Russia interferes with your campaign, spreading disinformation and causing distrust among voters. Public support decreases by 15%.", -15, 0, 0),
|
|
|
187
|
+ ("China", "China launches a cyber-attack on your campaign infrastructure, reducing your influence. Influence decreases by 20%.", 0, -20, 0),
|
|
|
188
|
+ ("Foreign Sabotage", "Opposition countries collaborate to sabotage your fundraising event. You raise no money.", 0, 0, -1)
|
|
|
189
|
+ ]
|
|
|
190
|
+ action = random.choice(actions)
|
|
|
191
|
+ print(f"Foreign Interference: {action[0]}")
|
|
|
192
|
+ print(f"{action[1]}")
|
|
|
193
|
+ self.game.public_support += action[2]
|
|
|
194
|
+ self.game.influence += action[3]
|
|
|
195
|
+ if action[0] == "Foreign Sabotage":
|
|
|
196
|
+ return False # Indicate that fundraising failed due to sabotage
|
|
|
197
|
+ return True
|
|
|
198
|
+
|