public boolean supportsMending(Physical item) { if (!(item instanceof MOB)) return false; MOB caster = CMClass.getFactoryMOB(); caster.basePhyStats().setLevel(CMProps.getIntVar(CMProps.SYSTEMI_LASTPLAYERLEVEL)); caster.phyStats().setLevel(CMProps.getIntVar(CMProps.SYSTEMI_LASTPLAYERLEVEL)); boolean canMend = returnOffensiveAffects(caster, item).size() > 0; caster.destroy(); return canMend; }
public List<Ability> returnOffensiveAffects(MOB caster, Physical fromMe) { MOB newMOB = CMClass.getFactoryMOB(); MOB newerMOB = CMClass.getFactoryMOB(); Vector offenders = new Vector(1); CMMsg msg = CMClass.getMsg(newMOB, newerMOB, null, CMMsg.MSG_LOOK, null); for (int a = 0; a < fromMe.numEffects(); a++) // personal { Ability A = fromMe.fetchEffect(a); if (A != null) { newMOB.recoverPhyStats(); A.affectPhyStats(newMOB, newMOB.phyStats()); if ((!CMLib.flags().canSee(newMOB)) || (!A.okMessage(newMOB, msg))) if ((A.invoker() == null) || ((A.invoker() != null) && (A.invoker().phyStats().level()) <= (caster.phyStats().level() + 1 + (2 * getXLEVELLevel(caster))))) offenders.addElement(A); } } newMOB.destroy(); newerMOB.destroy(); return offenders; }