Examples of AndCondition


Examples of games.stendhal.server.entity.npc.condition.AndCondition

    actions.add(new SetQuestAndModifyKarmaAction(QUEST_SLOT, "done", 15.0))
    actions.add(new EquipItemAction("steel boots", 1, true));
   
    james.add(ConversationStates.ATTENDING,
        Arrays.asList("map", "henry"),
        new AndCondition(new QuestInStateCondition(QUEST_SLOT, "map"),
                new PlayerHasInfostringItemWithHimCondition("map", "henry")),
        ConversationStates.ATTENDING,
        "The map! Wonderful! Thank you. And here is your reward.",
        new MultipleActions(actions));
   
    james.add(ConversationStates.ATTENDING,
        Arrays.asList("map", "henry"),
        new AndCondition(new QuestInStateCondition(QUEST_SLOT, "map"),
                new NotCondition(new PlayerHasInfostringItemWithHimCondition("map", "henry"))),
        ConversationStates.ATTENDING,
        "Well, where is the map?",
        null);
   
View Full Code Here

Examples of games.stendhal.server.entity.npc.condition.AndCondition

     * book.
     */
    npc.add(
      ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestInStateCondition(QUEST_SLOT, "start")),
      ConversationStates.ATTENDING,
      "Oh, Ceryl's looking for that book back? My goodness! I completely forgot about it... here you go!",
      new MultipleActions(new EquipItemAction("black book", 1, true), new SetQuestAction(QUEST_SLOT, "jynath")));

    /** If player keeps asking for the book, just tell him to hurry up */
    npc.add(
      ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestInStateCondition(QUEST_SLOT, "jynath")),
      ConversationStates.ATTENDING,
      "You'd better take that book back to #Ceryl quickly... he'll be waiting for you.",
      null);

View Full Code Here

Examples of games.stendhal.server.entity.npc.condition.AndCondition

    reward.add(new SetQuestAction(QUEST_SLOT, "done"));

    npc.add(
      ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestInStateCondition(QUEST_SLOT, "jynath"),
          new PlayerHasItemWithHimCondition("black book")),
      ConversationStates.ATTENDING,
      "Oh, you got the book back! Phew, thanks!",
      new MultipleActions(reward));

    // There is no other way to get the book.
    // Remove that quest slot so that the player can get
    // it again from Jynath
    // As the book is both bound and useless outside the
    // quest, this is not a problem
    npc.add(
      ConversationStates.IDLE,
      ConversationPhrases.GREETING_MESSAGES,
      new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
          new QuestInStateCondition(QUEST_SLOT, "jynath"),
          new NotCondition(new PlayerHasItemWithHimCondition("black book"))),
      ConversationStates.ATTENDING,
      "Haven't you got that #book back from #Jynath? Please go look for it, quickly!",
      new SetQuestAction(QUEST_SLOT, "start"));
View Full Code Here

Examples of games.stendhal.server.entity.npc.condition.AndCondition

    final SpeakerNPC npc = npcs.get("Elisabeth");
   
    // first conversation with Elisabeth.
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestNotStartedCondition(QUEST_SLOT), new QuestNotInStateCondition(QUEST_SLOT, "rejected")),
        ConversationStates.ATTENDING,
        "I can't remember when I smelt the good taste of #chocolate the last time...",
        null);
   
    npc.addReply("chocolate", "My mom told me, that chocolate can be found in an assassin school, which is quite #dangerous. She said also that someone sells it in Ados...");
   
    npc.addReply("dangerous", "Some bandits wait on the road to the school and assassins guard the way there, so mom and I have to stay in Kirdneh because it's safe here...");
   
    // 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("chocolate bar")),
        ConversationStates.IDLE,
        "My mum wants to know who I was asking for chocolate from now :(",
        null);
   
    // player didn't get chocolate, meanie
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "start"), new NotCondition(new PlayerHasItemWithHimCondition("chocolate bar"))),
        ConversationStates.ATTENDING,
        "I hope that someone will bring me some chocolate soon...:(",
        null);
   
    // player got chocolate and spoke to mummy
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "mummy"), new PlayerHasItemWithHimCondition("chocolate bar")),
        ConversationStates.QUESTION_1,
        "Awesome! Is that chocolate for me?",
        null);
   
    // player spoke to mummy and hasn't got chocolate
    npc.add(ConversationStates.IDLE,
        ConversationPhrases.GREETING_MESSAGES,
        new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
            new QuestInStateCondition(QUEST_SLOT, "mummy"), new NotCondition(new PlayerHasItemWithHimCondition("chocolate bar"))),
        ConversationStates.ATTENDING,
        "I hope that someone will bring me some chocolate soon...:(",
        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 would really love to have some chocolate. I'd like one bar, please. A dark brown one or a sweet white one or some with flakes. Will you get me one?",
        null);
   
    // shouldn't happen
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new QuestCompletedCondition(QUEST_SLOT),
        ConversationStates.ATTENDING,
        "I still enjoy the last chocolate bar you brought me, thanks!",
        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 chocolate bar wouldn't be greedy. Can you get me another 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 chocolate. I feel sick.",
        null)
   
    // player should be bringing chocolate 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 chocolate ...",
        null);
   
    // Player agrees to get the chocolate
