Merging 1.7.5 Source: items/wands changes
This commit is contained in:
parent
c1b262a614
commit
fbd2fb907e
|
@ -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?";
|
||||
|
@ -56,6 +58,8 @@ 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();
|
||||
|
@ -65,6 +69,8 @@ public abstract class Wand extends KindOfWeapon {
|
|||
|
||||
private boolean curChargeKnown = false;
|
||||
|
||||
private int usagesToKnow = USAGES_TO_KNOW;
|
||||
|
||||
protected boolean hitChars = true;
|
||||
|
||||
private static final Class<?>[] wands = {
|
||||
|
@ -331,7 +337,12 @@ 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 );
|
||||
}
|
||||
|
@ -371,6 +382,7 @@ 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 );
|
||||
|
|
|
@ -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..." );
|
||||
|
|
Loading…
Reference in New Issue
Block a user