From b294155fb1dfe0351b9bef2509d25b668e41d734 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 1 Aug 2017 14:51:06 -0400 Subject: [PATCH] v0.6.1: more bugfixes and improvements to the dried rose --- .../shatteredpixeldungeon/actors/mobs/npcs/Ghost.java | 11 +++++++---- .../shatteredpixeldungeon/items/Generator.java | 9 ++------- .../items/artifacts/Artifact.java | 5 +++++ .../items/artifacts/DriedRose.java | 11 ++++++++++- .../shatteredpixeldungeon/levels/Level.java | 2 +- .../messages/items/items.properties | 1 + 6 files changed, 26 insertions(+), 13 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java index b32c306a6..07734c76c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java @@ -75,7 +75,7 @@ public class Ghost extends NPC { @Override protected boolean act() { - if (Quest.completed()) + if (Quest.processed()) target = Dungeon.hero.pos; return super.act(); } @@ -87,7 +87,7 @@ public class Ghost extends NPC { @Override public float speed() { - return Quest.completed() ? 2f : 0.5f; + return Quest.processed() ? 2f : 0.5f; } @Override @@ -334,7 +334,6 @@ public class Ghost extends NPC { GLog.n( Messages.get(Ghost.class, "find_me") ); Sample.INSTANCE.play( Assets.SND_GHOST ); processed = true; - Generator.Category.ARTIFACT.probs[10] = 1; //flags the dried rose as spawnable. } } @@ -345,8 +344,12 @@ public class Ghost extends NPC { Notes.remove( Notes.Landmark.GHOST ); } - public static boolean completed(){ + public static boolean processed(){ return spawned && processed; } + + public static boolean completed(){ + return processed() && weapon == null && armor == null; + } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java index ff2009a94..fae0af47f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java @@ -23,7 +23,6 @@ package com.shatteredpixel.shatteredpixeldungeon.items; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; -import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Ghost; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.LeatherArmor; @@ -192,7 +191,7 @@ public class Generator { return item instanceof Bag ? Integer.MAX_VALUE : Integer.MAX_VALUE - 1; } - private static final float[] INITIAL_ARTIFACT_PROBS = new float[]{ 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1}; + private static final float[] INITIAL_ARTIFACT_PROBS = new float[]{ 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1}; static { GOLD.classes = new Class[]{ @@ -342,7 +341,7 @@ public class Generator { TimekeepersHourglass.class, UnstableSpellbook.class, AlchemistsToolkit.class, //currently removed from drop tables, pending rework. - DriedRose.class, //starts with no chance of spawning, chance is set directly after beating ghost quest. + DriedRose.class, LloydsBeacon.class, EtherealChains.class }; @@ -524,10 +523,6 @@ public class Generator { //resets artifact probabilities, for new dungeons public static void initArtifacts() { Category.ARTIFACT.probs = Category.INITIAL_ARTIFACT_PROBS.clone(); - - //checks for dried rose quest completion, adds the rose in accordingly. - if (Ghost.Quest.completed()) Category.ARTIFACT.probs[10] = 1; - spawnedArtifacts = new ArrayList<>(); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/Artifact.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/Artifact.java index a25c1b073..dfbbe711a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/Artifact.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/Artifact.java @@ -137,6 +137,11 @@ public class Artifact extends KindofMisc { @Override public String status() { + + //if the artifact isn't IDed, or is cursed, don't display anything + if (!isIdentified() || cursed){ + return null; + } //display the current cooldown if (cooldown != 0) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java index b25926737..8fd90e01f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java @@ -33,6 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Wraith; +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Ghost; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.NPC; import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; @@ -100,6 +101,10 @@ public class DriedRose extends Artifact { @Override public ArrayList actions( Hero hero ) { ArrayList actions = super.actions( hero ); + if (!Ghost.Quest.completed()){ + actions.remove(AC_EQUIP); + return actions; + } if (isEquipped( hero ) && charge == chargeCap && !cursed) { actions.add(AC_SUMMON); } @@ -168,6 +173,10 @@ public class DriedRose extends Artifact { @Override public String desc() { + if (!Ghost.Quest.completed() && !isIdentified()){ + return Messages.get(this, "desc_no_quest"); + } + String desc = super.desc(); if (isEquipped( Dungeon.hero )){ @@ -262,7 +271,7 @@ public class DriedRose extends Artifact { ghostPos = pos + PathFinder.NEIGHBOURS8[Random.Int(8)]; } while (Level.solid[ghostPos] || level.findMob(ghostPos) != null); - heldGhost.pos = pos; + heldGhost.pos = ghostPos; heldGhost = null; } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java index 4e7194381..7ab1a71ab 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -190,7 +190,7 @@ public abstract class Level implements Bundlable { } DriedRose rose = Dungeon.hero.belongings.getItem( DriedRose.class ); - if (rose != null && !rose.cursed){ + if (rose != null && rose.isIdentified() && !rose.cursed){ //aim to drop 1 petal every 2 floors int petalsNeeded = (int) Math.ceil((float)((Dungeon.depth / 2) - rose.droppedPetals) / 3); diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties index 0c41fce9b..685f50b0a 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties @@ -176,6 +176,7 @@ items.artifacts.driedrose.cursed=You cannot use a cursed rose. items.artifacts.driedrose.no_space=There is no free space near you. items.artifacts.driedrose.charged=Your rose is fully charged! items.artifacts.driedrose.desc=Is this the rose that the ghost mentioned before disappearing? It seems to hold some spiritual power, perhaps it can be used to channel the energy of that lost warrior. +items.artifacts.driedrose.desc_no_quest=A dried aged rose that is somehow still holding together despite its age.\n\nIt seems to have some spiritual power, but you have no idea how to use it right now. items.artifacts.driedrose.desc_hint=It seems to be missing some petals. Perhaps reattaching them will strengthen the rose. items.artifacts.driedrose.desc_cursed=The cursed rose is bound to your hand, it feels eerily cold. items.artifacts.driedrose$petal.name=dried petal