def create_mob_entity(x,
                      y,
                      mob_index,
                      encounter,
                      ai_type=AI,
                      faction_name="Mindless"):
    mob_stats = MOBS.get(mob_index)
    faction_component = Faction(faction_name=faction_name)
    fighter_component = Fighter(hp=mob_stats.get('hp'),
                                defense=mob_stats.get('def'),
                                power=mob_stats.get('att'),
                                xp=mob_stats.get('xp'),
                                fov_range=mob_stats.get('fov_range'),
                                mob_level=mob_stats.get('mob_level'))
    ai_component = ai_type(encounter=encounter, origin_x=x, origin_y=y)
    position_component = Position(x, y)
    mob_entity = Entity(mob_stats.get('glyph'),
                        mob_stats.get('color'),
                        mob_stats.get('name'),
                        json_index=mob_index,
                        position=position_component,
                        blocks=True,
                        fighter=fighter_component,
                        render_order=RenderOrder.ACTOR,
                        ai=ai_component,
                        faction=faction_component)
    return mob_entity
def generate_particle(x, y, particle_index):
    p_stats = PARTICLES.get(particle_index)
    p_name = p_stats.get("name")
    p_lifetime = p_stats.get("lifetime")
    p_char = p_stats.get("glyph")
    p_fg = p_stats.get("fg")
    p_bg = p_stats.get("bg")
    p_propagate = p_stats.get("propagate", False)
    p_propagate_property = p_stats.get("propagate_property", None)
    p_forever = p_stats.get("forever", False)
    position_component = Position(x=x, y=y)
    particle_component = Particle(lifetime=p_lifetime,
                                  char=p_char,
                                  fg=p_fg,
                                  bg=p_bg,
                                  forever=p_forever,
                                  propagate=p_propagate,
                                  propagate_property=p_propagate_property)
    particle_entity = Entity(char=p_char,
                             color=p_fg,
                             name=p_name,
                             json_index=particle_index,
                             position=position_component,
                             particle=particle_component,
                             render_order=RenderOrder.PARTICLE)

    return particle_entity
Beispiel #3
0
    def drop_item(self, item_entity, entity_owner=''):
        results = []

        # Untoggle Item if Equipped
        if item_entity in self.owner.equipment.equipment_dict.values():
            self.owner.equipment.toggle_equip(item_entity)

        # Drop Item at Owner Location and Create/Update Position Component
        if not item_entity.position:
            position_component = Position(self.owner.position.x,
                                          self.owner.position.y)
            item_entity.position = position_component
        else:
            item_entity.position.x, item_entity.position.y = self.owner.position.x, self.owner.position.y
            print('actually updated position component!', item_entity.name)

        self.remove_item(item_entity)
        results.append({
            'item_dropped':
            item_entity,
            'message':
            Message(
                '{} dropped the {}.'.format(self.owner.name, item_entity.name),
                libtcod.yellow)
        })

        return results
def place_stairs(game_map, dungeon_level, x, y):
    object_index = "11"
    object_stats = TILE_SET.get(object_index)

    movable = object_stats.get('moveable')
    breakable = object_stats.get('breakable')
    walkable = object_stats.get('walkable')
    properties = object_stats.get('properties')

    position_component = Position(x, y)
    map_object_component = MapObject(
        name=object_stats.get('name'),
        movable=movable,
        breakable=breakable,
        walkable=walkable,
        properties=properties,
        interact_function=eval(
            object_stats.get('interact_function', "no_function")),
        wait_function=eval(object_stats.get("wait_function", "no_function")))

    stairs_entity = Entity(object_stats.get("char"),
                           object_stats.get("color"),
                           object_stats.get("name"),
                           furniture=map_object_component,
                           json_index=object_index,
                           position=position_component,
                           render_order=RenderOrder.STAIRS,
                           stairs=Stairs(dungeon_level + 1))
    game_map.map_objects.append(stairs_entity)
    place_tile(game_map, x, y, object_index)
    game_map.stairs = stairs_entity
Beispiel #5
0
class Direction(Enum):
    NORTH = Position(0, -1)
    EAST = Position(-1, 0)
    SOUTH = Position(0, 1)
    WEST = Position(1, 0)
    NORTHEAST = Position(-1, -1)
    NORTHWEST = Position(1, -1)
    SOUTHEAST = Position(-1, 1)
    SOUTHWEST = Position(1, 1)
Beispiel #6
0
def from_mxCell(el, batch, windowSize, lineWidth=10):
    # Parse style
    style = parse_style(el.attrib['style'])
    # Get parent
    style['parent'] = el.attrib['parent']

    # Get geometry
    geometry = el[0]
    x = float(geometry.attrib.get('x', '0'))
    y = float(geometry.attrib.get('y', '0'))
    width = float(geometry.attrib['width'])
    height = float(geometry.attrib['height'])
    # Create drawing
    (x, y) = translate_coordinates((x, y), windowSize, height)
    pos = Position(x=x, y=y, w=width, h=height, movable=False)

    rotate = 0
    if style.get('rotation', '') != '':
        rotate = int(style['rotation'])
        if rotate < 0:
            rotate = 360 + rotate
    pos.angle = rotate

    draw = None
    col_points = None
    center = (pos.x + pos.w // 2, pos.y + pos.h // 2)

    if 'ellipse' in style:
        draw = primitives.Ellipse(center, width, height, style, rotate)
        col_points = draw._get_points()
    else:
        draw = primitives.Rectangle(x, y, width, height, style, rotate)
        col_points = pos._get_box()

    label = el.attrib.get('value', '')
    if label:
        label = pyglet.text.HTMLLabel(label,
                                      batch=batch,
                                      x=center[0], y=center[1],
                                      anchor_x='center', anchor_y='center')
    batch_draw = draw.add_to_batch(batch)
    col_points = list(map(lambda x: Vector(x[0] - center[0], x[1] - center[1]), col_points))
    collision_box = Poly(Vector(center[0], center[1]), col_points)

    return [pos, Collidable(shape=collision_box)], style, batch_draw
Beispiel #7
0
def from_mxCell(el, batch, windowSize, lineWidth=10):
  # Parse style
  style = parse_style(el.attrib['style'])
  if style.get('shape') != 'mxgraph.floorplan.wall':
    raise Exception("Cannot create Wall from {}: shape is not mxgraph.floorplan.wall".format(el))
  # Get parent
  parent_element = el.attrib['parent']
  style['parent'] = parent_element
  # Get geometry
  geometry = el[0]
  x = float(geometry.attrib.get('x', '0'))
  y = float(geometry.attrib.get('y', '0'))
  width = float(geometry.attrib['width'])
  height = float(geometry.attrib['height'])
  # Create drawing
  (x, y) = translate_coordinates((x, y), windowSize, height)
  pos = Position(x=x, y=y, w=width, h=height, movable=False)
  
  rotate = 0
  if 'rotation' in style:
    rotate = int(style['rotation'])
    if rotate < 0:
      rotate = 360 + rotate
  pos.angle = rotate

  label = el.attrib.get('value', '')
  if label:
    label = pyglet.text.HTMLLabel(label,
                                  batch=batch,
                                  x=center[0], y=center[1],
                                  anchor_x='center', anchor_y='center')
  
  # Create collision box
  col_points = pos._get_box()
  center = (pos.x + pos.w // 2, pos.y + pos.h // 2)
  col_points = list(map(lambda x: Vector(x[0] - center[0], x[1] - center[1]), col_points))
  collision_box = Poly(Vector(center[0], center[1]), col_points)
  rectangle = primitives.Rectangle(x, y, width, height, style, rotate)
  rectangle.add_to_batch(batch)
  return ([pos, Collidable(shape=collision_box)], style)
def generate_objects(entities, map_objects, game_map, room, number_of_objects,
                     object_chances, object_table):
    object_list = []
    for i in range(number_of_objects):
        x, y = room.obtain_point_within(2)

        if not any([entity for entity in entities + map_objects if entity.position.x == x and entity.position.y == y]) and \
                game_map.is_within_map(x, y) and not game_map.is_blocked(x, y):

            # Randomly Select an Object to Spawn
            object_index = random_choice_from_dict(object_chances)
            object_stats = object_table[object_index]

            # Inventory/Items Contained Within
            inventory = object_stats.get('inventory')
            inventory_component = None
            if inventory:
                inventory_component = Inventory(26)
                inventory_component.items = _generate_random_items()

                # for item in inventory_component.items:
                #     entities.append(item)

            # Interactable
            movable = object_stats.get('moveable')
            breakable = object_stats.get('breakable')
            walkable = object_stats.get('walkable')
            properties = object_stats.get('properties')
            # items=[], movable=False, breakable=False, walkable=False, interact_function
            furniture_component = MapObject(
                name=object_stats.get('name'),
                movable=movable,
                breakable=breakable,
                walkable=walkable,
                properties=properties,
                interact_function=eval(object_stats.get('interact_function')))
            position_component = Position(x, y)
            object_entity = Entity(object_stats.get('glyph'),
                                   object_stats.get('color'),
                                   object_stats.get('name'),
                                   json_index=object_index,
                                   position=position_component,
                                   render_order=RenderOrder.ITEM,
                                   furniture=furniture_component,
                                   inventory=inventory_component)

            map_objects.append(object_entity)
            object_list.append(object_entity)

    return object_list
Beispiel #9
0
    def __init__(self, world, factory, x, y, width, height):
        self.pos = Position(x, y)
        self.width = width
        self.height = height
        self.items = []

        if random.random() < 0.33:
            itemX = random.randint(x, x + width - 1)
            itemY = random.randint(y, y + height - 1)

            self.items.append(
                Item(world, factory, 'sandwich', itemX, itemY, DataTypes.ITEM,
                     'Sandwich'))
        else:
            enemyX = random.randint(x, x + width - 1)
            enemyY = random.randint(y, y + height - 1)

            self.items.append(Enemy(world, factory, enemyX, enemyY))
Beispiel #10
0
    def random_move(self, grid):
        while True:
            num = random.random()

            if num > 0.75:
                x = self.position.x
                y = self.position.y + 1
            elif num > 0.50:
                x = self.position.x + 1
                y = self.position.y
            elif num > 0.25:
                x = self.position.x - 1
                y = self.position.y
            else:
                x = self.position.x
                y = self.position.y - 1

            if any([type(entity) is Tile for entity in grid.entitiesAt(x, y)]):
                self.position = Position(x, y)
                break
    def walk(self, direction):
        x = self.player.position.x + direction.value.x
        y = self.player.position.y + direction.value.y

        entities = self.grid.entitiesAt(x, y)
        if not any([type(entity) is Tile for entity in entities]):
            return

        move = True

        for entity in entities:
            ty = type(entity)

            if ty is Enemy:
                print('Setting player target')
                self.player.target = Target(entity.stats, entity)
                move = False

        if move:
            self.player.position = Position(x, y)
Beispiel #12
0
def from_mxCell(el, batch, windowSize, lineWidth=10):
    # Parse style
    style = parse_style(el.attrib['style'])
    if style.get('shape', "") != 'mxgraph.floorplan.room':
        raise Exception(
            "Cannot create Wall from {}: shape is not mxgraph.floorplan.room".
            format(el))
    # Get parent
    parent_element = el.attrib['parent']

    # Get geometry
    geometry = el[0]
    x = float(geometry.attrib.get('x', '0'))
    y = float(geometry.attrib.get('y', '0'))
    width = float(geometry.attrib['width'])
    height = float(geometry.attrib['height'])
    # Create drawing
    (x, y) = translate_coordinates((x, y), windowSize, height)
    pos = Position(x=x, y=y, w=width, h=height, movable=False)
    center = (pos.x + pos.w // 2, pos.y + pos.h // 2)
    points = [(pos.x, pos.y), (pos.x, pos.y + pos.h),
              (pos.x - lineWidth // 2, pos.y + pos.h),
              (pos.x + pos.w + lineWidth // 2, pos.y + pos.h),
              (pos.x + pos.w, pos.y + pos.h), (pos.x + pos.w, pos.y),
              (pos.x + pos.w + lineWidth // 2, pos.y),
              (pos.x - lineWidth // 2, pos.y)]
    # Collision points
    # TODO: Verify corners
    boxes = [((pos.x + lineWidth // 2,
               pos.y + pos.h // 2), [(pos.x, pos.y), (pos.x, pos.y + pos.h),
                                     (pos.x + lineWidth, pos.y + pos.h),
                                     (pos.x + lineWidth, pos.y)]),
             ((pos.x + pos.w // 2, pos.y + pos.h + lineWidth // 2),
              [(pos.x, pos.y + pos.h), (pos.x, pos.y + pos.h + lineWidth),
               (pos.x + pos.w, pos.y + pos.h + lineWidth),
               (pos.x + pos.w, pos.y + pos.h)]),
             ((pos.x + pos.w + lineWidth // 2, pos.y + pos.h // 2),
              [(pos.x + pos.w, pos.y + pos.h),
               (pos.x + pos.w + lineWidth, pos.y + pos.h),
               (pos.x + pos.w + lineWidth, pos.y), (pos.x + pos.w, pos.y)]),
             ((pos.x + pos.w // 2, pos.y + lineWidth // 2),
              [(pos.x, pos.y), (pos.x, pos.y + lineWidth),
               (pos.x + pos.w, pos.y + lineWidth), (pos.x + pos.w, pos.y)])]

    boxes = list(
        map(lambda x: Poly(tuple2vector(x[0]), get_rel_points(x[0], x[1])),
            boxes))
    if style.get('rotation', '') != '':
        rotate = int(style['rotation'])
        if rotate < 0:
            rotate = 360 - rotate
        for box in boxes:
            box.angle = rotate
        points = map(
            lambda x: rotate_around_point(x, math.radians(rotate), center),
            points)

    drawing = primitives.Line(list(points), style)
    drawing.add_to_batch(batch)

    label = el.attrib.get('value', '')
    if label:
        label = pyglet.text.HTMLLabel(label,
                                      batch=batch,
                                      x=center[0],
                                      y=center[1],
                                      anchor_x='center',
                                      anchor_y='center')

    return ([pos, Collidable(shape=boxes)], style)
Beispiel #13
0
 def __init__(self, world, factory, name, x, y):
     self.sprite = factory.from_image(TILES.get_path(name + '.bmp'))
     self.position = Position(x, y)
     self.sprite.depth = 0
Beispiel #14
0
def from_mxCell(el, batch, windowSize, lineWidth=10):
    # Parse style
    style = parse_style(el.attrib['style'])
    if style.get('shape', "") != 'mxgraph.floorplan.wallCorner':
        raise Exception(
            "Cannot create Wall from {}: shape is not mxgraph.floorplan.wallCorner"
            .format(el))
    # Get parent
    parent_element = el.attrib['parent']
    direction = style.get('direction', 'east')
    style['parent'] = parent_element

    # Get geometry
    geometry = el[0]
    x = float(geometry.attrib.get('x', '0'))
    y = float(geometry.attrib.get('y', '0'))
    width = float(geometry.attrib['width'])
    height = float(geometry.attrib['height'])
    # Create drawing
    (x, y) = translate_coordinates((x, y), windowSize, height)
    pos = Position(x=x, y=y, w=width, h=height, movable=False)
    center = (pos.x + pos.w // 2, pos.y + pos.h // 2)
    points = [(pos.x, pos.y), (pos.x, pos.y + pos.h),
              (pos.x - lineWidth // 2, pos.y + pos.h),
              (pos.x + pos.w, pos.y + pos.h)]

    # Collision box
    col_points = [(pos.x - lineWidth // 2, pos.y),
                  (pos.x - lineWidth // 2, pos.y + pos.h + lineWidth // 2),
                  (pos.x + pos.w, pos.y + pos.h + lineWidth // 2),
                  (pos.x + pos.w, pos.y + pos.h - lineWidth // 2),
                  (pos.x + lineWidth // 2, pos.y + pos.h - lineWidth // 2),
                  (pos.x + lineWidth // 2, pos.y)]
    # Get the right corner
    if direction == 'north':
        points = map(
            lambda x: rotate_around_point(x, math.radians(-90), center),
            points)
        col_points = map(
            lambda x: rotate_around_point(x, math.radians(-90), center),
            col_points)
    elif direction == 'south':
        points = map(
            lambda x: rotate_around_point(x, math.radians(90), center), points)
        col_points = map(
            lambda x: rotate_around_point(x, math.radians(90), center),
            col_points)
    elif direction == 'west':
        points = map(
            lambda x: rotate_around_point(x, math.radians(180), center),
            points)
        col_points = map(
            lambda x: rotate_around_point(x, math.radians(180), center),
            col_points)

    # Check for rotation
    if style.get('rotation', '') != '':
        rotate = int(style['rotation'])
        if rotate < 0:
            rotate = 360 + rotate
        points = map(
            lambda x: rotate_around_point(x, math.radians(rotate), center),
            points)
        col_points = map(
            lambda x: rotate_around_point(x, math.radians(rotate), center),
            col_points)

    drawing = primitives.Line(list(points), style)
    drawing.add_to_batch(batch)

    label = el.attrib.get('value', '')
    if label:
        label = pyglet.text.HTMLLabel(label,
                                      batch=batch,
                                      x=center[0],
                                      y=center[1],
                                      anchor_x='center',
                                      anchor_y='center')

    col_points = map(lambda x: Vector(x[0] - center[0], x[1] - center[1]),
                     col_points)
    box = Concave_Poly(Vector(center[0], center[1]), list(col_points))

    return ([pos, Collidable(shape=box)], style)
Beispiel #15
0
 def __init__(self, world, factory, x, y):
     self.sprite             = factory.from_image(RESOURCES.get_path('enemy.png'))
     self.position           = Position(x, y)
     self.sprite.depth       = 2
     self.stats              = Stats(20, 20)
     self.enemydata          = EnemyData(20, 20)
Beispiel #16
0
 def __init__(self, world, factory, name, x, y, type, data):
     self.sprite = factory.from_image(ITEMS.get_path(name + '.png'))
     self.position = Position(x, y)
     self.sprite.depth = 1
     self.data = Data(type, data)
Beispiel #17
0
 def __init__(self, world, factory, x, y):
     self.sprite = factory.from_image(RESOURCES.get_path('player.png'))
     self.position = Position(x, y)
     self.sprite.depth = 2
     self.playerdata = PlayerData()
     self.stats = Stats(50, 2)
def generate_mob(x,
                 y,
                 mob_stats,
                 mob_index,
                 encounter_group,
                 faction,
                 ai,
                 entities,
                 dialogue_component=None,
                 follow_entity=None,
                 target_entity=None,
                 origin_x=None,
                 origin_y=None):

    faction_component = Faction(faction_name=faction)
    inventory_component = Inventory(3)
    equipment_component = Equipment()

    fighter_component = Fighter(hp=mob_stats.get('hp'),
                                defense=mob_stats.get('def'),
                                power=mob_stats.get('att'),
                                xp=mob_stats.get('xp'),
                                fov_range=mob_stats.get('fov_range'),
                                mob_level=mob_stats.get('mob_level'),
                                attack_range=mob_stats.get(
                                    'attack_range', 0.99))

    # Check if Mob Has Skills or Spells
    spells = mob_stats.get("spells", None)
    if spells:
        spell_data_list = []
        for spell_name in spells:
            spell_data_list.append(SPELLS.get(spell_name))
        # print('name:', mob_stats.get("name"))
        spellcaster_component = SpellCaster(spell_data=spell_data_list)
    else:
        spellcaster_component = None

    if origin_x and origin_y:
        ai_component = ai(encounter=encounter_group,
                          origin_x=origin_x,
                          origin_y=origin_y,
                          follow_entity=follow_entity,
                          target_entity=target_entity)
    else:
        ai_component = ai(encounter=encounter_group,
                          origin_x=x,
                          origin_y=y,
                          follow_entity=follow_entity,
                          target_entity=target_entity)

    position_component = Position(
        x,
        y,
        minimum_dist=mob_stats.get("minimum_dist", 1),
        movement_type=mob_stats.get("movement_type", "astar"))
    mob_entity = Entity(mob_stats.get('glyph'),
                        mob_stats.get('color'),
                        mob_stats.get('name'),
                        mob_index,
                        position=position_component,
                        blocks=True,
                        fighter=fighter_component,
                        render_order=RenderOrder.ACTOR,
                        ai=ai_component,
                        faction=faction_component,
                        equipment=equipment_component,
                        inventory=inventory_component,
                        spellcaster=spellcaster_component,
                        dialogue=dialogue_component)

    # Add/Equip Inventory
    mob_inventory = mob_stats.get("inventory", [])
    for item_index in mob_inventory:
        # print('\ntem_index:', item_index)
        item_entity = create_item_entity(item_index)
        mob_entity.inventory.add_item(item_entity)
        # print(item_entity.name)
        if item_entity.equippable:
            mob_entity.equipment.toggle_equip(item_entity)
        # print('mob inventory:')
        # for entity in mob_entity.inventory.items:
        #     print('\t%s'  % entity.name)

    if isinstance(ai_component, PatrolAI):
        mob_entity.ai.goal_x = x
        mob_entity.ai.goal_y = y

    return mob_entity
def generate_object(x,
                    y,
                    entities,
                    map_objects,
                    particles,
                    game_map,
                    object_stats,
                    object_index,
                    item_list=None,
                    no_inventory=True):

    # Create an Object that has an "Interact" and "Wait" functions
    # _entities = [entity for entity in entities + map_objects if entity.position]
    if not any([entity for entity in entities + map_objects if entity.position.x == x and entity.position.y == y]) and \
            game_map.is_within_map(x, y) and not game_map.is_blocked(x, y):

        inventory = object_stats.get('inventory')
        inventory_component = None

        # Create Inventory
        # TODO: Check if Item Entities have been moved to their own list in Engine.py(not yet)
        if inventory or not no_inventory:
            inventory_component = Inventory(
                object_stats.get('inventory_capacity'))
            number_of_items = object_stats.get('inventory_capacity')

            # Check if Pre-defined items
            if item_list and no_inventory:
                # Spawn Items in Full View through Part of the Inventory
                for item in item_list:
                    if item.position:
                        item.position.x = x
                        item.position.y = y
                    entities.append(item)
                    inventory_component.add_item(item)
            elif not no_inventory and item_list:
                for item in item_list:
                    inventory_component.add_item(item)

            elif not no_inventory:
                inventory_component.items = _generate_random_items(
                    number_of_items, game_map.dungeon_level)

        # Check for Particle Attached to Tile Object
        particle_index = object_stats.get('particle')
        if particle_index:
            particle_entity = generate_particle(x, y, particle_index)
            particles.append(particle_entity)

        movable = object_stats.get('moveable')
        breakable = object_stats.get('breakable')
        walkable = object_stats.get('walkable')
        properties = object_stats.get('properties')
        # items=[], movable=False, breakable=False, walkable=False, interact_function
        map_object_component = MapObject(
            name=object_stats.get('name'),
            movable=movable,
            breakable=breakable,
            walkable=walkable,
            properties=properties,
            interact_function=eval(
                object_stats.get('interact_function', "no_function")),
            wait_function=eval(object_stats.get("wait_function",
                                                "no_function")))
        position_component = Position(x, y)
        map_object_entity = Entity(object_stats.get('glyph'),
                                   object_stats.get('color'),
                                   object_stats.get('name'),
                                   json_index=object_index,
                                   position=position_component,
                                   render_order=RenderOrder.ITEM,
                                   furniture=map_object_component,
                                   inventory=inventory_component)
        # TODO: Directly Add to Game Map, might have to change
        game_map.map_objects.append(map_object_entity)
        place_tile(game_map, x, y, object_index)
        return map_object_entity
def create_item_entity(item_index, x=None, y=None):
    item_stats = ITEMS.get(item_index)
    if x and y:
        position_component = Position(x, y)
    else:
        position_component = None

    # Assemble an Item Entity with it's Required Components
    if item_stats.get('type') == 'consumable':
        item_component = Item(
            use_function=eval(item_stats.get('use_function', "nothing")),
            amount=item_stats.get('amount'),
            radius=item_stats.get('radius'),
            damage=item_stats.get('damage'),
            targeting_message=Message(item_stats.get('targeting_message')),
            targeting=item_stats.get('targeting'),
            maximum_range=item_stats.get('range'),
            targeting_type=item_stats.get('targeting_type'),
            description=item_stats.get('description'))

        item_entity = Entity(item_stats.get('glyph'),
                             item_stats.get('color'),
                             item_stats.get('name'),
                             json_index=item_index,
                             position=position_component,
                             render_order=RenderOrder.ITEM,
                             item=item_component)

    elif item_stats.get('type') == 'reuseable':
        item_component = Item(use_function=eval(
            item_stats.get('use_function', "nothing")),
                              name=item_stats.get('name'),
                              text=item_stats.get('text'),
                              description=item_stats.get('description'))

        item_entity = Entity(
            item_stats.get('glyph'),
            item_stats.get('color'),
            item_stats.get('name'),
            position=position_component,
            json_index=item_index,
            render_order=RenderOrder.ITEM,
            item=item_component,
        )

    elif item_stats.get('type') == 'equip':
        equippable_component = Equippable(
            item_stats.get('slot'),
            power_bonus=item_stats.get('attack', 0),
            defense_bonus=item_stats.get('defense', 0),
            max_hp_bonus=item_stats.get('hp', 0),
            description=item_stats.get('description'))

        item_entity = Entity(item_stats.get('glyph'),
                             item_stats.get('color'),
                             item_stats.get('name'),
                             position=position_component,
                             render_order=RenderOrder.ITEM,
                             json_index=item_index,
                             equippable=equippable_component)
    else:
        print(
            'Item Name: %s, Item type: %s isn\'t a suitable item type! Double check ./assets/item.json'
            % (item_stats.get('name'), item_stats.get('type')))
        raise ValueError

    return item_entity