Merging 1.7.5 Source: items/wands changes

This commit is contained in:
Evan Debenham
2015-02-04 01:09:48 -05:00
parent c1b262a614
commit fbd2fb907e
2 changed files with 22 additions and 6 deletions
@@ -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 );