Search in sources :

Example 26 with SacrificeTargetEffect

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;
}
Also used : AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) Permanent(mage.game.permanent.Permanent) FixedTargets(mage.target.targetpointer.FixedTargets) ThatcherHumanToken(mage.game.permanent.token.ThatcherHumanToken) ArrayList(java.util.ArrayList) SacrificeTargetEffect(mage.abilities.effects.common.SacrificeTargetEffect) UUID(java.util.UUID)

Example 27 with SacrificeTargetEffect

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;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) Permanent(mage.game.permanent.Permanent) AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) DelayedTriggeredAbility(mage.abilities.DelayedTriggeredAbility) MageObject(mage.MageObject) CantBeBlockedTargetEffect(mage.abilities.effects.common.combat.CantBeBlockedTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) SacrificeTargetEffect(mage.abilities.effects.common.SacrificeTargetEffect)

Example 28 with SacrificeTargetEffect

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;
}
Also used : Permanent(mage.game.permanent.Permanent) FixedTargets(mage.target.targetpointer.FixedTargets) AkoumStonewakerElementalToken(mage.game.permanent.token.AkoumStonewakerElementalToken) ArrayList(java.util.ArrayList) AkoumStonewakerElementalToken(mage.game.permanent.token.AkoumStonewakerElementalToken) Token(mage.game.permanent.token.Token) SacrificeTargetEffect(mage.abilities.effects.common.SacrificeTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility) SacrificeTargetEffect(mage.abilities.effects.common.SacrificeTargetEffect) UUID(java.util.UUID)

Example 29 with SacrificeTargetEffect

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;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) GeminiEngineTwinToken(mage.game.permanent.token.GeminiEngineTwinToken) GeminiEngineTwinToken(mage.game.permanent.token.GeminiEngineTwinToken) Token(mage.game.permanent.token.Token) SacrificeTargetEffect(mage.abilities.effects.common.SacrificeTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) SacrificeTargetEffect(mage.abilities.effects.common.SacrificeTargetEffect) AtTheEndOfCombatDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility) UUID(java.util.UUID)

Example 30 with SacrificeTargetEffect

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;
}
Also used : AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) FixedTargets(mage.target.targetpointer.FixedTargets) HungryForMoreVampireToken(mage.game.permanent.token.HungryForMoreVampireToken) Token(mage.game.permanent.token.Token) HungryForMoreVampireToken(mage.game.permanent.token.HungryForMoreVampireToken) SacrificeTargetEffect(mage.abilities.effects.common.SacrificeTargetEffect)

Aggregations

SacrificeTargetEffect (mage.abilities.effects.common.SacrificeTargetEffect)40 Permanent (mage.game.permanent.Permanent)35 FixedTarget (mage.target.targetpointer.FixedTarget)34 AtTheBeginOfNextEndStepDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility)31 DelayedTriggeredAbility (mage.abilities.DelayedTriggeredAbility)20 Player (mage.players.Player)19 Card (mage.cards.Card)16 OneShotEffect (mage.abilities.effects.OneShotEffect)14 ContinuousEffect (mage.abilities.effects.ContinuousEffect)13 Effect (mage.abilities.effects.Effect)13 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)13 UUID (java.util.UUID)9 FilterCard (mage.filter.FilterCard)6 Token (mage.game.permanent.token.Token)6 TargetCardInHand (mage.target.common.TargetCardInHand)6 FixedTargets (mage.target.targetpointer.FixedTargets)6 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)5 MageObject (mage.MageObject)4 BoostTargetEffect (mage.abilities.effects.common.continuous.BoostTargetEffect)4 FilterCreatureCard (mage.filter.common.FilterCreatureCard)4