}
@Test
public void testQuest() {
SpeakerNPC henry = SingletonRepository.getNPCList().get("Henry");
Engine en1 = henry.getEngine();
SpeakerNPC james = SingletonRepository.getNPCList().get("Sergeant James");
Engine en2 = james.getEngine();
// talk with Henry
en1.step(player, "hi");
assertEquals("Ssshh! Silence or you will attract more #dwarves.", getReply(henry));
en1.step(player, "dwarves");
assertEquals("They are everywhere! Their #kingdom must be close.", getReply(henry));
en1.step(player, "kingdom");
assertEquals("Kanmararn, the legendary city of the #dwarves.", getReply(henry));
en1.step(player, "dwarves");
assertEquals("They are everywhere! Their #kingdom must be close.", getReply(henry));
en1.step(player, "kingdom");
assertEquals("Kanmararn, the legendary city of the #dwarves.", getReply(henry));
en1.step(player, "job");
assertEquals("I'm a soldier in the army.", getReply(henry));
en1.step(player, "offer");
en1.step(player, "help");
assertEquals("I need help myself. I got separated from my #group. Now I'm all alone.", getReply(henry));
en1.step(player, "group");
assertEquals("The General sent five of us to explore this area in search for #treasure.", getReply(henry));
en1.step(player, "treasure");
assertEquals("A big treasure is rumored to be #somewhere in this dungeon.", getReply(henry));
en1.step(player, "somewhere");
assertEquals("If you #help me I might give you a clue.", getReply(henry));
en1.step(player, "help");
assertEquals("I need help myself. I got separated from my #group. Now I'm all alone.", getReply(henry));
en1.step(player, "group");
assertEquals("The General sent five of us to explore this area in search for #treasure.", getReply(henry));
en1.step(player, "task");
assertEquals("Find my #group, Peter, Tom, and Charles, prove it and I will reward you. Will you do it?", getReply(henry));
en1.step(player, "group");
assertEquals("The General sent five of us to explore this area in search for #treasure. So, will you help me find them?", getReply(henry));
en1.step(player, "no");
assertEquals("OK. I understand. I'm scared of the #dwarves myself.", getReply(henry));
en1.step(player, "task");
assertEquals("Find my #group, Peter, Tom, and Charles, prove it and I will reward you. Will you do it?", getReply(henry));
en1.step(player, "group");
assertEquals("The General sent five of us to explore this area in search for #treasure. So, will you help me find them?", getReply(henry));
en1.step(player, "yes");
assertEquals("Thank you! I'll be waiting for your return.", getReply(henry));
en1.step(player, "task");
assertEquals("Find my #group, Peter, Tom, and Charles, prove it and I will reward you. Will you do it?", getReply(henry));
en1.step(player, "yes");
assertEquals("Thank you! I'll be waiting for your return.", getReply(henry));
en1.step(player, "map");
assertEquals("If you find my friends, I will give you the map.", getReply(henry));
en1.step(player, "treasure");
assertEquals("A big treasure is rumored to be #somewhere in this dungeon.", getReply(henry));
en1.step(player, "dwarves");
assertEquals("They are everywhere! Their #kingdom must be close.", getReply(henry));
en1.step(player, "kingodom");
assertEquals("Kanmararn, the legendary city of the #dwarves.", getReply(henry));
en1.step(player, "bye");
assertEquals("Bye and be careful with all those dwarves around!", getReply(henry));
en1.step(player, "hi");
assertEquals("You didn't prove that you have found them all!", getReply(henry));
en1.step(player, "bye");
assertEquals("Bye and be careful with all those dwarves around!", getReply(henry));
// You see the cold corpse of Peter. You can inspect it to see its contents.
// You see a slightly rusty scale armor. It is heavily deformed by several strong hammer blows. Stats are (DEF: 7).
// take scale armor with me
PlayerTestHelper.equipWithItem(player, "scale armor", "peter");
// You see the rotten corpse of Tom. You can inspect it to see its contents.
// take leather legs with me
// You see torn leather legs that are heavily covered with blood. Stats are (DEF: 1).
PlayerTestHelper.equipWithItem(player, "leather legs", "tom");
// now talk with James
en2.step(player, "hi");
assertEquals("Good day, adventurer!", getReply(james));
en2.step(player, "map");
assertEquals("The #treasure map that leads into the heart of the #dwarven #kingdom.", getReply(james));
en2.step(player, "treasure");
assertEquals("A big treasure is rumored to be somewhere in this dungeon.", getReply(james));
en2.step(player, "dwarven kingdom");
assertEquals("They are strong enemies! We're in their #kingdom.", getReply(james));
en2.step(player, "kingdom");
assertEquals("Kanmararn, the legendary kingdom of the #dwarves.", getReply(james));
en2.step(player, "dwarves");
assertEquals("They are strong enemies! We're in their #kingdom.", getReply(james));
en2.step(player, "dwarven kingdom");
assertEquals("They are strong enemies! We're in their #kingdom.", getReply(james));
en2.step(player, "bye");
assertEquals("Good luck and better watch your back with all those dwarves around!", getReply(james));
en2.step(player, "hi");
assertEquals("Good day, adventurer!", getReply(james));
en2.step(player, "task");
assertEquals("Find my fugitive soldier and bring him to me ... or at least the #map he's carrying.", getReply(james));
en2.step(player, "bye");
assertEquals("Good luck and better watch your back with all those dwarves around!", getReply(james));
// You see the slightly rotten corpse of Charles. You can inspect it to see its contents.
// You read: "IOU 250 money. (signed) McPegleg"
// take IOU with me
PlayerTestHelper.equipWithItem(player, "note", "charles");
en2.step(player, "hi");
// drop leather legs for testing
player.drop("leather legs");
en1.step(player, "hi");
assertEquals("You didn't prove that you have found them all!", getReply(henry));
en1.step(player, "bye");
assertEquals("Bye and be careful with all those dwarves around!", getReply(henry));
// take legs up again
PlayerTestHelper.equipWithItem(player, "leather legs", "tom");
assertFalse(player.isEquipped("map"));
assertEquals(0, player.getXP());
// back to Henry
en1.step(player, "hi");
assertEquals("Oh my! Peter, Tom, and Charles are all dead? *cries*. Anyway, here is your reward. And keep the IOU.", getReply(henry));
// player earns 2500 experience points.
assertEquals(2500, player.getXP());
// You see a hand drawn map, but no matter how you look at it, nothing on it looks familiar.
assertTrue(player.isEquipped("map"));
assertEquals("map", player.getQuest(questSlot, 0));
en1.step(player, "bye");
assertEquals("Bye and be careful with all those dwarves around!", getReply(henry));
// back to James
en2.step(player, "hi");
assertEquals("Good day, adventurer!", getReply(james));
en2.step(player, "map");
assertEquals("The map! Wonderful! Thank you. And here is your reward.", getReply(james));
// player earns 5000 experience points.
assertEquals(7500, player.getXP());
// You see a pair of steel boots, fit for any soldier. It is a special quest reward for player, and cannot be used by others. Stats are (DEF: 6).
assertTrue(player.isEquipped("steel boots"));
en2.step(player, "bye");
assertEquals("Good luck and better watch your back with all those dwarves around!", getReply(james));
// back to Henry
en1.step(player, "hi");
assertEquals("Ssshh! Silence or you will attract more #dwarves.", getReply(henry));