use of mage.abilities.effects.common.SacrificeTargetEffect in project mage by magefree.
the class ThatcherRevoltEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
ThatcherHumanToken token = new ThatcherHumanToken();
token.putOntoBattlefield(3, game, source, source.getControllerId());
List<Permanent> toSacrifice = new ArrayList<>();
for (UUID tokenId : token.getLastAddedTokenIds()) {
Permanent tokenPermanent = game.getPermanent(tokenId);
if (tokenPermanent != null) {
toSacrifice.add(tokenPermanent);
}
}
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect();
sacrificeEffect.setTargetPointer(new FixedTargets(toSacrifice, game));
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect), source);
return true;
}
use of mage.abilities.effects.common.SacrificeTargetEffect in project mage by magefree.
the class WingsOfHubrisEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
MageObject equipment = game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (equipment instanceof Permanent && ((Permanent) equipment).getAttachedTo() != null) {
Permanent attachedToCreature = game.getPermanent(((Permanent) equipment).getAttachedTo());
if (attachedToCreature != null) {
ContinuousEffect effect = new CantBeBlockedTargetEffect(Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(attachedToCreature, game));
game.addEffect(effect, source);
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("sacrifice this", source.getControllerId());
sacrificeEffect.setTargetPointer(new FixedTarget(attachedToCreature, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
return true;
}
return false;
}
use of mage.abilities.effects.common.SacrificeTargetEffect in project mage by magefree.
the class ForceOfRageEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Token token = new AkoumStonewakerElementalToken();
token.putOntoBattlefield(2, game, source, source.getControllerId());
List<Permanent> permanentList = new ArrayList();
for (UUID permId : token.getLastAddedTokenIds()) {
permanentList.add(game.getPermanent(permId));
}
Effect effect = new SacrificeTargetEffect("sacrifice those tokens");
effect.setTargetPointer(new FixedTargets(permanentList, game));
game.addDelayedTriggeredAbility(new AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(effect), source);
return true;
}
use of mage.abilities.effects.common.SacrificeTargetEffect in project mage by magefree.
the class GeminiEngineCreateTokenEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
Token token;
if (permanent != null) {
token = new GeminiEngineTwinToken(permanent.getPower().getValue(), permanent.getToughness().getValue());
} else {
token = new GeminiEngineTwinToken(0, 0);
}
token.putOntoBattlefield(1, game, source, source.getControllerId(), false, true);
for (UUID tokenId : token.getLastAddedTokenIds()) {
Permanent tokenPerm = game.getPermanent(tokenId);
if (tokenPerm != null) {
Effect effect = new SacrificeTargetEffect("sacrifice " + tokenPerm.getLogName(), player.getId());
effect.setTargetPointer(new FixedTarget(tokenPerm, game));
game.addDelayedTriggeredAbility(new AtTheEndOfCombatDelayedTriggeredAbility(effect), source);
}
}
return true;
}
use of mage.abilities.effects.common.SacrificeTargetEffect in project mage by magefree.
the class HungryForMoreEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Token token = new HungryForMoreVampireToken();
token.putOntoBattlefield(1, game, source, source.getControllerId());
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new SacrificeTargetEffect().setTargetPointer(new FixedTargets(token.getLastAddedTokenIds().stream().map(game::getPermanent).collect(Collectors.toList()), game)).setText("sacrifice that token")), source);
return true;
}
Aggregations