Exemplo n.º 1
1
  @Override
  public boolean okMessage(final Environmental myHost, final CMMsg msg) {
    if (!(affected instanceof MOB)) return true;

    final MOB mob = (MOB) affected;

    // when this spell is on a MOBs Affected list,
    // it should consistantly prevent the mob
    // from trying to do ANYTHING except sleep
    if ((msg.amITarget(mob))
        && (CMath.bset(msg.targetMajor(), CMMsg.MASK_MALICIOUS))
        && (msg.source() == mob.amFollowing())) unInvoke();
    if ((msg.amISource(mob))
        && (CMath.bset(msg.targetMajor(), CMMsg.MASK_MALICIOUS))
        && (msg.target() == mob.amFollowing())) {
      mob.tell(L("You like @x1 too much.", mob.amFollowing().charStats().himher()));
      return false;
    } else if ((msg.amISource(mob))
        && (!mob.isMonster())
        && (msg.target() instanceof Room)
        && ((msg.targetMinor() == CMMsg.TYP_LEAVE) || (msg.sourceMinor() == CMMsg.TYP_RECALL))
        && (mob.amFollowing() != null)
        && (((Room) msg.target()).isInhabitant(mob.amFollowing()))) {
      mob.tell(L("You don't want to leave your friend."));
      return false;
    } else if ((msg.amISource(mob))
        && (mob.amFollowing() != null)
        && (msg.sourceMinor() == CMMsg.TYP_NOFOLLOW)) {
      mob.tell(L("You like @x1 too much.", mob.amFollowing().name()));
      return false;
    }

    return super.okMessage(myHost, msg);
  }
Exemplo n.º 2
0
  @Override
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    final Item I =
        getTarget(mob, mob.location(), givenTarget, commands, Wearable.FILTER_UNWORNONLY);
    if (I == null) return false;
    if (((I.material() & RawMaterial.MATERIAL_MASK) != RawMaterial.MATERIAL_VEGETATION)
        && ((I.material() & RawMaterial.MATERIAL_MASK) != RawMaterial.MATERIAL_WOODEN)) {
      mob.tell(L("Your plant knowledge can tell you nothing about @x1.", I.name(mob)));
      return false;
    }

    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;
    final boolean success = proficiencyCheck(mob, 0, auto);

    if (!success) mob.tell(L("Your plant senses fail you."));
    else {
      final CMMsg msg =
          CMClass.getMsg(mob, I, null, CMMsg.MSG_DELICATE_SMALL_HANDS_ACT | CMMsg.MASK_MAGIC, null);
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        final StringBuffer str = new StringBuffer("");
        str.append(
            L(
                "@x1 is a kind of @x2.  ",
                I.name(mob),
                RawMaterial.CODES.NAME(I.material()).toLowerCase()));
        if (isPlant(I)) str.append(L("It was summoned by @x1.", I.rawSecretIdentity()));
        else str.append(L("It is either processed by hand, or grown wild."));
        mob.tell(str.toString());
      }
    }
    return success;
  }
Exemplo n.º 3
0
  public boolean execute(MOB mob, Vector commands, int metaFlags) throws java.io.IOException {
    if ((mob == null) || (mob.playerStats() == null)) return false;

    if (commands.size() < 2) {
      String pageBreak =
          (mob.playerStats().getPageBreak() != 0)
              ? ("" + mob.playerStats().getPageBreak())
              : "Disabled";
      mob.tell(
          "Change your page break to what? Your current page break setting is: "
              + pageBreak
              + ". Enter a number larger than 0 or 'disable'.");
      return false;
    }
    String newBreak = CMParms.combine(commands, 1);
    int newVal = mob.playerStats().getWrap();
    if ((CMath.isInteger(newBreak)) && (CMath.s_int(newBreak) > 0)) newVal = CMath.s_int(newBreak);
    else if ("DISABLED".startsWith(newBreak.toUpperCase())) newVal = 0;
    else {
      mob.tell(
          "'" + newBreak + "' is not a valid setting. Enter a number larger than 0 or 'disable'.");
      return false;
    }
    mob.playerStats().setPageBreak(newVal);
    String pageBreak =
        (mob.playerStats().getPageBreak() != 0)
            ? ("" + mob.playerStats().getPageBreak())
            : "Disabled";
    mob.tell("Your new page break setting is: " + pageBreak + ".");
    return false;
  }
Exemplo n.º 4
0
 @Override
 public void executeMsg(final Environmental myHost, final CMMsg msg) {
   if ((msg.amITarget(this)
           || (msg.targetMinor() == CMMsg.TYP_ADVANCE)
           || (msg.targetMinor() == CMMsg.TYP_RETREAT))
       && (!msg.source().isMonster())
       && (msg.source().curState().getHitPoints() < msg.source().maxState().getHitPoints())
       && (CMLib.dice().rollPercentage() == 1)
       && (CMLib.dice().rollPercentage() == 1)
       && (!CMSecurity.isDisabled(CMSecurity.DisFlag.AUTODISEASE))) {
     Ability A = null;
     if (CMLib.dice().rollPercentage() > 50) A = CMClass.getAbility("Disease_Chlamydia");
     else A = CMClass.getAbility("Disease_Malaria");
     if ((A != null) && (msg.source().fetchEffect(A.ID()) == null))
       A.invoke(msg.source(), msg.source(), true, 0);
   }
   if (msg.amITarget(this) && (msg.targetMinor() == CMMsg.TYP_DRINK)) {
     final MOB mob = msg.source();
     final boolean thirsty = mob.curState().getThirst() <= 0;
     final boolean full =
         !mob.curState().adjThirst(thirstQuenched(), mob.maxState().maxThirst(mob.baseWeight()));
     if (thirsty) mob.tell(L("You are no longer thirsty."));
     else if (full) mob.tell(L("You have drunk all you can."));
     if (CMLib.dice().rollPercentage() < 10) {
       Ability A = CMClass.getAbility("Disease_Malaria");
       if ((A != null) && (msg.source().fetchEffect(A.ID()) == null))
         A.invoke(msg.source(), msg.source(), true, 0);
     }
   }
   super.executeMsg(myHost, msg);
 }
