v0.8.2b: fixed crashes caused by new respawn behaviour and questgivers

This commit is contained in:
Evan Debenham 2020-08-17 10:14:53 -04:00
parent 0b53953294
commit 422288d857
2 changed files with 16 additions and 15 deletions

View File

@ -534,17 +534,25 @@ public abstract class Level implements Bundlable {
if (count < Dungeon.level.nMobs()) {
PathFinder.buildDistanceMap(Dungeon.hero.pos, BArray.or(Dungeon.level.passable, Dungeon.level.avoid, null));
Mob mob = Dungeon.level.createMob();
mob.state = mob.WANDERING;
mob.pos = Dungeon.level.randomRespawnCell( mob );
if (Dungeon.hero.isAlive() && mob.pos != -1) {
if (Dungeon.hero.isAlive() && mob.pos != -1 && PathFinder.distance[mob.pos] >= 12) {
GameScene.add( mob );
if (Statistics.amuletObtained) {
mob.beckon( Dungeon.hero.pos );
}
spend(Dungeon.level.respawnCooldown());
} else {
//try again in 1 turn
spend(TICK);
}
} else {
spend(Dungeon.level.respawnCooldown());
}
spend(Dungeon.level.respawnCooldown());
return true;
}
}

View File

@ -55,9 +55,7 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.traps.ExplosiveTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.FrostTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.WornDartTrap;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.watabou.utils.Bundle;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
import java.util.ArrayList;
@ -238,8 +236,6 @@ public abstract class RegularLevel extends Level {
int count = 0;
int cell = -1;
PathFinder.buildDistanceMap(Dungeon.hero.pos, BArray.or(passable, avoid, null));
while (true) {
if (++count > 30) {
@ -252,15 +248,12 @@ public abstract class RegularLevel extends Level {
}
cell = pointToCell(room.random(1));
if (Actor.findChar( cell ) == null
if (!heroFOV[cell]
&& Actor.findChar( cell ) == null
&& passable[cell]
&& (!Char.hasProp(ch, Char.Property.LARGE) || openSpace[cell])
&& room.canPlaceCharacter(cellToPoint(cell), this)
&& cell != exit) {
if (heroFOV[cell] || PathFinder.distance[cell] < 12){
continue;
}
return cell;
}