diff options
| -rw-r--r-- | rpg.py | 80 |
1 files changed, 48 insertions, 32 deletions
| diff --git a/rpg.py b/rpg.py index d8cbb47..72c1118 100644 --- a/rpg.py +++ b/rpg.py | |||
| @@ -19,8 +19,9 @@ name = input("What is your name, Traveler? ") | |||
| 19 | # welcome them | 19 | # welcome them |
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | print(f"Welcome to the game, {name}, I wish you the best of luck!") | 22 | print(f"Welcome to the kingdom, {name}, I wish you the best of luck!") |
| 23 | 23 | ||
| 24 | # troll | ||
| 24 | 25 | ||
| 25 | answer = input("Do you wish to proceed further? ") | 26 | answer = input("Do you wish to proceed further? ") |
| 26 | 27 | ||
| @@ -29,6 +30,7 @@ if answer.lower() == "no": | |||
| 29 | print("Well then, off you go!") | 30 | print("Well then, off you go!") |
| 30 | exit() | 31 | exit() |
| 31 | 32 | ||
| 33 | # classes | ||
| 32 | 34 | ||
| 33 | print("Choose your class!") | 35 | print("Choose your class!") |
| 34 | print("1. Knight") | 36 | print("1. Knight") |
| @@ -56,6 +58,8 @@ while valid_class == False: | |||
| 56 | player_class = 3 | 58 | player_class = 3 |
| 57 | else: | 59 | else: |
| 58 | print("That isn't a class!") | 60 | print("That isn't a class!") |
| 61 | |||
| 62 | # set stats | ||
| 59 | 63 | ||
| 60 | if player_class == 1: | 64 | if player_class == 1: |
| 61 | print("health - 150") | 65 | print("health - 150") |
| @@ -76,6 +80,8 @@ elif player_class == 3: | |||
| 76 | print("damage - 90") | 80 | print("damage - 90") |
| 77 | player_damage = 90 | 81 | player_damage = 90 |
| 78 | 82 | ||
| 83 | # small little thing to give player items | ||
| 84 | |||
| 79 | alchemist_shop = False | 85 | alchemist_shop = False |
| 80 | 86 | ||
| 81 | 87 | ||
| @@ -100,6 +106,8 @@ while alchemist_shop == False: | |||
| 100 | else: | 106 | else: |
| 101 | print("That isn't an option!") | 107 | print("That isn't an option!") |
| 102 | 108 | ||
| 109 | # define battle function bc we're gonna need that maybe. | ||
| 110 | |||
| 103 | def battle(enemy_name, enemy_health, enemy_damage): | 111 | def battle(enemy_name, enemy_health, enemy_damage): |
| 104 | global player_health | 112 | global player_health |
| 105 | global inventory | 113 | global inventory |
| @@ -117,6 +125,7 @@ def battle(enemy_name, enemy_health, enemy_damage): | |||
| 117 | print("3. Run") | 125 | print("3. Run") |
| 118 | battle_selection = (input("> ")) | 126 | battle_selection = (input("> ")) |
| 119 | 127 | ||
| 128 | # fight | ||
| 120 | 129 | ||
| 121 | if battle_selection.lower() in ["1", "fight"]: | 130 | if battle_selection.lower() in ["1", "fight"]: |
| 122 | damage = random.randint( | 131 | damage = random.randint( |
| @@ -127,6 +136,7 @@ def battle(enemy_name, enemy_health, enemy_damage): | |||
| 127 | print(f"You dealt {damage} to {enemy_name}") | 136 | print(f"You dealt {damage} to {enemy_name}") |
| 128 | print(f"{enemy_name} has {enemy_health} HP remaining!") | 137 | print(f"{enemy_name} has {enemy_health} HP remaining!") |
| 129 | 138 | ||
| 139 | # items (my finest work) | ||
| 130 | 140 | ||
| 131 | elif battle_selection.lower() in ["2", "item"]: | 141 | elif battle_selection.lower() in ["2", "item"]: |
| 132 | if not inventory: | 142 | if not inventory: |
| @@ -186,6 +196,7 @@ def battle(enemy_name, enemy_health, enemy_damage): | |||
| 186 | itemselected = True | 196 | itemselected = True |
| 187 | break | 197 | break |
| 188 | continue | 198 | continue |
| 199 | # troll more (run) | ||
| 189 | elif battle_selection.lower() in ["3", "run"]: | 200 | elif battle_selection.lower() in ["3", "run"]: |
| 190 | print("You can't run, idiot.") | 201 | print("You can't run, idiot.") |
| 191 | player_health = player_health - 15 | 202 | player_health = player_health - 15 |
| @@ -194,7 +205,7 @@ def battle(enemy_name, enemy_health, enemy_damage): | |||
| 194 | print("Not an option!") | 205 | print("Not an option!") |
| 195 | continue | 206 | continue |
| 196 | 207 | ||
| 197 | 208 | # enemy attacks | |
| 198 | if enemy_health > 0: | 209 | if enemy_health > 0: |
| 199 | 210 | ||
| 200 | 211 | ||
| @@ -207,7 +218,7 @@ def battle(enemy_name, enemy_health, enemy_damage): | |||
| 207 | 218 | ||
| 208 | player_health = player_health - enemy_attack | 219 | player_health = player_health - enemy_attack |
| 209 | 220 | ||
| 210 | 221 | # check if you died like a pleb | |
| 211 | if player_health <= 0: | 222 | if player_health <= 0: |
| 212 | print("You died!") | 223 | print("You died!") |
| 213 | exit() | 224 | exit() |
| @@ -219,13 +230,13 @@ def battle(enemy_name, enemy_health, enemy_damage): | |||
| 219 | 230 | ||
| 220 | print(f"You have {player_health} HP Remaining!") | 231 | print(f"You have {player_health} HP Remaining!") |
| 221 | 232 | ||
| 222 | 233 | # actually run the battle fnct | |
| 223 | battle("Goblin", 125, 15) | 234 | battle("Goblin", 125, 15) |
| 224 | 235 | ||
| 225 | 236 | ||
| 226 | import random | 237 | import random |
| 227 | 238 | ||
| 228 | 239 | # money | |
| 229 | player_gold = random.randint(150, 250) | 240 | player_gold = random.randint(150, 250) |
| 230 | 241 | ||
| 231 | 242 | ||
| @@ -241,6 +252,7 @@ print("Down the path was a little shop. You stop inside.") | |||
| 241 | print("Spend your gold here!") | 252 | print("Spend your gold here!") |
| 242 | print("What would you like to buy?") | 253 | print("What would you like to buy?") |
| 243 | 254 | ||
| 255 | # add shop func | ||
| 244 | def shop(): | 256 | def shop(): |
| 245 | global player_gold | 257 | global player_gold |
| 246 | road_shop = False | 258 | road_shop = False |
| @@ -285,7 +297,7 @@ def shop(): | |||
| 285 | else: | 297 | else: |
| 286 | print("Not an option!") | 298 | print("Not an option!") |
| 287 | 299 | ||
| 288 | 300 | # let the player get items | |
| 289 | shop() | 301 | shop() |
| 290 | 302 | ||
| 291 | 303 | ||
| @@ -295,7 +307,7 @@ print("He asks if you want to know about the path ahead of you.") | |||
| 295 | 307 | ||
| 296 | manquestion = input("yes or no? ") | 308 | manquestion = input("yes or no? ") |
| 297 | 309 | ||
| 298 | 310 | # story stuff | |
| 299 | if manquestion.lower() == "yes": | 311 | if manquestion.lower() == "yes": |
| 300 | print("The man tells you about a powerful Ogre down the path a little while.") | 312 | print("The man tells you about a powerful Ogre down the path a little while.") |
| 301 | print("You feel as if you will cross paths with that monster.") | 313 | print("You feel as if you will cross paths with that monster.") |
| @@ -308,7 +320,7 @@ else: | |||
| 308 | 320 | ||
| 309 | print("You come across a bridge. There's a seemingly evil presence under it. Will you investigate or not.") | 321 | print("You come across a bridge. There's a seemingly evil presence under it. Will you investigate or not.") |
| 310 | 322 | ||
| 311 | 323 | # prompt for more money | |
| 312 | bridgelook = input("yes or no ") | 324 | bridgelook = input("yes or no ") |
| 313 | 325 | ||
| 314 | if bridgelook.lower() == "yes": | 326 | if bridgelook.lower() == "yes": |
| @@ -327,13 +339,13 @@ else: | |||
| 327 | 339 | ||
| 328 | print("You felt a sense of unease rise onto your back. You turn and a goblin ambushes you!") | 340 | print("You felt a sense of unease rise onto your back. You turn and a goblin ambushes you!") |
| 329 | 341 | ||
| 330 | 342 | # more battle | |
| 331 | battle("Strong Goblin", 300, 40) | 343 | battle("Strong Goblin", 300, 40) |
| 332 | 344 | ||
| 333 | 345 | ||
| 334 | print("The strong goblin falls beneath your strength. He gives you a permanent health upgrade.") | 346 | print("The strong goblin falls beneath your strength. He gives you a permanent health upgrade.") |
| 335 | 347 | ||
| 336 | 348 | # give player more hp for later things | |
| 337 | if player_class == 1: | 349 | if player_class == 1: |
| 338 | print("Your max HP increased to 350") | 350 | print("Your max HP increased to 350") |
| 339 | max_player_health = 350 | 351 | max_player_health = 350 |
| @@ -350,10 +362,10 @@ elif player_class == 3: | |||
| 350 | player_health = max_player_health | 362 | player_health = max_player_health |
| 351 | print("Your HP was also fully restored!") | 363 | print("Your HP was also fully restored!") |
| 352 | 364 | ||
| 353 | 365 | # make it so that the hpup affects items | |
| 354 | hpup1 = True | 366 | hpup1 = True |
| 355 | 367 | ||
| 356 | 368 | # story | |
| 357 | print("You press on going forawrd.") | 369 | print("You press on going forawrd.") |
| 358 | print() | 370 | print() |
| 359 | print() | 371 | print() |
| @@ -365,7 +377,7 @@ print("Be a monster?") | |||
| 365 | print("1. Yes.") | 377 | print("1. Yes.") |
| 366 | print("2. No.") | 378 | print("2. No.") |
| 367 | 379 | ||
| 368 | 380 | # ask if the player wants to fight and impossible fight | |
| 369 | brutality = input("> ") | 381 | brutality = input("> ") |
| 370 | 382 | ||
| 371 | 383 | ||
| @@ -377,7 +389,7 @@ if brutality.lower() == "yes": | |||
| 377 | print() | 389 | print() |
| 378 | print("You encounter the dreadful Ogre. Be prepared.") | 390 | print("You encounter the dreadful Ogre. Be prepared.") |
| 379 | print("He judges you a distasteful stain of this world. Good luck.") | 391 | print("He judges you a distasteful stain of this world. Good luck.") |
| 380 | battle("Ogre", 1500, 60) | 392 | battle("Enraged Ogre", 9999999999, 100) |
| 381 | 393 | ||
| 382 | 394 | ||
| 383 | elif brutality.lower() == "no": | 395 | elif brutality.lower() == "no": |
| @@ -385,27 +397,31 @@ elif brutality.lower() == "no": | |||
| 385 | print("She runs off into the wilderness.") | 397 | print("She runs off into the wilderness.") |
| 386 | 398 | ||
| 387 | 399 | ||
| 388 | if manquestion.lower() == "yes": | 400 | if manquestion.lower() == "yes": |
| 389 | print("You come across the Ogre that the strange man told you about.") | 401 | print("You come across the Ogre that the strange man told you about.") |
| 390 | print("He thanks you for gifting his friend a flower.") | 402 | print("He thanks you for gifting his friend a flower.") |
| 391 | print() | 403 | print() |
| 392 | elif manquestion.lower() == "no": | 404 | elif manquestion.lower() == "no": |
| 393 | print("You come across an Ogre") | 405 | print("You come across an Ogre") |
| 394 | print("He thanks you for gifting his friend a flower.") | 406 | print("He thanks you for gifting his friend a flower.") |
| 395 | 407 | ||
| 396 | print("Attack the Ogre in fear?") | 408 | # hard fight? |
| 397 | print("Yes.") | ||
| 398 | print("No.") | ||
| 399 | ogrefight = input("> ") | ||
| 400 | 409 | ||
| 410 | print("Attack the Ogre in fear?") | ||
| 411 | print("Yes.") | ||
| 412 | print("No.") | ||
| 413 | ogrefight = input("> ") | ||
| 401 | 414 | ||
| 402 | if ogrefight.lower() in ["1", "yes"]: | 415 | # good luckkk |
| 403 | print("You swing at the Ogre. He initates a fight.") | ||
| 404 | battle("Ogre", 850, 60) | ||
| 405 | player_gold = player_gold + random.randint(500, 700) | ||
| 406 | elif ogrefight.lower() in ["2", "no"]: | ||
| 407 | print("You carry on down the path.") | ||
| 408 | print("Good choice.") | ||
| 409 | 416 | ||
| 417 | if ogrefight.lower() in ["1", "yes"]: | ||
| 418 | print("You swing at the Ogre. He initates a fight.") | ||
| 419 | battle("Ogre", 850, 60) | ||
| 420 | player_gold = player_gold + random.randint(500, 700) | ||
| 421 | # boring | ||
| 422 | elif ogrefight.lower() in ["2", "no"]: | ||
| 423 | print("You carry on down the path.") | ||
| 424 | print("Good choice.") | ||
| 410 | 425 | ||
| 426 | # atp the player wants or needs more items depending on their choices, so let em have it. | ||
| 411 | shop() | 427 | shop() |
