コード例 #1
0
  @Override
  public void executeMsg(final Environmental myHost, final CMMsg msg) {
    super.executeMsg(myHost, msg);
    if (!(affected instanceof MOB)) return;
    final MOB mob = (MOB) affected;

    if ((msg.amISource(mob))
        && (!CMath.bset(msg.sourceMajor(), CMMsg.MASK_CHANNEL))
        && ((CMath.bset(msg.sourceMajor(), CMMsg.MASK_MOVE))
            || (CMath.bset(msg.sourceMajor(), CMMsg.MASK_HANDS))
            || (CMath.bset(msg.sourceMajor(), CMMsg.MASK_MOUTH)))) unInvoke();
    return;
  }
コード例 #2
0
ファイル: Stone.java プロジェクト: kingdavid127/MUD
 @Override
 public boolean okMessage(final Environmental myHost, final CMMsg msg) {
   if ((myHost != null) && (myHost instanceof MOB) && (msg.amISource((MOB) myHost))) {
     if (((msg.targetMinor() == CMMsg.TYP_LEAVE)
         || (msg.sourceMinor() == CMMsg.TYP_ADVANCE)
         || (msg.sourceMinor() == CMMsg.TYP_RETREAT)
         || (msg.sourceMinor() == CMMsg.TYP_RECALL))) {
       msg.source().tell(L("You can't really go anywhere -- you're a rock!"));
       return false;
     }
   } else if (((msg.targetMajor() & CMMsg.MASK_MALICIOUS) > 0)
       && (myHost instanceof MOB)
       && (msg.amITarget(myHost))
       && (!CMath.bset(msg.sourceMajor(), CMMsg.MASK_ALWAYS))) {
     final MOB target = (MOB) msg.target();
     if ((!target.isInCombat())
         && (msg.source().isMonster())
         && (msg.source().location() == target.location())
         && (msg.source().getVictim() != target)) {
       msg.source().tell(L("Attack a rock?!"));
       if (target.getVictim() == msg.source()) {
         target.makePeace();
         target.setVictim(null);
       }
       return false;
     }
   }
   return super.okMessage(myHost, msg);
 }
コード例 #3
0
  @Override
  public boolean okMessage(final Environmental myHost, final CMMsg msg) {
    if (!(affected instanceof MOB)) return super.okMessage(myHost, msg);
    final MOB mob = (MOB) affected;

    if ((msg.amISource(mob)
        && (!msg.sourceMajor(CMMsg.MASK_ALWAYS))
        && (!CMath.bset(msg.sourceMajor(), CMMsg.MASK_CHANNEL))
        && (msg.sourceMajor() > 0))) {
      if (roundsHibernating < 10) {
        mob.tell(L("You can't withdraw from hibernation just yet."));
        return false;
      }
      unInvoke();
    }
    return super.okMessage(myHost, msg);
  }
コード例 #4
0
  public void executeMsg(Environmental myHost, CMMsg msg) {
    if ((affected == null) || (!(affected instanceof MOB))) return;

    MOB mob = (MOB) affected;

    if (msg.amISource(mob)) {

      if (((!CMath.bset(msg.sourceMajor(), CMMsg.MASK_SOUND)
              || (msg.sourceMinor() == CMMsg.TYP_SPEAK)
              || (msg.sourceMinor() == CMMsg.TYP_ENTER)
              || (msg.sourceMinor() == CMMsg.TYP_LEAVE)
              || (msg.sourceMinor() == CMMsg.TYP_RECALL)))
          && (!CMath.bset(msg.sourceMajor(), CMMsg.MASK_ALWAYS))
          && (msg.sourceMinor() != CMMsg.TYP_LOOK)
          && (msg.sourceMinor() != CMMsg.TYP_EXAMINE)
          && (msg.sourceMajor() > 0)) {
        ticksSinceLoss = 0;
        mob.recoverEnvStats();
      }
    }
    return;
  }
コード例 #5
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;
 }