Search in sources :

Example 1 with WndBlacksmith

use of com.watabou.pixeldungeon.windows.WndBlacksmith 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 2 with WndBlacksmith

use of com.watabou.pixeldungeon.windows.WndBlacksmith 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)

Aggregations

DarkGold (com.watabou.pixeldungeon.items.quest.DarkGold)2 Pickaxe (com.watabou.pixeldungeon.items.quest.Pickaxe)2 WndBlacksmith (com.watabou.pixeldungeon.windows.WndBlacksmith)2 WndQuest (com.watabou.pixeldungeon.windows.WndQuest)2