暂无描述

events.py 1.5KB

123456789101112131415161718192021222324252627282930313233
  1. import random
  2. class Events:
  3. def __init__(self, game):
  4. self.game = game
  5. def random_event(self):
  6. events = [
  7. ("Economic Boom", "Your country experiences an economic boom. Public support increases by 10%.", 10, 0, 10, 200, -1),
  8. ("Scandal", "A scandal erupts involving your campaign. Public support decreases by 15%.", -15, 0, -15, 0, 0),
  9. ("Foreign Policy Win", "You achieve a major foreign policy victory. Influence increases by 20%.", 0, 20, 0, 0, 0),
  10. ("Natural Disaster", "A natural disaster strikes. You lose $30 in relief efforts.", -30, 0, -10, -100, 1),
  11. ("Military Conflict", "A military conflict arises requiring immediate attention.", 0, 0, -20, 0, 0),
  12. ("Opponent Friction", "An opponent takes action against you.", 0, 0, -10, 0, 0),
  13. ("Foreign Interference", "A foreign country interferes with your campaign.", 0, 0, -10, 0, 0)
  14. ]
  15. event = random.choice(events)
  16. print(f"Random Event: {event[0]}")
  17. print(f"{event[1]}")
  18. self.game.money += event[2]
  19. self.game.influence += event[3]
  20. self.game.public_support += event[4]
  21. self.game.gdp += event[5]
  22. self.game.unemployment_rate += event[6]
  23. if event[0] == "Military Conflict":
  24. self.game.handle_conflict()
  25. elif event[0] == "Opponent Friction":
  26. self.game.opponent_friction()
  27. elif event[0] == "Foreign Interference":
  28. self.game.foreign_interference()