Ejemplo 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);
  }
Ejemplo n.º 2
0
 @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);
 }
Ejemplo n.º 3
0
 @Override
 public void executeMsg(final Environmental myHost, final CMMsg msg) {
   super.executeMsg(myHost, msg);
   if (((msg.sourceMinor() == CMMsg.TYP_SHUTDOWN)
           || ((msg.targetMinor() == CMMsg.TYP_EXPIRE) && (msg.target() == affected))
           || (msg.sourceMinor() == CMMsg.TYP_ROOMRESET))
       && (affected instanceof Room)) {
     updateLot(null);
     final Vector mobs = new Vector();
     Room R = (Room) affected;
     if (R != null) {
       synchronized (("SYNC" + R.roomID()).intern()) {
         R = CMLib.map().getRoom(R);
         for (int m = 0; m < R.numInhabitants(); m++) {
           final MOB M = R.fetchInhabitant(m);
           if ((M != null)
               && (M.isSavable())
               && (M.getStartRoom() == R)
               && ((M.basePhyStats().rejuv() == 0)
                   || (M.basePhyStats().rejuv() == PhyStats.NO_REJUV))) {
             CMLib.catalog().updateCatalogIntegrity(M);
             mobs.addElement(M);
           }
         }
         if (!CMSecurity.isSaveFlag(CMSecurity.SaveFlag.NOPROPERTYMOBS))
           CMLib.database().DBUpdateTheseMOBs(R, mobs);
       }
     }
   }
 }
Ejemplo n.º 4
0
 public boolean okMessage(Environmental myHost, CMMsg msg) {
   if (!super.okMessage(myHost, msg)) return false;
   if (affected == null) return true;
   MOB mob = (MOB) affected;
   if ((msg.amISource(mob))
       && (mob.location() != null)
       && (msg.target() != null)
       && (msg.target() instanceof Room)) {
     if ((msg.sourceMinor() == CMMsg.TYP_ENTER)
         && ((mob.location().domainType() == Room.DOMAIN_OUTDOORS_WATERSURFACE)
             || (mob.location().domainType() == Room.DOMAIN_INDOORS_WATERSURFACE))
         && (msg.target() == mob.location().getRoomInDir(Directions.UP))) {
       msg.source()
           .tell("Your water walking magic prevents you from ascending from the water surface.");
       return false;
     } else if ((msg.sourceMinor() == CMMsg.TYP_LEAVE)
         && (mob.location().domainType() != Room.DOMAIN_OUTDOORS_WATERSURFACE)
         && (mob.location().domainType() != Room.DOMAIN_INDOORS_WATERSURFACE)
         && (msg.tool() != null)
         && (msg.tool() instanceof Exit)) {
       for (int d = Directions.NUM_DIRECTIONS() - 1; d >= 0; d--) {
         Room R = mob.location().getRoomInDir(d);
         if ((R != null)
             && (mob.location().getReverseExit(d) == msg.tool())
             && ((R.domainType() == Room.DOMAIN_OUTDOORS_WATERSURFACE)
                 || (R.domainType() == Room.DOMAIN_INDOORS_WATERSURFACE))) {
           triggerNow = true;
           msg.source().recoverEnvStats();
           return true;
         }
       }
     }
   }
   return true;
 }
Ejemplo n.º 5
0
 @Override
 public boolean okMessage(final Environmental myHost, final CMMsg msg) {
   if ((affected instanceof MOB)
       && (msg.amISource((MOB) affected))
       && (msg.sourceMinor() == CMMsg.TYP_QUIT)) unInvoke();
   else if (msg.sourceMinor() == CMMsg.TYP_SHUTDOWN) unInvoke();
   return super.okMessage(myHost, msg);
 }
