Search in sources :

Example 1 with Wand

use of com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand in project shattered-pixel-dungeon-gdx by 00-Evan.

the class WaterOfTransmutation method changeWand.

private Wand changeWand(Wand w) {
    Wand n;
    do {
        n = (Wand) Generator.random(Category.WAND);
    } while (Challenges.isItemBlocked(n) || n.getClass() == w.getClass());
    n.level(0);
    n.upgrade(w.level());
    n.levelKnown = w.levelKnown;
    n.cursedKnown = w.cursedKnown;
    n.cursed = w.cursed;
    return n;
}
Also used : Wand(com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand)

Example 2 with Wand

use of com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand in project shattered-pixel-dungeon-gdx by 00-Evan.

the class ShopRoom method ChooseBag.

protected static Bag ChooseBag(Belongings pack) {
    // 0=pouch, 1=holder, 2=bandolier, 3=holster
    int[] bagItems = new int[4];
    // count up items in the main bag
    for (Item item : pack.backpack.items) {
        if (item instanceof Plant.Seed || item instanceof Runestone)
            bagItems[0]++;
        if (item instanceof Scroll)
            bagItems[1]++;
        if (item instanceof Potion)
            bagItems[2]++;
        if (item instanceof Wand || item instanceof MissileWeapon)
            bagItems[3]++;
    }
    // disqualify bags that have already been dropped
    if (Dungeon.LimitedDrops.VELVET_POUCH.dropped())
        bagItems[0] = -1;
    if (Dungeon.LimitedDrops.SCROLL_HOLDER.dropped())
        bagItems[1] = -1;
    if (Dungeon.LimitedDrops.POTION_BANDOLIER.dropped())
        bagItems[2] = -1;
    if (Dungeon.LimitedDrops.MAGICAL_HOLSTER.dropped())
        bagItems[3] = -1;
    // find the best bag to drop. This does give a preference to later bags, if counts are equal
    int bestBagIdx = 0;
    for (int i = 1; i <= 3; i++) {
        if (bagItems[bestBagIdx] <= bagItems[i]) {
            bestBagIdx = i;
        }
    }
    // drop it, or return nothing if no bag works
    if (bagItems[bestBagIdx] == -1)
        return null;
    switch(bestBagIdx) {
        case 0:
        default:
            Dungeon.LimitedDrops.VELVET_POUCH.drop();
            return new VelvetPouch();
        case 1:
            Dungeon.LimitedDrops.SCROLL_HOLDER.drop();
            return new ScrollHolder();
        case 2:
            Dungeon.LimitedDrops.POTION_BANDOLIER.drop();
            return new PotionBandolier();
        case 3:
            Dungeon.LimitedDrops.MAGICAL_HOLSTER.drop();
            return new MagicalHolster();
    }
}
Also used : Potion(com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion) Scroll(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll) Wand(com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand) VelvetPouch(com.shatteredpixel.shatteredpixeldungeon.items.bags.VelvetPouch) ScrollHolder(com.shatteredpixel.shatteredpixeldungeon.items.bags.ScrollHolder) Runestone(com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone) Point(com.watabou.utils.Point) Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Plant(com.shatteredpixel.shatteredpixeldungeon.plants.Plant) MagicalHolster(com.shatteredpixel.shatteredpixeldungeon.items.bags.MagicalHolster) PotionBandolier(com.shatteredpixel.shatteredpixeldungeon.items.bags.PotionBandolier) MissileWeapon(com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon)

Example 3 with Wand

use of com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand in project shattered-pixel-dungeon-gdx by 00-Evan.

the class ScrollOfUpgrade method onItemSelected.

