Fixed Preacher
-
package mage.cards.p;
import java.util.UUID;
@@ -25,6 +24,7 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetOpponentsChoicePermanent;
+import mage.target.targetpointer.FixedTarget;
/**
*
@@ -45,7 +45,6 @@ public final class Preacher extends CardImpl {
// {tap}: Gain control of target creature of an opponent's choice that he or she controls for as long as Preacher remains tapped.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreacherEffect(), new TapSourceCost());
ability.addTarget(new TargetOpponentsChoicePermanent(1, 1, new FilterControlledCreaturePermanent(), false, true));
-
this.addAbility(ability);
}
@@ -60,7 +59,6 @@ public final class Preacher extends CardImpl {
}
}
-
class PreacherEffect extends OneShotEffect {
public PreacherEffect() {
@@ -79,25 +77,22 @@ class PreacherEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
-
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
Player controller = game.getPlayer(source.getControllerId());
-
-
- if (controller != null && sourcePermanent != null
- && controller.getId().equals(sourcePermanent.getControllerId())) {
- UUID target = source.getFirstTarget();
- if (target != null && game.getPermanent(target) != null) {
- Permanent targetPermanent = game.getPermanent(target);
-
- SourceHasRemainedInSameZoneCondition condition = new SourceHasRemainedInSameZoneCondition(sourcePermanent.getId());
- SourceHasRemainedInSameZoneCondition conditionTarget = new SourceHasRemainedInSameZoneCondition(target);
-
+ if (controller != null
+ && sourcePermanent != null) {
+ Permanent targetPermanent = game.getPermanent(source.getFirstTarget());
+ if (targetPermanent != null) {
+ SourceTappedCondition sourceTappedCondition = SourceTappedCondition.instance;
+ SourceHasRemainedInSameZoneCondition conditionSourceSameZone = new SourceHasRemainedInSameZoneCondition(sourcePermanent.getId());
+ SourceHasRemainedInSameZoneCondition conditionTargetSameZone = new SourceHasRemainedInSameZoneCondition(targetPermanent.getId());
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(
new GainControlTargetEffect(Duration.Custom),
- new CompoundCondition(SourceTappedCondition.instance, new CompoundCondition (condition, conditionTarget)),
+ new CompoundCondition(sourceTappedCondition, new CompoundCondition(conditionSourceSameZone, conditionTargetSameZone)),
"Gain control of target creature of an opponent's choice that he or she controls for as long as {this} remains tapped");
+ effect.setTargetPointer(new FixedTarget(targetPermanent.getId()));
game.addEffect(effect, source);
+ return true;
}
}
return false;
