mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
* Gilt-Leaf Archdruid - Fixed that control handling was wrong (fixes #4596).
This commit is contained in:
parent
dac8f2dfe8
commit
0077484c3e
1 changed files with 21 additions and 21 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue