Skip to content

Commit

Permalink
Modified: Player __init__ to improve scripting (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
signebedi committed Jun 15, 2023
1 parent 155fcaa commit 5c4c4f2
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions src/coliseum/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from colorama import Fore, Back, Style

class Player:
def __init__(self):
def __init__(self, headless=False, ask_load_game=True, player_name=None):

colorama.init(autoreset=True)

Expand All @@ -15,10 +15,12 @@ def __init__(self):
' | |___| |__| | |____ _| |_ ____) | |____| |__| | | | |',
' \_____\____/|______|_____|_____/|______|\____/|_| |_|',
]

if not headless:

for item in header: print(item)

for item in header: print(item)

print('\nThe great Greek hero, Hercules, is inviting you to fight in his new golden coliseum! He is growing old, and wishes to see one last fight before he is laid to rest. He hashundreds of fighters from both Greece and Rome, that have all trained heavily their entire life - just like you! You will have to battle gladiators and knights alike, and it won\'t be easy! Armed with a bronze dagger, you will take on all the foes before you! Good luck, young fighter. You will need it!')
print('\nThe great Greek hero, Hercules, is inviting you to fight in his new golden coliseum! He is growing old, and wishes to see one last fight before he is laid to rest. He hashundreds of fighters from both Greece and Rome, that have all trained heavily their entire life - just like you! You will have to battle gladiators and knights alike, and it won\'t be easy! Armed with a bronze dagger, you will take on all the foes before you! Good luck, young fighter. You will need it!')

self.lvl = 1
self.xp = 0
Expand All @@ -35,11 +37,22 @@ def __init__(self):
self.kills = 0
self.victories = []

if os.path.exists("save.pickle"):
if ask_load_game and os.path.exists("save.pickle"):
load_game = input('\nDo you want to load a save file? (yes, no; defaults to no)\n')
if load_game == 'yes': self.load()
else: self.name = input('\nWhat is your character\'s name?\n> ')
else: self.name = input('\nWhat is your character\'s name?\n> ')
if load_game == 'yes':
self.load()
else:
if not player_name:
self.name = input('\nWhat is your character\'s name?\n> ')
else:
self.name = player_name


else:
if not player_name:
self.name = input('\nWhat is your character\'s name?\n> ')
else:
self.name = player_name

def input(self):
i = input('\nWhat would you like to do next? (type "help" for options)\n> ')
Expand Down

0 comments on commit 5c4c4f2

Please sign in to comment.