Пример #1
0
  public boolean invoke(
      MOB mob, Vector commands, Environmental givenTarget, boolean auto, int asLevel) {
    Item myPlant = getTarget(mob, mob.location(), givenTarget, commands, Item.WORNREQ_ANY);
    if (myPlant == null) return false;

    if (isPlant(myPlant) == null) {
      mob.tell("You can't control " + myPlant.name() + ".");
      return false;
    }

    if (myPlant.rawSecretIdentity().equals(mob.Name())) {
      mob.tell("You already control " + myPlant.name() + ".");
      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,
              myPlant,
              this,
              verbalCastCode(mob, myPlant, auto),
              auto ? "" : "^S<S-NAME> chant(s) to <T-NAMESELF>!^?");
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        Ability A = isPlant(myPlant);
        if (A != null) A.setInvoker(mob);
        mob.tell(
            "You wrest control of " + myPlant.name() + " from " + myPlant.secretIdentity() + ".");
        myPlant.setSecretIdentity(mob.Name());
      }

    } else
      beneficialVisualFizzle(
          mob, myPlant, "<S-NAME> chant(s) to <T-NAMESELF>, but nothing happens.");

    // return whether it worked
    return success;
  }