Exemplo n.º 1
0
def game_loop():
    creatures = [
        SmallAnimal('Toad', 1),
        Creature('Tiger', 12),
        SmallAnimal('Bat', 3),
        Dragon('Dragon', 50, 100, True),
        Creature('Evil Wizard', 1000)
    ]
    # print(creatures)
    hero = Wizard('Gandolf', 75)
    while True:
        active_creature = random.choice(creatures)
        cmd = input("Do you [a]ttack, [r]unaway, or [l]ook around?")

        if cmd == 'a':
            if hero.attack(active_creature):
                creatures.remove(active_creature)
            else:
                print("The wizard runs and hides taking time to recover...")
                time.sleep(5)
                print("The wizard returns revitalized!")
        elif cmd == 'r':
            print('The wizard has become unsure of his power and flees!')
        elif cmd == 'l':
            print("The wizard {} takes in the surroundings and sees...".format(hero.name))
            for c in creatures:
                print("* A {} of level {}".format(c.name, c.level))
        else:
            print("Ok, Existing game.... Bye!!!!")
            break
        if not creatures:
            print("You've defeated all the wizards, well done!")
            break
Exemplo n.º 2
0
def run_game_loop():

    creatures = [
        Creature('Toad', 1),
        Creature('Tiger', 12),
        Creature('Dragon', 100),
        Creature('Bat', 3),
        Creature('Evil Wizard', 50)
    ]

    wizard = Wizard('Dunder', 75)

    while True:

        for i in creatures:
            print('Creature import: {}'.format(i))

        cmd = input(
            'Wizard has 3 options: [l]ook around, [a]ttack, [r]un away!')

        if cmd == 'l':
            print('Wizard looked around...')
        elif cmd == 'a':
            print('Wizard attacked!')
        elif cmd == 'r':
            print('Wizard runs...')
        else:
            print('Wizard exits!')
            break
Exemplo n.º 3
0
def game_loop():
    creatures = [
        Creature('Bat', 5),
        Creature('Toad', 1),
        Creature('Tiger', 12),
        Dragon('Black Dragon', 50, scaliness=2, breathes_fire=False),
        Wizard('Evil Wizard', 1000)
    ]

    hero = Wizard('Gandalff', 75)

    while True:
        active_creature = random.choice(creatures)

        print(
            f'A {active_creature.name} of {active_creature.level} has arrived from the forest.'
        )
        selection = input(
            'What do you want to do? attack (a), run away (r), look around (l): '
        )

        if selection == 'a':
            if hero.attack(active_creature):
                creatures.remove(active_creature)
                print(f'{hero.name} defeated {active_creature.name}.')
        elif selection == 'r':
            print(f'Wizard {hero.name} ran away safely.')
        elif selection == 'l':
            print(f'Wizard {hero.name} looks around and sees the following:')
            for c in creatures:
                print(c.name)
        else:
            print('Exiting the game....Bye')
            break
Exemplo n.º 4
0
def game_loop():

    creatures = [
        Dragon('Golden Dragon', 14, True),
        Creature('Hobbit', 1),
        Creature('Bat', 15),
        Creature('Evil Wizard', 100),
    ]

    hero = Wizard('James', 9)

    while True:

        active_creature = random.choice(creatures)
        print('A {} of level {} has appears'.format(active_creature.name,
                                                    active_creature.level))

        cmd = input('Do you [a]ttack, [r]un, or [c]heck? ')
        if cmd == 'a':
            if hero.attack(active_creature):
                creatures.remove(active_creature)
            else:
                time.sleep(5)
                print('Zzzzz you some how rest and recover from your injuries')
        elif cmd == 'r':
            print('run forest run')
        elif cmd == 'c':
            print('you look blindly around')
            for c in creatures:
                print(' A {} of level {}'.format(c.name, c.level))
        else:
            break
Exemplo n.º 5
0
def game_loop():
    creatures = [
        Creature("Bat", 5),
        Creature("Toad", 1),
        Creature("Tiger", 12),
        Dragon("Dragon", 50, scaliness=2, breathes_fire=False),
        Wizard("Evil Wizard", 100),
    ]
    hero = Wizard("Gandolf", 75)
    while True:
        # randomly choose a creature
        active_creature = random.choice(creatures)
        print("A {} of level {} has appeared".format(active_creature.name,
                                                     active_creature.level))
        cmd = input("Do you [a] attack, [r]unaway, or [l]ook around? ")
        if cmd == "a":
            if hero.attack(active_creature):
                creatures.remove(active_creature)
                print("{} defeated the {}!".format(hero.name,
                                                   active_creature.name))
        elif cmd == "r":
            print("{} flees!".format(hero.name))
        elif cmd == "l":
            print("{} looks around and sees:".format(hero.name))
            for c in creature:
                print("* {} of level {}".format(c.name, c.level))
        else:
            print("Exiting game")
            break
        if not creatures:
            print("You've defeated all of the creatures")
            break
