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 {
|
public abstract class Wand extends KindOfWeapon {
|
||||||
|
|
||||||
|
private static final int USAGES_TO_KNOW = 40;
|
||||||
|
|
||||||
public static final String AC_ZAP = "ZAP";
|
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?";
|
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_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_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;
|
private static final float TIME_TO_ZAP = 1f;
|
||||||
|
|
||||||
public int maxCharges = initialCharges();
|
public int maxCharges = initialCharges();
|
||||||
|
@ -64,7 +68,9 @@ public abstract class Wand extends KindOfWeapon {
|
||||||
protected Charger charger;
|
protected Charger charger;
|
||||||
|
|
||||||
private boolean curChargeKnown = false;
|
private boolean curChargeKnown = false;
|
||||||
|
|
||||||
|
private int usagesToKnow = USAGES_TO_KNOW;
|
||||||
|
|
||||||
protected boolean hitChars = true;
|
protected boolean hitChars = true;
|
||||||
|
|
||||||
private static final Class<?>[] wands = {
|
private static final Class<?>[] wands = {
|
||||||
|
@ -331,8 +337,13 @@ public abstract class Wand extends KindOfWeapon {
|
||||||
|
|
||||||
protected void wandUsed() {
|
protected void wandUsed() {
|
||||||
curCharges--;
|
curCharges--;
|
||||||
updateQuickslot();
|
if (!isIdentified() && --usagesToKnow <= 0) {
|
||||||
|
identify();
|
||||||
|
GLog.w( TXT_IDENTIFY, name() );
|
||||||
|
} else {
|
||||||
|
updateQuickslot();
|
||||||
|
}
|
||||||
|
|
||||||
curUser.spendAndNext( TIME_TO_ZAP );
|
curUser.spendAndNext( TIME_TO_ZAP );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +381,8 @@ public abstract class Wand extends KindOfWeapon {
|
||||||
}
|
}
|
||||||
return price;
|
return price;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final String UNFAMILIRIARITY = "unfamiliarity";
|
||||||
private static final String MAX_CHARGES = "maxCharges";
|
private static final String MAX_CHARGES = "maxCharges";
|
||||||
private static final String CUR_CHARGES = "curCharges";
|
private static final String CUR_CHARGES = "curCharges";
|
||||||
private static final String CUR_CHARGE_KNOWN = "curChargeKnown";
|
private static final String CUR_CHARGE_KNOWN = "curChargeKnown";
|
||||||
|
@ -378,6 +390,7 @@ public abstract class Wand extends KindOfWeapon {
|
||||||
@Override
|
@Override
|
||||||
public void storeInBundle( Bundle bundle ) {
|
public void storeInBundle( Bundle bundle ) {
|
||||||
super.storeInBundle( bundle );
|
super.storeInBundle( bundle );
|
||||||
|
bundle.put( UNFAMILIRIARITY, usagesToKnow );
|
||||||
bundle.put( MAX_CHARGES, maxCharges );
|
bundle.put( MAX_CHARGES, maxCharges );
|
||||||
bundle.put( CUR_CHARGES, curCharges );
|
bundle.put( CUR_CHARGES, curCharges );
|
||||||
bundle.put( CUR_CHARGE_KNOWN, curChargeKnown );
|
bundle.put( CUR_CHARGE_KNOWN, curChargeKnown );
|
||||||
|
@ -386,6 +399,9 @@ public abstract class Wand extends KindOfWeapon {
|
||||||
@Override
|
@Override
|
||||||
public void restoreFromBundle( Bundle bundle ) {
|
public void restoreFromBundle( Bundle bundle ) {
|
||||||
super.restoreFromBundle( bundle );
|
super.restoreFromBundle( bundle );
|
||||||
|
if ((usagesToKnow = bundle.getInt( UNFAMILIRIARITY )) == 0) {
|
||||||
|
usagesToKnow = USAGES_TO_KNOW;
|
||||||
|
}
|
||||||
maxCharges = bundle.getInt( MAX_CHARGES );
|
maxCharges = bundle.getInt( MAX_CHARGES );
|
||||||
curCharges = bundle.getInt( CUR_CHARGES );
|
curCharges = bundle.getInt( CUR_CHARGES );
|
||||||
curChargeKnown = bundle.getBoolean( CUR_CHARGE_KNOWN );
|
curChargeKnown = bundle.getBoolean( CUR_CHARGE_KNOWN );
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class WandOfLightning extends Wand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onZap( int cell ) {
|
protected void onZap( int cell ) {
|
||||||
|
// Everything is processed in fx() method
|
||||||
if (!curUser.isAlive()) {
|
if (!curUser.isAlive()) {
|
||||||
Dungeon.fail( Utils.format( ResultDescriptions.ITEM, name ) );
|
Dungeon.fail( Utils.format( ResultDescriptions.ITEM, name ) );
|
||||||
GLog.n( "You killed yourself with your own Wand of Lightning..." );
|
GLog.n( "You killed yourself with your own Wand of Lightning..." );
|
||||||
|
|
Loading…
Reference in New Issue
Block a user