final SpeakerNPC npc = npcs.get("Annie Jones");
// first conversation with annie. be like [strike]every good child[/strike] kymara was when she was little and advertise name and age.
npc.add(ConversationStates.IDLE,
ConversationPhrases.GREETING_MESSAGES,
new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
new QuestNotStartedCondition(QUEST_SLOT),
new QuestNotInStateCondition(QUEST_SLOT, "rejected")),
ConversationStates.ATTENDING,
"Hello, my name is Annie. I am five years old.",
null);
// player is supposed to speak to mummy now
npc.add(ConversationStates.IDLE,
ConversationPhrases.GREETING_MESSAGES,
new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
new QuestInStateCondition(QUEST_SLOT, "start"),
new PlayerHasItemWithHimCondition("icecream")),
ConversationStates.IDLE,
"Mummy says I mustn't talk to you any more. You're a stranger.",
null);
// player didn't get ice cream, meanie
npc.add(ConversationStates.IDLE,
ConversationPhrases.GREETING_MESSAGES,
new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
new QuestInStateCondition(QUEST_SLOT, "start"),
new NotCondition(new PlayerHasItemWithHimCondition("icecream"))),
ConversationStates.ATTENDING,
"Hello. I'm hungry.",
null);
// player got ice cream and spoke to mummy
npc.add(ConversationStates.IDLE,
ConversationPhrases.GREETING_MESSAGES,
new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
new QuestInStateCondition(QUEST_SLOT, "mummy"),
new PlayerHasItemWithHimCondition("icecream")),
ConversationStates.QUESTION_1,
"Yummy! Is that ice cream for me?",
null);
// player spoke to mummy and hasn't got ice cream
npc.add(ConversationStates.IDLE,
ConversationPhrases.GREETING_MESSAGES,
new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
new QuestInStateCondition(QUEST_SLOT, "mummy"),
new NotCondition(new PlayerHasItemWithHimCondition("icecream"))),
ConversationStates.ATTENDING,
"Hello. I'm hungry.",
null);
// player is in another state like eating
npc.add(ConversationStates.IDLE,
ConversationPhrases.GREETING_MESSAGES,
new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
new QuestStartedCondition(QUEST_SLOT),
new QuestNotInStateCondition(QUEST_SLOT, "start"),
new QuestNotInStateCondition(QUEST_SLOT, "mummy")),
ConversationStates.ATTENDING,
"Hello.",
null);
// player rejected quest
npc.add(ConversationStates.IDLE,
ConversationPhrases.GREETING_MESSAGES,
new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
new QuestInStateCondition(QUEST_SLOT, "rejected")),
ConversationStates.ATTENDING,
"Hello.",
null);
// player asks about quest for first time (or rejected)
npc.add(ConversationStates.ATTENDING,
ConversationPhrases.QUEST_MESSAGES,
new QuestNotStartedCondition(QUEST_SLOT),
ConversationStates.QUEST_OFFERED,
"I'm hungry! I'd like an ice cream, please. Vanilla, with a chocolate flake. Will you get me one?",
null);
// shouldn't happen
npc.add(ConversationStates.ATTENDING,
ConversationPhrases.QUEST_MESSAGES,
new QuestCompletedCondition(QUEST_SLOT),
ConversationStates.ATTENDING,
"I'm full up now thank you!",
null);
// player can repeat quest
npc.add(ConversationStates.ATTENDING,
ConversationPhrases.QUEST_MESSAGES,
new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT, "eating;"), new TimePassedCondition(QUEST_SLOT, 1, REQUIRED_MINUTES)),
ConversationStates.QUEST_OFFERED,
"I hope another ice cream wouldn't be greedy. Can you get me one?",
null);
// player can't repeat quest
npc.add(ConversationStates.ATTENDING,
ConversationPhrases.QUEST_MESSAGES,
new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT, "eating;"), new NotCondition(new TimePassedCondition(QUEST_SLOT, 1, REQUIRED_MINUTES))),
ConversationStates.ATTENDING,
"I've had too much ice cream. I feel sick.",
null);
// player should be bringing ice cream not asking about the quest
npc.add(ConversationStates.ATTENDING,
ConversationPhrases.QUEST_MESSAGES,
new AndCondition(new QuestActiveCondition(QUEST_SLOT), new NotCondition(new QuestStateStartsWithCondition(QUEST_SLOT, "eating;"))),
ConversationStates.ATTENDING,
"Waaaaaaaa! Where is my ice cream ....",
null);
// Player agrees to get the ice cream