예제 #1
0
	def do_look(self, s):
		cur_room = self.map.getRooms()[self.player.getPos()]
		dir = s.lower()
		if s == '':
			print format_string(self.parser.parseDescription(cur_room.description))
		elif dir == 'north' or dir == 'n' or dir == 'forward' or dir == 'f':
			if cur_room.isAltDescActive('north'):
				print format_string(self.parser.parseDescription(cur_room.getAltDesc('north')))
			else:
				print format_string(self.parser.parseDescription(cur_room.north_desc))
			#print magenta(cur_room.north_desc)
		elif dir == 'south' or dir == 's' or dir == 'back' or dir == 'b':
			if cur_room.isAltDescActive('south'):
				print format_string(self.parser.parseDescription(cur_room.getAltDesc('south')))
			else:
				print format_string(self.parser.parseDescription(cur_room.south_desc))
		elif dir == 'east' or dir == 'e' or dir == 'right' or dir == 'r':
			if cur_room.isAltDescActive('east'):
				print format_string(self.parser.parseDescription(cur_room.getAltDesc('east')))
			else:
				print format_string(self.parser.parseDescription(cur_room.east_desc))
			#print magenta(cur_room.east_desc)
		elif dir == 'west' or dir == 'w' or dir == 'left' or dir == 'l':
			if cur_room.isAltDescActive('west'):
				print format_string(self.parser.parseDescription(cur_room.getAltDesc('west')))
			else:
				print format_string(self.parser.parseDescription(cur_room.west_desc))
		else:
			return
		## Print any items that have been dropped in this room
		if len(cur_room.getDroppedItems()) > 0:
			print "=== Dropped Items ==="
			for i in cur_room.getDroppedItems():
				print yellow(i.getName())
		## Print enemies
		#enemies = self.map.getEnemiesAtPos(self.player.getPos())
		enemy_bank = self.map.getEnemies()
		if len(cur_room.getEnemies()) > 0:
			print red("=== Enemies ===")
			for e_id in cur_room.getEnemies():
				if enemy_bank[e_id].getHP() > 0:
					print enemy_bank[e_id].getName()
				else:
					print enemy_bank[e_id].getName() + '   ' + red_bg('*DEFEATED*')
				print '  HP: ' + str(enemy_bank[e_id].getHP())
				print '  MP: ' + str(enemy_bank[e_id].getMP())
예제 #2
0
	def __init__(self, player, enemy):
		cmd.Cmd.__init__(self)
		self.player = player
		self.enemy = enemy
		self.prompt = red_bg('(Combat)>>') + ' '