Exemplo n.º 5
0
  public void unInvoke() {
    // undo the affects of this spell
    if ((affected == null) || (!(affected instanceof MOB))) return;
    MOB mob = (MOB) affected;
    super.unInvoke();

    if ((canBeUninvoked()) && (mob.location() != null)) {
      if ((failed)
          || (!CMLib.flags().isSitting(mob))
          || (room == null)
          || (title == null)
          || (mob.location() != room)) mob.tell("You are no longer squatting.");
      else if (title.landOwner().length() > 0) {
        mob.tell(
            "Your squat has succeeded.  This property no longer belongs to "
                + title.landOwner()
                + ".");
        title.setLandOwner("");
        title.updateTitle();
        title.updateLot(null);
      } else if (title.landOwner().length() > 0) {
        mob.tell("Your squat has succeeded.  This property now belongs to you.");
        title.setLandOwner(mob.Name());
        title.updateTitle();
        title.updateLot(new XVector(mob.name()));
      }
    }
    failed = false;
  }
Exemplo n.º 6
0
  @Override
  public boolean execute(MOB mob, Vector commands, int metaFlags) throws java.io.IOException {
    if (!(CMLib.intermud().imc2online())) {
      mob.tell(L("IMC2 is unavailable."));
      return false;
    }
    commands.remove(0);
    if (commands.size() < 1) {
      IMC2Error(mob);
      return false;
    }
    final String str = (String) commands.get(0);
    if (!(CMLib.intermud().imc2online())) mob.tell(L("IMC2 is unavailable."));
    else if (str.equalsIgnoreCase("list")) CMLib.intermud().giveIMC2MudList(mob);
    else if (str.equalsIgnoreCase("locate"))
      CMLib.intermud().i3locate(mob, CMParms.combine(commands, 1));
    else if (str.equalsIgnoreCase("channels")
        && CMSecurity.isAllowed(mob, mob.location(), CMSecurity.SecFlag.IMC2))
      CMLib.intermud().giveIMC2ChannelsList(mob);
    else if (str.equalsIgnoreCase("info"))
      CMLib.intermud().imc2mudInfo(mob, CMParms.combine(commands, 1));
    else if (str.equalsIgnoreCase("restart")
        && CMSecurity.isAllowed(mob, mob.location(), CMSecurity.SecFlag.IMC2)) {
      try {
        mob.tell(CMLib.hosts().get(0).executeCommand("START IMC2"));
      } catch (final Exception e) {
        Log.errOut("IMC2Cmd", e);
      }
    } else IMC2Error(mob);

    return false;
  }
Exemplo n.º 7
0
  public boolean okMessage(Environmental myHost, CMMsg msg) {
    if (affected == null) return true;

    if (!super.okMessage(myHost, msg)) return false;

    MOB mob = msg.source();
    if (((!msg.amITarget(affected)) && (msg.tool() != affected))
        || (msg.source() == invoker())
        || (CMLib.law().doesHavePriviledgesHere(mob, msg.source().location()))
            && (text().toUpperCase().indexOf("MALICIOUS") < 0)) return true;

    switch (msg.targetMinor()) {
      case CMMsg.TYP_OPEN:
        mob.tell(affected.name() + " appears to be magically locked.");
        return false;
      case CMMsg.TYP_UNLOCK:
        mob.tell(affected.name() + " appears to be magically locked.");
        return false;
      case CMMsg.TYP_JUSTICE:
        if (!CMath.bset(msg.targetMajor(), CMMsg.MASK_DELICATE)) return true;
      case CMMsg.TYP_DELICATE_HANDS_ACT:
        mob.tell(affected.name() + " appears to be magically protected.");
        return false;
      default:
        break;
    }
    return true;
  }
