Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.60 KB | None | 0 0
  1. # This a test game (BETA)
  2. # Copyright Amir
  3.  
  4. from time import sleep
  5.  
  6.  
  7. coins = 5000
  8. soldiers = 1000
  9. countries = 1
  10.  
  11. commands = ["help", "balance", "soldiers", "territory", "buy"]
  12.  
  13. first_time_balance = 0
  14.  
  15.  
  16. def start():
  17. print()
  18. print("This game is currently in BETA.")
  19. print()
  20. print("NOTE: On yes or no questions, say Y for yes, and N for no.")
  21. print()
  22. name = input("Hello, what's your name? ")
  23. print("Welcome,", name + ".")
  24. print("")
  25. sleep(1.5)
  26. print("""
  27. Your planet is called Utakis.
  28. There are 5 countries on your planet:
  29. - Plotus
  30. - Rakus
  31. - Kares
  32. - Tetrus
  33. - Yipis
  34. You are the king of Plotus.
  35. You have to conquer all the countries.
  36. You gain coins by conquering parts of countries (each country has 3 parts).
  37. You can buy more soldiers with those coins.
  38. You also get soldiers when you win fights, but you lose some when you lose those fights.
  39. You win fights when you have more soldiers then the enemy.
  40. You can't know how many soldiers the enemy has!""")
  41. print()
  42.  
  43. play = input("Do you want to play this game? ")
  44. if play == "Y":
  45. begin_game()
  46. elif play == "N":
  47. print("Okay, bye!")
  48.  
  49.  
  50. def begin_game():
  51. print()
  52. print("""
  53. Here is the control box.
  54. You can write commands such as 'balance' or 'help'.
  55. Write 'balance' to check how much coins you have:""")
  56. control_box()
  57.  
  58.  
  59. def control_box():
  60. global first_time_balance
  61.  
  62. command = input("")
  63. if command == commands[0]:
  64. print("""
  65. help: shows this page.
  66. balance: shows how much coins you have.
  67. soldiers: shows how many soldiers you have.
  68. territory: shows how much you expanded your country.
  69. buy: go to the shop.""")
  70. control_box()
  71.  
  72. elif command == commands[1]:
  73. print("You have", coins, "coins.")
  74. print()
  75. first_time_balance += 1
  76. if first_time_balance == 1:
  77. achievement("Use balance for the first time.", 1000)
  78. control_box()
  79.  
  80. elif command == commands[2]:
  81. print("You have", soldiers, "soldiers.")
  82. print()
  83. control_box()
  84.  
  85. elif command == commands[3]:
  86. print("You have", countries, "countries.")
  87. print()
  88. control_box()
  89.  
  90. elif command == commands[4]:
  91. shop()
  92.  
  93. else:
  94. print("Error: type help to show all the commands.")
  95. print()
  96. control_box()
  97.  
  98. def achievement(name, reward):
  99. global coins
  100. sleep(0.5)
  101. print("You just got an achievement:", name)
  102. coins += reward
  103. print("+", reward, "coins!")
  104. print()
  105.  
  106.  
  107. def shop():
  108. global soldiers
  109. global coins
  110. print("""
  111. You can buy:
  112. 1 - Soldiers (100 soldiers for 200 coins)""")
  113. buy_item = str(input("""
  114. Type the number you see before an item to buy this item.
  115. Type 'EXIT' to exit the shop.
  116.  
  117. """))
  118.  
  119. if coins <= 0:
  120. coins = 0
  121. print("You have 0 coins, so you were put back to the control box.")
  122. print()
  123. control_box()
  124. elif buy_item == "1":
  125. if coins < 200:
  126. print("Error: you don't have enough coins.")
  127. shop()
  128. soldiers += 100
  129. print("You now have", soldiers, "soldiers.")
  130. coins -= 200
  131. print("You now have", coins, "coins.")
  132. sleep(0.5)
  133. shop()
  134. elif buy_item == "EXIT":
  135. control_box()
  136. else:
  137. print("Error: incorrect typing.")
  138. shop()
  139.  
  140.  
  141. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement