Search in sources :

Example 1 with ThatcherHumanToken

use of mage.game.permanent.token.ThatcherHumanToken in project mage by magefree.

the class ThatcherRevoltEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    ThatcherHumanToken token = new ThatcherHumanToken();
    token.putOntoBattlefield(3, game, source, source.getControllerId());
    List<Permanent> toSacrifice = new ArrayList<>();
    for (UUID tokenId : token.getLastAddedTokenIds()) {
        Permanent tokenPermanent = game.getPermanent(tokenId);
        if (tokenPermanent != null) {
            toSacrifice.add(tokenPermanent);
        }
    }
    SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect();
    sacrificeEffect.setTargetPointer(new FixedTargets(toSacrifice, game));
    game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect), source);
    return true;
}
Also used : AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) Permanent(mage.game.permanent.Permanent) FixedTargets(mage.target.targetpointer.FixedTargets) ThatcherHumanToken(mage.game.permanent.token.ThatcherHumanToken) ArrayList(java.util.ArrayList) SacrificeTargetEffect(mage.abilities.effects.common.SacrificeTargetEffect) UUID(java.util.UUID)

Aggregations

ArrayList (java.util.ArrayList)1 UUID (java.util.UUID)1 AtTheBeginOfNextEndStepDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility)1 SacrificeTargetEffect (mage.abilities.effects.common.SacrificeTargetEffect)1 Permanent (mage.game.permanent.Permanent)1 ThatcherHumanToken (mage.game.permanent.token.ThatcherHumanToken)1 FixedTargets (mage.target.targetpointer.FixedTargets)1