Ejemplo n.º 6
0
  @Override
  public boolean okMessage(final Environmental myHost, final CMMsg msg) {
    if (!(affected instanceof MOB)) return true;

    final MOB mob = (MOB) affected;
    if (msg.amISource(mob)
        && ((msg.sourceMinor() == CMMsg.TYP_SIT) || (msg.sourceMinor() == CMMsg.TYP_SLEEP))) {
      mob.tell(L("You're too caffeinated for that!"));
      return false;
    }
    return true;
  }
Ejemplo n.º 7
0
 @Override
 public void executeMsg(final Environmental myHost, final CMMsg msg) {
   if ((whom != null)
       && (song == null)
       && (msg.amISource(whom))
       && (CMLib.flags().canBeSeenBy(whom, invoker()))) {
     if (trail == null) trail = new StringBuffer("");
     ensureCmds();
     if (cmds.containsKey("" + msg.sourceMinor())) trail.append(msg.sourceMinor() + ";");
   }
   super.executeMsg(myHost, msg);
 }
Ejemplo n.º 8
0
 public void executeMsg(Environmental host, CMMsg msg) {
   if ((affected instanceof Armor) && (msg.source() == ((Armor) affected).owner())) {
     if ((msg.targetMinor() == CMMsg.TYP_REMOVE)
         || (msg.sourceMinor() == CMMsg.TYP_WEAR)
         || (msg.sourceMinor() == CMMsg.TYP_WIELD)
         || (msg.sourceMinor() == CMMsg.TYP_HOLD)
         || (msg.sourceMinor() == CMMsg.TYP_DROP)) checked = false;
     else {
       check(msg.source(), (Armor) affected);
       super.executeMsg(host, msg);
     }
   } else super.executeMsg(host, msg);
 }
Ejemplo n.º 9
0
  public void executeMsg(final Environmental myHost, final CMMsg msg) {
    super.executeMsg(myHost, msg);
    if ((affected != null)
        && (affected instanceof Room)
        && (invoker() != null)
        && (invoker().location() != null)
        && (sourceRoom != null)
        && (!invoker().isInCombat())
        && (invoker().location() == sourceRoom)) {
      if (invoker().location() == room) {
        if ((msg.sourceMinor() == CMMsg.TYP_SPEAK)
            && (msg.othersCode() == CMMsg.NO_EFFECT)
            && (msg.othersMessage() == null)
            && (msg.sourceMessage() != null)
            && (!msg.amISource(invoker()))
            && (!msg.amITarget(invoker()))
            && (!lastSaid.equals(msg.sourceMessage()))) {
          lastSaid = msg.sourceMessage();
          if ((invoker().phyStats().level() + (getXLEVELLevel(invoker()) * 10))
              > msg.source().phyStats().level())
            invoker().tell(msg.source(), msg.target(), msg.tool(), msg.sourceMessage());
          else
            invoker()
                .tell(
                    msg.source(),
                    null,
                    null,
                    "<S-NAME> said something, but you couldn't quite make it out.");
        }
      } else if ((msg.sourceMinor() == CMMsg.TYP_SPEAK)
          && (msg.othersMinor() == CMMsg.TYP_SPEAK)
          && (msg.othersMessage() != null)
          && (msg.sourceMessage() != null)
          && (!lastSaid.equals(msg.sourceMessage()))) {
        lastSaid = msg.sourceMessage();
        if ((invoker().phyStats().level() + (getXLEVELLevel(invoker()) * 10))
            > msg.source().phyStats().level())
          invoker().tell(msg.source(), msg.target(), msg.tool(), msg.sourceMessage());
        else
          invoker()
              .tell(
                  msg.source(),
                  null,
                  null,
                  "<S-NAME> said something, but you couldn't quite make it out.");
      }

    } else unInvoke();
  }
Ejemplo n.º 10
0
 @Override
 public void executeMsg(Environmental host, CMMsg msg) {
   super.executeMsg(host, msg);
   if ((msg.sourceMinor() == CMMsg.TYP_DEATH)
       && (msg.source() != host)
       && (msg.source().location() != CMLib.map().roomLocation(host))) DoneEquipping = false;
 }
Ejemplo n.º 11
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);
       }
     }
   }
 }
Ejemplo n.º 12
0
 @Override
 public void executeMsg(final Environmental myHost, final CMMsg msg) {
   super.executeMsg(myHost, msg);
   if ((reRollFlag)
       && (affected instanceof MOB)
       && (msg.sourceMinor() == CMMsg.TYP_LOOK)
       && (msg.source() == affected)) {
     final MOB M = msg.source();
     if ((M.session() != null) && (M.playerStats() != null)) {
       final Ability me = this;
       CMLib.threads()
           .executeRunnable(
               new Runnable() {
                 @Override
                 public void run() {
                   try {
                     CMLib.login()
                         .promptBaseCharStats(
                             M.playerStats().getTheme(), M, 300, M.session(), bonusPointsPerStat);
                     M.recoverCharStats();
                     if (rePickClass)
                       M.baseCharStats()
                           .setCurrentClass(
                               CMLib.login()
                                   .promptCharClass(M.playerStats().getTheme(), M, M.session()));
                     M.recoverCharStats();
                     M.delEffect(me);
                     M.baseCharStats().getCurrentClass().grantAbilities(M, false);
                   } catch (final IOException e) {
                   }
                 }
               });
     }
   }
 }
Ejemplo n.º 13
0
  public boolean okMessage(Environmental myHost, CMMsg msg) {
    if (!(myHost instanceof MOB)) return super.okMessage(myHost, msg);
    MOB myChar = (MOB) myHost;
    if (!super.okMessage(myChar, msg)) return false;

    if ((msg.amITarget(myChar))
        && (msg.targetMinor() == CMMsg.TYP_DAMAGE)
        && (msg.sourceMinor() == CMMsg.TYP_ACID)) {
      int recovery = myChar.charStats().getClassLevel(this);
      msg.setValue(msg.value() - recovery);
    } else if ((msg.amITarget(myChar))
        && (msg.targetMinor() == CMMsg.TYP_DAMAGE)
        && (msg.sourceMinor() == CMMsg.TYP_ELECTRIC)) {
      int recovery = msg.value();
      msg.setValue(msg.value() + recovery);
    }
    return true;
  }
Ejemplo n.º 14
0
 @Override
 public boolean okMessage(Environmental host, CMMsg msg) {
   if (!super.okMessage(host, msg)) return false;
   if ((msg.tool() == affected) && (msg.sourceMinor() == CMMsg.TYP_SELL)) {
     unInvoke();
     if (affected != null) affected.delEffect(this);
   }
   return true;
 }
Ejemplo n.º 15
0
 @Override
 public void executeMsg(Environmental host, CMMsg msg) {
   if ((affected instanceof Room) || (affected instanceof Area)) {
     if ((msg.targetMinor() == CMMsg.TYP_LEAVE) || (msg.sourceMinor() == CMMsg.TYP_RECALL))
       removeMyAffectsFrom(msg.source());
     if (msg.targetMinor() == CMMsg.TYP_ENTER)
       addMeIfNeccessary(msg.source(), msg.source(), true, 0, maxTicks);
   }
   super.executeMsg(host, msg);
 }
Ejemplo n.º 16
0
 public void executeMsg(Environmental myHost, CMMsg msg) {
   super.executeMsg(myHost, msg);
   if ((affected instanceof Item)
       && (((Item) affected).owner() instanceof Room)
       && (((Room) ((Item) affected).owner()).isContent((Item) affected))
       && (msg.sourceMinor() == CMMsg.TYP_SPEAK)
       && (invoker != null)
       && (invoker.location() != ((Room) ((Item) affected).owner()))
       && (msg.othersMessage() != null)) invoker.executeMsg(invoker, msg);
 }
Ejemplo n.º 17
0
  public void executeMsg(final Environmental myHost, final CMMsg msg) {
    try {
      super.executeMsg(myHost, msg);
      if (spy == null) return;
      if (invoker == null) return;

      if ((msg.amISource(spy))
          && ((msg.sourceMinor() == CMMsg.TYP_LOOK) || (msg.sourceMinor() == CMMsg.TYP_EXAMINE))
          && (msg.target() != null)
          && ((invoker.location() != spy.location()) || (!(msg.target() instanceof Room)))) {
        disable = true;
        CMMsg newAffect = CMClass.getMsg(invoker, msg.target(), msg.sourceMinor(), null);
        msg.target().executeMsg(invoker, newAffect);
      } else if ((!msg.amISource(invoker))
          && (invoker.location() != spy.location())
          && (msg.source().location() == spy.location())
          && (msg.othersCode() != CMMsg.NO_EFFECT)
          && (msg.othersMessage() != null)
          && (!disable)) {
        disable = true;
        invoker.executeMsg(invoker, msg);
      } else if (msg.amISource(invoker)
          && (!disable)
          && (msg.sourceMinor() == CMMsg.TYP_SPEAK)
          && (msg.sourceMessage() != null)
          && ((msg.sourceMajor() & CMMsg.MASK_MAGIC) == 0)) {
        int start = msg.sourceMessage().indexOf("\'");
        int end = msg.sourceMessage().lastIndexOf("\'");
        if ((start > 0) && (end > start)) {
          String msg2 = msg.sourceMessage().substring(start + 1, end).trim();
          if (msg2.length() > 0)
            spy.enqueCommand(CMParms.parse(msg2.trim()), Command.METAFLAG_FORCED, 0);
        }
      }
    } finally {
      disable = false;
      if ((spy != null)
          && ((spy.amFollowing() != invoker)
              || (spy.amDead())
              || (!CMLib.flags().isInTheGame(spy, false))
              || (!CMLib.flags().isInTheGame(invoker, true)))) unInvoke();
    }
  }
Ejemplo n.º 18
0
  @Override
  public boolean okMessage(final Environmental myHost, final CMMsg msg) {
    if ((myHost == null) || (!(myHost instanceof MOB))) return super.okMessage(myHost, msg);

    final MOB mob = (MOB) myHost;
    if ((msg.amISource(mob)) && (mob.charStats().getClassLevel(this) > 4)) {
      if (((msg.sourceMinor() == CMMsg.TYP_BUY) || (msg.sourceMinor() == CMMsg.TYP_LIST))
          && (msg.tool() instanceof Potion)) {
        mob.basePhyStats().setDisposition(mob.basePhyStats().disposition() | PhyStats.IS_BONUS);
        mob.recoverPhyStats();
        mob.recoverCharStats();
      } else if ((mob.basePhyStats().disposition() & PhyStats.IS_BONUS) == PhyStats.IS_BONUS) {
        mob.basePhyStats().setDisposition(mob.basePhyStats().disposition() - PhyStats.IS_BONUS);
        mob.recoverPhyStats();
        mob.recoverCharStats();
      }
    }
    return super.okMessage(myHost, msg);
  }
