コード例 #1
0
  public void removeMyAffectsFrom(Physical P) {
    if (P == null) return;

    int x = 0;
    final Vector<Ability> eff = new Vector<Ability>();
    Ability thisAffect = null;
    for (x = 0; x < P.numEffects(); x++) // personal
    {
      thisAffect = P.fetchEffect(x);
      if (thisAffect != null) eff.addElement(thisAffect);
    }
    if (eff.size() > 0) {
      final Map<String, String> h = makeMySpellsH(getMySpellsV());
      if (unrevocableSpells != null) {
        for (int v = unrevocableSpells.size() - 1; v >= 0; v--) {
          thisAffect = unrevocableSpells.get(v);
          if (h.containsKey(thisAffect.ID())) P.delEffect(thisAffect);
        }
      } else
        for (x = 0; x < eff.size(); x++) {
          thisAffect = eff.elementAt(x);
          final String ID = h.get(thisAffect.ID());
          if ((ID != null) && (thisAffect.invoker() == getInvokerMOB(P, P))) {
            thisAffect.unInvoke();
            if ((!uninvocable) && (!thisAffect.canBeUninvoked())) P.delEffect(thisAffect);
          }
        }
      unrevocableSpells = null;
    }
  }
コード例 #2
0
  public List<Ability> returnOffensiveAffects(Physical fromMe) {
    final Vector offenders = new Vector();

    for (int a = 0; a < fromMe.numEffects(); a++) // personal
    {
      final Ability A = fromMe.fetchEffect(a);
      if ((A != null) && ((A.classificationCode() & Ability.ALL_ACODES) == Ability.ACODE_POISON))
        offenders.addElement(A);
    }
    return offenders;
  }
コード例 #3
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;
 }