Search in sources :

Example 1 with WndQuest

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

the class Blacksmith method interact.

@Override
public boolean interact() {
    sprite.turnTo(pos, Dungeon.hero.pos);
    if (!Quest.given) {
        GameScene.show(new WndQuest(this, Quest.alternative ? Messages.get(this, "blood_1") : Messages.get(this, "gold_1")) {

            @Override
            public void onBackPressed() {
                super.onBackPressed();
                Quest.given = true;
                Quest.completed = false;
                Pickaxe pick = new Pickaxe();
                if (pick.doPickUp(Dungeon.hero)) {
                    GLog.i(Messages.get(Dungeon.hero, "you_now_have", pick.name()));
                } else {
                    Dungeon.level.drop(pick, Dungeon.hero.pos).sprite.drop();
                }
            }
        });
        Notes.add(Notes.Landmark.TROLL);
    } else if (!Quest.completed) {
        if (Quest.alternative) {
            Pickaxe pick = Dungeon.hero.belongings.getItem(Pickaxe.class);
            if (pick == null) {
                tell(Messages.get(this, "lost_pick"));
            } else if (!pick.bloodStained) {
                tell(Messages.get(this, "blood_2"));
            } else {
                if (pick.isEquipped(Dungeon.hero)) {
                    pick.doUnequip(Dungeon.hero, false);
                }
                pick.detach(Dungeon.hero.belongings.backpack);
                tell(Messages.get(this, "completed"));
                Quest.completed = true;
                Quest.reforged = false;
            }
        } else {
            Pickaxe pick = Dungeon.hero.belongings.getItem(Pickaxe.class);
            DarkGold gold = Dungeon.hero.belongings.getItem(DarkGold.class);
            if (pick == null) {
                tell(Messages.get(this, "lost_pick"));
            } else if (gold == null || gold.quantity() < 15) {
                tell(Messages.get(this, "gold_2"));
            } else {
                if (pick.isEquipped(Dungeon.hero)) {
                    pick.doUnequip(Dungeon.hero, false);
                }
                pick.detach(Dungeon.hero.belongings.backpack);
                gold.detachAll(Dungeon.hero.belongings.backpack);
                tell(Messages.get(this, "completed"));
                Quest.completed = true;
                Quest.reforged = false;
            }
        }
    } else if (!Quest.reforged) {
        GameScene.show(new WndBlacksmith(this, Dungeon.hero));
    } else {
        tell(Messages.get(this, "get_lost"));
    }
    return false;
}
Also used : WndQuest(com.shatteredpixel.shatteredpixeldungeon.windows.WndQuest) WndBlacksmith(com.shatteredpixel.shatteredpixeldungeon.windows.WndBlacksmith) Pickaxe(com.shatteredpixel.shatteredpixeldungeon.items.quest.Pickaxe) DarkGold(com.shatteredpixel.shatteredpixeldungeon.items.quest.DarkGold)

Example 2 with WndQuest

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

the class Ghost method interact.

@Override
public boolean interact() {
    sprite.turnTo(pos, Dungeon.hero.pos);
    Sample.INSTANCE.play(Assets.SND_GHOST);
    if (Quest.given) {
        if (Quest.weapon != null) {
            if (Quest.processed) {
                GameScene.show(new WndSadGhost(this, Quest.type));
            } else {
                switch(Quest.type) {
                    case 1:
                    default:
                        GameScene.show(new WndQuest(this, Messages.get(this, "rat_2")));
                        break;
                    case 2:
                        GameScene.show(new WndQuest(this, Messages.get(this, "gnoll_2")));
                        break;
                    case 3:
                        GameScene.show(new WndQuest(this, Messages.get(this, "crab_2")));
                        break;
                }
                int newPos = -1;
                for (int i = 0; i < 10; i++) {
                    newPos = Dungeon.level.randomRespawnCell();
                    if (newPos != -1) {
                        break;
                    }
                }
                if (newPos != -1) {
                    CellEmitter.get(pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
                    pos = newPos;
                    sprite.place(pos);
                    sprite.visible = Dungeon.level.heroFOV[pos];
                }
            }
        }
    } else {
        Mob questBoss;
        String txt_quest;
        switch(Quest.type) {
            case 1:
            default:
                questBoss = new FetidRat();
                txt_quest = Messages.get(this, "rat_1", Dungeon.hero.givenName());
                break;
            case 2:
                questBoss = new GnollTrickster();
                txt_quest = Messages.get(this, "gnoll_1", Dungeon.hero.givenName());
                break;
            case 3:
                questBoss = new GreatCrab();
                txt_quest = Messages.get(this, "crab_1", Dungeon.hero.givenName());
                break;
        }
        questBoss.pos = Dungeon.level.randomRespawnCell();
        if (questBoss.pos != -1) {
            GameScene.add(questBoss);
            GameScene.show(new WndQuest(this, txt_quest));
            Quest.given = true;
            Notes.add(Notes.Landmark.GHOST);
        }
    }
    return false;
}
Also used : WndQuest(com.shatteredpixel.shatteredpixeldungeon.windows.WndQuest) Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob) GreatCrab(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.GreatCrab) FetidRat(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.FetidRat) GnollTrickster(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.GnollTrickster) WndSadGhost(com.shatteredpixel.shatteredpixeldungeon.windows.WndSadGhost)

