use of mage.game.permanent.token.BeastToken in project mage by magefree.
the class WildEndeavorEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
List<Integer> results = controller.rollDice(outcome, source, game, 4, 2, 0);
int firstResult = results.get(0);
int secondResult = results.get(1);
int first, second;
if (firstResult != secondResult && controller.chooseUse(outcome, "Choose the amount of 3/3 green Beast creature tokens.", "The other number is the amount of basic lands you search from your library and put on the battlefield tapped.", "" + firstResult, "" + secondResult, source, game)) {
first = firstResult;
second = secondResult;
} else {
first = secondResult;
second = firstResult;
}
new BeastToken().putOntoBattlefield(first, game, source, source.getControllerId());
TargetCardInLibrary target = new TargetCardInLibrary(0, second, StaticFilters.FILTER_CARD_BASIC_LAND);
controller.searchLibrary(target, source, game);
Set<Card> cards = target.getTargets().stream().map(game::getCard).filter(Objects::nonNull).collect(Collectors.toSet());
controller.moveCards(cards, Zone.BATTLEFIELD, source, game, true, false, false, null);
controller.shuffleLibrary(source, game);
return true;
}
use of mage.game.permanent.token.BeastToken in project mage by magefree.
the class SawtuskDemolisherEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return false;
}
Player player = game.getPlayer(permanent.getControllerId());
permanent.destroy(source, game, false);
if (player == null) {
return false;
}
Effect effect = new CreateTokenTargetEffect(new BeastToken());
effect.setTargetPointer(new FixedTarget(player.getId(), game));
return effect.apply(game, source);
}
Aggregations