From 3ce341092f9d60ae1ff344e2e7a1fb00e433bcd7 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 19 Jun 2016 00:25:05 -0400 Subject: [PATCH] v0.4.0: fixed the sad ghost sometimes giving missile weapons --- .../shatteredpixeldungeon/actors/mobs/npcs/Ghost.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java index d62f4b1de..72921f43a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java @@ -40,6 +40,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.armor.MailArmor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.PlateArmor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.ScaleArmor; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.NewShortsword; import com.shatteredpixel.shatteredpixeldungeon.levels.SewerLevel; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; @@ -292,7 +293,9 @@ public class Ghost extends NPC { } try { - weapon = (Weapon)Generator.wepTiers[wepTier-1].classes[Random.chances(Generator.wepTiers[wepTier-1].probs)].newInstance(); + do { + weapon = (Weapon) Generator.wepTiers[wepTier - 1].classes[Random.chances(Generator.wepTiers[wepTier - 1].probs)].newInstance(); + } while (!(weapon instanceof MeleeWeapon)); } catch (Exception e){ weapon = new NewShortsword(); }