fixed Goryo's Vengeance targeting noncreature legendary cards (fixes #5992)

This commit is contained in:
Evan Kranzler 2019-09-18 08:07:04 -04:00
parent 3f125dcca7
commit c6b95b02d2

View file

@ -1,4 +1,3 @@
package mage.cards.g;
import mage.abilities.Ability;
@ -16,6 +15,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -26,19 +26,18 @@ import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class GoryosVengeance extends CardImpl {
private static final FilterCard filter = new FilterCard("legendary creature card");
private static final FilterCard filter = new FilterCreatureCard("legendary creature card");
static {
filter.add(new SupertypePredicate(SuperType.LEGENDARY));
}
public GoryosVengeance(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{B}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{B}");
this.subtype.add(SubType.ARCANE);
// Return target legendary creature card from your graveyard to the battlefield. That creature gains haste. Exile it at the beginning of the next end step.
@ -49,7 +48,7 @@ public final class GoryosVengeance extends CardImpl {
this.addAbility(new SpliceOntoArcaneAbility("{2}{B}"));
}
public GoryosVengeance(final GoryosVengeance card) {
private GoryosVengeance(final GoryosVengeance card) {
super(card);
}
@ -61,12 +60,12 @@ public final class GoryosVengeance extends CardImpl {
class GoryosVengeanceEffect extends OneShotEffect {
public GoryosVengeanceEffect() {
GoryosVengeanceEffect() {
super(Outcome.PutCardInPlay);
this.staticText = "Return target legendary creature card from your graveyard to the battlefield. That creature gains haste. Exile it at the beginning of the next end step";
}
public GoryosVengeanceEffect(final GoryosVengeanceEffect effect) {
private GoryosVengeanceEffect(final GoryosVengeanceEffect effect) {
super(effect);
}
@ -78,27 +77,27 @@ class GoryosVengeanceEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Card card = game.getCard(targetPointer.getFirst(game, source));
if (card != null) {
if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) {
// Haste
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
// Exile it at end of turn
Effect exileEffect = new ExileTargetEffect("Exile " + permanent.getName() + " at the beginning of the next end step");
exileEffect.setTargetPointer(new FixedTarget(permanent, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
}
}
if (controller == null) {
return false;
}
return false;
Card card = game.getCard(targetPointer.getFirst(game, source));
if (card == null || !controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
return false;
}
Permanent permanent = game.getPermanent(card.getId());
if (permanent == null) {
return false;
}
// Haste
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
// Exile it at end of turn
Effect exileEffect = new ExileTargetEffect("Exile " + permanent.getName() + " at the beginning of the next end step");
exileEffect.setTargetPointer(new FixedTarget(permanent, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
}