# Path: compositecore.py
# class Leaf(Component):
#     """
#     Abstract leaf class of composite design pattern.
# 
#     Component classes of leaf type should inherit from this class.
#     """
# 
#     def __init__(self):
#         super(Leaf, self).__init__()
# 
#     def get_relative_of_type(self, component_type):
#         return self.parent.get_child_or_ancestor(component_type)
# 
#     def has_relative_of_type(self, component_type):
#         return self.parent.has_child_or_ancestor(component_type)
# 
# class CompositeMessage(object):
#     """
#     Enumerator defining class. Defines all messages that may be sent.
#     """
#     DUNGEON_LEVEL_CHANGED = 0
#     POSITION_CHANGED = 1
# 
#     def __init__(self):
#         """
#         Should not be initiated.
#         """
#         raise
# 
# Path: console.py
# class ConsoleVisual(object):
#     def __init__(self, width, height):
#     def get_color_fg(self, position):
#     def get_color_bg(self, position):
#     def get_symbol(self, position):
#     def get_default_color_fg(self):
#     def get_default_color_bg(self):
#     def set_default_color_fg(self, color, console=0):
#     def set_default_color_bg(self, color, console=0):
#     def set_symbol(self, position, icon, console=0):
#     def set_color_fg(self, position, color, console=0):
#     def set_color_bg(self, position, color, effect=libtcod.BKGND_SET, console=0):
#     def print_text(self, position, text):
#     def print_text_vertical(self, position, text):
#     def set_colors_and_symbol(self, position, color_fg, color_bg, icon, console=0):
#     def print_char_big(self, icon_position, destination, console=0):
#     def flush(self):
#     def print_screen(self):


import random
import time
import colors
import direction
import geometry
import icon
import libtcodpy as libtcod
import turn
from compositecore import Leaf, CompositeMessage
from console import console
        dungeon_level = self.parent.dungeon_level.value
        terrain = dungeon_level.get_tile_or_unknown((x, y)).get_terrain()
        dungeon_feature = dungeon_level.get_tile_or_unknown((x, y)).get_dungeon_feature()
        is_opaque = terrain.has("is_opaque") or (dungeon_feature and dungeon_feature.has("is_opaque"))
        libtcod.map_set_properties(self.dungeon_map, x, y, 0 if is_opaque else 1,
                                   self.parent.mover.can_pass_terrain(terrain))

    def update_dungeon_map(self):
        """
        Updates the dungeon map.
        """
        dungeon_level = self.parent.dungeon_level.value
        for y in range(dungeon_level.height):
            for x in range(dungeon_level.width):
                self.update_dungeon_map_point(x, y)
        self.dungeon_map_needs_total_update = False
        self._dirty_point_list = []

    def send_message(self, message):
        """
        Handles received messages.
        """
        if message == CompositeMessage.DUNGEON_LEVEL_CHANGED:
            self.init_dungeon_map_if_has_dungeon_level()
            self.update_dungeon_map()
            self.update_fov()
        if message == CompositeMessage.POSITION_CHANGED:
            self.update_fov()



# Path: compositecore.py
# class Leaf(Component):
#     """
#     Abstract leaf class of composite design pattern.
# 
#     Component classes of leaf type should inherit from this class.
#     """
# 
#     def __init__(self):
#         super(Leaf, self).__init__()
# 
#     def get_relative_of_type(self, component_type):
#         return self.parent.get_child_or_ancestor(component_type)
# 
#     def has_relative_of_type(self, component_type):
#         return self.parent.has_child_or_ancestor(component_type)
# 
# class CompositeMessage(object):
#     """
#     Enumerator defining class. Defines all messages that may be sent.
#     """
#     DUNGEON_LEVEL_CHANGED = 0
#     POSITION_CHANGED = 1
# 
#     def __init__(self):
#         """
#         Should not be initiated.
#         """
#         raise
# 
# Path: console.py
# class ConsoleVisual(object):
#     def __init__(self, width, height):
#     def get_color_fg(self, position):
#     def get_color_bg(self, position):
#     def get_symbol(self, position):
#     def get_default_color_fg(self):
#     def get_default_color_bg(self):
#     def set_default_color_fg(self, color, console=0):
#     def set_default_color_bg(self, color, console=0):
#     def set_symbol(self, position, icon, console=0):
#     def set_color_fg(self, position, color, console=0):
#     def set_color_bg(self, position, color, effect=libtcod.BKGND_SET, console=0):
#     def print_text(self, position, text):
#     def print_text_vertical(self, position, text):
#     def set_colors_and_symbol(self, position, color_fg, color_bg, icon, console=0):
#     def print_char_big(self, icon_position, destination, console=0):
#     def flush(self):
#     def print_screen(self):


# Path: dungeonmask.py
import random
import time
import colors
import direction
import geometry
import icon
import libtcodpy as libtcod
import turn
from compositecore import Leaf, CompositeMessage
from console import console

        dungeon_level = self.parent.dungeon_level.value
        terrain = dungeon_level.get_tile_or_unknown((x, y)).get_terrain()
        dungeon_feature = dungeon_level.get_tile_or_unknown((x, y)).get_dungeon_feature()
        is_opaque = terrain.has("is_opaque") or (dungeon_feature and dungeon_feature.has("is_opaque"))
        libtcod.map_set_properties(self.dungeon_map, x, y, 0 if is_opaque else 1,
                                   self.parent.mover.can_pass_terrain(terrain))

    def update_dungeon_map(self):
        """
        Updates the dungeon map.
        """
        dungeon_level = self.parent.dungeon_level.value
        for y in range(dungeon_level.height):
            for x in range(dungeon_level.width):
                self.update_dungeon_map_point(x, y)
        self.dungeon_map_needs_total_update = False
        self._dirty_point_list = []

    def send_message(self, message):
        """
        Handles received messages.
        """
        if message == CompositeMessage.DUNGEON_LEVEL_CHANGED:
            self.init_dungeon_map_if_has_dungeon_level()
            self.update_dungeon_map()
            self.update_fov()
        if message == CompositeMessage.POSITION_CHANGED:
            self.update_fov()



class Path(Leaf):