Search in sources :

Example 1 with CantBeBlockedTargetEffect

use of mage.abilities.effects.common.combat.CantBeBlockedTargetEffect 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 2 with CantBeBlockedTargetEffect

use of mage.abilities.effects.common.combat.CantBeBlockedTargetEffect in project mage by magefree.

the class TeleportalEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
        CantBeBlockedTargetEffect effect = new CantBeBlockedTargetEffect();
        effect.setTargetPointer(new FixedTarget(creature.getId(), game));
        game.addEffect(effect, source);
    }
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) TargetControlledCreaturePermanent(mage.target.common.TargetControlledCreaturePermanent) CantBeBlockedTargetEffect(mage.abilities.effects.common.combat.CantBeBlockedTargetEffect)

Aggregations

CantBeBlockedTargetEffect (mage.abilities.effects.common.combat.CantBeBlockedTargetEffect)2 Permanent (mage.game.permanent.Permanent)2 FixedTarget (mage.target.targetpointer.FixedTarget)2 MageObject (mage.MageObject)1 DelayedTriggeredAbility (mage.abilities.DelayedTriggeredAbility)1 AtTheBeginOfNextEndStepDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility)1 ContinuousEffect (mage.abilities.effects.ContinuousEffect)1 SacrificeTargetEffect (mage.abilities.effects.common.SacrificeTargetEffect)1 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)1 TargetControlledCreaturePermanent (mage.target.common.TargetControlledCreaturePermanent)1