mirror of
https://github.com/correl/mage.git
synced 2024-11-16 03:00:12 +00:00
* Postmortem Lunge - Fixed that the exile effect were not applied correctly.
This commit is contained in:
parent
f5b2770c3e
commit
62a85fafc6
2 changed files with 30 additions and 32 deletions
|
@ -28,12 +28,7 @@
|
||||||
package mage.sets.newphyrexia;
|
package mage.sets.newphyrexia;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.DelayedTriggeredAbility;
|
|
||||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||||
import mage.abilities.effects.ContinuousEffect;
|
import mage.abilities.effects.ContinuousEffect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
@ -42,12 +37,18 @@ import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
|
||||||
import mage.abilities.keyword.HasteAbility;
|
import mage.abilities.keyword.HasteAbility;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.AbilityType;
|
||||||
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.filter.Filter;
|
import mage.filter.Filter;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.filter.common.FilterCreatureCard;
|
import mage.filter.common.FilterCreatureCard;
|
||||||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetCardInYourGraveyard;
|
import mage.target.common.TargetCardInYourGraveyard;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
@ -78,6 +79,7 @@ public class PostmortemLunge extends CardImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void adjustTargets(Ability ability, Game game) {
|
public void adjustTargets(Ability ability, Game game) {
|
||||||
|
if (ability.getAbilityType().equals(AbilityType.SPELL)) { // otherwise the target is also added to the delayed triggered ability
|
||||||
ability.getTargets().clear();
|
ability.getTargets().clear();
|
||||||
int xValue = ability.getManaCostsToPay().getX();
|
int xValue = ability.getManaCostsToPay().getX();
|
||||||
FilterCard filter = new FilterCreatureCard("creature card with converted mana cost " + xValue + " or less from your graveyard");
|
FilterCard filter = new FilterCreatureCard("creature card with converted mana cost " + xValue + " or less from your graveyard");
|
||||||
|
@ -85,6 +87,7 @@ public class PostmortemLunge extends CardImpl {
|
||||||
ability.getTargets().add(new TargetCardInYourGraveyard(filter));
|
ability.getTargets().add(new TargetCardInYourGraveyard(filter));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class PostmortemLungeEffect extends OneShotEffect {
|
class PostmortemLungeEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
@ -107,24 +110,22 @@ class PostmortemLungeEffect extends OneShotEffect {
|
||||||
Card card = game.getCard(source.getFirstTarget());
|
Card card = game.getCard(source.getFirstTarget());
|
||||||
|
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
Player player = game.getPlayer(card.getOwnerId());
|
Player cardOwner = game.getPlayer(card.getOwnerId());
|
||||||
if (player == null) {
|
if (cardOwner == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId());
|
|
||||||
|
|
||||||
|
if (cardOwner.moveCards(card, Zone.BATTLEFIELD, source, game)) {
|
||||||
|
Permanent permanent = game.getPermanent(card.getId());
|
||||||
|
if (permanent != null) {
|
||||||
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
|
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
|
||||||
effect.setTargetPointer(new FixedTarget(card.getId()));
|
effect.setTargetPointer(new FixedTarget(permanent, game));
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
|
ExileTargetEffect exileEffect = new ExileTargetEffect(null, null, Zone.BATTLEFIELD);
|
||||||
ExileTargetEffect exileEffect = new ExileTargetEffect();
|
exileEffect.setTargetPointer(new FixedTarget(permanent, game));
|
||||||
exileEffect.setTargetPointer(new FixedTarget(card.getId()));
|
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect), source);
|
||||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
|
}
|
||||||
delayedAbility.setSourceId(source.getSourceId());
|
}
|
||||||
delayedAbility.setControllerId(source.getControllerId());
|
|
||||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
|
||||||
game.addDelayedTriggeredAbility(delayedAbility);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,10 +115,7 @@ class DawnOfTheDeadEffect extends OneShotEffect {
|
||||||
ExileTargetEffect exileEffect = new ExileTargetEffect(null, null, Zone.BATTLEFIELD);
|
ExileTargetEffect exileEffect = new ExileTargetEffect(null, null, Zone.BATTLEFIELD);
|
||||||
exileEffect.setTargetPointer(new FixedTarget(creature, game));
|
exileEffect.setTargetPointer(new FixedTarget(creature, game));
|
||||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
|
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
|
||||||
delayedAbility.setSourceId(source.getSourceId());
|
game.addDelayedTriggeredAbility(delayedAbility, source);
|
||||||
delayedAbility.setControllerId(source.getControllerId());
|
|
||||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
|
||||||
game.addDelayedTriggeredAbility(delayedAbility);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue