v1.2.1: redesigned spreading logic for magical fire
This commit is contained in:
parent
d0d125da60
commit
a10c3b399f
|
@ -43,6 +43,7 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
import com.watabou.utils.PathFinder;
|
import com.watabou.utils.PathFinder;
|
||||||
import com.watabou.utils.Point;
|
import com.watabou.utils.Point;
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
@ -154,7 +155,8 @@ public class MagicalFireRoom extends SpecialRoom {
|
||||||
return super.canPlaceCharacter(p, l);
|
return super.canPlaceCharacter(p, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EternalFire extends Fire {
|
public static class EternalFire extends Blob {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void evolve() {
|
protected void evolve() {
|
||||||
|
|
||||||
|
@ -163,18 +165,18 @@ public class MagicalFireRoom extends SpecialRoom {
|
||||||
Freezing freeze = (Freezing)Dungeon.level.blobs.get( Freezing.class );
|
Freezing freeze = (Freezing)Dungeon.level.blobs.get( Freezing.class );
|
||||||
Blizzard bliz = (Blizzard)Dungeon.level.blobs.get( Blizzard.class );
|
Blizzard bliz = (Blizzard)Dungeon.level.blobs.get( Blizzard.class );
|
||||||
|
|
||||||
|
Fire fire = (Fire)Dungeon.level.blobs.get( Fire.class );
|
||||||
|
|
||||||
//if any part of the fire is cleared, cleanse the whole thing
|
//if any part of the fire is cleared, cleanse the whole thing
|
||||||
//Note that this is a bit brittle atm, it assumes only one group of eternal fire per floor
|
//Note that this is a bit brittle atm, it assumes only one group of eternal fire per floor
|
||||||
boolean clearAll = false;
|
boolean clearAll = false;
|
||||||
|
|
||||||
Level l = Dungeon.level;
|
Level l = Dungeon.level;
|
||||||
for (int i = area.left; i < area.right; i++){
|
for (int i = area.left - 1; i <= area.right; i++){
|
||||||
for (int j = area.top; j < area.bottom; j++){
|
for (int j = area.top - 1; j <= area.bottom; j++){
|
||||||
cell = i + j*l.width();
|
cell = i + j*l.width();
|
||||||
if (cur[cell] <= 0) continue;
|
|
||||||
|
|
||||||
cur[cell]++;
|
|
||||||
|
|
||||||
|
if (cur[cell] > 0){
|
||||||
//evaporates in the presence of water, frost, or blizzard
|
//evaporates in the presence of water, frost, or blizzard
|
||||||
//this blob is not considered interchangeable with fire, so those blobs do not interact with it otherwise
|
//this blob is not considered interchangeable with fire, so those blobs do not interact with it otherwise
|
||||||
//potion of purity can cleanse it though
|
//potion of purity can cleanse it though
|
||||||
|
@ -192,18 +194,28 @@ public class MagicalFireRoom extends SpecialRoom {
|
||||||
cur[cell] = 0;
|
cur[cell] = 0;
|
||||||
clearAll = true;
|
clearAll = true;
|
||||||
}
|
}
|
||||||
|
l.passable[cell] = cur[cell] == 0 && (Terrain.flags[l.map[cell]] & Terrain.PASSABLE) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
//if a char is adjacent, set them on fire briefly
|
if (cur[cell] > 0
|
||||||
if (cur[cell] > 0){
|
|| cur[cell-1] > 0
|
||||||
for (int k : PathFinder.NEIGHBOURS4){
|
|| cur[cell+1] > 0
|
||||||
Char ch = Actor.findChar(cell+k);
|
|| cur[cell-Dungeon.level.width()] > 0
|
||||||
if (ch != null && !ch.isImmune(getClass())){
|
|| cur[cell+Dungeon.level.width()] > 0) {
|
||||||
|
//spread fire to nearby flammable cells
|
||||||
|
if (Dungeon.level.flamable[cell] && (fire == null || fire.cur[cell] == 0)){
|
||||||
|
GameScene.add(Blob.seed(cell, 4, Fire.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
//ignite adjacent chars
|
||||||
|
Char ch = Actor.findChar(cell);
|
||||||
|
if (ch != null && !ch.isImmune(getClass())) {
|
||||||
Buff.affect(ch, Burning.class).reignite(ch, 4f);
|
Buff.affect(ch, Burning.class).reignite(ch, 4f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
l.passable[cell] = cur[cell] == 0 && (Terrain.flags[l.map[cell]] & Terrain.PASSABLE) != 0;
|
off[cell] = cur[cell];
|
||||||
|
volume += off[cell];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +224,6 @@ public class MagicalFireRoom extends SpecialRoom {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
super.evolve();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user