Esempio n. 1
0
    def __init__(self,
                 x,
                 y,
                 char,
                 name,
                 color,
                 speed=10,
                 blocks=False,
                 blocks_sight=False,
                 delay=0,
                 fighter=None,
                 always_visible=False,
                 ai=None,
                 item=None,
                 equipment=None,
                 ranged=None):
        self.name = name
        self.blocks = blocks
        self.blocks_sight = blocks_sight
        self.x = x
        self.y = y
        self.delay = delay
        self.base_speed = speed
        self.char = char
        self.color = Color(color)
        self.always_visible = always_visible
        self.path = None
        self.status = Status.StatusList()

        # Optional Components
        self.fighter = fighter
        if self.fighter:  # let the fighter component know who owns it
            self.fighter.owner = self

        self.ranged = ranged
        if self.ranged:  # let the fighter component know who owns it
            self.ranged.owner = self

        self.ai = ai
        if self.ai:  # let the AI component know who owns it
            self.ai.owner = self

        self.item = item
        if self.item:  # let the Item component know who owns it
            self.item.owner = self

        self.equipment = equipment
        if self.equipment:  # let the Equipment component know who owns it
            self.equipment.owner = self
            self.item = Components.Item()
            self.item.owner = self
Esempio n. 2
0
 def Loot_Drop(self):
     self.world.create_entity(Components.Item(), Components.Render(True, 'O', tcod.black, False),
                              Components.Position(random.randint(10, 30), random.randint(10, 20)))
     return