Package games.stendhal.server.maps.quests.DailyMonsterQuest

Examples of games.stendhal.server.maps.quests.DailyMonsterQuest.DailyQuestAction


   * Tests for pickIdealCreature.
   */
  @Test
  public void testPickIdealCreature() {
    //final DailyMonsterQuest dmqp = new DailyMonsterQuest();
    final DailyMonsterQuest.DailyQuestAction dmqpick = new DailyQuestAction();
    CreatureTestHelper.generateRPClasses();
    assertNull("empty list", dmqpick.pickIdealCreature(-1, false, new LinkedList<Creature>()));
    final LinkedList<Creature> creatureList = new LinkedList<Creature>();
    creatureList.add(SingletonRepository.getEntityManager().getCreature("rat"));
    assertThat("1 rat in list", dmqpick.pickIdealCreature(-1, false, creatureList).getName(), is("rat"));
    assertThat("1 rat in list", dmqpick.pickIdealCreature(1000, false, creatureList).getName(), is("rat"));
    creatureList.add(SingletonRepository.getEntityManager().getCreature("balrog"));
    assertThat("rat and balrog in list", dmqpick.pickIdealCreature(-1, false, creatureList).getName(), is("rat"));

  }
View Full Code Here


   * Tests for pickIdealCreatureratLONGLIST.
   */
  @Test
  public void testPickIdealCreatureratLONGLIST() {
    //final DailyMonsterQuest dmqp = new DailyMonsterQuest();
    final DailyMonsterQuest.DailyQuestAction dmqpick = new DailyQuestAction();
    CreatureTestHelper.generateRPClasses();
    final LinkedList<Creature> creatureList = new LinkedList<Creature>();
    Creature creat;
    for (int i = 0; i < 3; i++) {
      creat = new Creature();
      creat.setLevel(i);
      creatureList.add(creat);
    }

    for (int i = 10; i < 50; i++) {
      creat = new Creature();
      creat.setLevel(i);
      creatureList.add(creat);
    }
    for (int i = 10; i < 20; i++) {
      creat = new Creature();
      creat.setLevel(i);
      creatureList.add(creat);
    }

   
    for (int i = 80; i < 100; i++) {
      creat = new Creature();
      creat.setLevel(i);
      creatureList.add(creat);
    }
    Collections.sort(creatureList, new LevelBasedComparator());
    for (int level = 0; level < 120; level++) {
      assertThat("1 rat in list", dmqpick.pickIdealCreature(level, false, creatureList).getLevel(),
          lessThanOrEqualTo(level + 5));
    }

  }
View Full Code Here

TOP

Related Classes of games.stendhal.server.maps.quests.DailyMonsterQuest.DailyQuestAction

Copyright © 2018 www.massapicom. 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.