* Gilded Drake - Fixed that the Drake had not to be sacrificed if the control did not happen.

This commit is contained in:
LevelX2 2015-07-02 22:33:40 +02:00
parent 7b4f2dd33a
commit 1a458a0837

View file

@ -55,11 +55,11 @@ import mage.target.common.TargetCreaturePermanent;
public class GildedDrake extends CardImpl { public class GildedDrake extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature an opponent controls"); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature an opponent controls");
static { static {
filter.add(new ControllerPredicate(TargetController.OPPONENT)); filter.add(new ControllerPredicate(TargetController.OPPONENT));
} }
public GildedDrake(UUID ownerId) { public GildedDrake(UUID ownerId) {
super(ownerId, 76, "Gilded Drake", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{U}"); super(ownerId, 76, "Gilded Drake", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{U}");
this.expansionSetCode = "USG"; this.expansionSetCode = "USG";
@ -72,8 +72,8 @@ public class GildedDrake extends CardImpl {
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
// When Gilded Drake enters the battlefield, exchange control of Gilded Drake and up to one target creature an opponent controls. If you don't make an exchange, sacrifice Gilded Drake. This ability can't be countered except by spells and abilities. // When Gilded Drake enters the battlefield, exchange control of Gilded Drake and up to one target creature an opponent controls. If you don't make an exchange, sacrifice Gilded Drake. This ability can't be countered except by spells and abilities.
Ability ability = new EntersBattlefieldTriggeredAbility(new GildedDrakeEffect()); Ability ability = new EntersBattlefieldTriggeredAbility(new GildedDrakeEffect());
ability.addTarget(new TargetCreaturePermanent(0,1,filter, false)); ability.addTarget(new TargetCreaturePermanent(0, 1, filter, false));
this.addAbility(ability); this.addAbility(ability);
} }
public GildedDrake(final GildedDrake card) { public GildedDrake(final GildedDrake card) {
@ -87,21 +87,21 @@ public class GildedDrake extends CardImpl {
} }
class GildedDrakeEffect extends OneShotEffect { class GildedDrakeEffect extends OneShotEffect {
public GildedDrakeEffect() { public GildedDrakeEffect() {
super(Outcome.GainControl); super(Outcome.GainControl);
this.staticText = "exchange control of {this} and up to one target creature an opponent controls. If you don't make an exchange, sacrifice {this}. This ability can't be countered except by spells and abilities"; this.staticText = "exchange control of {this} and up to one target creature an opponent controls. If you don't make an exchange, sacrifice {this}. This ability can't be countered except by spells and abilities";
} }
public GildedDrakeEffect(final GildedDrakeEffect effect) { public GildedDrakeEffect(final GildedDrakeEffect effect) {
super(effect); super(effect);
} }
@Override @Override
public GildedDrakeEffect copy() { public GildedDrakeEffect copy() {
return new GildedDrakeEffect(this); return new GildedDrakeEffect(this);
} }
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent sourceObject = game.getPermanent(source.getSourceId()); Permanent sourceObject = game.getPermanent(source.getSourceId());
@ -111,13 +111,13 @@ class GildedDrakeEffect extends OneShotEffect {
if (targetPointer.getFirst(game, source) != null) { if (targetPointer.getFirst(game, source) != null) {
targetPermanent = game.getPermanent(targetPointer.getFirst(game, source)); targetPermanent = game.getPermanent(targetPointer.getFirst(game, source));
if (targetPermanent != null) { if (targetPermanent != null) {
ContinuousEffect effect = new ExchangeControlTargetEffect(Duration.EndOfGame, "", true); ContinuousEffect effect = new ExchangeControlTargetEffect(Duration.EndOfGame, "", true);
effect.setTargetPointer(targetPointer); effect.setTargetPointer(targetPointer);
game.addEffect(effect, source); game.addEffect(effect, source);
} else { return true;
sourceObject.sacrifice(source.getSourceId(), game);
} }
} }
sourceObject.sacrifice(source.getSourceId(), game);
return true; return true;
} }
return false; return false;