Search in sources :

Example 1 with WasitoraCatDragonToken

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

the class WasitoraNekoruQueenEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player damagedPlayer = game.getPlayer(targetPointer.getFirst(game, source));
    Player controller = game.getPlayer(source.getControllerId());
    if (damagedPlayer != null && controller != null) {
        FilterControlledPermanent filter = new FilterControlledPermanent("creature");
        filter.add(CardType.CREATURE.getPredicate());
        TargetPermanent target = new TargetPermanent(1, 1, filter, true);
        if (damagedPlayer.choose(Outcome.Sacrifice, target, source.getSourceId(), game)) {
            Permanent objectToBeSacrificed = game.getPermanent(target.getFirstTarget());
            if (objectToBeSacrificed != null) {
                if (objectToBeSacrificed.sacrifice(source, game)) {
                    return true;
                }
            }
        }
        new CreateTokenEffect(new WasitoraCatDragonToken()).apply(game, source);
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) FilterControlledPermanent(mage.filter.common.FilterControlledPermanent) Permanent(mage.game.permanent.Permanent) TargetPermanent(mage.target.TargetPermanent) WasitoraCatDragonToken(mage.game.permanent.token.WasitoraCatDragonToken) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) TargetPermanent(mage.target.TargetPermanent) FilterControlledPermanent(mage.filter.common.FilterControlledPermanent)

Aggregations

CreateTokenEffect (mage.abilities.effects.common.CreateTokenEffect)1 FilterControlledPermanent (mage.filter.common.FilterControlledPermanent)1 Permanent (mage.game.permanent.Permanent)1 WasitoraCatDragonToken (mage.game.permanent.token.WasitoraCatDragonToken)1 Player (mage.players.Player)1 TargetPermanent (mage.target.TargetPermanent)1