v0.7.4a: fixed metabolism glyph incorrectly applying to ghost hero

This commit is contained in:
Evan Debenham 2019-07-24 17:04:40 -04:00
parent 02eec6ee92
commit e95a61dc15
2 changed files with 3 additions and 2 deletions

View File

@ -66,7 +66,7 @@ public class Hunger extends Buff implements Hero.Doom {
return true; return true;
} }
if (target.isAlive()) { if (target.isAlive() && target instanceof Hero) {
Hero hero = (Hero)target; Hero hero = (Hero)target;

View File

@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.armor.curses;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor.Glyph; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor.Glyph;
@ -40,7 +41,7 @@ public class Metabolism extends Glyph {
@Override @Override
public int proc( Armor armor, Char attacker, Char defender, int damage) { 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; //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); int healing = Math.min((int)Hunger.STARVING/100, defender.HT - defender.HP);