Пример #1
0
 static {
   filter.add(
       Predicates.or(
           new CardTypePredicate(CardType.INSTANT), new CardTypePredicate(CardType.SORCERY)));
   filterPermanent.add(Predicates.not(new TokenPredicate()));
   filterPermanent.add(new AnotherPredicate());
 }
Пример #2
0
 @Override
 public boolean apply(Game game, Ability source) {
   Player controller = game.getPlayer(source.getControllerId());
   if (controller != null) {
     // Find the two permanents to meld.
     UUID sourceId = source.getSourceId();
     FilterControlledCreaturePermanent filter =
         new FilterControlledCreaturePermanent("creature named " + meldWithName);
     filter.add(new NamePredicate(meldWithName));
     TargetPermanent target = new TargetControlledCreaturePermanent(filter);
     Set<UUID> meldWithList = target.possibleTargets(sourceId, source.getControllerId(), game);
     if (meldWithList.isEmpty()) {
       return false; // possible permanent has left the battlefield meanwhile
     }
     UUID meldWithId;
     if (meldWithList.size() == 1) {
       meldWithId = meldWithList.iterator().next();
     } else {
       controller.choose(Outcome.BoostCreature, target, sourceId, game);
       meldWithId = target.getFirstTarget();
     }
     // Exile the two permanents to meld.
     Permanent sourcePermanent = game.getPermanent(sourceId);
     Permanent meldWithPermanent = game.getPermanent(meldWithId);
     if (sourcePermanent != null && meldWithPermanent != null) {
       sourcePermanent.moveToExile(null, "", sourceId, game);
       meldWithPermanent.moveToExile(null, "", sourceId, game);
       // Create the meld card and move it to the battlefield.
       Card sourceCard = game.getExile().getCard(sourceId, game);
       Card meldWithCard = game.getExile().getCard(meldWithId, game);
       if (!sourceCard.isCopy() && !meldWithCard.isCopy()) {
         meldCard.setOwnerId(controller.getId());
         meldCard.setTopHalfCard(meldWithCard, game);
         meldCard.setBottomHalfCard(sourceCard, game);
         meldCard.setMelded(true);
         game.addMeldCard(meldCard.getId(), meldCard);
         game.getState().addCard(meldCard);
         meldCard.setZone(Zone.EXILED, game);
         meldCard.moveToZone(Zone.BATTLEFIELD, sourceId, game, false);
       }
       return true;
     }
   }
   return false;
 }
Пример #3
0
 @Override
 public boolean apply(Game game, Ability source) {
   Player player = game.getPlayer(source.getControllerId());
   if (player != null) {
     Choice typeChoice = new ChoiceImpl(true);
     typeChoice.setMessage("Choose a creature type:");
     typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
     while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
       if (!player.canRespond()) {
         return false;
       }
     }
     FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
     filter.add(new SubtypePredicate(typeChoice.getChoice()));
     return new DrawCardSourceControllerEffect(new PermanentsOnBattlefieldCount(filter))
         .apply(game, source);
   }
   return false;
 }
 @Override
 public boolean checkTrigger(GameEvent event, Game game) {
   Permanent sourcePermanent = game.getPermanent(event.getSourceId());
   if (sourcePermanent != null && filter.match(sourcePermanent, sourceId, controllerId, game)) {
     if (setTargetPointer) {
       for (Effect effect : this.getEffects()) {
         effect.setTargetPointer(new FixedTarget(event.getSourceId()));
       }
     }
     return true;
   }
   return false;
 }
Пример #5
0
 static {
   filter.add(new PowerPredicate(Filter.ComparisonType.LessThan, 3));
   filter2.add(new AnotherPredicate());
 }
Пример #6
0
 static {
   filter.add(new ColorPredicate(ObjectColor.GREEN));
 }
Пример #7
0
 static {
   filter1.add(new SubtypePredicate("Vampire"));
   filter2.add(new SubtypePredicate("Vampire"));
   filter2.add(Predicates.not(new TappedPredicate()));
 }
Пример #8
0
 static {
   filter.add(new AnotherPredicate());
 }
Пример #9
0
 static {
   filter.add(new SupertypePredicate("Legendary"));
 }
Пример #10
0
 static {
   filter.add(new SubtypePredicate("Ally"));
 }
Пример #11
0
 static {
   filter.add(new ColorPredicate(ObjectColor.RED));
 }
Пример #12
0
 static {
   filter.add(new ColorPredicate(ObjectColor.WHITE));
   filter.add(new AnotherPredicate());
 }
Пример #13
0
 static {
   FILTER1.add(new SubtypePredicate("Ally"));
 }
Пример #14
0
 static {
   filter.add(Predicates.not(new SubtypePredicate("Ogre")));
 }
Пример #15
0
 static {
   filter.add(new ColorPredicate(ObjectColor.BLACK));
 }
Пример #16
0
 static {
   filterCreatures.add(new ColorPredicate(ObjectColor.BLACK));
   filterCreature.add(new AnotherPredicate());
   filterCreature.add(new ColorPredicate(ObjectColor.BLACK));
 }
Пример #17
0
 static {
   filterGreen.add(new AnotherPredicate());
   filterGreen.add(new ColorPredicate(ObjectColor.GREEN));
   filterRed.add(new AnotherPredicate());
   filterRed.add(new ColorPredicate(ObjectColor.RED));
 }
Пример #18
0
 static {
   filterPermanent.add(new AnotherPredicate());
   filterCard.add(Predicates.not(new SupertypePredicate("Legendary")));
 }
Пример #19
0
 static {
   filter.add(new AbilityPredicate(DefenderAbility.class));
 }
Пример #20
0
 @Override
 public String getMessage() {
   return filter.getMessage();
 }
Пример #21
0
 static {
   filter.add(new MulticoloredPredicate());
 }
Пример #22
0
 static {
   filter.add(new SubtypePredicate("Spirit"));
 }
Пример #23
0
 static {
   filter.add(new SubtypePredicate("Elf"));
 }
Пример #24
0
 static {
   filterCreature.add((new SubtypePredicate("Ninja")));
 }
 @Override
 public String getRule() {
   return "Whenever a " + filter.getMessage() + " attacks, " + super.getRule();
 }
Пример #26
0
 static {
   filter.add(Predicates.not(new TappedPredicate()));
 }
Пример #27
0
 static {
   filter.add(new SubtypePredicate("Knight"));
 }