Search in sources :

Example 1 with Bomb

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

the class RingOfWealth method generateRareDrop.

// TODO this is a start, but i'm sure this could be made more interesting...
private static ArrayList<Item> generateRareDrop() {
    float roll = Random.Float();
    ArrayList<Item> items = new ArrayList<>();
    if (roll < 0.6f) {
        switch(Random.Int(3)) {
            case 0:
                items.add(new Gold().random());
                break;
            case 1:
                items.add(Generator.random(Generator.Category.POTION));
                break;
            case 2:
                items.add(Generator.random(Generator.Category.SCROLL));
                break;
        }
    } else if (roll < 0.9f) {
        switch(Random.Int(3)) {
            case 0:
                items.add(Generator.random(Generator.Category.SEED));
                items.add(Generator.random(Generator.Category.SEED));
                items.add(Generator.random(Generator.Category.SEED));
                items.add(Generator.random(Generator.Category.SEED));
                items.add(Generator.random(Generator.Category.SEED));
                break;
            case 1:
                items.add(Generator.random(Random.Int(2) == 0 ? Generator.Category.POTION : Generator.Category.SCROLL));
                items.add(Generator.random(Random.Int(2) == 0 ? Generator.Category.POTION : Generator.Category.SCROLL));
                items.add(Generator.random(Random.Int(2) == 0 ? Generator.Category.POTION : Generator.Category.SCROLL));
                break;
            case 2:
                items.add(new Bomb().random());
                items.add(new Honeypot());
                break;
        }
    } else {
        Gold g = new Gold();
        g.random();
        g.quantity(g.quantity() * 5);
        items.add(g);
    }
    return items;
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Gold(com.shatteredpixel.shatteredpixeldungeon.items.Gold) ArrayList(java.util.ArrayList) Bomb(com.shatteredpixel.shatteredpixeldungeon.items.Bomb) Honeypot(com.shatteredpixel.shatteredpixeldungeon.items.Honeypot)

Example 2 with Bomb

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

the class ShopRoom method generateItems.

protected static ArrayList<Item> generateItems() {
    ArrayList<Item> itemsToSpawn = new ArrayList<>();
    switch(Dungeon.depth) {
        case 6:
            itemsToSpawn.add((Random.Int(2) == 0 ? new Shortsword().identify() : new HandAxe()).identify());
            itemsToSpawn.add(Random.Int(2) == 0 ? new FishingSpear().quantity(2) : new Shuriken().quantity(2));
            itemsToSpawn.add(new LeatherArmor().identify());
            break;
        case 11:
            itemsToSpawn.add((Random.Int(2) == 0 ? new Sword().identify() : new Mace()).identify());
            itemsToSpawn.add(Random.Int(2) == 0 ? new ThrowingSpear().quantity(2) : new Bolas().quantity(2));
            itemsToSpawn.add(new MailArmor().identify());
            break;
        case 16:
            itemsToSpawn.add((Random.Int(2) == 0 ? new Longsword().identify() : new BattleAxe()).identify());
            itemsToSpawn.add(Random.Int(2) == 0 ? new Javelin().quantity(2) : new Tomahawk().quantity(2));
            itemsToSpawn.add(new ScaleArmor().identify());
            break;
        case 21:
            itemsToSpawn.add(Random.Int(2) == 0 ? new Greatsword().identify() : new WarHammer().identify());
            itemsToSpawn.add(Random.Int(2) == 0 ? new Trident().quantity(2) : new ThrowingHammer().quantity(2));
            itemsToSpawn.add(new PlateArmor().identify());
            itemsToSpawn.add(new Torch());
            itemsToSpawn.add(new Torch());
            itemsToSpawn.add(new Torch());
            break;
    }
    itemsToSpawn.add(TippedDart.randomTipped());
    itemsToSpawn.add(new MerchantsBeacon());
    itemsToSpawn.add(ChooseBag(Dungeon.hero.belongings));
    itemsToSpawn.add(new PotionOfHealing());
    for (int i = 0; i < 3; i++) itemsToSpawn.add(Generator.random(Generator.Category.POTION));
    itemsToSpawn.add(new ScrollOfIdentify());
    itemsToSpawn.add(new ScrollOfRemoveCurse());
    itemsToSpawn.add(new ScrollOfMagicMapping());
    itemsToSpawn.add(Generator.random(Generator.Category.SCROLL));
    for (int i = 0; i < 2; i++) itemsToSpawn.add(Random.Int(2) == 0 ? Generator.random(Generator.Category.POTION) : Generator.random(Generator.Category.SCROLL));
    itemsToSpawn.add(new SmallRation());
    itemsToSpawn.add(new SmallRation());
    itemsToSpawn.add(new Bomb().random());
    switch(Random.Int(5)) {
        case 1:
            itemsToSpawn.add(new Bomb());
            break;
        case 2:
            itemsToSpawn.add(new Bomb().random());
            break;
        case 3:
        case 4:
            itemsToSpawn.add(new Honeypot());
            break;
    }
    if (Dungeon.depth == 6) {
        itemsToSpawn.add(new Ankh());
        itemsToSpawn.add(new Weightstone());
    } else {
        itemsToSpawn.add(Random.Int(2) == 0 ? new Ankh() : new Weightstone());
    }
    TimekeepersHourglass hourglass = Dungeon.hero.belongings.getItem(TimekeepersHourglass.class);
    if (hourglass != null) {
        int bags = 0;
        // this way players who get the hourglass late can still max it, usually.
        switch(Dungeon.depth) {
            case 6:
                bags = (int) Math.ceil((5 - hourglass.sandBags) * 0.20f);
                break;
            case 11:
                bags = (int) Math.ceil((5 - hourglass.sandBags) * 0.25f);
                break;
            case 16:
                bags = (int) Math.ceil((5 - hourglass.sandBags) * 0.50f);
                break;
            case 21:
                bags = (int) Math.ceil((5 - hourglass.sandBags) * 0.80f);
                break;
        }
        for (int i = 1; i <= bags; i++) {
            itemsToSpawn.add(new TimekeepersHourglass.sandBag());
            hourglass.sandBags++;
        }
    }
    Item rare;
    switch(Random.Int(10)) {
        case 0:
            rare = Generator.random(Generator.Category.WAND);
            rare.level(0);
            break;
        case 1:
            rare = Generator.random(Generator.Category.RING);
            rare.level(0);
            break;
        case 2:
            rare = Generator.random(Generator.Category.ARTIFACT);
            break;
        default:
            rare = new Stylus();
    }
    rare.cursed = rare.cursedKnown = false;
    itemsToSpawn.add(rare);
    // hard limit is 63 items + 1 shopkeeper, as shops can't be bigger than 8x8=64 internally
    if (itemsToSpawn.size() > 63)
        throw new RuntimeException("Shop attempted to carry more than 63 items!");
    Random.shuffle(itemsToSpawn);
    return itemsToSpawn;
}
Also used : MailArmor(com.shatteredpixel.shatteredpixeldungeon.items.armor.MailArmor) Tomahawk(com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Tomahawk) ScrollOfIdentify(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfIdentify) Bolas(com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Bolas) ThrowingHammer(com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.ThrowingHammer) ArrayList(java.util.ArrayList) BattleAxe(com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.BattleAxe) Javelin(com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Javelin) ScrollOfMagicMapping(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping) Torch(com.shatteredpixel.shatteredpixeldungeon.items.Torch) Stylus(com.shatteredpixel.shatteredpixeldungeon.items.Stylus) Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Longsword(com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Longsword) Sword(com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Sword) Trident(com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Trident) LeatherArmor(com.shatteredpixel.shatteredpixeldungeon.items.armor.LeatherArmor) Greatsword(com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Greatsword) PotionOfHealing(com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing) Bomb(com.shatteredpixel.shatteredpixeldungeon.items.Bomb) TimekeepersHourglass(com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass) Shortsword(com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Shortsword) ThrowingSpear(com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.ThrowingSpear) ScaleArmor(com.shatteredpixel.shatteredpixeldungeon.items.armor.ScaleArmor) MerchantsBeacon(com.shatteredpixel.shatteredpixeldungeon.items.MerchantsBeacon) Point(com.watabou.utils.Point) WarHammer(com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.WarHammer) ScrollOfRemoveCurse(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse) Weightstone(com.shatteredpixel.shatteredpixeldungeon.items.Weightstone) PlateArmor(com.shatteredpixel.shatteredpixeldungeon.items.armor.PlateArmor) FishingSpear(com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.FishingSpear) Mace(com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Mace) Shuriken(com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Shuriken) Ankh(com.shatteredpixel.shatteredpixeldungeon.items.Ankh) SmallRation(com.shatteredpixel.shatteredpixeldungeon.items.food.SmallRation) HandAxe(com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.HandAxe) Honeypot(com.shatteredpixel.shatteredpixeldungeon.items.Honeypot)

Example 3 with Bomb

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

the class SecretHoneypotRoom method paint.

@Override
public void paint(Level level) {
    Painter.fill(level, this, Terrain.WALL);
    Painter.fill(level, this, 1, Terrain.EMPTY);
    Point brokenPotPos = center();
    brokenPotPos.x = (brokenPotPos.x + entrance().x) / 2;
    brokenPotPos.y = (brokenPotPos.y + entrance().y) / 2;
    Honeypot.ShatteredPot pot = new Honeypot.ShatteredPot();
    level.drop(pot, level.pointToCell(brokenPotPos));
    Bee bee = new Bee();
    bee.spawn(Dungeon.depth);
    bee.HP = bee.HT;
    bee.pos = level.pointToCell(brokenPotPos);
    level.mobs.add(bee);
    pot.setBee(bee);
    bee.setPotInfo(level.pointToCell(brokenPotPos), null);
    placeItem(new Honeypot(), level);
    placeItem(Random.Int(3) == 0 ? new Bomb.DoubleBomb() : new Bomb(), level);
    if (Random.Int(2) == 0) {
        placeItem(new Bomb(), level);
    }
    entrance().set(Door.Type.HIDDEN);
}
Also used : Bee(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bee) Point(com.watabou.utils.Point) Bomb(com.shatteredpixel.shatteredpixeldungeon.items.Bomb) Honeypot(com.shatteredpixel.shatteredpixeldungeon.items.Honeypot)

Example 4 with Bomb

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

the class CursedWand method uncommonEffect.

private static void uncommonEffect(final Wand wand, final Hero user, final Ballistica bolt) {
    switch(Random.Int(4)) {
        // Random plant
        case 0:
            cursedFX(user, bolt, new Callback() {

                public void call() {
                    int pos = bolt.collisionPos;
                    // place the plant infront of an enemy so they walk into it.
                    if (Actor.findChar(pos) != null && bolt.dist > 1) {
                        pos = bolt.path.get(bolt.dist - 1);
                    }
                    if (pos == Terrain.EMPTY || pos == Terrain.EMBERS || pos == Terrain.EMPTY_DECO || pos == Terrain.GRASS || pos == Terrain.HIGH_GRASS) {
                        Dungeon.level.plant((Plant.Seed) Generator.random(Generator.Category.SEED), pos);
                    }
                    wand.wandUsed();
                }
            });
            break;
        // Health transfer
        case 1:
            final Char target = Actor.findChar(bolt.collisionPos);
            if (target != null) {
                cursedFX(user, bolt, new Callback() {

                    public void call() {
                        int damage = user.lvl * 2;
                        switch(Random.Int(2)) {
                            case 0:
                                user.HP = Math.min(user.HT, user.HP + damage);
                                user.sprite.emitter().burst(Speck.factory(Speck.HEALING), 3);
                                target.damage(damage, wand);
                                target.sprite.emitter().start(ShadowParticle.UP, 0.05f, 10);
                                break;
                            case 1:
                                user.damage(damage, this);
                                user.sprite.emitter().start(ShadowParticle.UP, 0.05f, 10);
                                target.HP = Math.min(target.HT, target.HP + damage);
                                target.sprite.emitter().burst(Speck.factory(Speck.HEALING), 3);
                                Sample.INSTANCE.play(Assets.SND_CURSED);
                                if (!user.isAlive()) {
                                    Dungeon.fail(wand.getClass());
                                    GLog.n(Messages.get(CursedWand.class, "ondeath", wand.name()));
                                }
                                break;
                        }
                        wand.wandUsed();
                    }
                });
            } else {
                GLog.i(Messages.get(CursedWand.class, "nothing"));
                wand.wandUsed();
            }
            break;
        // Bomb explosion
        case 2:
            cursedFX(user, bolt, new Callback() {

                public void call() {
                    new Bomb().explode(bolt.collisionPos);
                    wand.wandUsed();
                }
            });
            break;
        // shock and recharge
        case 3:
            new ShockingTrap().set(user.pos).activate();
            Buff.prolong(user, Recharging.class, 20f);
            ScrollOfRecharging.charge(user);
            SpellSprite.show(user, SpellSprite.CHARGE);
            wand.wandUsed();
            break;
    }
}
Also used : Callback(com.watabou.utils.Callback) Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) ShockingTrap(com.shatteredpixel.shatteredpixeldungeon.levels.traps.ShockingTrap) Bomb(com.shatteredpixel.shatteredpixeldungeon.items.Bomb)