def game_loop():

    creatures = [
        Creature('Toad', 1),
        Creature('Tiger', 12),
        Creature('Bat', 3),
        Creature('Dragon', 50),
        Creature('Evil Wizard', 1000),
    ]
    print(creatures)
    hero = Wizard('Gandolf', 75)

    while True:
        active_creature = random.choice(creatures)
        print('A {} of level {} has appeared from a dark and foggy forest...'.
              format(active_creature.name, active_creature.level))
        print('')
        cmd = input('Do you [a]ttack, [r]unaway, or [l]ook around?: ')
        if cmd == 'a':
            if hero.attack(active_creature):
                creatures.remove(active_creature)
            else:
                print('The wizard runs and hides taking time to recover...')
                print('The wizard returns revitalized')
        elif cmd == 'r':
            print('runaway')
        elif cmd == 'l':
            print('lookaround')
        else:
            print('OK, exiting game...bye homie!')
            break
        print()
Exemplo n.º 7
0
def game_loop():
	creatures = [
		Creature('Bat', 5),
		Creature('Toad', 1),
		Creature('Tiger', 12),
		# based on the order, you could just said 2 after 50 but just to be safe,
		# define it directly
		Dragon('Black Dragon', 50, scaliness=2, breathes_fire=False),
		# WHY IN THE WORLD WOULD YOU MAKE A WIZARD THAT IS SO HIGH A LVL THAT IT'S IMPOSSIBLE TO BEAT??
		# Wizard('Evil Wizard(aka Merlin)', 1000)
		Wizard('Evil Wizard(aka Merlin)', 100)
	]

	hero = Wizard('Gandolf', 75)

	"""
	let's make the game loop a little forgiving because it's possible that
	because it's possible that someone will accidentally hit the wrong key, so give
	the player three chances to hit a playable key, it's a global variable because
	while the game may be forgiving, it tells you the playable commends during the 
	game loop so you only have so many non renewable chances
	"""

	miss_counter = 3

	while True:
		# randomly select an oppenent creature
		active_creature = random.choice(creatures)

		# READY TO PLAY A GAME??
		# let the oppenent know what their oppnent in the game is
		print('A {} of level {} has appeared from a dark and foggy forrest...\n'.format(active_creature.name, active_creature.level))

		# get the player's input commands to interact in the game
		cmd = input('Do you [a]ttack, [r]unaway, or [l]ook around?')
		# depending on the options, this is what you're going to do
		if cmd == 'a':
			if hero.attack(active_creature):
				creatures.remove(active_creature)
				print("The wizard has defeated {}".format(active_creature.name))
			else:
				print("The wizard has been defeated by the powerful {}".format(active_creature.name))
		elif cmd == "r":
			print('The wizard has become unsure of his power and flees!!!')
		elif cmd == 'l':
			print('The wizard {} takes in the surroundings and sees:'.format(hero.name))
			for c in creatures:
				print(" * {} of level {}".format(c.name,c.level))
		else:
			miss_counter-=1
			print('You have {} attempts left to input a valid command before the game exits.'.format(miss_counter))
			if miss_counter == 0:
				print("OK, exiting the game...bye!")
				break

		if not creatures:
			print("You've defeated all the creatures, well done!")
			break

		print()
def game_loopb():
    creatures = [
        Pawns(' THe LOw level Security', 4),
        Creature('SHa', 5),
        Creature('Sharleen', 30),
        Pawns('The whITE-ARmy', 6),
        FBI('FBI', 18, 25, True),
        FBIsnitch('Nesto', 4, 12, False),
        Pawnscum('SoulTravler', 16, 20, True),
        RightHand('Cannavale', 20, 40, True),
        Hacker('BLACK Violet', 408),
        Hacker('Rell', 205)
    ]

    hero = Hacker('LE', 300)

    while True:

        active_creature = random.choice(creatures)
        print('{} of Terminal stats {} pulls into focus out of the !!!'.format(
            active_creature.name, active_creature.level))
        print()

        cmd = input(
            'Do you [Hack]Attack, MR[roboto], or Reading[white papers]? ')
        if cmd == 'Hack':
            if hero.attack(active_creature):
                creatures.remove(active_creature)
            else:
                print("LEs vision comes into focus............")
                time.sleep(12)
                print("a moment of clarity!")
        elif cmd == 'roboto':
            print('Mr.Roboto takes control of LE !!!')
        elif cmd == 'white papers':
            print('I {} Time to do some research!!!:'.format(hero.name))
            for c in creatures:
                print(' * {} of level {}'.format(c.name, c.level))
        else:
            print('YOu have Beeeeeeeeeeeen owned............... Late!!')
            break

        if not creatures:
            print(
                "'LE,'No matter what I do, Black Violet Seems to be ahead, as if for seen..... "
                " What will come of us!!!")
            print()
            print()
            print()
            print()
            print("How Will this un-rap next!!!!!!!!!!!!!!!!!!!!!!")
            break

        print()
