Ejemplo n.º 1
0
    def setupMap(self):
        zones = ZoneLayout(symmetryEnforced=True)

        pos = zones.connectZone(zones.firstLocation, ZoneStep.NORTHEAST)
        pos = zones.connectZone(pos, ZoneStep.SOUTHEAST)
        pos = zones.connectZone(pos, ZoneStep.SOUTH)
        pos = zones.connectZone(pos, ZoneStep.SOUTHWEST)
        pos2 = zones.connectZone(pos, ZoneStep.NORTHWEST)
        zones.connectZone(pos2, ZoneStep.NORTH)

        pos = zones.connectZone(pos, ZoneStep.SOUTH)
        pos = zones.connectZone(pos, ZoneStep.SOUTHEAST)
        pos = zones.connectZone(pos, ZoneStep.NORTHEAST)
        pos = zones.connectZone(pos, ZoneStep.NORTH)
        zones.connectZone(pos, ZoneStep.NORTHWEST)

        pos = zones.connectZone(pos, ZoneStep.NORTHEAST)
        pos = zones.connectZone(pos, ZoneStep.NORTH)
        pos = zones.connectZone(pos, ZoneStep.NORTHWEST)
        zones.connectZone(pos, ZoneStep.SOUTHWEST)

        pos = zones.connectZone(pos, ZoneStep.NORTH)
        pos = zones.connectZone(pos, ZoneStep.NORTHWEST)
        pos = zones.connectZone(pos, ZoneStep.SOUTHWEST)
        zones.connectZone(pos, ZoneStep.SOUTH)

        layout = zones.createMapLayout(self.world.layoutDatabase)
        self.world.setLayout(layout)
Ejemplo n.º 2
0
    def setupMap(self):
        self.blueTeam = self.world.teams[0]
        self.redTeam = self.world.teams[1]

        zones = ZoneLayout()
        zone = zones.firstLocation
        zone = zones.connectZone(zone, ZoneStep.NORTHEAST)
        zone = zones.connectZone(zone, ZoneStep.SOUTHEAST)
        zone = zones.connectZone(zone, ZoneStep.SOUTHEAST)
        zone = zones.connectZone(zone, ZoneStep.NORTHEAST)

        layout = zones.createMapLayout(self.world.layoutDatabase)

        self.applyBlock(layout, 'tutorialblockA', 2, 1)
        self.applyBlock(layout, 'tutorialblockB', 2, 2)
        self.applyBlock(layout, 'bckOpenEmpty', 1, 2)
        self.applyBlock(layout, 'tutorialblockC', 1, 3)
        self.applyBlock(layout, 'tutorialblockD', 0, 3)
        # self.applyBlock(layout, 'tutorialblockE', 0, 4)
        self.applyBlock(layout, 'tutorialblockF', 1, 4)
        self.applyBlock(layout, 'tutorialblockG', 2, 4)
        self.applyBlock(layout, 'tutorialblockroom1', 2, 5)
        self.applyBlock(layout, 'bckOpenEmpty', 2, 6, reversed=True)
        self.applyBlock(layout, 'btmBlockedBasic', 3, 7)
        self.applyBlock(layout, 'bckOpenEmpty', 2, 8)

        self.world.setLayout(layout)
        for zone in self.world.zones:
            zone.owner = self.blueTeam
            zone.dark = False
Ejemplo n.º 3
0
    def setupMap(self):
        zones = ZoneLayout()
        zones.connectZone(zones.firstLocation, ZoneStep.NORTHWEST)
        zones.connectZone(zones.firstLocation, ZoneStep.SOUTHEAST)

        layout = zones.createMapLayout(self.world.layoutDatabase)
        tetris = self.world.layoutDatabase.getLayoutByFilename(
            'bckOpenTetris.block', reversed=True)
        tetris.applyTo(layout.blocks[0][2])
        self.world.setLayout(layout)
