v0.7.4a: fixed respawn cells on special levels not checking for chars
This commit is contained in:
parent
97ebb16c81
commit
b9be1a6a05
|
@ -203,10 +203,10 @@ public class CavesBossLevel extends Level {
|
|||
|
||||
@Override
|
||||
public int randomRespawnCell() {
|
||||
int cell = entrance + PathFinder.NEIGHBOURS8[Random.Int(8)];
|
||||
while (!passable[cell]){
|
||||
int cell;
|
||||
do {
|
||||
cell = entrance + PathFinder.NEIGHBOURS8[Random.Int(8)];
|
||||
}
|
||||
} while (!passable[cell] || Actor.findChar(cell) != null);
|
||||
return cell;
|
||||
}
|
||||
|
||||
|
|
|
@ -174,10 +174,10 @@ public class CityBossLevel extends Level {
|
|||
|
||||
@Override
|
||||
public int randomRespawnCell() {
|
||||
int cell = entrance + PathFinder.NEIGHBOURS8[Random.Int(8)];
|
||||
while (!passable[cell]){
|
||||
int cell;
|
||||
do {
|
||||
cell = entrance + PathFinder.NEIGHBOURS8[Random.Int(8)];
|
||||
}
|
||||
} while (!passable[cell] || Actor.findChar(cell) != null);
|
||||
return cell;
|
||||
}
|
||||
|
||||
|
|
|
@ -164,10 +164,10 @@ public class HallsBossLevel extends Level {
|
|||
@Override
|
||||
public int randomRespawnCell() {
|
||||
int pos = entrance == -1 ? stairs : entrance;
|
||||
int cell = pos + PathFinder.NEIGHBOURS8[Random.Int(8)];
|
||||
while (!passable[cell]){
|
||||
int cell;
|
||||
do {
|
||||
cell = pos + PathFinder.NEIGHBOURS8[Random.Int(8)];
|
||||
}
|
||||
} while (!passable[cell] || Actor.findChar(cell) != null);
|
||||
return cell;
|
||||
}
|
||||
|
||||
|
|
|
@ -131,10 +131,10 @@ public class LastLevel extends Level {
|
|||
|
||||
@Override
|
||||
public int randomRespawnCell() {
|
||||
int cell = entrance + PathFinder.NEIGHBOURS8[Random.Int(8)];
|
||||
while (!passable[cell]){
|
||||
int cell;
|
||||
do {
|
||||
cell = entrance + PathFinder.NEIGHBOURS8[Random.Int(8)];
|
||||
}
|
||||
} while (!passable[cell] || Actor.findChar(cell) != null);
|
||||
return cell;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,8 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ExitRoom;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ImpShopRoom;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.watabou.noosa.Group;
|
||||
import com.watabou.utils.PathFinder;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
@ -127,7 +129,11 @@ public class LastShopLevel extends RegularLevel {
|
|||
|
||||
@Override
|
||||
public int randomRespawnCell() {
|
||||
return pointToCell( roomEntrance.random() );
|
||||
int cell;
|
||||
do {
|
||||
cell = pointToCell( roomEntrance.random() );
|
||||
} while (!passable[cell] || Actor.findChar(cell) != null);
|
||||
return cell;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -210,7 +210,12 @@ public class PrisonBossLevel extends Level {
|
|||
|
||||
@Override
|
||||
public int randomRespawnCell() {
|
||||
return 5+2*32 + PathFinder.NEIGHBOURS8[Random.Int(8)]; //random cell adjacent to the entrance.
|
||||
int pos = 5+2*32; //random cell adjacent to the entrance.
|
||||
int cell;
|
||||
do {
|
||||
cell = pos + PathFinder.NEIGHBOURS8[Random.Int(8)];
|
||||
} while (!passable[cell] || Actor.findChar(cell) != null);
|
||||
return cell;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -130,7 +130,7 @@ public class SewerBossLevel extends SewerLevel {
|
|||
int pos;
|
||||
do {
|
||||
pos = pointToCell(roomEntrance.random());
|
||||
} while (pos == entrance || solid[pos]);
|
||||
} while (pos == entrance || !passable[pos] || Actor.findChar(pos) != null);
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user