Ejemplo n.º 19
0
 @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.source().tell(L("You can't really go anywhere -- you are rooted!"));
       return false;
     }
   }
   return super.okMessage(myHost, msg);
 }
 @Override
 public boolean okMessage(Environmental host, CMMsg msg) {
   if ((affected instanceof MOB)
       && (msg.amISource((MOB) affected))
       && (msg.sourceMinor() == CMMsg.TYP_REBUKE)
       && (msg.target() != null)
       && ((msg.target() == invoker()) || (msg.target().Name().equals(godName)))) {
     msg.source().tell(L("Your faith is too undeniable."));
     return false;
   }
   return super.okMessage(host, msg);
 }
  @Override
  public boolean okMessage(final Environmental myHost, final CMMsg msg) {
    if (affected == null) return super.okMessage(myHost, msg);

    if (affected instanceof MOB) {
      final MOB mob = (MOB) affected;
      if ((msg.amITarget(mob))
          && (!msg.amISource(mob))
          && (mob.location() != msg.source().location())
          && (msg.tool() instanceof Ability)
          && (CMath.bset(((Ability) msg.tool()).flags(), Ability.FLAG_TRANSPORTING))
          && (!mob.amDead())) {
        final 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))
          msg.source()
              .location()
              .showHappens(
                  CMMsg.MSG_OK_VISUAL, L("Magical energy fizzles and is absorbed into the air!"));
        return false;
      }
    } else if (affected instanceof Room) {
      final Room R = (Room) affected;
      if ((msg.tool() instanceof Ability)
          && (msg.source().location() != null)
          && (msg.sourceMinor() != CMMsg.TYP_LEAVE)) {
        final boolean summon = CMath.bset(((Ability) msg.tool()).flags(), Ability.FLAG_SUMMONING);
        final boolean teleport =
            CMath.bset(((Ability) msg.tool()).flags(), Ability.FLAG_TRANSPORTING);
        final boolean shere =
            (msg.source().location() == affected)
                || ((affected instanceof Area)
                    && (((Area) affected).inMyMetroArea(msg.source().location().getArea())));
        if ((!shere)
            && (!summon)
            && (teleport)
            && (!CMLib.law().doesHavePriviledgesHere(msg.source(), R))) {
          if ((msg.source().location() != null) && (msg.source().location() != R))
            msg.source()
                .location()
                .showHappens(
                    CMMsg.MSG_OK_VISUAL, L("Magical energy fizzles and is absorbed into the air!"));
          R.showHappens(
              CMMsg.MSG_OK_VISUAL, L("Magic energy fizzles and is absorbed into the air."));
          return false;
        }
      }
    }
    return super.okMessage(myHost, msg);
  }
Ejemplo n.º 22
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;
  }
Ejemplo n.º 23
0
  @Override
  public void executeMsg(Environmental host, CMMsg msg) {
    super.executeMsg(host, msg);
    if ((affected instanceof MOB) && (msg.amISource((MOB) affected))) {
      if (!DATA.containsKey(msg.source())) DATA.put(msg.source(), new int[DATA_TOTAL]);
      final int[] data = DATA.get(msg.source());

      if (data == null) return;
      if (msg.tool() instanceof Social) {
        if (nonIPnonMonsterWithMe(msg.source())) data[DATA_GOODSOCIAL]++;
        if ((msg.target() instanceof MOB) && (!((MOB) msg.target()).isMonster()))
          data[DATA_DIRSOCIAL]++;
        data[DATA_ANYSOCIAL]++;
      } else
        switch (msg.sourceMinor()) {
          case CMMsg.TYP_SPEAK:
            if ((msg.othersMessage() != null)
                && (msg.sourceMessage() != null)
                && (msg.othersMinor() == msg.sourceMinor())
                && (msg.source().location() != null)
                && (msg.source().session() != null)) {
              if (msg.sourceMessage().indexOf("order(s)") > 0) {
                if ((msg.target() instanceof MOB)
                    && (((MOB) msg.target()).session() != null)
                    && (((MOB) msg.target())
                        .session()
                        .getAddress()
                        .equals(msg.source().session().getAddress()))) data[DATA_ORDER]++;
              } else {
                if (nonIPnonMonsterWithMe(msg.source())) data[DATA_GOODSPEECH]++;
                if ((msg.target() instanceof MOB) && (!((MOB) msg.target()).isMonster()))
                  data[DATA_DIRSPEECH]++;
                data[DATA_ANYSPEECH]++;
              }
            }
            break;
        }
    }
  }
