v0.3.0: slight refactor to hunger

This commit is contained in:
Evan Debenham 2015-04-24 03:32:55 -04:00
parent 2367283bf6
commit a222efa406
4 changed files with 35 additions and 34 deletions

View File

@ -125,6 +125,7 @@ public class Hunger extends Buff implements Hero.Doom {
GLog.n("The cursed horn steals some of the food energy as you eat.");
}
if (!Dungeon.isChallenged(Challenges.NO_FOOD))
reduceHunger( energy );
}
@ -135,12 +136,12 @@ public class Hunger extends Buff implements Hero.Doom {
else if (level < HUNGRY)
energy *= 0.75f;
if (!Dungeon.isChallenged(Challenges.NO_FOOD))
reduceHunger( energy );
}
private void reduceHunger( float energy ) {
if (Dungeon.isChallenged(Challenges.NO_FOOD))
return;
//directly interacts with hunger, no checks.
public void reduceHunger( float energy ) {
level -= energy;
if (level < 0) {

View File

@ -798,7 +798,7 @@ public class Hero extends Char {
Hunger hunger = buff( Hunger.class );
if (hunger != null && !hunger.isStarving()) {
hunger.satisfy( -Hunger.STARVING / 10 );
hunger.reduceHunger( -Hunger.STARVING / 10 );
}
Buff buff = buff(TimekeepersHourglass.timeFreeze.class);

View File

@ -48,7 +48,7 @@ public class Metabolism extends Glyph {
if (hunger != null && !hunger.isStarving()) {
hunger.satisfy( -Hunger.STARVING / 10 );
hunger.reduceHunger( -Hunger.STARVING / 10 );
BuffIndicator.refreshHero();
defender.HP += healing;

View File

@ -109,7 +109,7 @@ public class Pickaxe extends Weapon {
Hunger hunger = hero.buff( Hunger.class );
if (hunger != null && !hunger.isStarving()) {
hunger.satisfy( -Hunger.STARVING / 10 );
hunger.reduceHunger( -Hunger.STARVING / 10 );
BuffIndicator.refreshHero();
}