Exemplo n.º 9
0
def game_loop():
    """
    Receives input from the command line to determine which action to take. Once all the
    creatures have been successfully photographed, exits the game loop.
    """

    # This list contains all the creatures to photograph
    creatures = [
        # Base type object
        Creature('Sloth', 1),
        # Sub type object
        SmallAnimal('Tree frog', 6),
        Creature('Chimpanzee', 20),
        CamouflagedAnimal('Zebra', 45, 2, False),
        CamouflagedAnimal('Cheetah', 80, 6, False),
        CamouflagedAnimal('Chameleon', 2, 10, True)
    ]
    # Humans also inherit from the base type Creature
    photographer = Human('Lucas', 80)

    while True:
        # Randomly choose the active creature from the creatures left in the List
        active_creature = random.choice(creatures)
        # Print the creature's information using inherited fields name and speed
        print(f'A {active_creature.name} with a speed of {active_creature.speed} has emerged from the jungle...')

        # Prompt the user to select an action to take
        action = input('Do you [p]hotograph, [r]eposition, or [l]ook around?')
        if action == 'p':
            if photographer.photograph(active_creature):
                # Taking a picture succeeded, remove that creature from the list
                creatures.remove(active_creature)
            else:
                # Taking a picture failed, sleep for 5 seconds before prompting the user again
                print("You've been spotted! You get up and move to a different position.")
                time.sleep(5)
                print('You settle in with your camera at the ready.')
        elif action == 'r':
            # Print a repositioning message and loop again
            print("You're not sure you can get a clear picture, so you get up and reposition yourself.")
        elif action == 'l':
            # Print everything still present in the creatures list
            print(f'The photographer {photographer.name} scans the area and spots:')
            for c in creatures:
                print(f' * A {c.name} with a speed of {c.speed}')
        else:
            # If something else is entered, assume the user wants to quit
            print('Exiting game')
            break

        if not creatures:
            # All creatures have been photographed and removed from the List. The game has been won.
            print("You've photographed all the creatures! Congratulations!")
            break
 def _setup_creatures(self):
     try:
         self.creatures = [
             Creature("Bat", 5),
             Creature("Toad", 1),
             Creature("Tiger", 12),
             Dragon("Black Dragon", 50, scaliness=2, breaths_fire=False),
             Wizard("Evil wizard", 1000),
         ]
     except TypeError as e:
         print(f"There was a problem creating the creatures")
         raise e
Exemplo n.º 11
0
def game_loop():

    creatures = [
        SmallAnimal('Toad', 1),
        Creature('Tiger', 12),
        SmallAnimal('Bat', 3),
        Dragon('Dragon', 50, 75, True),
        Wizard('Evil Wizard', 1000),
        Creature('birb', 90),
    ]

    print(creatures)

    hero = Wizard('Gandalf', 75)

    while True:

        active_creature = random.choice(creatures)

        print(
            'A {} of f level {} has apppeared from a dark and foggy forest...'.
            format(active_creature.name, active_creature.level))
        print()

        cmd = input('Do you [a]ttack, [r]unaway or [l]ook around? ')
        cmd = cmd.lower()

        if cmd == 'a':
            if hero.attack(active_creature):
                creatures.remove(active_creature)
            else:
                print('The wizard runs and hides taking time to recover...')
                time.sleep(5)
                print('The wizard returns revitalized!')
                # print("Game over.")
                # break
        elif cmd == 'r':
            print('The wizard flees!')
        elif cmd == 'l':
            print('The wizard {} takes in the surroundings and sees:'.format(
                hero.name))
            for c in creatures:
                print(' * A {} of level {}'.format(c.name, c.level))
        else:
            print('OK. Exiting game... bye!')
            break

        if not creatures:
            print('You defeated all the creatures!')
            break

        print()
