v0.3.0: improved previous hunger mechanics changes, now better coded & clarified

This commit is contained in:
Evan Debenham 2015-04-05 12:40:01 -04:00
parent 80c591e64a
commit 4e34e81365
13 changed files with 63 additions and 15 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -136,7 +136,7 @@ public class Hunger extends Buff implements Hero.Doom {
@Override
public int icon() {
if (Dungeon.level.locked || level < HUNGRY) {
if (level < HUNGRY) {
return BuffIndicator.NONE;
} else if (level < STARVING) {
return BuffIndicator.HUNGER;
@ -147,7 +147,7 @@ public class Hunger extends Buff implements Hero.Doom {
@Override
public String toString() {
if (Dungeon.level.locked || level < STARVING) {
if (level < STARVING) {
return "Hungry";
} else {
return "Starving";

View File

@ -0,0 +1,33 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
/**
* Created by Evan on 04/04/2015.
*/
public class LockedFloor extends Buff {
//this buff is purely meant as a visual indicator that the gameplay implications of a level seal are in effect.
@Override
public boolean act() {
spend(TICK);
if (!Dungeon.level.locked)
detach();
return true;
}
@Override
public int icon() {
return BuffIndicator.LOCKED_FLOOR;
}
@Override
public String toString() {
return "Floor is Locked";
}
}

View File

@ -423,7 +423,7 @@ public class Hero extends Char {
if (curAction == null) {
if (restoreHealth) {
if (isStarving() || HP >= HT) {
if (isStarving() || HP >= HT || Dungeon.level.locked) {
restoreHealth = false;
} else {
spend( TIME_TO_REST ); next();

View File

@ -186,7 +186,7 @@ public class Goo extends Mob {
@Override
public void move( int step ) {
((SewerBossLevel)Dungeon.level).seal();
Dungeon.level.seal();
super.move( step );
}
@ -195,7 +195,7 @@ public class Goo extends Mob {
super.die( cause );
((SewerBossLevel)Dungeon.level).unseal();
Dungeon.level.unseal();
GameScene.bossSlain();
Dungeon.level.drop( new SkeletonKey( Dungeon.depth ), pos ).sprite.drop();

View File

@ -218,7 +218,7 @@ public class CavesBossLevel extends Level {
if (!enteredArena && outsideEntraceRoom( cell ) && hero == Dungeon.hero) {
enteredArena = true;
locked = true;
seal();
Mob boss = Bestiary.mob( Dungeon.depth );
boss.state = boss.HUNTING;
@ -246,7 +246,7 @@ public class CavesBossLevel extends Level {
if (!keyDropped && item instanceof SkeletonKey) {
keyDropped = true;
locked = false;
unseal();
CellEmitter.get( arenaDoor ).start( Speck.factory( Speck.ROCK ), 0.07f, 10 );

View File

@ -177,7 +177,7 @@ public class CityBossLevel extends Level {
if (!enteredArena && outsideEntraceRoom( cell ) && hero == Dungeon.hero) {
enteredArena = true;
locked = true;
seal();
Mob boss = Bestiary.mob( Dungeon.depth );
boss.state = boss.HUNTING;
@ -208,7 +208,7 @@ public class CityBossLevel extends Level {
if (!keyDropped && item instanceof SkeletonKey) {
keyDropped = true;
locked = false;
unseal();
set( arenaDoor, Terrain.DOOR );
GameScene.updateMap( arenaDoor );

View File

@ -167,7 +167,7 @@ public class HallsBossLevel extends Level {
if (!enteredArena && hero == Dungeon.hero && cell != entrance) {
enteredArena = true;
locked = true;
seal();
for (int i=ROOM_LEFT-1; i <= ROOM_RIGHT + 1; i++) {
doMagic( (ROOM_TOP - 1) * WIDTH + i );
@ -206,7 +206,7 @@ public class HallsBossLevel extends Level {
if (!keyDropped && item instanceof SkeletonKey) {
keyDropped = true;
locked = false;
unseal();
entrance = stairs;
set( entrance, Terrain.ENTRANCE );

View File

@ -29,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.WellWater;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Awareness;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MindVision;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Shadows;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
@ -415,6 +416,19 @@ public abstract class Level implements Bundlable {
abstract protected void createItems();
public void seal(){
if (!locked) {
locked = true;
Buff.affect(Dungeon.hero, LockedFloor.class);
}
}
public void unseal(){
if (locked) {
locked = false;
}
}
public void addVisuals( Scene scene ) {
for (int i=0; i < LENGTH; i++) {
if (pit[i]) {

View File

@ -309,7 +309,7 @@ public class PrisonBossLevel extends RegularLevel {
if (ch == Dungeon.hero && !enteredArena && roomExit.inside( cell )) {
enteredArena = true;
locked = true;
seal();
int pos;
do {
@ -337,7 +337,7 @@ public class PrisonBossLevel extends RegularLevel {
if (!keyDropped && item instanceof SkeletonKey) {
keyDropped = true;
locked = false;
unseal();
set( arenaDoor, Terrain.DOOR );
GameScene.updateMap( arenaDoor );

View File

@ -241,7 +241,7 @@ public class SewerBossLevel extends RegularLevel {
public void seal() {
if (entrance != 0) {
locked = true;
super.seal();
set( entrance, Terrain.WATER_TILES );
GameScene.updateMap( entrance );
@ -255,7 +255,7 @@ public class SewerBossLevel extends RegularLevel {
public void unseal() {
if (stairs != 0) {
locked = false;
super.unseal();
entrance = stairs;
stairs = 0;

View File

@ -68,6 +68,7 @@ public class BuffIndicator extends Component {
public static final int FORESIGHT = 32;
public static final int VERTIGO = 33;
public static final int CHARGE = 34;
public static final int LOCKED_FLOOR= 35;
public static final int SIZE = 7;