Example #1
0
 @Override
 public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
   Permanent permanent = game.getPermanent(sourceId);
   if (permanent != null) {
     Permanent attachment = game.getPermanent(attachmentid);
     if (attachment != null) {
       permanent.removeAttachment(attachmentid, game);
       this.paid = true;
     }
   }
   return paid;
 }
Example #2
0
 @Override
 public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
   Permanent attachment = game.getPermanent(sourceId);
   Permanent permanent = game.getPermanent(attachment.getAttachedTo());
   if (permanent != null) {
     paid = permanent.removeAttachment(attachment.getId(), game);
     if (paid) {
       game.fireEvent(
           GameEvent.getEvent(GameEvent.EventType.UNATTACHED, sourceId, sourceId, controllerId));
     }
   }
   return paid;
 }
Example #3
0
 @Override
 public boolean apply(Game game, Ability source) {
   Permanent permanent = game.getPermanent(source.getFirstTarget());
   Permanent attachment = game.getPermanent(source.getSourceId());
   if (permanent != null && attachment != null) {
     if (attachment.getAttachedTo() != null) {
       Permanent oldTarget = game.getPermanent(attachment.getAttachedTo());
       if (oldTarget != null) {
         oldTarget.removeAttachment(source.getSourceId(), game);
       }
     }
     boolean result;
     result = permanent.addAttachment(source.getSourceId(), game);
     return result;
   }
   return false;
 }
Example #4
0
    @java.lang.Override
    public boolean apply(Game game, Ability source) {
      Permanent creature = game.getPermanent(targetPointer.getFirst(game, source));
      if (creature != null) {
        FilterPermanent creatureFilter = new FilterPermanent();
        creatureFilter.add(new PermanentIdPredicate(creature.getId()));

        FilterPermanent equipmentFilter = new FilterPermanent();
        equipmentFilter.add(new AttachedToPredicate(creatureFilter));
        equipmentFilter.add(new SubtypePredicate("Equipment"));

        for (Permanent equipment :
            game.getBattlefield().getAllActivePermanents(equipmentFilter, game)) {
          creature.removeAttachment(equipment.getId(), game);
        }
        return true;
      }
      return false;
    }