Aggregations

Bomb (com.shatteredpixel.shatteredpixeldungeon.items.Bomb)4 Honeypot (com.shatteredpixel.shatteredpixeldungeon.items.Honeypot)3 Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)2 Point (com.watabou.utils.Point)2 ArrayList (java.util.ArrayList)2 Char (com.shatteredpixel.shatteredpixeldungeon.actors.Char)1 Bee (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bee)1 Ankh (com.shatteredpixel.shatteredpixeldungeon.items.Ankh)1 Gold (com.shatteredpixel.shatteredpixeldungeon.items.Gold)1 MerchantsBeacon (com.shatteredpixel.shatteredpixeldungeon.items.MerchantsBeacon)1 Stylus (com.shatteredpixel.shatteredpixeldungeon.items.Stylus)1 Torch (com.shatteredpixel.shatteredpixeldungeon.items.Torch)1 Weightstone (com.shatteredpixel.shatteredpixeldungeon.items.Weightstone)1 LeatherArmor (com.shatteredpixel.shatteredpixeldungeon.items.armor.LeatherArmor)1 MailArmor (com.shatteredpixel.shatteredpixeldungeon.items.armor.MailArmor)1 PlateArmor (com.shatteredpixel.shatteredpixeldungeon.items.armor.PlateArmor)1 ScaleArmor (com.shatteredpixel.shatteredpixeldungeon.items.armor.ScaleArmor)1 TimekeepersHourglass (com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass)1 SmallRation (com.shatteredpixel.shatteredpixeldungeon.items.food.SmallRation)1 PotionOfHealing (com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing)1