Examples of AndCondition


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

    fightingAchievements.add(createAchievement("fight.general.bears", "Bear Hunter", "Kill 10 black bears, 10 bears and 10 babybears", Achievement.EASY_BASE_SCORE, true,
                          new PlayerHasKilledNumberOfCreaturesCondition(10, "bear", "black bear", "babybear")));
    fightingAchievements.add(createAchievement("fight.general.foxes", "Fox Hunter", "Kill 20 foxes", Achievement.EASY_BASE_SCORE, true,
                          new PlayerHasKilledNumberOfCreaturesCondition("fox", 20)));
    fightingAchievements.add(createAchievement("fight.general.safari", "Safari", "Kill 30 tigers, 30 lions and 50 elephants", Achievement.EASY_BASE_SCORE, true,
                          new AndCondition(
                              new PlayerHasKilledNumberOfCreaturesCondition("tiger", 30),
                              new PlayerHasKilledNumberOfCreaturesCondition("lion", 30),
                              new PlayerHasKilledNumberOfCreaturesCondition("elephant", 50)
                              )));
    fightingAchievements.add(createAchievement("fight.general.ents", "Wood Cutter", "Kill 10 ents, 10 entwifes and 10 old ents", Achievement.MEDIUM_BASE_SCORE, true,
View Full Code Here

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

        addReply("island", "I can summon a magical island for you personally. It is sustained by your life force, so if you leave it, you must return quickly or "
            + "it will dissipate. You should not try to leave and return more than once. To enter, just pay the #fee.");
        addGoodbye("Bye.");
        add(ConversationStates.ANY,
            "fee",
            new AndCondition(new LevelGreaterThanCondition(MIN_LEVEL - 1),
                new TimePassedCondition(QUEST_SLOT, DAYS_BEFORE_REPEAT * MINUTES_IN_DAYS)),
                ConversationStates.QUEST_OFFERED,
                null,
                new ChatAction() {
          public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
            npc.say("The fee is your current level, multiplied by " + COST_FACTOR + " and payable in cash. At your level of "
                + player.getLevel() + " the fee is " + COST_FACTOR * player.getLevel() + " money. Do you want to fight?");     
          }
        });

        // player meets conditions, first remind them of the dangers and wait for a 'yes'
        add(ConversationStates.ANY,
            Arrays.asList("challenge", "fight", "battle"),
            new AndCondition(new LevelGreaterThanCondition(MIN_LEVEL - 1),
                new TimePassedCondition(QUEST_SLOT, DAYS_BEFORE_REPEAT * MINUTES_IN_DAYS)),
                ConversationStates.QUEST_OFFERED,
                "I accept your challenge. If you can pay the #fee, I will summon an island with " + NUMBER_OF_CREATURES
                + " dangerous creatures for you to face. So, are you sure you want to enter the adventure island?",
                null);
        // player returns within DAYS_BEFORE_REPEAT days, and his island has expired
        add(ConversationStates.ANY,
            Arrays.asList("challenge", "fight", "battle", "fee"),
            new AndCondition(
                new NotCondition(new TimePassedCondition(QUEST_SLOT, DAYS_BEFORE_REPEAT * MINUTES_IN_DAYS)),
                new NotCondition(new AdventureZoneExistsCondition())
            ),
            ConversationStates.ATTENDING,
            null,
            new SayTimeRemainingAction(QUEST_SLOT, DAYS_BEFORE_REPEAT * MINUTES_IN_DAYS, "Your life force will not support the island so soon after you last visited. You will be ready again in"));

        // player returns within DAYS_BEFORE_REPEAT days, if the zone still exists that he was in before, send him straight up.
        add(ConversationStates.ANY,
            Arrays.asList("challenge", "fight", "battle", "fee"),
            new AndCondition(
                new NotCondition(new TimePassedCondition(QUEST_SLOT, DAYS_BEFORE_REPEAT * MINUTES_IN_DAYS)),
                new AdventureZoneExistsCondition()
            ),
            ConversationStates.QUESTION_1,
            "The island which I recently summoned for you, remains for you to visit at no extra cost. Do you wish to return to it?",
View Full Code Here

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

      // TODO: add Pacifist achievement for not participating in pvp for 6 months or more (last_pvp_action_time)

    // Befriend Susi and complete quests for all children
    achievements.add(createAchievement("friend.quests.children", "Childrens' friend", "Complete quests for all children",
                        Achievement.MEDIUM_BASE_SCORE, true,
                        new AndCondition(
                            // Susi Quest is never set to done, therefore we check just if the quest has been started (condition "anyFriends" from FoundGirl.java)
                            new QuestStartedCondition("susi"),
                            // Help Tad, Semos Town Hall (Medicine for Tad)
                            new QuestCompletedCondition("introduce_players"),
                            // Plink, Semos Plains North
                            new QuestCompletedCondition("plinks_toy"),
                            // Anna, in Ados
                            new QuestCompletedCondition("toys_collector"),
                            // Sally, Orril River
                            // 'completed' doesn't work for Sally - return player.hasQuest(QUEST_SLOT) && !"start".equals(player.getQuest(QUEST_SLOT)) && !"rejected".equals(player.getQuest(QUEST_SLOT));
                            new AndCondition(new QuestActiveCondition("campfire"), new QuestNotInStateCondition("campfire", "start")),
                            // Annie, Kalavan city gardens
                            new QuestStateStartsWithCondition("icecream_for_annie","eating;"),
                            // Elisabeth, Kirdneh
                            new QuestStateStartsWithCondition("chocolate_for_elisabeth","eating;"),
                            // Jef, Kirdneh
                            new QuestCompletedCondition("find_jefs_mom"),
                            // Hughie, Ados farmhouse
                            new AndCondition(new QuestActiveCondition("fishsoup_for_hughie"), new QuestNotInStateCondition("fishsoup_for_hughie", "start")))));

    // quests about finding people
    achievements.add(createAchievement("friend.quests.find", "Private Detective", "Find all lost and hidden people",
                        Achievement.HARD_BASE_SCORE, true,
                        new AndCondition(
                            // Rat Children (Agnus)
                            new QuestCompletedCondition("find_rat_kids"),
                            // Find Ghosts (Carena)
                            new QuestCompletedCondition("find_ghosts"),
                            // Meet Angels (any of the cherubs)
                            new ChatCondition() {
                              public boolean fire(final Player player, final Sentence sentence, final Entity entity) {
                                if (!player.hasQuest("seven_cherubs")) {
                                  return false;
                                }
                                final String npcDoneText = player.getQuest("seven_cherubs");
                                final String[] done = npcDoneText.split(";");
                                final int left = 7 - done.length;
                                return left < 0;
                              }
                            })));

    // earn over 250 karma
    achievements.add(createAchievement("friend.karma.250", "Good Samaritan", "Earn a very good karma",
        Achievement.MEDIUM_BASE_SCORE, true,
        new ChatCondition() {
      public boolean fire(final Player player, final Sentence sentence, final Entity entity) {
        return player.getKarma()>250;
      }
    }));

    // meet Santa Claus and Easter Bunny
    achievements.add(createAchievement("friend.meet.seasonal", "Still Believing", "Meet Santa Claus and Easter Bunny",
                        Achievement.EASY_BASE_SCORE, true, new AndCondition(new QuestWithPrefixCompletedCondition("meet_santa_"), new QuestWithPrefixCompletedCondition("meet_bunny_"))));

    return achievements;
  }
View Full Code Here

Examples of org.apache.jackrabbit.oak.query.xpath.Expression.AndCondition

        } else if (where instanceof AndCondition) {
            // conditions of type
            // @a = 1 and (@x = 1 or @y = 2)
            // are automatically converted to
            // (@a = 1 and @x = 1) union (@a = 1 and @y = 2)
            AndCondition and = (AndCondition) where;
            if (and.left instanceof OrCondition && !(and.right instanceof OrCondition)) {
                // swap left and right
                and = new AndCondition(and.right, and.left);
            }
            if (and.right instanceof OrCondition) {
                OrCondition or = (OrCondition) and.right;
                if (or.getCommonLeftPart() != null) {
                    // @x = 1 or @x = 2
                    // is automatically converted to
                    // @x in (1, 2)
                    // within the query engine               
                } else if (or.left instanceof Contains && or.right instanceof Contains) {
                    // do not optimize "contains"
                } else {
                    // same as above, but with the added "and"
                    // TODO avoid code duplication if possible
                    Statement s1 = new Statement();
                    s1.columnSelector = columnSelector;
                    s1.selectors = selectors;
                    s1.columnList = columnList;
                    s1.where = new AndCondition(and.left, or.left);
                    Statement s2 = new Statement();
                    s2.columnSelector = columnSelector;
                    s2.selectors = selectors;
                    s2.columnList = columnList;
                    s2.where = new AndCondition(and.left, or.right);
                    s2.xpathQuery = xpathQuery;
                    return new UnionStatement(s1.optimize(), s2.optimize());
                }
            }
        }
View Full Code Here

Examples of org.apache.uima.ruta.condition.AndCondition

    List<AbstractRutaCondition> conds = new ArrayList<AbstractRutaCondition>();
    AbstractRutaCondition c1 = new AfterCondition(typeExpr2);
    AbstractRutaCondition c2 = new AfterCondition(typeListExpr);
    conds.add(c1);
    conds.add(c2);
    c = new AndCondition(conds);
    s = v.verbalize(c);
    assertEquals("AND(AFTER(typeVar), AFTER({Type1, typeVar}))", s);

    // BEFORE
    c = new BeforeCondition(typeExpr1);
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.