コード例 #1
0
  @Override
  public boolean okMessage(final Environmental myHost, final CMMsg msg) {
    if (!super.okMessage(myHost, msg)) return false;
    if (!(affected instanceof MOB)) return true;

    if ((msg.target() == affected)
        && (msg.tool() instanceof Ability)
        && (msg.source() != affected)
        && (msg.targetMinor() == CMMsg.TYP_CAST_SPELL)
        && (msg.isTarget(CMMsg.MASK_MALICIOUS))
        && (CMLib.dice().rollPercentage() > 50)
        && ((((Ability) msg.tool()).classificationCode() & Ability.ALL_DOMAINS)
            == Ability.DOMAIN_CURSING)
        && (((Ability) msg.tool()).castingQuality(msg.source(), (MOB) msg.target())
            == Ability.QUALITY_MALICIOUS)) {
      msg.source()
          .location()
          .show(
              (MOB) affected,
              msg.source(),
              CMMsg.MSG_OK_VISUAL,
              L("An curse from <T-NAME> against <S-NAME> is magically repelled."));
      return false;
    }
    return true;
  }
コード例 #2
0
 public static boolean robberyCheck(LandTitle A, CMMsg msg) {
   if (((msg.targetMinor() == CMMsg.TYP_GET) && (!msg.isTarget(CMMsg.MASK_INTERMSG)))
       || (msg.targetMinor() == CMMsg.TYP_PUSH)
       || (msg.targetMinor() == CMMsg.TYP_PULL)) {
     if ((msg.target() instanceof Item)
         && (((Item) msg.target()).owner() == msg.source().location())
         && ((!(msg.tool() instanceof Item)) || (msg.source().isMine(msg.tool())))
         && (!msg.sourceMajor(CMMsg.MASK_ALWAYS))
         && (A.getOwnerName().length() > 0)
         && (msg.source().location() != null)
         && (msg.othersMessage() != null)
         && (msg.othersMessage().length() > 0)
         && (!shopkeeperMobPresent(msg.source().location()))
         && (!CMLib.law().doesHavePriviledgesHere(msg.source(), msg.source().location()))) {
       final Room R = msg.source().location();
       final LegalBehavior B = CMLib.law().getLegalBehavior(R);
       if (B != null) {
         for (int m = 0; m < R.numInhabitants(); m++) {
           final MOB M = R.fetchInhabitant(m);
           if (CMLib.law().doesHavePriviledgesHere(M, R)) return true;
         }
         MOB D = null;
         final Clan C = CMLib.clans().getClan(A.getOwnerName());
         if (C != null) D = C.getResponsibleMember();
         else D = CMLib.players().getLoadPlayer(A.getOwnerName());
         if (D == null) return true;
         B.accuse(
             CMLib.law().getLegalObject(R),
             msg.source(),
             D,
             new String[] {"PROPERTYROB", "THIEF_ROBBERY"});
       }
     }
     return true;
   }
   return false;
 }
コード例 #3
0
  @Override
  public boolean okMessage(final Environmental myHost, final CMMsg msg) {
    if (!super.okMessage(myHost, msg)) return false;

    if ((msg.target() == affected)
        && msg.isTarget(CMMsg.MASK_MALICIOUS)
        && CMLib.flags().isAPlant(msg.source())
        && (affected instanceof MOB)
        && (pointsRemaining >= 0)) {
      final MOB mob = (MOB) affected;
      final MOB plantMOB = msg.source();
      final Room R = plantMOB.location();
      if ((R != null) && (R == mob.location())) {
        if ((msg.isSource(CMMsg.TYP_ADVANCE)) && (--pointsRemaining >= 0)) {
          R.show(
              plantMOB,
              affected,
              CMMsg.MSG_OK_ACTION,
              L("<S-NAME> struggle(s) against <T-YOUPOSS> anti-plant shell."));
          return false;
        } else if (plantMOB.getVictim() == null) {
          plantMOB.setVictim(mob);
          if (mob.getVictim() == plantMOB) {
            if (mob.rangeToTarget() > 0) plantMOB.setRangeToTarget(mob.rangeToTarget());
            else {
              plantMOB.setRangeToTarget(R.maxRange());
              mob.setRangeToTarget(R.maxRange());
            }
          } else plantMOB.setRangeToTarget(R.maxRange());
          if ((--pointsRemaining) < 0) {
            unInvoke();
            return true;
          }
          R.show(
              plantMOB,
              affected,
              CMMsg.MSG_OK_ACTION,
              L("<S-NAME> <S-IS-ARE> repelled by <T-YOUPOSS> anti-plant shell."));
          return false;
        } else if ((plantMOB.getVictim() == affected) && (plantMOB.rangeToTarget() <= 0)) {
          plantMOB.setRangeToTarget(R.maxRange());
          if (mob.getVictim() == plantMOB) mob.setRangeToTarget(R.maxRange());
          if ((--pointsRemaining) < 0) {
            unInvoke();
            return true;
          }
          R.show(
              plantMOB,
              affected,
              CMMsg.MSG_OK_ACTION,
              L("<S-NAME> <S-IS-ARE> repelled by <T-YOUPOSS> anti-plant shell."));
          return false;
        } else if ((mob.getVictim() == plantMOB) && (mob.rangeToTarget() <= 0)) {
          mob.setRangeToTarget(R.maxRange());
          if ((--pointsRemaining) < 0) {
            unInvoke();
            return true;
          }
          R.show(
              plantMOB,
              affected,
              CMMsg.MSG_OK_ACTION,
              L("<S-NAME> <S-IS-ARE> repelled by <T-YOUPOSS> anti-plant shell."));
          return false;
        }
      }
    } else if (msg.isSource(CMMsg.TYP_ADVANCE)
        && (msg.source() == affected)
        && (msg.source().getVictim() == msg.target())
        && (CMLib.flags().isAPlant((MOB) msg.target()))
        && (pointsRemaining >= 0)
        && (msg.source().rangeToTarget() == 1)) {
      final MOB plantM = msg.source().getVictim();
      if (plantM != null) {
        final Room R = plantM.location();
        if (R != null) {
          final CMMsg msg2 =
              CMClass.getMsg(
                  plantM,
                  msg.source(),
                  CMMsg.MSG_RETREAT,
                  L("<S-NAME> <S-IS-ARE> pushed back by <T-YOUPOSS> anti-plant shell."));
          if (R.okMessage(plantM, msg2)) R.send(plantM, msg2);
        }
      }
    }
    if (pointsRemaining < 0) {
      unInvoke();
      return true;
    }
    return true;
  }