Exemplo n.º 8
0
 @Override
 public void executeMsg(final Environmental myHost, final CMMsg msg) {
   super.executeMsg(myHost, msg);
   if (msg.amITarget(this) && (msg.targetMinor() == CMMsg.TYP_DRINK)) {
     final MOB mob = msg.source();
     final boolean thirsty = mob.curState().getThirst() <= 0;
     final boolean full =
         !mob.curState().adjThirst(thirstQuenched(), mob.maxState().maxThirst(mob.baseWeight()));
     if (thirsty) mob.tell(L("You are no longer thirsty."));
     else if (full) mob.tell(L("You have drunk all you can."));
   } else if ((msg.tool() == this)
       && (msg.targetMinor() == CMMsg.TYP_FILL)
       && (msg.target() instanceof Container)
       && (((Container) msg.target()).capacity() > 0)) {
     final Container container = (Container) msg.target();
     final Item I = CMClass.getItem("GenLiquidResource");
     I.setName(L("some milk"));
     I.setDisplayText(L("some milk has been left here."));
     I.setDescription(L("It looks like milk"));
     I.setMaterial(RawMaterial.RESOURCE_MILK);
     I.setBaseValue(RawMaterial.CODES.VALUE(RawMaterial.RESOURCE_MILK));
     I.basePhyStats().setWeight(1);
     CMLib.materials().addEffectsToResource(I);
     I.recoverPhyStats();
     I.setContainer(container);
     if (container.owner() != null)
       if (container.owner() instanceof MOB) ((MOB) container.owner()).addItem(I);
       else if (container.owner() instanceof Room)
         ((Room) container.owner()).addItem(I, ItemPossessor.Expire.Resource);
   }
 }
Exemplo n.º 9
0
 public boolean execute(MOB mob, Vector commands, int metaFlags) throws java.io.IOException {
   if (commands != null) commands.removeElementAt(0);
   if ((commands == null) || (commands.size() == 0)) {
     if (!CMLib.flags().isSleeping(mob)) mob.tell("You aren't sleeping!?");
     else {
       CMMsg msg =
           CMClass.getMsg(mob, null, null, CMMsg.MSG_STAND, "<S-NAME> awake(s) and stand(s) up.");
       if (mob.location().okMessage(mob, msg)) mob.location().send(mob, msg);
     }
   } else {
     String whom = CMParms.combine(commands, 0);
     MOB M = mob.location().fetchInhabitant(whom);
     if ((M == null) || (!CMLib.flags().canBeSeenBy(M, mob))) {
       mob.tell("You don't see '" + whom + "' here.");
       return false;
     }
     if (!CMLib.flags().isSleeping(M)) {
       mob.tell(M.name() + " is awake!");
       return false;
     }
     CMMsg msg =
         CMClass.getMsg(
             mob, M, null, CMMsg.MSG_NOISYMOVEMENT, "<S-NAME> attempt(s) to wake <T-NAME> up.");
     if (mob.location().okMessage(mob, msg)) {
       mob.location().send(mob, msg);
       execute(M, null, metaFlags | Command.METAFLAG_ORDER);
     }
   }
   return false;
 }
Exemplo n.º 10
0
  @Override
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    if (mob.isInCombat()) {
      mob.tell(L("You can't hibernate while in combat!"));
      return false;
    }
    if (!CMLib.flags().isSitting(mob)) {
      mob.tell(L("You must be in a sitting, restful position to hibernate."));
      return false;
    }
    // now see if it worked
    final boolean success = proficiencyCheck(mob, 0, auto);
    if (success) {
      invoker = mob;
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              null,
              this,
              CMMsg.MSG_SLEEP | CMMsg.MASK_MAGIC,
              L("<S-NAME> begin(s) to hibernate..."));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        oldState = mob.curState();
        beneficialAffect(mob, mob, asLevel, Ability.TICKS_FOREVER);
        helpProficiency(mob, 0);
      }
    } else
      return beneficialVisualFizzle(
          mob, null, L("<S-NAME> chant(s) to hibernate, but lose(s) concentration."));

    // return whether it worked
    return success;
  }
Exemplo n.º 11
0
 @Override
 public boolean execute(MOB mob, Vector commands, int metaFlags) throws java.io.IOException {
   mob.tell(L("CoffeeMud v@x1", CMProps.getVar(CMProps.Str.MUDVER)));
   mob.tell(L("(C) 2000-2015 Bo Zimmerman"));
   mob.tell(L("^<A HREF=\"mailto:[email protected]\"^>[email protected]^</A^>"));
   mob.tell(L("^<A HREF=\"http://www.coffeemud.org\"^>http://www.coffeemud.org^</A^>"));
   return false;
 }
Exemplo n.º 12
0
  @Override
  public boolean invoke(
      MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) {
    if (commands.size() < 1) {
      mob.tell(
          L(
              "You must specify an item to fence, and possibly a ShopKeeper (unless it is implied)."));
      return false;
    }

    commands.add(0, "SELL"); // will be instantly deleted by parseshopkeeper
    final Environmental shopkeeper =
        CMLib.english().parseShopkeeper(mob, commands, L("Fence what to whom?"));
    if (shopkeeper == null) return false;
    if (commands.size() == 0) {
      mob.tell(L("Fence what?"));
      return false;
    }

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

    final boolean success = proficiencyCheck(mob, 0, auto);
    if (success) {
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              shopkeeper,
              this,
              CMMsg.MSG_SPEAK,
              auto ? "" : L("<S-NAME> fence(s) stolen loot to <T-NAMESELF>."));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        invoker = mob;
        addBackMap.clear();
        mob.addEffect(this);
        mob.recoverCharStats();
        commands.add(0, CMStrings.capitalizeAndLower("SELL"));
        mob.doCommand(commands, MUDCmdProcessor.METAFLAG_FORCED);
        commands.add(shopkeeper.name());
        mob.delEffect(this);
        for (Item I : addBackMap.keySet()) {
          if (mob.isMine(I)) {
            I.addEffect(addBackMap.get(I));
          }
        }
        addBackMap.clear();
        mob.recoverCharStats();
      }
    } else
      beneficialWordsFizzle(
          mob,
          shopkeeper,
          L(
              "<S-NAME> attempt(s) to fence stolen loot to <T-NAMESELF>, but make(s) <T-HIM-HER> too nervous."));

    // return whether it worked
    return success;
  }
