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; } }
public boolean destroyIfNecessary() { final Physical E = affected; if ((affects.size() == 0) && (E != null)) { unInvoke(); E.delEffect(this); return true; } return false; }