v0.9.3c: player can now collect dew on stairs even at full HP

This commit is contained in:
Evan Debenham 2021-06-22 17:22:19 -04:00
parent 9c7c0c8b90
commit 4df0062292
2 changed files with 8 additions and 4 deletions

View File

@ -22,11 +22,14 @@
package com.shatteredpixel.shatteredpixeldungeon.items;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barrier;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
@ -55,7 +58,8 @@ public class Dewdrop extends Item {
} else {
if (!consumeDew(1, hero)){
int terr = Dungeon.level.map[hero.pos];
if (!consumeDew(1, hero, terr == Terrain.ENTRANCE|| terr == Terrain.EXIT || terr == Terrain.UNLOCKED_EXIT)){
return false;
}
@ -67,7 +71,7 @@ public class Dewdrop extends Item {
return true;
}
public static boolean consumeDew(int quantity, Hero hero){
public static boolean consumeDew(int quantity, Hero hero, boolean force){
//20 drops for a full heal
int heal = Math.round( hero.HT * 0.05f * quantity );
@ -92,7 +96,7 @@ public class Dewdrop extends Item {
hero.sprite.showStatus( CharSprite.POSITIVE, Messages.get(Dewdrop.class, "shield", shield) );
}
} else {
} else if (!force) {
GLog.i( Messages.get(Dewdrop.class, "already_full") );
return false;
}

View File

@ -103,7 +103,7 @@ public class Waterskin extends Item {
int dropsNeeded = (int)Math.ceil((missingHealthPercent / 0.05f) - 0.01f);
dropsNeeded = (int)GameMath.gate(1, dropsNeeded, volume);
if (Dewdrop.consumeDew(dropsNeeded, hero)){
if (Dewdrop.consumeDew(dropsNeeded, hero, true)){
volume -= dropsNeeded;
hero.spend(TIME_TO_DRINK);