Ejemplo n.º 4
0
def makeCirclesLayout(layoutDatabase):
    zones = ZoneLayout()

    # Centre
    zone = zones.firstLocation
    zones.setZoneOwner(zone, 0, dark=True)

    # Inner ring
    zone = zones.firstLocation
    zones.addZoneAt(zone + ZoneStep.SOUTH, ownerIndex=1, dark=False)
    zones.addZoneAt(zone + ZoneStep.NORTHEAST, ownerIndex=1, dark=False)
    zones.addZoneAt(zone + ZoneStep.NORTHWEST, ownerIndex=1, dark=False)
    se = zones.connectZone(
        zone, ZoneStep.SOUTHEAST, ownerIndex=1, dark=False)
    zones.connectZone(se, ZoneStep.SOUTHWEST)
    zones.connectZone(se, ZoneStep.NORTH)
    sw = zones.connectZone(
        zone, ZoneStep.SOUTHWEST, ownerIndex=1, dark=False)
    zones.connectZone(sw, ZoneStep.SOUTHEAST)
    zones.connectZone(sw, ZoneStep.NORTH)
    n = zones.connectZone(zone, ZoneStep.NORTH, ownerIndex=1, dark=False)
    zones.connectZone(n, ZoneStep.SOUTHEAST)
    zones.connectZone(n, ZoneStep.SOUTHWEST)

    # Outer ring
    zone = zones.connectZone(n, ZoneStep.NORTHEAST)
    zone = zones.connectZone(zone, ZoneStep.SOUTHEAST)
    zone = zones.connectZone(zone, ZoneStep.SOUTH)
    zones.connectZone(zone, ZoneStep.NORTHWEST)
    zone = zones.connectZone(zone, ZoneStep.SOUTH)
    zone = zones.connectZone(zone, ZoneStep.SOUTHWEST)
    zones.connectZone(zone, ZoneStep.NORTH)
    zone = zones.connectZone(zone, ZoneStep.SOUTHWEST)
    zone = zones.connectZone(zone, ZoneStep.NORTHWEST)
    zones.connectZone(zone, ZoneStep.NORTHEAST)
    zone = zones.connectZone(zone, ZoneStep.NORTHWEST)
    zone = zones.connectZone(zone, ZoneStep.NORTH)
    zones.connectZone(zone, ZoneStep.SOUTHEAST)
    zone = zones.connectZone(zone, ZoneStep.NORTH)
    zone = zones.connectZone(zone, ZoneStep.NORTHEAST)
    zones.connectZone(zone, ZoneStep.SOUTH)
    zone = zones.connectZone(zone, ZoneStep.NORTHEAST)
    zone = zones.connectZone(zone, ZoneStep.SOUTHEAST)

    return zones.createMapLayout(layoutDatabase, autoOwner=False)