Exemplo n.º 12
0
def game_loop():
    creatures = [
        Creature('Bat', 5),
        Creature('Toad', 1),
        Creature('Tiger', 12),
        Dragon('Black Dragon', 50, scaliness=2, breathes_fire=False),
        Wizard('Evil Wizard', 1000),
    ]

    hero = Wizard("Gandalf", 75)

    while True:

        # Randomly choose a creature
        active_creature = random.choice(creatures)

        print(
            f"A {active_creature.name} of level {active_creature.level} has appeared from a dark and foggy forest..."
        )
        print()

        cmd = input('Do you [a]ttack, [r]un away, or [l]ook around? ')

        if cmd == 'a':
            if hero.attack(active_creature):
                creatures.remove(active_creature)
                print(f'The wizard defeated {active_creature.name}')

            else:
                print("The wizard has been defeated...temporarily")

            print()

        elif cmd == 'r':
            print('The wizard has become unsure of his power and flees!!')
            print()

        elif cmd == 'l':
            print(
                f'The wizard {hero.name} takes in the surroundings and sees:')
            for c in creatures:
                print(f"* {c.name} of level {c.level}")
            print()

        else:
            print("OK, exiting the game...bye!")
            break

        if not creatures:
            print("You've defeated all the creatures, well done!")
            break
Exemplo n.º 13
0
def game_loop():
    creatures = [
        Creature(),
        Creature(),
        Creature(),
        Creature(),
        Creature(),
        Creature(),
        Creature(),
        Creature(),
    ]

    hero = Wizard()

    while True:

        cmd = input('Do you [a]ttack, [r]unaway, or [l]ook around? ')

        if cmd == 'a':
            print('attack ')
        elif cmd == 'r':
            print('runaway ')
        elif cmd == 'l':
            print('Look Around ')
        else:
            print('OK, exiting the Game.... bye!')
            break
Exemplo n.º 14
0
def game_loop():
    creatures = [
        Creature('Toad', 1),
        Creature('Tiger', 12),
        Creature('Bat', 3),
        Creature('Dragon', 50),
        Creature('Evil Wizard', 1000),
    ]
    hero = Player('Gandolf', 75)
    while True:
        active_creature = choice(creatures)
        print(f'A {active_creature.name} of level {active_creature.level} has appeared from a dark and foggy forest...')
        print()

        cmd = input('Do you [a]ttack, [r]unaway, or [l]ook around? ')
        if cmd == 'a':
            print(f'The hero has {hero.hp} hit points')
            print(f'The {active_creature.name} has {active_creature.hp} hit points')
            while hero.is_alive() and active_creature.is_alive() and input('Continue? (y/n)').strip().lower() == 'y':
                hero.attack(active_creature)
                if not active_creature.is_alive():
                    print(f'The wizard has killed the {active_creature.name}')
                    creatures.remove(active_creature)
                    break

                active_creature.attack(hero)
                if not hero.is_alive():
                    print(f'The wizard was killed by the {active_creature.name}')
                    hero.heal(hero.max_hp)
                    break

                print(f'The hero has {hero.hp} hit points')
                print(f'The {active_creature.name} has {active_creature.hp} hit points')

        elif cmd == 'r':
            hero.heal(hero.max_hp)
            print(f'The wizard has healed')
        elif cmd == 'l':
            print(f'The wizard {hero.name} takes in the surroundings and sees:')
            for c in creatures:
                print(f' * A {c.name} of level {c.level}')
        else:
            print('Ok, exiting game... bye!')
            break

        if not creatures:
            print('You have defeated all the creates, well done!')
            break

        print()
Exemplo n.º 15
0
def game_loop():
    player = Wizard('Wizardy Boy', 50)
    creatures = [
        SmallCreature('Rat', 1),
        Creature('Golem', 20),
        Dragon('Dragon (His name is Freddy)', 70, 20, True),
        Wizard('Evil Wizardy Boy', 200)
    ]
    current_enemy = random.choice(creatures)

    while True:
        print('You encounter a terrifying {}!'.format(current_enemy.name))
        action = input('Do you want to [A]ttack, [L]ook around or [R]un away?')
        action = action.lower()
        if action == 'a':
            result = player.attack(current_enemy)
            if result:
                print('You win buddy!')
                current_enemy = random.choice(creatures)
            else:
                print('You dead.')
                break

        elif action == 'l':
            print('You look around and see:')
            for c in creatures:
                print(c.name)

        elif action == 'r':
            print('You run away from the {}!'.format(current_enemy))
            current_enemy = random.choice(creatures)

        else:
            print('Bye forever!')
            break
