Esempio n. 1
0
 @Override
 public boolean apply(Game game, Ability source) {
   Player controller = game.getPlayer(source.getControllerId());
   if (controller != null) {
     GermToken token = new GermToken();
     token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
     Permanent p = game.getPermanent(token.getLastAddedToken());
     if (p != null) {
       p.addAttachment(source.getSourceId(), game);
       return true;
     }
   }
   return false;
 }
Esempio n. 2
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;
 }
 @Override
 public boolean apply(Game game, Ability source) {
   Player you = game.getPlayer(source.getControllerId());
   Permanent attackingCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
   if (you != null && attackingCreature != null) {
     FilterCard filter = new FilterCard("aura that could enchant the lone attacking creature");
     filter.add(new SubtypePredicate("Aura"));
     filter.add(new AuraCardCanAttachToPermanentId(attackingCreature.getId()));
     if (you.chooseUse(Outcome.Benefit, "Do you want to search your library?", source, game)) {
       TargetCardInLibrary target = new TargetCardInLibrary(filter);
       target.setNotTarget(true);
       if (you.searchLibrary(target, game)) {
         if (target.getFirstTarget() != null) {
           Card aura = game.getCard(target.getFirstTarget());
           game.getState().setValue("attachTo:" + aura.getId(), attackingCreature);
           aura.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), you.getId());
           return attackingCreature.addAttachment(aura.getId(), game);
         }
       }
     }
     you.shuffleLibrary(game);
   }
   return false;
 }