v0.3.0: removed the ability to disenchant the wand of magic missile, removed wands as weapons, added save transfer logic for pre-0.3.0

This commit is contained in:
Evan Debenham
2015-05-12 22:15:31 -04:00
parent 0a78b2dc28
commit 00dc49c021
5 changed files with 33 additions and 120 deletions
@@ -44,7 +44,7 @@ import com.watabou.utils.Bundle;
import com.watabou.utils.Callback;
import com.watabou.utils.Random;
public abstract class Wand extends KindOfWeapon {
public abstract class Wand extends Item {
private static final int USAGES_TO_KNOW = 10;
@@ -78,37 +78,16 @@ public abstract class Wand extends KindOfWeapon {
defaultAction = AC_ZAP;
}
public Wand() {
super();
calculateDamage();
}
@Override
public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero );
if (curCharges > 0 || !curChargeKnown) {
actions.add( AC_ZAP );
}
if (hero.heroClass != HeroClass.MAGE) {
actions.remove( AC_EQUIP );
actions.remove( AC_UNEQUIP );
}
return actions;
}
@Override
public boolean doUnequip( Hero hero, boolean collect, boolean single ) {
onDetach();
return super.doUnequip( hero, collect, single );
}
@Override
public void activate( Hero hero ) {
charge( hero );
}
@Override
public void execute( Hero hero, String action ) {
if (action.equals( AC_ZAP )) {
@@ -196,16 +175,7 @@ public abstract class Wand extends KindOfWeapon {
@Override
public String info() {
StringBuilder info = new StringBuilder( desc() );
if (Dungeon.hero.heroClass == HeroClass.MAGE) {
info.append( "\n\n" );
if (levelKnown) {
info.append( String.format( TXT_DAMAGE, MIN + (MAX - MIN) / 2 ) );
} else {
info.append( String.format( TXT_WEAPON ) );
}
}
return info.toString();
return desc();
}
@Override
@@ -247,8 +217,6 @@ public abstract class Wand extends KindOfWeapon {
public void updateLevel() {
maxCharges = Math.min( initialCharges() + level, 10 );
curCharges = Math.min( curCharges, maxCharges );
calculateDamage();
}
protected int initialCharges() {
@@ -259,12 +227,6 @@ public abstract class Wand extends KindOfWeapon {
return 1;
}
private void calculateDamage() {
int tier = 1 + level / 3;
MIN = tier;
MAX = (tier * tier - tier + 10) / 2 + level;
}
protected void fx( Ballistica bolt, Callback callback ) {
MagicMissile.whiteLight( curUser.sprite.parent, bolt.sourcePos, bolt.collisionPos, callback );
Sample.INSTANCE.play( Assets.SND_ZAP );
@@ -381,8 +343,7 @@ public abstract class Wand extends KindOfWeapon {
Invisibility.dispel();
} else {
curUser.spendAndNext( TIME_TO_ZAP );
GLog.w( TXT_FIZZLES );
}
@@ -43,16 +43,7 @@ import java.util.ArrayList;
public class WandOfMagicMissile extends Wand {
public static final String AC_DISENCHANT = "DISENCHANT";
private static final String TXT_SELECT_WAND = "Select a wand to upgrade";
private static final String TXT_DISENCHANTED =
"you disenchanted the Wand of Magic Missile and used its essence to upgrade your %s";
private static final float TIME_TO_DISENCHANT = 2f;
private boolean disenchantEquipped;
{
name = "Wand of Magic Missile";
image = ItemSpriteSheet.WAND_MAGIC_MISSILE;
@@ -60,15 +51,6 @@ public class WandOfMagicMissile extends Wand {
bones = false;
}
@Override
public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero );
if (level > 0) {
actions.add( AC_DISENCHANT );
}
return actions;
}
@Override
protected void onZap( Ballistica bolt ) {
@@ -94,29 +76,6 @@ public class WandOfMagicMissile extends Wand {
partialCharge += ((maxCharges - curCharges)/20f)*staff.level;
SpellSprite.show(attacker, SpellSprite.CHARGE);
}
@Override
public void execute( Hero hero, String action ) {
if (action.equals( AC_DISENCHANT )) {
if (hero.belongings.weapon == this) {
disenchantEquipped = true;
hero.belongings.weapon = null;
updateQuickslot();
} else {
disenchantEquipped = false;
detach( hero.belongings.backpack );
}
curUser = hero;
GameScene.selectItem( itemSelector, WndBag.Mode.WAND, TXT_SELECT_WAND );
} else {
super.execute( hero, action );
}
}
protected int initialCharges() {
return 4;
@@ -127,34 +86,4 @@ public class WandOfMagicMissile extends Wand {
return
"This wand launches missiles of pure magical energy, dealing moderate damage to a target creature.";
}
private final WndBag.Listener itemSelector = new WndBag.Listener() {
@Override
public void onSelect( Item item ) {
if (item != null) {
Sample.INSTANCE.play( Assets.SND_EVOKE );
ScrollOfUpgrade.upgrade( curUser );
evoke( curUser );
GLog.w( TXT_DISENCHANTED, item.name() );
Dungeon.quickslot.clearItem(WandOfMagicMissile.this);
WandOfMagicMissile.this.updateQuickslot();
item.upgrade();
curUser.spendAndNext( TIME_TO_DISENCHANT );
Badges.validateItemLevelAquired( item );
} else {
if (disenchantEquipped) {
curUser.belongings.weapon = WandOfMagicMissile.this;
WandOfMagicMissile.this.updateQuickslot();
} else {
collect( curUser.belongings.backpack );
}
}
}
};
}