Examples of Sheep


Examples of games.stendhal.server.entity.creature.Sheep

    SheepTestHelper.generateRPClasses();
    final RPAction action = new RPAction();
    final NameAction nameAction = new NameAction();
    action.put("target", "sheep");
    action.put("args", "newname");
    final Sheep pet = new Sheep();
    pet.setTitle("oldname");
    zone.add(pet);
    final Player bob = PlayerTestHelper.createPlayer("bob");
    zone.add(bob);
   
    bob.setSheep(pet);
    nameAction.onAction(bob, action);
    assertThat(bob.events().get(0).get("text"), is("You changed the name of 'oldname' to 'newname'"));
    assertThat(pet.getTitle(), is("newname"));
  }
View Full Code Here

Examples of games.stendhal.server.entity.creature.Sheep

    SheepTestHelper.generateRPClasses();
    final RPAction action = new RPAction();
    final NameAction nameAction = new NameAction();
    action.put("target", "sheep");
    action.put("args", "sheep");
    final Sheep pet = new Sheep();
    pet.setTitle("oldname");
    zone.add(pet);
    final Player bob = PlayerTestHelper.createPlayer("bob");
    zone.add(bob);
   
    bob.setSheep(pet);
    nameAction.onAction(bob, action);
    assertThat(bob.events().get(0).get("text"), is("You changed the name of 'oldname' to 'sheep'"));
    assertThat(pet.getTitle(), is("sheep"));
  }
View Full Code Here

Examples of games.stendhal.server.entity.creature.Sheep

    SheepTestHelper.generateRPClasses();
    final RPAction action = new RPAction();
    final NameAction nameAction = new NameAction();
    action.put("target", "oldname");
    action.put("args", "01234567890123456789");
    final Sheep pet = new Sheep();
    pet.setTitle("oldname");
    zone.add(pet);
    final Player bob = PlayerTestHelper.createPlayer("bob");
    zone.add(bob);
   
    bob.setSheep(pet);
    nameAction.onAction(bob, action);
    assertThat(bob.events().get(0).get("text"), is("You changed the name of 'oldname' to '01234567890123456789'"));
    assertThat(pet.getTitle(), is("01234567890123456789"));
  }
View Full Code Here

Examples of games.stendhal.server.entity.creature.Sheep

    final RPAction action = new RPAction();
    final NameAction nameAction = new NameAction();
    action.put("target", "oldname");
    action.put("args", "012345678901234567890");
   
    final Sheep pet = new Sheep();
    pet.setTitle("oldname");
    zone.add(pet);
    final Player bob = PlayerTestHelper.createPlayer("bob");
    zone.add(bob);
   
    bob.setSheep(pet);
    nameAction.onAction(bob, action);
    assertThat(bob.events().get(0).get("text"), is("The new name of your pet must not be longer than 20 characters."));
    assertThat(pet.getTitle(), is("oldname"));
  }
View Full Code Here

Examples of games.stendhal.server.entity.creature.Sheep

    SheepTestHelper.generateRPClasses();
    final RPAction action = new RPAction();
    final NameAction nameAction = new NameAction();
    action.put("target", "sheep");
    action.put("args", "   ");
    final Sheep pet = new Sheep();
    zone.add(pet);
    final Player bob = PlayerTestHelper.createPlayer("bob");
    zone.add(bob);
   
    bob.setSheep(pet);
    nameAction.onAction(bob, action);
    assertThat(bob.events().get(0).get("text"), is("Please don't use empty names."));
    assertThat(pet.getTitle(), is("sheep"));
  }
View Full Code Here

Examples of games.stendhal.server.entity.creature.Sheep

      rpentity.stop();
      rpentity.stopAttack();
      rpentity.clearPath();
    }

    Sheep sheep = null;
    Pet pet = null;

    /*
     * Remove from old zone (if any) during zone change
     */
    if (oldZone != null) {
      /*
       * Player specific pre-remove handling
       */
      if (entity instanceof Player) {
        final Player player = (Player) entity;

        /*
         * Remove and remember dependents
         */
        sheep = player.getSheep();

        if (sheep != null) {
          sheep.clearPath();
          sheep.stop();

          player.removeSheep(sheep);
        }

        pet = player.getPet();

        if (pet != null) {
          pet.clearPath();
          pet.stop();

          player.removePet(pet);
        }
      }

      if (zoneChanged) {
        oldZone.remove(entity);
      }
    }

    /*
     * [Re]position (possibly while between zones)
     */
    entity.setPosition(x, y);

    /*
     * Place in new zone (if needed)
     */
    if (zoneChanged) {
      zone.add(entity);
    }

    /*
     * Player specific post-change handling
     */
    if (entity instanceof Player) {
      final Player player = (Player) entity;

      /*
       * Move and re-add removed dependents
       */
      if (sheep != null) {
        if (placePet(zone, player, sheep)) {
          player.setSheep(sheep);
          sheep.setOwner(player);
        } else {
          // Didn't fit?
          player.sendPrivateText("You seemed to have lost your sheep while trying to squeeze in.");
        }
      }
View Full Code Here

Examples of games.stendhal.server.entity.creature.Sheep

              + type + ") at (" + x + "," + y + ") of " + getID()
              + " found");
          break;
        }
      } else if (clazz.contains("sheep.png")) {
        final Sheep sheep = new Sheep();
        sheep.setPosition(x, y);
        add(sheep);
      } else if (clazz.contains("logic/creature")) {
        // get the default EntityManager
        final EntityManager manager = SingletonRepository.getEntityManager();
View Full Code Here

Examples of games.stendhal.server.entity.creature.Sheep

        }
      } else if ("sheep".equals(type)) {
        if (player.hasSheep()) {
          error("You already own a sheep!");
        } else {
          final Sheep sheep = new Sheep(player);
          found(type, sheep);
        }
      }
      }
View Full Code Here

Examples of games.stendhal.server.entity.creature.Sheep

  }

  public static void placeSheepAndPetIntoWorld(final Player player) {
    // load sheep
    final Sheep sheep = player.getPetOwner().retrieveSheep();

    if (sheep != null) {
      logger.debug("Player has a sheep");

      if (!sheep.has("base_hp")) {
        sheep.initHP(10);
      }

      if (placeAnimalIntoWorld(sheep, player)) {
        player.setSheep(sheep);
      } else {
        logger.warn("Could not place sheep: " + sheep);
        player.sendPrivateText("You can not seem to locate your "
            + sheep.getTitle() + ".");
      }

      sheep.notifyWorldAboutChanges();
    }

    // load pet
    final Pet pet = player.getPetOwner().retrievePet();
View Full Code Here

Examples of games.stendhal.server.entity.creature.Sheep

    player.poisonToConsume.clear();
  }


  private void abondonPetsAndSheep() {
    final Sheep sheep = player.getSheep();

    if (sheep != null) {
      player.removeSheep(sheep);
    }
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.