mirror of
https://github.com/correl/mage.git
synced 2024-12-30 19:10:36 +00:00
* 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:
parent
6bc5a00e8a
commit
d35e1fbfb1
21 changed files with 54 additions and 32 deletions
|
@ -110,8 +110,7 @@ class BrilliantUltimatumEffect extends OneShotEffect {
|
|||
TargetCard targetExiledCard = new TargetCard(Zone.EXILED, new FilterCard());
|
||||
if (controller.chooseTarget(Outcome.PlayForFree, selectedPile, targetExiledCard, source, game)) {
|
||||
Card card = selectedPile.get(targetExiledCard.getFirstTarget(), game);
|
||||
controller.canPlayLand();
|
||||
if (controller.playCard(card, game, true, true, new ApprovingObject(source, game))) {
|
||||
if (controller.playCard(card, game, true, new ApprovingObject(source, game))) {
|
||||
selectedPileCards.remove(card);
|
||||
selectedPile.remove(card);
|
||||
}
|
||||
|
|
|
@ -171,7 +171,10 @@ class ChandraAblazeEffect5 extends OneShotEffect {
|
|||
if (player.choose(outcome, target, source.getSourceId(), game)) {
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ class DjinnOfWishesEffect extends OneShotEffect {
|
|||
Cards cards = new CardsImpl(card);
|
||||
controller.revealCards(sourceObject.getIdName(), cards, game);
|
||||
if (!controller.chooseUse(Outcome.PlayForFree, "Play " + card.getName() + " without paying its mana cost?", source, game)
|
||||
|| !controller.playCard(card, game, true, true, new ApprovingObject(source, game))) {
|
||||
|| !controller.playCard(card, game, true, new ApprovingObject(source, game))) {
|
||||
controller.moveCards(card, Zone.EXILED, source, game);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -154,7 +154,9 @@ class EyeOfTheStormEffect1 extends OneShotEffect {
|
|||
if (cardToCopy != null) {
|
||||
Card copy = game.copyCard(cardToCopy, source, source.getControllerId());
|
||||
if (spellController.chooseUse(outcome, "Cast " + copy.getIdName() + " without paying mana cost?", source, game)) {
|
||||
spellController.cast(copy.getSpellAbility(), game, true, new ApprovingObject(source, game));
|
||||
game.getState().setValue("PlayFromNotOwnHandZone" + copy.getId(), Boolean.TRUE);
|
||||
spellController.cast(spellController.chooseAbilityForCast(copy, game, true), game, true, new ApprovingObject(source, game));
|
||||
game.getState().setValue("PlayFromNotOwnHandZone" + copy.getId(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ class GuileReplacementEffect extends ReplacementEffectImpl {
|
|||
Card spellCard = spell.getCard();
|
||||
if (spellCard != null
|
||||
&& controller.chooseUse(Outcome.PlayForFree, "Play " + spellCard.getIdName() + " for free?", source, game)) {
|
||||
controller.playCard(spellCard, game, true, true, new ApprovingObject(source, game));
|
||||
controller.playCard(spellCard, game, true, new ApprovingObject(source, game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ class HordeOfNotionsEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
||||
if (card != null && controller.chooseUse(outcome, "Play " + card.getName() + " from your graveyard for free?", source, game)) {
|
||||
controller.playCard(card, game, true, true, new ApprovingObject(source, game));
|
||||
controller.playCard(card, game, true, new ApprovingObject(source, game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -157,7 +157,9 @@ class KnowledgePoolEffect2 extends OneShotEffect {
|
|||
if (player.choose(Outcome.PlayForFree, game.getExile().getExileZone(exileZoneId), target, game)) {
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
if (card != null && !card.getId().equals(spell.getSourceId())) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ class LeafCrownedElderPlayEffect extends OneShotEffect {
|
|||
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
||||
if (controller != null && card != null) {
|
||||
if (controller.chooseUse(Outcome.PlayForFree, "Play " + card.getIdName() + " without paying its mana cost?", source, game)) {
|
||||
controller.playCard(card, game, true, true, new ApprovingObject(source, game));
|
||||
controller.playCard(card, game, true, new ApprovingObject(source, game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -100,7 +100,9 @@ class OmenMachineEffect2 extends OneShotEffect {
|
|||
if (card.isLand(game)) {
|
||||
player.moveCards(card, Zone.BATTLEFIELD, source, game);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -128,7 +128,9 @@ class PossibilityStormEffect extends OneShotEffect {
|
|||
&& !card.isLand(game)
|
||||
&& card.getSpellAbility().canChooseTarget(game, spellController.getId())) {
|
||||
if (spellController.chooseUse(Outcome.PlayForFree, "Cast " + card.getLogName() + " without paying cost?", source, game)) {
|
||||
spellController.cast(card.getSpellAbility(), game, true, new ApprovingObject(source, game));
|
||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
|
||||
spellController.cast(spellController.chooseAbilityForCast(card, game, true), game, true, new ApprovingObject(source, game));
|
||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,9 @@ class SpellQuellerLeavesEffect extends OneShotEffect {
|
|||
Player cardOwner = game.getPlayer(card.getOwnerId());
|
||||
if (cardOwner != null) {
|
||||
if (cardOwner.chooseUse(Outcome.PlayForFree, "Cast " + card.getLogName() + " without paying cost?", source, game)) {
|
||||
cardOwner.cast(card.getSpellAbility(), game, true, new ApprovingObject(source, game));
|
||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
|
||||
cardOwner.cast(cardOwner.chooseAbilityForCast(card, game, true), game, true, new ApprovingObject(source, game));
|
||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,7 +78,9 @@ class SpellshiftEffect extends OneShotEffect {
|
|||
}
|
||||
spellController.revealCards(source, cardsToReveal, game);
|
||||
if (toCast != null && spellController.chooseUse(outcome, "Cast " + toCast.getLogName() + " without paying its mana cost?", source, game)) {
|
||||
spellController.cast(toCast.getSpellAbility(), game, true, new ApprovingObject(source, game));
|
||||
game.getState().setValue("PlayFromNotOwnHandZone" + toCast.getId(), Boolean.TRUE);
|
||||
spellController.cast(spellController.chooseAbilityForCast(toCast, game, true), game, true, new ApprovingObject(source, game));
|
||||
game.getState().setValue("PlayFromNotOwnHandZone" + toCast.getId(), null);
|
||||
}
|
||||
spellController.shuffleLibrary(source, game);
|
||||
return true;
|
||||
|
|
|
@ -115,7 +115,7 @@ class WordOfCommandEffect extends OneShotEffect {
|
|||
boolean canPlay = checkPlayability(card, targetPlayer, game, source);
|
||||
while (canPlay
|
||||
&& targetPlayer.canRespond()
|
||||
&& !targetPlayer.playCard(card, game, false, true, new ApprovingObject(source, game))) {
|
||||
&& !targetPlayer.playCard(card, game, false, new ApprovingObject(source, game))) {
|
||||
SpellAbility spellAbility = card.getSpellAbility();
|
||||
if (spellAbility != null) {
|
||||
spellAbility.getManaCostsToPay().clear();
|
||||
|
|
|
@ -92,7 +92,9 @@ class YennettCrypticSovereignEffect extends OneShotEffect {
|
|||
player.revealCards(source, new CardsImpl(card), game);
|
||||
if (card.getManaValue() % 2 == 1) {
|
||||
if (player.chooseUse(outcome, "Cast " + card.getLogName() + " without paying its mana cost?", source, game)) {
|
||||
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);
|
||||
} else {
|
||||
/*
|
||||
7/13/2018 | If the revealed card doesn’t have an odd converted mana cost or if that card does but you
|
||||
|
|
|
@ -3092,8 +3092,8 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean playCard(Card card, Game game, boolean noMana, boolean ignoreTiming, ApprovingObject approvingObject) {
|
||||
return computerPlayer.playCard(card, game, noMana, ignoreTiming, approvingObject);
|
||||
public boolean playCard(Card card, Game game, boolean noMana, ApprovingObject approvingObject) {
|
||||
return computerPlayer.playCard(card, game, noMana, approvingObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -601,7 +601,7 @@ public class PlayerStub implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean playCard(Card card, Game game, boolean noMana, boolean checkTiming, ApprovingObject approvingObject) {
|
||||
public boolean playCard(Card card, Game game, boolean noMana, ApprovingObject approvingObject) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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() + '.');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue