Exemplo n.º 1
0
 @Override
 public boolean okMessage(final Environmental myHost, final CMMsg msg) {
   if ((affected != null)
       && (((msg.target() instanceof Room) && (msg.targetMinor() == CMMsg.TYP_ENTER))
           || ((msg.target() instanceof Rideable) && (msg.targetMinor() == CMMsg.TYP_SIT)))
       && ((msg.amITarget(affected)) || (msg.tool() == affected) || (affected instanceof Area))
       && (!CMLib.flags().isFalling(msg.source()))) {
     final HashSet<MOB> H = new HashSet<MOB>();
     if (noFollow) H.add(msg.source());
     else {
       msg.source().getGroupMembers(H);
       int hsize = 0;
       while (hsize != H.size()) {
         hsize = H.size();
         final HashSet H2 = (HashSet) H.clone();
         for (final Iterator e = H2.iterator(); e.hasNext(); ) {
           final Object O = e.next();
           if (O instanceof MOB) ((MOB) O).getRideBuddies(H);
         }
       }
     }
     for (final Object O : H) {
       if ((!(O instanceof MOB)) || (passesMuster((MOB) O))) return super.okMessage(myHost, msg);
     }
     msg.source().tell(L("You are not allowed in there."));
     return false;
   }
   return super.okMessage(myHost, msg);
 }
Exemplo n.º 2
0
  public boolean invoke(
      MOB mob, Vector commands, Environmental givenTarget, boolean auto, int asLevel) {
    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    HashSet h = properTargets(mob, givenTarget, auto);
    if (h == null) return false;

    boolean success = proficiencyCheck(mob, 0, auto);
    boolean nothingDone = true;
    if (success) {
      for (Iterator e = h.iterator(); e.hasNext(); ) {
        MOB target = (MOB) e.next();
        // 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) | CMMsg.MASK_MALICIOUS,
                auto
                    ? ""
                    : "^S<S-NAME> "
                        + prayForWord(mob)
                        + " an unholy paralysis upon <T-NAMESELF>.^?");
        CMMsg msg2 =
            CMClass.getMsg(
                mob,
                target,
                this,
                CMMsg.MASK_MALICIOUS | CMMsg.TYP_PARALYZE | (auto ? CMMsg.MASK_ALWAYS : 0),
                null);
        if ((target != mob)
            && (mob.location().okMessage(mob, msg))
            && (mob.location().okMessage(mob, msg2))) {
          int levelDiff =
              target.envStats().level()
                  - (mob.envStats().level() + (2 * super.getXLEVELLevel(mob)));
          if (levelDiff < 0) levelDiff = 0;
          if (levelDiff > 6) levelDiff = 6;
          mob.location().send(mob, msg);
          mob.location().send(mob, msg2);
          if ((msg.value() <= 0) && (msg2.value() <= 0)) {
            success = maliciousAffect(mob, target, asLevel, 8 - levelDiff, -1);
            mob.location().show(target, null, CMMsg.MSG_OK_VISUAL, "<S-NAME> can't move!");
          }
          nothingDone = false;
        }
      }
    }

    if (nothingDone)
      return maliciousFizzle(
          mob, null, "<S-NAME> attempt(s) to paralyze everyone, but flub(s) it.");

    // return whether it worked
    return success;
  }