예제 #1
0
파일: Sneak.java 프로젝트: ivstuart/tea-mud
  /** Move without alerting others to your presence as you enter in the same room as them */
  @Override
  public void execute(Mob mob, String input) {

    Ability sneak = mob.getLearned().getAbility(SNEAK);

    if (sneak == null || sneak.isNull()) {
      mob.out("You have no knowledge of sneak");
      return;
    }

    if (mob.isSneaking()) {
      mob.out("You are already sneaking around");
    }

    if (sneak.isSuccessful(mob)) {
      mob.out(new Msg(mob, "<S-You/NAME> successfully start to sneak"));

      mob.getMobStatus().setSneaking(60); // 1 minute of sneaking around.
    }
  }
예제 #2
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());
  }