Search in sources :

Example 6 with WndQuest

use of com.watabou.pixeldungeon.windows.WndQuest in project pixel-dungeon-remix by NYRDS.

the class Blacksmith method interact.

@Override
public boolean interact(final Hero hero) {
    getSprite().turnTo(getPos(), hero.getPos());
    if (!Quest.given) {
        GameScene.show(new WndQuest(this, Quest.alternative ? TXT_BLOOD_1 : TXT_GOLD_1) {

            @Override
            public void onBackPressed() {
                super.onBackPressed();
                Quest.given = true;
                Quest.completed = false;
                Pickaxe pick = new Pickaxe();
                if (pick.doPickUp(hero)) {
                    GLog.i(Hero.TXT_YOU_NOW_HAVE, pick.name());
                } else {
                    Dungeon.level.drop(pick, hero.getPos()).sprite.drop();
                }
            }
        });
        Journal.add(Journal.Feature.TROLL.desc());
    } else if (!Quest.completed) {
        if (Quest.alternative) {
            Pickaxe pick = hero.belongings.getItem(Pickaxe.class);
            if (pick == null) {
                tell(TXT2);
            } else if (!pick.bloodStained) {
                tell(TXT4);
            } else {
                if (pick.isEquipped(hero)) {
                    pick.doUnequip(hero, false);
                }
                pick.detach(hero.belongings.backpack);
                tell(TXT_COMPLETED);
                Quest.completed = true;
                Quest.reforged = false;
            }
        } else {
            Pickaxe pick = hero.belongings.getItem(Pickaxe.class);
            DarkGold gold = hero.belongings.getItem(DarkGold.class);
            if (pick == null) {
                tell(TXT2);
            } else if (gold == null || gold.quantity() < 15) {
                tell(TXT3);
            } else {
                if (pick.isEquipped(hero)) {
                    pick.doUnequip(hero, false);
                }
                pick.detach(hero.belongings.backpack);
                gold.detachAll(hero.belongings.backpack);
                tell(TXT_COMPLETED);
                Quest.completed = true;
                Quest.reforged = false;
            }
        }
    } else if (!Quest.reforged) {
        GameScene.show(new WndBlacksmith(this, hero));
    } else {
        tell(TXT_GET_LOST);
    }
    return true;
}
Also used : WndQuest(com.watabou.pixeldungeon.windows.WndQuest) WndBlacksmith(com.watabou.pixeldungeon.windows.WndBlacksmith) Pickaxe(com.watabou.pixeldungeon.items.quest.Pickaxe) DarkGold(com.watabou.pixeldungeon.items.quest.DarkGold)

Example 7 with WndQuest

use of com.watabou.pixeldungeon.windows.WndQuest in project pixel-dungeon by watabou.

the class Blacksmith method interact.

@Override
public void interact() {
    sprite.turnTo(pos, Dungeon.hero.pos);
    if (!Quest.given) {
        GameScene.show(new WndQuest(this, Quest.alternative ? TXT_BLOOD_1 : TXT_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(Hero.TXT_YOU_NOW_HAVE, pick.name());
                } else {
                    Dungeon.level.drop(pick, Dungeon.hero.pos).sprite.drop();
                }
            }
        });
        Journal.add(Journal.Feature.TROLL);
    } else if (!Quest.completed) {
        if (Quest.alternative) {
            Pickaxe pick = Dungeon.hero.belongings.getItem(Pickaxe.class);
            if (pick == null) {
                tell(TXT2);
            } else if (!pick.bloodStained) {
                tell(TXT4);
            } else {
                if (pick.isEquipped(Dungeon.hero)) {
                    pick.doUnequip(Dungeon.hero, false);
                }
                pick.detach(Dungeon.hero.belongings.backpack);
                tell(TXT_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(TXT2);
            } else if (gold == null || gold.quantity() < 15) {
                tell(TXT3);
            } else {
                if (pick.isEquipped(Dungeon.hero)) {
                    pick.doUnequip(Dungeon.hero, false);
                }
                pick.detach(Dungeon.hero.belongings.backpack);
                gold.detachAll(Dungeon.hero.belongings.backpack);
                tell(TXT_COMPLETED);
                Quest.completed = true;
                Quest.reforged = false;
            }
        }
    } else if (!Quest.reforged) {
        GameScene.show(new WndBlacksmith(this, Dungeon.hero));
    } else {
        tell(TXT_GET_LOST);
    }
}
Also used : WndQuest(com.watabou.pixeldungeon.windows.WndQuest) WndBlacksmith(com.watabou.pixeldungeon.windows.WndBlacksmith) Pickaxe(com.watabou.pixeldungeon.items.quest.Pickaxe) DarkGold(com.watabou.pixeldungeon.items.quest.DarkGold)

