From da5058d0ab0299ecf590147b84236000f285eecd Mon Sep 17 00:00:00 2001 From: Jeff Date: Fri, 15 Mar 2019 09:22:07 -0500 Subject: [PATCH] - Fixed Preacher --- Mage.Sets/src/mage/cards/p/Preacher.java | 29 ++++++++++-------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/Mage.Sets/src/mage/cards/p/Preacher.java b/Mage.Sets/src/mage/cards/p/Preacher.java index 75f4f6df82b..c492c3bae28 100644 --- a/Mage.Sets/src/mage/cards/p/Preacher.java +++ b/Mage.Sets/src/mage/cards/p/Preacher.java @@ -1,4 +1,3 @@ - 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; /** * @@ -33,7 +33,7 @@ import mage.target.common.TargetOpponentsChoicePermanent; public final class Preacher extends CardImpl { public Preacher(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{W}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{W}"); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.CLERIC); this.power = new MageInt(1); @@ -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;