def set_up(self): self.player = Character() self.monsters = [ Goblin(), Goblin(), Goblin(), Goblin(), Goblin(), Troll(), Troll(), Troll(), Troll(), Dragon() ] self.monster = self.get_next_monster()
def setup(self): self.player = Character() self.monsters = [ Goblin(), Goblin(), Goblin(), Troll(), Troll(), Goblin(), Troll(), Troll(), Dragon() ] self.monster = self.get_next_monster() print("An angry {} {} steps forward!".format( self.monster.color.title(), self.monster.__class__.__name__))
def setup(self): print('=' * 60) print("Hack 'n Slash: The ultimate battle between human and monster!") print('=' * 60) self.player = Character() self.monsters = [Goblin(), Troll(), Dragon()] self.monster = self.get_next_monster()
def setup(self): self.player = Character() self.monsters = [ Goblin(), Troll(), Dragon() ]
def setup(self): self.new = Character() self.monsters = [ Imp(), Goblin(), Bandit() ]
def setup(self): self.player = Character() # this will trigger name and weapon selection self.monsters = [ Goblin(), Troll(), Dragon() ] self.monster = self.get_next_monster()
def setup(self): # setup will allow game to run at start each time self.player = Character() # Will set up player and prompt for name and weapon self.monsters = [ # Total monsters Goblin(), Troll(), Dragon() ] self.monster = self.get_next_monster() # Monster currently being battled.
def setup(self): debug.log('Setting up!') self.player = Char() self.monsters = [ Goblin(), Troll(), Orge(), Dragon() ] self.monster = self.get_next_monster()
def setup(self): print('\n') print( " _ .-') .-') _ .-') .-') _ ('-. _ .-') .-') ('-. .-') .-') _ " ) print( "( '.( OO )_ ( OO ) ) ( OO ). ( OO) ) _( OO)( \( -O ) .( OO) _( OO) ( OO ). ( OO) ) " ) print( " ,--. ,--.).-'),-----. ,--./ ,--,' (_)---\_)/ '._(,------.,------. (_)---\_) ,--. ,--. (,------.(_)---\_)/ '._ " ) print( " | `.' |( OO' .-. '| \ | |\ / _ | |'--...__)| .---'| /`. ' ' .-. ' | | | | | .---'/ _ | |'--...__) " ) print( " | |/ | | | || \| | )\ :` `. '--. .--'| | | / | | ,| | | | | | | .-') | | \ :` `. '--. .--' " ) print( " | |'.'| |\_) | |\| || . |/ '..`''.) | | (| '--. | |_.' | (_| | | | | |_|( OO )(| '--. '..`''.) | | " ) print( " | | | | \ | | | || |\ | .-._) \ | | | .--' | . '.' | | | | | | | `-' / | .--' .-._) \ | | " ) print( " | | | | `' '-' '| | \ | \ / | | | `---.| |\ \ ' '-' '-.(' '-'(_.-' | `---.\ / | | " ) print( " `--' `--' `-----' `--' `--' `-----' `--' `------'`--' '--' `-----'--' `-----' `------' `-----' `--' " ) print('\n') self.player = Character() print('\n' + '-=' * 30 + '-') print("Instructions:") print("(1) Fight the monsters!") print("(2) Attempting to dodge attacks uses 1 stamina.") print("(3) Resting replenishes random HP and 1 Sta.") print('-=' * 30 + '-') self.monsters = [Goblin(), Troll(), Ogre(), Giant(), Dragon()] self.monster = self.get_next_monster()
def setup(self): '''Spawn player, boss, and 5 monsters''' self.endgame = False self.player = get_job() self.boss = [Dragon()] self.monster_pool = [Goblin(), Goblin(), Goblin(), Troll(), Troll()]
""" Added a store. The hero can now buy a tonic or a sword. A tonic will add 2 to the hero's health wherease a sword will add 2 power. """ import random from character import Character from hero import Hero from monster import Goblin from monster import Wizard from monster import Zombie from store import Shopping from battle import Battle import os hero = Hero() enemies = [Goblin(), Wizard(), Zombie()] battle_engine = Battle() shopping_engine = Shopping() os.system("say --voice=Maged 'Welcome to this amazing game!!'") for enemy in enemies: hero_won = battle_engine.do_battle(hero, enemy) if not hero_won: print "YOU LOSE!" os.system("say --voive=Maged 'you loose sucker!!'") exit(0) shopping_engine.do_shopping(hero) print "YOU WIN!" os.system("say --voice=Maged 'you won the game!!'")
from monster import Goblin from monster import Dragon from monster import Troll from character import Character player = Character() print(player) print('Attack: {}'.format(player.attack())) print('Dodge: {}'.format(player.dodge())) print(">>> azog <<<") azog = Goblin() print(azog) print('Attack: {}'.format(azog.attack())) print('Dodge: {}'.format(azog.dodge())) print(">>> snaga <<<") snaga = Troll() print(snaga) print('Attack: {}'.format(snaga.attack())) print('Dodge: {}'.format(snaga.dodge())) print(">>> pete <<<") pete = Dragon() print(pete) print('Attack: {}'.format(pete.attack())) print('Dodge: {}'.format(pete.dodge()))
def setup(self): self.player = Character() self.monster = [ Goblin(), Troll(), Dragon()] self.monster = self.get_next_monster() def get_new_monster(self): try: return self.monster.pop(0) except IndexError: return None def monster_turn(self): # Check to see if the monster attacks if self.monster.attack(): # If so, tell the player print ('{} is attacking.'.format(self.monster)) # Check if the player wants to dodge if input('Dodge? Y/N: ').lower() == 'y': if self.player.dodge(): # If dodged, print that print ('You dodged successfuly') # If it is not, remove one player hit point else: print ('You got hit anyway') self.player.hit_points -= 1 else: print ('{} hit you for one point!'.format(self.monster)) self.player.hit_points -= 1 # If the monster is not attacking, tell that to the player too. else: print ('{} is not attacking this turn. It is your turn now'.format(self.monster)) def player_turn(self): # Let the player attack, rest or quit action_chioce = input('Your action ([A]ttack, [R]est, [Q]uit): ').lower() # If they attack: # See if the attack is successful if action choice == 'a': print ("You are attacking {}!".format(self.monster)) if self.player.attack(): if self.monster.dodge(): print ('{} dodged your attack.'.format(self.monster)) else: if self.player.leveled_up(): self.monster_hit_points -= 2 else: self.monster_hit_points -= 1 print ("You hit {} with your {}".format(self.monster, self.player.weapon)) else: print ("You missed!") # If not a good attack, tell the player # If they rest: # Call the player.rest() method elif action choice == 'r' return self.player.rest()
def setup(self): """ Create instances of all the characters in the game """ self.player = Character() self.monsters = [Goblin(), Troll(), Dragon()] self.monster = self.get_next_monster()
def setup(self): self.player = Character() self.monsters = [Troll(), Goblin(), Shrek(), Dragon()] self.monster = self.get_next_monster() self.dodge = Consent(question="Dost thou will to dodge the attack? ")