Exemplo n.º 13
0
  @Override
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    Item target = null;
    if ((commands.size() == 0) && (!auto) && (givenTarget == null))
      target = Prayer_Sacrifice.getBody(mob.location());
    if (target == null)
      target = getTarget(mob, mob.location(), givenTarget, commands, Wearable.FILTER_UNWORNONLY);
    if (target == null) return false;

    if ((!(target instanceof DeadBody))
        || (target.rawSecretIdentity().toUpperCase().indexOf("FAKE") >= 0)) {
      mob.tell(L("You may only desecrate the dead."));
      return false;
    }
    if ((((DeadBody) target).isPlayerCorpse())
        && (!((DeadBody) target).getMobName().equals(mob.Name()))
        && (((DeadBody) target).hasContent())) {
      mob.tell(L("You are not allowed to desecrate a players corpse."));
      return false;
    }

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

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

    if (success) {
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              verbalCastCode(mob, target, auto),
              auto
                  ? L("<T-NAME> feel(s) desecrated!")
                  : L("^S<S-NAME> desecrate(s) <T-NAMESELF> before @x1.^?", hisHerDiety(mob)));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        if (CMLib.flags().isEvil(mob)) {
          double exp = 5.0;
          final int levelLimit = CMProps.getIntVar(CMProps.Int.EXPRATE);
          final int levelDiff = (mob.phyStats().level()) - target.phyStats().level();
          if (levelDiff > levelLimit) exp = 0.0;
          if (exp > 0.0)
            CMLib.leveler()
                .postExperience(
                    mob, null, null, (int) Math.round(exp) + super.getXPCOSTLevel(mob), false);
        }
        target.destroy();
        mob.location().recoverRoomStats();
      }
    } else
      beneficialWordsFizzle(
          mob, target, L("<S-NAME> attempt(s) to desecrate <T-NAMESELF>, but fail(s)."));

    // return whether it worked
    return success;
  }
Exemplo n.º 14
0
  @Override
  public boolean invoke(
      MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) {
    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

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

    final boolean success = proficiencyCheck(mob, 0, auto);
    if (success) {
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              null,
              this,
              verbalCastCode(mob, null, auto),
              auto
                  ? ""
                  : L("^S<S-NAME> @x1 for knowledge of the lower law here.^?", prayWord(mob)));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        final Area O = CMLib.law().getLegalObject(mob.location());
        final LegalBehavior B = CMLib.law().getLegalBehavior(mob.location());
        if ((B == null) || (O == null)) mob.tell(L("No lower law is established here."));
        else {
          final Law L = B.legalInfo(O);
          final Vector<String> crimes = new Vector<String>();
          possiblyAddLaw(L, crimes, "TRESPASSING");
          possiblyAddLaw(L, crimes, "ASSAULT");
          possiblyAddLaw(L, crimes, "MURDER");
          possiblyAddLaw(L, crimes, "NUDITY");
          possiblyAddLaw(L, crimes, "ARMED");
          possiblyAddLaw(L, crimes, "RESISTINGARREST");
          possiblyAddLaw(L, crimes, "PROPERTYROB");
          for (final String key : L.abilityCrimes().keySet())
            if (key.startsWith("$")) crimes.add(key.substring(1));
          if (L.taxLaws().containsKey("TAXEVASION"))
            crimes.add(((String[]) L.taxLaws().get("TAXEVASION"))[Law.BIT_CRIMENAME]);
          for (int x = 0; x < L.bannedSubstances().size(); x++) {
            final String name = L.bannedBits().get(x)[Law.BIT_CRIMENAME];
            if (!crimes.contains(name)) crimes.add(name);
          }
          for (int x = 0; x < L.otherCrimes().size(); x++) {
            final String name = L.otherBits().get(x)[Law.BIT_CRIMENAME];
            if (!crimes.contains(name)) crimes.add(name);
          }
          mob.tell(
              L(
                  "The following lower crimes are divinely revealed to you: @x1.",
                  CMLib.english().toEnglishStringList(crimes.toArray(new String[0]))));
        }
      }
    } else
      beneficialWordsFizzle(mob, null, L("<S-NAME> @x1, but nothing is revealed.", prayWord(mob)));

    return success;
  }
Exemplo n.º 15
0
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {

    if (commands.size() < 1) {
      mob.tell("Chant to whom?");
      return false;
    }
    String mobName = CMParms.combine(commands, 0).trim().toUpperCase();
    MOB target = getTarget(mob, commands, givenTarget);

    Room newRoom = mob.location();
    if (target != null) {
      newRoom = target.location();
      if ((!CMLib.flags().isAnimalIntelligence(target)) || (target.amFollowing() != mob)) {
        mob.tell("You have no animal follower named '" + mobName + "' here.");
        return false;
      }
    } else {
      mob.tell("You have no animal follower named '" + mobName + "' here.");
      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,
              target,
              this,
              verbalCastCode(mob, target, auto),
              auto
                  ? ""
                  : "^S<S-NAME> chant(s) to <T-NAMESELF>, invoking the a mystical connection.^?");
      CMMsg msg2 = CMClass.getMsg(mob, target, this, verbalCastCode(mob, target, auto), null);
      if ((mob.location().okMessage(mob, msg))
          && ((newRoom == mob.location()) || (newRoom.okMessage(mob, msg2)))) {
        mob.location().send(mob, msg);
        if (newRoom != mob.location()) newRoom.send(target, msg2);
        spy = target;
        beneficialAffect(mob, spy, asLevel, 0);
        Ability A = spy.fetchEffect(ID());
        if (A != null) {
          mob.addNonUninvokableEffect((Ability) A.copyOf());
          A.setAffectedOne(spy);
        }
      }

    } else
      beneficialVisualFizzle(
          mob, target, "<S-NAME> chant(s) to <T-NAMESELF>, but the magic fades.");

    // return whether it worked
    return success;
  }
