Exemple #1
0
def draw_visible(con):
    tcod.console_set_default_foreground(con, COL_B)
    ls = []
    for object in game.actors:
        if map.is_fov(object.x, object.y):
            ls.append(object.char)  
    line = ', '.join(ls)
    tcod.console_print(con, 1, game.GAME_HEIGHT - 4, chr(254)+' '+line)
Exemple #2
0
 def draw(self, con, skip_fov=False, no_char=False):
     '''skip_fov: means seeing with TEH MIND! - also makes invisible display as <space>
     no_char: means that the player can 'sense', but not see clearly - aka blinded'''
     tcod.console_set_default_foreground(con, self.color)
     ch = self.char
     
     if self.invisible and not skip_fov:
         return False
     if no_char:
         ch = ' '
     if skip_fov:
         tcod.console_put_char(con, self.x, self.y, ch, tcod.BKGND_NONE)
         return True
     if map.is_fov(self.x, self.y):
         tcod.console_put_char(con, self.x, self.y, ch, tcod.BKGND_NONE)
Exemple #3
0
 def seek_and_destroy(self, target):
     if target:
         dx = target.x - self.owner.x
         dy = target.y - self.owner.y
         distance = map.get_distance(self.owner, target)
         if distance > 0:
             dx = int(round(dx / distance))
             dy = int(round(dy / distance))
             d = tcod.random_get_int(0,0,1) #make them zombies move orthogonally f**k
             if d == 0:
                 if dx != 0:
                     dy = 0
                 else:
                     dx = 0
             self.owner.move(dx, dy)
             e = map.get_actor_alive(self.owner.x+dx, self.owner.y+dy)
             if e and map.is_fov(self.owner.x, self.owner.y):
                 self.owner.attacker.attack(e)
                 if e is game.player:
                     game.log('the', self.owner.name, 'hits!')
                 elif e.destructible:
                     game.log('a', self.owner.name, 'hits the', e.name)
Exemple #4
0
 def update(self):
     if map.is_fov(self.owner.x, self.owner.y):
         self.move_count = self.tracking_turns
     if self.move_count:
         self.move_count -= 1
         self.seek_and_destroy(game.player)