use of mage.cards.Card in project mage by magefree.
the class MavindaStudentsAdvocateCostEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
if (!super.apply(game, source)) {
return false;
}
Card card = game.getCard(this.getTargetPointer().getFirst(game, source));
if (card == null) {
return false;
}
game.addEffect(new MavindaStudentsAdvocateCostEffect(card, game), source);
return true;
}
use of mage.cards.Card in project mage by magefree.
the class MemoryPlunderEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(getTargetPointer().getFirst(game, source));
if (card != null) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD && controller.chooseUse(Outcome.PlayForFree, "Cast " + card.getName() + " without paying cost?", source, game)) {
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true), game, true, new ApprovingObject(source, game));
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
return cardWasCast;
}
}
return false;
}
use of mage.cards.Card in project mage by magefree.
the class MemoryLeakEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Player opponent = game.getPlayer(source.getFirstTarget());
if (controller == null || opponent == null) {
return false;
}
opponent.revealCards(source, opponent.getHand(), game);
TargetCard target;
Cards cards;
if (controller.chooseUse(outcome, "Exile a card from hand or graveyard?", null, "Hand", "Graveyard", source, game)) {
FilterCard filter = new FilterNonlandCard("nonland card in " + opponent.getName() + "'s hand");
target = new TargetCard(Zone.HAND, filter);
target.setNotTarget(true);
cards = opponent.getHand();
} else {
FilterCard filter = new FilterNonlandCard("nonland card in " + opponent.getName() + "'s graveyard");
target = new TargetCard(Zone.GRAVEYARD, filter);
target.setNotTarget(true);
cards = opponent.getGraveyard();
}
if (controller.choose(outcome, cards, target, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
controller.moveCards(card, Zone.EXILED, source, game);
}
}
return true;
}
use of mage.cards.Card in project mage by magefree.
the class TargetCardInMuseVesselExile method possibleTargets.
@Override
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
Set<UUID> possibleTargets = new HashSet<>();
Card sourceCard = game.getCard(sourceId);
if (sourceCard != null) {
UUID exileId = CardUtil.getCardExileZoneId(game, sourceId);
ExileZone exile = game.getExile().getExileZone(exileId);
if (exile != null && !exile.isEmpty()) {
possibleTargets.addAll(exile);
}
}
return possibleTargets;
}
use of mage.cards.Card in project mage by magefree.
the class TargetCardInMuseVesselExile method canChoose.
@Override
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
Card sourceCard = game.getCard(sourceId);
if (sourceCard != null) {
UUID exileId = CardUtil.getCardExileZoneId(game, sourceId);
ExileZone exile = game.getExile().getExileZone(exileId);
if (exile != null && !exile.isEmpty()) {
return true;
}
}
return false;
}
Aggregations