Ejemplo n.º 1
0
 @Override
 public List<CardType> getCardType() {
   if (this.getSpellAbility() instanceof BestowAbility) {
     List<CardType> cardTypes = new ArrayList<CardType>();
     cardTypes.addAll(card.getCardType());
     cardTypes.remove(CardType.CREATURE);
     return cardTypes;
   }
   return card.getCardType();
 }
Ejemplo n.º 2
0
 public SupportAbility(Card card, int amount) {
   super(new SupportEffect(card, amount, true));
   if (!card.getCardType().contains(CardType.INSTANT)
       && !card.getCardType().contains(CardType.SORCERY)) {
     FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures");
     if (card.getCardType().contains(CardType.CREATURE)) {
       filter.add(new AnotherPredicate());
       filter.setMessage("other target creatures");
     }
     addTarget(new TargetCreaturePermanent(0, amount, filter, false));
   }
 }
Ejemplo n.º 3
0
 public SupportEffect(Card card, int amount, boolean otherPermanent) {
   super(CounterType.P1P1.createInstance(0), new StaticValue(1));
   this.amountSupportTargets = new StaticValue(amount);
   this.otherPermanent = otherPermanent;
   if (card.getCardType().contains(CardType.INSTANT)
       || card.getCardType().contains(CardType.SORCERY)) {
     card.getSpellAbility()
         .addTarget(
             new TargetCreaturePermanent(
                 0, amount, new FilterCreaturePermanent("target creatures"), false));
   }
   staticText = setText();
 }
Ejemplo n.º 4
0
  @Override
  public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
    Permanent permanent = game.getPermanent(source.getSourceId());
    if (permanent != null) {
      if (permanent.getImprinted().size() > 0) {
        Card card = game.getCard(permanent.getImprinted().get(0));
        if (card != null && card.getCardType().contains(CardType.CREATURE)) {
          switch (layer) {
            case TypeChangingEffects_4:
              if (sublayer == SubLayer.NA) {
                permanent.getSubtype().addAll(card.getSubtype());
              }

              break;
            case PTChangingEffects_7:
              if (sublayer == SubLayer.SetPT_7b) {
                permanent.getPower().setValue(card.getPower().getValue());
                permanent.getToughness().setValue(card.getToughness().getValue());
              }
          }
          return true;
        }
      }
    }
    return false;
  }
Ejemplo n.º 5
0
  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(targetPointer.getFirst(game, source));
    if (player != null) {
      int max = amount.calculate(game, source);
      if (max != 0) {
        int numberOfCard = 0;

        while (player.getLibrary().size() > 0) {
          Card card = player.getLibrary().removeFromTop(game);
          if (card != null) {
            if (card.moveToZone(Constants.Zone.GRAVEYARD, source.getId(), game, false)) {
              if (card.getCardType().contains(CardType.CREATURE)) {
                break;
              } else {
                numberOfCard++;
                if (numberOfCard >= max) {
                  break;
                }
              }
            }
          } else {
            return false;
          }
        }
      }
    }
    return true;
  }
Ejemplo n.º 6
0
 @Override
 public boolean apply(Game game, Ability source) {
   Permanent sourcePermanent =
       (Permanent)
           game.getLastKnownInformation(
               targetPointer.getFirst(game, source), Constants.Zone.BATTLEFIELD);
   if (sourcePermanent == null) {
     return false;
   }
   Player controller = game.getPlayer(source.getControllerId());
   if (controller == null) {
     return false;
   }
   Cards revealed = new CardsImpl();
   Card artifactCard = null;
   Cards nonArtifactCards = new CardsImpl();
   Player player = game.getPlayer(sourcePermanent.getControllerId());
   while (artifactCard == null && player.getLibrary().size() > 0) {
     Card card = player.getLibrary().removeFromTop(game);
     revealed.add(card);
     if (card.getCardType().contains(CardType.ARTIFACT)) artifactCard = card;
     else nonArtifactCards.add(card);
   }
   player.revealCards("Shape Anew", revealed, game);
   if (artifactCard != null) {
     artifactCard.putOntoBattlefield(
         game, Constants.Zone.LIBRARY, source.getId(), player.getId());
   }
   player.getLibrary().addAll(nonArtifactCards.getCards(game), game);
   player.shuffleLibrary(game);
   return true;
 }
