use of mage.choices.ChoiceCreatureType in project mage by magefree.
the class PacksDisdainEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Choice typeChoice = new ChoiceCreatureType(game.getObject(source.getSourceId()));
if (player != null && player.choose(Outcome.UnboostCreature, typeChoice, game)) {
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
filter.add(SubType.byDescription(typeChoice.getChoice()).getPredicate());
DynamicValue negativePermanentsCount = new PermanentsOnBattlefieldCount(filter, -1);
ContinuousEffect effect = new BoostTargetEffect(negativePermanentsCount, negativePermanentsCount, Duration.EndOfTurn, true);
effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
game.addEffect(effect, source);
return true;
}
return false;
}
use of mage.choices.ChoiceCreatureType in project mage by magefree.
the class RiptideShapeshifterEffect 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) {
Choice choice = new ChoiceCreatureType(sourceObject);
if (!controller.choose(Outcome.BoostCreature, choice, game)) {
return false;
}
Cards revealedCards = new CardsImpl();
for (Card card : controller.getLibrary().getCards(game)) {
if (card.isCreature(game) && card.hasSubtype(SubType.byDescription(choice.getChoice()), game)) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
break;
}
revealedCards.add(card);
}
controller.revealCards(sourceObject.getIdName(), revealedCards, game);
controller.moveCards(revealedCards, Zone.LIBRARY, source, game);
controller.shuffleLibrary(source, game);
return true;
}
return false;
}
use of mage.choices.ChoiceCreatureType in project mage by magefree.
the class RiptideChronologistEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (player != null && sourceObject != null) {
Choice typeChoice = new ChoiceCreatureType(sourceObject);
if (player.choose(outcome, typeChoice, game)) {
game.informPlayers(sourceObject.getLogName() + " chosen type: " + typeChoice.getChoice());
FilterCreaturePermanent filterCreaturePermanent = new FilterCreaturePermanent();
filterCreaturePermanent.add(SubType.byDescription(typeChoice.getChoice()).getPredicate());
for (Permanent creature : game.getBattlefield().getActivePermanents(filterCreaturePermanent, source.getSourceId(), game)) {
creature.untap(game);
}
return true;
}
}
return false;
}
use of mage.choices.ChoiceCreatureType in project mage by magefree.
the class MistformSliverEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId());
if (player != null && permanent != null) {
Choice typeChoice = new ChoiceCreatureType(permanent);
if (!player.choose(Outcome.Detriment, typeChoice, game)) {
return false;
}
game.informPlayers(permanent.getName() + ": " + player.getLogName() + " has chosen " + typeChoice.getChoice());
ContinuousEffect effect = new AddCardSubTypeTargetEffect(SubType.byDescription(typeChoice.getChoice()), Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
}
return false;
}
use of mage.choices.ChoiceCreatureType in project mage by magefree.
the class TribalUnityEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
MageObject sourceObject = game.getObject(source.getSourceId());
if (sourceObject == null) {
return false;
}
Player player = game.getPlayer(source.getControllerId());
Choice typeChoice = new ChoiceCreatureType(sourceObject);
if (player != null && player.choose(outcome, typeChoice, game)) {
int boost = amount.calculate(game, source, this);
if (typeChoice.getChoice() != null) {
game.informPlayers(sourceObject.getLogName() + " chosen type: " + typeChoice.getChoice());
}
FilterCreaturePermanent filterCreaturePermanent = new FilterCreaturePermanent();
filterCreaturePermanent.add(SubType.byDescription(typeChoice.getChoice()).getPredicate());
game.addEffect(new BoostAllEffect(boost, boost, Duration.EndOfTurn, filterCreaturePermanent, false), source);
return true;
}
return false;
}
Aggregations