Exemplo n.º 16
0
def game_loop():
    creatures = [
        Creature('Bat', 5),
        Creature('Toad', 1),
        Creature('Tiger', 12),
        Dragon('Black Dragon', 50, scaliness=2, breaths_fire=False),
        Wizard('Evil wizard', 1000),
    ]

    hero = Wizard('Gandolf', 75)

    while True:

        active_creature = random.choice(creatures)

        print('A {} of level {} has appear from a dark and foggy forest...'.
              format(active_creature.name, active_creature.level))
        print()

        cmd = input('Do you [a]ttack, [r]unaway, or [l]ook around? ')

        try:
            if cmd == 'a':
                if hero.attack(active_creature):
                    creatures.remove(active_creature)
                    print("The wizard defeated {}".format(
                        active_creature.name))
                else:
                    print(
                        "The wizard has been defeat by the powerful {}".format(
                            active_creature.name))
            elif cmd == 'r':
                print('The wizard has become unsure of his power and flees!!!')
            elif cmd == 'l':
                print(
                    'The wizard {} takes in the surroundings and sees:'.format(
                        hero.name))
                for c in creatures:
                    print(" * {} of level {}".format(c.name, c.level))
        except ValueError:
            print('Please enter "a", "r", or "l".')

        if not creatures:
            print("You've defeated all the creatures, well done!")
            break

        print()
def game_loop():
    creatures = {[
        Creature('Bat', 5),
        Creature('Toad', 1),
        Creature('Tiger', 12),
        Dragon('Black Dragon', 50, scaliness=2, breaths_fire=False),
        Wizard('Evil wizard', 1000)
    ]}

    hero = Wizard('Gandolf', 75)

    while True:

        active_creature = random.choice(creatures)

        print('A {} of level {} has appear from a dark and foggy forest...'.
              format(active_creature.name, active_creature.level))
        print()

        cmd = input('Do you [a]ttack, [r]unaway, or [l]ook around?')
        if cmd == 'a':
            if hero.attack(active_creature):
                print(f"The wizard defeated {active_creature.name}")
            else:
                print(
                    f"The wizard has been defeated by the powerful {active_creature.name}"
                )
        elif cmd == 'r':
            print('The wizard has become unsure of his power and flees!!!')
        elif cmd == 'l':
            print('The wizard {} takes in the surroundings and sees:'.format(
                hero.name))
            for c in creatures:
                print(f" * {c.name} of level {c.level}")
        else:
            print("Ok, exiting the game... bye!")
            break

        if not creatures:
            print("You've defeated all the creatures, well done!")
            break
            print()

        # ask use for action

    print("Good bye")
Exemplo n.º 18
0
def game_loop():
    creatures = [
        Creature('Bat', 5),
        Creature('Toad', 1),
        Creature('Tiger', 12),
        Dragon('Black Dragon', 50, scaliness=2, breaths_fire=False),
        Wizard('Evil wizard', 1000)
    ]

    hero = Wizard('Gandolf', 75)

    while True:

        # Randomly choose a creature
        # random.choice will randomly choose a value from a collection object
        active_creature = random.choice(creatures)

        print('A {} of level {} has appeared from a dark and foggy forest...'.
              format(active_creature.name, active_creature.level))
        print()

        cmd = input('Do you [a]ttack, [r]unaway, or [l]ook around? ')
        if cmd == 'a':
            if hero.attack(active_creature):
                print("The wizard defeated {}!".format(active_creature.name))
            else:
                print(
                    "The wizard has been defeated by the powerful {}!!".format(
                        active_creature.name))
        elif cmd == 'r':
            print('The wizard has become unsure of his power and flees!!!')
        elif cmd == 'l':
            print('The wizard {} takes in the surroundings and sees:'.format(
                hero.name))
            for c in creatures:
                print(" * {} level of {}".format(c.name, c.level))
        else:
            print("Ok, exiting game... bye!")
            break

        if not creatures:
            print("You've defeated all the creatures, well done!")
            break

        print()
Exemplo n.º 19
0
def game_loop(player_name):

    creatures = [
        SmallAnimal('Toad', 1),
        Creature('Tiger', 12),
        SmallAnimal('Bat', 3),
        Dragon('Dragon', 50, scaliness=20, breaths_fire=True),
        Dragon('Blue Dragon', 50, scaliness=100, breaths_fire=False),
        Wizard('Evil Wizard', 1000)
    ]

    hero = Wizard(player_name, 75)

    while True:

        active_creature = random.choice(creatures)

        print()
        print('A level {} {} has appeared from a dark and foggy forest ...'.
              format(active_creature.level, active_creature.name))

        cmd = input(
            '[Level {}] Do you [a]ttack, [r]un away , [t]rain, [l]ook around, or E[x]it game: '
            .format(hero.level)).rstrip().lower()
        if cmd == 'a':
            if hero.attack(active_creature):
                creatures.remove(active_creature)
            else:
                print('The wizard runs and hides taking time to recover ...')
                time.sleep(5)
                print('The wizard returns well rested.')
        elif cmd == 'r':
            print('The wizard {} has become unsure of his powers and flees'.
                  format(hero.name))
        elif cmd == 'l':
            print('The wizard {} takes in the surroundings and sees:'.format(
                hero.name))
            for c in creatures:
                print(' * A {} of level {}'.format(c.name, c.level))
        elif cmd == 't':
            print(
                'The wizard {} takes two sticks and waves them saying random phrases:'
                .format(hero.name))
            hero.train()
        elif cmd == 'x':
            print('OK exiting game ... goodbye!')
            break
        else:
            print('Try again, unknown command!')

        if not creatures:
            print()
            print('*************************************************')
            print('You have defeated all your enemies, well done {}'.format(
                hero.name))
            break
