use of mage.abilities.effects.common.SacrificeAllEffect in project mage by magefree.
the class RiteOfRuinEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Set<String> choices = new HashSet<>();
choices.add("Artifacts");
choices.add("Creatures");
choices.add("Lands");
LinkedList<CardType> order = new LinkedList<>();
ChoiceImpl choice = new ChoiceImpl(true);
choice.setMessage("Choose a card type");
choice.setChoices(choices);
while (choices.size() > 1) {
if (!controller.choose(Outcome.Sacrifice, choice, game)) {
return false;
}
order.add(getCardType(choice.getChoice()));
choices.remove(choice.getChoice());
choice.clearChoice();
}
order.add(getCardType(choices.iterator().next()));
int count = 1;
for (CardType cardType : order) {
FilterControlledPermanent filter = new FilterControlledPermanent(cardType + " you control");
filter.add(cardType.getPredicate());
new SacrificeAllEffect(count, filter).apply(game, source);
count++;
}
return true;
}
use of mage.abilities.effects.common.SacrificeAllEffect in project mage by magefree.
the class ByInvitationOnlyEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
int number = player.getAmount(0, 13, "Choose a number between 0 and 13", game);
return new SacrificeAllEffect(number, StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT).apply(game, source);
}
Aggregations