v1.2.0: fixed a bug with purity and adjusted some blob logic

This commit is contained in:
Evan Debenham 2022-03-08 16:03:36 -05:00
parent f34c6f3471
commit 463c3a3781
4 changed files with 19 additions and 18 deletions

View File

@ -219,6 +219,10 @@ public class Blob extends Actor {
off = new int[Dungeon.level.length()]; off = new int[Dungeon.level.length()];
} }
public void onBuildFlagMaps( Level l ){
//do nothing by default, only some blobs affect flags
}
public String tileDesc() { public String tileDesc() {
return null; return null;
} }

View File

@ -91,6 +91,16 @@ public class Web extends Blob {
Dungeon.level.buildFlagMaps(); Dungeon.level.buildFlagMaps();
} }
@Override
public void onBuildFlagMaps(Level l) {
if (volume > 0){
for (int i=0; i < l.length(); i++) {
l.solid[i] = l.solid[i] || cur[i] > 0;
l.flamable[i] = l.flamable[i] || cur[i] > 0;
}
}
}
@Override @Override
public String tileDesc() { public String tileDesc() {
return Messages.get(this, "desc"); return Messages.get(this, "desc");

View File

@ -67,16 +67,7 @@ public class PotionOfPurity extends Potion {
if (PathFinder.distance[i] < Integer.MAX_VALUE) { if (PathFinder.distance[i] < Integer.MAX_VALUE) {
for (Blob blob : blobs) { for (Blob blob : blobs) {
int value = blob.cur[i];
if (value > 0) {
blob.clear(i); blob.clear(i);
blob.cur[i] = 0;
blob.volume -= value;
}
} }
if (Dungeon.level.heroFOV[i]) { if (Dungeon.level.heroFOV[i]) {

View File

@ -657,12 +657,8 @@ public abstract class Level implements Bundlable {
pit[i] = (flags & Terrain.PIT) != 0; pit[i] = (flags & Terrain.PIT) != 0;
} }
Web w = (Web) blobs.get(Web.class); for (Blob b : blobs.values()){
if (w != null && w.volume > 0){ b.onBuildFlagMaps(this);
for (int i=0; i < length(); i++) {
solid[i] = solid[i] || w.cur[i] > 0;
flamable[i] = flamable[i] || w.cur[i] > 0;
}
} }
int lastRow = length() - width(); int lastRow = length() - width();
@ -680,7 +676,7 @@ public abstract class Level implements Bundlable {
} }
//an open space is large enough to fit large mobs. A space is open when it is not solid //an open space is large enough to fit large mobs. A space is open when it is not solid
// and there is and open corner with both adjacent cells opens // and there is an open corner with both adjacent cells opens
for (int i=0; i < length(); i++) { for (int i=0; i < length(); i++) {
if (solid[i]){ if (solid[i]){
openSpace[i] = false; openSpace[i] = false;