use of mage.cards.Cards in project mage by magefree.
the class SearchForBlexEffect method actionWithSelectedCards.
@Override
protected void actionWithSelectedCards(Cards cards, Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
TargetCard target = new TargetCard(0, 5, Zone.LIBRARY, filter);
if (player.choose(outcome, cards, target, game)) {
Cards pickedCards = new CardsImpl(target.getTargets());
cards.removeAll(pickedCards);
player.moveCards(pickedCards, Zone.HAND, source, game);
player.loseLife(pickedCards.size() * 3, game, source, false);
}
}
}
use of mage.cards.Cards in project mage by magefree.
the class BloodOathEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
MageObject sourceObject = game.getObject(source.getSourceId());
Player player = game.getPlayer(source.getControllerId());
Player opponent = game.getPlayer(source.getFirstTarget());
if (player != null && opponent != null && sourceObject != null) {
Choice choiceImpl = new ChoiceImpl();
choiceImpl.setChoices(choice);
if (player.choose(Outcome.Neutral, choiceImpl, game)) {
CardType type = null;
String choosenType = choiceImpl.getChoice();
if (choosenType.equals(CardType.ARTIFACT.toString())) {
type = CardType.ARTIFACT;
} else if (choosenType.equals(CardType.LAND.toString())) {
type = CardType.LAND;
} else if (choosenType.equals(CardType.CREATURE.toString())) {
type = CardType.CREATURE;
} else if (choosenType.equals(CardType.ENCHANTMENT.toString())) {
type = CardType.ENCHANTMENT;
} else if (choosenType.equals(CardType.INSTANT.toString())) {
type = CardType.INSTANT;
} else if (choosenType.equals(CardType.SORCERY.toString())) {
type = CardType.SORCERY;
} else if (choosenType.equals(CardType.PLANESWALKER.toString())) {
type = CardType.PLANESWALKER;
} else if (choosenType.equals(CardType.TRIBAL.toString())) {
type = CardType.TRIBAL;
}
if (type != null) {
Cards hand = opponent.getHand();
opponent.revealCards(sourceObject.getIdName(), hand, game);
Set<Card> cards = hand.getCards(game);
int damageToDeal = 0;
for (Card card : cards) {
if (card != null && card.getCardType(game).contains(type)) {
damageToDeal += 3;
}
}
game.informPlayers(sourceObject.getLogName() + " deals " + (damageToDeal == 0 ? "no" : "" + damageToDeal) + " damage to " + opponent.getLogName());
opponent.damage(damageToDeal, source.getSourceId(), source, game);
return true;
}
}
}
return false;
}
use of mage.cards.Cards in project mage by magefree.
the class BlightHerderEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Target target = new TargetCardInExile(2, 2, filter, null);
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
if (controller.chooseTarget(outcome, target, source, game)) {
Cards cardsToGraveyard = new CardsImpl(target.getTargets());
controller.moveCards(cardsToGraveyard, Zone.GRAVEYARD, source, game);
return new CreateTokenEffect(new EldraziScionToken(), 3).apply(game, source);
}
}
return true;
}
return false;
}
use of mage.cards.Cards in project mage by magefree.
the class CartographersSurveyEffect method actionWithSelectedCards.
@Override
protected void actionWithSelectedCards(Cards cards, Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
TargetCard target = new TargetCard(0, 2, Zone.LIBRARY, StaticFilters.FILTER_CARD_LANDS);
controller.choose(outcome, cards, target, game);
Cards pickedCards = new CardsImpl(target.getTargets());
if (!pickedCards.isEmpty()) {
cards.removeAll(pickedCards);
controller.moveCards(pickedCards.getCards(game), Zone.BATTLEFIELD, source, game, true, false, false, null);
}
}
}
use of mage.cards.Cards in project mage by magefree.
the class CrosisThePurgerEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
ChoiceColor choice = new ChoiceColor();
player.choose(outcome, choice, game);
if (!choice.isChosen()) {
return false;
}
game.informPlayers(player.getLogName() + " chooses " + choice.getColor());
Player damagedPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source));
if (damagedPlayer == null) {
return false;
}
damagedPlayer.revealCards("hand of " + damagedPlayer.getName(), damagedPlayer.getHand(), game);
Cards cards = new CardsImpl(damagedPlayer.getHand().getCards(game).stream().filter(card -> card.getColor(game).shares(choice.getColor())).collect(Collectors.toSet()));
damagedPlayer.discard(cards, false, source, game);
return true;
}
Aggregations