Search in sources :

Example 6 with Flare

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

the class AmuletScene method create.

@Override
public void create() {
    super.create();
    RenderedTextMultiline text = null;
    if (!noText) {
        text = renderMultiline(Messages.get(this, "text"), 8);
        text.maxWidth(WIDTH);
        add(text);
    }
    amulet = new Image(Assets.AMULET);
    add(amulet);
    RedButton btnExit = new RedButton(Messages.get(this, "exit")) {

        @Override
        protected void onClick() {
            Dungeon.win(Amulet.class);
            Dungeon.deleteGame(GamesInProgress.curSlot, true);
            Game.switchScene(RankingsScene.class);
        }
    };
    btnExit.setSize(WIDTH, BTN_HEIGHT);
    add(btnExit);
    RedButton btnStay = new RedButton(Messages.get(this, "stay")) {

        @Override
        protected void onClick() {
            onBackPressed();
        }
    };
    btnStay.setSize(WIDTH, BTN_HEIGHT);
    add(btnStay);
    float height;
    if (noText) {
        height = amulet.height + LARGE_GAP + btnExit.height() + SMALL_GAP + btnStay.height();
        amulet.x = (Camera.main.width - amulet.width) / 2;
        amulet.y = (Camera.main.height - height) / 2;
        align(amulet);
        btnExit.setPos((Camera.main.width - btnExit.width()) / 2, amulet.y + amulet.height + LARGE_GAP);
        btnStay.setPos(btnExit.left(), btnExit.bottom() + SMALL_GAP);
    } else {
        height = amulet.height + LARGE_GAP + text.height() + LARGE_GAP + btnExit.height() + SMALL_GAP + btnStay.height();
        amulet.x = (Camera.main.width - amulet.width) / 2;
        amulet.y = (Camera.main.height - height) / 2;
        align(amulet);
        text.setPos((Camera.main.width - text.width()) / 2, amulet.y + amulet.height + LARGE_GAP);
        align(text);
        btnExit.setPos((Camera.main.width - btnExit.width()) / 2, text.top() + text.height() + LARGE_GAP);
        btnStay.setPos(btnExit.left(), btnExit.bottom() + SMALL_GAP);
    }
    new Flare(8, 48).color(0xFFDDBB, true).show(amulet, 0).angularSpeed = +30;
    fadeIn();
}
Also used : Flare(com.shatteredpixel.shatteredpixeldungeon.effects.Flare) RenderedTextMultiline(com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline) RedButton(com.shatteredpixel.shatteredpixeldungeon.ui.RedButton) Image(com.watabou.noosa.Image)

Example 7 with Flare

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

the class CursedWand method veryRareEffect.

private static void veryRareEffect(final Wand wand, final Hero user, final Ballistica bolt) {
    switch(Random.Int(4)) {
        // great forest fire!
        case 0:
            for (int i = 0; i < Dungeon.level.length(); i++) {
                int c = Dungeon.level.map[i];
                if (c == Terrain.EMPTY || c == Terrain.EMBERS || c == Terrain.EMPTY_DECO || c == Terrain.GRASS || c == Terrain.HIGH_GRASS) {
                    GameScene.add(Blob.seed(i, 15, Regrowth.class));
                }
            }
            do {
                GameScene.add(Blob.seed(Dungeon.level.randomDestination(), 10, Fire.class));
            } while (Random.Int(5) != 0);
            new Flare(8, 32).color(0xFFFF66, true).show(user.sprite, 2f);
            Sample.INSTANCE.play(Assets.SND_TELEPORT);
            GLog.p(Messages.get(CursedWand.class, "grass"));
            GLog.w(Messages.get(CursedWand.class, "fire"));
            wand.wandUsed();
            break;
        // superpowered mimic
        case 1:
            cursedFX(user, bolt, new Callback() {

                public void call() {
                    Mimic mimic = Mimic.spawnAt(bolt.collisionPos, new ArrayList<Item>());
                    if (mimic != null) {
                        mimic.adjustStats(Dungeon.depth + 10);
                        mimic.HP = mimic.HT;
                        Item reward;
                        do {
                            reward = Generator.random(Random.oneOf(Generator.Category.WEAPON, Generator.Category.ARMOR, Generator.Category.RING, Generator.Category.WAND));
                        } while (reward.level() < 1);
                        Sample.INSTANCE.play(Assets.SND_MIMIC, 1, 1, 0.5f);
                        mimic.items.clear();
                        mimic.items.add(reward);
                    } else {
                        GLog.i(Messages.get(CursedWand.class, "nothing"));
                    }
                    wand.wandUsed();
                }
            });
            break;
        // crashes the game, yes, really.
        case 2:
            try {
                Dungeon.saveAll();
                if (Messages.lang() != Languages.ENGLISH) {
                    // Don't bother doing this joke to none-english speakers, I doubt it would translate.
                    GLog.i(Messages.get(CursedWand.class, "nothing"));
                    wand.wandUsed();
                } else {
                    GameScene.show(new WndOptions("CURSED WAND ERROR", "this application will now self-destruct", "abort", "retry", "fail") {

                        @Override
                        protected void onSelect(int index) {
                            Game.instance.finish();
                        }

                        @Override
                        public void onBackPressed() {
                        // do nothing
                        }
                    });
                }
            } catch (IOException e) {
                ShatteredPixelDungeon.reportException(e);
                // oookay maybe don't kill the game if the save failed.
                GLog.i(Messages.get(CursedWand.class, "nothing"));
                wand.wandUsed();
            }
            break;
        // random transmogrification
        case 3:
            wand.wandUsed();
            wand.detach(user.belongings.backpack);
            Item result;
            do {
                result = Generator.random(Random.oneOf(Generator.Category.WEAPON, Generator.Category.ARMOR, Generator.Category.RING, Generator.Category.ARTIFACT));
            } while (result.cursed);
            if (result.isUpgradable())
                result.upgrade();
            result.cursed = result.cursedKnown = true;
            GLog.w(Messages.get(CursedWand.class, "transmogrify"));
            Dungeon.level.drop(result, user.pos).sprite.drop();
            wand.wandUsed();
            break;
    }
}
Also used : WndOptions(com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions) Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Flare(com.shatteredpixel.shatteredpixeldungeon.effects.Flare) Callback(com.watabou.utils.Callback) Mimic(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic) Fire(com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire) ArrayList(java.util.ArrayList) Regrowth(com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Regrowth) IOException(java.io.IOException)