Ejemplo n.º 7
0
  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null) {
      return false;
    }

    Card card = player.getLibrary().getFromTop(game);
    if (card != null) {
      Cards cards = new CardsImpl();
      cards.add(card);
      player.lookAtCards("Explorer's Scope", cards, game);
      if (card.getCardType().contains(CardType.LAND)) {
        String message = "Put " + card.getName() + " onto the battlefield tapped?";
        if (player.chooseUse(Outcome.PutLandInPlay, message, game)) {
          if (card.putOntoBattlefield(
              game, Zone.LIBRARY, source.getId(), source.getControllerId())) {
            Permanent permanent = game.getPermanent(card.getId());
            if (permanent != null) {
              permanent.setTapped(true);
            }
          }
        }
      }
    }
    return true;
  }
Ejemplo n.º 8
0
  public static void transform(Permanent permanent, Card sourceCard, Game game) {

    if (sourceCard == null) {
      return;
    }

    permanent.setName(sourceCard.getName());
    permanent.getColor().setColor(sourceCard.getColor());
    permanent.getManaCost().clear();
    permanent.getManaCost().add(sourceCard.getManaCost());
    permanent.getCardType().clear();
    for (CardType type : sourceCard.getCardType()) {
      permanent.getCardType().add(type);
    }
    permanent.getSubtype().clear();
    for (String type : sourceCard.getSubtype()) {
      permanent.getSubtype().add(type);
    }
    permanent.getSupertype().clear();
    for (String type : sourceCard.getSupertype()) {
      permanent.getSupertype().add(type);
    }
    permanent.setExpansionSetCode(sourceCard.getExpansionSetCode());
    permanent.getAbilities().clear();
    for (Ability ability : sourceCard.getAbilities()) {
      permanent.addAbility(ability, game);
    }
    permanent.getPower().setValue(sourceCard.getPower().getValue());
    permanent.getToughness().setValue(sourceCard.getToughness().getValue());
  }
Ejemplo n.º 9
0
 @Override
 public boolean apply(Game game, Ability source) {
   Player controller = game.getPlayer(source.getControllerId());
   MageObject sourceObject = source.getSourceObject(game);
   if (controller != null && sourceObject != null) {
     Choice choice = new ChoiceImpl(true);
     choice.setMessage("Choose a creature type:");
     choice.setChoices(CardRepository.instance.getCreatureTypes());
     while (!controller.choose(Outcome.BoostCreature, choice, game)) {
       if (!controller.canRespond()) {
         return false;
       }
     }
     Cards revealedCards = new CardsImpl();
     while (controller.getLibrary().size() > 0) {
       Card card = controller.getLibrary().removeFromTop(game);
       if (card.getCardType().contains(CardType.CREATURE)
           && card.getSubtype().contains(choice.getChoice())) {
         controller.moveCards(card, Zone.BATTLEFIELD, source, game);
         break;
       }
       revealedCards.add(card);
     }
     controller.revealCards(sourceObject.getIdName(), revealedCards, game);
     controller.moveCards(revealedCards, Zone.LIBRARY, source, game);
     controller.shuffleLibrary(source, game);
     return true;
   }
   return false;
 }
Ejemplo n.º 10
0
 @Override
 public boolean apply(Game game, Ability source) {
   Card creature = null;
   Player opponent = game.getPlayer(source.getFirstTarget());
   CardsImpl cards = new CardsImpl();
   boolean creatureFound = false;
   while (opponent.getLibrary().size() > 0 && !creatureFound) {
     Card card = opponent.getLibrary().removeFromTop(game);
     if (card != null) {
       if (card.getCardType().contains(CardType.CREATURE)) {
         creature = card;
         creatureFound = true;
       }
       if (!creatureFound) {
         cards.add(card);
       }
     }
   }
   if (!cards.isEmpty()) {
     opponent.revealCards("Telemin Performance", cards, game);
     opponent.moveCards(cards, Zone.GRAVEYARD, source, game);
   }
   if (creature != null) {
     return creature.putOntoBattlefield(
         game, Zone.LIBRARY, source.getSourceId(), source.getControllerId());
   }
   return false;
 }
