From 6e8fe2089d0693ebdac6e948e8bc6904f2f72fbe Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 30 Sep 2018 20:02:41 -0400 Subject: [PATCH] v0.7.0: various fixes: - fixed typos - fixed rare cases where item or bag windows could be stacked - fixed honeyed healing not applying potion of healing curing effects - fixed a text alyout issue in alchemy scene --- .../elixirs/ElixirOfHoneyedHealing.java | 2 ++ .../scenes/AlchemyScene.java | 2 +- .../shatteredpixeldungeon/windows/WndBag.java | 16 ++++++++++++++++ .../shatteredpixeldungeon/windows/WndItem.java | 18 +++++++++++++++++- .../messages/items/items.properties | 2 +- .../messages/levels/levels.properties | 2 +- 6 files changed, 38 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfHoneyedHealing.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfHoneyedHealing.java index 89f20b3b9..c427166c7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfHoneyedHealing.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfHoneyedHealing.java @@ -44,6 +44,7 @@ public class ElixirOfHoneyedHealing extends Elixir { @Override public void apply(Hero hero) { Buff.affect( hero, Healing.class ).setHeal((int)(0.8f*hero.HT + 14), 0.25f, 0); + PotionOfHealing.cure(hero); hero.buff(Hunger.class).satisfy(Hunger.STARVING/5f); } @@ -57,6 +58,7 @@ public class ElixirOfHoneyedHealing extends Elixir { Char ch = Actor.findChar(cell); if (ch != null){ Buff.affect( ch, Healing.class ).setHeal((int)(0.8f*ch.HT + 14), 0.25f, 0); + PotionOfHealing.cure(ch); if (ch instanceof Bee && ch.alignment != curUser.alignment){ ch.alignment = Char.Alignment.ALLY; ((Bee)ch).setPotInfo(-1, null); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/AlchemyScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/AlchemyScene.java index b0abe422c..781fe53cb 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/AlchemyScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/AlchemyScene.java @@ -127,8 +127,8 @@ public class AlchemyScene extends PixelScene { int pos = (Camera.main.height - 100)/2; RenderedTextMultiline desc = PixelScene.renderMultiline(6); - desc.text( Messages.get(AlchemyScene.class, "text") ); desc.maxWidth(w); + desc.text( Messages.get(AlchemyScene.class, "text") ); desc.setPos(left + (w - desc.width())/2, pos); add(desc); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndBag.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndBag.java index a3f6c5e0b..a8284b9ca 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndBag.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndBag.java @@ -66,6 +66,9 @@ import com.watabou.utils.RectF; public class WndBag extends WndTabbed { + //only one wnditem can appear at a time + private static WndBag INSTANCE; + //FIXME this is getting cumbersome, there should be a better way to manage this public static enum Mode { ALL, @@ -119,6 +122,11 @@ public class WndBag extends WndTabbed { super(); + if( INSTANCE != null ){ + INSTANCE.hide(); + } + INSTANCE = this; + this.listener = listener; this.mode = mode; this.title = title; @@ -259,6 +267,14 @@ public class WndBag extends WndTabbed { Game.scene().addToFront(new WndBag(((BagTab) tab).bag, listener, mode, title)); } + @Override + public void hide() { + super.hide(); + if (INSTANCE == this){ + INSTANCE = null; + } + } + @Override protected int tabHeight() { return 20; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndItem.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndItem.java index 2d6ce930e..f8222e52f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndItem.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndItem.java @@ -36,6 +36,9 @@ import java.util.Collections; import java.util.Comparator; public class WndItem extends Window { + + //only one wnditem can appear at a time + private static WndItem INSTANCE; private static final float BUTTON_HEIGHT = 16; @@ -51,6 +54,11 @@ public class WndItem extends Window { public WndItem( final WndBag owner, final Item item , final boolean options ) { super(); + + if( INSTANCE != null ){ + INSTANCE.hide(); + } + INSTANCE = this; int width = WIDTH_MIN; @@ -161,7 +169,15 @@ public class WndItem extends Window { x += btn.width()+1; } } - + + @Override + public void hide() { + super.hide(); + if (INSTANCE == this){ + INSTANCE = null; + } + } + private static Comparator widthComparator = new Comparator() { @Override public int compare(RedButton lhs, RedButton rhs) { diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties index 9def69044..7b45f9679 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties @@ -387,7 +387,7 @@ items.bombs.shockbomb.name=shock bomb items.bombs.shockbomb.desc=This bomb has been modified to unleash a storm of electricity around it when it explodes. items.bombs.regrowthbomb.name=regrowth bomb -items.bombs.regrowthbomb.desc=This customized bomb will splash life-giving liquid all around it instead of exploding. The area caught in the blast with rapidly sprout glass and plants, and any allies caught in the blast will be healed. +items.bombs.regrowthbomb.desc=This customized bomb will splash life-giving liquid all around it instead of exploding. The area caught in the blast with rapidly sprout grass and plants, and any allies caught in the blast will be healed. items.bombs.shrapnelbomb.name=shrapnel bomb items.bombs.shrapnelbomb.desc=This bomb has been modified with scraps of DM-300's metal, which will fragment and fly everywhere when it explodes. You had better hide behind something when using it... diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/levels/levels.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/levels/levels.properties index 15043eec3..690819d57 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/levels/levels.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/levels/levels.properties @@ -124,7 +124,7 @@ levels.traps.weakeningtrap.name=weakening trap levels.traps.weakeningtrap.desc=Dark magic in this trap sucks the energy out of anything that comes into contact with it. levels.traps.worndarttrap.name=worn dart trap -levels.traps.worndarttrap.desc=A small dart-blower must be hidden nearby, activating this trap will cause it to shoot at the nearest target.\n\nDue to it's age it's not very harmful though, it isn't even hidden... +levels.traps.worndarttrap.desc=A small dart-blower must be hidden nearby, activating this trap will cause it to shoot at the nearest target.\n\nDue to its age it's not very harmful though, it isn't even hidden...