* Postmortem Lunge and Gruesome Encorer - Fixed that the haste ability was not correctly granted to the creature put into play.

This commit is contained in:
LevelX2 2015-05-07 00:17:42 +02:00
parent fbbc9dcb10
commit 27d4e9fc37
2 changed files with 22 additions and 12 deletions

View file

@ -36,9 +36,11 @@ import mage.constants.Zone;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
@ -61,9 +63,9 @@ public class GruesomeEncore extends CardImpl {
super(ownerId, 44, "Gruesome Encore", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{2}{B}");
this.expansionSetCode = "MBS";
this.color.setBlack(true);
// Put target creature card from an opponent's graveyard onto the battlefield under your control. It gains haste.
this.getSpellAbility().addEffect(new GruesomeEncoreEffect());
// Exile it at the beginning of the next end step. If that creature would leave the battlefield, exile it instead of putting it anywhere else.
this.getSpellAbility().addEffect(new GruesomeEncoreReplacementEffect());
this.getSpellAbility().addTarget(new TargetCardInOpponentsGraveyard(filter));
}
@ -98,9 +100,12 @@ class GruesomeEncoreEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Card card = game.getCard(source.getFirstTarget());
if (card != null) {
game.getState().addOtherAbility(card, HasteAbility.getInstance());
card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId());
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
effect.setTargetPointer(new FixedTarget(card.getId()));
game.addEffect(effect, source);
ExileTargetEffect exileEffect = new ExileTargetEffect();
exileEffect.setTargetPointer(new FixedTarget(card.getId()));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
@ -141,15 +146,16 @@ class GruesomeEncoreReplacementEffect extends ReplacementEffectImpl {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE
&& event.getTargetId().equals(source.getFirstTarget())
return event.getTargetId().equals(source.getFirstTarget())
&& ((ZoneChangeEvent) event).getFromZone().equals(Zone.BATTLEFIELD)
&& !((ZoneChangeEvent) event).getToZone().equals(Zone.EXILED)) {
return true;
}
return false;
&& !((ZoneChangeEvent) event).getToZone().equals(Zone.EXILED);
}
@Override

View file

@ -35,11 +35,14 @@ import mage.constants.Zone;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.Duration;
import mage.filter.Filter;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
@ -59,8 +62,6 @@ public class PostmortemLunge extends CardImpl {
super(ownerId, 70, "Postmortem Lunge", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{X}{BP}");
this.expansionSetCode = "NPH";
this.color.setBlack(true);
// Return target creature card with converted mana cost X from your graveyard to the battlefield. It gains haste. Exile it at the beginning of the next end step.
this.getSpellAbility().addEffect(new PostmortemLungeEffect());
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(new FilterCreatureCard("creature card from your graveyard")));
@ -110,9 +111,12 @@ class PostmortemLungeEffect extends OneShotEffect {
if (player == null) {
return false;
}
game.getState().addOtherAbility(card, HasteAbility.getInstance());
card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId());
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
effect.setTargetPointer(new FixedTarget(card.getId()));
game.addEffect(effect, source);
ExileTargetEffect exileEffect = new ExileTargetEffect();
exileEffect.setTargetPointer(new FixedTarget(card.getId()));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);