v0.2.3e: reworked night mode into a level feeling

This commit is contained in:
Evan Debenham 2015-01-20 16:49:55 -05:00
parent 66db278940
commit e4d0017137
5 changed files with 23 additions and 13 deletions

View File

@ -169,8 +169,6 @@ public class Dungeon {
// Hero's field of view
public static boolean[] visible = new boolean[Level.LENGTH];
public static boolean nightMode;
public static int version;
@ -349,8 +347,6 @@ public class Dungeon {
@SuppressWarnings("deprecation")
public static void switchLevel( final Level level, int pos ) {
nightMode = new Date().getHours() < 7;
Dungeon.level = level;
Actor.init();

View File

@ -382,7 +382,7 @@ public abstract class Mob extends Char {
Badges.validateMonstersSlain();
Statistics.qualifiedForNoKilling = false;
if (Dungeon.nightMode) {
if (Dungeon.level.feeling == Feeling.DARK) {
Statistics.nightHunt++;
} else {
Statistics.nightHunt = 0;

View File

@ -42,6 +42,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.Stylus;
import com.shatteredpixel.shatteredpixeldungeon.items.Torch;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.AlchemistsToolkit;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
@ -84,7 +85,8 @@ public abstract class Level implements Bundlable {
NONE,
CHASM,
WATER,
GRASS
GRASS,
DARK
};
public static final int WIDTH = 32;
@ -172,6 +174,7 @@ public abstract class Level implements Bundlable {
private static final String MOBS = "mobs";
private static final String BLOBS = "blobs";
private static final String FALLING = "falling";
private static final String FEELING = "feeling";
public void create() {
@ -240,6 +243,11 @@ public abstract class Level implements Bundlable {
case 2:
feeling = Feeling.GRASS;
break;
case 3:
feeling = Feeling.DARK;
addItemToSpawn(new Torch());
viewDistance = (int)Math.ceil(viewDistance/3f);
break;
}
}
}
@ -330,6 +338,10 @@ public abstract class Level implements Bundlable {
}
fallingItems = (ArrayList)bundle.getCollection( FALLING );
feeling = bundle.getEnum( FEELING, Feeling.class );
if (feeling == Feeling.DARK)
viewDistance = (int)Math.ceil(viewDistance/3f);
buildFlagMaps();
cleanWalls();
@ -348,6 +360,7 @@ public abstract class Level implements Bundlable {
bundle.put( MOBS, mobs );
bundle.put( BLOBS, blobs.values() );
bundle.put( FALLING, fallingItems);
bundle.put( FEELING, feeling );
}
public int tunnelTile() {
@ -435,7 +448,7 @@ public abstract class Level implements Bundlable {
}
}
}
spend( Dungeon.nightMode || Statistics.amuletObtained ? TIME_TO_RESPAWN / 2 : TIME_TO_RESPAWN );
spend( Dungeon.level.feeling == Feeling.DARK || Statistics.amuletObtained ? TIME_TO_RESPAWN / 2 : TIME_TO_RESPAWN );
return true;
}
};

View File

@ -73,11 +73,11 @@ public class GameScene extends PixelScene {
private static final String TXT_WELCOME = "Welcome to the level %d of Pixel Dungeon!";
private static final String TXT_WELCOME_BACK = "Welcome back to the level %d of Pixel Dungeon!";
private static final String TXT_NIGHT_MODE = "Be cautious, since the dungeon is even more dangerous at night!";
private static final String TXT_CHASM = "Your steps echo across the dungeon.";
private static final String TXT_WATER = "You hear water splashing around you.";
private static final String TXT_GRASS = "The smell of vegetation is thick in the air.";
private static final String TXT_DARK = "You can hear enemies moving in the darkness...";
private static final String TXT_SECRETS = "The atmosphere hints that this floor hides many secrets.";
static GameScene scene;
@ -240,16 +240,16 @@ public class GameScene extends PixelScene {
case GRASS:
GLog.w( TXT_GRASS );
break;
case DARK:
GLog.w( TXT_DARK );
break;
default:
}
if (Dungeon.level instanceof RegularLevel &&
((RegularLevel)Dungeon.level).secretDoors > Random.IntRange( 3, 4 )) {
GLog.w( TXT_SECRETS );
}
if (Dungeon.nightMode && !Dungeon.bossLevel()) {
GLog.w( TXT_NIGHT_MODE );
}
busy = new BusyIndicator();
busy.camera = uiCamera;
busy.x = 1;

View File

@ -18,6 +18,7 @@
package com.shatteredpixel.shatteredpixeldungeon.scenes;
import java.nio.FloatBuffer;
import java.util.Calendar;
import com.watabou.gltextures.Gradient;
import com.watabou.gltextures.SmartTexture;
@ -82,7 +83,7 @@ public class SurfaceScene extends PixelScene {
window.camera = viewport;
add( window );
boolean dayTime = !Dungeon.nightMode;
boolean dayTime = Calendar.getInstance().get(Calendar.HOUR_OF_DAY) >= 7;
Sky sky = new Sky( dayTime );
sky.scale.set( WIDTH, HEIGHT );