v0.3.1: refactored resting based on new functionality. Hitting full HP now interrupts resting.
This commit is contained in:
parent
0a6c9c6e7f
commit
18e488c63e
|
@ -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;
|
||||
|
|
|
@ -24,13 +24,13 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShaftParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
||||
import com.watabou.utils.Bundle;
|
||||
|
||||
public class Sungrass extends Plant {
|
||||
|
@ -114,6 +114,10 @@ public class Sungrass extends Plant {
|
|||
if (healCurr < 6)
|
||||
healCurr ++;
|
||||
target.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1);
|
||||
|
||||
if (target.HP == target.HT && target instanceof Hero){
|
||||
((Hero)target).resting = false;
|
||||
}
|
||||
}
|
||||
count = 1;
|
||||
} else {
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.io.IOException;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.*;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Honeypot;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.bags.PotionBandolier;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.bags.ScrollHolder;
|
||||
|
@ -32,7 +31,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.bags.SeedPouch;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.bags.WandHolster;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.LootIndicator;
|
||||
|
@ -685,10 +683,10 @@ public class GameScene extends PixelScene {
|
|||
}
|
||||
|
||||
static boolean cancel() {
|
||||
if (Dungeon.hero.curAction != null || Dungeon.hero.restoreHealth) {
|
||||
if (Dungeon.hero.curAction != null || Dungeon.hero.resting) {
|
||||
|
||||
Dungeon.hero.curAction = null;
|
||||
Dungeon.hero.restoreHealth = false;
|
||||
Dungeon.hero.resting = false;
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
|
|
@ -103,7 +103,7 @@ public class HeroSprite extends CharSprite {
|
|||
|
||||
@Override
|
||||
public void update() {
|
||||
sleeping = ch.isAlive() && ((Hero)ch).restoreHealth;
|
||||
sleeping = ch.isAlive() && ((Hero)ch).resting;
|
||||
|
||||
super.update();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user