v0.3.0: wand types are now automatically known (wands still need to be IDed though)
This commit is contained in:
parent
bc64d00e17
commit
9c1cfc095f
|
@ -463,9 +463,10 @@ public class Badges {
|
|||
validateAllItemsIdentified();
|
||||
}
|
||||
}
|
||||
|
||||
public static void validateAllWandsIdentified() {
|
||||
if (Dungeon.hero != null && Dungeon.hero.isAlive() &&
|
||||
|
||||
//TODO: no longer in use, deal with new wand related badges in the badge rework.
|
||||
/**public static void validateAllWandsIdentified() {
|
||||
if (Dungeon.hero != null && Dungeon.hero.isAlive() &&
|
||||
!local.contains( Badge.ALL_WANDS_IDENTIFIED ) && Wand.allKnown()) {
|
||||
|
||||
Badge badge = Badge.ALL_WANDS_IDENTIFIED;
|
||||
|
@ -474,7 +475,7 @@ public class Badges {
|
|||
|
||||
validateAllItemsIdentified();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
public static void validateAllBagsBought( Item bag ) {
|
||||
|
||||
|
@ -510,8 +511,8 @@ public class Badges {
|
|||
if (!global.contains( Badge.ALL_ITEMS_IDENTIFIED ) &&
|
||||
global.contains( Badge.ALL_POTIONS_IDENTIFIED ) &&
|
||||
global.contains( Badge.ALL_SCROLLS_IDENTIFIED ) &&
|
||||
global.contains( Badge.ALL_RINGS_IDENTIFIED ) &&
|
||||
global.contains( Badge.ALL_WANDS_IDENTIFIED )) {
|
||||
global.contains( Badge.ALL_RINGS_IDENTIFIED )) {
|
||||
//global.contains( Badge.ALL_WANDS_IDENTIFIED )) {
|
||||
|
||||
Badge badge = Badge.ALL_ITEMS_IDENTIFIED;
|
||||
displayBadge( badge );
|
||||
|
|
|
@ -33,7 +33,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.CavesBossLevel;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.CavesLevel;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.CityBossLevel;
|
||||
|
@ -145,7 +144,6 @@ public class Dungeon {
|
|||
|
||||
Scroll.initLabels();
|
||||
Potion.initColors();
|
||||
Wand.initWoods();
|
||||
Ring.initGems();
|
||||
|
||||
Statistics.reset();
|
||||
|
@ -452,7 +450,6 @@ public class Dungeon {
|
|||
|
||||
Scroll.save( bundle );
|
||||
Potion.save( bundle );
|
||||
Wand.save( bundle );
|
||||
Ring.save( bundle );
|
||||
|
||||
Actor.storeNextID( bundle );
|
||||
|
@ -530,7 +527,6 @@ public class Dungeon {
|
|||
|
||||
Scroll.restore( bundle );
|
||||
Potion.restore( bundle );
|
||||
Wand.restore( bundle );
|
||||
Ring.restore( bundle );
|
||||
|
||||
quickslot.restorePlaceholders( bundle );
|
||||
|
|
|
@ -21,7 +21,6 @@ import java.util.ArrayList;
|
|||
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
|
@ -31,7 +30,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.ItemStatusHandler;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfMagic.Magic;
|
||||
|
@ -73,76 +71,20 @@ public abstract class Wand extends KindOfWeapon {
|
|||
private int usagesToKnow = USAGES_TO_KNOW;
|
||||
|
||||
protected boolean hitChars = true;
|
||||
|
||||
private static final Class<?>[] wands = {
|
||||
WandOfTeleportation.class,
|
||||
WandOfSlowness.class,
|
||||
WandOfFirebolt.class,
|
||||
WandOfPoison.class,
|
||||
WandOfRegrowth.class,
|
||||
WandOfBlink.class,
|
||||
WandOfLightning.class,
|
||||
WandOfAmok.class,
|
||||
WandOfTelekinesis.class,
|
||||
WandOfFlock.class,
|
||||
WandOfDisintegration.class,
|
||||
WandOfAvalanche.class
|
||||
};
|
||||
private static final String[] woods =
|
||||
{"holly", "yew", "ebony", "cherry", "teak", "rowan", "willow", "mahogany", "bamboo", "purpleheart", "oak", "birch"};
|
||||
private static final Integer[] images = {
|
||||
ItemSpriteSheet.WAND_HOLLY,
|
||||
ItemSpriteSheet.WAND_YEW,
|
||||
ItemSpriteSheet.WAND_EBONY,
|
||||
ItemSpriteSheet.WAND_CHERRY,
|
||||
ItemSpriteSheet.WAND_TEAK,
|
||||
ItemSpriteSheet.WAND_ROWAN,
|
||||
ItemSpriteSheet.WAND_WILLOW,
|
||||
ItemSpriteSheet.WAND_MAHOGANY,
|
||||
ItemSpriteSheet.WAND_BAMBOO,
|
||||
ItemSpriteSheet.WAND_PURPLEHEART,
|
||||
ItemSpriteSheet.WAND_OAK,
|
||||
ItemSpriteSheet.WAND_BIRCH};
|
||||
|
||||
private static ItemStatusHandler<Wand> handler;
|
||||
|
||||
private String wood;
|
||||
|
||||
|
||||
{
|
||||
defaultAction = AC_ZAP;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void initWoods() {
|
||||
handler = new ItemStatusHandler<Wand>( (Class<? extends Wand>[])wands, woods, images );
|
||||
}
|
||||
|
||||
public static void save( Bundle bundle ) {
|
||||
handler.save( bundle );
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void restore( Bundle bundle ) {
|
||||
handler = new ItemStatusHandler<Wand>( (Class<? extends Wand>[])wands, woods, images, bundle );
|
||||
|
||||
image = ItemSpriteSheet.WAND_MAGIC_MISSILE;
|
||||
}
|
||||
|
||||
public Wand() {
|
||||
super();
|
||||
|
||||
calculateDamage();
|
||||
|
||||
try {
|
||||
syncVisuals();
|
||||
} catch (Exception e) {
|
||||
// Wand of Magic Missile
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncVisuals(){
|
||||
image = handler.image( this );
|
||||
wood = handler.label( this );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
|
@ -227,22 +169,9 @@ public abstract class Wand extends KindOfWeapon {
|
|||
}
|
||||
}
|
||||
|
||||
protected boolean isKnown() {
|
||||
return handler.isKnown( this );
|
||||
}
|
||||
|
||||
public void setKnown() {
|
||||
if (!isKnown()) {
|
||||
handler.know( this );
|
||||
}
|
||||
|
||||
Badges.validateAllWandsIdentified();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item identify() {
|
||||
|
||||
setKnown();
|
||||
|
||||
curChargeKnown = true;
|
||||
super.identify();
|
||||
|
||||
|
@ -264,14 +193,9 @@ public abstract class Wand extends KindOfWeapon {
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
return isKnown() ? name : wood + " wand";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String info() {
|
||||
StringBuilder info = new StringBuilder( isKnown() ? desc() : String.format( TXT_WOOD, wood ) );
|
||||
StringBuilder info = new StringBuilder( desc() );
|
||||
if (Dungeon.hero.heroClass == HeroClass.MAGE) {
|
||||
info.append( "\n\n" );
|
||||
if (levelKnown) {
|
||||
|
@ -285,7 +209,7 @@ public abstract class Wand extends KindOfWeapon {
|
|||
|
||||
@Override
|
||||
public boolean isIdentified() {
|
||||
return super.isIdentified() && isKnown() && curChargeKnown;
|
||||
return super.isIdentified() && curChargeKnown;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -365,10 +289,6 @@ public abstract class Wand extends KindOfWeapon {
|
|||
return this;
|
||||
}
|
||||
|
||||
public static boolean allKnown() {
|
||||
return handler.known().size() == wands.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int price() {
|
||||
int price = 75;
|
||||
|
@ -431,9 +351,8 @@ public abstract class Wand extends KindOfWeapon {
|
|||
GLog.i( TXT_SELF_TARGET );
|
||||
return;
|
||||
}
|
||||
|
||||
curWand.setKnown();
|
||||
curUser.sprite.zap( cell );
|
||||
|
||||
curUser.sprite.zap(cell);
|
||||
|
||||
//targets the enemy hit for char-hitting wands, or the cell aimed at for other wands.
|
||||
QuickSlotButton.target(Actor.findChar(curWand.hitChars ? cell : target));
|
||||
|
|
|
@ -107,15 +107,6 @@ public class WandOfMagicMissile extends Wand {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isKnown() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setKnown() {
|
||||
}
|
||||
|
||||
protected int initialCharges() {
|
||||
return 3;
|
||||
}
|
||||
|
|
|
@ -40,8 +40,7 @@ public class WandOfTeleportation extends Wand {
|
|||
Char ch = Actor.findChar( cell );
|
||||
|
||||
if (ch == curUser) {
|
||||
|
||||
setKnown();
|
||||
|
||||
ScrollOfTeleportation.teleportHero( curUser );
|
||||
|
||||
} else if (ch != null && !(ch instanceof NPC)) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user