Ejemplo n.º 11
0
 @Override
 public boolean checkTrigger(GameEvent event, Game game) {
   if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) {
     if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
       Card c = game.getCard(event.getSourceId());
       if (c != null) {
         if (c.getColor().isRed()
             && (c.getCardType().contains(CardType.PLANESWALKER)
                 || c.getCardType().contains(CardType.INSTANT)
                 || c.getCardType().contains(CardType.SORCERY))) {
           return true;
         }
       }
     }
   }
   return false;
 }
Ejemplo n.º 12
0
 @Override
 public boolean applies(GameEvent event, Ability source, Game game) {
   if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD
       && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
     Card c = game.getCard(event.getTargetId());
     if (c != null && c.getCardType().contains(CardType.CREATURE)) return true;
   }
   return false;
 }
Ejemplo n.º 13
0
 @Override
 public void postResolve(Card card, Ability source, UUID controllerId, Game game) {
   Card revealed = (Card) game.getState().getValue(source.getId().toString());
   if (revealed != null && revealed.getCardType().contains(CardType.LAND)) {
     card.moveToZone(Zone.HAND, source.getId(), game, false);
   } else {
     card.moveToZone(Zone.GRAVEYARD, source.getId(), game, false);
   }
 }
Ejemplo n.º 14
0
 @Override
 public boolean apply(Game game, Ability source) {
   SecondSunriseWatcher watcher =
       (SecondSunriseWatcher) game.getState().getWatchers().get("SecondSunriseWatcher");
   if (watcher != null) {
     for (UUID id : watcher.cards) {
       Card c = game.getCard(id);
       if (c != null && game.getState().getZone(id) == Zone.GRAVEYARD) {
         if (c.getCardType().contains(CardType.ARTIFACT)
             || c.getCardType().contains(CardType.CREATURE)
             || c.getCardType().contains(CardType.ENCHANTMENT)
             || c.getCardType().contains(CardType.LAND))
           c.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false);
       }
     }
     return true;
   }
   return false;
 }
Ejemplo n.º 15
0
  @Override
  public boolean apply(Game game, Ability source) {
    boolean isMountain = false;
    Card sourceCard = game.getCard(source.getSourceId());
    Player player = game.getPlayer(source.getControllerId());

    if (player == null || sourceCard == null) {
      return false;
    }
    Cards cards = new CardsImpl(Zone.PICK);
    while (player.getLibrary().size() > 0) {
      Card card = player.getLibrary().removeFromTop(game);
      if (card != null) {
        cards.add(card);
        if (card.getCardType().contains(CardType.LAND)) {
          if (card.getSubtype().contains("Mountain")) {
            isMountain = true;
          }
          break;
        }
      } else {
        break;
      }
    }
    player.revealCards(sourceCard.getName(), cards, game);
    int damage = cards.size();
    if (isMountain == true) {
      damage *= 2;
    }

    Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
    if (permanent != null) {
      permanent.damage(damage, source.getSourceId(), game, true, false);
    } else {
      Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
      if (targetPlayer != null) {
        targetPlayer.damage(damage, source.getSourceId(), game, false, true);
      }
    }

    TargetCard target =
        new TargetCard(Zone.PICK, new FilterCard("card to put on the bottom of your library"));
    target.setRequired(true);
    while (cards.size() > 1) {
      player.choose(Outcome.Neutral, cards, target, game);
      Card card = cards.get(target.getFirstTarget(), game);
      if (card != null) {
        cards.remove(card);
        card.moveToZone(Zone.PICK, source.getId(), game, false);
      }
      target.clearChosen();
    }

    return true;
  }
Ejemplo n.º 16
0
 @Override
 public boolean applies(UUID sourceId, Ability source, Game game) {
   Card card = game.getCard(sourceId);
   if (card != null) {
     if (card.getCardType().contains(CardType.SORCERY)
         && card.getOwnerId().equals(source.getControllerId())) {
       return true;
     }
   }
   return false;
 }
Ejemplo n.º 17
0
 @Override
 public boolean checkTrigger(GameEvent event, Game game) {
   if (game.getOpponents(controllerId).contains(event.getPlayerId())) {
     Card card = game.getCard(event.getSourceId());
     if (card != null && card.getCardType().contains(CardType.CREATURE)) {
       this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId()));
       return true;
     }
   }
   return false;
 }