Exemplo n.º 16
0
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    if (mob.fetchEffect("Thief_Hide") != null) {
      mob.tell("You are already hiding.");
      return false;
    }

    if (mob.isInCombat()) {
      mob.tell("Not while in combat!");
      return false;
    }

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

    Set<MOB> H = mob.getGroupMembers(new HashSet<MOB>());
    if (!H.contains(mob)) H.add(mob);
    int numBesidesMe = 0;
    for (Iterator e = H.iterator(); e.hasNext(); ) {
      MOB M = (MOB) e.next();
      if ((M != mob) && (mob.location().isInhabitant(M))) numBesidesMe++;
    }
    if (numBesidesMe == 0) {
      mob.tell("You need a group to set up an ambush!");
      return false;
    }
    for (int i = 0; i < mob.location().numInhabitants(); i++) {
      MOB M = mob.location().fetchInhabitant(i);
      if ((M != null) && (M != mob) && (!H.contains(M)) && (CMLib.flags().canSee(M))) {
        mob.tell(M, null, null, "<S-NAME> is watching you too closely.");
        return false;
      }
    }
    boolean success = proficiencyCheck(mob, 0, auto);

    if (!success)
      beneficialVisualFizzle(mob, null, "<S-NAME> attempt(s) to set up an ambush, but fail(s).");
    else {
      CMMsg msg =
          CMClass.getMsg(
              mob,
              null,
              this,
              auto ? CMMsg.MSG_OK_ACTION : (CMMsg.MSG_DELICATE_HANDS_ACT | CMMsg.MASK_MOVE),
              "<S-NAME> set(s) up an ambush, directing everyone to hiding places.");
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        invoker = mob;
        Ability hide = CMClass.getAbility("Thief_Hide");
        for (Iterator e = H.iterator(); e.hasNext(); ) {
          MOB M = (MOB) e.next();
          hide.invoke(M, M, true, adjustedLevel(mob, asLevel));
        }
      } else success = false;
    }
    return success;
  }
Exemplo n.º 17
0
  @Override
  public boolean invoke(
      MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) {
    MOB target = CMLib.players().getLoadPlayer(CMParms.combine(commands, 0));
    if (target == null) target = getTargetAnywhere(mob, commands, givenTarget, false, true, false);
    if (target == null) return false;

    final Archon_Record A = (Archon_Record) target.fetchEffect(ID());
    if (A != null) {
      target.delEffect(A);
      if (target.playerStats() != null) target.playerStats().setLastUpdated(0);
      mob.tell(L("@x1 will no longer be recorded.", target.Name()));
      return true;
    }

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

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

    if (success) {
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              CMMsg.MASK_MOVE | CMMsg.TYP_JUSTICE | (auto ? CMMsg.MASK_ALWAYS : 0),
              L("^F<S-NAME> begin(s) recording <T-NAMESELF>.^?"));
      CMLib.color().fixSourceFightColor(msg);
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        final String filename = "/" + target.Name() + System.currentTimeMillis() + ".log";
        final CMFile file = new CMFile(filename, null, CMFile.FLAG_LOGERRORS);
        if (!file.canWrite()) {
          if (!CMSecurity.isASysOp(mob) || (CMSecurity.isASysOp(target)))
            Log.sysOut("Record", mob.Name() + " failed to start recording " + target.name() + ".");
        } else {
          if (!CMSecurity.isASysOp(mob) || (CMSecurity.isASysOp(target)))
            Log.sysOut(
                "Record",
                mob.Name() + " started recording " + target.name() + " to /" + filename + ".");
          final Archon_Record A2 = (Archon_Record) copyOf();
          final Session F = (Session) CMClass.getCommon("FakeSession");
          F.initializeSession(null, Thread.currentThread().getThreadGroup().getName(), filename);
          if (target.session() == null) target.setSession(F);
          A2.sess = F;
          target.addNonUninvokableEffect(A2);
          mob.tell(L("Enter RECORD @x1 again to stop recording.", target.Name()));
        }
      }
    } else
      return beneficialVisualFizzle(
          mob, target, L("<S-NAME> attempt(s) to hush <T-NAMESELF>, but fail(s)."));
    return success;
  }
Exemplo n.º 18
0
 public boolean qualifiesForThisClass(MOB mob, boolean quiet) {
   if (mob.baseCharStats().getStat(CharStats.STAT_WISDOM) <= 8) {
     if (!quiet) mob.tell("You need at least a 9 Wisdom to become a Shaman.");
     return false;
   }
   if (mob.baseCharStats().getStat(CharStats.STAT_CONSTITUTION) <= 8) {
     if (!quiet) mob.tell("You need at least a 9 Constitution to become a Shaman.");
     return false;
   }
   return super.qualifiesForThisClass(mob, quiet);
 }
