Search in sources :

Example 51 with SacrificeTargetCost

use of mage.abilities.costs.common.SacrificeTargetCost in project mage by magefree.

the class DiscipleOfGriselbrandEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    int amount = 0;
    for (Cost cost : source.getCosts()) {
        if (cost instanceof SacrificeTargetCost) {
            amount = ((SacrificeTargetCost) cost).getPermanents().get(0).getToughness().getValue();
            Player player = game.getPlayer(source.getControllerId());
            if (amount > 0 && player != null) {
                player.gainLife(amount, game, source);
                return true;
            }
        }
    }
    return false;
}
Also used : SacrificeTargetCost(mage.abilities.costs.common.SacrificeTargetCost) Player(mage.players.Player) Cost(mage.abilities.costs.Cost) SacrificeTargetCost(mage.abilities.costs.common.SacrificeTargetCost) GenericManaCost(mage.abilities.costs.mana.GenericManaCost)

Aggregations

SacrificeTargetCost (mage.abilities.costs.common.SacrificeTargetCost)51 Cost (mage.abilities.costs.Cost)38 Player (mage.players.Player)37 Permanent (mage.game.permanent.Permanent)30 TargetControlledCreaturePermanent (mage.target.common.TargetControlledCreaturePermanent)25 TargetControlledPermanent (mage.target.common.TargetControlledPermanent)13 Card (mage.cards.Card)12 UUID (java.util.UUID)11 FilterCard (mage.filter.FilterCard)8 TargetCardInLibrary (mage.target.common.TargetCardInLibrary)8 TapSourceCost (mage.abilities.costs.common.TapSourceCost)7 ManaValuePredicate (mage.filter.predicate.mageobject.ManaValuePredicate)7 GenericManaCost (mage.abilities.costs.mana.GenericManaCost)4 CardsImpl (mage.cards.CardsImpl)4 FilterControlledCreaturePermanent (mage.filter.common.FilterControlledCreaturePermanent)4 FilterControlledPermanent (mage.filter.common.FilterControlledPermanent)4 MageObject (mage.MageObject)3 Ability (mage.abilities.Ability)3 FilterControlledLandPermanent (mage.filter.common.FilterControlledLandPermanent)3 TargetPlayer (mage.target.TargetPlayer)3