Search in sources :

Example 1 with BeastToken

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;
}
Also used : Player(mage.players.Player) BeastToken(mage.game.permanent.token.BeastToken) TargetCardInLibrary(mage.target.common.TargetCardInLibrary) Card(mage.cards.Card)

Example 2 with BeastToken

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);
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) FilterPermanent(mage.filter.FilterPermanent) Permanent(mage.game.permanent.Permanent) TargetPermanent(mage.target.TargetPermanent) CreateTokenTargetEffect(mage.abilities.effects.common.CreateTokenTargetEffect) BeastToken(mage.game.permanent.token.BeastToken) OneShotEffect(mage.abilities.effects.OneShotEffect) CreateTokenTargetEffect(mage.abilities.effects.common.CreateTokenTargetEffect) Effect(mage.abilities.effects.Effect)

Aggregations

BeastToken (mage.game.permanent.token.BeastToken)2 Player (mage.players.Player)2 Effect (mage.abilities.effects.Effect)1 OneShotEffect (mage.abilities.effects.OneShotEffect)1 CreateTokenTargetEffect (mage.abilities.effects.common.CreateTokenTargetEffect)1 Card (mage.cards.Card)1 FilterPermanent (mage.filter.FilterPermanent)1 Permanent (mage.game.permanent.Permanent)1 TargetPermanent (mage.target.TargetPermanent)1 TargetCardInLibrary (mage.target.common.TargetCardInLibrary)1 FixedTarget (mage.target.targetpointer.FixedTarget)1