Ejemplo n.º 1
0
  public void setTrapped(Environmental myThang, Trap theTrap, boolean isTrapped) {
    for (int a = 0; a < myThang.numEffects(); a++) {
      Ability A = myThang.fetchEffect(a);
      if ((A != null) && (A instanceof Trap)) A.unInvoke();
    }

    if ((isTrapped) && (myThang.fetchEffect(theTrap.ID()) == null)) myThang.addEffect(theTrap);
  }
Ejemplo n.º 2
0
  public boolean invoke(
      MOB mob, Vector commands, Environmental givenTarget, boolean auto, int asLevel) {
    if (type.length() == 0) return false;
    if ((mob.getClanID() == null)
        || (mob.getClanID().equalsIgnoreCase(""))
        || (mob.getClanRole() == 0)) {
      mob.tell("You aren't even a member of a clan.");
      return false;
    }
    Clan C = CMLib.clans().getClan(mob.getClanID());
    if (C == null) {
      mob.tell("You aren't even a member of a clan.");
      return false;
    }
    if (C.allowedToDoThis(mob, Clan.FUNC_CLANENCHANT) != 1) {
      mob.tell("You are not authorized to draw from the power of your " + C.typeName() + ".");
      return false;
    }
    String ClanName = C.clanID();
    String ClanType = C.typeName();

    // Invoking will be like:
    //   CAST [CLANEQSPELL] ITEM QUANTITY
    //   -2   -1            0    1
    if (commands.size() < 1) {
      mob.tell("Enchant which spell onto what?");
      return false;
    }
    if (commands.size() < 2) {
      mob.tell("Use how much clan enchantment power?");
      return false;
    }
    Environmental target =
        mob.location()
            .fetchFromMOBRoomFavorsItems(
                mob, null, (String) commands.elementAt(0), Item.WORNREQ_UNWORNONLY);
    if ((target == null) || (!CMLib.flags().canBeSeenBy(target, mob))) {
      mob.tell("You don't see '" + ((String) commands.elementAt(0)) + "' here.");
      return false;
    }
    // Add clan power check start
    int points = CMath.s_int((String) commands.elementAt(1));
    if (points <= 0) {
      mob.tell("You need to use at least 1 enchantment point.");
      return false;
    }
    long exp = points * CMProps.getIntVar(CMProps.SYSTEMI_CLANENCHCOST);
    if ((C.getExp() < exp) || (exp < 0)) {
      mob.tell(
          "You need "
              + exp
              + " to do that, but your "
              + C.typeName()
              + " has only "
              + C.getExp()
              + " experience points.");
      return false;
    }

    // Add clan power check end
    if (target.fetchEffect("Prop_ClanEquipment") != null) {
      mob.tell(target.name() + " is already clan enchanted.");
      return false;
    }

    // lose all the mana!
    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

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

    C.setExp(C.getExp() - exp);
    C.update();

    if (success) {
      CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              verbalCastCode(mob, target, auto),
              "^S<S-NAME> move(s) <S-HIS-HER> fingers around <T-NAMESELF>, encanting intensely.^?");
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        Ability A = CMClass.getAbility("Prop_ClanEquipment");
        StringBuffer str = new StringBuffer("");
        str.append(type); // Type of Enchantment
        str.append(" ");
        str.append("" + points); // Power of Enchantment
        str.append(" \"");
        str.append(ClanName); // Clan Name
        str.append("\" \"");
        str.append(ClanType); // Clan Type
        str.append("\"");
        A.setMiscText(str.toString());
        target.addEffect(A);
      }
    } else
      beneficialWordsFizzle(
          mob,
          target,
          "<S-NAME> move(s) <S-HIS-HER> fingers around <T-NAMESELF>, encanting intensely, and looking very frustrated.");
    return success;
  }