use of mage.abilities.effects.common.TransformSourceEffect in project mage by magefree.
the class ProfaneProcessionEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
UUID exileId = CardUtil.getCardExileZoneId(game, source);
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && exileId != null && sourceObject != null) {
new ExileTargetEffect(exileId, sourceObject.getIdName()).setTargetPointer(targetPointer).apply(game, source);
game.getState().processAction(game);
ExileZone exileZone = game.getExile().getExileZone(exileId);
if (exileZone != null && exileZone.size() > 2) {
new TransformSourceEffect().apply(game, source);
}
return true;
}
return false;
}
use of mage.abilities.effects.common.TransformSourceEffect in project mage by magefree.
the class SearchForAzcantaLookLibraryEffect method apply.
@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().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
controller.lookAtCards(sourceObject.getIdName(), new CardsImpl(card), game);
if (controller.chooseUse(Outcome.Neutral, "Put that card into your graveyard?", source, game)) {
controller.moveCards(card, Zone.GRAVEYARD, source, game);
}
if (controller.getGraveyard().size() > 6 && controller.chooseUse(Outcome.Neutral, "Transform " + sourceObject.getLogName() + "?", source, game)) {
new TransformSourceEffect().apply(game, source);
}
}
}
return true;
}
return false;
}
use of mage.abilities.effects.common.TransformSourceEffect in project mage by magefree.
the class SmolderingEggEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
if (permanent == null) {
return false;
}
Spell spell = (Spell) getValue("spellCast");
if (spell != null) {
permanent.addCounters(CounterType.EMBER.createInstance(ManaPaidSourceWatcher.getTotalPaid(spell.getId(), game)), source.getControllerId(), source, game);
}
int counters = permanent.getCounters(game).getCount(CounterType.EMBER);
if (counters < 7) {
return true;
}
permanent.removeCounters(CounterType.EMBER.createInstance(counters), source, game);
new TransformSourceEffect().apply(game, source);
return true;
}
use of mage.abilities.effects.common.TransformSourceEffect in project mage by magefree.
the class DelverOfSecretsEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (player == null || sourcePermanent == null) {
return false;
}
if (player.getLibrary().hasCards()) {
Card card = player.getLibrary().getFromTop(game);
if (card == null) {
return false;
}
Cards cards = new CardsImpl();
cards.add(card);
player.lookAtCards(sourcePermanent.getName(), cards, game);
if (player.chooseUse(Outcome.DrawCard, "Reveal the top card of your library?", source, game)) {
player.revealCards(sourcePermanent.getName(), cards, game);
if (filter.match(card, game)) {
return new TransformSourceEffect().apply(game, source);
}
}
}
return true;
}
use of mage.abilities.effects.common.TransformSourceEffect in project mage by magefree.
the class AzorsGatewayEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
UUID exileId = CardUtil.getCardExileZoneId(game, source);
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && exileId != null && sourceObject != null) {
controller.drawCards(1, source, game);
TargetCardInHand target = new TargetCardInHand();
controller.choose(outcome, target, source.getSourceId(), game);
Card cardToExile = game.getCard(target.getFirstTarget());
if (cardToExile != null) {
controller.moveCardsToExile(cardToExile, source, game, true, exileId, sourceObject.getIdName());
}
Set<Integer> usedCMC = new HashSet<>();
ExileZone exileZone = game.getExile().getExileZone(exileId);
if (exileZone != null) {
for (Card card : exileZone.getCards(game)) {
usedCMC.add(card.getManaValue());
}
if (usedCMC.size() > 4) {
controller.gainLife(4, game, source);
new UntapSourceEffect().apply(game, source);
new TransformSourceEffect().apply(game, source);
}
}
return true;
}
return false;
}
Aggregations