use of mage.abilities.costs.common.SacrificeTargetCost in project mage by magefree.
the class PillarTombsOfAkuEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player activePlayer = game.getPlayer(game.getActivePlayerId());
if (activePlayer == null) {
return false;
}
if (activePlayer.chooseUse(Outcome.Sacrifice, "Sacrifice a creature?", source, game)) {
Cost cost = new SacrificeTargetCost(new TargetControlledCreaturePermanent());
if (cost.canPay(source, source, activePlayer.getId(), game) && cost.pay(source, game, source, activePlayer.getId(), true)) {
return true;
}
}
activePlayer.loseLife(5, game, source, false);
return new SacrificeSourceEffect().apply(game, source);
}
use of mage.abilities.costs.common.SacrificeTargetCost in project mage by magefree.
the class RakdosRiteknifeEffect method makeAbility.
private static Ability makeAbility(Permanent permanent, Game game) {
Ability ability = new SimpleActivatedAbility(new AddCountersTargetEffect(CounterType.BLOOD.createInstance()).setText("put a blood counter on " + permanent.getName()).setTargetPointer(new FixedTarget(permanent, game)), new TapSourceCost());
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(FILTER_CONTROLLED_CREATURE_SHORT_TEXT)));
return ability;
}
use of mage.abilities.costs.common.SacrificeTargetCost in project mage by magefree.
the class SacrificeCostConvertedMana method calculate.
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
for (Cost cost : sourceAbility.getCosts()) {
if (cost instanceof SacrificeTargetCost) {
SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost;
int totalCMC = 0;
for (Permanent permanent : sacrificeCost.getPermanents()) {
totalCMC += permanent.getManaValue();
}
return totalCMC;
}
}
return 0;
}
use of mage.abilities.costs.common.SacrificeTargetCost in project mage by magefree.
the class EbonPraetorEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
for (Cost cost : source.getCosts()) {
if (cost instanceof SacrificeTargetCost) {
Permanent sacrificedCreature = ((SacrificeTargetCost) cost).getPermanents().get(0);
Permanent sourceCreature = game.getPermanent(source.getSourceId());
if (sacrificedCreature.hasSubtype(SubType.THRULL, game) && sourceCreature != null) {
sourceCreature.addCounters(CounterType.P1P0.createInstance(), source.getControllerId(), source, game);
return true;
}
}
}
return true;
}
use of mage.abilities.costs.common.SacrificeTargetCost in project mage by magefree.
the class FirecatBlitzEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
int xValue = source.getManaCostsToPay().getX();
for (Cost cost : source.getCosts()) {
if (cost instanceof SacrificeTargetCost) {
xValue = ((SacrificeTargetCost) cost).getPermanents().size();
}
}
CreateTokenEffect effect = new CreateTokenEffect(new ElementalCatToken(), xValue);
effect.apply(game, source);
for (UUID tokenId : effect.getLastAddedTokenIds()) {
Permanent tokenPermanent = game.getPermanent(tokenId);
if (tokenPermanent != null) {
ExileTargetEffect exileEffect = new ExileTargetEffect(null, "", Zone.BATTLEFIELD);
exileEffect.setTargetPointer(new FixedTarget(tokenPermanent, game));
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect), source);
}
}
return true;
}
return false;
}
Aggregations