v0.3.0: improved previous hunger mechanics changes, now better coded & clarified
This commit is contained in:
parent
80c591e64a
commit
4e34e81365
BIN
assets/buffs.png
BIN
assets/buffs.png
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 |
|
@ -136,7 +136,7 @@ public class Hunger extends Buff implements Hero.Doom {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int icon() {
|
public int icon() {
|
||||||
if (Dungeon.level.locked || level < HUNGRY) {
|
if (level < HUNGRY) {
|
||||||
return BuffIndicator.NONE;
|
return BuffIndicator.NONE;
|
||||||
} else if (level < STARVING) {
|
} else if (level < STARVING) {
|
||||||
return BuffIndicator.HUNGER;
|
return BuffIndicator.HUNGER;
|
||||||
|
@ -147,7 +147,7 @@ public class Hunger extends Buff implements Hero.Doom {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if (Dungeon.level.locked || level < STARVING) {
|
if (level < STARVING) {
|
||||||
return "Hungry";
|
return "Hungry";
|
||||||
} else {
|
} else {
|
||||||
return "Starving";
|
return "Starving";
|
||||||
|
|
|
@ -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";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -423,7 +423,7 @@ public class Hero extends Char {
|
||||||
if (curAction == null) {
|
if (curAction == null) {
|
||||||
|
|
||||||
if (restoreHealth) {
|
if (restoreHealth) {
|
||||||
if (isStarving() || HP >= HT) {
|
if (isStarving() || HP >= HT || Dungeon.level.locked) {
|
||||||
restoreHealth = false;
|
restoreHealth = false;
|
||||||
} else {
|
} else {
|
||||||
spend( TIME_TO_REST ); next();
|
spend( TIME_TO_REST ); next();
|
||||||
|
|
|
@ -186,7 +186,7 @@ public class Goo extends Mob {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void move( int step ) {
|
public void move( int step ) {
|
||||||
((SewerBossLevel)Dungeon.level).seal();
|
Dungeon.level.seal();
|
||||||
super.move( step );
|
super.move( step );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ public class Goo extends Mob {
|
||||||
|
|
||||||
super.die( cause );
|
super.die( cause );
|
||||||
|
|
||||||
((SewerBossLevel)Dungeon.level).unseal();
|
Dungeon.level.unseal();
|
||||||
|
|
||||||
GameScene.bossSlain();
|
GameScene.bossSlain();
|
||||||
Dungeon.level.drop( new SkeletonKey( Dungeon.depth ), pos ).sprite.drop();
|
Dungeon.level.drop( new SkeletonKey( Dungeon.depth ), pos ).sprite.drop();
|
||||||
|
|
|
@ -218,7 +218,7 @@ public class CavesBossLevel extends Level {
|
||||||
if (!enteredArena && outsideEntraceRoom( cell ) && hero == Dungeon.hero) {
|
if (!enteredArena && outsideEntraceRoom( cell ) && hero == Dungeon.hero) {
|
||||||
|
|
||||||
enteredArena = true;
|
enteredArena = true;
|
||||||
locked = true;
|
seal();
|
||||||
|
|
||||||
Mob boss = Bestiary.mob( Dungeon.depth );
|
Mob boss = Bestiary.mob( Dungeon.depth );
|
||||||
boss.state = boss.HUNTING;
|
boss.state = boss.HUNTING;
|
||||||
|
@ -246,7 +246,7 @@ public class CavesBossLevel extends Level {
|
||||||
if (!keyDropped && item instanceof SkeletonKey) {
|
if (!keyDropped && item instanceof SkeletonKey) {
|
||||||
|
|
||||||
keyDropped = true;
|
keyDropped = true;
|
||||||
locked = false;
|
unseal();
|
||||||
|
|
||||||
CellEmitter.get( arenaDoor ).start( Speck.factory( Speck.ROCK ), 0.07f, 10 );
|
CellEmitter.get( arenaDoor ).start( Speck.factory( Speck.ROCK ), 0.07f, 10 );
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ public class CityBossLevel extends Level {
|
||||||
if (!enteredArena && outsideEntraceRoom( cell ) && hero == Dungeon.hero) {
|
if (!enteredArena && outsideEntraceRoom( cell ) && hero == Dungeon.hero) {
|
||||||
|
|
||||||
enteredArena = true;
|
enteredArena = true;
|
||||||
locked = true;
|
seal();
|
||||||
|
|
||||||
Mob boss = Bestiary.mob( Dungeon.depth );
|
Mob boss = Bestiary.mob( Dungeon.depth );
|
||||||
boss.state = boss.HUNTING;
|
boss.state = boss.HUNTING;
|
||||||
|
@ -208,7 +208,7 @@ public class CityBossLevel extends Level {
|
||||||
if (!keyDropped && item instanceof SkeletonKey) {
|
if (!keyDropped && item instanceof SkeletonKey) {
|
||||||
|
|
||||||
keyDropped = true;
|
keyDropped = true;
|
||||||
locked = false;
|
unseal();
|
||||||
|
|
||||||
set( arenaDoor, Terrain.DOOR );
|
set( arenaDoor, Terrain.DOOR );
|
||||||
GameScene.updateMap( arenaDoor );
|
GameScene.updateMap( arenaDoor );
|
||||||
|
|
|
@ -167,7 +167,7 @@ public class HallsBossLevel extends Level {
|
||||||
if (!enteredArena && hero == Dungeon.hero && cell != entrance) {
|
if (!enteredArena && hero == Dungeon.hero && cell != entrance) {
|
||||||
|
|
||||||
enteredArena = true;
|
enteredArena = true;
|
||||||
locked = true;
|
seal();
|
||||||
|
|
||||||
for (int i=ROOM_LEFT-1; i <= ROOM_RIGHT + 1; i++) {
|
for (int i=ROOM_LEFT-1; i <= ROOM_RIGHT + 1; i++) {
|
||||||
doMagic( (ROOM_TOP - 1) * WIDTH + i );
|
doMagic( (ROOM_TOP - 1) * WIDTH + i );
|
||||||
|
@ -206,7 +206,7 @@ public class HallsBossLevel extends Level {
|
||||||
|
|
||||||
if (!keyDropped && item instanceof SkeletonKey) {
|
if (!keyDropped && item instanceof SkeletonKey) {
|
||||||
keyDropped = true;
|
keyDropped = true;
|
||||||
locked = false;
|
unseal();
|
||||||
|
|
||||||
entrance = stairs;
|
entrance = stairs;
|
||||||
set( entrance, Terrain.ENTRANCE );
|
set( entrance, Terrain.ENTRANCE );
|
||||||
|
|
|
@ -29,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.WellWater;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Awareness;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Awareness;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
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.MindVision;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Shadows;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Shadows;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
|
@ -415,6 +416,19 @@ public abstract class Level implements Bundlable {
|
||||||
|
|
||||||
abstract protected void createItems();
|
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 ) {
|
public void addVisuals( Scene scene ) {
|
||||||
for (int i=0; i < LENGTH; i++) {
|
for (int i=0; i < LENGTH; i++) {
|
||||||
if (pit[i]) {
|
if (pit[i]) {
|
||||||
|
|
|
@ -309,7 +309,7 @@ public class PrisonBossLevel extends RegularLevel {
|
||||||
if (ch == Dungeon.hero && !enteredArena && roomExit.inside( cell )) {
|
if (ch == Dungeon.hero && !enteredArena && roomExit.inside( cell )) {
|
||||||
|
|
||||||
enteredArena = true;
|
enteredArena = true;
|
||||||
locked = true;
|
seal();
|
||||||
|
|
||||||
int pos;
|
int pos;
|
||||||
do {
|
do {
|
||||||
|
@ -337,7 +337,7 @@ public class PrisonBossLevel extends RegularLevel {
|
||||||
if (!keyDropped && item instanceof SkeletonKey) {
|
if (!keyDropped && item instanceof SkeletonKey) {
|
||||||
|
|
||||||
keyDropped = true;
|
keyDropped = true;
|
||||||
locked = false;
|
unseal();
|
||||||
|
|
||||||
set( arenaDoor, Terrain.DOOR );
|
set( arenaDoor, Terrain.DOOR );
|
||||||
GameScene.updateMap( arenaDoor );
|
GameScene.updateMap( arenaDoor );
|
||||||
|
|
|
@ -241,7 +241,7 @@ public class SewerBossLevel extends RegularLevel {
|
||||||
public void seal() {
|
public void seal() {
|
||||||
if (entrance != 0) {
|
if (entrance != 0) {
|
||||||
|
|
||||||
locked = true;
|
super.seal();
|
||||||
|
|
||||||
set( entrance, Terrain.WATER_TILES );
|
set( entrance, Terrain.WATER_TILES );
|
||||||
GameScene.updateMap( entrance );
|
GameScene.updateMap( entrance );
|
||||||
|
@ -255,7 +255,7 @@ public class SewerBossLevel extends RegularLevel {
|
||||||
public void unseal() {
|
public void unseal() {
|
||||||
if (stairs != 0) {
|
if (stairs != 0) {
|
||||||
|
|
||||||
locked = false;
|
super.unseal();
|
||||||
|
|
||||||
entrance = stairs;
|
entrance = stairs;
|
||||||
stairs = 0;
|
stairs = 0;
|
||||||
|
|
|
@ -68,6 +68,7 @@ public class BuffIndicator extends Component {
|
||||||
public static final int FORESIGHT = 32;
|
public static final int FORESIGHT = 32;
|
||||||
public static final int VERTIGO = 33;
|
public static final int VERTIGO = 33;
|
||||||
public static final int CHARGE = 34;
|
public static final int CHARGE = 34;
|
||||||
|
public static final int LOCKED_FLOOR= 35;
|
||||||
|
|
||||||
public static final int SIZE = 7;
|
public static final int SIZE = 7;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user