Search in sources :

Example 6 with CostsImpl

use of mage.abilities.costs.CostsImpl in project mage by magefree.

the class DemonicEmbracePlayEffect method applies.

@Override
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
    if (sourceId.equals(source.getSourceId()) && source.isControlledBy(affectedControllerId)) {
        if (game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) {
            Player player = game.getPlayer(affectedControllerId);
            if (player != null) {
                Costs<Cost> costs = new CostsImpl<>();
                costs.add(new PayLifeCost(3));
                costs.add(new DiscardCardCost());
                player.setCastSourceIdWithAlternateMana(sourceId, new ManaCostsImpl<>("{1}{B}{B}"), costs);
                return true;
            }
        }
    }
    return false;
}
Also used : DiscardCardCost(mage.abilities.costs.common.DiscardCardCost) Player(mage.players.Player) CostsImpl(mage.abilities.costs.CostsImpl) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl) PayLifeCost(mage.abilities.costs.common.PayLifeCost) PayLifeCost(mage.abilities.costs.common.PayLifeCost) DiscardCardCost(mage.abilities.costs.common.DiscardCardCost) Cost(mage.abilities.costs.Cost)

Aggregations

CostsImpl (mage.abilities.costs.CostsImpl)6 Player (mage.players.Player)6 Cost (mage.abilities.costs.Cost)5 ManaCostsImpl (mage.abilities.costs.mana.ManaCostsImpl)4 PayLifeCost (mage.abilities.costs.common.PayLifeCost)3 Costs (mage.abilities.costs.Costs)1 OrCost (mage.abilities.costs.OrCost)1 DiscardCardCost (mage.abilities.costs.common.DiscardCardCost)1 ExileFromGraveCost (mage.abilities.costs.common.ExileFromGraveCost)1 SacrificeTargetCost (mage.abilities.costs.common.SacrificeTargetCost)1 ManaCost (mage.abilities.costs.mana.ManaCost)1 Card (mage.cards.Card)1 GameEvent (mage.game.events.GameEvent)1 ManaEvent (mage.game.events.ManaEvent)1 Permanent (mage.game.permanent.Permanent)1 TargetCardInYourGraveyard (mage.target.common.TargetCardInYourGraveyard)1 TargetControlledCreaturePermanent (mage.target.common.TargetControlledCreaturePermanent)1