Search in sources :

Example 1 with PumpkinPie

use of com.nyrds.pixeldungeon.items.food.PumpkinPie in project pixel-dungeon-remix by NYRDS.

the class ScarecrowNPC method interact.

@Override
public boolean interact(final Hero hero) {
    getSprite().turnTo(getPos(), hero.getPos());
    if (Quest.completed) {
        this.die(null);
        return true;
    }
    if (Quest.given) {
        Item item = hero.belongings.getItem(Candy.class);
        if (item != null && item.quantity() == 5) {
            item.removeItemFrom(Dungeon.hero);
            Item reward = new PumpkinPie();
            reward.quantity(5);
            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, TXT_QUEST));
        }
    } else {
        String txtQuestStart = TXT_QUEST_START_M;
        if (Dungeon.hero.getGender() == Utils.FEMININE) {
            txtQuestStart = TXT_QUEST_START_F;
        }
        GameScene.show(new WndQuest(this, txtQuestStart));
        Quest.given = true;
        Quest.process(hero.getPos());
        Journal.add(Journal.Feature.SCARECROW.desc());
    }
    return true;
}
Also used : Item(com.watabou.pixeldungeon.items.Item) WndTradeItem(com.watabou.pixeldungeon.windows.WndTradeItem) PumpkinPie(com.nyrds.pixeldungeon.items.food.PumpkinPie) WndQuest(com.watabou.pixeldungeon.windows.WndQuest)

Aggregations

PumpkinPie (com.nyrds.pixeldungeon.items.food.PumpkinPie)1 Item (com.watabou.pixeldungeon.items.Item)1 WndQuest (com.watabou.pixeldungeon.windows.WndQuest)1 WndTradeItem (com.watabou.pixeldungeon.windows.WndTradeItem)1