v0.6.2a: fixed crashes involving tengu's FOV not being initialized

This commit is contained in:
Evan Debenham 2017-10-31 16:15:40 -04:00
parent 9ad765e256
commit 62a6c4be34

View File

@ -165,13 +165,20 @@ public class Tengu extends Mob {
private void jump() { private void jump() {
Level level = Dungeon.level; Level level = Dungeon.level;
if (level == null) return; if (enemy == null) enemy = chooseEnemy();
if (enemy == null) return;
int newPos;
//if we're in phase 1, want to warp around within the room
if (HP > HT/2) {
//place new traps
for (int i=0; i < 4; i++) { for (int i=0; i < 4; i++) {
int trapPos; int trapPos;
do { do {
trapPos = Random.Int( level.length() ); trapPos = Random.Int( level.length() );
} while (!fieldOfView[trapPos] || level.solid[trapPos]); } while (level.map[trapPos] != Terrain.INACTIVE_TRAP
&& level.map[trapPos] != Terrain.TRAP);
if (level.map[trapPos] == Terrain.INACTIVE_TRAP) { if (level.map[trapPos] == Terrain.INACTIVE_TRAP) {
level.setTrap( new GrippingTrap().reveal(), trapPos ); level.setTrap( new GrippingTrap().reveal(), trapPos );
@ -180,12 +187,6 @@ public class Tengu extends Mob {
} }
} }
if (enemy == null) enemy = chooseEnemy();
if (enemy == null) return;
int newPos;
//if we're in phase 1, want to warp around within the room
if (HP > HT/2) {
int tries = 50; int tries = 50;
do { do {
newPos = Random.IntRange(3, 7) + 32*Random.IntRange(26, 30); newPos = Random.IntRange(3, 7) + 32*Random.IntRange(26, 30);