v0.3.0c: centralized general sign placement logic, fixed a bug where traps would sometimes appear over signs.

This commit is contained in:
Evan Debenham 2015-06-05 11:24:36 -04:00 committed by Evan Debenham
parent 8a6b970c1f
commit 976ff5cb96
9 changed files with 18 additions and 56 deletions

View File

@ -144,13 +144,7 @@ public class CavesLevel extends RegularLevel {
}
}
while (true) {
int pos = roomEntrance.random();
if (pos != entrance) {
map[pos] = Terrain.SIGN;
break;
}
}
placeSign();
if (Dungeon.bossLevel( Dungeon.depth + 1 )) {
return;

View File

@ -77,13 +77,7 @@ public class CityLevel extends RegularLevel {
}
}
while (true) {
int pos = roomEntrance.random();
if (pos != entrance) {
map[pos] = Terrain.SIGN;
break;
}
}
placeSign();
}
@Override

View File

@ -94,13 +94,7 @@ public class HallsLevel extends RegularLevel {
}
}
while (true) {
int pos = roomEntrance.random();
if (pos != entrance) {
map[pos] = Terrain.SIGN;
break;
}
}
placeSign();
}
@Override

View File

@ -147,13 +147,7 @@ public class LastShopLevel extends RegularLevel {
}
if (Imp.Quest.isCompleted()) {
while (true) {
int pos = roomEntrance.random();
if (pos != entrance) {
map[pos] = Terrain.SIGN;
break;
}
}
placeSign();
}
}

View File

@ -256,13 +256,7 @@ public class PrisonBossLevel extends RegularLevel {
}
}
while (true) {
int pos = roomEntrance.random();
if (pos != entrance) {
map[pos] = Terrain.SIGN;
break;
}
}
placeSign();
Point door = roomExit.entrance();
arenaDoor = door.x + door.y * WIDTH;

View File

@ -119,13 +119,7 @@ public class PrisonLevel extends RegularLevel {
}
}
while (true) {
int pos = roomEntrance.random();
if (pos != entrance) {
map[pos] = Terrain.SIGN;
break;
}
}
placeSign();
}
@Override

View File

@ -168,6 +168,16 @@ public abstract class RegularLevel extends Level {
return true;
}
protected void placeSign(){
while (true) {
int pos = roomEntrance.random();
if (pos != entrance || traps.get(pos) == null) {
map[pos] = Terrain.SIGN;
break;
}
}
}
protected boolean initRooms() {

View File

@ -196,13 +196,7 @@ public class SewerBossLevel extends RegularLevel {
}
}
while (true) {
int pos = roomEntrance.random();
if (pos != entrance) {
map[pos] = Terrain.SIGN;
break;
}
}
placeSign();
}
@Override

View File

@ -93,13 +93,7 @@ public class SewerLevel extends RegularLevel {
}
}
while (true) {
int pos = roomEntrance.random();
if (pos != entrance) {
map[pos] = Terrain.SIGN;
break;
}
}
placeSign();
}
@Override