diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java index af596e665..6d8f89017 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java @@ -47,6 +47,8 @@ import com.watabou.utils.Random; public abstract class Wand extends KindOfWeapon { + private static final int USAGES_TO_KNOW = 40; + public static final String AC_ZAP = "ZAP"; private static final String TXT_WOOD = "This thin %s wand is warm to the touch. Who knows what it will do when used?"; @@ -55,7 +57,9 @@ public abstract class Wand extends KindOfWeapon { private static final String TXT_FIZZLES = "your wand fizzles; it must be out of charges for now"; private static final String TXT_SELF_TARGET = "You can't target yourself"; - + + private static final String TXT_IDENTIFY = "You are now familiar enough with your %s."; + private static final float TIME_TO_ZAP = 1f; public int maxCharges = initialCharges(); @@ -64,7 +68,9 @@ public abstract class Wand extends KindOfWeapon { protected Charger charger; private boolean curChargeKnown = false; - + + private int usagesToKnow = USAGES_TO_KNOW; + protected boolean hitChars = true; private static final Class[] wands = { @@ -331,8 +337,13 @@ public abstract class Wand extends KindOfWeapon { protected void wandUsed() { curCharges--; - updateQuickslot(); - + if (!isIdentified() && --usagesToKnow <= 0) { + identify(); + GLog.w( TXT_IDENTIFY, name() ); + } else { + updateQuickslot(); + } + curUser.spendAndNext( TIME_TO_ZAP ); } @@ -370,7 +381,8 @@ public abstract class Wand extends KindOfWeapon { } return price; } - + + private static final String UNFAMILIRIARITY = "unfamiliarity"; private static final String MAX_CHARGES = "maxCharges"; private static final String CUR_CHARGES = "curCharges"; private static final String CUR_CHARGE_KNOWN = "curChargeKnown"; @@ -378,6 +390,7 @@ public abstract class Wand extends KindOfWeapon { @Override public void storeInBundle( Bundle bundle ) { super.storeInBundle( bundle ); + bundle.put( UNFAMILIRIARITY, usagesToKnow ); bundle.put( MAX_CHARGES, maxCharges ); bundle.put( CUR_CHARGES, curCharges ); bundle.put( CUR_CHARGE_KNOWN, curChargeKnown ); @@ -386,6 +399,9 @@ public abstract class Wand extends KindOfWeapon { @Override public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle( bundle ); + if ((usagesToKnow = bundle.getInt( UNFAMILIRIARITY )) == 0) { + usagesToKnow = USAGES_TO_KNOW; + } maxCharges = bundle.getInt( MAX_CHARGES ); curCharges = bundle.getInt( CUR_CHARGES ); curChargeKnown = bundle.getBoolean( CUR_CHARGE_KNOWN ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLightning.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLightning.java index 1f34e151f..a0da9a4cc 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLightning.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLightning.java @@ -48,7 +48,7 @@ public class WandOfLightning extends Wand { @Override protected void onZap( int cell ) { - + // Everything is processed in fx() method if (!curUser.isAlive()) { Dungeon.fail( Utils.format( ResultDescriptions.ITEM, name ) ); GLog.n( "You killed yourself with your own Wand of Lightning..." );