diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/DewVial.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/DewVial.java index 172140ddd..d1c0d2676 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/DewVial.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/DewVial.java @@ -22,9 +22,8 @@ package com.shatteredpixel.shatteredpixeldungeon.items; import com.shatteredpixel.shatteredpixeldungeon.Assets; -import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; -import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; @@ -37,7 +36,7 @@ import java.util.ArrayList; public class DewVial extends Item { - private static final int MAX_VOLUME = 10; + private static final int MAX_VOLUME = 20; private static final String AC_DRINK = "DRINK"; @@ -86,21 +85,25 @@ public class DewVial extends Item { if (action.equals( AC_DRINK )) { if (volume > 0) { - - int value = 1 + (Dungeon.depth - 1) / 5; - if (hero.heroClass == HeroClass.HUNTRESS) { - value++; - } - value *= volume; - value = (int)Math.max(volume*volume*.01*hero.HT, value); - int effect = Math.min( hero.HT - hero.HP, value ); + + //20 drops for a full heal normally, 15 for the warden + float dropHealPercent = hero.subClass == HeroSubClass.WARDEN ? 0.0667f : 0.05f; + float missingHealthPercent = 1f - (hero.HP / (float)hero.HT); + + //trimming off 0.01 drops helps with floating point errors + int dropsNeeded = (int)Math.ceil((missingHealthPercent / dropHealPercent) - 0.01f); + dropsNeeded = Math.min(dropsNeeded, volume); + + int heal = Math.round( hero.HT * dropHealPercent * dropsNeeded ); + + int effect = Math.min( hero.HT - hero.HP, heal ); if (effect > 0) { hero.HP += effect; - hero.sprite.emitter().burst( Speck.factory( Speck.HEALING ), volume > 5 ? 2 : 1 ); + hero.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 + dropsNeeded/5 ); hero.sprite.showStatus( CharSprite.POSITIVE, Messages.get(this, "value", effect) ); } - volume = 0; + volume -= dropsNeeded; hero.spend( TIME_TO_DRINK ); hero.busy(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Dewdrop.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Dewdrop.java index 7d4e26100..f073a841f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Dewdrop.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Dewdrop.java @@ -22,7 +22,6 @@ package com.shatteredpixel.shatteredpixeldungeon.items; import com.shatteredpixel.shatteredpixeldungeon.Assets; -import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; @@ -45,14 +44,17 @@ public class Dewdrop extends Item { DewVial vial = hero.belongings.getItem( DewVial.class ); - if (hero.HP < hero.HT || vial == null || vial.isFull()) { + if (vial != null && !vial.isFull()){ - int value = 1 + (Dungeon.depth - 1) / 5; - if (hero.subClass == HeroSubClass.WARDEN) { - value+=2; - } + vial.collectDew( this ); - int effect = Math.min( hero.HT - hero.HP, value * quantity ); + } else { + + //20 drops for a full heal normally, 15 for the warden + float healthPercent = hero.subClass == HeroSubClass.WARDEN ? 0.0667f : 0.05f; + int heal = Math.round( hero.HT * healthPercent * quantity ); + + int effect = Math.min( hero.HT - hero.HP, heal ); if (effect > 0) { hero.HP += effect; hero.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 ); @@ -62,10 +64,6 @@ public class Dewdrop extends Item { return false; } - } else { - - vial.collectDew( this ); - } Sample.INSTANCE.play( Assets.SND_DEWDROP );