Package games.stendhal.server.core.rule

Examples of games.stendhal.server.core.rule.EntityManager


  public void configureZone(final StendhalRPZone zone, final Map<String, String> attributes) {
    buildFifthFloor(zone, attributes);
  }

  private void buildFifthFloor(final StendhalRPZone zone, final Map<String, String> attributes) {
    final EntityManager manager = SingletonRepository.getEntityManager();

    final Creature creature = manager.getCreature("stone golem");
    final Creature creature1 = manager.getCreature("wooden golem");
    final Creature creature2 = manager.getCreature("nymph");
    final Creature creature3 = manager.getCreature("earth elemental");

    creature.setAIProfiles(new HashMap<String, String>());
    creature1.setAIProfiles(new HashMap<String, String>());
    creature2.setAIProfiles(new HashMap<String, String>());
    creature3.setAIProfiles(new HashMap<String, String>());
View Full Code Here


  public void configureZone(final StendhalRPZone zone, final Map<String, String> attributes) {
    buildSecondFloor(zone, attributes);
  }

  private void buildSecondFloor(final StendhalRPZone zone, final Map<String, String> attributes) {
    final EntityManager manager = SingletonRepository.getEntityManager();

    final Creature creature = manager.getCreature("air elemental");
    final Creature creature1 = manager.getCreature("madaram windwalker");
    final Creature creature2 = manager.getCreature("djinn");
    final Creature creature3 = manager.getCreature("invisible man");

    creature1.setName("cloudwalker");
    creature2.setName("djinn windmaster");
    creature3.setName("incorporeal man");
View Full Code Here

public class SadScientsBrother implements ZoneConfigurator {

  public void configureZone(StendhalRPZone zone,
      Map<String, String> attributes) {
    final EntityManager manager = SingletonRepository.getEntityManager();
    final Creature creature = new ItemGuardCreature(manager.getCreature("imperial scientist"), "goblet", "sad_scientist", "kill_scientist", 0);
    creature.setName("Sergej Elos");
    final CreatureRespawnPoint point = new CreatureRespawnPoint(zone, 43, 85, creature, 1);
    zone.add(point);
  }
View Full Code Here

   * function returns list of blordrough creatures.
   * @return - list of blordrough creatures
   */
  protected LinkedList<Creature> getBlordroughs() {
    LinkedList<Creature> blordroughs = new LinkedList<Creature>();
    final EntityManager manager = SingletonRepository.getEntityManager();
    for (int i=0; i<Blordroughs.size(); i++) {
      Creature creature = manager.getCreature(Blordroughs.get(i));
      if (!creature.isRare()) {
        blordroughs.add(creature);
      }
    }
    return(blordroughs);
View Full Code Here

   * Iterate through each zone and select the min and max rat count based on zone size
   * Places rat if possible, if not skip this rat (so if 6 rats chosen perhaps only 3 are placed)
   */
  private void summonRats() {

    final EntityManager manager = SingletonRepository.getEntityManager();
    final RatsObserver ratsObserver = new RatsObserver();

    // generating rats in zones
    for(int j=0; j<(RAT_ZONES.size()); j++) {
      final StendhalRPZone zone = (StendhalRPZone) SingletonRepository.getRPWorld().getRPZone(
          RAT_ZONES.get(j));
      final int maxRats = (int) Math.round(Math.sqrt(zone.getWidth()*zone.getHeight())/4);
      final int minRats = (int) Math.round(Math.sqrt(zone.getWidth()*zone.getHeight())/12);
      final int ratsCount = Rand.rand(maxRats-minRats)+minRats;
      logger.debug(ratsCount+ " rats selected at " + zone.getName());
      for(int i=0 ; i<ratsCount; i++) {
        final int x=Rand.rand(zone.getWidth());
        final int y=Rand.rand(zone.getHeight());
        // Gaussian distribution
        int tc=Rand.randGaussian(0,RAT_TYPES.size());
        if ((tc>(RAT_TYPES.size()-1)) || (tc<0)) {
          tc=0;
        }
        // checking if EntityManager knows about this creature type.
        final Creature tempCreature = new Creature((Creature) manager.getEntity(RAT_TYPES.get(tc)));
        final Creature rat = new Creature(tempCreature.getNewInstance());

        // chosen place is occupied
        if (zone.collides(rat,x,y)) {
          // Could not place the creature here.
View Full Code Here

TOP

Related Classes of games.stendhal.server.core.rule.EntityManager

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.