Exemplo n.º 20
0
def game_loop():

    creatures = [
        SmallAnimal('Toad', 1),
        Creature('Tiger', 12),
        Creature('Bat', 3),
        Dragon('Dragon', 50, 75, True),
        Wizard('Evil Wizard', 100),
    ]

    hero = Wizard('Gandolf', 75)

    while True:

        active_creature = random.choice(creatures)
        print()
        print('A {} of level {} has appeared from a dark and foggy forest...'
              .format(active_creature.name, active_creature.level))
        print()

        cmd = input('Do you [a]ttack, [r]unaway, or [l]ook around? ')
        if cmd == 'a':
            if hero.attack(active_creature):
                creatures.remove(active_creature)
            else:
                print("The wizard runs and hides taking time to recover...")
                time.sleep(5)
                print("The wizard returns revitalized!")
        elif cmd == 'r':
            print('The wizard has become unsure of his power and flees!!!')
        elif cmd == 'l':
            print('The wizard {} takes in the surroundings and sees:'.format(hero.name))
            for c in creatures:
                print(' * A {} of level {}'.format(c.name, c.level))
            print()
        else:
            print("Ok, exiting game... bye!")
            break

        if not creatures:
            print("You've defeated all the creatures, well done!")
            break
def game_loop():

    creatures = [
        SmallAnimal('Toad', 1),
        Creature('Tiger', 12),
        SmallAnimal('Bat', 3),
        Dragon('Dragon', 50, False),
        Dragon('Dragon', 50, True),
        Creature('Evil Wizard', 1000)
    ]

    hero = Wizard('Gandolf', 75)

    while True:
        active_creature = random.choice(creatures)
        print(f'A {active_creature} has appear from a dark and a foggy forest...')
        command = input('Do you [a]ttack, [r]unaway, or [l]ook around? ')

        if command == 'a':
            if hero.attack(active_creature):
                creatures.remove(active_creature)
            else:
                print('The wizard runs and hides taking time to recover')
                time.sleep(5)
                print('The wizard returns revitalized!')

        elif command == 'r':
            print('The wizard has becomes unsure of his power and flees!')

        elif command == 'l':
            print(f'The wizard {hero.name} takes in the surrounding and sees: ')
            for creature in creatures:
                print(creature)

        else:
            print('OK, exiting game..... bye!')
            break

        print()
        if not creatures:
            print('You defeated all creatures! you WON!')
            break
Exemplo n.º 22
0
def game_loop():
    creatures = [
        Creature('Bat', 5),
        Creature('Toad', 1),
        Creature('Tiger', 12),
        Dragon('Black Dragon', 50, scaliness=2, breaths_fire=False),
        Wizard('Evil Wizard', 1000)

    ]

    hero = Wizard('Gandalf', 75)

    while True:
        # randomly choose a creature

        active_creature = random.choice(creatures)

        print('A {} of level {} has appeared from the dark and foggy forest...'.format(active_creature.name, active_creature.level))
        print()

        cmd = input('Do you [a]ttack, [r]unaway, or [l]ook around? ')
        if cmd == 'a':
            if hero.attack(active_creature):
                creatures.remove(active_creature)
                print('The Wizard {} has eliminated the {}'.format(hero.name, active_creature.name))
                print('There are {} creatures to defeat.'.format(len(creatures)))
            else:
                print('The wizard has been defeated by a powerful a {}.'.format(active_creature.name))
        elif cmd == 'r':
            print('The wizard {} has become unsure of his powers and flees...'.format(hero.name))
        elif cmd == 'l':
            print('The wizard {} takes in the surroundings and sees: '.format(hero.name))
            for c in creatures:
                print('* {} of level {}.'.format(c.name, c.level))
            print('--\n')
        else:
            print('OK, exiting game....bye!')

        if not creatures:
            print('You  have defeated all the creatures, well done!')
            break
