from dh.game import Monster, Map, Doodad, Container
import random


class Level(object):
    """ takes all of our components and creates a level """

    def __init__(self, level):
        self.level = level
        self.map = self.generate_map()
        self.mobs = self.generate_mobs()
        self.doodads = self.generate_stairs()
        self.containers = self.generate_containers()

    def generate_map(self):
        """right now just spits out a map, eventually will take level parameter to spit out a type"""
        map = Map.Map(50, 80, 1000, 10, 6)

        #here we can map out our larger map structure
        if self.level < 2:
            map.make_greathall()
        elif self.level >= 2 and self.level < 20:
            map.make_map()
        elif self.level >= 20:
            map.make_cave()
        else:
            map.make_map()
        return map

    def generate_stairs(self):
        doodads = []
        c = 0
        z = 0
        while c == 0:
            x = random.randint(0, self.map.width - 1)
            y = random.randint(0, self.map.height - 1)
            if self.map.map[x][y].blocked == False:
                if z == 0:
                    doodads.append(Doodad.Stairs(x=x, y=y, direction=1, char="<"))
                    z += 1
                else:
                    doodads.append(Doodad.Stairs(x=x, y=y, direction=-1, char=">"))
                    c += 1
        return doodads

    def generate_mobs(self):
        """spit out a collection of monsters, will eventually take level into consideration"""
        mobs = []
        z = 0
        while z < 10:  # 10 mobs per level for now
            c = 0
            while c == 0:
                x = random.randint(0, self.map.width - 1)
                y = random.randint(0, self.map.height - 1)
                if self.map.map[x][y].blocked == False:
                    mobs.append(Monster.Monster(x=x, y=y))
                    z += 1
                    c += 1

        return mobs

    def generate_containers(self):
        """i made this all by myself and it's totally not a copy paste of generate_mobs"""
        chests = []
        z = 0
        while z < 10:  # 10 chests per level for now
            c = 0
            while c == 0:
                x = random.randint(0, self.map.width - 1)
                y = random.randint(0, self.map.height - 1)
                if self.map.map[x][y].blocked == False:
                    chests.append(Container.Container(x=x, y=y, name="Chest", char="c", contents=""))
                    z += 1
                    c += 1

        return chests

034b744e66f75eb74e7beefd947e5ef36e21c774
<mask token>


class Level(object):
    <mask token>

    def __init__(self, level):
        self.level = level
        self.map = self.generate_map()
        self.mobs = self.generate_mobs()
        self.doodads = self.generate_stairs()
        self.containers = self.generate_containers()

    def generate_map(self):
        """right now just spits out a map, eventually will take level parameter to spit out a type"""
        map = Map.Map(50, 80, 1000, 10, 6)
        if self.level < 2:
            map.make_greathall()
        elif self.level >= 2 and self.level < 20:
            map.make_map()
        elif self.level >= 20:
            map.make_cave()
        else:
            map.make_map()
        return map
    <mask token>

    def generate_mobs(self):
        """spit out a collection of monsters, will eventually take level into consideration"""
        mobs = []
        z = 0
        while z < 10:
            c = 0
            while c == 0:
                x = random.randint(0, self.map.width - 1)
                y = random.randint(0, self.map.height - 1)
                if self.map.map[x][y].blocked == False:
                    mobs.append(Monster.Monster(x=x, y=y))
                    z += 1
                    c += 1
        return mobs

    def generate_containers(self):
        """i made this all by myself and it's totally not a copy paste of generate_mobs"""
        chests = []
        z = 0
        while z < 10:
            c = 0
            while c == 0:
                x = random.randint(0, self.map.width - 1)
                y = random.randint(0, self.map.height - 1)
                if self.map.map[x][y].blocked == False:
                    chests.append(Container.Container(x=x, y=y, name=
                        'Chest', char='c', contents=''))
                    z += 1
                    c += 1
        return chests

<mask token>


