// time is not over
npc.add(ConversationStates.ATTENDING,
ConversationPhrases.QUEST_MESSAGES,
new AndCondition(
new QuestCompletedCondition(QUEST_SLOT),
new NotCondition(
new TimePassedCondition(QUEST_SLOT, 1, delay))),
ConversationStates.ATTENDING,
null,
new SayTimeRemainingAction(QUEST_SLOT, 1, delay, "You have to check again in"));
// explanations
npc.add(ConversationStates.ATTENDING,
"enemy",
new QuestInStateCondition(QUEST_SLOT, 0, "start"),
ConversationStates.ATTENDING,
null,
new ChatAction() {
public void fire(Player player, Sentence sentence, EventRaiser npc) {
npc.say(enemyForces.get(player.getQuest(QUEST_SLOT, 1)).second());
}
});
// explanations
npc.add(ConversationStates.ATTENDING,
"enemy",
new QuestNotInStateCondition(QUEST_SLOT, 0, "start"),
ConversationStates.ATTENDING,
"Yes, my enemies are everywhere, they want to kill me! I guess you are one of them. Stay away from me!",
null);
// checking for kills
final List<String> creatures = new LinkedList<String>(enemyForces.keySet());
for(int i=0; i<enemyForces.size(); i++) {
final String enemy = creatures.get(i);
// player killed enough enemies.
npc.add(ConversationStates.ATTENDING,
ConversationPhrases.QUEST_MESSAGES,
new AndCondition(
new QuestInStateCondition(QUEST_SLOT, 1, enemy),
new KilledInSumForQuestCondition(QUEST_SLOT, 2, enemyForces.get(enemy).first())),
ConversationStates.ATTENDING,
null,
new MultipleActions(
new RewardPlayerAction(),
new IncreaseXPAction(100000),
new IncrementQuestAction(QUEST_SLOT,3,1),
// empty the 2nd index as we use it later
new SetQuestAction(QUEST_SLOT,2,""),
new SetQuestToTimeStampAction(QUEST_SLOT,1),
new SetQuestAction(QUEST_SLOT,0,"done")));
// player killed not enough enemies.
npc.add(ConversationStates.ATTENDING,
ConversationPhrases.QUEST_MESSAGES,
new AndCondition(
new QuestInStateCondition(QUEST_SLOT, 1, enemy),
new NotCondition(
new KilledInSumForQuestCondition(QUEST_SLOT, 2, enemyForces.get(enemy).first()))),
ConversationStates.ATTENDING,
null,
new ExplainAction());