Package games.stendhal.server.entity.creature

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


     
    final int pickedIdx = (int) (Math.random() * possibleCreatures.size());
    pickedCreature = possibleCreatures.get(pickedIdx);
     
    //     create it
    final AttackableCreature creature;

    if (pickedCreature != null) {
      creature = new AttackableCreature(pickedCreature);
    } else {
      creature = null;
    }
   
    return creature;
View Full Code Here


    //Pick a corpse within the staff's range.
    for (final RPObject inspected : zone) {
      if (inspected instanceof Corpse
          && user.squaredDistance(Integer.parseInt(inspected.get("x")), Integer.parseInt(inspected.get("y"))) <= SQUARED_RANGE) {
       
        final AttackableCreature creature = pickSuitableCreature(user.getLevel());
       
        if (creature == null) {
          user.sendPrivateText("This staff does not seem to work. Maybe it has lost its unholy power.");
          return false;
        }
       
        StendhalRPAction.placeat(zone, creature, Integer.parseInt(inspected.get("x")), Integer.parseInt(inspected.get("y")));
        zone.remove(inspected);
        creature.init();
        creature.setMaster(user.getTitle());
        creature.clearDropItemList();
        creature.put("title_type", "friend");
       
        //Suck some of the summoners HP depending on the summoned creature's level.
        user.damage(HP_FACTOR * creature.getLevel(), this);
        return true;
      }

    }
   
View Full Code Here

    final CreatureRespawnPoint point = new CreatureRespawnPoint(zone, 40, 5, creature, 1);
    zone.add(point);
  }

  private void attackableAnimal(final StendhalRPZone zone, final Map<String, String> attributes) {
    Creature creature = new AttackableCreature(manager.getCreature("orc"));
    CreatureRespawnPoint point = new CreatureRespawnPoint(zone, 4, 56, creature, 1);
    point.setRespawnTime(60 * 60 * 3);
    zone.add(point);

    creature = manager.getCreature("deer");
View Full Code Here

     *  Need to use a real creature, because the
     *  creature needs to be offensive to see the
     *  targets.
     */
    final Creature creature = SingletonRepository.getEntityManager().getCreature("rat");
    final Creature scrollCreature = new AttackableCreature(SingletonRepository.getEntityManager().getCreature("rat"));
   
    Player veteran = PlayerTestHelper.createPlayer("veteran");
   
    StendhalRPZone arena = new StendhalRPZone("arena");
    arena.add(creature);
    assertFalse("is not attacking", strat.hasValidTarget(creature));
    arena.add(veteran);
    arena.add(scrollCreature);
    veteran.addXP(10000);
   
    assertTrue("sanity check for enemy levels", veteran.getLevel() > scrollCreature.getLevel());
   
    creature.setPosition(3, 3);
    scrollCreature.setPosition(2, 4);
   
    // Should pick the nearest: scrollCreature
    strat.findNewTarget(creature);
    assertTrue("has a valid target", strat.hasValidTarget(creature));
    assertEquals("attack nearest", scrollCreature, creature.getAttackTarget());
View Full Code Here

      player.sendPrivateText("This scroll does not seem to work. You should talk to the magician who created it.");
      return false;
    }

    // create it
    final AttackableCreature creature = new AttackableCreature(pickedCreature);

    // remove cowardly profiles as the creature is supposed to fight on behalf of the player
    Map<String, String> profiles = new HashMap<String, String>(creature.getAIProfiles());
    if (profiles.containsKey("coward")) {
      profiles.remove("coward");
      creature.setAIProfiles(profiles);
    }
    if (profiles.containsKey("stupid coward")) {
      profiles.remove("stupid coward");
      creature.setAIProfiles(profiles);
    }
 
    StendhalRPAction.placeat(zone, creature, x, y);

    creature.init();
    creature.setMaster(player.getTitle());
    creature.clearDropItemList();
    creature.put("title_type", "friend");

    return true;
  }
View Full Code Here

TOP

Related Classes of games.stendhal.server.entity.creature.AttackableCreature

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.