예제 #1
0
 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()
예제 #2
0
 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__))
예제 #3
0
 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()
예제 #4
0
	def  setup(self):
		self.player = Character()
		self.monsters = [
		Goblin(),
		Troll(),
		Dragon()
		]
 def setup(self):
     self.player = Character()  # this will trigger name and weapon selection
     self.monsters = [
         Goblin(),
         Troll(),
         Dragon()
     ]
     self.monster = self.get_next_monster()
예제 #6
0
 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.
예제 #7
0
파일: game.py 프로젝트: zeromars/treehouse
 def setup(self):
     debug.log('Setting up!')
     self.player = Char()
     self.monsters = [
         Goblin(),
         Troll(),
         Orge(),
         Dragon()
     ]  
     self.monster = self.get_next_monster()
예제 #8
0
 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()
예제 #9
0
 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()]
예제 #10
0
    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()
예제 #11
0
 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()
예제 #12
0
파일: game.py 프로젝트: leojacoby/python
 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? ")