final WeaponsCollector2 wc = new WeaponsCollector2();
wc.addToWorld();
final SpeakerNPC npc = wc.getNPC();
final Engine en = npc.getEngine();
final Player pl = PlayerTestHelper.createPlayer("player");
// set previous quest to done
pl.setQuest("weapons_collector", "done");
assertTrue(en.stepTest(pl, "hello"));
assertEquals(
"Greetings, old friend. If you are willing, I have another #quest for you.",
getReply(npc));
assertTrue(en.stepTest(pl, "quest"));
assertEquals(
"Recent adventurers to these parts describe strange new creatures with weapons"
+ " I have never seen. Would you fight these creatures and bring their weapons to me?",
getReply(npc));
assertTrue(en.stepTest(pl, ConversationPhrases.YES_MESSAGES.get(0)));
assertEquals(
"Wonderful. Now, the #list is small but the risk may be great. If you return safely, I have another reward for you.",
getReply(npc));
assertTrue(en.stepTest(pl, "list"));
assertEquals(
"There are 3 weapons still missing from my newest collection: #'morning star', #staff, and #'great sword'."
+ " Do you have anything like that with you?",
getReply(npc));
assertTrue(en.stepTest(pl, "no"));
assertEquals("Let me know as soon as you find them. Farewell.",
getReply(npc));
// start another conversation
assertTrue(en.stepTest(pl, "hi"));
assertEquals(
"Welcome back. I hope you have come to help me with my latest #list of weapons.",
getReply(npc));
assertTrue(en.stepTest(pl, "list"));
assertEquals(
"There are 3 weapons still missing from my newest collection: #'morning star', #staff, and #'great sword'."
+ " Do you have anything like that with you?",
getReply(npc));
assertTrue(en.stepTest(pl, "yes"));
assertEquals("What did you find?", getReply(npc));
Item weapon = new Item("morning star", "", "", null);
pl.getSlot("bag").add(weapon);
assertTrue(en.stepTest(pl, "morning star"));
assertEquals("Thank you very much! Do you have anything more for me?",
getReply(npc));
assertTrue(en.stepTest(pl, "morning star"));
assertEquals(
"I already have that one. Do you have any other weapon for me?",
getReply(npc));
for (final String cloakName : wc.getNeededItems()) {
weapon = new Item(cloakName, "", "", null);
pl.getSlot("bag").add(weapon);
en.step(pl, cloakName);
}
assertEquals(
"At last, my collection is complete! Thank you very much; here, take this pair of swords in exchange!",