class Level(object):
    <mask token>

    def __init__(self, level):
        self.level = level
        self.map = self.generate_map()
        self.mobs = self.generate_mobs()
        self.doodads = self.generate_stairs()
        self.containers = self.generate_containers()

    def generate_map(self):
        """right now just spits out a map, eventually will take level parameter to spit out a type"""
        map = Map.Map(50, 80, 1000, 10, 6)
        if self.level < 2:
            map.make_greathall()
        elif self.level >= 2 and self.level < 20:
            map.make_map()
        elif self.level >= 20:
            map.make_cave()
        else:
            map.make_map()
        return map

    def generate_stairs(self):
        doodads = []
        c = 0
        z = 0
        while c == 0:
            x = random.randint(0, self.map.width - 1)
            y = random.randint(0, self.map.height - 1)
            if self.map.map[x][y].blocked == False:
                if z == 0:
                    doodads.append(Doodad.Stairs(x=x, y=y, direction=1,
                        char='<'))
                    z += 1
                else:
                    doodads.append(Doodad.Stairs(x=x, y=y, direction=-1,
                        char='>'))
                    c += 1
        return doodads

    def generate_mobs(self):
        """spit out a collection of monsters, will eventually take level into consideration"""
        mobs = []
        z = 0
        while z < 10:
            c = 0
            while c == 0:
                x = random.randint(0, self.map.width - 1)
                y = random.randint(0, self.map.height - 1)
                if self.map.map[x][y].blocked == False:
                    mobs.append(Monster.Monster(x=x, y=y))
                    z += 1
                    c += 1
        return mobs

    def generate_containers(self):
        """i made this all by myself and it's totally not a copy paste of generate_mobs"""
        chests = []
        z = 0
        while z < 10:
            c = 0
            while c == 0:
                x = random.randint(0, self.map.width - 1)
                y = random.randint(0, self.map.height - 1)
                if self.map.map[x][y].blocked == False:
                    chests.append(Container.Container(x=x, y=y, name=
                        'Chest', char='c', contents=''))
                    z += 1
                    c += 1
        return chests

<mask token>


class Level(object):
    """ takes all of our components and creates a level """

    def __init__(self, level):
        self.level = level
        self.map = self.generate_map()
        self.mobs = self.generate_mobs()
        self.doodads = self.generate_stairs()
        self.containers = self.generate_containers()

    def generate_map(self):
        """right now just spits out a map, eventually will take level parameter to spit out a type"""
        map = Map.Map(50, 80, 1000, 10, 6)
        if self.level < 2:
            map.make_greathall()
        elif self.level >= 2 and self.level < 20:
            map.make_map()
        elif self.level >= 20:
            map.make_cave()
        else:
            map.make_map()
        return map

    def generate_stairs(self):
        doodads = []
        c = 0
        z = 0
        while c == 0:
            x = random.randint(0, self.map.width - 1)
            y = random.randint(0, self.map.height - 1)
            if self.map.map[x][y].blocked == False:
                if z == 0:
                    doodads.append(Doodad.Stairs(x=x, y=y, direction=1,
                        char='<'))
                    z += 1
                else:
                    doodads.append(Doodad.Stairs(x=x, y=y, direction=-1,
                        char='>'))
                    c += 1
        return doodads

    def generate_mobs(self):
        """spit out a collection of monsters, will eventually take level into consideration"""
        mobs = []
        z = 0
        while z < 10:
            c = 0
            while c == 0:
                x = random.randint(0, self.map.width - 1)
                y = random.randint(0, self.map.height - 1)
                if self.map.map[x][y].blocked == False:
                    mobs.append(Monster.Monster(x=x, y=y))
                    z += 1
                    c += 1
        return mobs

    def generate_containers(self):
        """i made this all by myself and it's totally not a copy paste of generate_mobs"""
        chests = []
        z = 0
        while z < 10:
            c = 0
            while c == 0:
                x = random.randint(0, self.map.width - 1)
                y = random.randint(0, self.map.height - 1)
                if self.map.map[x][y].blocked == False:
                    chests.append(Container.Container(x=x, y=y, name=
                        'Chest', char='c', contents=''))
                    z += 1
                    c += 1
        return chests

from dh.game import Monster, Map, Doodad, Container
import random