Exemplo n.º 19
0
  @Override
  public boolean invoke(
      MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) {
    if (!mob.isInCombat()) {
      mob.tell(L("You must be in combat to do this!"));
      return false;
    }
    final MOB victim = super.getTarget(mob, commands, givenTarget);
    if (victim == null) return false;
    if (((victim == mob.getVictim()) && (mob.rangeToTarget() > 0))
        || ((victim.getVictim() == mob) && (victim.rangeToTarget() > 0))) {
      mob.tell(L("You are too far away to disarm!"));
      return false;
    }
    if (mob.fetchWieldedItem() == null) {
      mob.tell(L("You need a weapon to disarm someone!"));
      return false;
    }
    Item hisWeapon = victim.fetchWieldedItem();
    if (hisWeapon == null) hisWeapon = victim.fetchHeldItem();
    if ((hisWeapon == null)
        || (!(hisWeapon instanceof Weapon))
        || ((((Weapon) hisWeapon).weaponClassification() == Weapon.CLASS_NATURAL))) {
      mob.tell(L("@x1 is not wielding a weapon!", victim.charStats().HeShe()));
      return false;
    }

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

    int levelDiff =
        victim.phyStats().level() - (mob.phyStats().level() + (2 * getXLEVELLevel(mob)));
    if (levelDiff > 0) levelDiff = levelDiff * 5;
    else levelDiff = 0;
    final boolean hit = (auto) || CMLib.combat().rollToHit(mob, victim);
    final boolean success = proficiencyCheck(mob, -levelDiff, auto) && (hit);
    if ((success)
        && ((hisWeapon.fitsOn(Wearable.WORN_WIELD))
            || hisWeapon.fitsOn(Wearable.WORN_WIELD | Wearable.WORN_HELD))) {
      if (mob.location().show(mob, victim, this, CMMsg.MSG_NOISYMOVEMENT, null)) {
        final CMMsg msg = CMClass.getMsg(victim, hisWeapon, null, CMMsg.MSG_DROP, null);
        if (mob.location().okMessage(mob, msg)) {
          mob.location().send(victim, msg);
          mob.location()
              .show(
                  mob,
                  victim,
                  CMMsg.MSG_NOISYMOVEMENT,
                  auto ? L("<T-NAME> is disarmed!") : L("<S-NAME> disarm(s) <T-NAMESELF>!"));
        }
      }
    } else
      maliciousFizzle(mob, victim, L("<S-NAME> attempt(s) to disarm <T-NAMESELF> and fail(s)!"));
    return success;
  }
Exemplo n.º 20
0
  @Override
  public boolean invoke(
      MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) {
    final Item target = getTarget(mob, null, givenTarget, commands, Wearable.FILTER_UNWORNONLY);
    if (target == null) return false;
    if (!(target instanceof Armor)) {
      mob.tell(L("@x1 cannot be refitted.", target.name(mob)));
      return false;
    }

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

    final boolean success =
        proficiencyCheck(
            mob,
            (((mob.phyStats().level() + (2 * getXLEVELLevel(mob))) - target.phyStats().level())
                * 5),
            auto);

    if (success) {
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              verbalCastCode(mob, target, auto),
              (auto ? "<T-NAME> begins to shimmer!" : "^S<S-NAME> incant(s) at <T-NAMESELF>!^?"));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);

        if (target.phyStats().height() == 0)
          mob.tell(L("Nothing happens to @x1.", target.name(mob)));
        else {
          mob.location()
              .show(
                  mob,
                  target,
                  CMMsg.MSG_OK_VISUAL,
                  L("<T-NAME> begin(s) to magically resize itself!"));
          target.basePhyStats().setHeight(0);
        }
        target.recoverPhyStats();
        mob.location().recoverRoomStats();
      }

    } else
      beneficialWordsFizzle(
          mob, target, L("<S-NAME> incant(s) at <T-NAMESELF>, but nothing happens."));

    // return whether it worked
    return success;
  }
Exemplo n.º 21
0
  public boolean invoke(
      MOB mob, Vector commands, Environmental givenTarget, boolean auto, int asLevel) {
    Item target = super.getTarget(mob, mob.location(), givenTarget, commands, Wearable.FILTER_ANY);
    if (target == null) return false;

    if ((!(target instanceof Ammunition))
        || (!((Ammunition) target).ammunitionType().equalsIgnoreCase("arrows"))) {
      mob.tell(mob, target, null, "You can't enchant <T-NAME> ith an Enchant Arrows spell!");
      return false;
    }

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

    int experienceToLose = getXPCOSTAdjustment(mob, 5);
    CMLib.leveler().postExperience(mob, null, null, -experienceToLose, false);

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

    if (success) {
      CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              verbalCastCode(mob, target, auto),
              auto ? "" : "^S<S-NAME> hold(s) <T-NAMESELF> and cast(s) a spell.^?");
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        Ability A = target.fetchEffect(ID());
        if ((A != null) && (CMath.s_int(A.text()) > 2))
          mob.tell("You are not able to enchant " + target.name() + " further.");
        else {
          mob.location().show(mob, target, CMMsg.MSG_OK_VISUAL, "<T-NAME> glows!");
          if (A == null) {
            A = (Ability) copyOf();
            target.addNonUninvokableEffect(A);
          }
          A.setMiscText("" + (CMath.s_int(A.text()) + 1));
          target.recoverEnvStats();
          mob.recoverEnvStats();
        }
      }

    } else
      beneficialWordsFizzle(
          mob,
          target,
          "<S-NAME> hold(s) <T-NAMESELF> tightly and whisper(s), but fail(s) to cast a spell.");

    // return whether it worked
    return success;
  }
