use of mage.abilities.costs.common.SacrificeTargetCost in project mage by magefree.
the class ScourgeOfSkolaValeEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
for (Cost cost : source.getCosts()) {
if (cost instanceof SacrificeTargetCost) {
int amount = ((SacrificeTargetCost) cost).getPermanents().get(0).getToughness().getValue();
Player player = game.getPlayer(source.getControllerId());
if (amount > 0 && player != null) {
return new AddCountersSourceEffect(CounterType.P1P1.createInstance(amount), true).apply(game, source);
}
}
}
return false;
}
use of mage.abilities.costs.common.SacrificeTargetCost in project mage by magefree.
the class VictimizeEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
SacrificeTargetCost cost = new SacrificeTargetCost(new TargetControlledCreaturePermanent(FILTER_CONTROLLED_CREATURE_SHORT_TEXT));
if (cost.pay(source, game, source, source.getControllerId(), false, null)) {
// To end effects of the sacrificed creature
game.getState().processAction(game);
controller.moveCards(new CardsImpl(getTargetPointer().getTargets(game, source)).getCards(game), Zone.BATTLEFIELD, source, game, true, false, false, null);
}
return true;
}
return false;
}
use of mage.abilities.costs.common.SacrificeTargetCost in project mage by magefree.
the class BrutalSuppressionAdditionalCostEffect method apply.
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, true);
target.setRequired(false);
abilityToModify.addCost(new SacrificeTargetCost(target));
return true;
}
use of mage.abilities.costs.common.SacrificeTargetCost in project mage by magefree.
the class OozeToken method apply.
@Override
public boolean apply(Game game, Ability source) {
int value = 0;
for (Cost cost : source.getCosts()) {
if (cost instanceof SacrificeTargetCost) {
value = ((SacrificeTargetCost) cost).getPermanents().get(0).getPower().getValue();
}
}
Token token = new OozeToken(value);
// neccessary if token has ability like DevourAbility()
token.getAbilities().newId();
token.putOntoBattlefield(1, game, source, source.getControllerId());
return true;
}
use of mage.abilities.costs.common.SacrificeTargetCost in project mage by magefree.
the class ElderSpawnEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && sourcePermanent != null) {
TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, true);
SacrificeTargetCost cost = new SacrificeTargetCost(target);
if (!controller.chooseUse(Outcome.AIDontUseIt, "Sacrifice an Island?", source, game) || !cost.canPay(source, source, source.getControllerId(), game) || !cost.pay(source, game, source, source.getControllerId(), true)) {
sourcePermanent.sacrifice(source, game);
controller.damage(6, sourcePermanent.getId(), source, game);
}
return true;
}
return false;
}
Aggregations