Ejemplo n.º 1
0
  public boolean invoke(
      MOB mob, Vector commands, Environmental givenTarget, boolean auto, int asLevel) {
    MOB target = this.getTarget(mob, commands, givenTarget);
    if (target == null) return false;

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

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

    if (success) {
      // it worked, so build a copy of this ability,
      // and add it to the affects list of the
      // affected MOB.  Then tell everyone else
      // what happened.
      CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              verbalCastCode(mob, target, auto),
              auto
                  ? ""
                  : (mob == target)
                      ? "^S<S-NAME> close(s) <T-HIS-HER> eyes and peer(s) into <T-HIS-HER> own nostrils.^?"
                      : "^S<S-NAME> peer(s) into the nostrils of <T-NAMESELF>.^?");
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        Ability A = target.fetchEffect("Allergies");
        if (A == null)
          mob.tell(
              mob, target, null, "<T-NAME> seem(s) like <T-HE-SHE> is not allergic to anything.");
        else {

          Vector allergies = new Vector();
          Vector V = CMParms.parse(A.text().toUpperCase().trim());
          for (int i = 0; i < V.size(); i++) {
            if (CMParms.contains(RawMaterial.RESOURCE_DESCS, (String) V.elementAt(i)))
              allergies.addElement(((String) V.elementAt(i)).toLowerCase());
            else {
              Race R = CMClass.getRace((String) V.elementAt(i));
              if (R != null) allergies.addElement(R.name());
            }
          }
          mob.tell(
              mob,
              target,
              null,
              "<T-NAME> seem(s) like <T-HE-SHE> is allergic to " + CMParms.toStringList(V) + ".");
        }
      }
    } else if (mob == target)
      beneficialWordsFizzle(
          mob,
          target,
          auto
              ? ""
              : "<S-NAME> close(s) <T-HIS-HER> eyes and peer(s) into <T-HIS-HER> own nostrils, but then blink(s).");
    else
      beneficialWordsFizzle(
          mob,
          target,
          auto ? "" : "<S-NAME> peer(s) into the nostrils of <T-NAMESELF>, but then blink(s).");

    // return whether it worked
    return success;
  }