コード例 #1
0
ファイル: Visible.java プロジェクト: yohanesgultom/CoffeeMud
 public static java.util.List<Ability> returnOffensiveAffects(Physical fromMe) {
   final MOB newMOB = CMClass.getFactoryMOB();
   newMOB.setLocation(CMLib.map().roomLocation(fromMe));
   final List<Ability> offenders = new Vector<Ability>();
   for (int a = 0; a < fromMe.numEffects(); a++) // personal
   {
     final Ability A = fromMe.fetchEffect(a);
     if ((A != null) && (A.canBeUninvoked())) {
       try {
         newMOB.recoverPhyStats();
         A.affectPhyStats(newMOB, newMOB.phyStats());
         if (CMLib.flags().isInvisible(newMOB) || CMLib.flags().isHidden(newMOB)) offenders.add(A);
       } catch (final Exception e) {
       }
     }
   }
   newMOB.destroy();
   return offenders;
 }
コード例 #2
0
  @Override
  public boolean okMessage(final Environmental myHost, final CMMsg msg) {
    if (!(affected instanceof MOB)) return true;

    final MOB mob = (MOB) affected;
    if ((msg.amITarget(mob))
        && (CMath.bset(msg.targetMajor(), CMMsg.MASK_MALICIOUS))
        && (msg.tool() instanceof Ability)
        && (!mob.amDead())) {
      final Ability A = (Ability) msg.tool();
      if (CMath.bset(A.flags(), Ability.FLAG_PARALYZING)) {
        msg.addTrailerMsg(
            CMClass.getMsg(
                mob,
                null,
                CMMsg.MSG_OK_VISUAL,
                L("The uninhibiting barrier around <S-NAME> repels the @x1.", A.name())));
        return false;
      }
      final MOB newMOB = CMClass.getFactoryMOB();
      final CMMsg msg2 = CMClass.getMsg(newMOB, null, null, CMMsg.MSG_SIT, null);
      newMOB.recoverPhyStats();
      try {
        A.affectPhyStats(newMOB, newMOB.phyStats());
        if ((!CMLib.flags().aliveAwakeMobileUnbound(newMOB, true))
            || (CMath.bset(A.flags(), Ability.FLAG_PARALYZING))
            || (!A.okMessage(newMOB, msg2))) {
          msg.addTrailerMsg(
              CMClass.getMsg(
                  mob,
                  null,
                  CMMsg.MSG_OK_VISUAL,
                  L("The uninhibiting barrier around <S-NAME> repels the @x1.", A.name())));
          newMOB.destroy();
          return false;
        }
      } catch (final Exception e) {
      }
      newMOB.destroy();
    }
    return true;
  }