Examples of Sheep


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

        final RPObject object = slot.getFirst();
        slot.remove(object.getID());
        player.removeSlot("#flock");
        object.put("x", player.getX());
        object.put("y", player.getY());
        return new Sheep(object, player);
      }
    }

    return null;
  }
View Full Code Here

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

      return null;
    }
  }

  public void destroy() {
    final Sheep sheep = player.getSheep();

    if (sheep != null) {
      sheep.getZone().remove(sheep);

      /*
       * NOTE: Once the sheep is stored there is no more trace of zoneid.
       */
      playerSheepManager.storeSheep(sheep);
 
View Full Code Here

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

   
    if (action.has(SPECIES)) {
      final String species = action.get(SPECIES);

      if (species.equals(SHEEP)) {
        final Sheep sheep = player.getSheep();

        if (sheep != null) {
          player.removeSheep(sheep);

          // HACK: Avoid a problem on database
          if (sheep.has(DB_ID)) {
            sheep.remove(DB_ID);
          }
          new GameEvent(player.getName(), "leave", Integer.toString(sheep.getWeight())).raise();
        } else {
          logger.error("sheep not found in disown action: " + action.toString());
        }
      } else if (species.equals(PET)) {
        final Pet pet = player.getPet();
View Full Code Here

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

    veteran.setPosition(3, 4);
    assertTrue("has a valid target", strat.hasValidTarget(creature));
    assertEquals("attack player", veteran, creature.getAttackTarget());
   
    // Add a sheep. Pets are nice targets for killing
    final Sheep sheep = new Sheep(veteran);
    sheep.setPosition(4, 4);
    assertTrue("sanity check for enemy levels", veteran.getLevel() > sheep.getLevel());
    assertTrue("has a valid target", strat.hasValidTarget(creature));
    assertEquals("attack sheep", sheep, creature.getAttackTarget());
  }
View Full Code Here

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

    assertEquals(0.2, (new SpeakerNPC("bob")).getBaseSpeed(), 0.001);
    assertEquals(0.0, (new Creature()).getBaseSpeed(), 0.001);
    assertEquals(1.0, (PlayerTestHelper.createPlayer("player")).getBaseSpeed(),
        0.001);
    assertEquals(0.9, (new Cat()).getBaseSpeed(), 0.001);
    assertEquals(0.25, (new Sheep()).getBaseSpeed(), 0.001);

  }
View Full Code Here

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

 
  @Test
  public void startAttackingPet() {
    final Player jekyll = PlayerTestHelper.createPlayer("jekyll");
    final Player hyde = PlayerTestHelper.createPlayer("hyde");
    final Sheep sheep = new Sheep();
   
    zone.add(hyde);
    zone.add(sheep);
    // attacking wild sheep should be ok
    StendhalRPAction.startAttack(hyde, sheep);
    assertSame("Attacking a sheep in unprotected area", hyde.getAttackTarget(), sheep);
    hyde.stopAttack();
    // also if you are the owner
    sheep.setOwner(hyde);
    StendhalRPAction.startAttack(hyde, sheep);
    assertSame("Attacking a sheep in unprotected area", hyde.getAttackTarget(), sheep);
    hyde.stopAttack();
    // but attacking someone elses pet is a no-no
    sheep.setOwner(jekyll);
    StendhalRPAction.startAttack(hyde, sheep);
    assertNull("Attacking someone else's sheep", hyde.getAttackTarget());
    assertEquals("message at attacking someone else's sheep",
        "You pity jekyll's sheep too much to kill it.",
        hyde.events().get(0).get("text"));
    hyde.stopAttack();
    hyde.clearEvents();
    sheep.setOwner(null);
   
    // Protected. should fail
    protectMap();
    StendhalRPAction.startAttack(hyde, sheep);
    assertNull("Attacking a sheep in protected area ", hyde.getAttackTarget());
    assertEquals("message at attacking a sheep in protected area",
        "The powerful protective aura in this place prevents you from attacking that sheep.",
        getPrivateReply(hyde));
    hyde.stopAttack();
    hyde.clearEvents();
   
    // the same with an owned sheep
    sheep.setOwner(hyde);
    StendhalRPAction.startAttack(hyde, sheep);
    assertNull("Attacking a sheep in protected area ", hyde.getAttackTarget());
    assertEquals("message at attacking a sheep in protected area",
        "The powerful protective aura in this place prevents you from attacking hyde's sheep.",
        getPrivateReply(hyde));
    hyde.clearEvents();
   
    // ...regarless of the owner
    sheep.setOwner(jekyll);
    StendhalRPAction.startAttack(hyde, sheep);
    assertNull("Attacking a sheep in protected area ", hyde.getAttackTarget());
    assertEquals("message at attacking a sheep in protected area",
        "The powerful protective aura in this place prevents you from attacking jekyll's sheep.",
        getPrivateReply(hyde));
View Full Code Here

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

  @Override
  public boolean isZoneChangeAllowed() {
    /*
     * If we are too far from dependents, then disallow zone change
     */
    final Sheep sheep = getSheep();

    if (sheep != null) {
      if (squaredDistance(sheep) > (7 * 7)) {
        return false;
      }
View Full Code Here

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

                seller.say("You don't seem to have enough money.");
                return false;
              }
              seller.say("Here you go, a nice fluffy little sheep! Take good care of it, now...");

              final Sheep sheep = new Sheep(player);
              StendhalRPAction.placeat(seller.getZone(), sheep, seller.getX(), seller.getY() + 1);

              player.notifyWorldAboutChanges();

              return true;
View Full Code Here

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

                seller.say("You don't seem to have enough money.");
                return false;
              }
              seller.say("Here you go, a nice fluffy little sheep! Take good care of it, now...");

              final Sheep sheep = new Sheep(player);
              StendhalRPAction.placeat(seller.getZone(), sheep, seller.getX(), seller.getY() + 1);

              player.notifyWorldAboutChanges();

              return true;
View Full Code Here

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

    }

    @Override
    public int getCharge(ItemParserResult res, final Player player) {
      if (player.hasSheep()) {
        final Sheep sheep = player.getSheep();
        return getValue(res, sheep);
      } else {
        // npc's answer was moved to BuyerAdder.
        return 0;
      }
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.