Ejemplo n.º 18
0
  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    MageObject sourceObject = source.getSourceObject(game);
    if (controller != null && sourceObject != null) {
      if (controller.getLibrary().size() > 0) {
        Card card = controller.getLibrary().getFromTop(game);
        if (card == null) {
          return false;
        }
        controller.revealCards(sourceObject.getIdName(), new CardsImpl(card), game);
        if (card.getCardType().contains(CardType.CREATURE)) {
          FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
          boolean found = false;
          for (Permanent permanent :
              game.getBattlefield().getAllActivePermanents(filter, controller.getId(), game)) {
            if (CardUtil.shareSubtypes(card, permanent, game)) {
              found = true;
              break;
            }
          }
          if (found) {
            game.informPlayers(
                sourceObject.getLogName()
                    + ": Found a creature that shares a creature type with the revealed card.");
            if (controller.chooseUse(Outcome.Benefit, "Cast the card?", source, game)) {
              controller.cast(card.getSpellAbility(), game, true);
            } else {
              game.informPlayers(
                  sourceObject.getLogName()
                      + ": "
                      + controller.getLogName()
                      + " canceled casting the card.");
              controller.getLibrary().putOnBottom(card, game);
            }
          } else {
            game.informPlayers(
                sourceObject.getLogName()
                    + ": No creature that shares a creature type with the revealed card.");
            controller.getLibrary().putOnBottom(card, game);
          }
        } else {
          game.informPlayers(
              sourceObject.getLogName() + ": Put " + card.getLogName() + " on the bottom.");
          controller.getLibrary().putOnBottom(card, game);
        }

        return true;
      }
    }
    return false;
  }
Ejemplo n.º 19
0
 @Override
 public boolean apply(Game game, Ability source, Ability abilityToModify) {
   Player controller = game.getPlayer(source.getControllerId());
   if (controller != null) {
     Set<CardType> foundCardTypes = new HashSet<>(8);
     for (Card card : controller.getGraveyard().getCards(game)) {
       foundCardTypes.addAll(card.getCardType());
     }
     CardUtil.reduceCost(abilityToModify, foundCardTypes.size());
     return true;
   }
   return false;
 }
Ejemplo n.º 20
0
 @Override
 public boolean checkTrigger(GameEvent event, Game game) {
   ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
   if (zEvent.getFromZone().equals(Zone.GRAVEYARD)) {
     Card card = game.getCard(zEvent.getTargetId());
     Player controller = game.getPlayer(getControllerId());
     return card != null
         && card.getCardType().contains(CardType.CREATURE)
         && controller != null
         && controller.hasOpponent(card.getOwnerId(), game);
   }
   return false;
 }
Ejemplo n.º 21
0
  @Override
  public boolean apply(Game game, Ability source) {
    Card card = game.getCard(source.getFirstTarget());
    Permanent permanent = game.getPermanent(source.getSourceId());
    if (card == null || permanent == null) {
      return false;
    }
    card.moveToExile(null, "Dimir Doppelganger", source.getSourceId(), game);
    Card cardToCopy = card.copy();
    cardToCopy.assignNewId();
    permanent.setName(cardToCopy.getName());
    permanent.getPower().setValue(cardToCopy.getPower().getValue());
    permanent.getToughness().setValue(cardToCopy.getToughness().getValue());
    permanent.getColor(game).setColor(cardToCopy.getColor(game));
    permanent.getManaCost().clear();
    permanent.getManaCost().add(cardToCopy.getManaCost());
    permanent.getCardType().clear();
    for (CardType type : cardToCopy.getCardType()) {
      if (!permanent.getCardType().contains(type)) {
        permanent.getCardType().add(type);
      }
    }
    permanent.getSubtype(game).clear();
    for (String type : cardToCopy.getSubtype(game)) {
      if (!permanent.getSubtype(game).contains(type)) {
        permanent.getSubtype(game).add(type);
      }
    }
    permanent.getSupertype().clear();
    for (String type : cardToCopy.getSupertype()) {
      if (!permanent.getSupertype().contains(type)) {
        permanent.getSupertype().add(type);
      }
    }
    permanent.removeAllAbilities(source.getSourceId(), game);
    // gains ability of Dimir Doppelganger
    Ability dimirDoppelgangerAbility =
        new SimpleActivatedAbility(
            Zone.BATTLEFIELD, new DimirDoppelgangerEffect(), new ManaCostsImpl("{1}{U}{B}"));
    dimirDoppelgangerAbility.addTarget(
        new TargetCardInGraveyard(new FilterCreatureCard("creature card in a graveyard")));
    permanent.addAbility(dimirDoppelgangerAbility, source.getSourceId(), game);

    for (Ability ability : cardToCopy.getAbilities()) {
      if (!permanent.getAbilities().contains(ability)) {
        permanent.addAbility(ability, source.getSourceId(), game);
      }
    }
    return true;
  }
