public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {

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

    String areaName = CMParms.combine(commands, 0).trim().toUpperCase();
    Room anyRoom = null;
    Room newRoom = null;
    try {
      List<Room> rooms = CMLib.map().findRooms(CMLib.map().rooms(), mob, areaName, true, 10);
      for (Room R : rooms) {
        anyRoom = R;
        if (R.domainType() == Room.DOMAIN_INDOORS_CAVE) {
          newRoom = R;
          break;
        }
      }
    } catch (NoSuchElementException e) {
    }

    if (newRoom == null) {
      if (anyRoom == null)
        mob.tell("You don't know of a place called '" + CMParms.combine(commands, 0) + "'.");
      else if ((anyRoom.domainType() & Room.INDOORS) == 0)
        mob.tell("There IS such a place, but it is outdoors, where your fungus will not grow.");
      else if ((anyRoom.domainType() == Room.DOMAIN_INDOORS_UNDERWATER)
          || (anyRoom.domainType() == Room.DOMAIN_INDOORS_WATERSURFACE))
        mob.tell("There IS such a place, but it is on or in the water, so your magic would fail.");
      else mob.tell("There IS such a place, but it is not in a cave, 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 = Chant_SummonFungus.buildFungus(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;
  }
示例#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;
  }