diff --git a/core/src/main/assets/messages/actors/actors.properties b/core/src/main/assets/messages/actors/actors.properties index 13fca9930..8283ee97d 100644 --- a/core/src/main/assets/messages/actors/actors.properties +++ b/core/src/main/assets/messages/actors/actors.properties @@ -1330,13 +1330,6 @@ actors.mobs.npcs.blacksmith.cant_enter_old=That area is not accessible on this r actors.mobs.npcs.blacksmith.def_verb=blocked actors.mobs.npcs.blacksmith.desc=This troll blacksmith looks like all trolls look: he is tall and lean, and his skin resembles stone in both color and texture. The troll blacksmith is tinkering with disproportionally small tools. -##old blacksmith quest dialogue from pre-v2.2.0 -actors.mobs.npcs.blacksmith.gold_1=Hey human! Wanna be useful, eh? Take dis pickaxe and mine me some _dark gold ore, 15 pieces_ should be enough. What do you mean, how am I gonna pay? You greedy...\nOk, ok, I don't have money to pay, but I can do some smithin' for you. Consider yourself lucky, I'm the only blacksmith around. -actors.mobs.npcs.blacksmith.blood_1=Hey human! Wanna be useful, eh? Take dis pickaxe and _kill a bat_ wit' it, I need its blood on the head. What do you mean, how am I gonna pay? You greedy...\nOk, ok, I don't have money to pay, but I can do some smithin' for you. Consider yourself lucky, I'm the only blacksmith around. -actors.mobs.npcs.blacksmith.gold_2=Dark gold ore. 15 pieces. Seriously, is it dat hard? -actors.mobs.npcs.blacksmith.blood_2=I said I need bat blood on the pickaxe. Chop chop! -actors.mobs.npcs.blacksmith.completed=Oh, you have returned... Better late dan never. - actors.mobs.npcs.ghost.name=sad ghost actors.mobs.npcs.ghost.rat_1=Hello %s... Once I was like you - strong and confident... But I was slain by a foul beast... I can't leave this place... Not until I have my revenge... Slay the _fetid rat,_ that has taken my life...\n\nIt stalks this floor... Spreading filth everywhere... _Beware its cloud of stink and corrosive bite, the acid dissolves in water..._ actors.mobs.npcs.ghost.rat_2=Please... Help me... Slay the abomination...\n\n_Fight it near water... Avoid the stench..._ diff --git a/core/src/main/assets/messages/items/items.properties b/core/src/main/assets/messages/items/items.properties index 103747b4c..a11152871 100644 --- a/core/src/main/assets/messages/items/items.properties +++ b/core/src/main/assets/messages/items/items.properties @@ -885,8 +885,6 @@ items.quest.metalshard.name=cursed metal shard items.quest.metalshard.desc=A shard of rusted cursed metal, which broke off DM-300 as it was destroyed. You can feel an inactive malevolent magic within it.\n\nIt does nothing on its own, but it might be useful when combined with certain scrolls, or a bomb. At the very least it should convert into a decent amount of energy. items.quest.pickaxe.name=pickaxe -items.quest.pickaxe.ac_mine=MINE -items.quest.pickaxe.no_vein=There is no dark gold vein near you to mine. items.quest.pickaxe.ability_name=pierce items.quest.pickaxe.ability_desc=The Duelist can _pierce_ an enemy with a pickaxe. This is guaranteed to hit, applies vulnerable for 3 turns, and deals _%1$d-%2$d damage_ to enemies with rigid skin. items.quest.pickaxe.upgrade_ability_stat_name=Ability Damage 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 af1923dca..1379280d2 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 @@ -89,28 +89,21 @@ public class Blacksmith extends NPC { String msg1 = ""; String msg2 = ""; - if (Quest.type == Quest.OLD){ - //pre-v2.2.0 saves - msg1 = Quest.alternative ? Messages.get(Blacksmith.this, "blood_1") : Messages.get(Blacksmith.this, "gold_1"); - } else { + switch (Dungeon.hero.heroClass){ + case WARRIOR: msg1 += Messages.get(Blacksmith.this, "intro_quest_warrior"); break; + case MAGE: msg1 += Messages.get(Blacksmith.this, "intro_quest_mage"); break; + case ROGUE: msg1 += Messages.get(Blacksmith.this, "intro_quest_rogue"); break; + case HUNTRESS: msg1 += Messages.get(Blacksmith.this, "intro_quest_huntress"); break; + case DUELIST: msg1 += Messages.get(Blacksmith.this, "intro_quest_duelist"); break; + case CLERIC: msg1 += Messages.get(Blacksmith.this, "intro_quest_cleric"); break; + } - switch (Dungeon.hero.heroClass){ - case WARRIOR: msg1 += Messages.get(Blacksmith.this, "intro_quest_warrior"); break; - case MAGE: msg1 += Messages.get(Blacksmith.this, "intro_quest_mage"); break; - case ROGUE: msg1 += Messages.get(Blacksmith.this, "intro_quest_rogue"); break; - case HUNTRESS: msg1 += Messages.get(Blacksmith.this, "intro_quest_huntress"); break; - case DUELIST: msg1 += Messages.get(Blacksmith.this, "intro_quest_duelist"); break; - case CLERIC: msg1 += Messages.get(Blacksmith.this, "intro_quest_cleric"); break; - } - - msg1 += "\n\n" + Messages.get(Blacksmith.this, "intro_quest_start"); - - switch (Quest.type){ - case Quest.CRYSTAL: msg2 += Messages.get(Blacksmith.this, "intro_quest_crystal"); break; - case Quest.GNOLL: msg2 += Messages.get(Blacksmith.this, "intro_quest_gnoll"); break; - case Quest.FUNGI: msg2 += Messages.get(Blacksmith.this, "intro_quest_fungi"); break; - } + msg1 += "\n\n" + Messages.get(Blacksmith.this, "intro_quest_start"); + switch (Quest.type){ + case Quest.CRYSTAL: msg2 += Messages.get(Blacksmith.this, "intro_quest_crystal"); break; + case Quest.GNOLL: msg2 += Messages.get(Blacksmith.this, "intro_quest_gnoll"); break; + case Quest.FUNGI: msg2 += Messages.get(Blacksmith.this, "intro_quest_fungi"); break; } final String msg1Final = msg1; @@ -144,73 +137,13 @@ public class Blacksmith extends NPC { } else if (!Quest.completed) { - if (Quest.type == Quest.OLD) { - if (Quest.alternative) { - - Pickaxe pick = Dungeon.hero.belongings.getItem(Pickaxe.class); - if (pick == null) { - tell(Messages.get(this, "lost_pick")); - } else if (!pick.bloodStained) { - tell(Messages.get(this, "blood_2")); - } else { - if (pick.isEquipped(Dungeon.hero)) { - boolean wasCursed = pick.cursed; - pick.cursed = false; //so that it can always be removed - pick.doUnequip(Dungeon.hero, false); - pick.cursed = wasCursed; - } - pick.detach(Dungeon.hero.belongings.backpack); - Quest.pickaxe = pick; - tell(Messages.get(this, "completed")); - - Quest.completed = true; - Statistics.questScores[2] = 3000; - } - - } else { - - Pickaxe pick = Dungeon.hero.belongings.getItem(Pickaxe.class); - DarkGold gold = Dungeon.hero.belongings.getItem(DarkGold.class); - if (pick == null) { - tell(Messages.get(this, "lost_pick")); - } else if (gold == null || gold.quantity() < 15) { - tell(Messages.get(this, "gold_2")); - } else { - if (pick.isEquipped(Dungeon.hero)) { - boolean wasCursed = pick.cursed; - pick.cursed = false; //so that it can always be removed - pick.doUnequip(Dungeon.hero, false); - pick.cursed = wasCursed; - } - pick.detach(Dungeon.hero.belongings.backpack); - Quest.pickaxe = pick; - gold.detachAll(Dungeon.hero.belongings.backpack); - tell(Messages.get(this, "completed")); - - Quest.completed = true; - Statistics.questScores[2] = 3000; - } - - } - } else { - - String msg = Messages.get(this, "reminder") + "\n\n"; - switch (Quest.type){ - case Quest.CRYSTAL: msg += Messages.get(Blacksmith.this, "reminder_crystal"); break; - case Quest.GNOLL: msg += Messages.get(Blacksmith.this, "reminder_gnoll"); break; - case Quest.FUNGI: msg += Messages.get(Blacksmith.this, "reminder_fungi"); break; - } - tell(msg); - + String msg = Messages.get(this, "reminder") + "\n\n"; + switch (Quest.type){ + case Quest.CRYSTAL: msg += Messages.get(Blacksmith.this, "reminder_crystal"); break; + case Quest.GNOLL: msg += Messages.get(Blacksmith.this, "reminder_gnoll"); break; + case Quest.FUNGI: msg += Messages.get(Blacksmith.this, "reminder_fungi"); break; } - } else if (Quest.type == Quest.OLD && Quest.reforges == 0) { - - Game.runOnRenderThread(new Callback() { - @Override - public void call() { - GameScene.show( new WndBlacksmith.WndReforge( Blacksmith.this, null ) ); - } - }); + tell(msg); } else if (Quest.rewardsAvailable()) { @@ -267,12 +200,9 @@ public class Blacksmith extends NPC { public static class Quest { private static int type = 0; - public static final int OLD = 0; public static final int CRYSTAL = 1; public static final int GNOLL = 2; public static final int FUNGI = 3; //The fungi quest is not implemented, only exists partially in code - //pre-v2.2.0 - private static boolean alternative; //false for mining gold, true for bat blood //quest state information private static boolean spawned; @@ -284,7 +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 int reforges; //also used by the pre-v2.2.0 version of the quest + public static int reforges; public static int hardens; public static int upgrades; public static int smiths; @@ -296,7 +226,6 @@ public class Blacksmith extends NPC { public static void reset() { type = 0; - alternative = false; spawned = false; given = false; @@ -345,7 +274,6 @@ public class Blacksmith extends NPC { if (spawned) { node.put( TYPE, type ); - node.put( ALTERNATIVE, alternative ); node.put( GIVEN, given ); node.put( STARTED, started ); @@ -377,7 +305,6 @@ public class Blacksmith extends NPC { if (!node.isNull() && (spawned = node.getBoolean( SPAWNED ))) { type = node.getInt(TYPE); - alternative = node.getBoolean( ALTERNATIVE ); given = node.getBoolean( GIVEN ); started = node.getBoolean( STARTED ); @@ -390,12 +317,7 @@ public class Blacksmith extends NPC { } else { pickaxe = null; } - if (node.contains("reforged")){ - //pre-v2.2.0 saves - reforges = node.getBoolean( "reforged" ) ? 1 : 0; - } else { - reforges = node.getInt( REFORGES ); - } + reforges = node.getInt( REFORGES ); hardens = node.getInt( HARDENS ); upgrades = node.getInt( UPGRADES ); smiths = node.getInt( SMITHS ); @@ -421,7 +343,6 @@ public class Blacksmith extends NPC { //Currently cannot roll the fungi quest, as it is not fully implemented type = Random.IntRange(1, 2); - alternative = false; given = false; generateRewards( true ); @@ -540,17 +461,5 @@ public class Blacksmith extends NPC { || (pickaxe != null && Statistics.questScores[2] >= 2500); } - //if the blacksmith is generated pre-v2.2.0, and the player never spawned a mining test floor - public static boolean oldQuestMineBlocked(){ - return type == OLD && !Dungeon.levelHasBeenGenerated(Dungeon.depth, 1); - } - - public static boolean oldBloodQuest(){ - return type == OLD && alternative; - } - - public static boolean oldMiningQuest(){ - return type == OLD && !alternative; - } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/quest/Pickaxe.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/quest/Pickaxe.java index 1562345ef..ffa205e7d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/quest/Pickaxe.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/quest/Pickaxe.java @@ -29,42 +29,24 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vulnerable; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; -import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; -import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bat; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bee; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Crab; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Scorpio; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Spinner; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Swarm; -import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Blacksmith; -import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; -import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; -import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.MiningLevel; -import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; -import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; -import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.ui.AttackIndicator; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.noosa.audio.Sample; -import com.watabou.utils.Bundle; import com.watabou.utils.Callback; -import com.watabou.utils.PathFinder; import java.util.ArrayList; -//various code in here supports old blacksmith quest logic from before v2.2.0 public class Pickaxe extends MeleeWeapon { - public static final String AC_MINE = "MINE"; - - public static final float TIME_TO_MINE = 2; - - private static final Glowing BLOODY = new Glowing( 0x550000 ); - { image = ItemSpriteSheet.PICKAXE; @@ -75,8 +57,6 @@ public class Pickaxe extends MeleeWeapon { tier = 2; } - - public boolean bloodStained = false; @Override public int STRReq(int lvl) { @@ -86,108 +66,18 @@ public class Pickaxe extends MeleeWeapon { @Override public ArrayList actions( Hero hero ) { ArrayList actions = super.actions( hero ); - if (Blacksmith.Quest.oldMiningQuest()) { - actions.add(AC_MINE); - } if (Dungeon.level instanceof MiningLevel){ actions.remove(AC_DROP); actions.remove(AC_THROW); } return actions; } - - @Override - public void execute( final Hero hero, String action ) { - - super.execute( hero, action ); - - if (action.equals(AC_MINE)) { - - if (Dungeon.depth < 11 || Dungeon.depth > 15) { - GLog.w( Messages.get(this, "no_vein") ); - return; - } - - for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) { - - final int pos = hero.pos + PathFinder.NEIGHBOURS8[i]; - if (Dungeon.level.map[pos] == Terrain.WALL_DECO) { - - hero.spend( TIME_TO_MINE ); - hero.busy(); - - hero.sprite.attack( pos, new Callback() { - - @Override - public void call() { - - CellEmitter.center( pos ).burst( Speck.factory( Speck.STAR ), 7 ); - Sample.INSTANCE.play( Assets.Sounds.EVOKE ); - - Level.set( pos, Terrain.WALL ); - GameScene.updateMap( pos ); - - DarkGold gold = new DarkGold(); - if (gold.doPickUp( Dungeon.hero )) { - GLog.i( Messages.capitalize(Messages.get(Dungeon.hero, "you_now_have", gold.name())) ); - } else { - Dungeon.level.drop( gold, hero.pos ).sprite.drop(); - } - - hero.onOperateComplete(); - } - } ); - - return; - } - } - - GLog.w( Messages.get(this, "no_vein") ); - - } - } - - @Override - public int proc( Char attacker, Char defender, int damage ) { - if (Blacksmith.Quest.oldBloodQuest() && !bloodStained && defender instanceof Bat) { - Actor.add(new Actor() { - - { - actPriority = VFX_PRIO; - } - - @Override - protected boolean act() { - if (!defender.isAlive()){ - bloodStained = true; - updateQuickslot(); - } - - Actor.remove(this); - return true; - } - }); - } - return super.proc( attacker, defender, damage ); - } @Override public boolean keptThroughLostInventory() { //pickaxe is always kept when it's needed for the mining level return super.keptThroughLostInventory() || Dungeon.level instanceof MiningLevel; } - - @Override - public String defaultAction() { - if (Dungeon.hero.heroClass == HeroClass.DUELIST && isEquipped(Dungeon.hero)){ - return AC_ABILITY; - } else if (Blacksmith.Quest.oldMiningQuest()) { - return AC_MINE; - } else { - return super.defaultAction(); - } - } - @Override public String targetingPrompt() { return Messages.get(this, "prompt"); @@ -254,29 +144,4 @@ public class Pickaxe extends MeleeWeapon { return augment.damageFactor(min(level)+dmgBoost) + "-" + augment.damageFactor(max(level)+dmgBoost); } - private static final String BLOODSTAINED = "bloodStained"; - - @Override - public void storeInBundle( Bundle bundle ) { - super.storeInBundle( bundle ); - - bundle.put( BLOODSTAINED, bloodStained ); - } - - @Override - public void restoreFromBundle( Bundle bundle ) { - super.restoreFromBundle( bundle ); - - bloodStained = bundle.getBoolean( BLOODSTAINED ); - } - - @Override - public Glowing glowing() { - if (super.glowing() == null) { - return bloodStained ? BLOODY : null; - } else { - return super.glowing(); - } - } - } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesLevel.java index 14f3ed4ce..db732670e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesLevel.java @@ -116,7 +116,7 @@ public class CavesLevel extends RegularLevel { @Override public boolean activateTransition(Hero hero, LevelTransition transition) { if (transition.type == LevelTransition.Type.BRANCH_EXIT - && (!Blacksmith.Quest.given() || Blacksmith.Quest.oldQuestMineBlocked() || Blacksmith.Quest.completed() || !Blacksmith.Quest.started())) { + && (!Blacksmith.Quest.given() || Blacksmith.Quest.completed() || !Blacksmith.Quest.started())) { Blacksmith smith = null; for (Char c : Actor.chars()){ @@ -126,11 +126,9 @@ public class CavesLevel extends RegularLevel { } } - if (Blacksmith.Quest.oldQuestMineBlocked()){ - GLog.w(Messages.get(Blacksmith.class, "cant_enter_old")); - } else if (smith == null || !Blacksmith.Quest.given() || Blacksmith.Quest.completed()) { + if (smith == null || !Blacksmith.Quest.given() || Blacksmith.Quest.completed()) { GLog.w(Messages.get(Blacksmith.class, "entrance_blocked")); - } else if (!Blacksmith.Quest.started() && Blacksmith.Quest.Type() != Blacksmith.Quest.OLD){ + } else { final Pickaxe pick = hero.belongings.getItem(Pickaxe.class); Game.runOnRenderThread(new Callback() { @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/MiningLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/MiningLevel.java index 17514d98e..d7480ff99 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/MiningLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/MiningLevel.java @@ -238,7 +238,7 @@ public class MiningLevel extends CavesLevel { @Override public boolean activateTransition(Hero hero, LevelTransition transition) { if (transition.type == LevelTransition.Type.BRANCH_ENTRANCE - && !Blacksmith.Quest.completed() && Blacksmith.Quest.Type() != Blacksmith.Quest.OLD) { + && !Blacksmith.Quest.completed()) { if (hero.belongings.getItem(Pickaxe.class) == null){ Game.runOnRenderThread(new Callback() {