Ejemplo n.º 1
0
 @Override
 public void unInvoke() {
   if ((canBeUninvoked()) && (plantsLocationR != null) && (oldMaterial >= 0))
     plantsLocationR.setResource(oldMaterial);
   super.unInvoke();
 }
Ejemplo n.º 2
0
  public boolean invoke(
      MOB mob, Vector commands, Environmental givenTarget, boolean auto, int asLevel) {

    if (commands.size() < 1) {
      mob.tell("Create overgrowth where?");
      return false;
    }

    String areaName = CMParms.combine(commands, 0).trim().toUpperCase();
    Room anyRoom = null;
    Room newRoom = null;
    try {
      Vector rooms = CMLib.map().findRooms(CMLib.map().rooms(), mob, areaName, true, 10);
      for (Enumeration r = rooms.elements(); r.hasMoreElements(); ) {
        Room R = (Room) r.nextElement();
        anyRoom = R;
        if ((R.domainType() & Room.INDOORS) == 0) {
          newRoom = R;
          break;
        }
      }
    } catch (NoSuchElementException e) {
    }

    if (newRoom == null) {
      if (anyRoom == null)
        mob.tell("You don't know of an place called '" + CMParms.combine(commands, 0) + "'.");
      else mob.tell("There IS such a place, but its not outdoors, so your magic would fail.");
      return false;
    }

    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    boolean success = proficiencyCheck(mob, 0, auto);

    if (success) {
      CMMsg msg =
          CMClass.getMsg(
              mob,
              null,
              this,
              verbalCastCode(mob, null, auto),
              "^S<S-NAME> chant(s) about a far away place.^?");
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        Item newItem = null;
        if (newRoom.domainType() == Room.DOMAIN_INDOORS_CAVE)
          newItem = Chant_SummonFungus.buildFungus(mob, newRoom);
        else if ((newRoom.domainType() == Room.DOMAIN_OUTDOORS_UNDERWATER)
            || (newRoom.domainType() == Room.DOMAIN_OUTDOORS_WATERSURFACE))
          newItem = Chant_SummonSeaweed.buildSeaweed(mob, newRoom);
        else if ((newRoom.domainType() == Room.DOMAIN_INDOORS_STONE)
            || (newRoom.domainType() == Room.DOMAIN_INDOORS_WOOD))
          newItem = Chant_SummonHouseplant.buildHouseplant(mob, newRoom);
        else newItem = Chant_SummonPlants.buildPlant(mob, newRoom);
        mob.tell("You feel a distant connection with " + newItem.name());
      }
    } else
      beneficialWordsFizzle(
          mob, null, "<S-NAME> chant(s) about a far away place, but the magic fades.");

    // return whether it worked
    return success;
  }