class Level(object):
    """ takes all of our components and creates a level """

    def __init__(self, level):
        self.level = level
        self.map = self.generate_map()
        self.mobs = self.generate_mobs()
        self.doodads = self.generate_stairs()
        self.containers = self.generate_containers()

    def generate_map(self):
        """right now just spits out a map, eventually will take level parameter to spit out a type"""
        map = Map.Map(50, 80, 1000, 10, 6)
        if self.level < 2:
            map.make_greathall()
        elif self.level >= 2 and self.level < 20:
            map.make_map()
        elif self.level >= 20:
            map.make_cave()
        else:
            map.make_map()
        return map

    def generate_stairs(self):
        doodads = []
        c = 0
        z = 0
        while c == 0:
            x = random.randint(0, self.map.width - 1)
            y = random.randint(0, self.map.height - 1)
            if self.map.map[x][y].blocked == False:
                if z == 0:
                    doodads.append(Doodad.Stairs(x=x, y=y, direction=1,
                        char='<'))
                    z += 1
                else:
                    doodads.append(Doodad.Stairs(x=x, y=y, direction=-1,
                        char='>'))
                    c += 1
        return doodads

    def generate_mobs(self):
        """spit out a collection of monsters, will eventually take level into consideration"""
        mobs = []
        z = 0
        while z < 10:
            c = 0
            while c == 0:
                x = random.randint(0, self.map.width - 1)
                y = random.randint(0, self.map.height - 1)
                if self.map.map[x][y].blocked == False:
                    mobs.append(Monster.Monster(x=x, y=y))
                    z += 1
                    c += 1
        return mobs

    def generate_containers(self):
        """i made this all by myself and it's totally not a copy paste of generate_mobs"""
        chests = []
        z = 0
        while z < 10:
            c = 0
            while c == 0:
                x = random.randint(0, self.map.width - 1)
                y = random.randint(0, self.map.height - 1)
                if self.map.map[x][y].blocked == False:
                    chests.append(Container.Container(x=x, y=y, name=
                        'Chest', char='c', contents=''))
                    z += 1
                    c += 1
        return chests

from dh.game import Monster, Map, Doodad, Container
import random


class Level(object):
    """ takes all of our components and creates a level """

    def __init__(self, level):
        self.level = level
        self.map = self.generate_map()
        self.mobs = self.generate_mobs()
        self.doodads = self.generate_stairs()
        self.containers = self.generate_containers()

    def generate_map(self):
        """right now just spits out a map, eventually will take level parameter to spit out a type"""
        map = Map.Map(50, 80, 1000, 10, 6)

        #here we can map out our larger map structure
        if self.level < 2:
            map.make_greathall()
        elif self.level >= 2 and self.level < 20:
            map.make_map()
        elif self.level >= 20:
            map.make_cave()
        else:
            map.make_map()
        return map

    def generate_stairs(self):
        doodads = []
        c = 0
        z = 0
        while c == 0:
            x = random.randint(0, self.map.width - 1)
            y = random.randint(0, self.map.height - 1)
            if self.map.map[x][y].blocked == False:
                if z == 0:
                    doodads.append(Doodad.Stairs(x=x, y=y, direction=1, char="<"))
                    z += 1
                else:
                    doodads.append(Doodad.Stairs(x=x, y=y, direction=-1, char=">"))
                    c += 1
        return doodads

    def generate_mobs(self):
        """spit out a collection of monsters, will eventually take level into consideration"""
        mobs = []
        z = 0
        while z < 10:  # 10 mobs per level for now
            c = 0
            while c == 0:
                x = random.randint(0, self.map.width - 1)
                y = random.randint(0, self.map.height - 1)
                if self.map.map[x][y].blocked == False:
                    mobs.append(Monster.Monster(x=x, y=y))
                    z += 1
                    c += 1

        return mobs

    def generate_containers(self):
        """i made this all by myself and it's totally not a copy paste of generate_mobs"""
        chests = []
        z = 0
        while z < 10:  # 10 chests per level for now
            c = 0
            while c == 0:
                x = random.randint(0, self.map.width - 1)
                y = random.randint(0, self.map.height - 1)
                if self.map.map[x][y].blocked == False:
                    chests.append(Container.Container(x=x, y=y, name="Chest", char="c", contents=""))
                    z += 1
                    c += 1

        return chests
