v3.3.5: gardens now properly set embers to grass, and account for fire
This commit is contained in:
@@ -28,9 +28,11 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.BlobEmitter;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.BlobEmitter;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShaftParticle;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShaftParticle;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
|
import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
|
import com.watabou.utils.PathFinder;
|
||||||
|
|
||||||
public class Foliage extends Blob {
|
public class Foliage extends Blob {
|
||||||
|
|
||||||
@@ -46,6 +48,8 @@ public class Foliage extends Blob {
|
|||||||
|
|
||||||
boolean seen = false;
|
boolean seen = false;
|
||||||
|
|
||||||
|
Fire fire = (Fire)Dungeon.level.blobs.get( Fire.class );
|
||||||
|
|
||||||
int cell;
|
int cell;
|
||||||
for (int i = area.left; i < area.right; i++) {
|
for (int i = area.left; i < area.right; i++) {
|
||||||
for (int j = area.top; j < area.bottom; j++) {
|
for (int j = area.top; j < area.bottom; j++) {
|
||||||
@@ -56,8 +60,19 @@ public class Foliage extends Blob {
|
|||||||
volume += off[cell];
|
volume += off[cell];
|
||||||
|
|
||||||
if (map[cell] == Terrain.EMBERS) {
|
if (map[cell] == Terrain.EMBERS) {
|
||||||
map[cell] = Terrain.GRASS;
|
//only turn terrain into grass if no fire is adjacent to it
|
||||||
GameScene.updateMap(cell);
|
boolean valid = true;
|
||||||
|
if (fire != null && fire.volume > 0) {
|
||||||
|
for (int k : PathFinder.NEIGHBOURS9) {
|
||||||
|
if (fire.cur[cell + k] > 0){
|
||||||
|
valid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (valid) {
|
||||||
|
Level.set(cell, Terrain.GRASS);
|
||||||
|
GameScene.updateMap(cell);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
seen = seen || Dungeon.level.visited[cell];
|
seen = seen || Dungeon.level.visited[cell];
|
||||||
|
|||||||
Reference in New Issue
Block a user