Exemplo n.º 23
0
def game_loop():
    creatures = [
        Creature('Bat', 5),
        Creature('Toad', 1),
        Creature('Tiger', 12),
        Dragon('Red Dragon', 50, 10, True),
        Wizard('Evil Wizard', 1000),
    ]

    print(creatures)

    hero = Wizard('Gandolf', 75)
    while True:
        active_creature = random.choice(creatures)

        print(f'A {active_creature.name} of level {active_creature.level} has appear from a dark and foggy forest...')
        print()

        cmd = input('Do you [a]ttack, [r]unaway, or [l]ook around? ').lower()

        if cmd == 'a':
            if hero.attack(active_creature):
                creatures.remove(active_creature)
                print(f'The Wizard defeated {active_creature.name}')
            else:
                print(f'The Wizard has been defeated by the powerfull {active_creature.name}')
        elif cmd == 'r':
            print('The wizard has become unsure of his power and flees!!!')
        elif cmd == 'l':
            print(f'The wizard {hero.name} takes in the surroundings and sees:')
            for c in sorted(creatures):
                print(f'* {c.name} of level {c.level}')
        else:
            print('OK, exiting the game... bye!')
            break

        if not creatures:
            print("You've defeated all the creatures, well done!")
            break

        print()
Exemplo n.º 24
0
def game_loop():
    creatures = [
        Creature('Todaa', 1),
        Creature('Tiger', 12),
        Creature('Bat', 3),
        Creature('Draggon', 50),
        Creature('Evil Wizard', 1000)
    ]
    # print(creatures)
    hero = Wizard('Gandeoof', 75)

    while True:

        active_creature = random.choice(creatures)
        print('A {} of level {} has appeared  from a forest....'.format(
            active_creature.name, active_creature.level))
        print()

        cmd = input('Do you [a]ttack. [r]unaway, or [l]ook around ? ')
        if cmd == 'a':
            if hero.attack(active_creature):
                creatures.remove(active_creature)
            else:
                print("The wizard runs and hides for recovery ")
                time.sleep(5)
                print("The wizard Returns ")

        elif cmd == 'r':
            print('runaway')
        elif cmd == 'l':
            print("The Wizard {} takes in the surroundings and sees: ".format(
                hero.name))
            for c in creatures:
                print(" * A {} of level {}".format(c.name, c.level))
        else:
            print('OK, existing the game')
            break

        print()
def game_loopa():
    creatures = [
        Pawns(' THe LOw level Security', 4),
        Creature('Sharleen', 30),
        Pawns('The whITE-ARmy', 6),
        FBI('FBI', 18, 25, True),
        Hacker('BLACK Violet', 404)
    ]

    hero = Hacker('LE', 187)

    while True:

        active_creature = random.choice(creatures)
        print('{} of cmd stats {} creeps from the silicon of the DarkWeb!!!'.
              format(active_creature.name, active_creature.level))
        print()

        cmd = input(
            'Do you [Hack]Attack, MR[roboto], or Reading[white papers]? ')
        if cmd == 'Hack':
            if hero.attack(active_creature):
                creatures.remove(active_creature)
            else:
                print("LE Hacks time, reset his own history.............")
                time.sleep(5)
                print("LE Flashes back into existence!")
        elif cmd == 'roboto':
            print('Mr.Roboto takes control of LE !!!')
        elif cmd == 'white papers':
            print('I {} Time to do some research!!!:'.format(hero.name))
            for c in creatures:
                print(' * {} of level {}'.format(c.name, c.level))
        else:
            print('YOu have Beeeeeeeeeeeen owned............... Late!!')
            break

        if not creatures:
            print(
                "MR.Roboto has destructed HELLcORP!!! We never Forget, We know no limits, We will find you. "
                " Game over Clowns!!!")
            print()
            print()
            print()
            print()
            print(
                "Bonsoir LE, hope to catch up with you next level!!!!!!!!!!!!!!!!!!!!!!"
            )
            break

        print()
Exemplo n.º 26
0
def game_loop():
    creatures = [
        Creature('Bat', 5),
        Creature('Toad', 1),
        Creature('Tiger', 12),
        Creature('Dragon', 15),
        Creature('Wizard', 50)
    ]
    print(creatures)
    hero = None  # TODO: Create our hero

    while True:
        # Randomly choose a creature
        activate_creature = None

        print(
            f'A {1*1} of level {1*2} has appear from a dark and foggy forest...'
        )

        print()

        cmd = input('Do you [a]ttack, [r]unaway, or [l]ook around? ')
        if cmd == 'a':
            # TODO: Attack
            pass

        elif cmd == 'r':
            print('The wizard has become unsure of his power and flees!!!')
        elif cmd == 'l':
            print('The wizard {hero.name} takes in the surroundings and sees:')
            # TODO: Show the creatures in the room
        else:
            print("OK, exiting game... bye!")
            break
        if not creatures:
            print("You've defeated all creatures, well done")
            break
    print('Goodbye')
