use of com.nyrds.pixeldungeon.items.common.RatArmor 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;
}