Search in sources :

Example 1 with WalkerToken

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

the class LucilleEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent equipment = game.getPermanent(source.getSourceId());
    if (equipment == null) {
        return false;
    }
    Player player = game.getPlayer(game.getCombat().getDefendingPlayerId(equipment.getAttachedTo(), game));
    if (player == null) {
        return false;
    }
    TargetPermanent target = new TargetControlledCreaturePermanent();
    target.setNotTarget(true);
    if (!target.canChoose(source.getSourceId(), player.getId(), game)) {
        return false;
    }
    player.choose(outcome, target, source.getSourceId(), game);
    Permanent permanent = game.getPermanent(target.getFirstTarget());
    return permanent.sacrifice(source, game) && new WalkerToken().putOntoBattlefield(1, game, source, source.getControllerId());
}
Also used : Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) TargetControlledCreaturePermanent(mage.target.common.TargetControlledCreaturePermanent) TargetPermanent(mage.target.TargetPermanent) WalkerToken(mage.game.permanent.token.WalkerToken) TargetPermanent(mage.target.TargetPermanent) TargetControlledCreaturePermanent(mage.target.common.TargetControlledCreaturePermanent)

Aggregations

Permanent (mage.game.permanent.Permanent)1 WalkerToken (mage.game.permanent.token.WalkerToken)1 Player (mage.players.Player)1 TargetPermanent (mage.target.TargetPermanent)1 TargetControlledCreaturePermanent (mage.target.common.TargetControlledCreaturePermanent)1