* Tests for quest.
*/
@Test
public void testQuest() {
final SpeakerNPC tad = getNPC("Tad");
final Engine engineTad = tad.getEngine();
engineTad.step(player, ConversationPhrases.GREETING_MESSAGES.get(0));
assertTrue(tad.isTalking());
assertEquals(SSSHH_COME_HERE, getReply(tad));
engineTad.step(player, "task");
assertTrue(tad.isTalking());
assertEquals(
"I'm not feeling well... I need to get a bottle of medicine made. Can you fetch me an empty #flask?",
getReply(tad));
engineTad.step(player, "yes");
assertTrue(player.hasQuest(QUEST_SLOT));
engineTad.step(player, ConversationPhrases.GOODBYE_MESSAGES.get(0));
assertFalse(tad.isTalking());
assertEquals("Bye.", getReply(tad));
final StackableItem flask = new StackableItem("flask", "", "", null);
flask.setQuantity(1);
flask.setID(new ID(2, ZONE_NAME));
player.getSlot("bag").add(flask);
assertTrue(player.isEquipped("flask"));
engineTad.step(player, ConversationPhrases.GREETING_MESSAGES.get(0));
assertTrue(tad.isTalking());
assertEquals(
"Ok, you got the flask! Here take this money to cover your expense. Now, I need you to take it to #ilisa... she'll know what to do next.",
getReply(tad));
assertTrue(player.hasQuest(QUEST_SLOT));
assertEquals("ilisa", player.getQuest(QUEST_SLOT));
engineTad.step(player, ConversationPhrases.GOODBYE_MESSAGES.get(0));
final SpeakerNPC ilisa = getNPC("Ilisa");
final Engine engineIlisa = ilisa.getEngine();
engineIlisa.step(player, ConversationPhrases.GREETING_MESSAGES.get(0));
assertEquals(
"Ah, I see you have that flask. #Tad needs medicine, right? Hmm... I'll need a #herb. Can you help?",
getReply(ilisa));
engineIlisa.step(player, "yes");
assertEquals("North of Semos, near the tree grove, grows a herb called arandula. Here is a picture I drew so you know what to look for.",getReply(ilisa));
assertEquals("corpse&herbs", player.getQuest(QUEST_SLOT));
engineIlisa.step(player, "tad");
assertEquals("He needs a very powerful potion to heal himself. He offers a good reward to anyone who will help him.", getReply(ilisa));
engineIlisa.step(player, ConversationPhrases.GOODBYE_MESSAGES.get(0));
assertEquals("Bye.", getReply(ilisa));
engineTad.step(player, ConversationPhrases.GREETING_MESSAGES.get(0));
assertTrue(tad.isTalking());
assertEquals("Tad has already asked and the quest was accepted",
"*sniff* *sniff* I still feel ill, please hurry with that #favour for me.", getReply(tad));
engineTad.step(player, ConversationPhrases.GOODBYE_MESSAGES.get(0));
assertFalse(tad.isTalking());
assertEquals("Bye.", getReply(tad));
engineIlisa.step(player, ConversationPhrases.GREETING_MESSAGES.get(0));
assertEquals("Can you fetch those #herbs for the #medicine?", getReply(ilisa));
engineIlisa.step(player, ConversationPhrases.GOODBYE_MESSAGES.get(0));
assertEquals("Bye.", getReply(ilisa));
// doesn't work as it causes an npe and adding it to setUp() doesn't help
//PlayerTestHelper.equipWithItem(player, "arandula");
final StackableItem arandula = new StackableItem("arandula", "", "", null);
arandula.setQuantity(1);
arandula.setID(new ID(2, ZONE_NAME));
player.getSlot("bag").add(arandula);
engineIlisa.step(player, ConversationPhrases.GREETING_MESSAGES.get(0));
assertEquals(
"Okay! Thank you. Now I will just mix these... a pinch of this... and a few drops... there! Can you ask #Tad to stop by and collect it? I want to see how he's doing.",
getReply(ilisa));
engineIlisa.step(player, ConversationPhrases.GOODBYE_MESSAGES.get(0));
assertEquals("Bye.", getReply(ilisa));
assertEquals("potion", player.getQuest(QUEST_SLOT));
engineTad.step(player, ConversationPhrases.GREETING_MESSAGES.get(0));