Exemplo n.º 1
0
  @Test
  public void testStander() {
    Race human = new Race();
    World.getInstance().addToWorld(human);

    // have test resource file to load in a mob sheep and mob player
    // test files.
    Mob sheepMob = new Mob();
    sheepMob.setNameAndId("sheep");
    sheepMob.setAlias("sheep");
    sheepMob.setHp("500");
    sheepMob.setMv("500");
    sheepMob.setBehaviour("Stander");

    BaseBehaviour baseBehaviour = BehaviourFactory.create("Stander");
    baseBehaviour.setMob(sheepMob);
    baseBehaviour.setParameter(100);

    sheepMob.addTickable(baseBehaviour);
    WorldTime.addTickable(sheepMob);

    Room whiteRoom = new Room();
    whiteRoom.add(sheepMob);
    sheepMob.setRoom(whiteRoom);

    Mob player1Mob = TestHelper.makeDefaultPlayerMob("player1");
    whiteRoom.add(player1Mob);
    player1Mob.setRoom(whiteRoom);

    Tackle.setTackled(player1Mob, sheepMob);

    sheepMob.getMobStatus().clear();

    baseBehaviour.tick();
    baseBehaviour.tick();
    baseBehaviour.tick();

    assertEquals("sheep should be standing", MobState.STAND, sheepMob.getState());

    assertEquals("sheep should be standing", false, sheepMob.getFight().isGroundFighting());
  }
Exemplo n.º 2
0
 public void repop() {
   WorldTime.getInstance().repopulateMobs();
 }
Exemplo n.º 3
0
 public void tick() {
   WorldTime.getInstance().tickWithCombat();
 }
Exemplo n.º 4
0
 public void heartBeat() {
   WorldTime.getInstance().sendHeartBeat();
 }
Exemplo n.º 5
0
 public void combatTick() {
   WorldTime.getInstance().resolveCombat();
 }