Example 8 with Flare

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

the class ScrollOfTerror method doRead.

@Override
public void doRead() {
    new Flare(5, 32).color(0xFF0000, true).show(curUser.sprite, 2f);
    Sample.INSTANCE.play(Assets.SND_READ);
    Invisibility.dispel();
    int count = 0;
    Mob affected = null;
    for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
        if (Dungeon.level.heroFOV[mob.pos]) {
            Buff.affect(mob, Terror.class, Terror.DURATION).object = curUser.id();
            if (mob.buff(Terror.class) != null) {
                count++;
                affected = mob;
            }
        }
    }
    switch(count) {
        case 0:
            GLog.i(Messages.get(this, "none"));
            break;
        case 1:
            GLog.i(Messages.get(this, "one", affected.name));
            break;
        default:
            GLog.i(Messages.get(this, "many"));
    }
    setKnown();
    readAnimation();
}
Also used : Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob) Flare(com.shatteredpixel.shatteredpixeldungeon.effects.Flare) Terror(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror)

Example 9 with Flare

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

the class Hero method die.

@Override
public void die(Object cause) {
    curAction = null;
    Ankh ankh = null;
    // look for ankhs in player inventory, prioritize ones which are blessed.
    for (Item item : belongings) {
        if (item instanceof Ankh) {
            if (ankh == null || ((Ankh) item).isBlessed()) {
                ankh = (Ankh) item;
            }
        }
    }
    if (ankh != null && ankh.isBlessed()) {
        this.HP = HT / 4;
        // ensures that you'll get to act first in almost any case, to prevent reviving and then instantly dieing again.
        Buff.detach(this, Paralysis.class);
        spend(-cooldown());
        new Flare(8, 32).color(0xFFFF66, true).show(sprite, 2f);
        CellEmitter.get(this.pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
        ankh.detach(belongings.backpack);
        Sample.INSTANCE.play(Assets.SND_TELEPORT);
        GLog.w(Messages.get(this, "revive"));
        Statistics.ankhsUsed++;
        return;
    }
    Actor.fixTime();
    super.die(cause);
    if (ankh == null) {
        reallyDie(cause);
    } else {
        Dungeon.deleteGame(GamesInProgress.curSlot, false);
        GameScene.show(new WndResurrect(ankh, cause));
    }
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) WndTradeItem(com.shatteredpixel.shatteredpixeldungeon.windows.WndTradeItem) WndResurrect(com.shatteredpixel.shatteredpixeldungeon.windows.WndResurrect) Flare(com.shatteredpixel.shatteredpixeldungeon.effects.Flare) Ankh(com.shatteredpixel.shatteredpixeldungeon.items.Ankh)

Aggregations

Flare (com.shatteredpixel.shatteredpixeldungeon.effects.Flare)9 Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)4 Mob (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob)2 RenderedTextMultiline (com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline)2 WndTradeItem (com.shatteredpixel.shatteredpixeldungeon.windows.WndTradeItem)2 Image (com.watabou.noosa.Image)2 IntMap (com.badlogic.gdx.utils.IntMap)1 Char (com.shatteredpixel.shatteredpixeldungeon.actors.Char)1 Blob (com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob)1 Fire (com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire)1 Regrowth (com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Regrowth)1 Terror (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror)1 Mimic (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic)1 Ankh (com.shatteredpixel.shatteredpixeldungeon.items.Ankh)1 Heap (com.shatteredpixel.shatteredpixeldungeon.items.Heap)1 Honeypot (com.shatteredpixel.shatteredpixeldungeon.items.Honeypot)1 Potion (com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion)1 RingOfWealth (com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfWealth)1 RegularLevel (com.shatteredpixel.shatteredpixeldungeon.levels.RegularLevel)1 Plant (com.shatteredpixel.shatteredpixeldungeon.plants.Plant)1