Ejemplo n.º 22
0
 @Override
 public boolean apply(Game game, Ability source) {
   Player controller = game.getPlayer(source.getControllerId());
   if (controller != null) {
     Permanent permanent =
         (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
     if (permanent != null) {
       List<UUID> imprinted = permanent.getImprinted();
       if (imprinted.size() > 0) {
         Card imprintedCard = game.getCard(imprinted.get(0));
         imprintedCard.setFaceDown(false, game);
         if (imprintedCard.getCardType().contains(CardType.CREATURE)) {
           controller.moveCards(imprintedCard, Zone.BATTLEFIELD, source, game);
         }
       }
     }
     return true;
   }
   return false;
 }
Ejemplo n.º 23
0
 @Override
 public boolean apply(Game game, Ability source) {
   Player targetPlayer = game.getPlayer(source.getFirstTarget());
   Player controller = game.getPlayer(source.getControllerId());
   if (targetPlayer != null && controller != null) {
     TargetCardInYourGraveyard target = new TargetCardInYourGraveyard();
     target.setRequired(true);
     if (targetPlayer.chooseTarget(Outcome.Exile, target, source, game)) {
       Card card = game.getCard(target.getFirstTarget());
       if (card != null) {
         targetPlayer.getGraveyard().remove(card);
         card.moveToExile(null, "", source.getId(), game);
         if (card.getCardType().contains(CardType.CREATURE)) {
           controller.gainLife(2, game);
         }
       }
       return true;
     }
   }
   return false;
 }
Ejemplo n.º 24
0
 @Override
 public boolean apply(Game game, Ability source) {
   Player player = game.getPlayer(targetPointer.getFirst(game, source));
   if (player != null) {
     int foundCreatures = 0;
     Cards cards = new CardsImpl();
     for (Card card : player.getLibrary().getTopCards(game, 4)) {
       cards.add(card);
       if (card.getCardType().contains(CardType.CREATURE)) {
         ++foundCreatures;
       }
     }
     player.moveCards(cards, Zone.GRAVEYARD, source, game);
     if (foundCreatures > 0) {
       Player controller = game.getPlayer(source.getControllerId());
       if (controller != null) {
         controller.drawCards(foundCreatures, game);
       }
     }
     return true;
   }
   return false;
 }
Ejemplo n.º 25
0
 @Override
 public boolean apply(Game game, Ability source) {
   Player player = game.getPlayer(source.getControllerId());
   if (player != null) {
     player.drawCards(1, game);
     TargetDiscard target = new TargetDiscard(player.getId());
     player.choose(Outcome.Discard, target, source.getSourceId(), game);
     Card card = player.getHand().get(target.getFirstTarget(), game);
     if (card != null) {
       player.discard(card, source, game);
       if (card.getCardType().contains(CardType.CREATURE)) {
         Permanent permanent = game.getPermanent(source.getSourceId());
         if (permanent != null) {
           permanent.untap(game);
           permanent.transform(game);
         }
       }
       return true;
     }
     return false;
   }
   return false;
 }
Ejemplo n.º 26
0
 @Override
 public boolean apply(Game game, Ability source) {
   Player controller = game.getPlayer(source.getControllerId());
   Card sourceCard = game.getCard(source.getSourceId());
   if (controller == null || sourceCard == null) {
     return false;
   }
   if (controller.getLibrary().size() > 0) {
     controller.shuffleLibrary(game);
     Card card = controller.getLibrary().getFromTop(game);
     if (card == null) {
       return false;
     }
     controller.revealCards(sourceCard.getName(), new CardsImpl(card), game);
     if (card.getCardType().contains(CardType.LAND)) {
       String message = "Put " + card.getName() + " onto the battlefield?";
       if (controller.chooseUse(Outcome.PutLandInPlay, message, game)) {
         card.putOntoBattlefield(
             game, Zone.LIBRARY, source.getSourceId(), source.getControllerId());
         return sourceCard.moveToZone(Zone.HAND, source.getSourceId(), game, false);
       }
     } else {
       if (controller.chooseUse(
           outcome,
           new StringBuilder("Cast ")
               .append(card.getName())
               .append(" without paying its mana cost?")
               .toString(),
           game)) {
         return controller.cast(card.getSpellAbility(), game, true);
       }
     }
     return true;
   }
   return false;
 }
Ejemplo n.º 27
0
 @Override
 public boolean apply(Card input, Game game) {
   return input.getCardType().contains(CardType.PLANESWALKER)
       && input.getName().contains("Ugin, the Spirit Dragon");
 }
Ejemplo n.º 28
0
  @Override
  public boolean apply(Game game, Ability source) {
    MageObject sourceObject = source.getSourceObject(game);
    if (sourceObject == null) {
      return false;
    }
    Map<UUID, Set<Card>> permanentsOwned = new HashMap<>();
    Collection<Permanent> permanents = game.getBattlefield().getAllActivePermanents();
    for (Permanent permanent : permanents) {
      Set<Card> set = permanentsOwned.get(permanent.getOwnerId());
      if (set == null) {
        set = new LinkedHashSet<>();
      }
      set.add(permanent);
      permanentsOwned.put(permanent.getOwnerId(), set);
    }

    // shuffle permanents into owner's library
    Map<UUID, Integer> permanentsCount = new HashMap<>();
    for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
      Player player = game.getPlayer(playerId);
      if (player != null) {
        Set<Card> set = permanentsOwned.remove(playerId);
        Integer count = 0;
        if (set != null) {
          count = set.size();
          player.moveCards(set, Zone.BATTLEFIELD, Zone.LIBRARY, source, game);
        }

        if (count > 0) {
          player.shuffleLibrary(game);
        }
        permanentsCount.put(playerId, count);
      }
    }

    game.applyEffects(); // so effects from creatures that were on the battlefield won't trigger
    // from draw or later put into play

    Map<UUID, CardsImpl> cardsRevealed = new HashMap<>();

    // draw cards and reveal them
    for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
      Player player = game.getPlayer(playerId);
      if (player != null) {
        Integer count = Math.min(permanentsCount.get(player.getId()), player.getLibrary().size());
        CardsImpl cards = new CardsImpl();
        for (int i = 0; i < count; i++) {
          Card card = player.getLibrary().removeFromTop(game);
          if (card != null) {
            cards.add(card);
          }
        }
        player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ")", cards, game);
        cardsRevealed.put(player.getId(), cards);
      }
    }

    // put artifacts, creaturs and lands onto the battlefield
    for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
      Player player = game.getPlayer(playerId);
      if (player != null) {
        CardsImpl cards = cardsRevealed.get(player.getId());
        for (Card card : cards.getCards(game)) {
          if (card != null
              && (card.getCardType().contains(CardType.ARTIFACT)
                  || card.getCardType().contains(CardType.CREATURE)
                  || card.getCardType().contains(CardType.LAND))) {
            card.putOntoBattlefield(game, Zone.HAND, source.getSourceId(), player.getId());
            cards.remove(card);
          }
        }
      }
    }
    // put enchantments onto the battlefield
    for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
      Player player = game.getPlayer(playerId);
      if (player != null) {
        CardsImpl cards = cardsRevealed.get(player.getId());
        for (Card card : cards.getCards(game)) {
          if (card != null && card.getCardType().contains(CardType.ENCHANTMENT)) {
            card.putOntoBattlefield(game, Zone.HAND, source.getSourceId(), player.getId());
            cards.remove(card);
          }
        }
      }
    }
    // put the rest of the cards on buttom of the library
    for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
      Player player = game.getPlayer(playerId);
      if (player != null) {
        CardsImpl cards = cardsRevealed.get(player.getId());
        player.putCardsOnBottomOfLibrary(cards, game, source, false);
      }
    }
    return true;
  }
Ejemplo n.º 29
0
 @Override
 public boolean apply(Card input, Game game) {
   return input.getCardType().contains(CardType.CREATURE)
       && input.getSubtype(game).contains("Dragon");
 }