v1.2.2: added more spawning requirements to cached rations
This commit is contained in:
+9
-3
@@ -425,16 +425,22 @@ public abstract class RegularLevel extends Level {
|
|||||||
if (dropped.count() < 2 + 2*Dungeon.hero.pointsInTalent(Talent.CACHED_RATIONS)){
|
if (dropped.count() < 2 + 2*Dungeon.hero.pointsInTalent(Talent.CACHED_RATIONS)){
|
||||||
int cell;
|
int cell;
|
||||||
int tries = 100;
|
int tries = 100;
|
||||||
|
boolean valid;
|
||||||
do {
|
do {
|
||||||
cell = randomDropCell(SpecialRoom.class);
|
cell = randomDropCell(SpecialRoom.class);
|
||||||
} while (tries-- > 0 && (room(cell) instanceof SecretRoom || room(cell) instanceof ShopRoom));
|
valid = !(room(cell) instanceof SecretRoom)
|
||||||
if (!(room(cell) instanceof SecretRoom || room(cell) instanceof ShopRoom) && cell != -1) {
|
&& !(room(cell) instanceof ShopRoom)
|
||||||
|
&& map[cell] != Terrain.EMPTY_SP
|
||||||
|
&& map[cell] != Terrain.WATER
|
||||||
|
&& map[cell] != Terrain.PEDESTAL;
|
||||||
|
} while (tries-- > 0 && !valid);
|
||||||
|
if (valid) {
|
||||||
if (map[cell] == Terrain.HIGH_GRASS || map[cell] == Terrain.FURROWED_GRASS) {
|
if (map[cell] == Terrain.HIGH_GRASS || map[cell] == Terrain.FURROWED_GRASS) {
|
||||||
map[cell] = Terrain.GRASS;
|
map[cell] = Terrain.GRASS;
|
||||||
losBlocking[cell] = false;
|
losBlocking[cell] = false;
|
||||||
}
|
}
|
||||||
drop(new SmallRation(), cell).type = Heap.Type.CHEST;
|
drop(new SmallRation(), cell).type = Heap.Type.CHEST;
|
||||||
dropped.countUp(1);
|
//dropped.countUp(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user