Example 3 with WndQuest

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

the class Wandmaker method interact.

@Override
public boolean interact() {
    sprite.turnTo(pos, Dungeon.hero.pos);
    if (Quest.given) {
        Item item;
        switch(Quest.type) {
            case 1:
            default:
                item = Dungeon.hero.belongings.getItem(CorpseDust.class);
                break;
            case 2:
                item = Dungeon.hero.belongings.getItem(Embers.class);
                break;
            case 3:
                item = Dungeon.hero.belongings.getItem(Rotberry.Seed.class);
                break;
        }
        if (item != null) {
            GameScene.show(new WndWandmaker(this, item));
        } else {
            String msg = "";
            switch(Quest.type) {
                case 1:
                    msg = Messages.get(this, "reminder_dust", Dungeon.hero.givenName());
                    break;
                case 2:
                    msg = Messages.get(this, "reminder_ember", Dungeon.hero.givenName());
                    break;
                case 3:
                    msg = Messages.get(this, "reminder_berry", Dungeon.hero.givenName());
                    break;
            }
            GameScene.show(new WndQuest(this, msg));
        }
    } else {
        String msg1 = "";
        String msg2 = "";
        switch(Dungeon.hero.heroClass) {
            case WARRIOR:
                msg1 += Messages.get(this, "intro_warrior");
                break;
            case ROGUE:
                msg1 += Messages.get(this, "intro_rogue");
                break;
            case MAGE:
                msg1 += Messages.get(this, "intro_mage", Dungeon.hero.givenName());
                break;
            case HUNTRESS:
                msg1 += Messages.get(this, "intro_huntress");
                break;
        }
        msg1 += Messages.get(this, "intro_1");
        switch(Quest.type) {
            case 1:
                msg2 += Messages.get(this, "intro_dust");
                break;
            case 2:
                msg2 += Messages.get(this, "intro_ember");
                break;
            case 3:
                msg2 += Messages.get(this, "intro_berry");
                break;
        }
        msg2 += Messages.get(this, "intro_2");
        final String msg2final = msg2;
        final NPC wandmaker = this;
        GameScene.show(new WndQuest(wandmaker, msg1) {

            @Override
            public void hide() {
                super.hide();
                GameScene.show(new WndQuest(wandmaker, msg2final));
            }
        });
        Notes.add(Notes.Landmark.WANDMAKER);
        Quest.given = true;
    }
    return false;
}
Also used : Embers(com.shatteredpixel.shatteredpixeldungeon.items.quest.Embers) WndWandmaker(com.shatteredpixel.shatteredpixeldungeon.windows.WndWandmaker) Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) WndQuest(com.shatteredpixel.shatteredpixeldungeon.windows.WndQuest) CorpseDust(com.shatteredpixel.shatteredpixeldungeon.items.quest.CorpseDust)

Aggregations

WndQuest (com.shatteredpixel.shatteredpixeldungeon.windows.WndQuest)3 FetidRat (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.FetidRat)1 GnollTrickster (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.GnollTrickster)1 GreatCrab (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.GreatCrab)1 Mob (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob)1 Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)1 CorpseDust (com.shatteredpixel.shatteredpixeldungeon.items.quest.CorpseDust)1 DarkGold (com.shatteredpixel.shatteredpixeldungeon.items.quest.DarkGold)1 Embers (com.shatteredpixel.shatteredpixeldungeon.items.quest.Embers)1 Pickaxe (com.shatteredpixel.shatteredpixeldungeon.items.quest.Pickaxe)1 WndBlacksmith (com.shatteredpixel.shatteredpixeldungeon.windows.WndBlacksmith)1 WndSadGhost (com.shatteredpixel.shatteredpixeldungeon.windows.WndSadGhost)1 WndWandmaker (com.shatteredpixel.shatteredpixeldungeon.windows.WndWandmaker)1