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;
}
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);
}
}
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;
}
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;
}
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;
}
Aggregations