use of mage.abilities.effects.keyword.ManifestEffect in project mage by magefree.
the class WildcallEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
new ManifestEffect(1).apply(game, source);
int xValue = source.getManaCostsToPay().getX();
if (xValue > 0) {
Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(xValue));
effect.setTargetPointer(new FixedTarget(card.getId()));
return effect.apply(game, source);
}
}
return true;
}
return false;
}
use of mage.abilities.effects.keyword.ManifestEffect in project mage by magefree.
the class BecomesAuraAttachToManifestSourceEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent enchantment = game.getPermanent(source.getSourceId());
if (controller != null && enchantment != null) {
// manifest top card
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
new ManifestEffect(1).apply(game, source);
Permanent enchantedCreature = game.getPermanent(card.getId());
if (enchantedCreature != null) {
enchantedCreature.addAttachment(enchantment.getId(), source, game);
FilterCreaturePermanent filter = new FilterCreaturePermanent();
Target target = new TargetCreaturePermanent(filter);
target.addTarget(enchantedCreature.getId(), source, game);
game.addEffect(new BecomesAuraSourceEffect(target), source);
}
}
return true;
}
return false;
}
use of mage.abilities.effects.keyword.ManifestEffect in project mage by magefree.
the class FierceInvocationEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
new ManifestEffect(1).apply(game, source);
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) {
Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(2));
effect.setTargetPointer(new FixedTarget(permanent, game));
return effect.apply(game, source);
}
}
return true;
}
return false;
}
use of mage.abilities.effects.keyword.ManifestEffect in project mage by magefree.
the class FormlessNurturingEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
new ManifestEffect(1).apply(game, source);
Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance());
effect.setTargetPointer(new FixedTarget(card.getId()));
return effect.apply(game, source);
}
return true;
}
return false;
}
use of mage.abilities.effects.keyword.ManifestEffect in project mage by magefree.
the class WriteIntoBeingEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (sourceObject != null && controller != null) {
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 2));
controller.lookAtCards(source, null, cards, game);
Card cardToManifest = null;
if (cards.size() > 1) {
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to manifest"));
if (controller.chooseTarget(outcome, cards, target, source, game)) {
cardToManifest = cards.get(target.getFirstTarget(), game);
}
} else {
cardToManifest = cards.getRandom(game);
}
if (!controller.getLibrary().getFromTop(game).equals(cardToManifest)) {
Card cardToPutBack = controller.getLibrary().removeFromTop(game);
cardToManifest = controller.getLibrary().removeFromTop(game);
controller.getLibrary().putOnTop(cardToPutBack, game);
controller.getLibrary().putOnTop(cardToManifest, game);
}
new ManifestEffect(1).apply(game, source);
if (controller.getLibrary().hasCards()) {
Card cardToPutBack = controller.getLibrary().getFromTop(game);
if (controller.chooseUse(Outcome.Detriment, "Put " + cardToPutBack.getName() + " on bottom of library?", source, game)) {
controller.putCardsOnBottomOfLibrary(cardToPutBack, game, source, true);
} else {
controller.putCardsOnTopOfLibrary(cardToPutBack, game, source, true);
}
}
return true;
}
return false;
}
Aggregations