from monster import Monster from player import Player # Main game # Create your player object, each player has a companion laura = Player() print("Your monster is called " + laura.companion_name()) laura.companion.status() print("------------------") # Create a monster to fight opponent = Monster() print( "Your opponent is a monster called " + opponent.get_name()) end_game = False while end_game == False: move = laura.get_action() laura.do_action(move, opponent) print("opponent" + str(opponent.is_alive())) print("you" + str(laura.companion.is_alive())) if opponent.is_alive() and laura.companion.is_alive(): opponent.fight(laura) else: end_game = True
# Check for death. if enemy.is_dead(): #The player has won. game_end("You won!") elif action == "2": # Do a especial attack. player.special_attack(enemy) # Check for death. if enemy.is_dead(): #The player has won. game_end("You won!") elif action == "3": game_end("You just surrendered. Too bad! Waluigi time!") # Enemy's turn. enemy.attack(player) enemy_last_action = "\n\tThe " + enemy.get_name() + " attacked!\n" # Check for death. if player.is_dead(): # The player has lost. game_end("You lost. Try again.") turn_count += 1