use of mage.cards.Cards in project mage by magefree.
the class NoxiousVaporsEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
player.revealCards(player.getName() + "'s hand", player.getHand(), game);
}
}
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player == null) {
continue;
}
Set<Card> chosenCards = new HashSet<>();
chooseCardForColor(ObjectColor.WHITE, chosenCards, player, game, source);
chooseCardForColor(ObjectColor.BLUE, chosenCards, player, game, source);
chooseCardForColor(ObjectColor.BLACK, chosenCards, player, game, source);
chooseCardForColor(ObjectColor.RED, chosenCards, player, game, source);
chooseCardForColor(ObjectColor.GREEN, chosenCards, player, game, source);
chosenCards.addAll(player.getHand().getCards(StaticFilters.FILTER_CARD_LAND, game));
Cards cards = player.getHand().copy();
cards.removeIf(chosenCards.stream().map(MageItem::getId).collect(Collectors.toSet())::contains);
player.discard(cards, false, source, game);
}
return true;
}
use of mage.cards.Cards in project mage by magefree.
the class ParadoxicalOutcomeNumber method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Cards cards = new CardsImpl(source.getTargets().get(0).getTargets());
game.getState().setValue(CardUtil.getCardZoneString("ParadoxicalOutcomeEffect", source.getSourceId(), game), cards.size());
controller.moveCards(new CardsImpl(source.getTargets().get(0).getTargets()), Zone.HAND, source, game);
return true;
}
return false;
}
use of mage.cards.Cards in project mage by magefree.
the class ParoxysmEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent aura = game.getPermanent(source.getSourceId());
if (aura != null) {
Permanent creatureAttachedTo = game.getPermanent(aura.getAttachedTo());
if (creatureAttachedTo != null) {
Player controllerOfCreature = game.getPlayer(creatureAttachedTo.getControllerId());
if (controllerOfCreature != null) {
Card revealCardFromTop = controllerOfCreature.getLibrary().getFromTop(game);
if (revealCardFromTop != null) {
Cards cards = new CardsImpl(revealCardFromTop);
controllerOfCreature.revealCards(source, cards, game);
if (revealCardFromTop.isLand(game)) {
creatureAttachedTo.destroy(source, game, false);
} else {
ContinuousEffect effect = new BoostTargetEffect(3, 3, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creatureAttachedTo.getId(), game));
game.addEffect(effect, source);
}
return true;
}
}
}
}
return false;
}
use of mage.cards.Cards in project mage by magefree.
the class SawtoothLoonEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.drawCards(2, source, game);
TargetCardInHand target = new TargetCardInHand(2, 2, new FilterCard());
controller.chooseTarget(Outcome.Detriment, target, source, game);
Cards cardsToLibrary = new CardsImpl(target.getTargets());
if (!cardsToLibrary.isEmpty()) {
controller.putCardsOnBottomOfLibrary(cardsToLibrary, game, source, false);
}
return true;
}
return false;
}
use of mage.cards.Cards in project mage by magefree.
the class SchemingSymmetryEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
source.getTargets().get(0).getTargets().stream().map(playerId -> game.getPlayer(playerId)).filter(player -> player != null).forEach(player -> {
TargetCardInLibrary targetCard = new TargetCardInLibrary();
if (player.searchLibrary(targetCard, source, game)) {
Cards cards = new CardsImpl();
cards.add(targetCard.getFirstTarget());
player.shuffleLibrary(source, game);
player.putCardsOnTopOfLibrary(cards, game, source, false);
}
});
return true;
}
Aggregations