Exemplo n.º 22
0
  @Override
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    final MOB target = getTarget(mob, commands, givenTarget);
    if (target == null) return false;
    Item myPlant = Druid_MyPlants.myPlant(mob.location(), mob, 0);
    if (myPlant == null) {
      if (auto) myPlant = new Chant_SummonPlants().buildPlant(mob, mob.location());
      else {
        mob.tell(L("There doesn't appear to be any of your plants here to choke with."));
        return false;
      }
    }

    if (target.getWearPositions(Wearable.WORN_NECK) == 0) {
      if (!auto) mob.tell(L("Ummm, @x1 doesn't HAVE a neck...", target.name(mob)));
      return false;
    }

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

    final boolean success = proficiencyCheck(mob, 0, auto);
    if (success) {

      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              verbalCastCode(mob, target, auto),
              auto
                  ? ""
                  : L("^S<S-NAME> chant(s) at <T-NAME> while pointing at @x1!^?", myPlant.name()));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        target.moveItemTo(myPlant);
        myPlant.setRawWornCode(Wearable.WORN_NECK);
        mob.location()
            .show(
                target,
                null,
                CMMsg.MSG_OK_VISUAL,
                L("@x1 jumps up and wraps itself around <S-YOUPOSS> neck!", myPlant.name()));
        beneficialAffect(mob, myPlant, asLevel, 5);
      }
    } else
      return maliciousFizzle(
          mob, target, L("<S-NAME> chant(s) at <T-NAME>, but the magic fizzles."));

    // return whether it worked
    return success;
  }
Exemplo n.º 23
0
 public boolean execute(MOB mob, Vector commands, int metaFlags) throws java.io.IOException {
   if (!mob.isMonster()) {
     if ((CMath.bset(mob.getBitmap(), MOB.ATT_MXP))
         || (mob.session().clientTelnetMode(Session.TELNET_MXP))) {
       if (mob.session().clientTelnetMode(Session.TELNET_MXP))
         mob.session().rawOut("\033[3z \033[7z");
       mob.setBitmap(CMath.unsetb(mob.getBitmap(), MOB.ATT_MXP));
       mob.session().changeTelnetMode(Session.TELNET_MXP, false);
       mob.session().setClientTelnetMode(Session.TELNET_MXP, false);
       mob.tell("MXP codes are disabled.\n\r");
     } else mob.tell("MXP codes are already disabled.\n\r");
   }
   return false;
 }
Exemplo n.º 24
0
  @Override
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    String cmd = "";
    if (commands.size() > 0) cmd = ((String) commands.firstElement()).toUpperCase();

    if ((commands.size() < 2) || ((!cmd.equals("BUY") && (!cmd.equals("SELL"))))) {
      mob.tell(
          L(
              "You must specify BUY, SELL, an item, and possibly a ShopKeeper (unless it is implied)."));
      return false;
    }

    final Environmental shopkeeper =
        CMLib.english()
            .parseShopkeeper(mob, commands, CMStrings.capitalizeAndLower(cmd) + " what to whom?");
    if (shopkeeper == null) return false;
    if (commands.size() == 0) {
      mob.tell(L("@x1 what?", CMStrings.capitalizeAndLower(cmd)));
      return false;
    }

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

    final boolean success = proficiencyCheck(mob, 0, auto);
    if (success) {
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              shopkeeper,
              this,
              CMMsg.MSG_SPEAK,
              auto ? "" : L("<S-NAME> haggle(s) with <T-NAMESELF>."));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        invoker = mob;
        mob.addEffect(this);
        mob.recoverCharStats();
        commands.insertElementAt(CMStrings.capitalizeAndLower(cmd), 0);
        mob.doCommand(commands, Command.METAFLAG_FORCED);
        commands.addElement(shopkeeper.name());
        mob.delEffect(this);
        mob.recoverCharStats();
      }
    } else
      beneficialWordsFizzle(
          mob, shopkeeper, L("<S-NAME> haggle(s) with <T-NAMESELF>, but <S-IS-ARE> unconvincing."));

    // return whether it worked
    return success;
  }
Exemplo n.º 25
0
  @Override
  public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) {
    final Item target = getTarget(mob, null, givenTarget, commands, Wearable.FILTER_ANY);
    if (target == null) return false;

    if (!(target instanceof Scroll)) {
      mob.tell(L("You can't clarify that."));
      return false;
    }

    if (((Scroll) target).usesRemaining() > ((Scroll) target).getSpells().size()) {
      mob.tell(L("That scroll can not be enhanced any further."));
      return false;
    }

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

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

    if (success) {
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              target,
              this,
              somanticCastCode(mob, target, auto),
              auto
                  ? ""
                  : L(
                      "^S<S-NAME> wave(s) <S-HIS-HER> fingers at <T-NAMESELF>, uttering a magical phrase.^?"));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        mob.location()
            .show(
                mob, target, CMMsg.MSG_OK_VISUAL, L("The words on <T-NAME> become more definite!"));
        ((Scroll) target).setUsesRemaining(((Scroll) target).usesRemaining() + 1);
      }

    } else
      beneficialVisualFizzle(
          mob,
          target,
          L(
              "<S-NAME> wave(s) <S-HIS-HER> fingers at <T-NAMESELF>, uttering a magical phrase, and looking very frustrated."));

    // return whether it worked
    return success;
  }
