This commit is contained in:
jeffwadsworth 2021-08-05 15:38:39 -05:00
parent 53aababd44
commit 98aaa78081
4 changed files with 129 additions and 40 deletions

View file

@ -121,6 +121,7 @@ class IntetTheDreamerAsThoughEffect extends AsThoughEffectImpl {
@Override @Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
// note to always discard the effect if anything fails
UUID targetId = getTargetPointer().getFirst(game, source); UUID targetId = getTargetPointer().getFirst(game, source);
if (targetId == null) { if (targetId == null) {
this.discard(); this.discard();
@ -132,7 +133,7 @@ class IntetTheDreamerAsThoughEffect extends AsThoughEffectImpl {
return false; return false;
} }
// split cards // split cards, etc
objectId = card.getMainCard().getId(); objectId = card.getMainCard().getId();
if (objectId.equals(targetId) if (objectId.equals(targetId)
@ -147,7 +148,11 @@ class IntetTheDreamerAsThoughEffect extends AsThoughEffectImpl {
allowCardToPlayWithoutMana(objectId, source, affectedControllerId, game); allowCardToPlayWithoutMana(objectId, source, affectedControllerId, game);
// while Intet remains on battlefield // while Intet remains on battlefield
return new SourceRemainsInZoneCondition(Zone.BATTLEFIELD).apply(game, source); if(!(new SourceRemainsInZoneCondition(Zone.BATTLEFIELD).apply(game, source))) {
this.discard();
return false;
}
return true;
} }
return false; return false;
} }

View file

@ -2,7 +2,6 @@ package mage.cards.j;
import mage.ApprovingObject; import mage.ApprovingObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.MagecraftAbility; import mage.abilities.common.MagecraftAbility;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.condition.Condition; import mage.abilities.condition.Condition;
@ -25,6 +24,10 @@ import mage.players.Player;
import mage.target.common.TargetCardInHand; import mage.target.common.TargetCardInHand;
import java.util.UUID; import java.util.UUID;
import mage.cards.AdventureCard;
import mage.cards.ModalDoubleFacesCardHalf;
import mage.cards.SplitCard;
import mage.cards.SplitCardHalf;
/** /**
* @author TheElk801 * @author TheElk801
@ -65,8 +68,8 @@ public final class JadziOracleOfArcavios extends ModalDoubleFacesCard {
this.getRightHalfCard().getSpellAbility().addEffect(new ConditionalOneShotEffect( this.getRightHalfCard().getSpellAbility().addEffect(new ConditionalOneShotEffect(
new DoIfCostPaid( new DoIfCostPaid(
new ReturnToHandSourceEffect(), new DiscardCardCost() new ReturnToHandSourceEffect(), new DiscardCardCost()
), condition, "Then if you control eight or more lands, " + ), condition, "Then if you control eight or more lands, "
"you may discard a card. If you do, return {this} to its owner's hand." + "you may discard a card. If you do, return {this} to its owner's hand."
)); ));
this.getRightHalfCard().getSpellAbility().addHint(LandsYouControlHint.instance); this.getRightHalfCard().getSpellAbility().addHint(LandsYouControlHint.instance);
} }
@ -85,8 +88,8 @@ class JadziOracleOfArcaviosEffect extends OneShotEffect {
JadziOracleOfArcaviosEffect() { JadziOracleOfArcaviosEffect() {
super(Outcome.Benefit); super(Outcome.Benefit);
staticText = "reveal the top card of your library. If it's a nonland card, you may cast it " + staticText = "reveal the top card of your library. If it's a nonland card, you may cast it "
"by paying {1} rather than paying its mana cost. If it's a land card, put it onto the battlefield"; + "by paying {1} rather than paying its mana cost. If it's a land card, put it onto the battlefield";
} }
private JadziOracleOfArcaviosEffect(final JadziOracleOfArcaviosEffect effect) { private JadziOracleOfArcaviosEffect(final JadziOracleOfArcaviosEffect effect) {
@ -100,29 +103,92 @@ class JadziOracleOfArcaviosEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (player == null) { if (controller == null) {
return false; return false;
} }
Card card = player.getLibrary().getFromTop(game); Card card = controller.getLibrary().getFromTop(game);
if (card == null) { if (card == null) {
return false; return false;
} }
player.revealCards(source, new CardsImpl(card), game); controller.revealCards(source, new CardsImpl(card), game);
if (card.isLand(game)) { if (card.isLand(game)) {
return player.moveCards(card, Zone.BATTLEFIELD, source, game); // this is a bit wierd in game, though it works fine
// note that MDFC land cards are handled differently: they can't be moved
return controller.moveCards(card, Zone.BATTLEFIELD, source, game);
} }
if (!player.chooseUse(outcome, "Cast " + card.getName() + " by paying {1}?", source, game)) {
// query player
if (!controller.chooseUse(outcome, "Cast " + card.getName() + " by paying {1}?", source, game)) {
return false; return false;
} }
SpellAbility spellAbility = player.chooseAbilityForCast(card, game, true);
if (spellAbility == null) { // handle split-cards
return false; if (card instanceof SplitCard) {
SplitCardHalf leftHalfCard = ((SplitCard) card).getLeftHalfCard();
SplitCardHalf rightHalfCard = ((SplitCard) card).getRightHalfCard();
controller.setCastSourceIdWithAlternateMana(leftHalfCard.getId(), new ManaCostsImpl<>("{1}"), null);
controller.setCastSourceIdWithAlternateMana(rightHalfCard.getId(), new ManaCostsImpl<>("{1}"), null);
} }
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
player.setCastSourceIdWithAlternateMana(card.getId(), new ManaCostsImpl<>("{1}"), null); // handle MDFC
player.cast(spellAbility, game, false, new ApprovingObject(source, game)); if (card instanceof ModalDoubleFacesCard) {
ModalDoubleFacesCardHalf leftHalfCard = ((ModalDoubleFacesCard) card).getLeftHalfCard();
ModalDoubleFacesCardHalf rightHalfCard = ((ModalDoubleFacesCard) card).getRightHalfCard();
// some MDFC cards are lands. IE: sea gate restoration
if (!leftHalfCard.isLand(game)) {
controller.setCastSourceIdWithAlternateMana(leftHalfCard.getId(), new ManaCostsImpl<>("{1}"), null);
}
if (!rightHalfCard.isLand(game)) {
controller.setCastSourceIdWithAlternateMana(rightHalfCard.getId(), new ManaCostsImpl<>("{1}"), null);
}
game.getState().setValue("PlayFromNotOwnHandZone" + ((ModalDoubleFacesCard) card).getLeftHalfCard().getId(), Boolean.TRUE);
game.getState().setValue("PlayFromNotOwnHandZone" + ((ModalDoubleFacesCard) card).getRightHalfCard().getId(), Boolean.TRUE);
}
// handle adventure cards
if (card instanceof AdventureCard) {
Card creatureCard = card.getMainCard();
Card spellCard = ((AdventureCard) card).getSpellCard();
controller.setCastSourceIdWithAlternateMana(creatureCard.getId(), new ManaCostsImpl<>("{1}"), null);
controller.setCastSourceIdWithAlternateMana(spellCard.getId(), new ManaCostsImpl<>("{1}"), null);
game.getState().setValue("PlayFromNotOwnHandZone" + creatureCard.getId(), Boolean.TRUE);
game.getState().setValue("PlayFromNotOwnHandZone" + spellCard.getId(), Boolean.TRUE);
}
// normal card
if (!(card instanceof SplitCard)
|| !(card instanceof ModalDoubleFacesCard)
|| !(card instanceof AdventureCard)) {
controller.setCastSourceIdWithAlternateMana(card.getMainCard().getId(), new ManaCostsImpl<>("{1}"), null);
}
// cast it
controller.cast(controller.chooseAbilityForCast(card.getMainCard(), game, false),
game, false, new ApprovingObject(source, game));
// turn off effect after cast on every possible card-face
if (card instanceof SplitCard) {
SplitCardHalf leftHalfCard = ((SplitCard) card).getLeftHalfCard();
SplitCardHalf rightHalfCard = ((SplitCard) card).getRightHalfCard();
game.getState().setValue("PlayFromNotOwnHandZone" + leftHalfCard.getId(), null);
game.getState().setValue("PlayFromNotOwnHandZone" + rightHalfCard.getId(), null);
}
if (card instanceof ModalDoubleFacesCard) {
ModalDoubleFacesCardHalf leftHalfCard = ((ModalDoubleFacesCard) card).getLeftHalfCard();
ModalDoubleFacesCardHalf rightHalfCard = ((ModalDoubleFacesCard) card).getRightHalfCard();
game.getState().setValue("PlayFromNotOwnHandZone" + leftHalfCard.getId(), null);
game.getState().setValue("PlayFromNotOwnHandZone" + rightHalfCard.getId(), null);
}
if (card instanceof AdventureCard) {
Card creatureCard = card.getMainCard();
Card spellCard = ((AdventureCard) card).getSpellCard();
game.getState().setValue("PlayFromNotOwnHandZone" + creatureCard.getId(), null);
game.getState().setValue("PlayFromNotOwnHandZone" + spellCard.getId(), null);
}
// turn off effect on a normal card
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null); game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
return true; return true;
} }
} }

View file

@ -10,6 +10,7 @@ import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.UUID; import java.util.UUID;
import mage.cards.AdventureCard;
/** /**
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
@ -69,12 +70,14 @@ public abstract class AsThoughEffectImpl extends ContinuousEffectImpl implements
} }
/** /**
* Internal method to do the neccessary to allow the card from objectId to be cast or played (if it's a land) without paying any mana. * Internal method to do the necessary to allow the card from objectId to be
* Additional costs (like sacrificing or discarding) have still to be payed. * cast or played (if it's a land) without paying any mana. Additional costs
* Checks if the card is of the correct type or in the correct zone have to be done before. * (like sacrificing or discarding) have still to be payed. Checks if the
* card is of the correct type or in the correct zone have to be done
* before.
* *
* @param objectId sourceId of the card to play * @param objectId sourceId of the card to play
* @param source source ability that allows this effect * @param source source ability that allows this effect
* @param affectedControllerId player allowed to play the card * @param affectedControllerId player allowed to play the card
* @param game * @param game
* @return * @return
@ -93,12 +96,21 @@ public abstract class AsThoughEffectImpl extends ContinuousEffectImpl implements
player.setCastSourceIdWithAlternateMana(rightCard.getId(), null, rightCard.getSpellAbility().getCosts()); player.setCastSourceIdWithAlternateMana(rightCard.getId(), null, rightCard.getSpellAbility().getCosts());
} else if (card instanceof ModalDoubleFacesCard) { } else if (card instanceof ModalDoubleFacesCard) {
Card leftCard = ((ModalDoubleFacesCard) card).getLeftHalfCard(); Card leftCard = ((ModalDoubleFacesCard) card).getLeftHalfCard();
player.setCastSourceIdWithAlternateMana(leftCard.getId(), null, leftCard.getSpellAbility().getCosts());
Card rightCard = ((ModalDoubleFacesCard) card).getRightHalfCard(); Card rightCard = ((ModalDoubleFacesCard) card).getRightHalfCard();
player.setCastSourceIdWithAlternateMana(rightCard.getId(), null, rightCard.getSpellAbility().getCosts()); // some MDFC's are land. IE: sea gate restoration
} else { if (!leftCard.isLand(game)) {
player.setCastSourceIdWithAlternateMana(objectId, null, card.getSpellAbility().getCosts()); player.setCastSourceIdWithAlternateMana(leftCard.getId(), null, leftCard.getSpellAbility().getCosts());
}
if (!rightCard.isLand(game)) {
player.setCastSourceIdWithAlternateMana(rightCard.getId(), null, rightCard.getSpellAbility().getCosts());
}
} else if (card instanceof AdventureCard) {
Card creatureCard = card.getMainCard();
Card spellCard = ((AdventureCard) card).getSpellCard();
player.setCastSourceIdWithAlternateMana(creatureCard.getId(), null, creatureCard.getSpellAbility().getCosts());
player.setCastSourceIdWithAlternateMana(spellCard.getId(), null, spellCard.getSpellAbility().getCosts());
} }
player.setCastSourceIdWithAlternateMana(objectId, null, card.getSpellAbility().getCosts());
} }
return true; return true;
} }

View file

@ -231,21 +231,27 @@ public class ForetellAbility extends SpecialAction {
} else if (card instanceof ModalDoubleFacesCard) { } else if (card instanceof ModalDoubleFacesCard) {
if (foretellCost != null) { if (foretellCost != null) {
ModalDoubleFacesCardHalf leftHalfCard = ((ModalDoubleFacesCard) card).getLeftHalfCard(); ModalDoubleFacesCardHalf leftHalfCard = ((ModalDoubleFacesCard) card).getLeftHalfCard();
ForetellCostAbility ability = new ForetellCostAbility(foretellCost); // some MDFC's are land IE: sea gate restoration
ability.setSourceId(leftHalfCard.getId()); if (!leftHalfCard.isLand(game)) {
ability.setControllerId(source.getControllerId()); ForetellCostAbility ability = new ForetellCostAbility(foretellCost);
ability.setSpellAbilityType(leftHalfCard.getSpellAbility().getSpellAbilityType()); ability.setSourceId(leftHalfCard.getId());
ability.setAbilityName(leftHalfCard.getName()); ability.setControllerId(source.getControllerId());
game.getState().addOtherAbility(leftHalfCard, ability); ability.setSpellAbilityType(leftHalfCard.getSpellAbility().getSpellAbilityType());
ability.setAbilityName(leftHalfCard.getName());
game.getState().addOtherAbility(leftHalfCard, ability);
}
} }
if (foretellSplitCost != null) { if (foretellSplitCost != null) {
ModalDoubleFacesCardHalf rightHalfCard = ((ModalDoubleFacesCard) card).getRightHalfCard(); ModalDoubleFacesCardHalf rightHalfCard = ((ModalDoubleFacesCard) card).getRightHalfCard();
ForetellCostAbility ability = new ForetellCostAbility(foretellSplitCost); // some MDFC's are land IE: sea gate restoration
ability.setSourceId(rightHalfCard.getId()); if (!rightHalfCard.isLand(game)) {
ability.setControllerId(source.getControllerId()); ForetellCostAbility ability = new ForetellCostAbility(foretellSplitCost);
ability.setSpellAbilityType(rightHalfCard.getSpellAbility().getSpellAbilityType()); ability.setSourceId(rightHalfCard.getId());
ability.setAbilityName(rightHalfCard.getName()); ability.setControllerId(source.getControllerId());
game.getState().addOtherAbility(rightHalfCard, ability); ability.setSpellAbilityType(rightHalfCard.getSpellAbility().getSpellAbilityType());
ability.setAbilityName(rightHalfCard.getName());
game.getState().addOtherAbility(rightHalfCard, ability);
}
} }
} else if (card instanceof AdventureCard) { } else if (card instanceof AdventureCard) {
if (foretellCost != null) { if (foretellCost != null) {