Package net.bytten.metazelda

Examples of net.bytten.metazelda.Condition


                constraints.initialRooms());
        assert possibleEntries.size() > 0;
        id = possibleEntries.get(random.nextInt(possibleEntries.size()));
       
        Room entry = new Room(id, constraints.getCoords(id), null,
                new Symbol(Symbol.START), new Condition());
        dungeon.add(entry);
       
        levels.addRoom(0, entry);
    }
View Full Code Here


        // keyLevel: the number of keys required to get to the new room
        int keyLevel = 0;
        Symbol latestKey = null;
        // condition that must hold true for the player to reach the new room
        // (the set of keys they must have).
        Condition cond = new Condition();
       
        int usableKeys = constraints.getMaxKeys();
        if (isBossRoomLocked())
            usableKeys -= 1;
       
        // Loop to place rooms and link them
        while (dungeon.roomCount() < constraints.getMaxRooms()) {
           
            boolean doLock = false;
           
            // Decide whether we need to place a new lock
            // (Don't place the last lock, since that's reserved for the boss)
            if (levels.getRooms(keyLevel).size() >= roomsPerLock &&
                    keyLevel < usableKeys) {
                latestKey = new Symbol(keyLevel++);
                cond = cond.and(latestKey);
                doLock = true;
            }
           
            // Find an existing room with a free edge:
            Room parentRoom = null;
View Full Code Here

           
            if (goalRoom != null) levels.addRoom(newKeyLevel, goalRoom);
            levels.addRoom(newKeyLevel, bossRoom);
           
            Symbol bossKey = new Symbol(newKeyLevel-1);
            Condition precond = bossRoom.getPrecond().and(bossKey);
            bossRoom.setPrecond(precond);
            if (goalRoom != null) goalRoom.setPrecond(precond);
           
            if (newKeyLevel == 0) {
                dungeon.link(bossRoom.getParent(), bossRoom);
View Full Code Here

            Room nextRoom = dungeon.get(neighborId);
            if (room.getChildren().contains(nextRoom)) {
                if (room.getEdge(neighborId).getSymbol() == null &&
                        random.nextInt(4) != 0) {
                    dungeon.link(room, nextRoom, state.toSymbol());
                    addPrecond(nextRoom, new Condition(state.toSymbol()));
                    anyLocks = true;
                } else {
                    anyLocks |= switchLockChildRooms(nextRoom, state);
                }
               
View Full Code Here

                    baseRoom = room;
                    break;
                }
            }
            if (baseRoom == null) throw new RetryException();
            Condition baseRoomCond = baseRoom.getPrecond();
           
            removeDescendantsFromList(rooms, baseRoom);
           
            Symbol switchSym = new Symbol(Symbol.SWITCH);
           
            Room switchRoom = null;
            for (Room room: rooms) {
                if (room.getItem() == null &&
                        baseRoomCond.implies(room.getPrecond()) &&
                        constraints.roomCanFitItem(room.id, switchSym)) {
                    switchRoom = room;
                    break;
                }
            }
View Full Code Here

TOP

Related Classes of net.bytten.metazelda.Condition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.