From 381b23b6bce0510993cfcdb858bc33a69ace2c79 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sat, 24 Jun 2017 22:21:33 -0400 Subject: [PATCH] v0.6.1: reworked unstable spellbook, now grants empowered scroll effects --- .../items/artifacts/UnstableSpellbook.java | 47 ++++++++++++------- .../messages/items/items.properties | 3 +- 2 files changed, 33 insertions(+), 17 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java index 32b37606e..c0fc1f9dc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java @@ -33,6 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfIdentify; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse; +import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; @@ -52,9 +53,9 @@ public class UnstableSpellbook extends Artifact { levelCap = 10; - charge = ((level()/2)+3); + charge = (int)(level()*0.4f)+2; partialCharge = 0; - chargeCap = ((level()/2)+3); + chargeCap = (int)(level()*0.4f)+2; defaultAction = AC_READ; } @@ -108,14 +109,25 @@ public class UnstableSpellbook extends Artifact { Scroll scroll; do { scroll = (Scroll) Generator.random(Generator.Category.SCROLL); - } while (scroll == null || - //gotta reduce the rate on these scrolls or that'll be all the item does. - ((scroll instanceof ScrollOfIdentify || + } while (scroll == null + //reduce the frequency of these scrolls by half + ||((scroll instanceof ScrollOfIdentify || scroll instanceof ScrollOfRemoveCurse || - scroll instanceof ScrollOfMagicMapping) && Random.Int(2) == 0)); - + scroll instanceof ScrollOfMagicMapping) && Random.Int(2) == 0) + //don't roll teleportation scrolls on boss floors + || (scroll instanceof ScrollOfTeleportation && Dungeon.bossLevel())); + scroll.ownedByBook = true; - scroll.execute(hero, AC_READ); + curItem = scroll; + curUser = hero; + + //if this scroll hasn't been given to the book + if (scrolls.contains(scroll.getClass())) { + scroll.doRead(); + } else { + scroll.empoweredRead(); + } + updateQuickslot(); } } else if (action.equals( AC_ADD )) { @@ -130,7 +142,7 @@ public class UnstableSpellbook extends Artifact { @Override public Item upgrade() { - chargeCap = (((level()+1)/2)+3); + chargeCap = (int)((level()+1)*0.4f)+2; //for artifact transmutation. while (scrolls.size() > (levelCap-1-level())) @@ -147,12 +159,15 @@ public class UnstableSpellbook extends Artifact { desc += "\n\n" + Messages.get(this, "desc_cursed"); } - if (level() < levelCap) - if (scrolls.size() > 0) { - desc += "\n\n" + Messages.get(this, "desc_index"); - desc += "\n" + Messages.get(scrolls.get(0), "name"); - if (scrolls.size() > 1) desc += "\n" + Messages.get(scrolls.get(1), "name"); - } + if (level() < levelCap && scrolls.size() > 0) { + desc += "\n\n" + Messages.get(this, "desc_index"); + desc += "\n" + "_" + Messages.get(scrolls.get(0), "name") + "_"; + if (scrolls.size() > 1) desc += "\n" + "_" + Messages.get(scrolls.get(1), "name") + "_"; + } + + if (level() > 0) { + desc += "\n\n" + Messages.get(this, "desc_empowered"); + } return desc; } @@ -177,7 +192,7 @@ public class UnstableSpellbook extends Artifact { public boolean act() { LockedFloor lock = target.buff(LockedFloor.class); if (charge < chargeCap && !cursed && (lock == null || lock.regenOn())) { - partialCharge += 1 / (150f - (chargeCap - charge)*15f); + partialCharge += 1 / (160f - (chargeCap - charge)*15f); if (partialCharge >= 1) { partialCharge --; 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 81a5a3415..977e83664 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 @@ -301,7 +301,8 @@ items.artifacts.unstablespellbook.unable_scroll=You are unable to add this scrol items.artifacts.unstablespellbook.unknown_scroll=You're not sure what type of scroll this is yet. items.artifacts.unstablespellbook.desc=This Tome is in surprising good condition given its age. It fizzes and crackles as you move the pages, surging with unstable energy. If you read from this book, there's no telling what spell you might cast. items.artifacts.unstablespellbook.desc_cursed=The cursed book has bound itself to you, it is inhibiting your ability to use most scrolls. -items.artifacts.unstablespellbook.desc_index=The book's index is incomplete, and is currently pointing to the following blank pages: +items.artifacts.unstablespellbook.desc_index=The book is incomplete. Its index is currently pointing to the following blank pages: +items.artifacts.unstablespellbook.desc_empowered=The scrolls that you've added to the book are glowing with power. Their magic seems stronger than it was before they were placed in the book.