V0.1.0 Partial Commit
changed package and application names to differentiate from main PD release
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2014 Oleg Dolya
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.scrolls;
|
||||
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
|
||||
|
||||
public abstract class InventoryScroll extends Scroll {
|
||||
|
||||
protected String inventoryTitle = "Select an item";
|
||||
protected WndBag.Mode mode = WndBag.Mode.ALL;
|
||||
|
||||
private static final String TXT_WARNING =
|
||||
"Do you really want to cancel this scroll usage? " +
|
||||
"It will be consumed anyway.";
|
||||
private static final String TXT_YES = "Yes, I'm positive";
|
||||
private static final String TXT_NO = "No, I changed my mind";
|
||||
|
||||
@Override
|
||||
protected void doRead() {
|
||||
|
||||
if (!isKnown()) {
|
||||
setKnown();
|
||||
identifiedByUse = true;
|
||||
} else {
|
||||
identifiedByUse = false;
|
||||
}
|
||||
|
||||
GameScene.selectItem( itemSelector, mode, inventoryTitle );
|
||||
}
|
||||
|
||||
private void confirmCancelation() {
|
||||
GameScene.show( new WndOptions( name(), TXT_WARNING, TXT_YES, TXT_NO ) {
|
||||
@Override
|
||||
protected void onSelect( int index ) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
curUser.spendAndNext( TIME_TO_READ );
|
||||
identifiedByUse = false;
|
||||
break;
|
||||
case 1:
|
||||
GameScene.selectItem( itemSelector, mode, inventoryTitle );
|
||||
break;
|
||||
}
|
||||
}
|
||||
public void onBackPressed() {};
|
||||
} );
|
||||
}
|
||||
|
||||
protected abstract void onItemSelected( Item item );
|
||||
|
||||
protected static boolean identifiedByUse = false;
|
||||
protected static WndBag.Listener itemSelector = new WndBag.Listener() {
|
||||
@Override
|
||||
public void onSelect( Item item ) {
|
||||
if (item != null) {
|
||||
|
||||
((InventoryScroll)curItem).onItemSelected( item );
|
||||
curUser.spendAndNext( TIME_TO_READ );
|
||||
|
||||
Sample.INSTANCE.play( Assets.SND_READ );
|
||||
Invisibility.dispel();
|
||||
|
||||
} else if (identifiedByUse) {
|
||||
|
||||
((InventoryScroll)curItem).confirmCancelation();
|
||||
|
||||
} else {
|
||||
|
||||
curItem.collect( curUser.belongings.backpack );
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2014 Oleg Dolya
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.scrolls;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.ItemStatusHandler;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.watabou.utils.Bundle;
|
||||
|
||||
public abstract class Scroll extends Item {
|
||||
|
||||
private static final String TXT_BLINDED = "You can't read a scroll while blinded";
|
||||
|
||||
public static final String AC_READ = "READ";
|
||||
|
||||
protected static final float TIME_TO_READ = 1f;
|
||||
|
||||
private static final Class<?>[] scrolls = {
|
||||
ScrollOfIdentify.class,
|
||||
ScrollOfMagicMapping.class,
|
||||
ScrollOfRecharging.class,
|
||||
ScrollOfRemoveCurse.class,
|
||||
ScrollOfTeleportation.class,
|
||||
ScrollOfUpgrade.class,
|
||||
ScrollOfRage.class,
|
||||
ScrollOfTerror.class,
|
||||
ScrollOfLullaby.class,
|
||||
ScrollOfWeaponUpgrade.class,
|
||||
ScrollOfPsionicBlast.class,
|
||||
ScrollOfMirrorImage.class
|
||||
};
|
||||
private static final String[] runes =
|
||||
{"KAUNAN", "SOWILO", "LAGUZ", "YNGVI", "GYFU", "RAIDO", "ISAZ", "MANNAZ", "NAUDIZ", "BERKANAN", "ODAL", "TIWAZ"};
|
||||
private static final Integer[] images = {
|
||||
ItemSpriteSheet.SCROLL_KAUNAN,
|
||||
ItemSpriteSheet.SCROLL_SOWILO,
|
||||
ItemSpriteSheet.SCROLL_LAGUZ,
|
||||
ItemSpriteSheet.SCROLL_YNGVI,
|
||||
ItemSpriteSheet.SCROLL_GYFU,
|
||||
ItemSpriteSheet.SCROLL_RAIDO,
|
||||
ItemSpriteSheet.SCROLL_ISAZ,
|
||||
ItemSpriteSheet.SCROLL_MANNAZ,
|
||||
ItemSpriteSheet.SCROLL_NAUDIZ,
|
||||
ItemSpriteSheet.SCROLL_BERKANAN,
|
||||
ItemSpriteSheet.SCROLL_ODAL,
|
||||
ItemSpriteSheet.SCROLL_TIWAZ};
|
||||
|
||||
private static ItemStatusHandler<Scroll> handler;
|
||||
|
||||
private String rune;
|
||||
|
||||
{
|
||||
stackable = true;
|
||||
defaultAction = AC_READ;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void initLabels() {
|
||||
handler = new ItemStatusHandler<Scroll>( (Class<? extends Scroll>[])scrolls, runes, images );
|
||||
}
|
||||
|
||||
public static void save( Bundle bundle ) {
|
||||
handler.save( bundle );
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void restore( Bundle bundle ) {
|
||||
handler = new ItemStatusHandler<Scroll>( (Class<? extends Scroll>[])scrolls, runes, images, bundle );
|
||||
}
|
||||
|
||||
public Scroll() {
|
||||
super();
|
||||
image = handler.image( this );
|
||||
rune = handler.label( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
actions.add( AC_READ );
|
||||
return actions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute( Hero hero, String action ) {
|
||||
if (action.equals( AC_READ )) {
|
||||
|
||||
if (hero.buff( Blindness.class ) != null) {
|
||||
GLog.w( TXT_BLINDED );
|
||||
} else {
|
||||
curUser = hero;
|
||||
curItem = detach( hero.belongings.backpack );
|
||||
doRead();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
super.execute( hero, action );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
abstract protected void doRead();
|
||||
|
||||
public boolean isKnown() {
|
||||
return handler.isKnown( this );
|
||||
}
|
||||
|
||||
public void setKnown() {
|
||||
if (!isKnown()) {
|
||||
handler.know( this );
|
||||
}
|
||||
|
||||
Badges.validateAllScrollsIdentified();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item identify() {
|
||||
setKnown();
|
||||
return super.identify();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
return isKnown() ? name : "scroll \"" + rune + "\"";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String info() {
|
||||
return isKnown() ?
|
||||
desc() :
|
||||
"This parchment is covered with indecipherable writing, and bears a title " +
|
||||
"of rune " + rune + ". Who knows what it will do when read aloud?";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUpgradable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIdentified() {
|
||||
return isKnown();
|
||||
}
|
||||
|
||||
public static HashSet<Class<? extends Scroll>> getKnown() {
|
||||
return handler.known();
|
||||
}
|
||||
|
||||
public static HashSet<Class<? extends Scroll>> getUnknown() {
|
||||
return handler.unknown();
|
||||
}
|
||||
|
||||
public static boolean allKnown() {
|
||||
return handler.known().size() == scrolls.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int price() {
|
||||
return 15 * quantity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2014 Oleg Dolya
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.scrolls;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Identification;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
||||
|
||||
public class ScrollOfIdentify extends InventoryScroll {
|
||||
|
||||
{
|
||||
name = "Scroll of Identify";
|
||||
inventoryTitle = "Select an item to identify";
|
||||
mode = WndBag.Mode.UNIDENTIFED;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onItemSelected( Item item ) {
|
||||
|
||||
curUser.sprite.parent.add( new Identification( curUser.sprite.center().offset( 0, -16 ) ) );
|
||||
|
||||
item.identify();
|
||||
GLog.i( "It is " + item );
|
||||
|
||||
Badges.validateItemLevelAquired( item );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return
|
||||
"Permanently reveals all of the secrets of a single item.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int price() {
|
||||
return isKnown() ? 30 * quantity : super.price();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2014 Oleg Dolya
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.scrolls;
|
||||
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Sleep;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
|
||||
public class ScrollOfLullaby extends Scroll {
|
||||
|
||||
{
|
||||
name = "Scroll of Lullaby";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doRead() {
|
||||
|
||||
curUser.sprite.centerEmitter().start( Speck.factory( Speck.NOTE ), 0.3f, 5 );
|
||||
Sample.INSTANCE.play( Assets.SND_LULLABY );
|
||||
Invisibility.dispel();
|
||||
|
||||
int count = 0;
|
||||
Mob affected = null;
|
||||
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
|
||||
if (Level.fieldOfView[mob.pos]) {
|
||||
Buff.affect( mob, Sleep.class );
|
||||
if (mob.buff( Sleep.class ) != null) {
|
||||
affected = mob;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (count) {
|
||||
case 0:
|
||||
GLog.i( "The scroll utters a soothing melody." );
|
||||
break;
|
||||
case 1:
|
||||
GLog.i( "The scroll utters a soothing melody and the " + affected.name + " falls asleep!" );
|
||||
break;
|
||||
default:
|
||||
GLog.i( "The scroll utters a soothing melody and the monsters fall asleep!" );
|
||||
}
|
||||
setKnown();
|
||||
|
||||
curUser.spendAndNext( TIME_TO_READ );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return
|
||||
"A soothing melody will put all creatures in your field of view into a deep sleep, " +
|
||||
"giving you a chance to flee or make a surprise attack on them.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int price() {
|
||||
return isKnown() ? 50 * quantity : super.price();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2014 Oleg Dolya
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.scrolls;
|
||||
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
|
||||
public class ScrollOfMagicMapping extends Scroll {
|
||||
|
||||
private static final String TXT_LAYOUT = "You are now aware of the level layout.";
|
||||
|
||||
{
|
||||
name = "Scroll of Magic Mapping";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doRead() {
|
||||
|
||||
int length = Level.LENGTH;
|
||||
int[] map = Dungeon.level.map;
|
||||
boolean[] mapped = Dungeon.level.mapped;
|
||||
boolean[] discoverable = Level.discoverable;
|
||||
|
||||
boolean noticed = false;
|
||||
|
||||
for (int i=0; i < length; i++) {
|
||||
|
||||
int terr = map[i];
|
||||
|
||||
if (discoverable[i]) {
|
||||
|
||||
mapped[i] = true;
|
||||
if ((Terrain.flags[terr] & Terrain.SECRET) != 0) {
|
||||
|
||||
Level.set( i, Terrain.discover( terr ) );
|
||||
GameScene.updateMap( i );
|
||||
|
||||
if (Dungeon.visible[i]) {
|
||||
GameScene.discoverTile( i, terr );
|
||||
discover( i );
|
||||
|
||||
noticed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Dungeon.observe();
|
||||
|
||||
GLog.i( TXT_LAYOUT );
|
||||
if (noticed) {
|
||||
Sample.INSTANCE.play( Assets.SND_SECRET );
|
||||
}
|
||||
|
||||
SpellSprite.show( curUser, SpellSprite.MAP );
|
||||
Sample.INSTANCE.play( Assets.SND_READ );
|
||||
Invisibility.dispel();
|
||||
|
||||
setKnown();
|
||||
|
||||
curUser.spendAndNext( TIME_TO_READ );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return
|
||||
"When this scroll is read, an image of crystal clarity will be etched into your memory, " +
|
||||
"alerting you to the precise layout of the level and revealing all hidden secrets. " +
|
||||
"The locations of items and creatures will remain unknown.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int price() {
|
||||
return isKnown() ? 25 * quantity : super.price();
|
||||
}
|
||||
|
||||
public static void discover( int cell ) {
|
||||
CellEmitter.get( cell ).start( Speck.factory( Speck.DISCOVER ), 0.1f, 4 );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2014 Oleg Dolya
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.scrolls;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.MirrorImage;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfBlink;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class ScrollOfMirrorImage extends Scroll {
|
||||
|
||||
private static final int NIMAGES = 3;
|
||||
|
||||
{
|
||||
name = "Scroll of Mirror Image";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doRead() {
|
||||
|
||||
ArrayList<Integer> respawnPoints = new ArrayList<Integer>();
|
||||
|
||||
for (int i=0; i < Level.NEIGHBOURS8.length; i++) {
|
||||
int p = curUser.pos + Level.NEIGHBOURS8[i];
|
||||
if (Actor.findChar( p ) == null && (Level.passable[p] || Level.avoid[p])) {
|
||||
respawnPoints.add( p );
|
||||
}
|
||||
}
|
||||
|
||||
int nImages = NIMAGES;
|
||||
while (nImages > 0 && respawnPoints.size() > 0) {
|
||||
int index = Random.index( respawnPoints );
|
||||
|
||||
MirrorImage mob = new MirrorImage();
|
||||
mob.duplicate( curUser );
|
||||
GameScene.add( mob );
|
||||
WandOfBlink.appear( mob, respawnPoints.get( index ) );
|
||||
|
||||
respawnPoints.remove( index );
|
||||
nImages--;
|
||||
}
|
||||
|
||||
if (nImages < NIMAGES) {
|
||||
setKnown();
|
||||
}
|
||||
|
||||
Sample.INSTANCE.play( Assets.SND_READ );
|
||||
Invisibility.dispel();
|
||||
|
||||
curUser.spendAndNext( TIME_TO_READ );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return
|
||||
"The incantation on this scroll will create illusionary twins of the reader, which will chase his enemies.";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2014 Oleg Dolya
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.scrolls;
|
||||
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class ScrollOfPsionicBlast extends Scroll {
|
||||
|
||||
{
|
||||
name = "Scroll of Psionic Blast";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doRead() {
|
||||
|
||||
GameScene.flash( 0xFFFFFF );
|
||||
|
||||
Sample.INSTANCE.play( Assets.SND_BLAST );
|
||||
Invisibility.dispel();
|
||||
|
||||
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
|
||||
if (Level.fieldOfView[mob.pos]) {
|
||||
Buff.prolong( mob, Blindness.class, Random.Int( 3, 6 ) );
|
||||
mob.damage( Random.IntRange( 1, mob.HT * 2 / 3 ), this );
|
||||
}
|
||||
}
|
||||
|
||||
Buff.prolong( curUser, Blindness.class, Random.Int( 3, 6 ) );
|
||||
Dungeon.observe();
|
||||
|
||||
setKnown();
|
||||
|
||||
curUser.spendAndNext( TIME_TO_READ );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return
|
||||
"This scroll contains destructive energy, that can be psionically channeled to inflict a " +
|
||||
"massive damage to all creatures within a field of view. An accompanying flash of light will " +
|
||||
"temporarily blind everybody in the area of effect including the reader of the scroll.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int price() {
|
||||
return isKnown() ? 80 * quantity : super.price();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2014 Oleg Dolya
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.scrolls;
|
||||
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
|
||||
public class ScrollOfRage extends Scroll {
|
||||
|
||||
{
|
||||
name = "Scroll of Rage";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doRead() {
|
||||
|
||||
for (Mob mob : Dungeon.level.mobs) {
|
||||
mob.beckon( curUser.pos );
|
||||
if (Dungeon.level.fieldOfView[mob.pos]) {
|
||||
Buff.prolong(mob, Amok.class, 5f);
|
||||
}
|
||||
}
|
||||
|
||||
GLog.w( "The scroll emits an enraging roar that echoes throughout the dungeon!" );
|
||||
setKnown();
|
||||
|
||||
curUser.sprite.centerEmitter().start( Speck.factory( Speck.SCREAM ), 0.3f, 3 );
|
||||
Sample.INSTANCE.play( Assets.SND_CHALLENGE );
|
||||
Invisibility.dispel();
|
||||
|
||||
curUser.spendAndNext( TIME_TO_READ );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return
|
||||
"When read aloud, this scroll will unleash a great roar " +
|
||||
"that draws all enemies to the reader, and enrages nearby ones.";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2014 Oleg Dolya
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.scrolls;
|
||||
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.EnergyParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
|
||||
public class ScrollOfRecharging extends Scroll {
|
||||
|
||||
{
|
||||
name = "Scroll of Recharging";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doRead() {
|
||||
|
||||
int count = curUser.belongings.charge( true );
|
||||
charge( curUser );
|
||||
|
||||
Sample.INSTANCE.play( Assets.SND_READ );
|
||||
Invisibility.dispel();
|
||||
|
||||
if (count > 0) {
|
||||
GLog.i( "a surge of energy courses through your pack, recharging your wand" + (count > 1 ? "s" : "") );
|
||||
SpellSprite.show( curUser, SpellSprite.CHARGE );
|
||||
} else {
|
||||
GLog.i( "a surge of energy courses through your pack, but nothing happens" );
|
||||
}
|
||||
setKnown();
|
||||
|
||||
curUser.spendAndNext( TIME_TO_READ );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return
|
||||
"The raw magical power bound up in this parchment will, when released, " +
|
||||
"recharge all of the reader's wands to full power.";
|
||||
}
|
||||
|
||||
public static void charge( Hero hero ) {
|
||||
hero.sprite.centerEmitter().burst( EnergyParticle.FACTORY, 15 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int price() {
|
||||
return isKnown() ? 40 * quantity : super.price();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2014 Oleg Dolya
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.scrolls;
|
||||
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Weakness;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Flare;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
|
||||
public class ScrollOfRemoveCurse extends Scroll {
|
||||
|
||||
private static final String TXT_PROCCED =
|
||||
"Your pack glows with a cleansing light, and a malevolent energy disperses.";
|
||||
private static final String TXT_NOT_PROCCED =
|
||||
"Your pack glows with a cleansing light, but nothing happens.";
|
||||
|
||||
{
|
||||
name = "Scroll of Remove Curse";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doRead() {
|
||||
|
||||
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] ) );
|
||||
procced = uncurse( curUser,
|
||||
curUser.belongings.weapon,
|
||||
curUser.belongings.armor,
|
||||
curUser.belongings.ring1,
|
||||
curUser.belongings.ring2 ) || procced;
|
||||
|
||||
Weakness.detach( curUser, Weakness.class );
|
||||
|
||||
if (procced) {
|
||||
GLog.p( TXT_PROCCED );
|
||||
} else {
|
||||
GLog.i( TXT_NOT_PROCCED );
|
||||
}
|
||||
|
||||
setKnown();
|
||||
|
||||
curUser.spendAndNext( TIME_TO_READ );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return
|
||||
"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.";
|
||||
}
|
||||
|
||||
public static boolean uncurse( Hero hero, Item... items ) {
|
||||
|
||||
boolean procced = false;
|
||||
for (int i=0; i < items.length; i++) {
|
||||
Item item = items[i];
|
||||
if (item != null && item.cursed) {
|
||||
item.cursed = false;
|
||||
procced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (procced) {
|
||||
hero.sprite.emitter().start( ShadowParticle.UP, 0.05f, 10 );
|
||||
}
|
||||
|
||||
return procced;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int price() {
|
||||
return isKnown() ? 30 * quantity : super.price();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2014 Oleg Dolya
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.scrolls;
|
||||
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfBlink;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
|
||||
public class ScrollOfTeleportation extends Scroll {
|
||||
|
||||
public static final String TXT_TELEPORTED =
|
||||
"In a blink of an eye you were teleported to another location of the level.";
|
||||
|
||||
public static final String TXT_NO_TELEPORT =
|
||||
"Strong magic aura of this place prevents you from teleporting!";
|
||||
|
||||
{
|
||||
name = "Scroll of Teleportation";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doRead() {
|
||||
|
||||
Sample.INSTANCE.play( Assets.SND_READ );
|
||||
Invisibility.dispel();
|
||||
|
||||
teleportHero( curUser );
|
||||
setKnown();
|
||||
|
||||
curUser.spendAndNext( TIME_TO_READ );
|
||||
}
|
||||
|
||||
public static void teleportHero( Hero hero ) {
|
||||
|
||||
int count = 10;
|
||||
int pos;
|
||||
do {
|
||||
pos = Dungeon.level.randomRespawnCell();
|
||||
if (count-- <= 0) {
|
||||
break;
|
||||
}
|
||||
} while (pos == -1);
|
||||
|
||||
if (pos == -1) {
|
||||
|
||||
GLog.w( TXT_NO_TELEPORT );
|
||||
|
||||
} else {
|
||||
|
||||
WandOfBlink.appear( hero, pos );
|
||||
Dungeon.level.press( pos, hero );
|
||||
Dungeon.observe();
|
||||
|
||||
GLog.i( TXT_TELEPORTED );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return
|
||||
"The spell on this parchment instantly transports the reader " +
|
||||
"to a random location on the dungeon level. It can be used " +
|
||||
"to escape a dangerous situation, but the unlucky reader might " +
|
||||
"find himself in an even more dangerous place.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int price() {
|
||||
return isKnown() ? 40 * quantity : super.price();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2014 Oleg Dolya
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.scrolls;
|
||||
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Flare;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
|
||||
public class ScrollOfTerror extends Scroll {
|
||||
|
||||
{
|
||||
name = "Scroll of Terror";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doRead() {
|
||||
|
||||
new Flare( 5, 32 ).color( 0xFF0000, true ).show( curUser.sprite, 2f );
|
||||
Sample.INSTANCE.play( Assets.SND_READ );
|
||||
Invisibility.dispel();
|
||||
|
||||
int count = 0;
|
||||
Mob affected = null;
|
||||
for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
|
||||
if (Level.fieldOfView[mob.pos]) {
|
||||
Terror terror = Buff.affect( mob, Terror.class, Terror.DURATION );
|
||||
terror.source = curUser;
|
||||
|
||||
count++;
|
||||
affected = mob;
|
||||
}
|
||||
}
|
||||
|
||||
switch (count) {
|
||||
case 0:
|
||||
GLog.i( "The scroll emits a brilliant flash of red light" );
|
||||
break;
|
||||
case 1:
|
||||
GLog.i( "The scroll emits a brilliant flash of red light and the " + affected.name + " flees!" );
|
||||
break;
|
||||
default:
|
||||
GLog.i( "The scroll emits a brilliant flash of red light and the monsters flee!" );
|
||||
}
|
||||
setKnown();
|
||||
|
||||
curUser.spendAndNext( TIME_TO_READ );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return
|
||||
"A flash of red light will overwhelm all creatures in your field of view with terror, " +
|
||||
"and they will turn and flee. Attacking a fleeing enemy will dispel the effect.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int price() {
|
||||
return isKnown() ? 50 * quantity : super.price();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2014 Oleg Dolya
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.scrolls;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
||||
|
||||
public class ScrollOfUpgrade extends InventoryScroll {
|
||||
|
||||
private static final String TXT_LOOKS_BETTER = "your %s certainly looks better now";
|
||||
|
||||
{
|
||||
name = "Scroll of Upgrade";
|
||||
inventoryTitle = "Select an item to upgrade";
|
||||
mode = WndBag.Mode.UPGRADEABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onItemSelected( Item item ) {
|
||||
|
||||
ScrollOfRemoveCurse.uncurse( Dungeon.hero, item );
|
||||
item.upgrade();
|
||||
|
||||
GLog.p( TXT_LOOKS_BETTER, item.name() );
|
||||
|
||||
Badges.validateItemLevelAquired( item );
|
||||
|
||||
upgrade( curUser );
|
||||
}
|
||||
|
||||
public static void upgrade( Hero hero ) {
|
||||
hero.sprite.emitter().start( Speck.factory( Speck.UP ), 0.2f, 3 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return
|
||||
"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 " +
|
||||
"or find its mark more frequently; a suit of armor will deflect additional blows; " +
|
||||
"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.";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2014 Oleg Dolya
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.scrolls;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
||||
|
||||
public class ScrollOfWeaponUpgrade extends InventoryScroll {
|
||||
|
||||
private static final String TXT_LOOKS_BETTER = "your %s certainly looks better now";
|
||||
|
||||
{
|
||||
name = "Scroll of Weapon Upgrade";
|
||||
inventoryTitle = "Select a weapon to upgrade";
|
||||
mode = WndBag.Mode.WEAPON;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onItemSelected( Item item ) {
|
||||
|
||||
Weapon weapon = (Weapon)item;
|
||||
|
||||
ScrollOfRemoveCurse.uncurse( Dungeon.hero, weapon );
|
||||
weapon.upgrade( true );
|
||||
|
||||
GLog.p( TXT_LOOKS_BETTER, weapon.name() );
|
||||
|
||||
Badges.validateItemLevelAquired( weapon );
|
||||
|
||||
curUser.sprite.emitter().start( Speck.factory( Speck.UP ), 0.2f, 3 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return
|
||||
"This scroll will upgrade a melee weapon, improving its quality. In contrast to a regular Scroll of Upgrade, " +
|
||||
"this specialized version will never destroy an enchantment on a weapon. On the contrary, it is able to imbue " +
|
||||
"an unenchanted weapon with a random enchantment.";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user