diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFireblast.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFireblast.java index d578451ec..f364372f7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFireblast.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFireblast.java @@ -42,6 +42,7 @@ import com.watabou.noosa.audio.Sample; import com.watabou.utils.Callback; import com.watabou.utils.PathFinder; +import java.util.ArrayList; import java.util.HashSet; public class WandOfFireblast extends DamageWand { @@ -70,7 +71,8 @@ public class WandOfFireblast extends DamageWand { @Override protected void onZap( Ballistica bolt ) { - + + ArrayList affectedChars = new ArrayList<>(); for( int cell : affectedCells){ //ignore caster cell @@ -86,18 +88,21 @@ public class WandOfFireblast extends DamageWand { Char ch = Actor.findChar( cell ); if (ch != null) { - - processSoulMark(ch, chargesPerCast()); - ch.damage(damageRoll(), this); - Buff.affect( ch, Burning.class ).reignite( ch ); - switch(chargesPerCast()){ - case 1: - break; //no effects - case 2: - Buff.affect(ch, Cripple.class, 4f); break; - case 3: - Buff.affect(ch, Paralysis.class, 4f); break; - } + affectedChars.add(ch); + } + } + + for ( Char ch : affectedChars ){ + processSoulMark(ch, chargesPerCast()); + ch.damage(damageRoll(), this); + Buff.affect( ch, Burning.class ).reignite( ch ); + switch(chargesPerCast()){ + case 1: + break; //no effects + case 2: + Buff.affect(ch, Cripple.class, 4f); break; + case 3: + Buff.affect(ch, Paralysis.class, 4f); break; } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java index bddef8501..c28ff7017 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java @@ -310,7 +310,9 @@ public class WandOfRegrowth extends Wand { ArrayList candidates = new ArrayList(); for (int i : PathFinder.NEIGHBOURS8){ - if (Dungeon.level.passable[pos+i]){ + if (Dungeon.level.passable[pos+i] + && pos+i != Dungeon.level.entrance + && pos+i != Dungeon.level.exit){ candidates.add(pos+i); } } @@ -344,7 +346,9 @@ public class WandOfRegrowth extends Wand { ArrayList candidates = new ArrayList(); for (int i : PathFinder.NEIGHBOURS8){ - if (Dungeon.level.passable[pos+i]){ + if (Dungeon.level.passable[pos+i] + && pos+i != Dungeon.level.entrance + && pos+i != Dungeon.level.exit){ candidates.add(pos+i); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretChestChasmRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretChestChasmRoom.java index 3d3c63e19..9a689a4c6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretChestChasmRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretChestChasmRoom.java @@ -62,38 +62,55 @@ public class SecretChestChasmRoom extends SecretRoom { Painter.fill(level, this, Terrain.WALL); Painter.fill(level, this, 1, Terrain.CHASM); - Point p = new Point(left+1, top+1); - Painter.set(level, p, Terrain.EMPTY_SP); - level.drop(new GoldenKey(Dungeon.depth), level.pointToCell(p)); + int chests = 0; - p.x = right-1; - Painter.set(level, p, Terrain.EMPTY_SP); - level.drop(new GoldenKey(Dungeon.depth), level.pointToCell(p)); - - p.y = bottom-1; - Painter.set(level, p, Terrain.EMPTY_SP); - level.drop(new GoldenKey(Dungeon.depth), level.pointToCell(p)); - - p.x = left+1; - Painter.set(level, p, Terrain.EMPTY_SP); - level.drop(new GoldenKey(Dungeon.depth), level.pointToCell(p)); - - - p = new Point(left+3, top+3); + Point p = new Point(left+3, top+3); Painter.set(level, p, Terrain.EMPTY_SP); level.drop(Generator.random(), level.pointToCell(p)).type = Heap.Type.LOCKED_CHEST; + if (level.heaps.get(level.pointToCell(p)) != null) chests++; p.x = right-3; Painter.set(level, p, Terrain.EMPTY_SP); level.drop(Generator.random(), level.pointToCell(p)).type = Heap.Type.LOCKED_CHEST; + if (level.heaps.get(level.pointToCell(p)) != null) chests++; p.y = bottom-3; Painter.set(level, p, Terrain.EMPTY_SP); level.drop(Generator.random(), level.pointToCell(p)).type = Heap.Type.LOCKED_CHEST; + if (level.heaps.get(level.pointToCell(p)) != null) chests++; p.x = left+3; Painter.set(level, p, Terrain.EMPTY_SP); level.drop(Generator.random(), level.pointToCell(p)).type = Heap.Type.LOCKED_CHEST; + if (level.heaps.get(level.pointToCell(p)) != null) chests++; + + p = new Point(left+1, top+1); + Painter.set(level, p, Terrain.EMPTY_SP); + if (chests > 0) { + level.drop(new GoldenKey(Dungeon.depth), level.pointToCell(p)); + chests--; + } + + p.x = right-1; + Painter.set(level, p, Terrain.EMPTY_SP); + if (chests > 0) { + level.drop(new GoldenKey(Dungeon.depth), level.pointToCell(p)); + chests--; + } + + p.y = bottom-1; + Painter.set(level, p, Terrain.EMPTY_SP); + if (chests > 0) { + level.drop(new GoldenKey(Dungeon.depth), level.pointToCell(p)); + chests--; + } + + p.x = left+1; + Painter.set(level, p, Terrain.EMPTY_SP); + if (chests > 0) { + level.drop(new GoldenKey(Dungeon.depth), level.pointToCell(p)); + chests--; + } level.addItemToSpawn(new PotionOfLevitation());