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;
}
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;
}
Aggregations