Esempio n. 1
0
  public boolean okMessage(final Environmental myHost, final CMMsg msg) {
    if (affected == null) return super.okMessage(myHost, msg);

    if (affected instanceof MOB) {
      MOB mob = (MOB) affected;
      if ((msg.amITarget(mob))
          && (!msg.amISource(mob))
          && (mob.location() != msg.source().location())
          && (msg.tool() != null)
          && (msg.tool() instanceof Ability)
          && (CMath.bset(((Ability) msg.tool()).flags(), Ability.FLAG_SUMMONING))
          && (!mob.amDead())) {
        msg.source()
            .location()
            .showHappens(
                CMMsg.MSG_OK_VISUAL, "Magical energy fizzles and is absorbed into the air!");
        return false;
      }
    } else if (affected instanceof Room) {
      Room R = (Room) affected;
      if ((msg.tool() != null)
          && (msg.tool() instanceof Ability)
          && (CMath.bset(((Ability) msg.tool()).flags(), Ability.FLAG_SUMMONING))) {
        Ability A = (Ability) msg.tool();
        if (((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_CHANT)
            || ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_SPELL)
            || ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_PRAYER)
            || ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_SONG)) {
          if ((msg.source().location() != null) && (msg.source().location() != R))
            msg.source()
                .location()
                .showHappens(
                    CMMsg.MSG_OK_VISUAL, "Magical energy fizzles and is absorbed into the air!");
          R.showHappens(
              CMMsg.MSG_OK_VISUAL, "Magical energy fizzles and is absorbed into the air!");
        }
        return false;
      }
    }
    return super.okMessage(myHost, msg);
  }