v0.7.0: significantly adjusted spellbook mechanics for new scrolls

This commit is contained in:
Evan Debenham 2018-07-20 23:37:03 -04:00
parent ab1b9f23d6
commit 83764f36d7
4 changed files with 62 additions and 8 deletions
core/src/main
assets
java/com/shatteredpixel/shatteredpixeldungeon/items
resources/com/shatteredpixel/shatteredpixeldungeon/messages/items

Binary file not shown.

Before

(image error) Size: 739 B

After

(image error) Size: 2.7 KiB

View File

@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.artifacts;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
@ -35,11 +36,13 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMappi
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTransmutation;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ExoticScroll;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
@ -54,9 +57,9 @@ public class UnstableSpellbook extends Artifact {
levelCap = 10;
charge = (int)(level()*0.4f)+2;
charge = (int)(level()*0.6f)+2;
partialCharge = 0;
chargeCap = (int)(level()*0.4f)+2;
chargeCap = (int)(level()*0.6f)+2;
defaultAction = AC_READ;
}
@ -103,7 +106,7 @@ public class UnstableSpellbook extends Artifact {
if (hero.buff( Blindness.class ) != null) GLog.w( Messages.get(this, "blinded") );
else if (!isEquipped( hero )) GLog.i( Messages.get(Artifact.class, "need_to_equip") );
else if (charge == 0) GLog.i( Messages.get(this, "no_charge") );
else if (charge <= 0) GLog.i( Messages.get(this, "no_charge") );
else if (cursed) GLog.i( Messages.get(this, "cursed") );
else {
charge--;
@ -125,10 +128,35 @@ public class UnstableSpellbook extends Artifact {
curUser = hero;
//if this scroll hasn't been given to the book
if (scrolls.contains(scroll.getClass())) {
scroll.doRead();
if (!scrolls.contains(scroll.getClass())) {
final Scroll fScroll = scroll;
GameScene.show(new WndOptions(
Messages.get(this, "prompt"),
Messages.get(this, "read_empowered"),
scroll.trueName(),
Messages.get(ExoticScroll.regToExo.get(scroll.getClass()), "name")){
@Override
protected void onSelect(int index) {
if (index == 1){
try {
Scroll scroll = ExoticScroll.regToExo.get(fScroll.getClass()).newInstance();
charge --;
scroll.doRead();
} catch ( Exception e) {
ShatteredPixelDungeon.reportException(e);
}
} else {
fScroll.doRead();
}
}
@Override
public void onBackPressed() {
//do nothing
}
});
} else {
scroll.empoweredRead();
scroll.doRead();
}
updateQuickslot();
}
@ -145,7 +173,7 @@ public class UnstableSpellbook extends Artifact {
@Override
public Item upgrade() {
chargeCap = (int)((level()+1)*0.4f)+2;
chargeCap = (int)((level()+1)*0.6f)+2;
//for artifact transmutation.
while (!scrolls.isEmpty() && scrolls.size() > (levelCap-1-level()))
@ -198,7 +226,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 / (160f - (chargeCap - charge)*15f);
partialCharge += 1 / (120f - (chargeCap - charge)*5f);
if (partialCharge >= 1) {
partialCharge --;

View File

@ -27,8 +27,13 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Recipe;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfIdentify;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfLullaby;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMirrorImage;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfPsionicBlast;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRage;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTerror;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
@ -62,6 +67,26 @@ public abstract class ExoticScroll extends Scroll {
regToExo.put(ScrollOfTerror.class, ScrollOfPetrification.class);
exoToReg.put(ScrollOfPetrification.class, ScrollOfTerror.class);
regToExo.put(ScrollOfTerror.class, ScrollOfPetrification.class);
exoToReg.put(ScrollOfPetrification.class, ScrollOfTerror.class);
//TODO
regToExo.put(ScrollOfTeleportation.class, ScrollOfPetrification.class);
exoToReg.put(ScrollOfPetrification.class, ScrollOfTeleportation.class);
regToExo.put(ScrollOfRecharging.class, ScrollOfPetrification.class);
exoToReg.put(ScrollOfPetrification.class, ScrollOfRecharging.class);
regToExo.put(ScrollOfMagicMapping.class, ScrollOfPetrification.class);
exoToReg.put(ScrollOfPetrification.class, ScrollOfMagicMapping.class);
regToExo.put(ScrollOfPsionicBlast.class, ScrollOfPetrification.class);
exoToReg.put(ScrollOfPetrification.class, ScrollOfPsionicBlast.class);
regToExo.put(ScrollOfMirrorImage.class, ScrollOfPetrification.class);
exoToReg.put(ScrollOfPetrification.class, ScrollOfMirrorImage.class);
}
@Override

View File

@ -323,6 +323,7 @@ items.artifacts.unstablespellbook.desc=This Tome is in surprising good condition
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 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.
items.artifacts.unstablespellbook.read_empowered=The scroll you added to the spellbook surges with energy. You are able to channel either the regular, or exotic version of this scroll's effect.\n\nChoosing the exotic variant will cost 2 charges instead of 1.