v2.2.0: enabled hunger mechanics in the new mining area
This commit is contained in:
@@ -28,7 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.journal.Guidebook;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfChallenge;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.journal.Document;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.MiningLevel;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
@@ -68,9 +67,7 @@ public class Hunger extends Buff implements Hero.Doom {
|
||||
if (Dungeon.level.locked
|
||||
|| target.buff(WellFed.class) != null
|
||||
|| SPDSettings.intro()
|
||||
|| target.buff(ScrollOfChallenge.ChallengeArena.class) != null
|
||||
//this is mainly for the current test sub-level
|
||||
|| Dungeon.level instanceof MiningLevel){
|
||||
|| target.buff(ScrollOfChallenge.ChallengeArena.class) != null){
|
||||
spend(STEP);
|
||||
return true;
|
||||
}
|
||||
@@ -140,6 +137,8 @@ public class Hunger extends Buff implements Hero.Doom {
|
||||
return;
|
||||
}
|
||||
|
||||
float oldLevel = level;
|
||||
|
||||
level -= energy;
|
||||
if (level < 0 && !overrideLimits) {
|
||||
level = 0;
|
||||
@@ -149,6 +148,13 @@ public class Hunger extends Buff implements Hero.Doom {
|
||||
partialDamage += excess * (target.HT/1000f);
|
||||
}
|
||||
|
||||
if (oldLevel < HUNGRY && level >= HUNGRY){
|
||||
GLog.w( Messages.get(this, "onhungry") );
|
||||
} else if (oldLevel < STARVING && level >= STARVING){
|
||||
GLog.n( Messages.get(this, "onstarving") );
|
||||
target.damage( 1, this );
|
||||
}
|
||||
|
||||
BuffIndicator.refreshHero();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.ChaliceOfBlood;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfEnergy;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.MiningLevel;
|
||||
|
||||
public class Regeneration extends Buff {
|
||||
|
||||
@@ -82,9 +81,6 @@ public class Regeneration extends Buff {
|
||||
if (lock != null && !lock.regenOn()){
|
||||
return false;
|
||||
}
|
||||
if (Dungeon.level instanceof MiningLevel){
|
||||
return false; //this is mainly for the current test sub-level
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1169,19 +1169,19 @@ public class Hero extends Char {
|
||||
Level.set( action.dst, Terrain.EMPTY_DECO );
|
||||
|
||||
} else if (Dungeon.level.map[action.dst] == Terrain.WALL){
|
||||
//TODO inc. hunger by 5
|
||||
buff(Hunger.class).affectHunger(-5);
|
||||
PixelScene.shake(0.5f, 0.5f);
|
||||
CellEmitter.get( action.dst ).burst( Speck.factory( Speck.ROCK ), 2 );
|
||||
Sample.INSTANCE.play( Assets.Sounds.MINE );
|
||||
Level.set( action.dst, Terrain.EMPTY_DECO );
|
||||
|
||||
} else if (Dungeon.level.map[action.dst] == Terrain.MINE_CRYSTAL){
|
||||
Splash.at(action.dst, 0xFFFFFF, 5); //TODO match color?
|
||||
Splash.at(action.dst, 0xFFFFFF, 5);
|
||||
Sample.INSTANCE.play( Assets.Sounds.SHATTER );
|
||||
Level.set( action.dst, Terrain.EMPTY );
|
||||
|
||||
} else if (Dungeon.level.map[action.dst] == Terrain.MINE_BOULDER){
|
||||
//TODO inc. hunger by 1
|
||||
buff(Hunger.class).affectHunger(-1);
|
||||
Splash.at(action.dst, ColorMath.random( 0x444444, 0x777766 ), 5);
|
||||
Sample.INSTANCE.play( Assets.Sounds.MINE, 0.6f );
|
||||
Level.set( action.dst, Terrain.EMPTY );
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Blacksmith;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.quest.DarkGold;
|
||||
@@ -153,6 +154,13 @@ public class MiningLevel extends CavesLevel {
|
||||
}
|
||||
drop( item, cell ).setHauntedIfCursed().type = Heap.Type.REMAINS;
|
||||
}
|
||||
|
||||
int cell = randomDropCell();
|
||||
if (map[cell] == Terrain.HIGH_GRASS || map[cell] == Terrain.FURROWED_GRASS) {
|
||||
map[cell] = Terrain.GRASS;
|
||||
losBlocking[cell] = false;
|
||||
}
|
||||
drop( Generator.randomUsingDefaults(Generator.Category.FOOD), cell );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user