Rogue: Savage Rats, a retro-themed dungeon crawler
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
rogue-savage-rats/src/mightypork/rogue/world/gen/rooms/EntranceRoom.java

61 lines
1.2 KiB

package mightypork.rogue.world.gen.rooms;
import java.util.Random;
import mightypork.rogue.world.gen.MapTheme;
import mightypork.rogue.world.gen.ScratchMap;
import mightypork.rogue.world.gen.TileProtectLevel;
import mightypork.rogue.world.tile.TileModel;
import mightypork.utils.math.Calc;
import mightypork.utils.math.algo.Coord;
public class EntranceRoom extends AbstractRectRoom {
@Override
protected Coord getInnerSize(Random rand)
{
return Coord.make(3 + rand.nextInt(3), 3 + rand.nextInt(3));
}
@Override
protected TileProtectLevel getWallProtectionLevel()
{
return TileProtectLevel.WEAK;
}
@Override
protected TileModel getDoorType(MapTheme theme, Random rand)
{
switch (rand.nextInt(5)) {
case 0:
case 1:
return theme.passage();
case 2:
return theme.secretDoor();
default:
return theme.door();
}
}
@Override
protected void buildExtras(ScratchMap map, MapTheme theme, Random rand, Coord min, Coord max)
{
final Coord c = Coord.make((max.x + min.x) / 2, (max.y + min.y) / 2);
map.set(c, theme.entrance());
map.protect(c, c, TileProtectLevel.STRONG);
map.setEntrance(c.add(1, 0));
}
@Override
protected int getDoorCount(Random rand)
{
return Calc.randInt(rand, 1, 4);
}
}