forked from External/mage
Modal double-faced cards - fixed game error on usage with some replacement effects (example: Diluvian Primordial, closes #12176) (#12184)
This commit is contained in:
parent
1ae48593a8
commit
36d6547bf8
10 changed files with 339 additions and 38 deletions
|
|
@ -1,6 +1,5 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.ApprovingObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
|
|
@ -115,8 +114,7 @@ public class MayCastTargetCardEffect extends OneShotEffect {
|
|||
|
||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
|
||||
boolean noMana = manaAdjustment == CastManaAdjustment.WITHOUT_PAYING_MANA_COST;
|
||||
controller.cast(controller.chooseAbilityForCast(card, game, noMana),
|
||||
game, noMana, new ApprovingObject(source, game));
|
||||
CardUtil.castSingle(controller, source, game, card, noMana, null);
|
||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
||||
} else {
|
||||
// TODO: support (and add tests!) for the non-NONE manaAdjustment
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package mage.abilities.effects.common.replacement;
|
|||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
|
|
@ -50,9 +51,21 @@ public class ThatSpellGraveyardExileReplacementEffect extends ReplacementEffectI
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
return zEvent.getToZone() == Zone.GRAVEYARD
|
||||
&& zEvent.getTargetId().equals(((FixedTarget) getTargetPointer()).getTarget())
|
||||
&& ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1
|
||||
== game.getState().getZoneChangeCounter(zEvent.getTargetId());
|
||||
if (zEvent.getToZone() != Zone.GRAVEYARD) {
|
||||
return false;
|
||||
}
|
||||
Card cardMoving = game.getCard(zEvent.getTargetId());
|
||||
Card cardTarget = game.getCard(((FixedTarget) getTargetPointer()).getTarget());
|
||||
if (cardMoving == null || cardTarget == null) {
|
||||
return false;
|
||||
}
|
||||
// for MDFC.
|
||||
Card mainCardMoving = cardMoving.getMainCard();
|
||||
Card mainCardTarget = cardTarget.getMainCard();
|
||||
return mainCardMoving != null
|
||||
&& mainCardTarget != null
|
||||
&& mainCardMoving.getId().equals(mainCardTarget.getId())
|
||||
&& ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1
|
||||
== game.getState().getZoneChangeCounter(mainCardMoving.getId());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue