From a17c141738a45953a6eb46f1a4807be002ebca62 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 29 Oct 2014 16:00:21 -0400 Subject: [PATCH] v0.2.2: fixed a bug with multiple ankhs in both blessed and unblessed states --- .../shatteredpixeldungeon/actors/hero/Hero.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index 7ac21f28d..89bf0e60d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -1181,8 +1181,17 @@ public class Hero extends Char { curAction = null; - //todo: investigate this, what would happen if the player has a blessed & unblessed ankh? - Ankh ankh = (Ankh)belongings.getItem( Ankh.class ); + Ankh ankh = null; + + //look for ankhs in player inventory, prioritize ones which are blessed. + for (Item item : belongings){ + if (item instanceof Ankh) { + if (ankh == null || ((Ankh) item).isBlessed()) { + ankh = (Ankh) item; + } + } + } + if (ankh != null && ankh.isBlessed()) { this.HP = HT;