From 77e712003c3936f709850aeedd2e7948b6946744 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 20 Dec 2018 21:29:39 -0500 Subject: [PATCH] v0.7.1a: added safety checks to blacksmith and bones --- .../java/com/shatteredpixel/shatteredpixeldungeon/Bones.java | 2 ++ .../shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Bones.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Bones.java index f1ee31826..412284409 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Bones.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Bones.java @@ -139,6 +139,8 @@ public class Bones { if (depth == Dungeon.depth && Dungeon.challenges == 0) { FileUtils.deleteFile( BONES_FILE ); depth = 0; + + if (item == null) return null; //Enforces artifact uniqueness if (item instanceof Artifact){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java index 28295e8bf..89b1fb57f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java @@ -200,7 +200,9 @@ public class Blacksmith extends NPC { } first.level(first.level()+1); //prevents on-upgrade effects like enchant/glyph removal if (first instanceof MissileWeapon && !Dungeon.hero.belongings.contains(first)) { - first.collect(); + if (!first.collect()){ + Dungeon.level.drop( first, Dungeon.hero.pos ); + } } Dungeon.hero.spendAndNext( 2f ); Badges.validateItemLevelAquired( first );