Exemplo n.º 26
0
  @Override
  public boolean invoke(
      MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) {
    MOB target = mob;
    if ((auto) && (givenTarget != null) && (givenTarget instanceof MOB)) target = (MOB) givenTarget;
    if (target.fetchEffect(this.ID()) != null) {
      mob.tell(target, null, null, L("<S-NAME> <S-IS-ARE> already observing."));
      return false;
    }

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

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

    final CMMsg msg =
        CMClass.getMsg(
            mob,
            target,
            this,
            auto ? CMMsg.MSG_OK_ACTION : (CMMsg.MSG_DELICATE_HANDS_ACT | CMMsg.MASK_EYES),
            auto
                ? L("<T-NAME> become(s) observant.")
                : L(
                    "<S-NAME> open(s) <S-HIS-HER> eyes and observe(s) <S-HIS-HER> surroundings carefully."));
    if (!success)
      return beneficialVisualFizzle(
          mob, null, L("<S-NAME> look(s) around carefully, but become(s) distracted."));
    else if (mob.location().okMessage(mob, msg)) {
      mob.location().send(mob, msg);
      beneficialAffect(mob, target, asLevel, 0);
    }
    return success;
  }
Exemplo n.º 27
0
 protected static boolean reportError(
     final Electronics me,
     final Software controlI,
     final MOB mob,
     final String literalMessage,
     final String controlMessage) {
   if ((mob != null)
       && (mob.location() == CMLib.map().roomLocation(me))
       && (literalMessage != null)) mob.tell(literalMessage);
   if (controlMessage != null) {
     if (controlI != null) controlI.addScreenMessage(controlMessage);
     else if ((mob != null) && (me != null))
       mob.tell(CMLib.lang().L("A panel on @x1 reports '@x2'.", me.name(mob), controlMessage));
   }
   return false;
 }
Exemplo n.º 28
0
 public boolean processFollow(MOB mob, MOB tofollow, boolean quiet) {
   if (mob == null) return false;
   Room R = mob.location();
   if (R == null) return false;
   if (tofollow != null) {
     if (tofollow == mob) {
       return nofollow(mob, true, false);
     }
     if (mob.getGroupMembers(new HashSet<MOB>()).contains(tofollow)) {
       if (!quiet) mob.tell("You are already a member of " + tofollow.name() + "'s group!");
       return false;
     }
     if (nofollow(mob, false, false)) {
       CMMsg msg =
           CMClass.getMsg(
               mob,
               tofollow,
               null,
               CMMsg.MSG_FOLLOW,
               quiet ? null : "<S-NAME> follow(s) <T-NAMESELF>.");
       if (R.okMessage(mob, msg)) R.send(mob, msg);
       else return false;
     } else return false;
   } else return nofollow(mob, !quiet, quiet);
   return true;
 }
Exemplo n.º 29
0
 public static void doAnimalFollowerLevelingCheck(CharClass C, Environmental host, CMMsg msg) {
   if ((msg.sourceMessage() == null)
       && (msg.sourceMinor() == CMMsg.TYP_LEVEL)
       && (msg.source().isMonster())) {
     final MOB druidM = msg.source().amUltimatelyFollowing();
     if ((druidM != null)
         && (!druidM.isMonster())
         && (druidM.charStats().getCurrentClass().ID().equals(C.ID()))
         && (CMLib.flags().isAnimalIntelligence(msg.source())
             || msg.source()
                 .charStats()
                 .getMyRace()
                 .racialCategory()
                 .equalsIgnoreCase("Vegetation")
             || msg.source()
                 .charStats()
                 .getMyRace()
                 .racialCategory()
                 .equalsIgnoreCase("Stone Golem"))) {
       final int xp = msg.source().phyStats().level() * 5;
       if (xp > 0) {
         druidM.tell(
             CMLib.lang().L("Your stewardship has benefitted @x1.", msg.source().name(druidM)));
         CMLib.leveler().postExperience(druidM, null, null, xp, false);
       }
     }
   }
 }
Exemplo n.º 30
0
  public boolean rightPlace(MOB mob, boolean auto) {
    if ((!auto) && (mob.location().domainType() & Room.INDOORS) > 0) {
      mob.tell("You must be outdoors for this chant to work.");
      return false;
    }

    if ((mob.location().domainType() == Room.DOMAIN_OUTDOORS_CITY)
        || (mob.location().domainType() == Room.DOMAIN_OUTDOORS_SPACEPORT)
        || (mob.location().domainType() == Room.DOMAIN_OUTDOORS_UNDERWATER)
        || (mob.location().domainType() == Room.DOMAIN_OUTDOORS_AIR)
        || (mob.location().domainType() == Room.DOMAIN_OUTDOORS_WATERSURFACE)) {
      mob.tell("This magic will not work here.");
      return false;
    }
    return true;
  }