def game_loop():

    creatures = [
        Creature('bat', 1),
        Creature('toad', 5),
        Creature('tiger', 12),
        Creature('Dragon', 50),
        Creature('Evil Wizard', 1000)
    ]

    hero = Wizard('Krondor', 75)

    #print(creatures)

    while True:

        baddy = random.choice(creatures)
        print("A level {} {} has appeared".format(baddy.level, baddy.name))

        cmd = input('Would you like to [a]ttack, [l]ook around, or [r]unaway?')
        cmd = cmd.lower()

        if cmd == 'a':
            if hero.attack(baddy):
                creatures.remove(baddy)
            else:
                print("The wizard must meditate.")
                time.sleep(3)
                print("The wizard recovers.")
        elif cmd == 'l':
            print('looking around')
        elif cmd == 'r':
            print('running away')
        else:
            print('Exiting')
            break

        print()
Exemplo n.º 28
0
def game_loop():

    creatures = [
        Creature("Toad", 1),
        Creature("Tiger", 12),
        Creature("Bat", 3),
        Creature("Dragon", 50),
        Creature("Evil Wizard", 1000),
    ]

    hero = Wizard("Alouris", 75)

    while True:
        cmd = input("Do you [a]ttack, [r]un away, or [l]ook around? ")
        if cmd == "a":
            print("attack")
        elif cmd == "r":
            print("run away")
        elif cmd == "l":
            print("look around")
        else:
            print("OK, exiting!")
            break
def game_loop():
    creatures = [
        Creature('Bat', 5, 5),
        Creature('Bat', 5, 5),
        Creature('Toad', 1, 1),
        Creature('Toad', 1, 1),
        Creature('Tiger', 12, 12),
        Creature('Tiger', 12, 12),
        Dragon('Black Dragon', 50, 50, scaliness=2, breaths_fire=False),
        Dragon('Red Dragon', 50, 50, scaliness=1, breaths_fire=True),
        Wizard('Evil wizard', 150, 150),
    ]

    hero = create_hero()

    while True:

        active_creature = random.choice(creatures)

        print('A {} of level {} appears from a dark and foggy forest...'
              .format(active_creature.name, active_creature.level))
        print()

        cmd = input('Do you [a]ttack, [r]unaway, or [l]ook around? ')
        if cmd == 'a':
            if hero.attack(active_creature):
                creatures.remove(active_creature)
                hero.level_up()
                hero.update_experience(active_creature)
                print("The wizard {} defeated {}".format(hero.name, active_creature.name))
            else:
                print("The wizard {} has been hurt by the powerful {}".format(hero.name, active_creature.name))
                if hero.health <= 0:
                    print("The hero {} has perished!".format(hero.name))
                    cmd = input('Do you wish to play again: [y]es or [no]?')
                    if cmd == 'y':
                        main()
                    else:
                        break
        elif cmd == 'r':
            print('The wizard {} has become unsure of his power and flees!!!'.format(hero.name))
        elif cmd == 'l':
            print('The wizard {} takes in the surroundings and sees:'
                  .format(hero.name))
            for c in creatures:
                print(" * {} of level {}".format(
                    c.name, c.level
                ))
        else:
            print("OK, exiting game... bye!")
            break

        if not creatures:
            print("You've defeated all the creatures, well done!")
            break

        print()
Exemplo n.º 30
0
def game_loop():

    creatures = [
        Creature('Toad', 1),
        Creature('Tiger', 3),
        Creature('Bat', 3),
        Creature('Dragon', 50),
        Creature('Evil Wizard', 1000),
    ]

    hero = Wizard('Gandalf', 75)

    while True:

        active_creature = random.choice(creatures)
        print()
        print('A {} of level {} has appeared from a dark and foggy forest...'.
              format(active_creature.name, active_creature.level))
        print()

        cmd = input('Do you [a]ttack, [r]unaway, or [l]ook around? ')
        if cmd == 'a':
            if hero.attack(active_creature):
                creatures.remove(active_creature)
            else:
                print("Wizard hides...")
                time.sleep(5)
                print("wizard returns!")
        elif cmd == 'r':
            print('runaway')
        elif cmd == 'l':
            print('The wizard {} looks around:'.format(hero.name))
            for c in creatures:
                print(f' * A {c.name} of level {c.level}')
        else:
            print('OK, exiting game...bye!')
            break