cleaned up formatting:
- removed trailing whitespace - changed all leading whitespace to tabs - removed IDE created author comments
This commit is contained in:
@@ -40,9 +40,9 @@ public class BlacksmithPainter extends Painter {
|
||||
do {
|
||||
pos = room.random();
|
||||
} while (level.map[pos] != Terrain.EMPTY_SP);
|
||||
level.drop(
|
||||
Generator.random( Random.oneOf(
|
||||
Generator.Category.ARMOR,
|
||||
level.drop(
|
||||
Generator.random( Random.oneOf(
|
||||
Generator.Category.ARMOR,
|
||||
Generator.Category.WEAPON
|
||||
) ), pos );
|
||||
}
|
||||
|
||||
@@ -37,21 +37,21 @@ public class GardenPainter extends Painter {
|
||||
|
||||
room.entrance().set( Room.Door.Type.REGULAR );
|
||||
|
||||
if (Dungeon.isChallenged(Challenges.NO_FOOD)) {
|
||||
if (Random.Int(2) == 0){
|
||||
level.plant(new Sungrass.Seed(), room.random());
|
||||
}
|
||||
} else {
|
||||
int bushes = Random.Int(3);
|
||||
if (bushes == 0) {
|
||||
level.plant(new Sungrass.Seed(), room.random());
|
||||
} else if (bushes == 1) {
|
||||
level.plant(new BlandfruitBush.Seed(), room.random());
|
||||
} else if (Random.Int(5) == 0) {
|
||||
level.plant(new Sungrass.Seed(), room.random());
|
||||
level.plant(new BlandfruitBush.Seed(), room.random());
|
||||
}
|
||||
}
|
||||
if (Dungeon.isChallenged(Challenges.NO_FOOD)) {
|
||||
if (Random.Int(2) == 0){
|
||||
level.plant(new Sungrass.Seed(), room.random());
|
||||
}
|
||||
} else {
|
||||
int bushes = Random.Int(3);
|
||||
if (bushes == 0) {
|
||||
level.plant(new Sungrass.Seed(), room.random());
|
||||
} else if (bushes == 1) {
|
||||
level.plant(new BlandfruitBush.Seed(), room.random());
|
||||
} else if (Random.Int(5) == 0) {
|
||||
level.plant(new Sungrass.Seed(), room.random());
|
||||
level.plant(new BlandfruitBush.Seed(), room.random());
|
||||
}
|
||||
}
|
||||
|
||||
Foliage light = (Foliage)level.blobs.get( Foliage.class );
|
||||
if (light == null) {
|
||||
|
||||
@@ -60,7 +60,7 @@ public class LaboratoryPainter extends Painter {
|
||||
do {
|
||||
pos = room.random();
|
||||
} while (
|
||||
level.map[pos] != Terrain.EMPTY_SP ||
|
||||
level.map[pos] != Terrain.EMPTY_SP ||
|
||||
level.heaps.get( pos ) != null);
|
||||
level.drop( prize( level ), pos );
|
||||
}
|
||||
@@ -71,10 +71,10 @@ public class LaboratoryPainter extends Painter {
|
||||
|
||||
private static Item prize( Level level ) {
|
||||
|
||||
Item prize = level.findPrizeItem( Potion.class );
|
||||
if (prize == null)
|
||||
prize = Generator.random( Generator.Category.POTION );
|
||||
Item prize = level.findPrizeItem( Potion.class );
|
||||
if (prize == null)
|
||||
prize = Generator.random( Generator.Category.POTION );
|
||||
|
||||
return prize;
|
||||
return prize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class LibraryPainter extends Painter {
|
||||
|
||||
Item prize = level.findPrizeItem( Scroll.class );
|
||||
if (prize == null)
|
||||
prize = Generator.random( Generator.Category.SCROLL );
|
||||
prize = Generator.random( Generator.Category.SCROLL );
|
||||
|
||||
return prize;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import com.watabou.utils.Random;
|
||||
|
||||
public class MagicWellPainter extends Painter {
|
||||
|
||||
private static final Class<?>[] WATERS =
|
||||
private static final Class<?>[] WATERS =
|
||||
{WaterOfAwareness.class, WaterOfHealth.class, WaterOfTransmutation.class};
|
||||
|
||||
public static void paint( Level level, Room room ) {
|
||||
@@ -42,9 +42,9 @@ public class MagicWellPainter extends Painter {
|
||||
set( level, c.x, c.y, Terrain.WELL );
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends WellWater> waterClass =
|
||||
Class<? extends WellWater> waterClass =
|
||||
Dungeon.depth >= Dungeon.transmutation ?
|
||||
WaterOfTransmutation.class :
|
||||
WaterOfTransmutation.class :
|
||||
(Class<? extends WellWater>)Random.element( WATERS );
|
||||
|
||||
if (waterClass == WaterOfTransmutation.class) {
|
||||
|
||||
@@ -60,10 +60,10 @@ public class PitPainter extends Painter {
|
||||
if (loot == 0) {
|
||||
level.drop( Generator.random( Generator.Category.RING ), remains );
|
||||
} else if (loot == 1) {
|
||||
level.drop( Generator.random( Generator.Category.ARTIFACT ), remains );
|
||||
} else {
|
||||
level.drop( Generator.random( Random.oneOf(
|
||||
Generator.Category.WEAPON,
|
||||
level.drop( Generator.random( Generator.Category.ARTIFACT ), remains );
|
||||
} else {
|
||||
level.drop( Generator.random( Random.oneOf(
|
||||
Generator.Category.WEAPON,
|
||||
Generator.Category.ARMOR
|
||||
) ), remains );
|
||||
}
|
||||
@@ -77,15 +77,15 @@ public class PitPainter extends Painter {
|
||||
private static Item prize( Level level ) {
|
||||
|
||||
if (Random.Int(2) != 0){
|
||||
Item prize = level.findPrizeItem();
|
||||
if (prize != null)
|
||||
return prize;
|
||||
}
|
||||
Item prize = level.findPrizeItem();
|
||||
if (prize != null)
|
||||
return prize;
|
||||
}
|
||||
|
||||
return Generator.random( Random.oneOf(
|
||||
Generator.Category.POTION,
|
||||
return Generator.random( Random.oneOf(
|
||||
Generator.Category.POTION,
|
||||
Generator.Category.SCROLL,
|
||||
Generator.Category.FOOD,
|
||||
Generator.Category.FOOD,
|
||||
Generator.Category.GOLD
|
||||
) );
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class PoolPainter extends Painter {
|
||||
fill( level, room, Terrain.WALL );
|
||||
fill( level, room, 1, Terrain.WATER );
|
||||
|
||||
Room.Door door = room.entrance();
|
||||
Room.Door door = room.entrance();
|
||||
door.set( Room.Door.Type.REGULAR );
|
||||
|
||||
int x = -1;
|
||||
@@ -65,7 +65,7 @@ public class PoolPainter extends Painter {
|
||||
}
|
||||
|
||||
int pos = x + y * Level.WIDTH;
|
||||
level.drop( prize( level ), pos ).type =
|
||||
level.drop( prize( level ), pos ).type =
|
||||
Random.Int( 3 ) == 0 ? Heap.Type.CHEST : Heap.Type.HEAP;
|
||||
set( level, pos, Terrain.PEDESTAL );
|
||||
|
||||
@@ -82,29 +82,29 @@ public class PoolPainter extends Painter {
|
||||
|
||||
private static Item prize( Level level ) {
|
||||
|
||||
Item prize;
|
||||
Item prize;
|
||||
|
||||
if (Random.Int(3) != 0){
|
||||
prize = level.findPrizeItem();
|
||||
if (prize != null)
|
||||
return prize;
|
||||
}
|
||||
if (Random.Int(3) != 0){
|
||||
prize = level.findPrizeItem();
|
||||
if (prize != null)
|
||||
return prize;
|
||||
}
|
||||
|
||||
prize = Generator.random( Random.oneOf(
|
||||
Generator.Category.WEAPON,
|
||||
Generator.Category.ARMOR
|
||||
) );
|
||||
prize = Generator.random( Random.oneOf(
|
||||
Generator.Category.WEAPON,
|
||||
Generator.Category.ARMOR
|
||||
) );
|
||||
|
||||
for (int i=0; i < 4; i++) {
|
||||
Item another = Generator.random( Random.oneOf(
|
||||
Generator.Category.WEAPON,
|
||||
Generator.Category.ARMOR
|
||||
) );
|
||||
if (another.level > prize.level) {
|
||||
prize = another;
|
||||
}
|
||||
}
|
||||
for (int i=0; i < 4; i++) {
|
||||
Item another = Generator.random( Random.oneOf(
|
||||
Generator.Category.WEAPON,
|
||||
Generator.Category.ARMOR
|
||||
) );
|
||||
if (another.level > prize.level) {
|
||||
prize = another;
|
||||
}
|
||||
}
|
||||
|
||||
return prize;
|
||||
return prize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,9 +56,9 @@ public class RatKingPainter extends Painter {
|
||||
|
||||
private static void addChest( Level level, int pos, int door ) {
|
||||
|
||||
if (pos == door - 1 ||
|
||||
pos == door + 1 ||
|
||||
pos == door - Level.WIDTH ||
|
||||
if (pos == door - 1 ||
|
||||
pos == door + 1 ||
|
||||
pos == door - Level.WIDTH ||
|
||||
pos == door + Level.WIDTH) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -208,8 +208,8 @@ public class ShopPainter extends Painter {
|
||||
TimekeepersHourglass hourglass = Dungeon.hero.belongings.getItem(TimekeepersHourglass.class);
|
||||
if (hourglass != null){
|
||||
int bags = 0;
|
||||
//creates the given float percent of the remaining bags to be dropped.
|
||||
//this way players who get the hourglass late can still max it, usually.
|
||||
//creates the given float percent of the remaining bags to be dropped.
|
||||
//this way players who get the hourglass late can still max it, usually.
|
||||
switch (Dungeon.depth) {
|
||||
case 6:
|
||||
bags = (int)Math.ceil(( 5-hourglass.sandBags) * 0.20f ); break;
|
||||
|
||||
@@ -79,7 +79,7 @@ public class StandardPainter extends Painter {
|
||||
// Fissure
|
||||
}
|
||||
case 5:
|
||||
if (!Dungeon.bossLevel() && !Dungeon.bossLevel( Dungeon.depth + 1 ) &&
|
||||
if (!Dungeon.bossLevel() && !Dungeon.bossLevel( Dungeon.depth + 1 ) &&
|
||||
Math.min( room.width(), room.height() ) >= 5) {
|
||||
paintFissure( level, room );
|
||||
return;
|
||||
@@ -130,7 +130,7 @@ public class StandardPainter extends Painter {
|
||||
for (int i=0; i < nGraves; i++) {
|
||||
int pos = w > h ?
|
||||
room.left + 1 + shift + i * 2 + (room.top + 2 + Random.Int( h-2 )) * Level.WIDTH :
|
||||
(room.left + 2 + Random.Int( w-2 )) + (room.top + 1 + shift + i * 2) * Level.WIDTH;
|
||||
(room.left + 2 + Random.Int( w-2 )) + (room.top + 1 + shift + i * 2) * Level.WIDTH;
|
||||
level.drop( i == index ? Generator.random() : new Gold().random(), pos ).type = Heap.Type.TOMB;
|
||||
}
|
||||
}
|
||||
@@ -149,42 +149,42 @@ public class StandardPainter extends Painter {
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: this is almost a special room type now, consider moving this into its own painter if/when you address room gen significantly.
|
||||
//TODO: this is almost a special room type now, consider moving this into its own painter if/when you address room gen significantly.
|
||||
private static void paintStudy( Level level, Room room ) {
|
||||
fill( level, room.left + 1, room.top + 1, room.width() - 1, room.height() - 1 , Terrain.BOOKSHELF );
|
||||
fill( level, room.left + 2, room.top + 2, room.width() - 3, room.height() - 3 , Terrain.EMPTY_SP );
|
||||
|
||||
for (Point door : room.connected.values()) {
|
||||
if (door.x == room.left) {
|
||||
set( level, door.x + 1, door.y, Terrain.EMPTY );
|
||||
} else if (door.x == room.right) {
|
||||
set( level, door.x - 1, door.y, Terrain.EMPTY );
|
||||
} else if (door.y == room.top) {
|
||||
set( level, door.x, door.y + 1, Terrain.EMPTY );
|
||||
} else if (door.y == room.bottom) {
|
||||
set( level, door.x , door.y - 1, Terrain.EMPTY );
|
||||
}
|
||||
}
|
||||
for (Point door : room.connected.values()) {
|
||||
if (door.x == room.left) {
|
||||
set( level, door.x + 1, door.y, Terrain.EMPTY );
|
||||
} else if (door.x == room.right) {
|
||||
set( level, door.x - 1, door.y, Terrain.EMPTY );
|
||||
} else if (door.y == room.top) {
|
||||
set( level, door.x, door.y + 1, Terrain.EMPTY );
|
||||
} else if (door.y == room.bottom) {
|
||||
set( level, door.x , door.y - 1, Terrain.EMPTY );
|
||||
}
|
||||
}
|
||||
Point center = room.center();
|
||||
set( level, center, Terrain.PEDESTAL );
|
||||
if (Random.Int(2) != 0){
|
||||
Item prize = level.findPrizeItem();
|
||||
if (prize != null) {
|
||||
level.drop(prize, (room.center().x + center.y * level.WIDTH));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Random.Int(2) != 0){
|
||||
Item prize = level.findPrizeItem();
|
||||
if (prize != null) {
|
||||
level.drop(prize, (room.center().x + center.y * level.WIDTH));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
level.drop(Generator.random( Random.oneOf(
|
||||
Generator.Category.POTION,
|
||||
Generator.Category.SCROLL)), (room.center().x + center.y * level.WIDTH));
|
||||
}
|
||||
level.drop(Generator.random( Random.oneOf(
|
||||
Generator.Category.POTION,
|
||||
Generator.Category.SCROLL)), (room.center().x + center.y * level.WIDTH));
|
||||
}
|
||||
|
||||
private static void paintBridge( Level level, Room room ) {
|
||||
|
||||
fill( level, room.left + 1, room.top + 1, room.width() - 1, room.height() - 1 ,
|
||||
!Dungeon.bossLevel() && !Dungeon.bossLevel( Dungeon.depth + 1 ) && Random.Int( 3 ) == 0 ?
|
||||
Terrain.CHASM :
|
||||
fill( level, room.left + 1, room.top + 1, room.width() - 1, room.height() - 1 ,
|
||||
!Dungeon.bossLevel() && !Dungeon.bossLevel( Dungeon.depth + 1 ) && Random.Int( 3 ) == 0 ?
|
||||
Terrain.CHASM :
|
||||
Terrain.WATER );
|
||||
|
||||
Point door1 = null;
|
||||
@@ -197,7 +197,7 @@ public class StandardPainter extends Painter {
|
||||
}
|
||||
}
|
||||
|
||||
if ((door1.x == room.left && door2.x == room.right) ||
|
||||
if ((door1.x == room.left && door2.x == room.right) ||
|
||||
(door1.x == room.right && door2.x == room.left)) {
|
||||
|
||||
int s = room.width() / 2;
|
||||
@@ -206,8 +206,8 @@ public class StandardPainter extends Painter {
|
||||
drawInside( level, room, door2, s, Terrain.EMPTY_SP );
|
||||
fill( level, room.center().x, Math.min( door1.y, door2.y ), 1, Math.abs( door1.y - door2.y ) + 1, Terrain.EMPTY_SP );
|
||||
|
||||
} else
|
||||
if ((door1.y == room.top && door2.y == room.bottom) ||
|
||||
} else
|
||||
if ((door1.y == room.top && door2.y == room.bottom) ||
|
||||
(door1.y == room.bottom && door2.y == room.top)) {
|
||||
|
||||
int s = room.height() / 2;
|
||||
@@ -216,7 +216,7 @@ public class StandardPainter extends Painter {
|
||||
drawInside( level, room, door2, s, Terrain.EMPTY_SP );
|
||||
fill( level, Math.min( door1.x, door2.x ), room.center().y, Math.abs( door1.x - door2.x ) + 1, 1, Terrain.EMPTY_SP );
|
||||
|
||||
} else
|
||||
} else
|
||||
if (door1.x == door2.x) {
|
||||
|
||||
fill( level, door1.x == room.left ? room.left + 1 : room.right - 1, Math.min( door1.y, door2.y ), 1, Math.abs( door1.y - door2.y ) + 1, Terrain.EMPTY_SP );
|
||||
@@ -232,7 +232,7 @@ public class StandardPainter extends Painter {
|
||||
drawInside( level, room, door1, Math.abs( door1.y - door2.y ), Terrain.EMPTY_SP );
|
||||
drawInside( level, room, door2, Math.abs( door1.x - door2.x ), Terrain.EMPTY_SP );
|
||||
|
||||
} else
|
||||
} else
|
||||
if (door1.x == room.left || door1.x == room.right) {
|
||||
|
||||
drawInside( level, room, door1, Math.abs( door1.x - door2.x ), Terrain.EMPTY_SP );
|
||||
|
||||
@@ -56,16 +56,16 @@ public class StoragePainter extends Painter {
|
||||
|
||||
private static Item prize( Level level ) {
|
||||
|
||||
if (Random.Int(2) != 0){
|
||||
Item prize = level.findPrizeItem();
|
||||
if (prize != null)
|
||||
return prize;
|
||||
}
|
||||
if (Random.Int(2) != 0){
|
||||
Item prize = level.findPrizeItem();
|
||||
if (prize != null)
|
||||
return prize;
|
||||
}
|
||||
|
||||
return Generator.random( Random.oneOf(
|
||||
Generator.Category.POTION,
|
||||
return Generator.random( Random.oneOf(
|
||||
Generator.Category.POTION,
|
||||
Generator.Category.SCROLL,
|
||||
Generator.Category.FOOD,
|
||||
Generator.Category.FOOD,
|
||||
Generator.Category.GOLD
|
||||
) );
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class TrapsPainter extends Painter {
|
||||
fill(level, room, 1, Terrain.TRAP);
|
||||
}
|
||||
|
||||
Room.Door door = room.entrance();
|
||||
Room.Door door = room.entrance();
|
||||
door.set( Room.Door.Type.REGULAR );
|
||||
|
||||
int lastRow = level.map[room.left + 1 + (room.top + 1) * Level.WIDTH] == Terrain.CHASM ? Terrain.CHASM : Terrain.EMPTY;
|
||||
@@ -101,23 +101,23 @@ public class TrapsPainter extends Painter {
|
||||
|
||||
private static Item prize( Level level ) {
|
||||
|
||||
Item prize;
|
||||
Item prize;
|
||||
|
||||
if (Random.Int(4) != 0){
|
||||
prize = level.findPrizeItem();
|
||||
if (prize != null)
|
||||
return prize;
|
||||
}
|
||||
if (Random.Int(4) != 0){
|
||||
prize = level.findPrizeItem();
|
||||
if (prize != null)
|
||||
return prize;
|
||||
}
|
||||
|
||||
prize = Generator.random( Random.oneOf(
|
||||
Generator.Category.WEAPON,
|
||||
Generator.Category.ARMOR
|
||||
prize = Generator.random( Random.oneOf(
|
||||
Generator.Category.WEAPON,
|
||||
Generator.Category.ARMOR
|
||||
) );
|
||||
|
||||
for (int i=0; i < 3; i++) {
|
||||
Item another = Generator.random( Random.oneOf(
|
||||
Generator.Category.WEAPON,
|
||||
Generator.Category.ARMOR
|
||||
Item another = Generator.random( Random.oneOf(
|
||||
Generator.Category.WEAPON,
|
||||
Generator.Category.ARMOR
|
||||
) );
|
||||
if (another.level > prize.level) {
|
||||
prize = another;
|
||||
|
||||
@@ -68,10 +68,10 @@ public class VaultPainter extends Painter {
|
||||
}
|
||||
|
||||
private static Item prize( Level level ) {
|
||||
return Generator.random( Random.oneOf(
|
||||
Generator.Category.WAND,
|
||||
return Generator.random( Random.oneOf(
|
||||
Generator.Category.WAND,
|
||||
Generator.Category.RING,
|
||||
Generator.Category.ARTIFACT
|
||||
Generator.Category.ARTIFACT
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class WeakFloorPainter extends Painter {
|
||||
fill( level, room, Terrain.WALL );
|
||||
fill( level, room, 1, Terrain.CHASM );
|
||||
|
||||
Room.Door door = room.entrance();
|
||||
Room.Door door = room.entrance();
|
||||
door.set( Room.Door.Type.REGULAR );
|
||||
|
||||
if (door.x == room.left) {
|
||||
|
||||
Reference in New Issue
Block a user