Example 8 with WndQuest

use of com.watabou.pixeldungeon.windows.WndQuest in project pixel-dungeon-remix by NYRDS.

the class LibrarianNPC method interact.

@Override
public boolean interact(final Hero hero) {
    getSprite().turnTo(getPos(), hero.getPos());
    GameScene.show(new WndQuest(this, TXT_MESSAGE));
    return true;
}
Also used : WndQuest(com.watabou.pixeldungeon.windows.WndQuest)

Example 9 with WndQuest

use of com.watabou.pixeldungeon.windows.WndQuest in project pixel-dungeon-remix by NYRDS.

the class NecromancerNPC method interact.

@Override
public boolean interact(final Hero hero) {
    getSprite().turnTo(getPos(), hero.getPos());
    if (!introduced) {
        GameScene.show(new WndQuest(this, TXT_INTRO));
        introduced = true;
        SkeletonKey key = new SkeletonKey();
        if (key.doPickUp(Dungeon.hero)) {
            GLog.i(Hero.TXT_YOU_NOW_HAVE, key.name());
        } else {
            Dungeon.level.drop(key, Dungeon.hero.getPos()).sprite.drop();
        }
    } else {
        int index = Random.Int(0, TXT_PHRASES.length);
        say(TXT_PHRASES[index]);
    }
    return true;
}
Also used : WndQuest(com.watabou.pixeldungeon.windows.WndQuest) SkeletonKey(com.watabou.pixeldungeon.items.keys.SkeletonKey)

Example 10 with WndQuest

use of com.watabou.pixeldungeon.windows.WndQuest in project pixel-dungeon-remix by NYRDS.

the class PlagueDoctorNPC method interact.

@Override
public boolean interact(final Hero hero) {
    getSprite().turnTo(getPos(), hero.getPos());
    if (Quest.completed) {
        GameScene.show(new WndQuest(this, TXT_QUEST_COMPLETED));
        return true;
    }
    if (Quest.given) {
        Item item = hero.belongings.getItem(RatHide.class);
        if (item != null && item.quantity() >= 5) {
            item.removeItemFrom(Dungeon.hero);
            Item reward = new RatArmor();
            reward.identify();
            if (reward.doPickUp(Dungeon.hero)) {
                GLog.i(Hero.TXT_YOU_NOW_HAVE, reward.name());
            } else {
                Dungeon.level.drop(reward, hero.getPos()).sprite.drop();
            }
            Quest.complete();
            GameScene.show(new WndQuest(this, TXT_QUEST_END));
        } else {
            GameScene.show(new WndQuest(this, (Utils.format(TXT_QUEST, 5))));
        }
    } else {
        String txtQuestStart = Utils.format(TXT_QUEST_START_M, 5);
        if (Dungeon.hero.getGender() == Utils.FEMININE) {
            txtQuestStart = Utils.format(TXT_QUEST_START_F, 5);
        }
        GameScene.show(new WndQuest(this, txtQuestStart));
        Quest.process(hero.getPos());
        Quest.given = true;
        Journal.add(Journal.Feature.PLAGUEDOCTOR.desc());
    }
    return true;
}
Also used : WndQuest(com.watabou.pixeldungeon.windows.WndQuest) Item(com.watabou.pixeldungeon.items.Item) RatArmor(com.nyrds.pixeldungeon.items.common.RatArmor)

Aggregations

WndQuest (com.watabou.pixeldungeon.windows.WndQuest)14 Item (com.watabou.pixeldungeon.items.Item)5 DarkGold (com.watabou.pixeldungeon.items.quest.DarkGold)2 Pickaxe (com.watabou.pixeldungeon.items.quest.Pickaxe)2 WndBlacksmith (com.watabou.pixeldungeon.windows.WndBlacksmith)2 WndTradeItem (com.watabou.pixeldungeon.windows.WndTradeItem)2 CandleOfMindVision (com.nyrds.pixeldungeon.items.artifacts.CandleOfMindVision)1 RatArmor (com.nyrds.pixeldungeon.items.common.RatArmor)1 PumpkinPie (com.nyrds.pixeldungeon.items.food.PumpkinPie)1 WndSadGhostNecro (com.nyrds.pixeldungeon.windows.WndSadGhostNecro)1 SkeletonKey (com.watabou.pixeldungeon.items.keys.SkeletonKey)1 PotionOfMight (com.watabou.pixeldungeon.items.potions.PotionOfMight)1 DriedRose (com.watabou.pixeldungeon.items.quest.DriedRose)1 RatSkull (com.watabou.pixeldungeon.items.quest.RatSkull)1 WndSadGhost (com.watabou.pixeldungeon.windows.WndSadGhost)1