v2.3.0: blacksmith landmark entry now clears after rewards are finished

This commit is contained in:
Evan Debenham
2023-11-15 13:40:32 -05:00
parent b94425b2c4
commit bc1ee348bc
2 changed files with 29 additions and 2 deletions
@@ -64,7 +64,7 @@ public class Blacksmith extends NPC {
Notes.remove( Notes.Landmark.TROLL ); Notes.remove( Notes.Landmark.TROLL );
return true; return true;
} }
if (Dungeon.level.visited[pos]){ if (Dungeon.level.visited[pos] && !Quest.started()){
Notes.add( Notes.Landmark.TROLL ); Notes.add( Notes.Landmark.TROLL );
} }
return super.act(); return super.act();
@@ -202,7 +202,7 @@ public class Blacksmith extends NPC {
} }
}); });
} else if (Quest.favor > 0 || Quest.pickaxe != null && Statistics.questScores[2] >= 2500) { } else if (Quest.rewardsAvailable()) {
Game.runOnRenderThread(new Callback() { Game.runOnRenderThread(new Callback() {
@Override @Override
@@ -497,6 +497,12 @@ public class Blacksmith extends NPC {
Statistics.questScores[2] = favor; Statistics.questScores[2] = favor;
} }
public static boolean rewardsAvailable(){
return favor > 0
|| (Quest.smithRewards != null && Quest.smiths > 0)
|| (pickaxe != null && Statistics.questScores[2] >= 2500);
}
//if the blacksmith is generated pre-v2.2.0, and the player never spawned a mining test floor //if the blacksmith is generated pre-v2.2.0, and the player never spawned a mining test floor
public static boolean oldQuestMineBlocked(){ public static boolean oldQuestMineBlocked(){
return type == OLD && !Dungeon.levelHasBeenGenerated(Dungeon.depth, 1); return type == OLD && !Dungeon.levelHasBeenGenerated(Dungeon.depth, 1);
@@ -37,6 +37,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
@@ -96,6 +97,10 @@ public class WndBlacksmith extends Window {
Blacksmith.Quest.favor -= pickaxeCost; Blacksmith.Quest.favor -= pickaxeCost;
Blacksmith.Quest.pickaxe = null; Blacksmith.Quest.pickaxe = null;
WndBlacksmith.this.hide(); WndBlacksmith.this.hide();
if (!Blacksmith.Quest.rewardsAvailable()){
Notes.remove( Notes.Landmark.TROLL );
}
} }
} }
}); });
@@ -290,6 +295,10 @@ public class WndBlacksmith extends Window {
Blacksmith.Quest.favor -= 500 + 1000*Blacksmith.Quest.reforges; Blacksmith.Quest.favor -= 500 + 1000*Blacksmith.Quest.reforges;
Blacksmith.Quest.reforges++; Blacksmith.Quest.reforges++;
if (!Blacksmith.Quest.rewardsAvailable()){
Notes.remove( Notes.Landmark.TROLL );
}
hide(); hide();
if (wndParent != null){ if (wndParent != null){
wndParent.hide(); wndParent.hide();
@@ -386,6 +395,10 @@ public class WndBlacksmith extends Window {
Sample.INSTANCE.play(Assets.Sounds.EVOKE); Sample.INSTANCE.play(Assets.Sounds.EVOKE);
Item.evoke( Dungeon.hero ); Item.evoke( Dungeon.hero );
if (!Blacksmith.Quest.rewardsAvailable()){
Notes.remove( Notes.Landmark.TROLL );
}
} }
} }
} }
@@ -424,6 +437,10 @@ public class WndBlacksmith extends Window {
Item.evoke( Dungeon.hero ); Item.evoke( Dungeon.hero );
Badges.validateItemLevelAquired( item ); Badges.validateItemLevelAquired( item );
if (!Blacksmith.Quest.rewardsAvailable()){
Notes.remove( Notes.Landmark.TROLL );
}
} }
} }
} }
@@ -498,6 +515,10 @@ public class WndBlacksmith extends Window {
} }
WndSmith.this.hide(); WndSmith.this.hide();
Blacksmith.Quest.smithRewards = null; Blacksmith.Quest.smithRewards = null;
if (!Blacksmith.Quest.rewardsAvailable()){
Notes.remove( Notes.Landmark.TROLL );
}
} }
}; };
btnConfirm.setRect(0, height+2, width/2-1, 16); btnConfirm.setRect(0, height+2, width/2-1, 16);