@Override public int randomDestination() { int count = 0; int cell = -1; while (true) { if (++count > 30) { return -1; } Room room = Random.element( rooms ); if (room == null) { continue; } cell = pointToCell(room.random()); if (passable[cell]) { return cell; } } }
@Override public int randomDestination() { int count = 0; int cell = -1; while (true) { if (++count > 30) { return -1; } Room room = Random.element( rooms ); if (room == null) { continue; } cell = pointToCell(room.random()); if (passable[cell]) { return cell; } } }
mob.pos = pointToCell(roomToSpawn.random()); mob.pos = pointToCell(roomToSpawn.random());
mob.pos = pointToCell(roomToSpawn.random()); mob.pos = pointToCell(roomToSpawn.random());
protected int randomDropCell() { while (true) { Room room = randomRoom( StandardRoom.class ); if (room != null && room != roomEntrance) { int pos = pointToCell(room.random()); if (passable[pos] && pos != exit && heaps.get(pos) == null) { Trap t = traps.get(pos); //items cannot spawn on traps which destroy items if (t == null || ! (t instanceof BurningTrap || t instanceof BlazingTrap || t instanceof ChillingTrap || t instanceof FrostTrap || t instanceof ExplosiveTrap || t instanceof DisintegrationTrap)) { return pos; } } } } }
protected int randomDropCell() { while (true) { Room room = randomRoom( StandardRoom.class ); if (room != null && room != roomEntrance) { int pos = pointToCell(room.random()); if (passable[pos] && pos != exit && heaps.get(pos) == null) { Trap t = traps.get(pos); //items cannot spawn on traps which destroy items if (t == null || ! (t instanceof BurningTrap || t instanceof BlazingTrap || t instanceof ChillingTrap || t instanceof FrostTrap || t instanceof ExplosiveTrap || t instanceof DisintegrationTrap)) { return pos; } } } } }
@Override public int fallCell( boolean fallIntoPit ) { if (fallIntoPit) { for (Room room : rooms) { if (room instanceof PitRoom) { int result; do { result = pointToCell(room.random()); } while (traps.get(result) != null || findMob(result) != null || heaps.get(result) != null); return result; } } } return super.fallCell( false ); }
@Override public int fallCell( boolean fallIntoPit ) { if (fallIntoPit) { for (Room room : rooms) { if (room instanceof PitRoom) { int result; do { result = pointToCell(room.random()); } while (traps.get(result) != null || findMob(result) != null || heaps.get(result) != null); return result; } } } return super.fallCell( false ); }
@Override public int randomRespawnCell() { int count = 0; int cell = -1; while (true) { if (++count > 30) { return -1; } Room room = randomRoom( StandardRoom.class ); if (room == null || room == roomEntrance) { continue; } cell = pointToCell(room.random(1)); if (!heroFOV[cell] && Actor.findChar( cell ) == null && passable[cell] && room.canPlaceCharacter(cellToPoint(cell), this) && cell != exit) { return cell; } } }
@Override public int randomRespawnCell() { int count = 0; int cell = -1; while (true) { if (++count > 30) { return -1; } Room room = randomRoom( StandardRoom.class ); if (room == null || room == roomEntrance) { continue; } cell = pointToCell(room.random(1)); if (!heroFOV[cell] && Actor.findChar( cell ) == null && passable[cell] && room.canPlaceCharacter(cellToPoint(cell), this) && cell != exit) { return cell; } } }
boolean locked = false; for (Point p : r.getPoints()){ terr = level.map[level.pointToCell(p)]; if (terr == Terrain.LOCKED_DOOR || terr == Terrain.BARRICADE){ locked = true; cell = level.pointToCell(p); if (level.passable[cell] && !level.visited[cell] && Actor.findChar(cell) == null){ candidates.add(cell);
boolean locked = false; for (Point p : r.getPoints()){ terr = level.map[level.pointToCell(p)]; if (terr == Terrain.LOCKED_DOOR || terr == Terrain.BARRICADE){ locked = true; cell = level.pointToCell(p); if (level.passable[cell] && !level.visited[cell] && Actor.findChar(cell) == null){ candidates.add(cell);