v0.6.1b: fixed rare crashes when tengu's arena was very full
This commit is contained in:
parent
e756328eef
commit
e9df79d108
|
@ -184,13 +184,12 @@ public class Tengu extends Mob {
|
||||||
int newPos;
|
int newPos;
|
||||||
//if we're in phase 1, want to warp around within the room
|
//if we're in phase 1, want to warp around within the room
|
||||||
if (HP > HT/2) {
|
if (HP > HT/2) {
|
||||||
|
int tries = 50;
|
||||||
do {
|
do {
|
||||||
newPos = Random.Int(Dungeon.level.length());
|
newPos = Random.IntRange(3, 7) + 32*Random.IntRange(26, 30);
|
||||||
} while (
|
} while ( (Dungeon.level.adjacent(newPos, enemy.pos) || Actor.findChar(newPos) != null)
|
||||||
!(Dungeon.level.map[newPos] == Terrain.INACTIVE_TRAP || Dungeon.level.map[newPos] == Terrain.TRAP)||
|
&& --tries > 0);
|
||||||
Level.solid[newPos] ||
|
if (tries <= 0) return;
|
||||||
Dungeon.level.adjacent(newPos, enemy.pos) ||
|
|
||||||
Actor.findChar(newPos) != null);
|
|
||||||
|
|
||||||
//otherwise go wherever, as long as it's a little bit away
|
//otherwise go wherever, as long as it's a little bit away
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user