v0.3.1: refactored resting based on new functionality. Hitting full HP now interrupts resting.
This commit is contained in:
@@ -88,7 +88,7 @@ public class Hunger extends Buff implements Hero.Doom {
|
||||
if (newLevel >= STARVING) {
|
||||
|
||||
GLog.n( TXT_STARVING );
|
||||
hero.restoreHealth = false;
|
||||
hero.resting = false;
|
||||
hero.damage( 1, this );
|
||||
statusUpdated = true;
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public class MagicalSleep extends Buff {
|
||||
public boolean act(){
|
||||
if (target instanceof Hero) {
|
||||
target.HP = Math.min(target.HP+1, target.HT);
|
||||
((Hero) target).restoreHealth = true;
|
||||
((Hero) target).resting = true;
|
||||
if (target.HP == target.HT) {
|
||||
GLog.p("You wake up feeling refreshed and healthy.");
|
||||
detach();
|
||||
@@ -72,7 +72,7 @@ public class MagicalSleep extends Buff {
|
||||
public void detach() {
|
||||
target.paralysed = false;
|
||||
if (target instanceof Hero)
|
||||
((Hero) target).restoreHealth = false;
|
||||
((Hero) target).resting = false;
|
||||
super.detach();
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,9 @@ public class Regeneration extends Buff {
|
||||
|
||||
if (target.HP < target.HT && !((Hero)target).isStarving()) {
|
||||
target.HP += 1;
|
||||
if (target.HP == target.HT){
|
||||
((Hero)target).resting = false;
|
||||
}
|
||||
}
|
||||
|
||||
ChaliceOfBlood.chaliceRegen regenBuff = Dungeon.hero.buff( ChaliceOfBlood.chaliceRegen.class);
|
||||
|
||||
@@ -164,7 +164,7 @@ public class Hero extends Char {
|
||||
|
||||
private Item theKey;
|
||||
|
||||
public boolean restoreHealth = false;
|
||||
public boolean resting = false;
|
||||
|
||||
public MissileWeapon rangedWeapon = null;
|
||||
public Belongings belongings;
|
||||
@@ -430,7 +430,7 @@ public class Hero extends Char {
|
||||
|
||||
if (curAction == null) {
|
||||
|
||||
if (restoreHealth) {
|
||||
if (resting) {
|
||||
spend( TIME_TO_REST ); next();
|
||||
return false;
|
||||
}
|
||||
@@ -440,7 +440,7 @@ public class Hero extends Char {
|
||||
|
||||
} else {
|
||||
|
||||
restoreHealth = false;
|
||||
resting = false;
|
||||
|
||||
ready = false;
|
||||
|
||||
@@ -849,12 +849,12 @@ public class Hero extends Char {
|
||||
}
|
||||
}
|
||||
|
||||
public void rest( boolean tillHealthy ) {
|
||||
public void rest( boolean fullRest ) {
|
||||
spendAndNext( TIME_TO_REST );
|
||||
if (!tillHealthy) {
|
||||
if (!fullRest) {
|
||||
sprite.showStatus( CharSprite.DEFAULT, TXT_WAIT );
|
||||
}
|
||||
restoreHealth = tillHealthy;
|
||||
resting = fullRest;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -908,7 +908,7 @@ public class Hero extends Char {
|
||||
|
||||
if (!(src instanceof Hunger || src instanceof Viscosity.DeferedDamage) && damageInterrupt) {
|
||||
interrupt();
|
||||
restoreHealth = false;
|
||||
resting = false;
|
||||
}
|
||||
|
||||
if (this.buff(Drowsy.class) != null){
|
||||
@@ -955,7 +955,7 @@ public class Hero extends Char {
|
||||
|
||||
if (newMob) {
|
||||
interrupt();
|
||||
restoreHealth = false;
|
||||
resting = false;
|
||||
}
|
||||
|
||||
visibleEnemies = visible;
|
||||
|
||||
Reference in New Issue
Block a user