View Full Code Here

Examples of games.stendhal.server.entity.npc.condition.AndCondition

    final SpeakerNPC mummyNPC = npcs.get("Carey");

    // player speaks to mummy before Elisabeth
    mummyNPC.add(ConversationStates.IDLE,
          ConversationPhrases.GREETING_MESSAGES,
          new AndCondition(new GreetingMatchesNameCondition(mummyNPC.getName()),
              new QuestNotStartedCondition(QUEST_SLOT)),
          ConversationStates.ATTENDING, "Hello, nice to meet you.",
          null);

    // player is supposed to begetting chocolate
    mummyNPC.add(ConversationStates.IDLE,
          ConversationPhrases.GREETING_MESSAGES,
          new AndCondition(new GreetingMatchesNameCondition(mummyNPC.getName()),
              new QuestInStateCondition(QUEST_SLOT, "start")),
          ConversationStates.ATTENDING,
          "Oh you met my daughter Elisabeth already. You seem like a nice person so it would be really kind, if you can bring her a chocolate bar because I'm not #strong enough for that.",
          new SetQuestAction(QUEST_SLOT, "mummy"));
View Full Code Here

Examples of games.stendhal.server.entity.npc.condition.AndCondition

    return 10;
  }
 
  @Override
  public boolean isRepeatable(final Player player) {
    return new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT,"eating;"),
         new TimePassedCondition(QUEST_SLOT, 1, REQUIRED_MINUTES)).fire(player,null, null);
  }
View Full Code Here

Examples of games.stendhal.server.entity.npc.condition.AndCondition

    // quest can be given
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new OrCondition(
          new QuestNotStartedCondition(QUEST_SLOT),
          new AndCondition(
            new QuestCompletedCondition(QUEST_SLOT),
            new TimePassedCondition(QUEST_SLOT, 1, delay))),
        ConversationStates.ATTENDING,
        null,
        new GiveQuestAction());

    // 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,
View Full Code Here

Examples of games.stendhal.server.entity.npc.condition.AndCondition

    return 80;
 
 
  @Override
  public boolean isRepeatable(final Player player) {
    return  new AndCondition(new QuestCompletedCondition(QUEST_SLOT),
             new TimePassedCondition(QUEST_SLOT,1,delay)).fire(player, null, null);
  }
View Full Code Here

Examples of games.stendhal.server.entity.npc.condition.AndCondition

   
    //player fixed the machine but hadn't got mithril shield.
    // they return and ask for quest but they still haven't got mithril shield
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new AndCondition(new NotCondition(new QuestCompletedCondition(mithrilcloak.getShieldQuestSlot())),
                 new OrCondition(new QuestInStateCondition(mithrilcloak.getQuestSlot(), "need_mithril_shield"),
                         new QuestInStateCondition(mithrilcloak.getQuestSlot(), "fixed_machine"))
                 ),
        ConversationStates.ATTENDING,
                 "I don't have anything for you until you have proved yourself worthy of carrying mithril items, by getting the mithril shield.",
        null);


    // player fixed the machine but hadn't got mithril shield at time or didn't ask to hear more about the cloak.
    // when they have got it and return to ask for quest she offers the cloak
    npc.add(ConversationStates.ATTENDING,
        ConversationPhrases.QUEST_MESSAGES,
        new AndCondition(
                 new QuestCompletedCondition(mithrilcloak.getShieldQuestSlot()),
                 new OrCondition(new QuestInStateCondition(mithrilcloak.getQuestSlot(), "need_mithril_shield"),
                         new QuestInStateCondition(mithrilcloak.getQuestSlot(), "fixed_machine"))
                 ),
        ConversationStates.QUEST_2_OFFERED,
View Full Code Here

Examples of games.stendhal.server.entity.npc.condition.AndCondition

         

      // player asks for quest but they haven't completed mithril shield quest
      npc.add(ConversationStates.QUEST_2_OFFERED,
        ConversationPhrases.YES_MESSAGES,
        new AndCondition(
                 new NotCondition(new QuestCompletedCondition(mithrilcloak.getShieldQuestSlot())),
                 new QuestStartedCondition(mithrilcloak.getShieldQuestSlot())
                 ),
        ConversationStates.ATTENDING,
        "Oh, I see you are already on a quest to obtain a mithril shield. You see, I was going to offer you a mithril cloak. But you should finish that first. Come back when you've finished the mithril shield quest and we will speak again.",
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.