Ejemplo n.º 5
0
    def makeRingLayout(self):
        zones = ZoneLayout()

        # Outer ring
        northSpawnZone = zone = zones.firstLocation
        zone = zones.connectZone(zone, ZoneStep.SOUTHEAST)
        zone = zones.connectZone(zone, ZoneStep.SOUTHEAST)
        eastZone = zone = zones.connectZone(zone, ZoneStep.SOUTH)
        eastSpawnZone = zone = zones.connectZone(zone, ZoneStep.SOUTH)
        zone = zones.connectZone(zone, ZoneStep.SOUTHWEST)
        zone = zones.connectZone(zone, ZoneStep.SOUTHWEST)
        southWestZone = zone = zones.connectZone(zone, ZoneStep.NORTHWEST)
        westSpawnZone = zone = zones.connectZone(zone, ZoneStep.NORTHWEST)
        zone = zones.connectZone(zone, ZoneStep.NORTH)
        zone = zones.connectZone(zone, ZoneStep.NORTH)
        northWestZone = zone = zones.connectZone(zone, ZoneStep.NORTHEAST)
        zone = zones.connectZone(zone, ZoneStep.NORTHEAST)

        # Inner swirl
        zone = zones.connectZone(eastZone, ZoneStep.NORTHWEST)
        zone = zones.connectZone(zone, ZoneStep.NORTHWEST)
        zones.connectZone(zone, ZoneStep.SOUTH, ownerIndex=0, dark=True)
        zone = zones.connectZone(southWestZone, ZoneStep.NORTHEAST)
        zone = zones.connectZone(zone, ZoneStep.NORTHEAST)
        zones.connectZone(zone, ZoneStep.NORTHWEST)
        zone = zones.connectZone(northWestZone, ZoneStep.SOUTH)
        zone = zones.connectZone(zone, ZoneStep.SOUTH)
        zones.connectZone(zone, ZoneStep.NORTHEAST)

        # Outer spawn zones
        zones.connectZone(
            northSpawnZone, ZoneStep.NORTH, ownerIndex=0, dark=True)
        zones.connectZone(
            eastSpawnZone, ZoneStep.SOUTHEAST, ownerIndex=0, dark=True)
        zones.connectZone(
            westSpawnZone, ZoneStep.SOUTHWEST, ownerIndex=0, dark=True)

        return zones.createMapLayout(
            self.world.layoutDatabase, autoOwner=False)
Ejemplo n.º 6
0
    def setupMap(self):

        zones = ZoneLayout()
        self.world.setLayout(zones.createMapLayout(self.world.layoutDatabase))
Ejemplo n.º 7
0
    def setupMap(self):
        super(DeploymentLevel, self).setupMap()

        blockRatio = 0.8

        zones = ZoneLayout(symmetryEnforced=True)

        def addColumn(startLocation, columnHeight, previousHeight):
            if not zones.hasZoneAt(startLocation):
                zones.addZoneAt(startLocation)

            current = startLocation
            connections = []
            for i in range(columnHeight - 1):
                nextLocation = current + ZoneStep.SOUTH
                zones.addZoneAt(nextLocation)
                connections.append((current, ZoneStep.SOUTH))
                current = nextLocation

            if previousHeight:
                if previousHeight < columnHeight:
                    assert previousHeight == columnHeight - 1
                    connections.append((startLocation, ZoneStep.SOUTHWEST))
                    connections.append((current, ZoneStep.NORTHWEST))
                    current = startLocation + ZoneStep.SOUTH
                    count = previousHeight - 1
                else:
                    assert previousHeight == columnHeight + 1
                    current = startLocation
                    count = columnHeight

                for i in range(count):
                    connections.append((current, ZoneStep.NORTHWEST))
                    connections.append((current, ZoneStep.SOUTHWEST))
                    current += ZoneStep.SOUTH

            while connections:
                loc, direction = connections.pop(0)
                if random.random() >= blockRatio:
                    zones.connectZone(loc, direction)

        location = zones.firstLocation
        addColumn(location, 5, 0)
        location += ZoneStep.SOUTHEAST
        addColumn(location, 4, 5)
        location += ZoneStep.NORTHEAST
        addColumn(location, 5, 4)
        location += ZoneStep.SOUTHEAST
        addColumn(location, 4, 5)
        location += ZoneStep.SOUTHEAST
        addColumn(location, 3, 4)
        location += ZoneStep.SOUTHEAST
        addColumn(location, 2, 3)
        location += ZoneStep.SOUTHEAST
        addColumn(location, 1, 2)

        zones.makeEverywhereReachable()
        layout = zones.createMapLayout(self.world.layoutDatabase)
        self.world.setLayout(layout)

        leftmost = min(self.world.zones, key=lambda z: z.defn.pos[0])
        rightmost = max(self.world.zones, key=lambda z: z.defn.pos[0])
        for zone in self.world.zones:
            if zone not in (leftmost, rightmost):
                if zone.owner:
                    zone.owner.zoneLost()
                zone.owner = None