use of mage.abilities.condition.common.SourceTappedCondition in project mage by magefree.
the class PreacherEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
Permanent targetPermanent = game.getPermanent(source.getFirstTarget());
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && sourcePermanent != null && targetPermanent != null) {
SourceTappedCondition sourceTappedCondition = SourceTappedCondition.TAPPED;
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(new GainControlTargetEffect(Duration.Custom), sourceTappedCondition, "Gain control of target creature of an opponent's choice that they control for as long as {this} remains tapped");
effect.setTargetPointer(new FixedTarget(targetPermanent.getId(), game));
game.addEffect(effect, source);
return true;
}
return false;
}
Aggregations