mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
- Fixed Preacher
This commit is contained in:
parent
9aae8c8db7
commit
da5058d0ab
1 changed files with 12 additions and 17 deletions
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
package mage.cards.p;
|
package mage.cards.p;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
@ -25,6 +24,7 @@ import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetOpponentsChoicePermanent;
|
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.
|
// {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 ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreacherEffect(), new TapSourceCost());
|
||||||
ability.addTarget(new TargetOpponentsChoicePermanent(1, 1, new FilterControlledCreaturePermanent(), false, true));
|
ability.addTarget(new TargetOpponentsChoicePermanent(1, 1, new FilterControlledCreaturePermanent(), false, true));
|
||||||
|
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -60,7 +59,6 @@ public final class Preacher extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class PreacherEffect extends OneShotEffect {
|
class PreacherEffect extends OneShotEffect {
|
||||||
|
|
||||||
public PreacherEffect() {
|
public PreacherEffect() {
|
||||||
|
|
@ -79,25 +77,22 @@ class PreacherEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
|
|
||||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
if (controller != null
|
||||||
|
&& sourcePermanent != null) {
|
||||||
if (controller != null && sourcePermanent != null
|
Permanent targetPermanent = game.getPermanent(source.getFirstTarget());
|
||||||
&& controller.getId().equals(sourcePermanent.getControllerId())) {
|
if (targetPermanent != null) {
|
||||||
UUID target = source.getFirstTarget();
|
SourceTappedCondition sourceTappedCondition = SourceTappedCondition.instance;
|
||||||
if (target != null && game.getPermanent(target) != null) {
|
SourceHasRemainedInSameZoneCondition conditionSourceSameZone = new SourceHasRemainedInSameZoneCondition(sourcePermanent.getId());
|
||||||
Permanent targetPermanent = game.getPermanent(target);
|
SourceHasRemainedInSameZoneCondition conditionTargetSameZone = new SourceHasRemainedInSameZoneCondition(targetPermanent.getId());
|
||||||
|
|
||||||
SourceHasRemainedInSameZoneCondition condition = new SourceHasRemainedInSameZoneCondition(sourcePermanent.getId());
|
|
||||||
SourceHasRemainedInSameZoneCondition conditionTarget = new SourceHasRemainedInSameZoneCondition(target);
|
|
||||||
|
|
||||||
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(
|
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(
|
||||||
new GainControlTargetEffect(Duration.Custom),
|
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");
|
"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);
|
game.addEffect(effect, source);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue