* Play card without mana - fixed that some cards did not allow to choose a casting spell from split/mdfc cards (#7410);

This commit is contained in:
Oleg Agafonov 2021-09-21 15:30:40 +04:00
parent 6bc5a00e8a
commit d35e1fbfb1
21 changed files with 54 additions and 32 deletions

View file

@ -72,7 +72,9 @@ public class CastCardFromOutsideTheGameEffect extends OneShotEffect {
if (player.choose(Outcome.Benefit, filteredCards, target, game)) {
Card card = player.getSideboard().get(target.getFirstTarget(), game);
if (card != null) {
player.cast(card.getSpellAbility(), game, true, new ApprovingObject(source, game));
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
player.cast(player.chooseAbilityForCast(card, game, true), game, true, new ApprovingObject(source, game));
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
}
}
}

View file

@ -67,7 +67,7 @@ public class HideawayPlayEffect extends OneShotEffect {
}
}
if (!controller.playCard(card, game, true, true, new ApprovingObject(source, game))) {
if (!controller.playCard(card, game, true, new ApprovingObject(source, game))) {
if (card.getZoneChangeCounter(game) == zcc) {
card.setFaceDown(true, game);
}

View file

@ -88,7 +88,7 @@ class RippleEffect extends OneShotEffect {
if (!player.chooseUse(Outcome.Neutral, "Reveal " + rippleNumber + " cards from the top of your library?", source, game)) {
return true; //fizzle
}
// reveal to/**/p cards from library
// reveal top cards from library
Cards cards = new CardsImpl();
cards.addAll(player.getLibrary().getTopCards(game, rippleNumber));
player.revealCards(sourceObject.getIdName(), cards, game);
@ -104,7 +104,10 @@ class RippleEffect extends OneShotEffect {
while (player.canRespond() && cards.count(sameNameFilter, game) > 0 && player.choose(Outcome.PlayForFree, cards, target1, game)) {
Card card = cards.get(target1.getFirstTarget(), game);
if (card != null) {
player.cast(card.getSpellAbility(), game, true, new ApprovingObject(source, game));
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
player.cast(player.chooseAbilityForCast(card, game, true), game, true, new ApprovingObject(source, game));
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
cards.remove(card);
}
target1.clearChosen();

View file

@ -449,19 +449,15 @@ public interface Player extends MageItem, Copyable<Player> {
boolean canPlayLand();
/**
* Plays a card if possible
* Plays a card (play land or cast spell). Works from any zones without timing restriction
*
* @param card the card that can be cast
* @param game
* @param noMana if it's a spell i can be cast without paying mana
* @param ignoreTiming if it's cast during the resolution of another
* spell no sorcery or play land timing restriction
* are checked. For a land it has to be the turn of
* the player playing that card.
* @param noMana if it's a spell it can be cast without paying mana
* @param approvingObject reference to the ability that allows to play the card
* @return
*/
boolean playCard(Card card, Game game, boolean noMana, boolean ignoreTiming, ApprovingObject approvingObject);
boolean playCard(Card card, Game game, boolean noMana, ApprovingObject approvingObject);
/**
* @param card the land card to play

View file

@ -1128,16 +1128,21 @@ public abstract class PlayerImpl implements Player, Serializable {
}
@Override
public boolean playCard(Card card, Game game, boolean noMana, boolean ignoreTiming, ApprovingObject approvingObject) {
public boolean playCard(Card card, Game game, boolean noMana, ApprovingObject approvingObject) {
if (card == null) {
return false;
}
// play without timing and from any zone
boolean result;
if (card.isLand(game)) {
result = playLand(card, game, ignoreTiming);
result = playLand(card, game, true);
} else {
result = cast(card.getSpellAbility(), game, noMana, approvingObject);
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
result = cast(this.chooseAbilityForCast(card, game, noMana), game, noMana, approvingObject);
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
}
if (!result) {
game.informPlayer(this, "You can't play " + card.getIdName() + '.');
}