@Override
protected void onItemSelected(Item item) {
    upgrade(curUser);
    // ...yes this is rather messy
    if (item instanceof Weapon) {
        Weapon w = (Weapon) item;
        boolean wasCursed = w.cursed;
        boolean hadCursedEnchant = w.hasCurseEnchant();
        boolean hadGoodEnchant = w.hasGoodEnchant();
        w.upgrade();
        if (hadCursedEnchant && !w.hasCurseEnchant()) {
            removeCurse(Dungeon.hero);
        } else if (wasCursed && !w.cursed) {
            weakenCurse(Dungeon.hero);
        }
        if (hadGoodEnchant && !w.hasGoodEnchant()) {
            GLog.w(Messages.get(Weapon.class, "incompatible"));
        }
    } else if (item instanceof Armor) {
        Armor a = (Armor) item;
        boolean wasCursed = a.cursed;
        boolean hadCursedGlyph = a.hasCurseGlyph();
        boolean hadGoodGlyph = a.hasGoodGlyph();
        a.upgrade();
        if (hadCursedGlyph && !a.hasCurseGlyph()) {
            removeCurse(Dungeon.hero);
        } else if (wasCursed && !a.cursed) {
            weakenCurse(Dungeon.hero);
        }
        if (hadGoodGlyph && !a.hasGoodGlyph()) {
            GLog.w(Messages.get(Armor.class, "incompatible"));
        }
    } else if (item instanceof Wand || item instanceof Ring) {
        boolean wasCursed = item.cursed;
        item.upgrade();
        if (wasCursed && !item.cursed) {
            removeCurse(Dungeon.hero);
        }
    } else {
        item.upgrade();
    }
    Badges.validateItemLevelAquired(item);
}
Also used : Armor(com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor) Ring(com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring) Wand(com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand) Weapon(com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon)

Example 4 with Wand

use of com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Electricity method evolve.

@Override
protected void evolve() {
    water = Dungeon.level.water;
    int cell;
    // spread first..
    for (int i = area.left - 1; i <= area.right; i++) {
        for (int j = area.top - 1; j <= area.bottom; j++) {
            cell = i + j * Dungeon.level.width();
            if (cur[cell] > 0) {
                spreadFromCell(cell, cur[cell]);
            }
        }
    }
    // ..then decrement/shock
    for (int i = area.left - 1; i <= area.right; i++) {
        for (int j = area.top - 1; j <= area.bottom; j++) {
            cell = i + j * Dungeon.level.width();
            if (cur[cell] > 0) {
                Char ch = Actor.findChar(cell);
                if (ch != null && !ch.isImmune(this.getClass())) {
                    Buff.prolong(ch, Paralysis.class, 1f);
                    if (cur[cell] % 2 == 1) {
                        ch.damage(Math.round(Random.Float(2 + Dungeon.depth / 5f)), this);
                    }
                }
                Heap h = Dungeon.level.heaps.get(cell);
                if (h != null) {
                    Item toShock = h.peek();
                    if (toShock instanceof Wand) {
                        ((Wand) toShock).gainCharge(0.333f);
                    } else if (toShock instanceof MagesStaff) {
                        ((MagesStaff) toShock).gainCharge(0.333f);
                    }
                }
                off[cell] = cur[cell] - 1;
                volume += off[cell];
            } else {
                off[cell] = 0;
            }
        }
    }
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) MagesStaff(com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff) Wand(com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand) Heap(com.shatteredpixel.shatteredpixeldungeon.items.Heap)

Example 5 with Wand

use of com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand in project shattered-pixel-dungeon-gdx by 00-Evan.

the class WaterOfTransmutation method changeStaff.

private MagesStaff changeStaff(MagesStaff staff) {
    Class<? extends Wand> wandClass = staff.wandClass();
    if (wandClass == null) {
        return null;
    } else {
        Wand n;
        do {
            n = (Wand) Generator.random(Category.WAND);
        } while (Challenges.isItemBlocked(n) || n.getClass() == wandClass);
        n.level(0);
        staff.imbueWand(n, null);
    }
    return staff;
}
Also used : Wand(com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand)

Aggregations

Wand (com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand)5 Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)2 Char (com.shatteredpixel.shatteredpixeldungeon.actors.Char)1 Heap (com.shatteredpixel.shatteredpixeldungeon.items.Heap)1 Armor (com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor)1 MagicalHolster (com.shatteredpixel.shatteredpixeldungeon.items.bags.MagicalHolster)1 PotionBandolier (com.shatteredpixel.shatteredpixeldungeon.items.bags.PotionBandolier)1 ScrollHolder (com.shatteredpixel.shatteredpixeldungeon.items.bags.ScrollHolder)1 VelvetPouch (com.shatteredpixel.shatteredpixeldungeon.items.bags.VelvetPouch)1 Potion (com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion)1 Ring (com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring)1 Scroll (com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll)1 Runestone (com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone)1 Weapon (com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon)1 MagesStaff (com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff)1 MissileWeapon (com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon)1 Plant (com.shatteredpixel.shatteredpixeldungeon.plants.Plant)1 Point (com.watabou.utils.Point)1