From 0077484c3e4c532970d64b3bd0a29d62d6894f1b Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 10 Mar 2018 20:11:39 +0100 Subject: [PATCH] * Gilt-Leaf Archdruid - Fixed that control handling was wrong (fixes #4596). --- .../src/mage/cards/g/GiltLeafArchdruid.java | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/Mage.Sets/src/mage/cards/g/GiltLeafArchdruid.java b/Mage.Sets/src/mage/cards/g/GiltLeafArchdruid.java index ac375927a7..99a265d621 100644 --- a/Mage.Sets/src/mage/cards/g/GiltLeafArchdruid.java +++ b/Mage.Sets/src/mage/cards/g/GiltLeafArchdruid.java @@ -30,12 +30,13 @@ package mage.cards.g; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.Mode; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SpellCastControllerTriggeredAbility; import mage.abilities.costs.common.TapTargetCost; -import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.continuous.GainControlTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; @@ -48,6 +49,7 @@ import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPlayer; import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.targetpointer.FixedTarget; /** * @@ -62,7 +64,7 @@ public class GiltLeafArchdruid extends CardImpl { } public GiltLeafArchdruid(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{G}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{G}"); this.subtype.add(SubType.ELF); this.subtype.add(SubType.DRUID); @@ -73,7 +75,7 @@ public class GiltLeafArchdruid extends CardImpl { this.addAbility(new SpellCastControllerTriggeredAbility(new DrawCardSourceControllerEffect(1), filterSpell, true)); // Tap seven untapped Druids you control: Gain control of all lands target player controls. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainControlAllLandsEffect(Duration.EndOfGame), new TapTargetCost(new TargetControlledCreaturePermanent(7, 7, new FilterControlledCreaturePermanent(SubType.DRUID, "Druids you control"), true))); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GiltLeafArchdruidEffect(), new TapTargetCost(new TargetControlledCreaturePermanent(7, 7, new FilterControlledCreaturePermanent(SubType.DRUID, "Druids you control"), true))); ability.addTarget(new TargetPlayer()); this.addAbility(ability); } @@ -88,38 +90,36 @@ public class GiltLeafArchdruid extends CardImpl { } } -class GainControlAllLandsEffect extends ContinuousEffectImpl { +class GiltLeafArchdruidEffect extends OneShotEffect { - public GainControlAllLandsEffect(Duration duration) { - super(duration, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl); + public GiltLeafArchdruidEffect() { + super(Outcome.GainControl); + this.staticText = "gain control of all lands target player controls"; } - public GainControlAllLandsEffect(final GainControlAllLandsEffect effect) { + public GiltLeafArchdruidEffect(final GiltLeafArchdruidEffect effect) { super(effect); } @Override - public GainControlAllLandsEffect copy() { - return new GainControlAllLandsEffect(this); + public GiltLeafArchdruidEffect copy() { + return new GiltLeafArchdruidEffect(this); } @Override public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); - if (targetPlayer != null && targetPlayer.isInGame()) { - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_LANDS, targetPointer.getFirst(game, source), game)) { + if (controller != null && targetPlayer != null) { + for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_LANDS, targetPlayer.getId(), game)) { if (permanent != null) { - permanent.changeControllerId(source.getControllerId(), game); + ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, true); + effect.setTargetPointer(new FixedTarget(permanent, game)); + game.addEffect(effect, source); } } - } else { - discard(); + return true; } - return true; - } - - @Override - public String getText(Mode mode) { - return "Gain control of all lands target player controls"; + return false; } }