v0.5.0b: added better checking and handling for mobs and grass

This commit is contained in:
Evan Debenham 2017-02-20 16:02:21 -05:00
parent 13091b735d
commit 5f31ee7e67
3 changed files with 10 additions and 6 deletions

View File

@ -282,8 +282,6 @@ public abstract class Level implements Bundlable {
createMobs();
createItems();
buildFlagMaps();
Random.seed();
}

View File

@ -602,8 +602,6 @@ public abstract class RegularLevel extends Level {
if (findMob(mob.pos) == null && Level.passable[mob.pos]) {
mobsToSpawn--;
mobs.add(mob);
if (map[mob.pos] == Terrain.HIGH_GRASS)
map[mob.pos] = Terrain.GRASS;
//TODO: perhaps externalize this logic into a method. Do I want to make mobs more likely to clump deeper down?
if (mobsToSpawn > 0 && Random.Int(4) == 0){
@ -613,12 +611,19 @@ public abstract class RegularLevel extends Level {
if (findMob(mob.pos) == null && Level.passable[mob.pos]) {
mobsToSpawn--;
mobs.add(mob);
if (map[mob.pos] == Terrain.HIGH_GRASS)
map[mob.pos] = Terrain.GRASS;
}
}
}
}
for (Mob m : mobs){
if (map[m.pos] == Terrain.HIGH_GRASS) {
map[m.pos] = Terrain.GRASS;
losBlocking[m.pos] = false;
}
}
}
@Override

View File

@ -56,6 +56,7 @@ public class FlockTrap extends Trap {
Sheep sheep = new Sheep();
sheep.lifespan = 2 + Random.Int(Dungeon.depth + 10);
sheep.pos = i;
Dungeon.level.mobPress(sheep);
GameScene.add(sheep);
CellEmitter.get(i).burst(Speck.factory(Speck.WOOL), 4);
}