diff --git a/forge-ai/src/main/java/forge/ai/AiController.java b/forge-ai/src/main/java/forge/ai/AiController.java index edab1ee7792..0228faf5a05 100644 --- a/forge-ai/src/main/java/forge/ai/AiController.java +++ b/forge-ai/src/main/java/forge/ai/AiController.java @@ -1046,17 +1046,32 @@ public class AiController { numLandsAvailable++; } - //Discard unplayable card + // Discard unplayable card boolean discardedUnplayable = false; - for (int j = 0; j < validCards.size(); j++) { - if (validCards.get(j).getCMC() > numLandsAvailable && !validCards.get(j).hasSVar("DoNotDiscardIfAble")) { - discardList.add(validCards.get(j)); - validCards.remove(validCards.get(j)); - discardedUnplayable = true; - break; - } else if (validCards.get(j).getCMC() <= numLandsAvailable) { - // cut short to avoid looping over cards which are guaranteed not to fit the criteria - break; + // But check if there is a card in play that allows casting spells for free! + // if yes, nothing is unplayable, at least based on CMC + boolean dreamHalls = false; + for (Card cardInPlay : game.getCardsIn(ZoneType.Battlefield)) { + if (cardInPlay.hasSVar("AllowFreeCast")) { + if ("Everyone".equals((cardInPlay.getSVar("AllowFreeCast")))) { + dreamHalls = true; + } else if (("Owner".equals((cardInPlay.getSVar("AllowFreeCast")))) + && (cardInPlay.getOwner().equals(player))) { + dreamHalls = true; + } + } + } + if (!dreamHalls) { + for (int j = 0; j < validCards.size(); j++) { + if (validCards.get(j).getCMC() > numLandsAvailable && !validCards.get(j).hasSVar("DoNotDiscardIfAble")) { + discardList.add(validCards.get(j)); + validCards.remove(validCards.get(j)); + discardedUnplayable = true; + break; + } else if (validCards.get(j).getCMC() <= numLandsAvailable) { + // cut short to avoid looping over cards which are guaranteed not to fit the criteria + break; + } } } diff --git a/forge-ai/src/main/java/forge/ai/AiCostDecision.java b/forge-ai/src/main/java/forge/ai/AiCostDecision.java index 4c538e5d4d3..68bc9e5f1c8 100644 --- a/forge-ai/src/main/java/forge/ai/AiCostDecision.java +++ b/forge-ai/src/main/java/forge/ai/AiCostDecision.java @@ -65,6 +65,20 @@ public class AiCostDecision extends CostDecisionMakerBase { final String type = cost.getType(); CardCollectionView hand = player.getCardsIn(ZoneType.Hand); +/* // Dream Halls + if (type.equals("Card.SharesColorWith")) { + Card bestfound= null; + for (Card card : hand) { + if ((card.sharesColorWith(source)) + && (!card.equals(source))) { + if (bestfound==null) { bestfound=card; } + if (card.getCMC() | AffectedZone$ Hand,Graveyard,Exile,Library,Command | Description$ Rather than pay the mana cost for a spell, its controller may discard a card that shares a color with that spell. SVar:NonStackingEffect:True AI:RemoveDeck:Random +SVar:AllowFreeCast:Everyone SVar:Picture:http://www.wizards.com/global/images/magic/general/dream_halls.jpg Oracle:Rather than pay the mana cost for a spell, its controller may discard a card that shares a color with that spell. diff --git a/forge-gui/res/cardsfolder/o/omniscience.txt b/forge-gui/res/cardsfolder/o/omniscience.txt index dcbed941b4f..0b308bd636e 100644 --- a/forge-gui/res/cardsfolder/o/omniscience.txt +++ b/forge-gui/res/cardsfolder/o/omniscience.txt @@ -2,6 +2,7 @@ Name:Omniscience ManaCost:7 U U U Types:Enchantment S:Mode$ Continuous | Affected$ Card.nonLand+YouOwn | MayPlay$ True | MayPlayWithoutManaCost$ True | AffectedZone$ Hand | Description$ You may cast spells from your hand without paying their mana costs. +SVar:AllowFreeCast:Owner AI:RemoveDeck:Random SVar:Picture:http://www.wizards.com/global/images/magic/general/omniscience.jpg Oracle:You may cast spells from your hand without paying their mana costs.