From e95a61dc15a82a98a02390a282f74462c11808bb Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 24 Jul 2019 17:04:40 -0400 Subject: [PATCH] v0.7.4a: fixed metabolism glyph incorrectly applying to ghost hero --- .../shatteredpixeldungeon/actors/buffs/Hunger.java | 2 +- .../shatteredpixeldungeon/items/armor/curses/Metabolism.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Hunger.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Hunger.java index c97c06972..95b46625d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Hunger.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Hunger.java @@ -66,7 +66,7 @@ public class Hunger extends Buff implements Hero.Doom { return true; } - if (target.isAlive()) { + if (target.isAlive() && target instanceof Hero) { Hero hero = (Hero)target; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/curses/Metabolism.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/curses/Metabolism.java index 7a1891939..556908bda 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/curses/Metabolism.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/curses/Metabolism.java @@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.armor.curses; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor.Glyph; @@ -40,7 +41,7 @@ public class Metabolism extends Glyph { @Override public int proc( Armor armor, Char attacker, Char defender, int damage) { - if (Random.Int( 6 ) == 0) { + if (Random.Int( 6 ) == 0 && defender instanceof Hero) { //assumes using up 10% of starving, and healing of 1 hp per 10 turns; int healing = Math.min((int)Hunger.STARVING/100, defender.HT - defender.HP);