Ejemplo n.º 24
0
 public static void doAnimalFreeingCheck(CharClass C, Environmental host, CMMsg msg) {
   if ((msg.source() != host)
       && (msg.sourceMinor() == CMMsg.TYP_NOFOLLOW)
       && (msg.source().isMonster())
       && (host instanceof MOB)
       && (!((MOB) host).isMonster())
       && (msg.target() == host)
       && (msg.source().getStartRoom() != null)
       && (CMLib.law().isACity(msg.source().getStartRoom().getArea()))
       && (((MOB) host).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"))
       && (CMLib.flags().flaggedAffects(msg.source(), Ability.FLAG_SUMMONING).size() == 0)
       && (msg.source().location() != null)
       && (!msg.source().amDestroyed())
       && (CMLib.flags().isInTheGame((MOB) host, true))
       && (!CMLib.law().isACity(msg.source().location().getArea()))) {
     Object[] stuff = (Object[]) animalChecking.get(host);
     final Room room = msg.source().location();
     if ((stuff == null)
         || (System.currentTimeMillis() - ((Long) stuff[0]).longValue()
             > (room.getArea().getTimeObj().getDaysInMonth()
                 * room.getArea().getTimeObj().getHoursInDay()
                 * CMProps.getMillisPerMudHour()))) {
       stuff = new Object[3];
       stuff[0] = Long.valueOf(System.currentTimeMillis());
       animalChecking.remove(host);
       animalChecking.put(host, stuff);
       stuff[1] = Integer.valueOf(0);
       stuff[2] = new Vector();
     }
     if ((((Integer) stuff[1]).intValue() < 19)
         && (!((List) stuff[2]).contains("" + msg.source()))) {
       stuff[1] = Integer.valueOf(((Integer) stuff[1]).intValue() + 1);
       ((MOB) host)
           .tell(
               CMLib.lang()
                   .L(
                       "You have freed @x1 from @x2.",
                       msg.source().name((MOB) host),
                       (msg.source().getStartRoom().getArea().name())));
       CMLib.leveler()
           .postExperience((MOB) host, null, null, ((Integer) stuff[1]).intValue(), false);
     }
   }
 }
Ejemplo n.º 25
0
  @Override
  public boolean okMessage(final Environmental myHost, final CMMsg msg) {
    if (!super.okMessage(myHost, msg)) return false;

    if (((msg.sourceMinor() == CMMsg.TYP_TELL) || (msg.othersMajor(CMMsg.MASK_CHANNEL)))
        && ((msg.source() == affected)
            || ((msg.source().location() == CMLib.map().roomLocation(affected))
                && (msg.source().isMonster())
                && (msg.source().willFollowOrdersOf((MOB) affected))))) {
      msg.source().tell(L("Your message drifts into oblivion."));
      return false;
    }
    return true;
  }
Ejemplo n.º 26
0
 @Override
 public void executeMsg(final Environmental myHost, final CMMsg msg) {
   super.executeMsg(myHost, msg);
   if ((affected != null) && (affected instanceof MOB) && (msg.amISource((MOB) affected))) {
     if (msg.sourceMinor() == CMMsg.TYP_RECALL) {
       damageToTake = 0;
       unInvoke();
     } else if ((msg.tool() instanceof Ability)
         && (CMath.bset(((Ability) msg.tool()).flags(), Ability.FLAG_TRANSPORTING))) {
       damageToTake = 0;
       unInvoke();
     }
   }
 }
Ejemplo n.º 27
0
  @Override
  public boolean okMessage(final Environmental myHost, final CMMsg msg) {
    if (affected == null) return super.okMessage(myHost, msg);

    if ((msg.sourceMinor() == CMMsg.TYP_CAST_SPELL)
        && (msg.tool() instanceof Ability)
        && ((((Ability) msg.tool()).classificationCode() & Ability.ALL_ACODES)
            == Ability.ACODE_PRAYER)
        && (CMath.bset(((Ability) msg.tool()).flags(), Ability.FLAG_UNHOLY))
        && (!CMath.bset(((Ability) msg.tool()).flags(), Ability.FLAG_HOLY))) {
      msg.source().tell(L("This place is blocking unholy magic!"));
      return false;
    }
    return super.okMessage(myHost, msg);
  }
Ejemplo n.º 28
0
 @Override
 public void executeMsg(Environmental host, CMMsg msg) {
   if (host instanceof MOB) {
     final MOB myChar = (MOB) host;
     if (msg.amISource(myChar)
         && (msg.tool() instanceof Ability)
         && (!myChar.isMonster())
         && (msg.sourceMinor() == CMMsg.TYP_PREINVOKE)
         && (myChar.isMine(msg.tool()))
         && (myChar.charStats().getClassLevel(this) >= 30)
         && (CMLib.ableMapper().getQualifyingLevel(ID(), true, msg.tool().ID()) < 1))
       invokable = new WeakReference(msg.tool());
   }
   super.executeMsg(host, msg);
   Bard.visitationBonusMessage(host, msg);
 }
Ejemplo n.º 29
0
  @Override
  public boolean okMessage(final Environmental myHost, final CMMsg msg) {
    if (!(myHost instanceof MOB)) return super.okMessage(myHost, msg);

    final MOB myChar = (MOB) myHost;
    if (msg.tool() instanceof Ability) {
      if (msg.amISource(myChar)
          && (!myChar.isMonster())
          && (msg.sourceMinor() != CMMsg.TYP_PREINVOKE)) {
        final WeakReference<Ability> curRef = invokable;
        if ((curRef != null) && (msg.tool() == curRef.get())) {
          curRef.clear();
          final Ability A = ((Ability) msg.tool());
          final int[] usageCost = A.usageCost(myChar, false);
          if (CMath.bset(A.usageType(), Ability.USAGE_MANA))
            myChar.curState().adjMana(usageCost[Ability.USAGEINDEX_MANA] / 4, myChar.maxState());
          if (CMath.bset(A.usageType(), Ability.USAGE_MOVEMENT))
            myChar
                .curState()
                .adjMovement(usageCost[Ability.USAGEINDEX_MOVEMENT] / 4, myChar.maxState());
          if (CMath.bset(A.usageType(), Ability.USAGE_HITPOINTS))
            myChar
                .curState()
                .adjHitPoints(usageCost[Ability.USAGEINDEX_HITPOINTS] / 4, myChar.maxState());
        }
      } else if (msg.amITarget(myChar)) {
        if (((((Ability) msg.tool()).classificationCode() & Ability.ALL_ACODES)
                == Ability.ACODE_SPELL)
            && ((((Ability) msg.tool()).classificationCode() & Ability.ALL_DOMAINS)
                == Ability.DOMAIN_DIVINATION)
            && (CMLib.dice().roll(1, 100, 0) < (myChar.charStats().getClassLevel(this) * 4))) {
          myChar
              .location()
              .show(
                  msg.source(),
                  myChar,
                  CMMsg.MSG_OK_ACTION,
                  L(
                      "<T-NAME> fool(s) <S-NAMESELF>, causing <S-HIM-HER> to fizzle @x1.",
                      msg.tool().name()));
          return false;
        }
      }
    }
    return super.okMessage(myHost, msg);
  }
Ejemplo n.º 30
0
 public boolean okMessage(Environmental myHost, CMMsg msg) {
   if (!(myHost instanceof MOB)) return super.okMessage(myHost, msg);
   MOB myChar = (MOB) myHost;
   if ((msg.tool() == null) || (!(msg.tool() instanceof Ability)))
     return super.okMessage(myChar, msg);
   if (msg.amISource(myChar) && (myChar.isMine(msg.tool()))) {
     if ((msg.sourceMinor() == CMMsg.TYP_CAST_SPELL)
         && (!CMLib.ableMapper().getDefaultGain(ID(), true, msg.tool().ID()))) {
       if (CMLib.dice().rollPercentage()
           > (myChar.charStats().getStat(CharStats.STAT_INTELLIGENCE)
               * ((myChar.charStats().getCurrentClass().ID().equals(ID())) ? 1 : 2))) {
         myChar.location().show(myChar, null, CMMsg.MSG_OK_VISUAL, "<S-NAME> fizzle(s) a spell.");
         return false;
       }
     }
   }
   return super.okMessage(myChar, msg);
 }