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 6fbb5a35f..c5ebeecd7 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 @@ -214,6 +214,7 @@ public class Blacksmith extends NPC { //reward tracking. Stores remaining favor, the pickaxe, and how many of each reward has been chosen public static int favor; public static Item pickaxe; + public static boolean freePickaxe; public static int reforges; public static int hardens; public static int upgrades; @@ -235,6 +236,7 @@ public class Blacksmith extends NPC { favor = 0; pickaxe = new Pickaxe().identify(); + freePickaxe = false; reforges = 0; hardens = 0; upgrades = 0; @@ -258,6 +260,7 @@ public class Blacksmith extends NPC { private static final String FAVOR = "favor"; private static final String PICKAXE = "pickaxe"; + private static final String FREE_PICKAXE= "free_pickaxe"; private static final String REFORGES = "reforges"; private static final String HARDENS = "hardens"; private static final String UPGRADES = "upgrades"; @@ -282,6 +285,7 @@ public class Blacksmith extends NPC { node.put( FAVOR, favor ); if (pickaxe != null) node.put( PICKAXE, pickaxe ); + node.put( FREE_PICKAXE, freePickaxe ); node.put( REFORGES, reforges ); node.put( HARDENS, hardens ); node.put( UPGRADES, upgrades ); @@ -317,6 +321,16 @@ public class Blacksmith extends NPC { } else { pickaxe = null; } + if (node.contains(FREE_PICKAXE)){ + freePickaxe = node.getBoolean(FREE_PICKAXE); + } else { + //some for pre-3.1 saves, some from incorrect values from v3.1-BETA-1.0 + if (favor >= 2500){ + freePickaxe = true; + } else { + freePickaxe = false; + } + } reforges = node.getInt( REFORGES ); hardens = node.getInt( HARDENS ); upgrades = node.getInt( UPGRADES ); @@ -453,12 +467,16 @@ public class Blacksmith extends NPC { if (bossBeaten) favor += 1000; Statistics.questScores[2] += favor; + + if (favor >= 2500){ + freePickaxe = true; + } } public static boolean rewardsAvailable(){ return favor > 0 || (Quest.smithRewards != null && Quest.smiths > 0) - || (pickaxe != null && Statistics.questScores[2] >= 2500); + || (pickaxe != null && freePickaxe); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndBlacksmith.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndBlacksmith.java index 7435f6a0d..ecbd4028b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndBlacksmith.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndBlacksmith.java @@ -24,7 +24,6 @@ package com.shatteredpixel.shatteredpixeldungeon.windows; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; -import com.shatteredpixel.shatteredpixeldungeon.Statistics; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Blacksmith; @@ -76,7 +75,7 @@ public class WndBlacksmith extends Window { ArrayList buttons = new ArrayList<>(); - int pickaxeCost = Statistics.questScores[2] >= 2500 ? 0 : 250; + int pickaxeCost = Blacksmith.Quest.freePickaxe ? 0 : 250; RedButton pickaxe = new RedButton(Messages.get(this, "pickaxe", pickaxeCost), 6){ @Override protected void onClick() {