Exemplo n.º 1
0
def change_maps(level):
	loadgen_message()
	decombine_maps()
	store_map(game.current_map)
	for i in range(len(game.border_maps)):
		store_map(game.border_maps[i])
	IO.autosave()
	game.current_map = fetch_map({'name': game.current_map.location_name, 'id': game.current_map.location_id, 'abbr': game.current_map.location_abbr, 'level': level, 'map_width': game.current_map.map_width, 'map_height': game.current_map.map_height})
	fetch_border_maps()
	IO.autosave_current_map()
	combine_maps()
	initialize_fov()
	game.fov_recompute = True
Exemplo n.º 2
0
def climb_down_stairs():
	location_name = game.current_map.location_name
	location_abbr = game.current_map.location_abbr
	location_id = game.current_map.location_id
	threat_level = game.current_map.threat_level
	dungeon_type = game.current_map.type
	map_width = game.DUNGEON_MAP_WIDTH
	map_height = game.DUNGEON_MAP_HEIGHT
	op = (0, 0, 0)

	if game.current_map.tile[game.char.x][game.char.y]['icon'] != '>':
		game.message.new('You see no stairs going in that direction!', game.turns)
	else:
		if game.current_map.location_id > 0:
			level = game.current_map.location_level + 1
			game.message.new('You climb down the stairs.', game.turns)
			util.store_map(game.current_map)
			IO.autosave(False)
			map_width = game.current_map.map_width
			map_height = game.current_map.map_height
			dice = util.roll_dice(1, 10)
			if dice == 10:
				threat_level += 1
		else:
			level = 1
			for (id, name, abbr, x, y, tlevel, dtype) in game.worldmap.dungeons:
				if y * game.WORLDMAP_WIDTH + x == game.current_map.location_level:
					location_id = id
					location_name = name
					location_abbr = abbr
					threat_level = tlevel
					dungeon_type = dtype
					if dtype == 'Maze':
						map_width = game.MAP_WIDTH
						map_height = game.MAP_HEIGHT
			game.message.new('You enter the ' + location_name + '.', game.turns)
			util.decombine_maps()
			op = (game.current_map.location_level, game.char.x, game.char.y)
			util.store_map(game.current_map)
			for i in range(len(game.border_maps)):
				util.store_map(game.border_maps[i])
			IO.autosave()

		util.loadgen_message()
		game.current_map = util.fetch_map({'name': location_name, 'id': location_id, 'abbr': location_abbr, 'level': level, 'threat': threat_level, 'map_width': map_width, 'map_height': map_height, 'type': dungeon_type}, dir='up')
		game.current_map.overworld_position = op
		IO.autosave_current_map()
		game.current_map.check_player_position()
		util.initialize_fov()
		game.fov_recompute = True
		game.player_move = True
Exemplo n.º 3
0
	def teleport_anywhere_manual(self):
		libtcod.console_print(0, game.MAP_X, 1, 'x, y coordinates: ')
		libtcod.console_flush()
		choice = game.messages.input('', 0, game.MAP_X + 18, 1)
		if choice != '':
			coord = choice.split(',')
			if int(coord[0]) in range(game.WORLDMAP_WIDTH) and int(coord[1]) in range(game.WORLDMAP_HEIGHT):
				game.worldmap.player_positionx = int(coord[0])
				game.worldmap.player_positiony = int(coord[1])
				if game.current_map.location_id > 0:
					util.loadgen_message()
					util.store_map(game.current_map)
					IO.autosave(False)
				else:
					util.change_maps((game.worldmap.player_positiony * game.WORLDMAP_WIDTH + game.worldmap.player_positionx))
			game.draw_map = True
			libtcod.console_clear(game.con)
Exemplo n.º 4
0
def climb_up_stairs():
	combine = False
	location_name = game.current_map.location_name
	location_abbr = game.current_map.location_abbr
	location_id = game.current_map.location_id
	threat_level = game.current_map.threat_level
	dungeon_type = game.current_map.type
	map_width = game.DUNGEON_MAP_WIDTH
	map_height = game.DUNGEON_MAP_HEIGHT

	if game.current_map.tile[game.char.x][game.char.y]['icon'] != '<':
		game.message.new('You see no stairs going in that direction!', game.turns)
	else:
		if game.current_map.location_level > 1:
			level = game.current_map.location_level - 1
			game.message.new('You climb up the stairs.', game.turns)
		else:
			combine = True
			(level, game.char.x, game.char.y) = game.current_map.overworld_position
			location_id = 0
			location_name = 'Wilderness'
			location_abbr = 'WD'
			game.message.new('You return to the ' + location_name + '.', game.turns)

		util.store_map(game.current_map)
		util.loadgen_message()
		IO.autosave(False)
		if not combine:
			game.current_map = util.fetch_map({'name': location_name, 'id': location_id, 'abbr': location_abbr, 'level': level, 'threat': threat_level, 'map_width': map_width, 'map_height': map_height, 'type': dungeon_type}, dir='down')
			IO.autosave_current_map()
		else:
			game.current_map = util.fetch_map({'name': location_name, 'id': location_id, 'abbr': location_abbr, 'level': level, 'map_width': game.current_map.map_width, 'map_height': game.current_map.map_height})
			util.fetch_border_maps()
			IO.autosave_current_map()
			util.combine_maps()
		game.current_map.check_player_position()
		util.initialize_fov()
		game.fov_recompute = True
		game.player_move = True