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();
|
validateAllItemsIdentified();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void validateAllWandsIdentified() {
|
//TODO: no longer in use, deal with new wand related badges in the badge rework.
|
||||||
if (Dungeon.hero != null && Dungeon.hero.isAlive() &&
|
/**public static void validateAllWandsIdentified() {
|
||||||
|
if (Dungeon.hero != null && Dungeon.hero.isAlive() &&
|
||||||
!local.contains( Badge.ALL_WANDS_IDENTIFIED ) && Wand.allKnown()) {
|
!local.contains( Badge.ALL_WANDS_IDENTIFIED ) && Wand.allKnown()) {
|
||||||
|
|
||||||
Badge badge = Badge.ALL_WANDS_IDENTIFIED;
|
Badge badge = Badge.ALL_WANDS_IDENTIFIED;
|
||||||
|
@ -474,7 +475,7 @@ public class Badges {
|
||||||
|
|
||||||
validateAllItemsIdentified();
|
validateAllItemsIdentified();
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public static void validateAllBagsBought( Item bag ) {
|
public static void validateAllBagsBought( Item bag ) {
|
||||||
|
|
||||||
|
@ -510,8 +511,8 @@ public class Badges {
|
||||||
if (!global.contains( Badge.ALL_ITEMS_IDENTIFIED ) &&
|
if (!global.contains( Badge.ALL_ITEMS_IDENTIFIED ) &&
|
||||||
global.contains( Badge.ALL_POTIONS_IDENTIFIED ) &&
|
global.contains( Badge.ALL_POTIONS_IDENTIFIED ) &&
|
||||||
global.contains( Badge.ALL_SCROLLS_IDENTIFIED ) &&
|
global.contains( Badge.ALL_SCROLLS_IDENTIFIED ) &&
|
||||||
global.contains( Badge.ALL_RINGS_IDENTIFIED ) &&
|
global.contains( Badge.ALL_RINGS_IDENTIFIED )) {
|
||||||
global.contains( Badge.ALL_WANDS_IDENTIFIED )) {
|
//global.contains( Badge.ALL_WANDS_IDENTIFIED )) {
|
||||||
|
|
||||||
Badge badge = Badge.ALL_ITEMS_IDENTIFIED;
|
Badge badge = Badge.ALL_ITEMS_IDENTIFIED;
|
||||||
displayBadge( badge );
|
displayBadge( badge );
|
||||||
|
|
|
@ -33,7 +33,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
|
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
|
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.CavesBossLevel;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.CavesLevel;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.CavesLevel;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.CityBossLevel;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.CityBossLevel;
|
||||||
|
@ -145,7 +144,6 @@ public class Dungeon {
|
||||||
|
|
||||||
Scroll.initLabels();
|
Scroll.initLabels();
|
||||||
Potion.initColors();
|
Potion.initColors();
|
||||||
Wand.initWoods();
|
|
||||||
Ring.initGems();
|
Ring.initGems();
|
||||||
|
|
||||||
Statistics.reset();
|
Statistics.reset();
|
||||||
|
@ -452,7 +450,6 @@ public class Dungeon {
|
||||||
|
|
||||||
Scroll.save( bundle );
|
Scroll.save( bundle );
|
||||||
Potion.save( bundle );
|
Potion.save( bundle );
|
||||||
Wand.save( bundle );
|
|
||||||
Ring.save( bundle );
|
Ring.save( bundle );
|
||||||
|
|
||||||
Actor.storeNextID( bundle );
|
Actor.storeNextID( bundle );
|
||||||
|
@ -530,7 +527,6 @@ public class Dungeon {
|
||||||
|
|
||||||
Scroll.restore( bundle );
|
Scroll.restore( bundle );
|
||||||
Potion.restore( bundle );
|
Potion.restore( bundle );
|
||||||
Wand.restore( bundle );
|
|
||||||
Ring.restore( bundle );
|
Ring.restore( bundle );
|
||||||
|
|
||||||
quickslot.restorePlaceholders( bundle );
|
quickslot.restorePlaceholders( bundle );
|
||||||
|
|
|
@ -21,7 +21,6 @@ import java.util.ArrayList;
|
||||||
|
|
||||||
import com.watabou.noosa.audio.Sample;
|
import com.watabou.noosa.audio.Sample;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
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.actors.hero.HeroClass;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.ItemStatusHandler;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon;
|
import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
|
import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfMagic.Magic;
|
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfMagic.Magic;
|
||||||
|
@ -73,76 +71,20 @@ public abstract class Wand extends KindOfWeapon {
|
||||||
private int usagesToKnow = USAGES_TO_KNOW;
|
private int usagesToKnow = USAGES_TO_KNOW;
|
||||||
|
|
||||||
protected boolean hitChars = true;
|
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;
|
defaultAction = AC_ZAP;
|
||||||
}
|
|
||||||
|
image = ItemSpriteSheet.WAND_MAGIC_MISSILE;
|
||||||
@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 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Wand() {
|
public Wand() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
calculateDamage();
|
calculateDamage();
|
||||||
|
|
||||||
try {
|
|
||||||
syncVisuals();
|
|
||||||
} catch (Exception e) {
|
|
||||||
// Wand of Magic Missile
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
}
|
||||||
public void syncVisuals(){
|
|
||||||
image = handler.image( this );
|
|
||||||
wood = handler.label( this );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<String> actions( Hero hero ) {
|
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
|
@Override
|
||||||
public Item identify() {
|
public Item identify() {
|
||||||
|
|
||||||
setKnown();
|
|
||||||
curChargeKnown = true;
|
curChargeKnown = true;
|
||||||
super.identify();
|
super.identify();
|
||||||
|
|
||||||
|
@ -264,14 +193,9 @@ public abstract class Wand extends KindOfWeapon {
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String name() {
|
|
||||||
return isKnown() ? name : wood + " wand";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String info() {
|
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) {
|
if (Dungeon.hero.heroClass == HeroClass.MAGE) {
|
||||||
info.append( "\n\n" );
|
info.append( "\n\n" );
|
||||||
if (levelKnown) {
|
if (levelKnown) {
|
||||||
|
@ -285,7 +209,7 @@ public abstract class Wand extends KindOfWeapon {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isIdentified() {
|
public boolean isIdentified() {
|
||||||
return super.isIdentified() && isKnown() && curChargeKnown;
|
return super.isIdentified() && curChargeKnown;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -365,10 +289,6 @@ public abstract class Wand extends KindOfWeapon {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean allKnown() {
|
|
||||||
return handler.known().size() == wands.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int price() {
|
public int price() {
|
||||||
int price = 75;
|
int price = 75;
|
||||||
|
@ -431,9 +351,8 @@ public abstract class Wand extends KindOfWeapon {
|
||||||
GLog.i( TXT_SELF_TARGET );
|
GLog.i( TXT_SELF_TARGET );
|
||||||
return;
|
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.
|
//targets the enemy hit for char-hitting wands, or the cell aimed at for other wands.
|
||||||
QuickSlotButton.target(Actor.findChar(curWand.hitChars ? cell : target));
|
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() {
|
protected int initialCharges() {
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,7 @@ public class WandOfTeleportation extends Wand {
|
||||||
Char ch = Actor.findChar( cell );
|
Char ch = Actor.findChar( cell );
|
||||||
|
|
||||||
if (ch == curUser) {
|
if (ch == curUser) {
|
||||||
|
|
||||||
setKnown();
|
|
||||||
ScrollOfTeleportation.teleportHero( curUser );
|
ScrollOfTeleportation.teleportHero( curUser );
|
||||||
|
|
||||||
} else if (ch != null && !(ch instanceof NPC)) {
|
} else if (ch != null && !(ch instanceof NPC)) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user