v0.4.0: adjusted some scroll logic

This commit is contained in:
Evan Debenham 2016-06-09 05:48:32 -04:00 committed by Evan Debenham
parent ababc270dd
commit 99760aac86
5 changed files with 41 additions and 25 deletions

View File

@ -116,7 +116,7 @@ public class Generator {
ScrollOfMagicalInfusion.class, ScrollOfMagicalInfusion.class,
ScrollOfPsionicBlast.class, ScrollOfPsionicBlast.class,
ScrollOfMirrorImage.class }; ScrollOfMirrorImage.class };
Category.SCROLL.probs = new float[]{ 30, 10, 15, 0, 15, 15, 12, 8, 8, 0, 4, 10 }; Category.SCROLL.probs = new float[]{ 35, 10, 25, 0, 15, 15, 12, 8, 8, 0, 4, 10 };
Category.POTION.classes = new Class<?>[]{ Category.POTION.classes = new Class<?>[]{
PotionOfHealing.class, PotionOfHealing.class,

View File

@ -29,30 +29,25 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag; import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
public class ScrollOfRemoveCurse extends Scroll { public class ScrollOfRemoveCurse extends InventoryScroll {
{ {
initials = 8; initials = 8;
mode = WndBag.Mode.UNIDED_OR_CURSED;
} }
@Override @Override
protected void doRead() { protected void onItemSelected(Item item) {
new Flare( 6, 32 ).show( curUser.sprite, 2f ) ; new Flare( 6, 32 ).show( curUser.sprite, 2f ) ;
Sample.INSTANCE.play( Assets.SND_READ );
Invisibility.dispel();
boolean procced = uncurse( curUser, curUser.belongings.backpack.items.toArray( new Item[0] ) ); boolean procced = uncurse( curUser, item );
procced = uncurse( curUser,
curUser.belongings.weapon,
curUser.belongings.armor,
curUser.belongings.misc1,
curUser.belongings.misc2) || procced;
Weakness.detach( curUser, Weakness.class ); Weakness.detach( curUser, Weakness.class );
@ -61,10 +56,6 @@ public class ScrollOfRemoveCurse extends Scroll {
} else { } else {
GLog.i( Messages.get(this, "not_cleansed") ); GLog.i( Messages.get(this, "not_cleansed") );
} }
setKnown();
readAnimation();
} }
public static boolean uncurse( Hero hero, Item... items ) { public static boolean uncurse( Hero hero, Item... items ) {
@ -91,6 +82,9 @@ public class ScrollOfRemoveCurse extends Scroll {
procced = true; procced = true;
} }
} }
if (item instanceof Ring && item.level() <= 0){
item.upgrade(1 - item.level());
}
if (item instanceof Bag){ if (item instanceof Bag){
for (Item bagItem : ((Bag)item).items){ for (Item bagItem : ((Bag)item).items){
if (bagItem != null && bagItem.cursed) { if (bagItem != null && bagItem.cursed) {

View File

@ -25,6 +25,8 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey; import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfIdentify;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room; import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
@ -72,7 +74,12 @@ public class LibraryPainter extends Painter {
do { do {
pos = room.random(); pos = room.random();
} while (level.map[pos] != Terrain.EMPTY || level.heaps.get( pos ) != null); } while (level.map[pos] != Terrain.EMPTY || level.heaps.get( pos ) != null);
level.drop( prize( level), pos ); Item item;
if (i == 0)
item = Random.Int(2) == 0 ? new ScrollOfIdentify() : new ScrollOfRemoveCurse();
else
item = prize( level );
level.drop( item, pos );
} }
entrance.set( Room.Door.Type.LOCKED ); entrance.set( Room.Door.Type.LOCKED );

View File

@ -598,9 +598,10 @@ items.scrolls.scrollofrecharging.surge=A surge of energy courses through your bo
items.scrolls.scrollofrecharging.desc=The raw magical power bound up in this parchment will, when released, charge up all the users wands over time. items.scrolls.scrollofrecharging.desc=The raw magical power bound up in this parchment will, when released, charge up all the users wands over time.
items.scrolls.scrollofremovecurse.name=scroll of remove curse items.scrolls.scrollofremovecurse.name=scroll of remove curse
items.scrolls.scrollofremovecurse.cleansed=Your pack glows with a cleansing light, and a malevolent energy disperses. items.scrolls.scrollofremovecurse.inv_title=Select an item to cleanse
items.scrolls.scrollofremovecurse.not_cleansed=Your pack glows with a cleansing light, but nothing happens. items.scrolls.scrollofremovecurse.cleansed=Your item glows with a cleansing light, and a malevolent energy disperses!
items.scrolls.scrollofremovecurse.desc=The incantation on this scroll will instantly strip from the reader's weapon, armor, rings and carried items any evil enchantments that might prevent the wearer from removing them. items.scrolls.scrollofremovecurse.not_cleansed=Your item glows with a cleansing light, but nothing happens.
items.scrolls.scrollofremovecurse.desc=The incantation on this scroll will instantly strip any curses from a single weapon, ring, wand, armor, or artifact.
items.scrolls.scrollofteleportation.name=scroll of teleportation items.scrolls.scrollofteleportation.name=scroll of teleportation
items.scrolls.scrollofteleportation.tele=In a blink of an eye you were teleported to another location of the level. items.scrolls.scrollofteleportation.tele=In a blink of an eye you were teleported to another location of the level.
@ -616,7 +617,7 @@ items.scrolls.scrollofterror.desc=A flash of red light will overwhelm all creatu
items.scrolls.scrollofupgrade.name=scroll of upgrade items.scrolls.scrollofupgrade.name=scroll of upgrade
items.scrolls.scrollofupgrade.inv_title=Select an item to upgrade items.scrolls.scrollofupgrade.inv_title=Select an item to upgrade
items.scrolls.scrollofupgrade.looks_better=Your %s certainly looks better now items.scrolls.scrollofupgrade.looks_better=Your %s certainly looks better now
items.scrolls.scrollofupgrade.desc=This scroll will upgrade a single item, improving its quality. A wand will increase in power and in number of charges; a weapon will inflict more damage; a suit of armor will better absorb damage; the effect of a ring on its wearer will intensify. Weapons and armor will also require less strength to use, and any curses on the item will be lifted. items.scrolls.scrollofupgrade.desc=This scroll will upgrade a single item, improving its quality. A wand will increase in power and number of charges, weapons and armor will deal and block more damage, and the effects of rings will intensify. This scroll is even able to dispel curse effects, though it is not as potent as a scroll of remove curse.

View File

@ -39,6 +39,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.food.Food;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion; import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand; import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
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.items.weapon.missiles.Boomerang; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Boomerang;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
@ -60,6 +61,7 @@ public class WndBag extends WndTabbed {
public static enum Mode { public static enum Mode {
ALL, ALL,
UNIDENTIFED, UNIDENTIFED,
UNIDED_OR_CURSED,
UPGRADEABLE, UPGRADEABLE,
QUICKSLOT, QUICKSLOT,
FOR_SALE, FOR_SALE,
@ -367,6 +369,7 @@ public class WndBag extends WndTabbed {
mode == Mode.FOR_SALE && (item.price() > 0) && (!item.isEquipped( Dungeon.hero ) || !item.cursed) || mode == Mode.FOR_SALE && (item.price() > 0) && (!item.isEquipped( Dungeon.hero ) || !item.cursed) ||
mode == Mode.UPGRADEABLE && item.isUpgradable() || mode == Mode.UPGRADEABLE && item.isUpgradable() ||
mode == Mode.UNIDENTIFED && !item.isIdentified() || mode == Mode.UNIDENTIFED && !item.isIdentified() ||
mode == Mode.UNIDED_OR_CURSED && (item instanceof EquipableItem && (!item.isIdentified() || item.cursed)) ||
mode == Mode.QUICKSLOT && (item.defaultAction != null) || mode == Mode.QUICKSLOT && (item.defaultAction != null) ||
mode == Mode.WEAPON && (item instanceof MeleeWeapon || item instanceof Boomerang) || mode == Mode.WEAPON && (item instanceof MeleeWeapon || item instanceof Boomerang) ||
mode == Mode.ARMOR && (item instanceof Armor) || mode == Mode.ARMOR && (item instanceof Armor) ||
@ -379,6 +382,17 @@ public class WndBag extends WndTabbed {
mode == Mode.EQUIPMENT && (item instanceof EquipableItem) || mode == Mode.EQUIPMENT && (item instanceof EquipableItem) ||
mode == Mode.ALL mode == Mode.ALL
); );
//extra logic for cursed weapons or armor
if (!active && mode == Mode.UNIDED_OR_CURSED){
if (item instanceof Weapon){
Weapon w = (Weapon) item;
enable(w.enchantment != null && w.enchantment.curse());
}
if (item instanceof Armor){
Armor a = (Armor) item;
enable(a.glyph != null && a.glyph.curse());
}
}
} }
} else { } else {
bg.color( NORMAL ); bg.color( NORMAL );