cleaned up formatting:
- removed trailing whitespace - changed all leading whitespace to tabs - removed IDE created author comments
This commit is contained in:
@@ -123,18 +123,18 @@ public class CavesBossLevel extends Level {
|
||||
}
|
||||
}
|
||||
|
||||
Painter.fill( this, ROOM_LEFT - 1, ROOM_TOP - 1,
|
||||
Painter.fill( this, ROOM_LEFT - 1, ROOM_TOP - 1,
|
||||
ROOM_RIGHT - ROOM_LEFT + 3, ROOM_BOTTOM - ROOM_TOP + 3, Terrain.WALL );
|
||||
Painter.fill( this, ROOM_LEFT, ROOM_TOP + 1,
|
||||
Painter.fill( this, ROOM_LEFT, ROOM_TOP + 1,
|
||||
ROOM_RIGHT - ROOM_LEFT + 1, ROOM_BOTTOM - ROOM_TOP, Terrain.EMPTY );
|
||||
|
||||
Painter.fill( this, ROOM_LEFT, ROOM_TOP,
|
||||
Painter.fill( this, ROOM_LEFT, ROOM_TOP,
|
||||
ROOM_RIGHT - ROOM_LEFT + 1, 1, Terrain.INACTIVE_TRAP );
|
||||
|
||||
arenaDoor = Random.Int( ROOM_LEFT, ROOM_RIGHT ) + (ROOM_BOTTOM + 1) * WIDTH;
|
||||
map[arenaDoor] = Terrain.DOOR;
|
||||
|
||||
entrance = Random.Int( ROOM_LEFT + 1, ROOM_RIGHT - 1 ) +
|
||||
entrance = Random.Int( ROOM_LEFT + 1, ROOM_RIGHT - 1 ) +
|
||||
Random.Int( ROOM_TOP + 1, ROOM_BOTTOM - 1 ) * WIDTH;
|
||||
map[entrance] = Terrain.ENTRANCE;
|
||||
|
||||
@@ -149,7 +149,7 @@ public class CavesBossLevel extends Level {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void decorate() {
|
||||
protected void decorate() {
|
||||
|
||||
for (int i=WIDTH + 1; i < LENGTH - WIDTH; i++) {
|
||||
if (map[i] == Terrain.EMPTY) {
|
||||
@@ -186,7 +186,7 @@ public class CavesBossLevel extends Level {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createMobs() {
|
||||
protected void createMobs() {
|
||||
}
|
||||
|
||||
public Actor respawner() {
|
||||
@@ -218,7 +218,7 @@ public class CavesBossLevel extends Level {
|
||||
if (!enteredArena && outsideEntraceRoom( cell ) && hero == Dungeon.hero) {
|
||||
|
||||
enteredArena = true;
|
||||
seal();
|
||||
seal();
|
||||
|
||||
Mob boss = Bestiary.mob( Dungeon.depth );
|
||||
boss.state = boss.HUNTING;
|
||||
@@ -246,7 +246,7 @@ public class CavesBossLevel extends Level {
|
||||
if (!keyDropped && item instanceof SkeletonKey) {
|
||||
|
||||
keyDropped = true;
|
||||
unseal();
|
||||
unseal();
|
||||
|
||||
CellEmitter.get( arenaDoor ).start( Speck.factory( Speck.ROCK ), 0.07f, 10 );
|
||||
|
||||
|
||||
@@ -251,8 +251,8 @@ public class CavesLevel extends RegularLevel {
|
||||
delay = Random.Float();
|
||||
|
||||
PointF p = DungeonTilemap.tileToWorld( pos );
|
||||
((Sparkle)recycle( Sparkle.class )).reset(
|
||||
p.x + Random.Float( DungeonTilemap.SIZE ),
|
||||
((Sparkle)recycle( Sparkle.class )).reset(
|
||||
p.x + Random.Float( DungeonTilemap.SIZE ),
|
||||
p.y + Random.Float( DungeonTilemap.SIZE ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,19 +113,19 @@ public class CityBossLevel extends Level {
|
||||
Painter.fill( this, LEFT, TOP + HALL_HEIGHT + 1, 1, CHAMBER_HEIGHT, Terrain.BOOKSHELF );
|
||||
Painter.fill( this, LEFT + HALL_WIDTH - 1, TOP + HALL_HEIGHT + 1, 1, CHAMBER_HEIGHT, Terrain.BOOKSHELF );
|
||||
|
||||
entrance = (TOP + HALL_HEIGHT + 2 + Random.Int( CHAMBER_HEIGHT - 1 )) * WIDTH + LEFT + (/*1 +*/ Random.Int( HALL_WIDTH-2 ));
|
||||
entrance = (TOP + HALL_HEIGHT + 2 + Random.Int( CHAMBER_HEIGHT - 1 )) * WIDTH + LEFT + (/*1 +*/ Random.Int( HALL_WIDTH-2 ));
|
||||
map[entrance] = Terrain.ENTRANCE;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void decorate() {
|
||||
protected void decorate() {
|
||||
|
||||
for (int i=0; i < LENGTH; i++) {
|
||||
if (map[i] == Terrain.EMPTY && Random.Int( 10 ) == 0) {
|
||||
if (map[i] == Terrain.EMPTY && Random.Int( 10 ) == 0) {
|
||||
map[i] = Terrain.EMPTY_DECO;
|
||||
} else if (map[i] == Terrain.WALL && Random.Int( 8 ) == 0) {
|
||||
} else if (map[i] == Terrain.WALL && Random.Int( 8 ) == 0) {
|
||||
map[i] = Terrain.WALL_DECO;
|
||||
}
|
||||
}
|
||||
@@ -143,7 +143,7 @@ public class CityBossLevel extends Level {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createMobs() {
|
||||
protected void createMobs() {
|
||||
}
|
||||
|
||||
public Actor respawner() {
|
||||
@@ -156,8 +156,8 @@ public class CityBossLevel extends Level {
|
||||
if (item != null) {
|
||||
int pos;
|
||||
do {
|
||||
pos =
|
||||
Random.IntRange( LEFT + 1, LEFT + HALL_WIDTH - 2 ) +
|
||||
pos =
|
||||
Random.IntRange( LEFT + 1, LEFT + HALL_WIDTH - 2 ) +
|
||||
Random.IntRange( TOP + HALL_HEIGHT + 1, TOP + HALL_HEIGHT + CHAMBER_HEIGHT ) * WIDTH;
|
||||
} while (pos == entrance || map[pos] == Terrain.SIGN);
|
||||
drop( item, pos ).type = Heap.Type.REMAINS;
|
||||
@@ -177,7 +177,7 @@ public class CityBossLevel extends Level {
|
||||
if (!enteredArena && outsideEntraceRoom( cell ) && hero == Dungeon.hero) {
|
||||
|
||||
enteredArena = true;
|
||||
seal();
|
||||
seal();
|
||||
|
||||
Mob boss = Bestiary.mob( Dungeon.depth );
|
||||
boss.state = boss.HUNTING;
|
||||
@@ -208,7 +208,7 @@ public class CityBossLevel extends Level {
|
||||
if (!keyDropped && item instanceof SkeletonKey) {
|
||||
|
||||
keyDropped = true;
|
||||
unseal();
|
||||
unseal();
|
||||
|
||||
set( arenaDoor, Terrain.DOOR );
|
||||
GameScene.updateMap( arenaDoor );
|
||||
|
||||
@@ -70,9 +70,9 @@ public class CityLevel extends RegularLevel {
|
||||
protected void decorate() {
|
||||
|
||||
for (int i=0; i < LENGTH; i++) {
|
||||
if (map[i] == Terrain.EMPTY && Random.Int( 10 ) == 0) {
|
||||
if (map[i] == Terrain.EMPTY && Random.Int( 10 ) == 0) {
|
||||
map[i] = Terrain.EMPTY_DECO;
|
||||
} else if (map[i] == Terrain.WALL && Random.Int( 8 ) == 0) {
|
||||
} else if (map[i] == Terrain.WALL && Random.Int( 8 ) == 0) {
|
||||
map[i] = Terrain.WALL_DECO;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class DeadEndLevel extends Level {
|
||||
}
|
||||
|
||||
for (int i=1; i <= SIZE; i++) {
|
||||
map[WIDTH + i] =
|
||||
map[WIDTH + i] =
|
||||
map[WIDTH * SIZE + i] =
|
||||
map[WIDTH * i + 1] =
|
||||
map[WIDTH * i + SIZE] =
|
||||
@@ -73,9 +73,9 @@ public class DeadEndLevel extends Level {
|
||||
@Override
|
||||
protected void decorate() {
|
||||
for (int i=0; i < LENGTH; i++) {
|
||||
if (map[i] == Terrain.EMPTY && Random.Int( 10 ) == 0) {
|
||||
if (map[i] == Terrain.EMPTY && Random.Int( 10 ) == 0) {
|
||||
map[i] = Terrain.EMPTY_DECO;
|
||||
} else if (map[i] == Terrain.WALL && Random.Int( 8 ) == 0) {
|
||||
} else if (map[i] == Terrain.WALL && Random.Int( 8 ) == 0) {
|
||||
map[i] = Terrain.WALL_DECO;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,12 +105,12 @@ public class HallsBossLevel extends Level {
|
||||
|
||||
map[exit] = Terrain.LOCKED_EXIT;
|
||||
|
||||
Painter.fill( this, ROOM_LEFT - 1, ROOM_TOP - 1,
|
||||
Painter.fill( this, ROOM_LEFT - 1, ROOM_TOP - 1,
|
||||
ROOM_RIGHT - ROOM_LEFT + 3, ROOM_BOTTOM - ROOM_TOP + 3, Terrain.WALL );
|
||||
Painter.fill( this, ROOM_LEFT, ROOM_TOP,
|
||||
Painter.fill( this, ROOM_LEFT, ROOM_TOP,
|
||||
ROOM_RIGHT - ROOM_LEFT + 1, ROOM_BOTTOM - ROOM_TOP + 1, Terrain.EMPTY );
|
||||
|
||||
entrance = Random.Int( ROOM_LEFT + 1, ROOM_RIGHT - 1 ) +
|
||||
entrance = Random.Int( ROOM_LEFT + 1, ROOM_RIGHT - 1 ) +
|
||||
Random.Int( ROOM_TOP + 1, ROOM_BOTTOM - 1 ) * WIDTH;
|
||||
map[entrance] = Terrain.ENTRANCE;
|
||||
|
||||
@@ -125,17 +125,17 @@ public class HallsBossLevel extends Level {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void decorate() {
|
||||
protected void decorate() {
|
||||
|
||||
for (int i=0; i < LENGTH; i++) {
|
||||
if (map[i] == Terrain.EMPTY && Random.Int( 10 ) == 0) {
|
||||
if (map[i] == Terrain.EMPTY && Random.Int( 10 ) == 0) {
|
||||
map[i] = Terrain.EMPTY_DECO;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createMobs() {
|
||||
protected void createMobs() {
|
||||
}
|
||||
|
||||
public Actor respawner() {
|
||||
@@ -206,7 +206,7 @@ public class HallsBossLevel extends Level {
|
||||
|
||||
if (!keyDropped && item instanceof SkeletonKey) {
|
||||
keyDropped = true;
|
||||
unseal();
|
||||
unseal();
|
||||
|
||||
entrance = stairs;
|
||||
set( entrance, Terrain.ENTRANCE );
|
||||
@@ -240,7 +240,7 @@ public class HallsBossLevel extends Level {
|
||||
return "It looks like lava, but it's cold and probably safe to touch.";
|
||||
case Terrain.STATUE:
|
||||
case Terrain.STATUE_SP:
|
||||
return "The pillar is made of real humanoid skulls. Awesome.";
|
||||
return "The pillar is made of real humanoid skulls. Awesome.";
|
||||
default:
|
||||
return super.tileDesc( tile );
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public class HallsLevel extends RegularLevel {
|
||||
protected void decorate() {
|
||||
|
||||
for (int i=WIDTH + 1; i < LENGTH - WIDTH - 1; i++) {
|
||||
if (map[i] == Terrain.EMPTY) {
|
||||
if (map[i] == Terrain.EMPTY) {
|
||||
|
||||
int count = 0;
|
||||
for (int j=0; j < NEIGHBOURS8.length; j++) {
|
||||
@@ -121,7 +121,7 @@ public class HallsLevel extends RegularLevel {
|
||||
return "It looks like lava, but it's cold and probably safe to touch.";
|
||||
case Terrain.STATUE:
|
||||
case Terrain.STATUE_SP:
|
||||
return "The pillar is made of real humanoid skulls. Awesome.";
|
||||
return "The pillar is made of real humanoid skulls. Awesome.";
|
||||
case Terrain.BOOKSHELF:
|
||||
return "Books in ancient languages smoulder in the bookshelf.";
|
||||
default:
|
||||
@@ -169,8 +169,8 @@ public class HallsLevel extends RegularLevel {
|
||||
delay = Random.Float( 2 );
|
||||
|
||||
PointF p = DungeonTilemap.tileToWorld( pos );
|
||||
((FireParticle)recycle( FireParticle.class )).reset(
|
||||
p.x + Random.Float( DungeonTilemap.SIZE ),
|
||||
((FireParticle)recycle( FireParticle.class )).reset(
|
||||
p.x + Random.Float( DungeonTilemap.SIZE ),
|
||||
p.y + Random.Float( DungeonTilemap.SIZE ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public class LastLevel extends Level {
|
||||
map[pedestal] = Terrain.PEDESTAL;
|
||||
map[pedestal-1-WIDTH] = map[pedestal+1-WIDTH] = map[pedestal-1+WIDTH] = map[pedestal+1+WIDTH] = Terrain.STATUE_SP;
|
||||
|
||||
exit = pedestal;
|
||||
exit = pedestal;
|
||||
|
||||
int pos = pedestal;
|
||||
|
||||
@@ -162,15 +162,15 @@ public class LastLevel extends Level {
|
||||
HallsLevel.addVisuals( this, scene );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle(Bundle bundle) {
|
||||
super.restoreFromBundle(bundle);
|
||||
for (int i=0; i < LENGTH; i++) {
|
||||
int flags = Terrain.flags[map[i]];
|
||||
if ((flags & Terrain.PIT) != 0){
|
||||
passable[i] = avoid[i] = false;
|
||||
solid[i] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void restoreFromBundle(Bundle bundle) {
|
||||
super.restoreFromBundle(bundle);
|
||||
for (int i=0; i < LENGTH; i++) {
|
||||
int flags = Terrain.flags[map[i]];
|
||||
if ((flags & Terrain.PIT) != 0){
|
||||
passable[i] = avoid[i] = false;
|
||||
solid[i] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ public class LastShopLevel extends RegularLevel {
|
||||
int shopSquare = 0;
|
||||
for (Room r : rooms) {
|
||||
if (r.type == Type.NULL && r.connected.size() > 0) {
|
||||
r.type = Type.PASSAGE;
|
||||
r.type = Type.PASSAGE;
|
||||
if (r.square() > shopSquare) {
|
||||
roomShop = r;
|
||||
shopSquare = r.square();
|
||||
@@ -128,10 +128,10 @@ public class LastShopLevel extends RegularLevel {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void decorate() {
|
||||
protected void decorate() {
|
||||
|
||||
for (int i=0; i < LENGTH; i++) {
|
||||
if (map[i] == Terrain.EMPTY && Random.Int( 10 ) == 0) {
|
||||
if (map[i] == Terrain.EMPTY && Random.Int( 10 ) == 0) {
|
||||
|
||||
map[i] = Terrain.EMPTY_DECO;
|
||||
|
||||
@@ -152,7 +152,7 @@ public class LastShopLevel extends RegularLevel {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createMobs() {
|
||||
protected void createMobs() {
|
||||
}
|
||||
|
||||
public Actor respawner() {
|
||||
@@ -217,7 +217,7 @@ public class LastShopLevel extends RegularLevel {
|
||||
|
||||
@Override
|
||||
public void addVisuals( Scene scene ) {
|
||||
super.addVisuals( scene );
|
||||
super.addVisuals( scene );
|
||||
CityLevel.addVisuals( this, scene );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,17 +102,17 @@ public abstract class Level implements Bundlable {
|
||||
public static final int[] NEIGHBOURS8 = {-WIDTH, +1-WIDTH, +1, +1+WIDTH, +WIDTH, -1+WIDTH, -1, -1-WIDTH};
|
||||
public static final int[] NEIGHBOURS9 = {0, -WIDTH, +1-WIDTH, +1, +1+WIDTH, +WIDTH, -1+WIDTH, -1, -1-WIDTH};
|
||||
|
||||
//make sure to check insideMap() when using these, as there's a risk something may be outside the map
|
||||
public static final int[] NEIGHBOURS8DIST2 = {+2+2*WIDTH, +1+2*WIDTH, 2*WIDTH, -1+2*WIDTH, -2+2*WIDTH,
|
||||
+2+WIDTH, +1+WIDTH, +WIDTH, -1+WIDTH, -2+WIDTH,
|
||||
+2, +1, -1, -2,
|
||||
+2-WIDTH, +1-WIDTH, -WIDTH, -1-WIDTH, -2-WIDTH,
|
||||
+2-2*WIDTH, +1-2*WIDTH, -2*WIDTH, -1-2*WIDTH, -2-2*WIDTH};
|
||||
public static final int[] NEIGHBOURS9DIST2 = {+2+2*WIDTH, +1+2*WIDTH, 2*WIDTH, -1+2*WIDTH, -2+2*WIDTH,
|
||||
+2+WIDTH, +1+WIDTH, +WIDTH, -1+WIDTH, -2+WIDTH,
|
||||
+2, +1, 0, -1, -2,
|
||||
+2-WIDTH, +1-WIDTH, -WIDTH, -1-WIDTH, -2-WIDTH,
|
||||
+2-2*WIDTH, +1-2*WIDTH, -2*WIDTH, -1-2*WIDTH, -2-2*WIDTH};
|
||||
//make sure to check insideMap() when using these, as there's a risk something may be outside the map
|
||||
public static final int[] NEIGHBOURS8DIST2 = {+2+2*WIDTH, +1+2*WIDTH, 2*WIDTH, -1+2*WIDTH, -2+2*WIDTH,
|
||||
+2+WIDTH, +1+WIDTH, +WIDTH, -1+WIDTH, -2+WIDTH,
|
||||
+2, +1, -1, -2,
|
||||
+2-WIDTH, +1-WIDTH, -WIDTH, -1-WIDTH, -2-WIDTH,
|
||||
+2-2*WIDTH, +1-2*WIDTH, -2*WIDTH, -1-2*WIDTH, -2-2*WIDTH};
|
||||
public static final int[] NEIGHBOURS9DIST2 = {+2+2*WIDTH, +1+2*WIDTH, 2*WIDTH, -1+2*WIDTH, -2+2*WIDTH,
|
||||
+2+WIDTH, +1+WIDTH, +WIDTH, -1+WIDTH, -2+WIDTH,
|
||||
+2, +1, 0, -1, -2,
|
||||
+2-WIDTH, +1-WIDTH, -WIDTH, -1-WIDTH, -2-WIDTH,
|
||||
+2-2*WIDTH, +1-2*WIDTH, -2*WIDTH, -1-2*WIDTH, -2-2*WIDTH};
|
||||
|
||||
|
||||
protected static final float TIME_TO_RESPAWN = 50;
|
||||
@@ -127,7 +127,7 @@ public abstract class Level implements Bundlable {
|
||||
public boolean[] visited;
|
||||
public boolean[] mapped;
|
||||
|
||||
public int viewDistance = Dungeon.isChallenged( Challenges.DARKNESS ) ? 3: 8;
|
||||
public int viewDistance = Dungeon.isChallenged( Challenges.DARKNESS ) ? 3: 8;
|
||||
|
||||
public static boolean[] fieldOfView = new boolean[LENGTH];
|
||||
|
||||
@@ -147,8 +147,8 @@ public abstract class Level implements Bundlable {
|
||||
public int entrance;
|
||||
public int exit;
|
||||
|
||||
//when a boss level has become locked.
|
||||
public boolean locked = false;
|
||||
//when a boss level has become locked.
|
||||
public boolean locked = false;
|
||||
|
||||
public HashSet<Mob> mobs;
|
||||
public SparseArray<Heap> heaps;
|
||||
@@ -170,7 +170,7 @@ public abstract class Level implements Bundlable {
|
||||
private static final String MAPPED = "mapped";
|
||||
private static final String ENTRANCE = "entrance";
|
||||
private static final String EXIT = "exit";
|
||||
private static final String LOCKED = "locked";
|
||||
private static final String LOCKED = "locked";
|
||||
private static final String HEAPS = "heaps";
|
||||
private static final String PLANTS = "plants";
|
||||
private static final String TRAPS = "traps";
|
||||
@@ -196,37 +196,37 @@ public abstract class Level implements Bundlable {
|
||||
}
|
||||
if (Dungeon.souNeeded()) {
|
||||
addItemToSpawn( new ScrollOfUpgrade() );
|
||||
Dungeon.limitedDrops.upgradeScrolls.count++;
|
||||
Dungeon.limitedDrops.upgradeScrolls.count++;
|
||||
}
|
||||
if (Dungeon.asNeeded()) {
|
||||
addItemToSpawn( new Stylus() );
|
||||
Dungeon.limitedDrops.arcaneStyli.count++;
|
||||
Dungeon.limitedDrops.arcaneStyli.count++;
|
||||
}
|
||||
|
||||
int bonus = 0;
|
||||
for (Buff buff : Dungeon.hero.buffs(RingOfWealth.Wealth.class)) {
|
||||
bonus += ((RingOfWealth.Wealth) buff).level;
|
||||
}
|
||||
if (Random.Float() > Math.pow(0.95, bonus)){
|
||||
if (Random.Int(2) == 0)
|
||||
addItemToSpawn( new ScrollOfMagicalInfusion() );
|
||||
else
|
||||
addItemToSpawn( new PotionOfMight() );
|
||||
}
|
||||
int bonus = 0;
|
||||
for (Buff buff : Dungeon.hero.buffs(RingOfWealth.Wealth.class)) {
|
||||
bonus += ((RingOfWealth.Wealth) buff).level;
|
||||
}
|
||||
if (Random.Float() > Math.pow(0.95, bonus)){
|
||||
if (Random.Int(2) == 0)
|
||||
addItemToSpawn( new ScrollOfMagicalInfusion() );
|
||||
else
|
||||
addItemToSpawn( new PotionOfMight() );
|
||||
}
|
||||
|
||||
DriedRose rose = Dungeon.hero.belongings.getItem( DriedRose.class );
|
||||
if (rose != null && !rose.cursed){
|
||||
//this way if a rose is dropped later in the game, player still has a chance to max it out.
|
||||
int petalsNeeded = (int) Math.ceil((float)((Dungeon.depth / 2) - rose.droppedPetals) / 3);
|
||||
DriedRose rose = Dungeon.hero.belongings.getItem( DriedRose.class );
|
||||
if (rose != null && !rose.cursed){
|
||||
//this way if a rose is dropped later in the game, player still has a chance to max it out.
|
||||
int petalsNeeded = (int) Math.ceil((float)((Dungeon.depth / 2) - rose.droppedPetals) / 3);
|
||||
|
||||
for (int i=1; i <= petalsNeeded; i++) {
|
||||
for (int i=1; i <= petalsNeeded; i++) {
|
||||
//the player may miss a single petal and still max their rose.
|
||||
if (rose.droppedPetals < 11) {
|
||||
addItemToSpawn(new DriedRose.Petal());
|
||||
rose.droppedPetals++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rose.droppedPetals < 11) {
|
||||
addItemToSpawn(new DriedRose.Petal());
|
||||
rose.droppedPetals++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Dungeon.depth > 1) {
|
||||
switch (Random.Int( 10 )) {
|
||||
@@ -274,7 +274,7 @@ public abstract class Level implements Bundlable {
|
||||
createItems();
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
public void reset() {
|
||||
|
||||
for (Mob mob : mobs.toArray( new Mob[0] )) {
|
||||
if (!mob.reset()) {
|
||||
@@ -303,7 +303,7 @@ public abstract class Level implements Bundlable {
|
||||
entrance = bundle.getInt( ENTRANCE );
|
||||
exit = bundle.getInt( EXIT );
|
||||
|
||||
locked = bundle.getBoolean( LOCKED );
|
||||
locked = bundle.getBoolean( LOCKED );
|
||||
|
||||
weakFloorCreated = false;
|
||||
|
||||
@@ -320,8 +320,8 @@ public abstract class Level implements Bundlable {
|
||||
if (resizingNeeded) {
|
||||
heap.pos = adjustPos( heap.pos );
|
||||
}
|
||||
if (!heap.isEmpty())
|
||||
heaps.put( heap.pos, heap );
|
||||
if (!heap.isEmpty())
|
||||
heaps.put( heap.pos, heap );
|
||||
}
|
||||
|
||||
collection = bundle.getCollection( PLANTS );
|
||||
@@ -375,7 +375,7 @@ public abstract class Level implements Bundlable {
|
||||
bundle.put( MAPPED, mapped );
|
||||
bundle.put( ENTRANCE, entrance );
|
||||
bundle.put( EXIT, exit );
|
||||
bundle.put( LOCKED, locked );
|
||||
bundle.put( LOCKED, locked );
|
||||
bundle.put( HEAPS, heaps.values() );
|
||||
bundle.put( PLANTS, plants.values() );
|
||||
bundle.put( TRAPS, traps.values() );
|
||||
@@ -416,7 +416,7 @@ public abstract class Level implements Bundlable {
|
||||
this.mapped = mapped;
|
||||
|
||||
entrance = adjustPos( entrance );
|
||||
exit = adjustPos( exit );
|
||||
exit = adjustPos( exit );
|
||||
} else {
|
||||
resizingNeeded = false;
|
||||
}
|
||||
@@ -528,27 +528,27 @@ public abstract class Level implements Bundlable {
|
||||
}
|
||||
}
|
||||
|
||||
public Item findPrizeItem(){ return findPrizeItem(null); }
|
||||
public Item findPrizeItem(){ return findPrizeItem(null); }
|
||||
|
||||
public Item findPrizeItem(Class<?extends Item> match){
|
||||
if (itemsToSpawn.size() == 0)
|
||||
return null;
|
||||
public Item findPrizeItem(Class<?extends Item> match){
|
||||
if (itemsToSpawn.size() == 0)
|
||||
return null;
|
||||
|
||||
if (match == null){
|
||||
Item item = Random.element(itemsToSpawn);
|
||||
itemsToSpawn.remove(item);
|
||||
return item;
|
||||
}
|
||||
if (match == null){
|
||||
Item item = Random.element(itemsToSpawn);
|
||||
itemsToSpawn.remove(item);
|
||||
return item;
|
||||
}
|
||||
|
||||
for (Item item : itemsToSpawn){
|
||||
if (match.isInstance(item)){
|
||||
itemsToSpawn.remove( item );
|
||||
return item;
|
||||
}
|
||||
}
|
||||
for (Item item : itemsToSpawn){
|
||||
if (match.isInstance(item)){
|
||||
itemsToSpawn.remove( item );
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void buildFlagMaps() {
|
||||
|
||||
@@ -590,7 +590,7 @@ public abstract class Level implements Bundlable {
|
||||
if (!pit[i - WIDTH]) {
|
||||
int c = map[i - WIDTH];
|
||||
if (c == Terrain.EMPTY_SP || c == Terrain.STATUE_SP) {
|
||||
map[i] = Terrain.CHASM_FLOOR_SP;
|
||||
map[i] = Terrain.CHASM_FLOOR_SP;
|
||||
} else if (water[i - WIDTH]) {
|
||||
map[i] = Terrain.CHASM_WATER;
|
||||
} else if ((Terrain.flags[c] & Terrain.UNSTITCHABLE) != 0) {
|
||||
@@ -603,7 +603,7 @@ public abstract class Level implements Bundlable {
|
||||
}
|
||||
}
|
||||
|
||||
private void cleanWalls() {
|
||||
private void cleanWalls() {
|
||||
for (int i=0; i < LENGTH; i++) {
|
||||
|
||||
boolean d = false;
|
||||
@@ -653,26 +653,26 @@ public abstract class Level implements Bundlable {
|
||||
public Heap drop( Item item, int cell ) {
|
||||
|
||||
//This messy if statement deals will items which should not drop in challenges primarily.
|
||||
if ((Dungeon.isChallenged( Challenges.NO_FOOD ) && (item instanceof Food || item instanceof BlandfruitBush.Seed)) ||
|
||||
(Dungeon.isChallenged( Challenges.NO_ARMOR ) && item instanceof Armor) ||
|
||||
(Dungeon.isChallenged( Challenges.NO_HEALING ) && item instanceof PotionOfHealing) ||
|
||||
(Dungeon.isChallenged( Challenges.NO_HERBALISM ) && (item instanceof Plant.Seed || item instanceof Dewdrop || item instanceof SeedPouch)) ||
|
||||
(Dungeon.isChallenged( Challenges.NO_SCROLLS ) && ((item instanceof Scroll && !(item instanceof ScrollOfUpgrade)) || item instanceof ScrollHolder)) ||
|
||||
if ((Dungeon.isChallenged( Challenges.NO_FOOD ) && (item instanceof Food || item instanceof BlandfruitBush.Seed)) ||
|
||||
(Dungeon.isChallenged( Challenges.NO_ARMOR ) && item instanceof Armor) ||
|
||||
(Dungeon.isChallenged( Challenges.NO_HEALING ) && item instanceof PotionOfHealing) ||
|
||||
(Dungeon.isChallenged( Challenges.NO_HERBALISM ) && (item instanceof Plant.Seed || item instanceof Dewdrop || item instanceof SeedPouch)) ||
|
||||
(Dungeon.isChallenged( Challenges.NO_SCROLLS ) && ((item instanceof Scroll && !(item instanceof ScrollOfUpgrade)) || item instanceof ScrollHolder)) ||
|
||||
item == null) {
|
||||
|
||||
//create a dummy heap, give it a dummy sprite, don't add it to the game, and return it.
|
||||
//effectively nullifies whatever the logic calling this wants to do, including dropping items.
|
||||
Heap heap = new Heap();
|
||||
ItemSprite sprite = heap.sprite = new ItemSprite();
|
||||
sprite.link( heap );
|
||||
return heap;
|
||||
//create a dummy heap, give it a dummy sprite, don't add it to the game, and return it.
|
||||
//effectively nullifies whatever the logic calling this wants to do, including dropping items.
|
||||
Heap heap = new Heap();
|
||||
ItemSprite sprite = heap.sprite = new ItemSprite();
|
||||
sprite.link( heap );
|
||||
return heap;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ((map[cell] == Terrain.ALCHEMY) && (
|
||||
!(item instanceof Plant.Seed || item instanceof Blandfruit) ||
|
||||
item instanceof BlandfruitBush.Seed ||
|
||||
(item instanceof Blandfruit && (((Blandfruit) item).potionAttrib != null || heaps.get(cell) != null))||
|
||||
(item instanceof Blandfruit && (((Blandfruit) item).potionAttrib != null || heaps.get(cell) != null))||
|
||||
Dungeon.hero.buff(AlchemistsToolkit.alchemy.class) != null && Dungeon.hero.buff(AlchemistsToolkit.alchemy.class).isCursed())) {
|
||||
int n;
|
||||
do {
|
||||
@@ -719,14 +719,14 @@ public abstract class Level implements Bundlable {
|
||||
plant.wither();
|
||||
}
|
||||
|
||||
if (map[pos] == Terrain.HIGH_GRASS ||
|
||||
map[pos] == Terrain.EMPTY ||
|
||||
map[pos] == Terrain.EMBERS ||
|
||||
map[pos] == Terrain.EMPTY_DECO) {
|
||||
map[pos] = Terrain.GRASS;
|
||||
flamable[pos] = true;
|
||||
GameScene.updateMap( pos );
|
||||
}
|
||||
if (map[pos] == Terrain.HIGH_GRASS ||
|
||||
map[pos] == Terrain.EMPTY ||
|
||||
map[pos] == Terrain.EMBERS ||
|
||||
map[pos] == Terrain.EMPTY_DECO) {
|
||||
map[pos] = Terrain.GRASS;
|
||||
flamable[pos] = true;
|
||||
GameScene.updateMap( pos );
|
||||
}
|
||||
|
||||
plant = seed.couch( pos );
|
||||
plants.put( pos, plant );
|
||||
|
||||
@@ -115,9 +115,9 @@ public class PrisonBossLevel extends RegularLevel {
|
||||
}
|
||||
roomExit = Random.element( rooms );
|
||||
} while (
|
||||
roomExit == roomEntrance ||
|
||||
roomExit.width() < 7 ||
|
||||
roomExit.height() < 7 ||
|
||||
roomExit == roomEntrance ||
|
||||
roomExit.width() < 7 ||
|
||||
roomExit.height() < 7 ||
|
||||
roomExit.top == 0);
|
||||
|
||||
Graph.buildDistanceMap( rooms, roomExit );
|
||||
@@ -128,7 +128,7 @@ public class PrisonBossLevel extends RegularLevel {
|
||||
roomEntrance.type = Type.ENTRANCE;
|
||||
roomExit.type = Type.BOSS_EXIT;
|
||||
|
||||
List<Room> path = Graph.buildPath( rooms, roomEntrance, roomExit );
|
||||
List<Room> path = Graph.buildPath( rooms, roomEntrance, roomExit );
|
||||
Graph.setPrice( path, roomEntrance.distance );
|
||||
|
||||
Graph.buildDistanceMap( rooms, roomExit );
|
||||
@@ -145,7 +145,7 @@ public class PrisonBossLevel extends RegularLevel {
|
||||
|
||||
for (Room r : rooms) {
|
||||
if (r.type == Type.NULL && r.connected.size() > 0) {
|
||||
r.type = Type.PASSAGE;
|
||||
r.type = Type.PASSAGE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ public class PrisonBossLevel extends RegularLevel {
|
||||
protected void decorate() {
|
||||
|
||||
for (int i=WIDTH + 1; i < LENGTH - WIDTH - 1; i++) {
|
||||
if (map[i] == Terrain.EMPTY) {
|
||||
if (map[i] == Terrain.EMPTY) {
|
||||
|
||||
float c = 0.15f;
|
||||
if (map[i + 1] == Terrain.WALL && map[i + WIDTH] == Terrain.WALL) {
|
||||
@@ -238,7 +238,7 @@ public class PrisonBossLevel extends RegularLevel {
|
||||
}
|
||||
|
||||
for (int i=0; i < WIDTH; i++) {
|
||||
if (map[i] == Terrain.WALL &&
|
||||
if (map[i] == Terrain.WALL &&
|
||||
(map[i + WIDTH] == Terrain.EMPTY || map[i + WIDTH] == Terrain.EMPTY_SP) &&
|
||||
Random.Int( 4 ) == 0) {
|
||||
|
||||
@@ -247,8 +247,8 @@ public class PrisonBossLevel extends RegularLevel {
|
||||
}
|
||||
|
||||
for (int i=WIDTH; i < LENGTH - WIDTH; i++) {
|
||||
if (map[i] == Terrain.WALL &&
|
||||
map[i - WIDTH] == Terrain.WALL &&
|
||||
if (map[i] == Terrain.WALL &&
|
||||
map[i - WIDTH] == Terrain.WALL &&
|
||||
(map[i + WIDTH] == Terrain.EMPTY || map[i + WIDTH] == Terrain.EMPTY_SP) &&
|
||||
Random.Int( 2 ) == 0) {
|
||||
|
||||
@@ -262,7 +262,7 @@ public class PrisonBossLevel extends RegularLevel {
|
||||
arenaDoor = door.x + door.y * WIDTH;
|
||||
Painter.set( this, arenaDoor, Terrain.LOCKED_DOOR );
|
||||
|
||||
Painter.fill( this,
|
||||
Painter.fill( this,
|
||||
roomExit.left + 2,
|
||||
roomExit.top + 2,
|
||||
roomExit.width() - 3,
|
||||
@@ -305,7 +305,7 @@ public class PrisonBossLevel extends RegularLevel {
|
||||
if (ch == Dungeon.hero && !enteredArena && roomExit.inside( cell )) {
|
||||
|
||||
enteredArena = true;
|
||||
seal();
|
||||
seal();
|
||||
|
||||
int pos;
|
||||
do {
|
||||
|
||||
@@ -78,7 +78,7 @@ public class PrisonLevel extends RegularLevel {
|
||||
protected void decorate() {
|
||||
|
||||
for (int i=WIDTH + 1; i < LENGTH - WIDTH - 1; i++) {
|
||||
if (map[i] == Terrain.EMPTY) {
|
||||
if (map[i] == Terrain.EMPTY) {
|
||||
|
||||
float c = 0.05f;
|
||||
if (map[i + 1] == Terrain.WALL && map[i + WIDTH] == Terrain.WALL) {
|
||||
@@ -101,7 +101,7 @@ public class PrisonLevel extends RegularLevel {
|
||||
}
|
||||
|
||||
for (int i=0; i < WIDTH; i++) {
|
||||
if (map[i] == Terrain.WALL &&
|
||||
if (map[i] == Terrain.WALL &&
|
||||
(map[i + WIDTH] == Terrain.EMPTY || map[i + WIDTH] == Terrain.EMPTY_SP) &&
|
||||
Random.Int( 6 ) == 0) {
|
||||
|
||||
@@ -110,8 +110,8 @@ public class PrisonLevel extends RegularLevel {
|
||||
}
|
||||
|
||||
for (int i=WIDTH; i < LENGTH - WIDTH; i++) {
|
||||
if (map[i] == Terrain.WALL &&
|
||||
map[i - WIDTH] == Terrain.WALL &&
|
||||
if (map[i] == Terrain.WALL &&
|
||||
map[i - WIDTH] == Terrain.WALL &&
|
||||
(map[i + WIDTH] == Terrain.EMPTY || map[i + WIDTH] == Terrain.EMPTY_SP) &&
|
||||
Random.Int( 3 ) == 0) {
|
||||
|
||||
|
||||
@@ -149,14 +149,14 @@ public abstract class RegularLevel extends Level {
|
||||
if (Dungeon.bossLevel( Dungeon.depth + 1 )) {
|
||||
specials.remove( Room.Type.WEAK_FLOOR );
|
||||
}
|
||||
if (Dungeon.isChallenged( Challenges.NO_ARMOR )){
|
||||
//no sense in giving an armor reward room on a run with no armor.
|
||||
specials.remove( Room.Type.CRYPT );
|
||||
}
|
||||
if (Dungeon.isChallenged( Challenges.NO_HERBALISM )){
|
||||
//sorry warden, no lucky sungrass or blandfruit seeds for you!
|
||||
specials.remove( Room.Type.GARDEN );
|
||||
}
|
||||
if (Dungeon.isChallenged( Challenges.NO_ARMOR )){
|
||||
//no sense in giving an armor reward room on a run with no armor.
|
||||
specials.remove( Room.Type.CRYPT );
|
||||
}
|
||||
if (Dungeon.isChallenged( Challenges.NO_HERBALISM )){
|
||||
//sorry warden, no lucky sungrass or blandfruit seeds for you!
|
||||
specials.remove( Room.Type.GARDEN );
|
||||
}
|
||||
if (!assignRoomType())
|
||||
return false;
|
||||
|
||||
@@ -203,7 +203,7 @@ public abstract class RegularLevel extends Level {
|
||||
int specialRooms = 0;
|
||||
|
||||
for (Room r : rooms) {
|
||||
if (r.type == Type.NULL &&
|
||||
if (r.type == Type.NULL &&
|
||||
r.connected.size() == 1) {
|
||||
|
||||
if (specials.size() > 0 &&
|
||||
@@ -250,7 +250,7 @@ public abstract class RegularLevel extends Level {
|
||||
|
||||
HashSet<Room> neigbours = new HashSet<Room>();
|
||||
for (Room n : r.neigbours) {
|
||||
if (!r.connected.containsKey( n ) &&
|
||||
if (!r.connected.containsKey( n ) &&
|
||||
!Room.SPECIALS.contains( n.type ) &&
|
||||
n.type != Type.PIT) {
|
||||
|
||||
@@ -274,7 +274,7 @@ public abstract class RegularLevel extends Level {
|
||||
r.type = Type.STANDARD;
|
||||
count++;
|
||||
} else {
|
||||
r.type = Type.TUNNEL;
|
||||
r.type = Type.TUNNEL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -394,14 +394,14 @@ public abstract class RegularLevel extends Level {
|
||||
split( new Rect( rect.left, rect.top, vw, rect.bottom ) );
|
||||
split( new Rect( vw, rect.top, rect.right, rect.bottom ) );
|
||||
|
||||
} else
|
||||
} else
|
||||
if (h > maxRoomSize && w < minRoomSize) {
|
||||
|
||||
int vh = Random.Int( rect.top + 3, rect.bottom - 3 );
|
||||
split( new Rect( rect.left, rect.top, rect.right, vh ) );
|
||||
split( new Rect( rect.left, vh, rect.right, rect.bottom ) );
|
||||
|
||||
} else
|
||||
} else
|
||||
if ((Math.random() <= (minRoomSize * minRoomSize / rect.square()) && w <= maxRoomSize && h <= maxRoomSize) || w < minRoomSize || h < minRoomSize) {
|
||||
|
||||
rooms.add( (Room)new Room().set( rect ) );
|
||||
@@ -446,11 +446,11 @@ public abstract class RegularLevel extends Level {
|
||||
|
||||
Rect i = r.intersect( n );
|
||||
if (i.width() == 0) {
|
||||
door = new Room.Door(
|
||||
i.left,
|
||||
door = new Room.Door(
|
||||
i.left,
|
||||
Random.Int( i.top + 1, i.bottom ) );
|
||||
} else {
|
||||
door = new Room.Door(
|
||||
door = new Room.Door(
|
||||
Random.Int( i.left + 1, i.right ),
|
||||
i.top);
|
||||
}
|
||||
@@ -654,12 +654,12 @@ public abstract class RegularLevel extends Level {
|
||||
protected void createItems() {
|
||||
|
||||
int nItems = 3;
|
||||
int bonus = 0;
|
||||
for (Buff buff : Dungeon.hero.buffs(RingOfWealth.Wealth.class)) {
|
||||
bonus += ((RingOfWealth.Wealth) buff).level;
|
||||
}
|
||||
//just incase someone gets a ridiculous ring, cap this at 80%
|
||||
bonus = Math.min(bonus, 10);
|
||||
int bonus = 0;
|
||||
for (Buff buff : Dungeon.hero.buffs(RingOfWealth.Wealth.class)) {
|
||||
bonus += ((RingOfWealth.Wealth) buff).level;
|
||||
}
|
||||
//just incase someone gets a ridiculous ring, cap this at 80%
|
||||
bonus = Math.min(bonus, 10);
|
||||
while (Random.Float() < (0.3f + bonus*0.05f)) {
|
||||
nItems++;
|
||||
}
|
||||
@@ -756,7 +756,7 @@ public abstract class RegularLevel extends Level {
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
|
||||
rooms = new HashSet<Room>( (Collection<Room>) ((Collection<?>) bundle.getCollection( "rooms" )) );
|
||||
rooms = new HashSet<Room>( (Collection<Room>) ((Collection<?>) bundle.getCollection( "rooms" )) );
|
||||
for (Room r : rooms) {
|
||||
if (r.type == Type.WEAK_FLOOR) {
|
||||
weakFloorCreated = true;
|
||||
|
||||
@@ -106,7 +106,7 @@ public class Room extends Rect implements Graph.Node, Bundlable {
|
||||
public void addNeigbour( Room other ) {
|
||||
|
||||
Rect i = intersect( other );
|
||||
if ((i.width() == 0 && i.height() >= 3) ||
|
||||
if ((i.width() == 0 && i.height() >= 3) ||
|
||||
(i.height() == 0 && i.width() >= 3)) {
|
||||
neigbours.add( other );
|
||||
other.neigbours.add( this );
|
||||
@@ -132,7 +132,7 @@ public class Room extends Rect implements Graph.Node, Bundlable {
|
||||
}
|
||||
|
||||
public Point center() {
|
||||
return new Point(
|
||||
return new Point(
|
||||
(left + right) / 2 + (((right - left) & 1) == 1 ? Random.Int( 2 ) : 0),
|
||||
(top + bottom) / 2 + (((bottom - top) & 1) == 1 ? Random.Int( 2 ) : 0) );
|
||||
}
|
||||
@@ -170,7 +170,7 @@ public class Room extends Rect implements Graph.Node, Bundlable {
|
||||
@Override
|
||||
public Collection<Room> edges() {
|
||||
return neigbours;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
|
||||
@@ -60,92 +60,92 @@ public class SewerBossLevel extends RegularLevel {
|
||||
initRooms();
|
||||
|
||||
int distance;
|
||||
//if we ever need to try 20 or more times to find a room, better to give up and try again.
|
||||
//if we ever need to try 20 or more times to find a room, better to give up and try again.
|
||||
int retry = 0;
|
||||
|
||||
//start with finding an entrance room (will also contain exit)
|
||||
//the room must be at least 4x4 and be nearer the top of the map(so that it is less likely something connects to the top)
|
||||
do {
|
||||
if (retry++ > 20) {
|
||||
return false;
|
||||
}
|
||||
roomEntrance = Random.element( rooms );
|
||||
} while (roomEntrance.width() != 8 || roomEntrance.height() < 5 || roomEntrance.top == 0 || roomEntrance.top >= 8);
|
||||
//start with finding an entrance room (will also contain exit)
|
||||
//the room must be at least 4x4 and be nearer the top of the map(so that it is less likely something connects to the top)
|
||||
do {
|
||||
if (retry++ > 20) {
|
||||
return false;
|
||||
}
|
||||
roomEntrance = Random.element( rooms );
|
||||
} while (roomEntrance.width() != 8 || roomEntrance.height() < 5 || roomEntrance.top == 0 || roomEntrance.top >= 8);
|
||||
|
||||
roomEntrance.type = Type.ENTRANCE;
|
||||
roomExit = roomEntrance;
|
||||
roomEntrance.type = Type.ENTRANCE;
|
||||
roomExit = roomEntrance;
|
||||
|
||||
|
||||
//now find the rest of the rooms for this boss mini-maze
|
||||
Room curRoom = null;
|
||||
Room lastRoom = roomEntrance;
|
||||
//we make 4 rooms, last iteration is tieing the final room to the start
|
||||
for(int i = 0; i <= 4; i++){
|
||||
retry = 0;
|
||||
//find a suitable room the first four times
|
||||
//suitable room should be empty, have a distance of 2 from the current room, and not touch the entrance.
|
||||
if (i < 4) {
|
||||
do {
|
||||
if (retry++ > 20) {
|
||||
return false;
|
||||
}
|
||||
curRoom = Random.element(rooms);
|
||||
Graph.buildDistanceMap(rooms, curRoom);
|
||||
distance = lastRoom.distance();
|
||||
} while (curRoom.type != Type.NULL || distance != 3 || curRoom.neigbours.contains(roomEntrance));
|
||||
//now find the rest of the rooms for this boss mini-maze
|
||||
Room curRoom = null;
|
||||
Room lastRoom = roomEntrance;
|
||||
//we make 4 rooms, last iteration is tieing the final room to the start
|
||||
for(int i = 0; i <= 4; i++){
|
||||
retry = 0;
|
||||
//find a suitable room the first four times
|
||||
//suitable room should be empty, have a distance of 2 from the current room, and not touch the entrance.
|
||||
if (i < 4) {
|
||||
do {
|
||||
if (retry++ > 20) {
|
||||
return false;
|
||||
}
|
||||
curRoom = Random.element(rooms);
|
||||
Graph.buildDistanceMap(rooms, curRoom);
|
||||
distance = lastRoom.distance();
|
||||
} while (curRoom.type != Type.NULL || distance != 3 || curRoom.neigbours.contains(roomEntrance));
|
||||
|
||||
curRoom.type = Type.STANDARD;
|
||||
curRoom.type = Type.STANDARD;
|
||||
|
||||
//otherwise, we're on the last iteration.
|
||||
} else {
|
||||
//set the current room to the entrance, so we can build a connection to it.
|
||||
curRoom = roomEntrance;
|
||||
}
|
||||
//otherwise, we're on the last iteration.
|
||||
} else {
|
||||
//set the current room to the entrance, so we can build a connection to it.
|
||||
curRoom = roomEntrance;
|
||||
}
|
||||
|
||||
//now build a connection between the current room and the last one.
|
||||
Graph.buildDistanceMap( rooms, curRoom );
|
||||
List<Room> path = Graph.buildPath( rooms, lastRoom, curRoom );
|
||||
//now build a connection between the current room and the last one.
|
||||
Graph.buildDistanceMap( rooms, curRoom );
|
||||
List<Room> path = Graph.buildPath( rooms, lastRoom, curRoom );
|
||||
|
||||
Graph.setPrice( path, lastRoom.distance );
|
||||
Graph.setPrice( path, lastRoom.distance );
|
||||
|
||||
path = Graph.buildPath( rooms, lastRoom, curRoom );
|
||||
path = Graph.buildPath( rooms, lastRoom, curRoom );
|
||||
|
||||
Room room = lastRoom;
|
||||
for (Room next : path) {
|
||||
room.connect( next );
|
||||
room = next;
|
||||
}
|
||||
Room room = lastRoom;
|
||||
for (Room next : path) {
|
||||
room.connect( next );
|
||||
room = next;
|
||||
}
|
||||
|
||||
if (i == 4) {
|
||||
if (i == 4) {
|
||||
|
||||
//we must find a room for his royal highness!
|
||||
//look at rooms adjacent to the final found room (likely to be furthest from start)
|
||||
ArrayList<Room> candidates = new ArrayList<Room>();
|
||||
for (Room r : lastRoom.neigbours) {
|
||||
if (r.type == Type.NULL && r.connected.size() == 0 && !r.neigbours.contains(roomEntrance)) {
|
||||
candidates.add(r);
|
||||
}
|
||||
}
|
||||
//we must find a room for his royal highness!
|
||||
//look at rooms adjacent to the final found room (likely to be furthest from start)
|
||||
ArrayList<Room> candidates = new ArrayList<Room>();
|
||||
for (Room r : lastRoom.neigbours) {
|
||||
if (r.type == Type.NULL && r.connected.size() == 0 && !r.neigbours.contains(roomEntrance)) {
|
||||
candidates.add(r);
|
||||
}
|
||||
}
|
||||
|
||||
//if we have candidates, pick a room and put the king there
|
||||
if (candidates.size() > 0) {
|
||||
Room kingsRoom = Random.element(candidates);
|
||||
kingsRoom.connect(lastRoom);
|
||||
kingsRoom.type = Room.Type.RAT_KING;
|
||||
//if we have candidates, pick a room and put the king there
|
||||
if (candidates.size() > 0) {
|
||||
Room kingsRoom = Random.element(candidates);
|
||||
kingsRoom.connect(lastRoom);
|
||||
kingsRoom.type = Room.Type.RAT_KING;
|
||||
|
||||
//unacceptable! make a new level...
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
lastRoom = curRoom;
|
||||
}
|
||||
//unacceptable! make a new level...
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
lastRoom = curRoom;
|
||||
}
|
||||
|
||||
//the connection structure ensures that (most of the time) there is a nice loop for the player to kite the
|
||||
//boss around. What's nice is that there is enough chaos such that the loop is rarely straightforward
|
||||
//and boring.
|
||||
//the connection structure ensures that (most of the time) there is a nice loop for the player to kite the
|
||||
//boss around. What's nice is that there is enough chaos such that the loop is rarely straightforward
|
||||
//and boring.
|
||||
|
||||
//fills our connection rooms in with tunnel
|
||||
//fills our connection rooms in with tunnel
|
||||
for (Room r : rooms) {
|
||||
if (r.type == Type.NULL && r.connected.size() > 0) {
|
||||
r.type = Type.TUNNEL;
|
||||
@@ -154,9 +154,9 @@ public class SewerBossLevel extends RegularLevel {
|
||||
|
||||
paint();
|
||||
|
||||
//sticks the exit in the room entrance.
|
||||
exit = roomEntrance.top * Level.WIDTH + (roomEntrance.left + roomEntrance.right) / 2;
|
||||
map[exit] = Terrain.LOCKED_EXIT;
|
||||
//sticks the exit in the room entrance.
|
||||
exit = roomEntrance.top * Level.WIDTH + (roomEntrance.left + roomEntrance.right) / 2;
|
||||
map[exit] = Terrain.LOCKED_EXIT;
|
||||
|
||||
//make sure the exit is only visible in the entrance room.
|
||||
int count = 0;
|
||||
@@ -184,7 +184,7 @@ public class SewerBossLevel extends RegularLevel {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void decorate() {
|
||||
protected void decorate() {
|
||||
int start = roomExit.top * WIDTH + roomExit.left + 1;
|
||||
int end = start + roomExit.width() - 1;
|
||||
for (int i=start; i < end; i++) {
|
||||
@@ -208,10 +208,10 @@ public class SewerBossLevel extends RegularLevel {
|
||||
@Override
|
||||
protected void createMobs() {
|
||||
Mob mob = Bestiary.mob( Dungeon.depth );
|
||||
Room room;
|
||||
do {
|
||||
room = Random.element(rooms);
|
||||
} while (room.type != Type.STANDARD);
|
||||
Room room;
|
||||
do {
|
||||
room = Random.element(rooms);
|
||||
} while (room.type != Type.STANDARD);
|
||||
mob.pos = room.random();
|
||||
mobs.add( mob );
|
||||
}
|
||||
@@ -255,7 +255,7 @@ public class SewerBossLevel extends RegularLevel {
|
||||
public void unseal() {
|
||||
if (stairs != 0) {
|
||||
|
||||
super.unseal();
|
||||
super.unseal();
|
||||
|
||||
entrance = stairs;
|
||||
stairs = 0;
|
||||
|
||||
@@ -60,7 +60,7 @@ public class SewerLevel extends RegularLevel {
|
||||
protected void decorate() {
|
||||
|
||||
for (int i=0; i < WIDTH; i++) {
|
||||
if (map[i] == Terrain.WALL &&
|
||||
if (map[i] == Terrain.WALL &&
|
||||
map[i + WIDTH] == Terrain.WATER &&
|
||||
Random.Int( 4 ) == 0) {
|
||||
|
||||
@@ -69,8 +69,8 @@ public class SewerLevel extends RegularLevel {
|
||||
}
|
||||
|
||||
for (int i=WIDTH; i < LENGTH - WIDTH; i++) {
|
||||
if (map[i] == Terrain.WALL &&
|
||||
map[i - WIDTH] == Terrain.WALL &&
|
||||
if (map[i] == Terrain.WALL &&
|
||||
map[i - WIDTH] == Terrain.WALL &&
|
||||
map[i + WIDTH] == Terrain.WATER &&
|
||||
Random.Int( 2 ) == 0) {
|
||||
|
||||
@@ -79,11 +79,11 @@ public class SewerLevel extends RegularLevel {
|
||||
}
|
||||
|
||||
for (int i=WIDTH + 1; i < LENGTH - WIDTH - 1; i++) {
|
||||
if (map[i] == Terrain.EMPTY) {
|
||||
if (map[i] == Terrain.EMPTY) {
|
||||
|
||||
int count =
|
||||
(map[i + 1] == Terrain.WALL ? 1 : 0) +
|
||||
(map[i - 1] == Terrain.WALL ? 1 : 0) +
|
||||
int count =
|
||||
(map[i + 1] == Terrain.WALL ? 1 : 0) +
|
||||
(map[i - 1] == Terrain.WALL ? 1 : 0) +
|
||||
(map[i + WIDTH] == Terrain.WALL ? 1 : 0) +
|
||||
(map[i - WIDTH] == Terrain.WALL ? 1 : 0);
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ public class Terrain {
|
||||
public static final int LIQUID = 0x40;
|
||||
public static final int PIT = 0x80;
|
||||
|
||||
public static final int UNSTITCHABLE = 0x100;
|
||||
public static final int UNSTITCHABLE = 0x100;
|
||||
|
||||
public static final int[] flags = new int[256];
|
||||
static {
|
||||
|
||||
@@ -31,48 +31,48 @@ import java.util.Iterator;
|
||||
public class AlchemyPot {
|
||||
|
||||
private static final String TXT_SELECT_SEED = "Select a seed to throw";
|
||||
private static final String TXT_POT = "Alchemy Pot";
|
||||
private static final String TXT_FRUIT = "Cook a Blandfruit";
|
||||
private static final String TXT_POTION = "Brew a Potion";
|
||||
private static final String TXT_OPTIONS =
|
||||
"Do you want to cook a Blandfruit with a seed, or brew a Potion from seeds?";
|
||||
private static final String TXT_POT = "Alchemy Pot";
|
||||
private static final String TXT_FRUIT = "Cook a Blandfruit";
|
||||
private static final String TXT_POTION = "Brew a Potion";
|
||||
private static final String TXT_OPTIONS =
|
||||
"Do you want to cook a Blandfruit with a seed, or brew a Potion from seeds?";
|
||||
|
||||
public static Hero hero;
|
||||
public static int pos;
|
||||
|
||||
public static boolean foundFruit;
|
||||
public static Item curItem = null;
|
||||
public static boolean foundFruit;
|
||||
public static Item curItem = null;
|
||||
|
||||
public static void operate( Hero hero, int pos ) {
|
||||
|
||||
AlchemyPot.hero = hero;
|
||||
AlchemyPot.pos = pos;
|
||||
|
||||
Iterator<Item> items = hero.belongings.iterator();
|
||||
foundFruit = false;
|
||||
Heap heap = Dungeon.level.heaps.get( pos );
|
||||
Iterator<Item> items = hero.belongings.iterator();
|
||||
foundFruit = false;
|
||||
Heap heap = Dungeon.level.heaps.get( pos );
|
||||
|
||||
if (heap == null)
|
||||
while (items.hasNext() && !foundFruit){
|
||||
curItem = items.next();
|
||||
if (curItem instanceof Blandfruit && ((Blandfruit) curItem).potionAttrib == null){
|
||||
GameScene.show(
|
||||
new WndOptions(TXT_POT, TXT_OPTIONS, TXT_FRUIT, TXT_POTION) {
|
||||
@Override
|
||||
protected void onSelect(int index) {
|
||||
if (index == 0) {
|
||||
curItem.cast( AlchemyPot.hero, AlchemyPot.pos );
|
||||
} else
|
||||
GameScene.selectItem(itemSelector, WndBag.Mode.SEED, TXT_SELECT_SEED);
|
||||
}
|
||||
}
|
||||
);
|
||||
foundFruit = true;
|
||||
}
|
||||
}
|
||||
if (heap == null)
|
||||
while (items.hasNext() && !foundFruit){
|
||||
curItem = items.next();
|
||||
if (curItem instanceof Blandfruit && ((Blandfruit) curItem).potionAttrib == null){
|
||||
GameScene.show(
|
||||
new WndOptions(TXT_POT, TXT_OPTIONS, TXT_FRUIT, TXT_POTION) {
|
||||
@Override
|
||||
protected void onSelect(int index) {
|
||||
if (index == 0) {
|
||||
curItem.cast( AlchemyPot.hero, AlchemyPot.pos );
|
||||
} else
|
||||
GameScene.selectItem(itemSelector, WndBag.Mode.SEED, TXT_SELECT_SEED);
|
||||
}
|
||||
}
|
||||
);
|
||||
foundFruit = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundFruit)
|
||||
GameScene.selectItem(itemSelector, WndBag.Mode.SEED, TXT_SELECT_SEED);
|
||||
if (!foundFruit)
|
||||
GameScene.selectItem(itemSelector, WndBag.Mode.SEED, TXT_SELECT_SEED);
|
||||
}
|
||||
|
||||
private static final WndBag.Listener itemSelector = new WndBag.Listener() {
|
||||
|
||||
@@ -45,13 +45,13 @@ public class Chasm {
|
||||
private static final String TXT_CHASM = "Chasm";
|
||||
private static final String TXT_YES = "Yes, I know what I'm doing";
|
||||
private static final String TXT_NO = "No, I changed my mind";
|
||||
private static final String TXT_JUMP =
|
||||
private static final String TXT_JUMP =
|
||||
"Do you really want to jump into the chasm? You can probably die.";
|
||||
|
||||
public static boolean jumpConfirmed = false;
|
||||
|
||||
public static void heroJump( final Hero hero ) {
|
||||
GameScene.show(
|
||||
GameScene.show(
|
||||
new WndOptions( TXT_CHASM, TXT_JUMP, TXT_YES, TXT_NO ) {
|
||||
@Override
|
||||
protected void onSelect( int index ) {
|
||||
@@ -73,8 +73,8 @@ public class Chasm {
|
||||
Buff buff = Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class);
|
||||
if (buff != null) buff.detach();
|
||||
|
||||
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] ))
|
||||
if (mob instanceof DriedRose.GhostHero) mob.destroy();
|
||||
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] ))
|
||||
if (mob instanceof DriedRose.GhostHero) mob.destroy();
|
||||
|
||||
if (Dungeon.hero.isAlive()) {
|
||||
Dungeon.hero.interrupt();
|
||||
|
||||
@@ -44,41 +44,41 @@ public class HighGrass {
|
||||
Level.set( pos, Terrain.GRASS );
|
||||
GameScene.updateMap( pos );
|
||||
|
||||
if (!Dungeon.isChallenged( Challenges.NO_HERBALISM )) {
|
||||
int naturalismLevel = 0;
|
||||
if (!Dungeon.isChallenged( Challenges.NO_HERBALISM )) {
|
||||
int naturalismLevel = 0;
|
||||
|
||||
if (ch != null) {
|
||||
SandalsOfNature.Naturalism naturalism = ch.buff( SandalsOfNature.Naturalism.class );
|
||||
if (naturalism != null) {
|
||||
if (!naturalism.isCursed()) {
|
||||
naturalismLevel = naturalism.level() + 1;
|
||||
naturalism.charge();
|
||||
} else {
|
||||
naturalismLevel = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ch != null) {
|
||||
SandalsOfNature.Naturalism naturalism = ch.buff( SandalsOfNature.Naturalism.class );
|
||||
if (naturalism != null) {
|
||||
if (!naturalism.isCursed()) {
|
||||
naturalismLevel = naturalism.level() + 1;
|
||||
naturalism.charge();
|
||||
} else {
|
||||
naturalismLevel = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (naturalismLevel >= 0) {
|
||||
// Seed, scales from 1/16 to 1/4
|
||||
if (Random.Int(16 - ((int) (naturalismLevel * 3))) == 0) {
|
||||
Item seed = Generator.random(Generator.Category.SEED);
|
||||
if (naturalismLevel >= 0) {
|
||||
// Seed, scales from 1/16 to 1/4
|
||||
if (Random.Int(16 - ((int) (naturalismLevel * 3))) == 0) {
|
||||
Item seed = Generator.random(Generator.Category.SEED);
|
||||
|
||||
if (seed instanceof BlandfruitBush.Seed) {
|
||||
if (Random.Int(15) - Dungeon.limitedDrops.blandfruitSeed.count >= 0) {
|
||||
level.drop(seed, pos).sprite.drop();
|
||||
Dungeon.limitedDrops.blandfruitSeed.count++;
|
||||
}
|
||||
} else
|
||||
level.drop(seed, pos).sprite.drop();
|
||||
}
|
||||
if (seed instanceof BlandfruitBush.Seed) {
|
||||
if (Random.Int(15) - Dungeon.limitedDrops.blandfruitSeed.count >= 0) {
|
||||
level.drop(seed, pos).sprite.drop();
|
||||
Dungeon.limitedDrops.blandfruitSeed.count++;
|
||||
}
|
||||
} else
|
||||
level.drop(seed, pos).sprite.drop();
|
||||
}
|
||||
|
||||
// Dew, scales from 1/6 to 1/3
|
||||
if (Random.Int(24 - naturalismLevel*3) <= 3) {
|
||||
level.drop(new Dewdrop(), pos).sprite.drop();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Dew, scales from 1/6 to 1/3
|
||||
if (Random.Int(24 - naturalismLevel*3) <= 3) {
|
||||
level.drop(new Dewdrop(), pos).sprite.drop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int leaves = 4;
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndMessage;
|
||||
|
||||
public class Sign {
|
||||
|
||||
private static final String TXT_DEAD_END =
|
||||
private static final String TXT_DEAD_END =
|
||||
"What are you doing here?!";
|
||||
|
||||
private static final String[] TIPS = {
|
||||
@@ -103,17 +103,17 @@ public class Sign {
|
||||
if (index < TIPS.length) {
|
||||
GameScene.show( new WndMessage( TIPS[index] ) );
|
||||
|
||||
if (index >= 21) {
|
||||
if (index >= 21) {
|
||||
|
||||
Level.set( pos, Terrain.EMBERS );
|
||||
GameScene.updateMap( pos );
|
||||
GameScene.discoverTile( pos, Terrain.SIGN );
|
||||
Level.set( pos, Terrain.EMBERS );
|
||||
GameScene.updateMap( pos );
|
||||
GameScene.discoverTile( pos, Terrain.SIGN );
|
||||
|
||||
GLog.w( TXT_BURN );
|
||||
GLog.w( TXT_BURN );
|
||||
|
||||
CellEmitter.get( pos ).burst( ElmoParticle.FACTORY, 6 );
|
||||
Sample.INSTANCE.play( Assets.SND_BURNING );
|
||||
}
|
||||
CellEmitter.get( pos ).burst( ElmoParticle.FACTORY, 6 );
|
||||
Sample.INSTANCE.play( Assets.SND_BURNING );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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