def get_game_variables(constants): fighter_component = Fighter(hp=30, defense=2, power=5) inventory_component = Inventory(26) player = Entity(0, 0, '@', libtcod.white, 'Player', blocks=True, render_order=RenderOrder.ACTOR, fighter=fighter_component, inventory=inventory_component) entities = [player] game_map = GameMap(constants['map_width'], constants['map_height']) game_map.make_map(constants['max_rooms'], constants['room_min_size'], constants['room_max_size'], constants['map_width'], constants['map_height'], player, entities, constants['max_monsters_per_room'], constants['max_items_per_room']) message_log = MessageLog(constants['message_x'], constants['message_width'], constants['message_height']) game_state = GameStates.PLAYER_TURN return player, entities, game_map, message_log, game_state
def create_naked_mole_rat(x, y): hp = randint(3, 6) defense = 0 power = 1 xp = calculate_xp(hp, defense, power) fighter_component = Fighter(hp, defense, power, xp) ai_component = BasicMonster() return Entity(x, y, 'n', libtcod.light_sepia, 'Naked Mole Rat', blocks=True, render_order=RenderOrder.ACTOR, fighter=fighter_component, ai=ai_component)
def create_fuzzy_wuzzy(x, y): hp = 60 defense = 4 power = 10 xp = calculate_xp(hp, defense, power) fighter_component = Fighter(hp, defense, power, xp) ai_component = BasicMonster() return Entity(x, y, 'B', libtcod.silver, 'Fuzzy Wuzzy', blocks=True, render_order=RenderOrder.ACTOR, fighter=fighter_component, ai=ai_component)
def get_game_variables(constants): fighter_component = Fighter(hp=100, defense=1, power=2) inventory_component = Inventory(26) level_component = Level() equipment_component = Equipment() player = Entity(0, 0, '@', tcod.white, 'Player', blocks=True, render_order=RenderOrder.ACTOR, fighter=fighter_component, inventory=inventory_component, level=level_component, equipment=equipment_component) entities = [player] equippable_component = Equipable(EquipmentSlots.MAIN_HAND, power_bonus=2) dagger = Entity(0, 0, '-', tcod.sky, 'Dagger', equipable=equippable_component) player.inventory.add_item(dagger) player.equipment.toggle_equip(dagger) game_map = GameMap(constants['map_width'], constants['map_height']) game_map.make_map( constants['max_rooms'], constants['room_min_size'], constants['room_max_size'], constants['map_width'], constants['map_height'], player, entities, ) message_log = MessageLog(constants['message_x'], constants['message_width'], constants['message_height']) game_state = GameStates.PLAYERS_TURN return player, entities, game_map, message_log, game_state
def get_game_variables(constants: Dict) -> Tuple: # initialize player/fighter and inventory fighter_component = Fighter(hp=100, defense=1, power=2) inventory_component = Inventory(26) level_component = Level() equipment_component = Equipment() player = Entity(int(constants['screen_width'] / 2), int(constants['screen_height'] / 2), "@", constants['colors'].get('player'), 'Player', blocks=True, render_order=RenderOrder.ACTOR, fighter=fighter_component, inventory=inventory_component, level=level_component, equipment=equipment_component) entities = [player] # set up inventory stuff equippable_component = Equippable(EquipmentSlots.MAIN_HAND, power_bonus=2) dagger = Entity(0, 0, '-', tcod.sky, 'Dagger', equippable=equippable_component) player.inventory.add_item(dagger) player.equipment.toggle_equip(dagger) # initialize game map game_map = GameMap(constants['map_width'], constants['map_height']) game_map.make_map(constants['max_rooms'], constants['room_min_size'], constants['room_max_size'], constants['map_width'], constants['map_height'], player, entities, constants['colors']) # initialize blank message log message_log = MessageLog(constants['message_x'], constants['message_width'], constants['message_height']) # set initial game state game_state = GameStates.PLAYERS_TURN return player, entities, game_map, message_log, game_state
def create_elephant(x, y): hp = randint(38, 45) defense = randint(2, 3) power = 8 xp = calculate_xp(hp, defense, power) fighter_component = Fighter(hp, defense, power, xp) ai_component = BasicMonster() return Entity(x, y, 'E', libtcod.dark_grey, 'Elephant', blocks=True, render_order=RenderOrder.ACTOR, fighter=fighter_component, ai=ai_component)
def create_pack(hp, defense, power, xp, asset, name): retr = [] packsize = random.randint(1, 3) diffs = [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)] clean_diffs = [] for d in diffs: dpos = Pos(x + d[0], y + d[1]) occupied = False if game_map.is_blocked(dpos.x, dpos.y): occupied = True else: for e in entities: if (e.pos == dpos and dpos.x in range(room.x1 + 2, room.x2 - 2) and dpos.y in range(room.y1 + 2, room.y2 - 2)): occupied = True if not occupied: clean_diffs.append(d) if len(clean_diffs) < packsize and len(clean_diffs) < 3: packsize = len(clean_diffs) assert len(clean_diffs) >= packsize for w in range(packsize): diff_idx = random.randint(0, len(clean_diffs) - 1) diff = clean_diffs[diff_idx] wx, wy = x + diff[0], y + diff[1] clean_diffs.remove(diff) fighter_component = Fighter(hp=hp, defense=defense, power=power, xp=xp // packsize) ai = MeleeMonsterAI() drawable_component = Drawable(asset) # randname = "{}-{}".format(name, random.randint(0, 1000)) monster = Monster( wx, wy, name, speed=150, fighter=fighter_component, ai=ai, drawable=drawable_component, ) retr.append(monster) return retr
def main(): screen_width = 80 screen_height = 50 map_width = 80 map_height = 45 room_max_size = 10 room_min_size = 6 max_rooms = 30 player = Entity('player', '@', tcod.white) player.interactable = NPC(player) player.fighter = Fighter(player, hp=30, defense=2, power=5) player.render_order = RenderOrder.ACTOR tcod.console_set_custom_font( 'terminal12x12_gs_ro.png', tcod.FONT_TYPE_GREYSCALE | tcod.FONT_LAYOUT_ASCII_INROW ) with tcod.console_init_root( screen_width, screen_height, 'Roguelikedev2019', order='F', renderer=tcod.RENDERER_SDL2, vsync=True ) as root_console: con = tcod.console.Console(screen_width, screen_height, order='F') game_map = GameMap(map_width, map_height, player) game_map.load(make_sample_map(map_width, map_height)) #game_map.load(make_tutorial_map(map_width, map_height, max_rooms, room_min_size, room_max_size)) handler = Playing(game_map) while True: con.clear(fg=(255,255,255)) handler.update() handler.render(con) con.print(1, screen_height - 2, f'HP: {player.fighter.hp}/{player.fighter.max_hp}', (255,255,255), (0,0,0), tcod.BKGND_NONE, tcod.LEFT) con.blit(root_console, 0, 0, 0, 0, screen_width, screen_height) tcod.console_flush() for event in tcod.event.wait(): handler.dispatch(event)
def create_player(): attributes = { 'strength': 20, 'dexterity': 10, 'constitution': 30, 'intelligence': 10, 'wisdom': 10, 'charisma': 10, } fighter_component = Fighter(defense=player_vars.defense, power=player_vars.power) inventory_component = Inventory(player_vars.inventory_size) level_component = Level() equipment_component = Equipment() caster_component = Caster(1) return Entity(0, 0, char=player_vars.char, color=color_vars.player, name=player_vars.name, blocks=True, render_order=RenderOrder.ACTOR, fighter=fighter_component, inventory=inventory_component, level=level_component, equipment=equipment_component, attributes=attributes, caster=caster_component)
def place_monster(room, entities, monster): # Choose a random location in the room x = NumberGenerator.random_integer(room.x1 + 1, room.x2 - 1) y = NumberGenerator.random_integer(room.y1 + 1, room.y2 - 1) if not any( [entity for entity in entities if entity.x == x and entity.y == y]): fighter_component = Fighter(monster) ai_component = get_monster_ai(monster) monster = Entity(x, y, f'{monster[0]}', tcod.desaturated_green, f"{monster}", blocks=True, render_order=RenderOrder.ACTOR, fighter=fighter_component, ai=ai_component) return monster
def get_game_variables(constants): # instantiate entities fighter_component = Fighter(hp=100, defense=1, power=2) inventory_component = Inventory(26) level_component = Level() equipment_component = Equipment() player = Entity(0, 0, '@', libtcod.white, "Player", blocks=True, render_order=RenderOrder.ACTOR, fighter=fighter_component, inventory=inventory_component, level=level_component, equipment=equipment_component) entities = [player] equippable_component = Equippable(EquipmentSlots.MAIN_HAND, power_bonus=2) dagger = Entity(0, 0, '-', libtcod.sky, 'Dagger', equippable=equippable_component) player.inventory.add_item(dagger) player.equipment.toggle_equip(dagger) # Instantiate world map. # Monsters will be added to entities upon map generation. game_map = GameMap(constants["map_width"], constants["map_height"]) game_map.make_map(constants["max_rooms"], constants["room_min_size"], constants["room_max_size"], constants["map_width"], constants["map_height"], player, entities) message_log = MessageLog(constants["message_panel_x"], constants["message_panel_width"], constants["message_panel_height"]) # first turn in world should be player's game_state = GameStates.PLAYER_TURN return player, entities, game_map, message_log, game_state
def place_entities(room, entities, max_monsters_per_room, colors): # Get a random number of monsters number_of_monsters = randint(0, max_monsters_per_room) for i in range(number_of_monsters): # Choose a random location in the room x = randint(room.x1 + 1, room.x2 - 1) y = randint(room.y1 + 1, room.y2 - 1) #and now, we start to diverge from the tutorial. #added a bestiary module to manage monster generation if not any([entity for entity in entities if entity.x == x and entity.y == y]): img, col, nm, fight_stats= ReturnBeast() h,d,p=fight_stats fighter_component=Fighter(hp=h,defense=d,power=p) ai_component=BasicMonster() monster = Entity(x,y,img,colors.get(col),nm, blocks=True,fighter=fighter_component,ai=ai_component) entities.append(monster)
def get_game_variables(constants): equipment_component = Equipment() fighter_component: Fighter = Fighter(hp=30, base_defense=2, base_power=3) inventory_component: Inventory = Inventory(capacity=26) player: Entity = Entity( x=0, y=0, char='@', color=terminal.color_from_argb(0, 255, 255, 255), name='Player', blocks=True, render_order=RenderOrder.ACTOR, equipment=equipment_component, fighter=fighter_component, inventory=inventory_component ) entities = [player] equippable_component = Equippable(slot=EquipmentSlots.MAIN_HAND, power_bonus=2) dagger = Entity( x=0, y=0, char='-', color=terminal.color_from_argb(0, 153, 204, 255), name='Dagger', equippable=equippable_component ) player.inventory.add_item(dagger) player.equipment.toggle_equip(dagger) game_map: GameMap = GameMap(width=constants['map_width'], height=constants['map_height']) game_map.current_floor.make_map( player=player, entities=entities, constants=constants ) message_log: MessageLog = MessageLog() game_state: GameStates = GameStates.PLAYERS_TURN return player, entities, game_map, message_log, game_state
def create_monster(name, hp, defense, power, xp, item_probability, item_level, colors, color, char, x, y, body_type): fighter_component = Fighter(hp=hp, defense=defense, power=power, xp=xp) ai_component = BasicMonster() body_component = Body(body_type) if randint(1, item_probability) == item_probability: inventory_component = Inventory(1) equipment_component = Equipment() loot_component = Item(use_function=heal, amount=25) loot = Entity(0, 0, '!', colors.get('red'), 'Small Healing Potion', render_order=RenderOrder.ITEM, item=loot_component) inventory_component.add_item(loot, colors) monster = Entity(x, y, char, colors.get(color), name, blocks=True, render_order=RenderOrder.ACTOR, fighter=fighter_component, inventory=inventory_component, equipment=equipment_component, ai=ai_component, body=body_component) else: monster = Entity(x, y, char, colors.get(color), name, blocks=True, render_order=RenderOrder.ACTOR, fighter=fighter_component, ai=ai_component, body=body_component) return monster
def get_game_variables(constants): fighter_component = Fighter(hp=100, defense=0, power=4) inventory_component = Inventory(10) level_component = Level() player = Entity( 0, 0, '@', libtcod.white, 'Player', blocks=True, render_order=RenderOrder.ACTOR, fighter=fighter_component, inventory=inventory_component, level=level_component) entities = [player] game_map = GameMap(constants['map_width'], constants['map_height']) game_map.make_map(player, entities) message_log = MessageLog( constants['message_x'], constants['message_width'], constants['message_height']) game_state = GameStates.PLAYERS_TURN return player, entities, game_map, message_log, game_state
def get_game_variables(constant_variables): fighter_component = Fighter(hp=100, armor_class=3, strength=10, intelligence=10) inventory_component = Inventory(26) grimoire_component = Grimoire(5) equipment_component = Equipment() player = Entity(0, 0, '@', libtcod.red, 'Player', blocks=True, render_order=RenderOrder.ACTOR, fighter=fighter_component, inventory=inventory_component, grimoire=grimoire_component, equipment=equipment_component) spell = Spell(name='Fireball', cast_function=fireball, damage=10, targeting=True, targeting_message=Message('click to target'), radius=3, cost=10) player.grimoire.add_spell(spell) entities = [player] # Initializes map game_map = Map(constant_variables['map_width'], constant_variables['map_height']) game_map.make_BSP_map(player, entities, constant_variables['map_width'], constant_variables['map_height']) # Initializes other game variables game_state = GameStates.PLAYERS_TURN message_log = MessageLog(constant_variables['message_x'], constant_variables['message_width'], constant_variables['message_height']) return player, entities, game_map, game_state, message_log
def generate_character(x, y, race, with_AI): """Generates a random character of the chosen race""" race_template = race_templates[race] attribute_values = generate_attribute_values(race_template) character_component = Character(attribute_values["age"], race_template) attacks = generate_attack_set(unarmed_attack_definitions) fighter_component = Fighter(hp=attribute_values["hp"], endurance=attribute_values["endurance"], strength=attribute_values["strength"], intelligence=1, willpower=1, known_attacks=attacks) inventory_component = Inventory(26) level_component = Level() equipment_component = Equipment() ai_component = None if with_AI: ai_component = NeutralAI() character_name = race_template["race_name"] color = libtcod.gray else: character_name = "Player" color = libtcod.orange character = Entity(x, y, '@', color, character_name, blocks=True, render_order=RenderOrder.ACTOR, fighter=fighter_component, inventory=inventory_component, level=level_component, equipment=equipment_component, character=character_component, ai=ai_component) return character
def set_up_wilderness(self, entities, map_width, map_height): for i in range(randint(1, 5)): #later change to a getCreature call to randomly add animals fighter_component = Fighter(hp=10, defense=0, power=3) ai_component = BasicMonster() x = randint(0, map_width - 1) y = randint(0, map_height - 1) if not any([ entity for entity in entities if entity.x == x and entity.y == y ]) and not self.is_blocked(x, y): enemy = Entity(x, y, 'T', tcod.orange, 'Tiger', blocks=True, render_order=RenderOrder.ACTOR, fighter=fighter_component, ai=ai_component) entities.append(enemy)
def __init__(self): super().__init__( name="player", player=True, # Let's us work with the player component around the game. char="@", color=(255, 255, 255), ai=None, equipment=Equipment(), fighter=Fighter(max_hp=30, base_ac=10), offense=OffenseComponent(Attack('punch', [2])), attributes=Attributes(base_strength=5), # Original inventory capacity is 267 because we have 26 lowercase letters plus $ inventory=PlayerInventory(capacity=27), level=Level(level_up_base=20, difficulty=0), energy=EnergyComponent(refill=12), regeneration=Regeneration(), light=LightComponent(radius=1), )
def get_game_variables(constants): fighter_component = Fighter(hp = 30, defense = 2, power = 5) inventory_component = Inventory(26) player = Entity(0, 0, '@', tcod.white, 'Player', blocks = True, render_order=RenderOrder.ACTOR, fighter = fighter_component, inventory = inventory_component) #game_map = GameMap(constants['map_width'], constants['map_height']) #game_map.make_map(constants['max_buildings'], constants['building_min_size'], constants['building_max_size'], #constants['map_width'], constants['map_height'], player, game_map.entities, #constants['max_monsters_per_room'], constants['max_items_per_building']) #print(entities) world_map = WorldMap(10, 10, 0, 0, constants, player) entities = world_map.maps[world_map.x][world_map.y].entities message_log = MessageLog(constants['message_x'], constants['message_width'], constants['message_height']) game_state = GameStates.PLAYER_TURN return player, entities, world_map, message_log, game_state
def get_game_variables(constants): """ Initialize player, entities list, and game map """ fighter_component = Fighter(hp=30, defense=2, power=5) inventory_component = Inventory(26) level_component = Level() player = Entity(0, 0, '@', tcod.white, 'Player', blocks=True, render_order=RenderOrder.ACTOR, fighter=fighter_component, inventory=inventory_component, level=level_component) entities = [player] game_map = GameMap(constants["map_width"], constants["map_height"]) game_map.make_map( constants["max_rooms"], constants["room_min_size"], constants["room_max_size"], constants["map_width"], constants["map_height"], player, entities, constants["max_monsters_per_room"], constants["max_items_per_room"], ) message_log = MessageLog(constants["message_x"], constants["message_width"], constants["message_height"]) game_state = GameStates.PLAYERS_TURN return player, entities, game_map, message_log, game_state
def necromancy(*args, **kwargs): caster = args[0] entities = kwargs.get('entities') number_of_monsters = kwargs.get("number_of_monsters") results = [] for i in range(number_of_monsters): x = randint(caster.x - 1, caster.x + 1) y = randint(caster.y - 1, caster.y + 1) if not any([entity for entity in entities if entity.x == x and entity.y == y]): fighter_component = Fighter(hp=4, defense=0, power=2, magic=0, magic_defense=0, xp=0, talismanhp=0, gold=0) ai_component = NecromancyAI() monster = Entity(x, y, 'g', libtcod.darker_grey, 'Goblin Corpse', blocks=True, render_order=RenderOrder.ACTOR, fighter=fighter_component, ai=ai_component) entities.append(monster) results.append({'consumed': True, 'message': Message("{0} uses necromancy to summon {1} goblin corpses!".format(caster.name, number_of_monsters), libtcod.light_green)}) return results
def get_game_variables(constants): """ Crée une nouvelle partie Parametres: ---------- constants : dict Renvoi: ------- player : Entity entities : list game_map : GameMap message_log : MessageLog game_state : int """ fighter_component = Fighter(hp=100, defense=1, power=3) inventory_component = Inventory() level_component = Level() equipment_component = Equipment() player = Entity(0, 0, constants.get('graphics').get('player'), libtcod.white, 'Player', blocks=True, render_order=RenderOrder.ACTOR, fighter=fighter_component, inventory=inventory_component, level=level_component, equipment=equipment_component) entities = [player] equippable_component = Equippable(EquipmentSlots.MAIN_HAND, power_bonus=2) dagger = Entity(0, 0, constants.get('graphics').get('dagger'), libtcod.sky, 'Dague', equippable=equippable_component) player.inventory.add_item(dagger) player.equipment.toggle_equip(dagger) game_map = GameMap(constants['map_width'], constants['map_height']) game_map.make_map(constants['max_rooms'], constants['room_min_size'], constants['room_max_size'], constants['map_width'], constants['map_height'], player, entities, constants.get('graphics')) message_log = MessageLog(constants['message_x'], constants['message_width'], constants['message_height']) game_state = GameStates.PLAYERS_TURN return player, entities, game_map, message_log, game_state
def get_game_variables(constants): fighter_component = Fighter(hp=100, defense=1, power=4) inventory_component = Inventory(26) level_component = Level() # initialize the player and an npc # place the player right in the middle of the screen player = Entity(0, 0, '@', libtcod.white, 'Player', blocks=True, render_order=RenderOrder.ACTOR, fighter=fighter_component, inventory=inventory_component, level=level_component) # store the npc and player in a list, which will eventually hold all entities in the map entities = [player] # initialize the game map game_map = GameMap(constants['map_width'], constants['map_height']) game_map.make_map(constants['max_rooms'], constants['room_min_size'], constants['room_max_size'], constants['map_width'], constants['map_height'], player, entities) message_log = MessageLog(constants['message_x'], constants['message_width'], constants['message_height']) game_state = GameStates.PLAYERS_TURN return player, entities, game_map, message_log, game_state
def get_game_variables(constants): fighter_component = Fighter(hp=80, defense=2, power=2) inventory_component = Inventory(26) level_component = Level() equipment_component = Equipment() player = Entity(0, 0, "@", (255, 255, 255), "Shark", blocks=True, render_order=RenderOrder.ACTOR, fighter=fighter_component, inventory=inventory_component, level=level_component, equipment=equipment_component) entities = [player] equippable_component = Equippable(EquipmentSlots.MAIN_HAND, power_bonus=2) dagger = Entity(0, 0, "-", constants["colors"].get("sky"), "holdout blade", equippable=equippable_component) player.inventory.add_item(dagger, constants["colors"]) player.equipment.toggle_equip(dagger) game_map = GameMap(constants["map_width"], constants["map_height"]) make_map(game_map, constants["max_rooms"], constants["room_min_size"], constants["room_max_size"], constants["map_width"], constants["map_height"], player, entities, constants["colors"]) message_log = MessageLog(constants["message_x"], constants["message_width"], constants["message_height"]) game_state = GameStates.PLAYERS_TURN return player, entities, game_map, message_log, game_state
def get_players(constants, entities): players = [] for i in range(constants['player_count']): # Building the players fighter_component = Fighter(hp=30, defense=1, power=2) inventory_component = Inventory(26) level_component = Level() equipment_component = Equipment() vision_component = Vision(None, constants['fov_radius']) players.append( Entity(0, 0, '@', libtcod.blue, 'Player{0}'.format(i + 1), blocks=True, render_order=RenderOrder.ACTOR, fighter=fighter_component, inventory=inventory_component, level=level_component, equipment=equipment_component, vision=vision_component)) # Give the player a dagger to start with equippable_component = Equippable(EquipmentSlots.MAIN_HAND, power_bonus=2) dagger = Entity(0, 0, '-', libtcod.sky, 'Dagger', equippable=equippable_component) players[-1].inventory.add_item(dagger) players[-1].equipment.toggle_equip(dagger) entities.append(players[-1]) return players
def place_entities(self, room, entities, Max_Monsters_Per_Room): # Get a random number of monsters number_of_monsters = randint(0, Max_Monsters_Per_Room) for i in range(number_of_monsters): # Choose a random location in the room x = randint(room.x1 + 1, room.x2 - 1) y = randint(room.y1 + 1, room.y2 - 1) if not any([ entity for entity in entities if entity.x == x and entity.y == y ]): if randint(0, 100) < 80: fighter_component = Fighter(hp=10, defense=0, power=3) ai_component = BasicMonster() monster = Entity(x, y, 'o', libtcod.desaturated_green, 'Orc', blocks=True, render_order=RenderOrder.Actor, fighter=fighter_component, ai=ai_component) else: monster = Entity(x, y, 'T', libtcod.darker_green, 'Troll', blocks=True, render_order=RenderOrder.Actor, fighter=fighter_component, ai=ai_component) entities.append(monster)
def get_game_variables(constants): fighter_component = Fighter(hp=3000, defense=2, power=5) inventory_component = Inventory(26) game_map = GameMap(constants['map_width'], constants['map_height']) fov_component = Fov(game_map) equipment_component = Equipment() player = Entity(0, 0, '@', 'You', 'white', game_map.entities, fighter=fighter_component, fov=fov_component, inventory=inventory_component, equipment=equipment_component) equippable_component = Equippable(EquipmentSlots.RIGHT_HAND, power_bonus=2) dagger = Entity(0, 0, '-', 'Dagger', 'blue', game_map.items, equippable=equippable_component) player.inventory.add_item(dagger) player.equipment.toggle_equip(dagger) # game_map.get_player(player) map_type = 'chunks' generate_map(game_map, player, map_type) # player.fov.calc_fov(game_map) game_map.get_player(player) game_state = GameStates.PLAYERS_TURN camera = Camera(constants['camera_width'], constants['camera_height']) camera.move_camera(player.x, player.y, game_map) message_log = MessageLog() return game_map, player, game_state, camera, message_log, map_type
def get_names_under_mouse(mouse, entities, fov_map): (x, y) = (mouse.cx, mouse.cy) for entity in entities: if entity.x == x and entity.y == y and tc.map_is_in_fov( fov_map, entity.x, entity.y) and entity.fighter != None: names = [ entity.name for entity in entities if entity.x == x and entity.y == y and tc.map_is_in_fov(fov_map, entity.x, entity.y) ] names = ''.join(names) + ' ' + Mage.get_stats( entity) + Fighter.get_stats(entity) return names else: names = [ entity.name for entity in entities if entity.x == x and entity.y == y and tc.map_is_in_fov(fov_map, entity.x, entity.y) ] names = ', '.join(names) return names.capitalize()
def generate_monster(monster_name, x, y): monster = get_monster_list(monster_name) ai = monster.get('ai') death_function = monster.get('death_function') name = monster.get('name') aspect = monster.get('aspect') color = monster.get('color') hp = monster.get('hp') str = monster.get('str') dex = monster.get('dex') defense = monster.get('defense') xp = monster.get('xp') resistance = monster.get('resistance') state = monster.get('state') fighter_component = Fighter(hp=hp, str=str, dex=dex, defense=defense, resistance=resistance, xp=xp) ai_component = ai death_component = Death(death_function) monster_to_return = Entity(x, y, aspect, color, name, blocks=True, render_order=RenderOrder.ACTOR, fighter=fighter_component, ai=ai_component, death=death_component) return monster_to_return