v0.2.2: falling items now appear on the next depth (potions shatter)
This commit is contained in:
@@ -18,7 +18,10 @@
|
||||
package com.shatteredpixel.shatteredpixeldungeon.scenes;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
||||
import com.watabou.noosa.BitmapText;
|
||||
import com.watabou.noosa.Camera;
|
||||
import com.watabou.noosa.Game;
|
||||
@@ -245,8 +248,18 @@ public class InterlevelScene extends PixelScene {
|
||||
}
|
||||
|
||||
private void descend() throws Exception {
|
||||
|
||||
Actor.fixTime();
|
||||
|
||||
Level level;
|
||||
ArrayList<Item> fallingItems = new ArrayList<Item>();
|
||||
|
||||
if (Dungeon.depth > 0) {
|
||||
level = Dungeon.level;
|
||||
|
||||
fallingItems = level.fallingItems;
|
||||
level.fallingItems = new ArrayList<Item>();
|
||||
}
|
||||
|
||||
Actor.fixTime();
|
||||
if (Dungeon.hero == null) {
|
||||
Dungeon.init();
|
||||
if (noStory) {
|
||||
@@ -256,29 +269,57 @@ public class InterlevelScene extends PixelScene {
|
||||
} else {
|
||||
Dungeon.saveLevel();
|
||||
}
|
||||
|
||||
Level level;
|
||||
|
||||
if (Dungeon.depth >= Statistics.deepestFloor) {
|
||||
level = Dungeon.newLevel();
|
||||
} else {
|
||||
Dungeon.depth++;
|
||||
level = Dungeon.loadLevel( Dungeon.hero.heroClass );
|
||||
}
|
||||
|
||||
for (Item item : fallingItems){
|
||||
int cell = level.randomRespawnCell();
|
||||
while (cell == -1)
|
||||
cell = level.randomRespawnCell();
|
||||
|
||||
if (!(item instanceof Potion))
|
||||
level.drop(item, cell);
|
||||
else
|
||||
level.fallingPotions.add((Potion)item);
|
||||
}
|
||||
|
||||
Dungeon.switchLevel( level, level.entrance );
|
||||
|
||||
}
|
||||
|
||||
private void fall() throws Exception {
|
||||
|
||||
Actor.fixTime();
|
||||
|
||||
Level level = Dungeon.level;
|
||||
|
||||
ArrayList<Item> fallingItems = level.fallingItems;
|
||||
level.fallingItems = new ArrayList<Item>();
|
||||
|
||||
Actor.fixTime();
|
||||
Dungeon.saveLevel();
|
||||
|
||||
Level level;
|
||||
|
||||
if (Dungeon.depth >= Statistics.deepestFloor) {
|
||||
level = Dungeon.newLevel();
|
||||
} else {
|
||||
Dungeon.depth++;
|
||||
level = Dungeon.loadLevel( Dungeon.hero.heroClass );
|
||||
}
|
||||
|
||||
for (Item item : fallingItems){
|
||||
int cell = level.randomRespawnCell();
|
||||
while (cell == -1)
|
||||
cell = level.randomRespawnCell();
|
||||
|
||||
if (!(item instanceof Potion))
|
||||
level.drop(item, cell);
|
||||
else
|
||||
level.fallingPotions.add((Potion)item);
|
||||
}
|
||||
|
||||
Dungeon.switchLevel( level, fallIntoPit ? level.pitCell() : level.randomRespawnCell() );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user