diff --git a/Mage.Sets/src/mage/cards/a/AltarOfTheLost.java b/Mage.Sets/src/mage/cards/a/AltarOfTheLost.java index 68401a9d0d..a8b4855f31 100644 --- a/Mage.Sets/src/mage/cards/a/AltarOfTheLost.java +++ b/Mage.Sets/src/mage/cards/a/AltarOfTheLost.java @@ -1,4 +1,3 @@ - package mage.cards.a; import java.util.UUID; @@ -11,6 +10,7 @@ import mage.abilities.condition.Condition; import mage.abilities.keyword.FlashbackAbility; import mage.abilities.mana.ConditionalAnyColorManaAbility; import mage.abilities.mana.builder.ConditionalManaBuilder; +import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; @@ -25,7 +25,7 @@ import mage.game.stack.Spell; public final class AltarOfTheLost extends CardImpl { public AltarOfTheLost(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}"); + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}"); // Altar of the Lost enters the battlefield tapped. this.addAbility(new EntersBattlefieldTappedAbility()); @@ -71,6 +71,16 @@ class AltarOfTheLostManaCondition implements Condition { @Override public boolean apply(Game game, Ability source) { MageObject object = game.getObject(source.getSourceId()); + if (game != null && game.inCheckPlayableState()) { + if (object instanceof Card && game.getState().getZone(source.getSourceId()).equals(Zone.GRAVEYARD)) { + for (Ability ability : ((Card) object).getAbilities(game)) { + if (ability instanceof FlashbackAbility) { + return true; + } + } + } + + } if (object instanceof Spell && ((Spell) object).getFromZone() == Zone.GRAVEYARD) { for (Ability ability : ((Spell) object).getAbilities(game)) { if (ability instanceof FlashbackAbility) { diff --git a/Mage.Sets/src/mage/cards/a/AstralCornucopia.java b/Mage.Sets/src/mage/cards/a/AstralCornucopia.java index 97c1d77698..5fed6445a1 100644 --- a/Mage.Sets/src/mage/cards/a/AstralCornucopia.java +++ b/Mage.Sets/src/mage/cards/a/AstralCornucopia.java @@ -5,7 +5,7 @@ import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; diff --git a/Mage.Sets/src/mage/cards/b/BenthicExplorers.java b/Mage.Sets/src/mage/cards/b/BenthicExplorers.java index 3388e40e7c..fd4afda4c0 100644 --- a/Mage.Sets/src/mage/cards/b/BenthicExplorers.java +++ b/Mage.Sets/src/mage/cards/b/BenthicExplorers.java @@ -7,7 +7,7 @@ import mage.abilities.Ability; import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.ActivatedManaAbilityImpl; import mage.cards.CardImpl; import mage.cards.CardSetInfo; diff --git a/Mage.Sets/src/mage/cards/b/BloomTender.java b/Mage.Sets/src/mage/cards/b/BloomTender.java index 22e11e8fac..d53a23e54a 100644 --- a/Mage.Sets/src/mage/cards/b/BloomTender.java +++ b/Mage.Sets/src/mage/cards/b/BloomTender.java @@ -4,7 +4,7 @@ import mage.MageInt; import mage.Mana; import mage.abilities.Ability; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; diff --git a/Mage.Sets/src/mage/cards/c/CagedSun.java b/Mage.Sets/src/mage/cards/c/CagedSun.java index 92d37d47ce..e335e9b799 100644 --- a/Mage.Sets/src/mage/cards/c/CagedSun.java +++ b/Mage.Sets/src/mage/cards/c/CagedSun.java @@ -10,7 +10,7 @@ import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.common.ChooseColorEffect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.TriggeredManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; diff --git a/Mage.Sets/src/mage/cards/c/CarpetOfFlowers.java b/Mage.Sets/src/mage/cards/c/CarpetOfFlowers.java index 1177bd5727..aa822e5b2e 100644 --- a/Mage.Sets/src/mage/cards/c/CarpetOfFlowers.java +++ b/Mage.Sets/src/mage/cards/c/CarpetOfFlowers.java @@ -3,7 +3,7 @@ package mage.cards.c; import mage.Mana; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.choices.ChoiceColor; diff --git a/Mage.Sets/src/mage/cards/c/CharmedPendant.java b/Mage.Sets/src/mage/cards/c/CharmedPendant.java index 398775739c..fb3f612396 100644 --- a/Mage.Sets/src/mage/cards/c/CharmedPendant.java +++ b/Mage.Sets/src/mage/cards/c/CharmedPendant.java @@ -6,7 +6,7 @@ import mage.abilities.costs.Cost; import mage.abilities.costs.common.PutTopCardOfYourLibraryToGraveyardCost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.*; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.effects.mana.BasicManaEffect; import mage.abilities.mana.ActivatedManaAbilityImpl; import mage.abilities.mana.ManaOptions; diff --git a/Mage.Sets/src/mage/cards/c/ChromeMox.java b/Mage.Sets/src/mage/cards/c/ChromeMox.java index e213aec345..a7dc58b7e0 100644 --- a/Mage.Sets/src/mage/cards/c/ChromeMox.java +++ b/Mage.Sets/src/mage/cards/c/ChromeMox.java @@ -7,7 +7,7 @@ import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.Card; import mage.cards.CardImpl; diff --git a/Mage.Sets/src/mage/cards/c/CorruptedGrafstone.java b/Mage.Sets/src/mage/cards/c/CorruptedGrafstone.java index b4441a1ebd..3cba94d656 100644 --- a/Mage.Sets/src/mage/cards/c/CorruptedGrafstone.java +++ b/Mage.Sets/src/mage/cards/c/CorruptedGrafstone.java @@ -5,7 +5,7 @@ import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTappedAbility; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.ActivatedManaAbilityImpl; import mage.cards.Card; import mage.cards.CardImpl; diff --git a/Mage.Sets/src/mage/cards/c/CrypticTrilobite.java b/Mage.Sets/src/mage/cards/c/CrypticTrilobite.java index 40bbb7587c..62c0a49475 100644 --- a/Mage.Sets/src/mage/cards/c/CrypticTrilobite.java +++ b/Mage.Sets/src/mage/cards/c/CrypticTrilobite.java @@ -12,6 +12,7 @@ import mage.abilities.costs.Cost; import mage.abilities.costs.common.RemoveCountersSourceCost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.dynamicvalue.common.CountersSourceCount; import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.mana.ConditionalColorlessManaAbility; @@ -42,10 +43,11 @@ public final class CrypticTrilobite extends CardImpl { new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance()) )); - // Remove a +1/+1 counter from Cryptic Trilobite: Add {C}{C}. Spend this mana only to activate abilities. + // Remove a +1/+1 counter from Cryptic Trilobite: Add {C}{C}. Spend this mana only to activate abilities. this.addAbility(new ConditionalColorlessManaAbility( new RemoveCountersSourceCost(CounterType.P1P1.createInstance()), - 2, new CrypticTrilobiteManaBuilder() + 2, new CrypticTrilobiteManaBuilder(), + new CountersSourceCount(CounterType.P1P1) )); // {1}, {T}: Put a +1/+1 counter on Cryptic Trilobite. diff --git a/Mage.Sets/src/mage/cards/d/DawnsReflection.java b/Mage.Sets/src/mage/cards/d/DawnsReflection.java index 9fe6083678..5fd8abfbf6 100644 --- a/Mage.Sets/src/mage/cards/d/DawnsReflection.java +++ b/Mage.Sets/src/mage/cards/d/DawnsReflection.java @@ -3,7 +3,7 @@ package mage.cards.d; import mage.Mana; import mage.abilities.Ability; import mage.abilities.effects.common.AttachEffect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.keyword.EnchantAbility; import mage.abilities.mana.TriggeredManaAbility; import mage.cards.CardImpl; diff --git a/Mage.Sets/src/mage/cards/d/DomriChaosBringer.java b/Mage.Sets/src/mage/cards/d/DomriChaosBringer.java index b0b518583c..6ef79ece29 100644 --- a/Mage.Sets/src/mage/cards/d/DomriChaosBringer.java +++ b/Mage.Sets/src/mage/cards/d/DomriChaosBringer.java @@ -10,7 +10,7 @@ import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.GetEmblemEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.effects.common.continuous.GainAbilityControlledSpellsEffect; import mage.abilities.effects.mana.BasicManaEffect; import mage.abilities.keyword.RiotAbility; diff --git a/Mage.Sets/src/mage/cards/e/EmpoweredAutogenerator.java b/Mage.Sets/src/mage/cards/e/EmpoweredAutogenerator.java index a53fb3e2ca..5d9ed21cdf 100644 --- a/Mage.Sets/src/mage/cards/e/EmpoweredAutogenerator.java +++ b/Mage.Sets/src/mage/cards/e/EmpoweredAutogenerator.java @@ -4,7 +4,7 @@ import mage.Mana; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTappedAbility; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; diff --git a/Mage.Sets/src/mage/cards/e/EverythingamajigC.java b/Mage.Sets/src/mage/cards/e/EverythingamajigC.java index 450f2cb6a9..7a331d7a2e 100644 --- a/Mage.Sets/src/mage/cards/e/EverythingamajigC.java +++ b/Mage.Sets/src/mage/cards/e/EverythingamajigC.java @@ -9,7 +9,7 @@ import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.VariableManaCost; import mage.abilities.effects.ContinuousEffectImpl; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.effects.common.discard.DiscardTargetEffect; import mage.abilities.hint.common.MyTurnHint; import mage.abilities.mana.ActivatedManaAbilityImpl; diff --git a/Mage.Sets/src/mage/cards/f/FaeburrowElder.java b/Mage.Sets/src/mage/cards/f/FaeburrowElder.java index c2c1988eb4..3c6dfab1e2 100644 --- a/Mage.Sets/src/mage/cards/f/FaeburrowElder.java +++ b/Mage.Sets/src/mage/cards/f/FaeburrowElder.java @@ -8,7 +8,7 @@ import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.effects.Effect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.keyword.VigilanceAbility; import mage.abilities.mana.SimpleManaAbility; diff --git a/Mage.Sets/src/mage/cards/f/FiremindVessel.java b/Mage.Sets/src/mage/cards/f/FiremindVessel.java index ac8f5dd510..a8514c098f 100644 --- a/Mage.Sets/src/mage/cards/f/FiremindVessel.java +++ b/Mage.Sets/src/mage/cards/f/FiremindVessel.java @@ -4,7 +4,7 @@ import mage.Mana; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTappedAbility; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.effects.mana.AddManaOfTwoDifferentColorsEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; diff --git a/Mage.Sets/src/mage/cards/f/FoodChain.java b/Mage.Sets/src/mage/cards/f/FoodChain.java index 1d48483454..51ac14a047 100644 --- a/Mage.Sets/src/mage/cards/f/FoodChain.java +++ b/Mage.Sets/src/mage/cards/f/FoodChain.java @@ -5,7 +5,7 @@ import mage.Mana; import mage.abilities.Ability; import mage.abilities.costs.Cost; import mage.abilities.costs.common.ExileTargetCost; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.SimpleManaAbility; import mage.abilities.mana.builder.ConditionalManaBuilder; import mage.abilities.mana.conditional.CreatureCastConditionalMana; diff --git a/Mage.Sets/src/mage/cards/g/GauntletOfMight.java b/Mage.Sets/src/mage/cards/g/GauntletOfMight.java index fc08e8bb92..2324ec47dd 100644 --- a/Mage.Sets/src/mage/cards/g/GauntletOfMight.java +++ b/Mage.Sets/src/mage/cards/g/GauntletOfMight.java @@ -7,7 +7,7 @@ import mage.ObjectColor; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.TapForManaAllTriggeredManaAbility; import mage.abilities.effects.mana.AddManaToManaPoolTargetControllerEffect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.effects.common.continuous.BoostAllEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; diff --git a/Mage.Sets/src/mage/cards/g/GauntletOfPower.java b/Mage.Sets/src/mage/cards/g/GauntletOfPower.java index ec7df62533..ac0956d58e 100644 --- a/Mage.Sets/src/mage/cards/g/GauntletOfPower.java +++ b/Mage.Sets/src/mage/cards/g/GauntletOfPower.java @@ -10,7 +10,7 @@ import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.ChooseColorEffect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.TriggeredManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; diff --git a/Mage.Sets/src/mage/cards/g/GoblinClearcutter.java b/Mage.Sets/src/mage/cards/g/GoblinClearcutter.java index 74224e3c00..4becf0f485 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinClearcutter.java +++ b/Mage.Sets/src/mage/cards/g/GoblinClearcutter.java @@ -5,7 +5,7 @@ import mage.Mana; import mage.abilities.Ability; import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; diff --git a/Mage.Sets/src/mage/cards/g/GuildGlobe.java b/Mage.Sets/src/mage/cards/g/GuildGlobe.java index b504a938a6..5ea7a5292c 100644 --- a/Mage.Sets/src/mage/cards/g/GuildGlobe.java +++ b/Mage.Sets/src/mage/cards/g/GuildGlobe.java @@ -7,7 +7,7 @@ import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.common.DrawCardSourceControllerEffect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.effects.mana.AddManaOfTwoDifferentColorsEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; diff --git a/Mage.Sets/src/mage/cards/h/HallOfTheBanditLord.java b/Mage.Sets/src/mage/cards/h/HallOfTheBanditLord.java index 74b4f6f11c..71dd6834ad 100644 --- a/Mage.Sets/src/mage/cards/h/HallOfTheBanditLord.java +++ b/Mage.Sets/src/mage/cards/h/HallOfTheBanditLord.java @@ -12,7 +12,7 @@ import mage.abilities.costs.common.PayLifeCost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.mana.BasicManaEffect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.keyword.HasteAbility; import mage.abilities.mana.SimpleManaAbility; diff --git a/Mage.Sets/src/mage/cards/i/IceCauldron.java b/Mage.Sets/src/mage/cards/i/IceCauldron.java index a7f69f4657..c9fadca7a5 100644 --- a/Mage.Sets/src/mage/cards/i/IceCauldron.java +++ b/Mage.Sets/src/mage/cards/i/IceCauldron.java @@ -14,7 +14,7 @@ import mage.abilities.decorator.ConditionalActivatedAbility; import mage.abilities.effects.AsThoughEffect; import mage.abilities.effects.AsThoughEffectImpl; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.Card; diff --git a/Mage.Sets/src/mage/cards/i/IncubationDruid.java b/Mage.Sets/src/mage/cards/i/IncubationDruid.java index 60ae97a8a2..9fbb7f8f40 100644 --- a/Mage.Sets/src/mage/cards/i/IncubationDruid.java +++ b/Mage.Sets/src/mage/cards/i/IncubationDruid.java @@ -5,7 +5,7 @@ import mage.Mana; import mage.abilities.Abilities; import mage.abilities.Ability; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.keyword.AdaptAbility; import mage.abilities.mana.ActivatedManaAbilityImpl; import mage.abilities.mana.SimpleManaAbility; diff --git a/Mage.Sets/src/mage/cards/j/JackInTheMox.java b/Mage.Sets/src/mage/cards/j/JackInTheMox.java index afe593beb5..bc34977b97 100644 --- a/Mage.Sets/src/mage/cards/j/JackInTheMox.java +++ b/Mage.Sets/src/mage/cards/j/JackInTheMox.java @@ -3,7 +3,7 @@ package mage.cards.j; import mage.Mana; import mage.abilities.Ability; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; diff --git a/Mage.Sets/src/mage/cards/j/JeganthaTheWellspring.java b/Mage.Sets/src/mage/cards/j/JeganthaTheWellspring.java index 2a8a274919..ccb82e3359 100644 --- a/Mage.Sets/src/mage/cards/j/JeganthaTheWellspring.java +++ b/Mage.Sets/src/mage/cards/j/JeganthaTheWellspring.java @@ -8,7 +8,7 @@ import mage.abilities.costs.Cost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCost; import mage.abilities.costs.mana.ManaCosts; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.keyword.CompanionAbility; import mage.abilities.keyword.CompanionCondition; import mage.abilities.mana.SimpleManaAbility; diff --git a/Mage.Sets/src/mage/cards/j/JeweledAmulet.java b/Mage.Sets/src/mage/cards/j/JeweledAmulet.java index 9d124d75bd..76b79a6807 100644 --- a/Mage.Sets/src/mage/cards/j/JeweledAmulet.java +++ b/Mage.Sets/src/mage/cards/j/JeweledAmulet.java @@ -8,7 +8,7 @@ import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.decorator.ConditionalActivatedAbility; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; diff --git a/Mage.Sets/src/mage/cards/k/KyrenToy.java b/Mage.Sets/src/mage/cards/k/KyrenToy.java index 25211ebb84..8c308589ee 100644 --- a/Mage.Sets/src/mage/cards/k/KyrenToy.java +++ b/Mage.Sets/src/mage/cards/k/KyrenToy.java @@ -7,7 +7,7 @@ import mage.abilities.costs.Cost; import mage.abilities.costs.common.RemoveVariableCountersSourceCost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; diff --git a/Mage.Sets/src/mage/cards/l/LeylineOfAbundance.java b/Mage.Sets/src/mage/cards/l/LeylineOfAbundance.java index a2e8594ea7..73234db3b7 100644 --- a/Mage.Sets/src/mage/cards/l/LeylineOfAbundance.java +++ b/Mage.Sets/src/mage/cards/l/LeylineOfAbundance.java @@ -4,7 +4,7 @@ import mage.Mana; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.TapForManaAllTriggeredManaAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.effects.common.counter.AddCountersAllEffect; import mage.abilities.effects.mana.BasicManaEffect; import mage.abilities.keyword.LeylineAbility; diff --git a/Mage.Sets/src/mage/cards/m/MadScienceFairProject.java b/Mage.Sets/src/mage/cards/m/MadScienceFairProject.java index 3981e18785..4a3e9d28ea 100644 --- a/Mage.Sets/src/mage/cards/m/MadScienceFairProject.java +++ b/Mage.Sets/src/mage/cards/m/MadScienceFairProject.java @@ -3,7 +3,7 @@ package mage.cards.m; import mage.Mana; import mage.abilities.Ability; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; diff --git a/Mage.Sets/src/mage/cards/m/ManaScrew.java b/Mage.Sets/src/mage/cards/m/ManaScrew.java index 88147c2fac..b7b99fc7e6 100644 --- a/Mage.Sets/src/mage/cards/m/ManaScrew.java +++ b/Mage.Sets/src/mage/cards/m/ManaScrew.java @@ -3,7 +3,7 @@ package mage.cards.m; import mage.Mana; import mage.abilities.Ability; import mage.abilities.costs.mana.GenericManaCost; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.ActivatedManaAbilityImpl; import mage.cards.CardImpl; import mage.cards.CardSetInfo; diff --git a/Mage.Sets/src/mage/cards/m/MarketFestival.java b/Mage.Sets/src/mage/cards/m/MarketFestival.java index 04835da133..8d4ebf59fe 100644 --- a/Mage.Sets/src/mage/cards/m/MarketFestival.java +++ b/Mage.Sets/src/mage/cards/m/MarketFestival.java @@ -3,7 +3,7 @@ package mage.cards.m; import mage.Mana; import mage.abilities.Ability; import mage.abilities.effects.common.AttachEffect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.keyword.EnchantAbility; import mage.abilities.mana.TriggeredManaAbility; import mage.cards.CardImpl; diff --git a/Mage.Sets/src/mage/cards/m/Metalworker.java b/Mage.Sets/src/mage/cards/m/Metalworker.java index ad17878097..63677ceede 100644 --- a/Mage.Sets/src/mage/cards/m/Metalworker.java +++ b/Mage.Sets/src/mage/cards/m/Metalworker.java @@ -4,7 +4,7 @@ import mage.MageInt; import mage.Mana; import mage.abilities.Ability; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; diff --git a/Mage.Sets/src/mage/cards/m/MeteorCrater.java b/Mage.Sets/src/mage/cards/m/MeteorCrater.java index f2793a67ef..f45a1e390e 100644 --- a/Mage.Sets/src/mage/cards/m/MeteorCrater.java +++ b/Mage.Sets/src/mage/cards/m/MeteorCrater.java @@ -4,7 +4,7 @@ import mage.Mana; import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; diff --git a/Mage.Sets/src/mage/cards/n/NehebTheEternal.java b/Mage.Sets/src/mage/cards/n/NehebTheEternal.java index 842682644f..aec5e07924 100644 --- a/Mage.Sets/src/mage/cards/n/NehebTheEternal.java +++ b/Mage.Sets/src/mage/cards/n/NehebTheEternal.java @@ -5,7 +5,7 @@ import mage.Mana; import mage.abilities.Ability; import mage.abilities.common.BeginningOfPostCombatMainTriggeredAbility; import mage.abilities.dynamicvalue.common.OpponentsLostLifeCount; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.effects.mana.DynamicManaEffect; import mage.abilities.keyword.AfflictAbility; import mage.cards.CardImpl; diff --git a/Mage.Sets/src/mage/cards/n/NykthosShrineToNyx.java b/Mage.Sets/src/mage/cards/n/NykthosShrineToNyx.java index 0e4a2e3c77..7579eb693c 100644 --- a/Mage.Sets/src/mage/cards/n/NykthosShrineToNyx.java +++ b/Mage.Sets/src/mage/cards/n/NykthosShrineToNyx.java @@ -9,7 +9,7 @@ import mage.abilities.Ability; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.dynamicvalue.common.DevotionCount; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.ActivatedManaAbilityImpl; import mage.abilities.mana.ColorlessManaAbility; import mage.cards.CardImpl; diff --git a/Mage.Sets/src/mage/cards/n/NyxLotus.java b/Mage.Sets/src/mage/cards/n/NyxLotus.java index 577c1a76b1..311f037828 100644 --- a/Mage.Sets/src/mage/cards/n/NyxLotus.java +++ b/Mage.Sets/src/mage/cards/n/NyxLotus.java @@ -9,7 +9,7 @@ import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTappedAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.dynamicvalue.common.DevotionCount; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.ActivatedManaAbilityImpl; import mage.cards.CardImpl; import mage.cards.CardSetInfo; diff --git a/Mage.Sets/src/mage/cards/o/OasisRitualist.java b/Mage.Sets/src/mage/cards/o/OasisRitualist.java index 70f3182bbc..dee56bb86a 100644 --- a/Mage.Sets/src/mage/cards/o/OasisRitualist.java +++ b/Mage.Sets/src/mage/cards/o/OasisRitualist.java @@ -6,7 +6,7 @@ import mage.MageInt; import mage.abilities.costs.common.ExertSourceCost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.mana.AddManaOfAnyColorEffect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.AnyColorManaAbility; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; diff --git a/Mage.Sets/src/mage/cards/o/OrcishLumberjack.java b/Mage.Sets/src/mage/cards/o/OrcishLumberjack.java index ef616d8ff1..ff1c9b8f5c 100644 --- a/Mage.Sets/src/mage/cards/o/OrcishLumberjack.java +++ b/Mage.Sets/src/mage/cards/o/OrcishLumberjack.java @@ -5,7 +5,7 @@ import mage.Mana; import mage.abilities.Ability; import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; diff --git a/Mage.Sets/src/mage/cards/r/RegalBehemoth.java b/Mage.Sets/src/mage/cards/r/RegalBehemoth.java index 706c0d3b8f..b8f751befb 100644 --- a/Mage.Sets/src/mage/cards/r/RegalBehemoth.java +++ b/Mage.Sets/src/mage/cards/r/RegalBehemoth.java @@ -7,7 +7,7 @@ import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.effects.Effect; import mage.abilities.effects.mana.AddManaOfAnyColorEffect; import mage.abilities.effects.common.BecomesMonarchSourceEffect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.keyword.TrampleAbility; import mage.abilities.mana.TriggeredManaAbility; import mage.cards.CardImpl; diff --git a/Mage.Sets/src/mage/cards/r/RhysticCave.java b/Mage.Sets/src/mage/cards/r/RhysticCave.java index a80baa3741..c756b5a8ec 100644 --- a/Mage.Sets/src/mage/cards/r/RhysticCave.java +++ b/Mage.Sets/src/mage/cards/r/RhysticCave.java @@ -6,7 +6,7 @@ import mage.abilities.costs.Cost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.Effect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.effects.mana.BasicManaEffect; import mage.abilities.effects.mana.DoUnlessAnyPlayerPaysManaEffect; import mage.abilities.mana.ActivatedManaAbilityImpl; diff --git a/Mage.Sets/src/mage/cards/r/RiteOfFlame.java b/Mage.Sets/src/mage/cards/r/RiteOfFlame.java index a56a3db678..377290a5df 100644 --- a/Mage.Sets/src/mage/cards/r/RiteOfFlame.java +++ b/Mage.Sets/src/mage/cards/r/RiteOfFlame.java @@ -2,7 +2,7 @@ package mage.cards.r; import mage.Mana; import mage.abilities.Ability; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; diff --git a/Mage.Sets/src/mage/cards/r/RosheenMeanderer.java b/Mage.Sets/src/mage/cards/r/RosheenMeanderer.java index f4229c6515..f84a3e1bf5 100644 --- a/Mage.Sets/src/mage/cards/r/RosheenMeanderer.java +++ b/Mage.Sets/src/mage/cards/r/RosheenMeanderer.java @@ -20,6 +20,7 @@ import mage.constants.Zone; import mage.game.Game; import java.util.UUID; +import mage.MageObject; /** * @author jeffwadsworth @@ -82,14 +83,20 @@ class RosheenMeandererManaCondition extends ManaCondition { its mana cost (printed in the upper right corner) or its alternative cost (such as flashback), as well as any additional costs (such as kicker). If it’s something you can spend mana on, it’s a cost. If that cost includes the {X} symbol in it, you can spend mana generated by Rosheen on that cost. (2017-11-17) - */ - + */ @Override public boolean apply(Game game, Ability source, UUID originalId, Cost costToPay) { + boolean result; if (costToPay instanceof ManaCosts) { - return !((ManaCosts) costToPay).getVariableCosts().isEmpty(); + result = !((ManaCosts) costToPay).getVariableCosts().isEmpty(); } else { - return costToPay instanceof VariableManaCost; + result = costToPay instanceof VariableManaCost; } + if (!result) { + if (game != null && game.inCheckPlayableState()) { + return true; // TODO: Check the card if there are related abilities with {X} costs. + } + } + return result; } } diff --git a/Mage.Sets/src/mage/cards/s/SacellumGodspeaker.java b/Mage.Sets/src/mage/cards/s/SacellumGodspeaker.java index bed2265a6f..1d1a5fc50b 100644 --- a/Mage.Sets/src/mage/cards/s/SacellumGodspeaker.java +++ b/Mage.Sets/src/mage/cards/s/SacellumGodspeaker.java @@ -4,7 +4,7 @@ import mage.MageInt; import mage.Mana; import mage.abilities.Ability; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; diff --git a/Mage.Sets/src/mage/cards/s/SasayaOrochiAscendant.java b/Mage.Sets/src/mage/cards/s/SasayaOrochiAscendant.java index e802e0f501..ce8def21b5 100644 --- a/Mage.Sets/src/mage/cards/s/SasayaOrochiAscendant.java +++ b/Mage.Sets/src/mage/cards/s/SasayaOrochiAscendant.java @@ -9,7 +9,7 @@ import mage.abilities.common.TapForManaAllTriggeredManaAbility; import mage.abilities.costs.common.RevealHandSourceControllerCost; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.FlipSourceEffect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; diff --git a/Mage.Sets/src/mage/cards/s/SavageVentmaw.java b/Mage.Sets/src/mage/cards/s/SavageVentmaw.java index 820b99062c..096619bebb 100644 --- a/Mage.Sets/src/mage/cards/s/SavageVentmaw.java +++ b/Mage.Sets/src/mage/cards/s/SavageVentmaw.java @@ -5,7 +5,7 @@ import mage.Mana; import mage.abilities.Ability; import mage.abilities.common.AttacksTriggeredAbility; import mage.abilities.effects.Effect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; diff --git a/Mage.Sets/src/mage/cards/s/SelvalaExplorerReturned.java b/Mage.Sets/src/mage/cards/s/SelvalaExplorerReturned.java index 9e3c726326..79463293dd 100644 --- a/Mage.Sets/src/mage/cards/s/SelvalaExplorerReturned.java +++ b/Mage.Sets/src/mage/cards/s/SelvalaExplorerReturned.java @@ -7,7 +7,7 @@ import mage.abilities.costs.common.TapSourceCost; import mage.abilities.dynamicvalue.common.ParleyCount; import mage.abilities.effects.Effect; import mage.abilities.effects.common.DrawCardAllEffect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.ActivatedManaAbilityImpl; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; diff --git a/Mage.Sets/src/mage/cards/s/SelvalaHeartOfTheWilds.java b/Mage.Sets/src/mage/cards/s/SelvalaHeartOfTheWilds.java index 5bd3a0df20..cb8b9077a3 100644 --- a/Mage.Sets/src/mage/cards/s/SelvalaHeartOfTheWilds.java +++ b/Mage.Sets/src/mage/cards/s/SelvalaHeartOfTheWilds.java @@ -8,7 +8,7 @@ import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.dynamicvalue.common.GreatestPowerAmongControlledCreaturesValue; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.effects.mana.AddManaInAnyCombinationEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; diff --git a/Mage.Sets/src/mage/cards/s/SpectralSearchlight.java b/Mage.Sets/src/mage/cards/s/SpectralSearchlight.java index 9df9ec409f..7c5a458eca 100644 --- a/Mage.Sets/src/mage/cards/s/SpectralSearchlight.java +++ b/Mage.Sets/src/mage/cards/s/SpectralSearchlight.java @@ -4,7 +4,7 @@ import mage.Mana; import mage.abilities.Ability; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.common.ChoosePlayerEffect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; diff --git a/Mage.Sets/src/mage/cards/s/SquanderedResources.java b/Mage.Sets/src/mage/cards/s/SquanderedResources.java index fd042fb5a6..66489f217c 100644 --- a/Mage.Sets/src/mage/cards/s/SquanderedResources.java +++ b/Mage.Sets/src/mage/cards/s/SquanderedResources.java @@ -10,7 +10,7 @@ import mage.Mana; import mage.abilities.Ability; import mage.abilities.costs.Cost; import mage.abilities.costs.common.SacrificeTargetCost; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.AnyColorLandsProduceManaAbility; import mage.abilities.mana.ManaOptions; import mage.abilities.mana.SimpleManaAbility; diff --git a/Mage.Sets/src/mage/cards/t/TitansNest.java b/Mage.Sets/src/mage/cards/t/TitansNest.java index f805e124d3..1b6e3a2c29 100644 --- a/Mage.Sets/src/mage/cards/t/TitansNest.java +++ b/Mage.Sets/src/mage/cards/t/TitansNest.java @@ -26,6 +26,7 @@ import mage.players.Player; import mage.target.common.TargetCardInYourGraveyard; import java.util.UUID; +import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount; /** * @author TheElk801 @@ -90,7 +91,7 @@ class TitansNestManaAbility extends ActivatedManaAbilityImpl { TitansNestManaAbility() { super(Zone.BATTLEFIELD, (BasicManaEffect) new BasicManaEffect( - new TitansNestConditionalMana()) + new TitansNestConditionalMana(), new CardsInControllerGraveyardCount()) .setText("Add {C}. Spend this mana only to cast a colored spell without {X} in its mana cost."), new ExileFromGraveCost(new TargetCardInYourGraveyard())); this.netMana.add(Mana.ColorlessMana(1)); diff --git a/Mage.Sets/src/mage/cards/u/UtopiaSprawl.java b/Mage.Sets/src/mage/cards/u/UtopiaSprawl.java index f0024acf17..ebd292581e 100644 --- a/Mage.Sets/src/mage/cards/u/UtopiaSprawl.java +++ b/Mage.Sets/src/mage/cards/u/UtopiaSprawl.java @@ -6,7 +6,7 @@ import mage.abilities.Ability; import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.ChooseColorEffect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.keyword.EnchantAbility; import mage.abilities.mana.TriggeredManaAbility; import mage.cards.CardImpl; diff --git a/Mage.Sets/src/mage/cards/v/VedalkenEngineer.java b/Mage.Sets/src/mage/cards/v/VedalkenEngineer.java index 441ebfc7b7..6db572102e 100644 --- a/Mage.Sets/src/mage/cards/v/VedalkenEngineer.java +++ b/Mage.Sets/src/mage/cards/v/VedalkenEngineer.java @@ -7,7 +7,7 @@ import mage.Mana; import mage.abilities.Ability; import mage.abilities.condition.Condition; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.SimpleManaAbility; import mage.abilities.mana.builder.ConditionalManaBuilder; import mage.cards.CardImpl; diff --git a/Mage.Sets/src/mage/cards/v/VictoryChimes.java b/Mage.Sets/src/mage/cards/v/VictoryChimes.java index e46c1a7676..ee79f88712 100644 --- a/Mage.Sets/src/mage/cards/v/VictoryChimes.java +++ b/Mage.Sets/src/mage/cards/v/VictoryChimes.java @@ -5,7 +5,7 @@ import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.common.ChoosePlayerEffect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.effects.common.continuous.UntapSourceDuringEachOtherPlayersUntapStepEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; diff --git a/Mage.Sets/src/mage/cards/v/VorinclexVoiceOfHunger.java b/Mage.Sets/src/mage/cards/v/VorinclexVoiceOfHunger.java index 1f3684a3c6..15ec45a2a2 100644 --- a/Mage.Sets/src/mage/cards/v/VorinclexVoiceOfHunger.java +++ b/Mage.Sets/src/mage/cards/v/VorinclexVoiceOfHunger.java @@ -5,7 +5,7 @@ import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.TapForManaAllTriggeredManaAbility; import mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.effects.mana.AddManaOfAnyTypeProducedEffect; import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; diff --git a/Mage.Sets/src/mage/cards/w/WintersNight.java b/Mage.Sets/src/mage/cards/w/WintersNight.java index 550e0b7d81..3cc8ddd480 100644 --- a/Mage.Sets/src/mage/cards/w/WintersNight.java +++ b/Mage.Sets/src/mage/cards/w/WintersNight.java @@ -7,7 +7,7 @@ import mage.abilities.common.TapForManaAllTriggeredManaAbility; import mage.abilities.effects.Effect; import mage.abilities.effects.mana.AddManaOfAnyTypeProducedEffect; import mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; diff --git a/Mage.Sets/src/mage/cards/w/WookieeMystic.java b/Mage.Sets/src/mage/cards/w/WookieeMystic.java index f9551231db..9616503a78 100644 --- a/Mage.Sets/src/mage/cards/w/WookieeMystic.java +++ b/Mage.Sets/src/mage/cards/w/WookieeMystic.java @@ -5,7 +5,7 @@ import mage.MageObject; import mage.Mana; import mage.abilities.Ability; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.effects.mana.BasicManaEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/enters/GatherSpecimensTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/enters/GatherSpecimensTest.java index 833065c02b..f02ce590df 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/enters/GatherSpecimensTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/enters/GatherSpecimensTest.java @@ -15,19 +15,20 @@ import org.mage.test.serverside.base.CardTestPlayerBase; */ public class GatherSpecimensTest extends CardTestPlayerBase { - /* Gather Specimens {3}{U}{U}{U} + /* Gather Specimens - Instant {3}{U}{U}{U} * * If a creature would enter the battlefield under an opponent's control this turn, it enters the battlefield under your control instead. */ @Test public void testFromHandEffect() { + setStrictChooseMode(true); addCard(Zone.BATTLEFIELD, playerA, "Island", 6); addCard(Zone.HAND, playerA, "Gather Specimens", 1); addCard(Zone.LIBRARY, playerB, "Mountain", 1); - addCard(Zone.HAND, playerB, "Memnite", 1); + addCard(Zone.HAND, playerB, "Memnite", 1); // Artifact Creature (1/1) {0} castSpell(2, PhaseStep.UPKEEP, playerA, "Gather Specimens"); @@ -37,6 +38,10 @@ public class GatherSpecimensTest extends CardTestPlayerBase { execute(); + assertAllCommandsUsed(); + + assertGraveyardCount(playerA, "Gather Specimens", 1); + assertPermanentCount(playerA, "Memnite", 1); assertPermanentCount(playerB, "Memnite", 0); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/mana/GaeasGradleTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/mana/GaeasGradleTest.java index 92c0ddd9dc..1ebe08d9aa 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/mana/GaeasGradleTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/mana/GaeasGradleTest.java @@ -1,6 +1,5 @@ package org.mage.test.cards.mana; -import mage.constants.ManaType; import mage.constants.PhaseStep; import mage.constants.Zone; import org.junit.Test; @@ -8,12 +7,14 @@ import org.mage.test.serverside.base.CardTestPlayerBase; public class GaeasGradleTest extends CardTestPlayerBase { + // {T}: Add {G} for each creature you control. private final String cradle = "Gaea's Cradle"; private final String bears = "Grizzly Bears"; private final String thopter = "Ornithopter"; @Test public void testGradle(){ + setStrictChooseMode(true); addCard(Zone.BATTLEFIELD, playerA, cradle); addCard(Zone.BATTLEFIELD, playerA, bears, 2); addCard(Zone.BATTLEFIELD, playerB, thopter); @@ -23,6 +24,8 @@ public class GaeasGradleTest extends CardTestPlayerBase { checkManaPool("gaeas cradle ",1, PhaseStep.PRECOMBAT_MAIN, playerA, "G", 2); setStopAt(1, PhaseStep.PRECOMBAT_MAIN); execute(); + + assertAllCommandsUsed(); } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/mana/RosheenMeandererManaXTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/mana/RosheenMeandererManaXTest.java index 6ef6eb8977..95125e8974 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/mana/RosheenMeandererManaXTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/mana/RosheenMeandererManaXTest.java @@ -40,7 +40,7 @@ public class RosheenMeandererManaXTest extends CardTestPlayerBase { @Test public void test_KickerWithXMana() { - addCard(Zone.BATTLEFIELD, playerA, "Forest", 6 + 2 - 4); + addCard(Zone.BATTLEFIELD, playerA, "Forest", 6); addCard(Zone.HAND, playerA, "Verdeloth the Ancient"); // addCard(Zone.BATTLEFIELD, playerA, "Rosheen Meanderer"); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/mana/ConditionalManaTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/mana/conditional/ConditionalManaTest.java similarity index 89% rename from Mage.Tests/src/test/java/org/mage/test/cards/mana/ConditionalManaTest.java rename to Mage.Tests/src/test/java/org/mage/test/cards/mana/conditional/ConditionalManaTest.java index 598eedc8c8..7c9a9b5c81 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/mana/ConditionalManaTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/mana/conditional/ConditionalManaTest.java @@ -1,4 +1,4 @@ -package org.mage.test.cards.mana; +package org.mage.test.cards.mana.conditional; import mage.abilities.keyword.FlyingAbility; import mage.abilities.mana.ManaOptions; @@ -6,7 +6,6 @@ import mage.constants.PhaseStep; import mage.constants.Zone; import mage.counters.CounterType; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; @@ -20,13 +19,17 @@ public class ConditionalManaTest extends CardTestPlayerBase { @Test public void testNormalUse() { + setStrictChooseMode(true); + // {T}: Add one mana of any color. Spend this mana only to cast a multicolored spell. addCard(Zone.BATTLEFIELD, playerA, "Pillar of the Paruns", 2); - // Instant {G}{W} + // Target player gains 7 life. - addCard(Zone.HAND, playerA, "Heroes' Reunion", 1); + addCard(Zone.HAND, playerA, "Heroes' Reunion", 1); // Instant {G}{W} castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Heroes' Reunion", playerA); + setChoice(playerA, "Green"); // Choose color + setChoice(playerA, "White"); // Choose color setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); @@ -358,4 +361,37 @@ public class ConditionalManaTest extends CardTestPlayerBase { assertLife(playerB, 20 - 3); } + + @Test + public void testTwoConditionalMana(){ + setStrictChooseMode(true); + + // At the beginning of your upkeep, look at the top card of your library. You may put that card into your graveyard. + // Exile a card from your graveyard: Add {C}. Spend this mana only to cast a colored spell without {X} in its mana cost. + addCard(Zone.BATTLEFIELD, playerA, "Titans' Nest"); // Enchantment {1}{B}{G}{U} + + // {T}: Add {C}{C}{C}{C}. Spend this mana only on costs that contain {X}. + addCard(Zone.BATTLEFIELD, playerA, "Rosheen Meanderer", 1); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1); + + addCard(Zone.GRAVEYARD, playerA, "Grizzly Bears", 2); + + + setChoice(playerA, "No"); // Put [Top Card of Library] into your graveyard? + + setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertAllCommandsUsed(); + + assertPermanentCount(playerA, "Titans' Nest", 1); + + ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame); + Assert.assertEquals("mana variations don't fit", 4, manaOptions.size()); + assertManaOptions("{R}", manaOptions); + assertManaOptions("{C}{C}{R}[{TitansNestManaCondition}]", manaOptions); + assertManaOptions("{C}{C}{C}{C}{R}[{RosheenMeandererManaCondition}]", manaOptions); + assertManaOptions("{C}{C}{C}{C}{C}{C}{R}[{RosheenMeandererManaCondition}{TitansNestManaCondition}]", manaOptions); + } + } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/mana/conditional/CrypticTrilobiteTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/mana/conditional/CrypticTrilobiteTest.java new file mode 100644 index 0000000000..20c0c9f449 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/mana/conditional/CrypticTrilobiteTest.java @@ -0,0 +1,112 @@ +package org.mage.test.cards.mana.conditional; + +import mage.abilities.mana.ManaOptions; +import mage.constants.PhaseStep; +import mage.constants.Zone; +import mage.counters.CounterType; +import org.junit.Assert; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; +import static org.mage.test.utils.ManaOptionsTestUtils.assertManaOptions; + +/** + * + * @author LevelX2 + */ + +public class CrypticTrilobiteTest extends CardTestPlayerBase { + + @Test + public void testAvailableManaCalculation(){ + setStrictChooseMode(true); + + // Cryptic Trilobite enters the battlefield with X +1/+1 counters on it. + // Remove a +1/+1 counter from Cryptic Trilobite: Add {C}{C}. Spend this mana only to activate abilities. + // {1}, {T}: Put a +1/+1 counter on Cryptic Trilobite. + addCard(Zone.HAND, playerA, "Cryptic Trilobite"); // Creature {X}{X} + + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 10); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cryptic Trilobite"); + setChoice(playerA, "X=5"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertAllCommandsUsed(); + + assertPermanentCount(playerA, "Cryptic Trilobite", 1); + + ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame); + Assert.assertEquals("mana variations don't fit", 1, manaOptions.size()); + assertManaOptions("{C}{C}{C}{C}{C}{C}{C}{C}{C}{C}[{CrypticTrilobiteManaCondition}]", manaOptions); + } + + @Test + public void testUse(){ + setStrictChooseMode(true); + + // Cryptic Trilobite enters the battlefield with X +1/+1 counters on it. + // Remove a +1/+1 counter from Cryptic Trilobite: Add {C}{C}. Spend this mana only to activate abilities. + // {1}, {T}: Put a +1/+1 counter on Cryptic Trilobite. + addCard(Zone.HAND, playerA, "Cryptic Trilobite"); // Creature {X}{X} + // Flying + // {2}: Deathknell Kami gets +1/+1 until end of turn. Sacrifice it at the beginning of the next end step. + // Soulshift 1 (When this creature dies, you may return target Spirit card with converted mana cost 1 or less from your graveyard to your hand.) + addCard(Zone.BATTLEFIELD, playerA, "Deathknell Kami"); // Creature (0/1) + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 10); + + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cryptic Trilobite"); + setChoice(playerA, "X=5"); + + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}:"); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}:"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertAllCommandsUsed(); + + assertPermanentCount(playerA, "Cryptic Trilobite", 1); + assertCounterCount(playerA, "Cryptic Trilobite", CounterType.P1P1, 3); + + assertPowerToughness(playerA, "Deathknell Kami", 2, 3); + + ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame); + Assert.assertEquals("mana variations don't fit", 1, manaOptions.size()); + assertManaOptions("{C}{C}{C}{C}{C}{C}[{CrypticTrilobiteManaCondition}]", manaOptions); + } + + @Test + public void testCantUse(){ + setStrictChooseMode(true); + + // Cryptic Trilobite enters the battlefield with X +1/+1 counters on it. + // Remove a +1/+1 counter from Cryptic Trilobite: Add {C}{C}. Spend this mana only to activate abilities. + // {1}, {T}: Put a +1/+1 counter on Cryptic Trilobite. + addCard(Zone.HAND, playerA, "Cryptic Trilobite"); // Creature {X}{X} + + // {4}{W}: Return another target creature you control to its owner's hand. + addCard(Zone.HAND, playerA, "Aegis Automaton"); // Creature {2} (0/2) + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 10); + + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cryptic Trilobite"); + setChoice(playerA, "X=5"); + + waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA); + + checkPlayableAbility("can't play", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Aegis Automaton", false); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertAllCommandsUsed(); + + assertPermanentCount(playerA, "Cryptic Trilobite", 1); + assertCounterCount(playerA, "Cryptic Trilobite", CounterType.P1P1, 5); + } + + +} \ No newline at end of file diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/mana/conditional/TitansNestTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/mana/conditional/TitansNestTest.java new file mode 100644 index 0000000000..89cfbed009 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/mana/conditional/TitansNestTest.java @@ -0,0 +1,44 @@ + +package org.mage.test.cards.mana.conditional; + +import mage.abilities.mana.ManaOptions; +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Assert; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; +import static org.mage.test.utils.ManaOptionsTestUtils.assertManaOptions; + +/** + * + * @author LevelX2 + */ +public class TitansNestTest extends CardTestPlayerBase { + + @Test + public void testTitansNest(){ + setStrictChooseMode(true); + + // At the beginning of your upkeep, look at the top card of your library. You may put that card into your graveyard. + // Exile a card from your graveyard: Add {C}. Spend this mana only to cast a colored spell without {X} in its mana cost. + addCard(Zone.HAND, playerA, "Titans' Nest"); // Enchantment {1}{B}{G}{U} + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1); + addCard(Zone.BATTLEFIELD, playerA, "Forest", 2); + addCard(Zone.BATTLEFIELD, playerA, "Island", 1); + + addCard(Zone.GRAVEYARD, playerA, "Grizzly Bears", 2); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Titans' Nest"); + + setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertAllCommandsUsed(); + + assertPermanentCount(playerA, "Titans' Nest", 1); + + ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame); + Assert.assertEquals("mana variations don't fit", 1, manaOptions.size()); + assertManaOptions("{C}{C}[{TitansNestManaCondition}]", manaOptions); + } +} \ No newline at end of file diff --git a/Mage.Tests/src/test/java/org/mage/test/utils/ManaOptionsTestUtils.java b/Mage.Tests/src/test/java/org/mage/test/utils/ManaOptionsTestUtils.java index 37914e1042..4d76d17143 100644 --- a/Mage.Tests/src/test/java/org/mage/test/utils/ManaOptionsTestUtils.java +++ b/Mage.Tests/src/test/java/org/mage/test/utils/ManaOptionsTestUtils.java @@ -6,6 +6,7 @@ import org.junit.Assert; import java.util.HashSet; import java.util.Set; +import mage.ConditionalMana; public class ManaOptionsTestUtils { @@ -18,29 +19,34 @@ public class ManaOptionsTestUtils { //mana info //logger.info(playerA.getManaPool().getMana().toString()); //logger.info(playerA.getManaAvailable(currentGame).toString()); - - public static boolean manaOptionsContain(ManaOptions list, String searchMana){ - for(Mana mana: list){ - if (mana.toString().equals(searchMana)){ - return true; + public static boolean manaOptionsContain(ManaOptions list, String searchMana) { + for (Mana mana : list) { + if (mana instanceof ConditionalMana) { + if ((mana.toString() + ((ConditionalMana)mana).getConditionString()).equals(searchMana)) { + return true; + } + } else { + if (mana.toString().equals(searchMana)) { + return true; + } } } return false; } - public static void assertManaOptions(String searchMana, ManaOptions manaList){ - if(!manaOptionsContain(manaList, searchMana)){ + public static void assertManaOptions(String searchMana, ManaOptions manaList) { + if (!manaOptionsContain(manaList, searchMana)) { Assert.fail("Can't find " + searchMana + " in " + manaList.toString()); } } - public static void assertDuplicatedManaOptions(ManaOptions manaList){ + public static void assertDuplicatedManaOptions(ManaOptions manaList) { Set list = new HashSet<>(); - for(Mana mana: manaList){ + for (Mana mana : manaList) { String s = mana.toString(); - if(list.contains(s)){ + if (list.contains(s)) { Assert.fail("Found duplicated mana option " + s + " in " + manaList.toString()); - }else{ + } else { list.add(s); } } diff --git a/Mage/src/main/java/mage/ConditionalMana.java b/Mage/src/main/java/mage/ConditionalMana.java index 86a378e12a..c5b36cf402 100644 --- a/Mage/src/main/java/mage/ConditionalMana.java +++ b/Mage/src/main/java/mage/ConditionalMana.java @@ -52,7 +52,7 @@ public class ConditionalMana extends Mana implements Serializable { public ConditionalMana(final ConditionalMana conditionalMana) { super(conditionalMana); - conditions = conditionalMana.conditions; + conditions.addAll(conditionalMana.conditions); scope = conditionalMana.scope; staticText = conditionalMana.staticText; manaProducerId = conditionalMana.manaProducerId; @@ -67,6 +67,10 @@ public class ConditionalMana extends Mana implements Serializable { this.scope = scope; } + public List getConditions() { + return conditions; + } + public boolean apply(Ability ability, Game game, UUID manaProducerId, Cost costToPay) { if (conditions.isEmpty()) { throw new IllegalStateException("Conditional mana should contain at least one Condition"); @@ -173,6 +177,24 @@ public class ConditionalMana extends Mana implements Serializable { } } + @Override + public void add(Mana mana) { + if (mana instanceof ConditionalMana) { + for (Condition condition : ((ConditionalMana) mana).getConditions()) { + addCondition(condition); + } + } + super.add(mana); + } + + public String getConditionString() { + String condStr = "["; + for (Condition condition : conditions) { + condStr += condition.getManaText(); + } + return condStr + "]"; + } + public void add(ManaType manaType, int amount) { switch (manaType) { case BLACK: diff --git a/Mage/src/main/java/mage/Mana.java b/Mage/src/main/java/mage/Mana.java index 883ec29e2a..3f8e0207f4 100644 --- a/Mage/src/main/java/mage/Mana.java +++ b/Mage/src/main/java/mage/Mana.java @@ -275,6 +275,7 @@ public class Mana implements Comparable, Serializable, Copyable { /** * Adds mana from the passed in {@link Mana} object to this object. + * Ignores conditions from conditional mana * * @param mana mana to add to this object. */ @@ -1111,6 +1112,17 @@ public class Mana implements Comparable, Serializable, Copyable { * @return */ public static Mana getMoreValuableMana(final Mana mana1, final Mana mana2) { + String conditionString1 = ""; + String conditionString2 = ""; + if (mana1 instanceof ConditionalMana){ + conditionString1 = ((ConditionalMana)mana1).getConditionString(); + } + if (mana2 instanceof ConditionalMana){ + conditionString2 = ((ConditionalMana)mana2).getConditionString(); + } + if (!conditionString1.equals(conditionString2)) { + return null; + } Mana moreMana; Mana lessMana; if (mana2.countColored() > mana1.countColored() || mana2.getAny() > mana1.getAny() || mana2.count() > mana1.count()) { diff --git a/Mage/src/main/java/mage/abilities/AbilityImpl.java b/Mage/src/main/java/mage/abilities/AbilityImpl.java index c9f951defa..8defb58adc 100644 --- a/Mage/src/main/java/mage/abilities/AbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/AbilityImpl.java @@ -8,7 +8,7 @@ import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.Effect; import mage.abilities.effects.Effects; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.hint.Hint; import mage.abilities.mana.ActivatedManaAbilityImpl; import mage.cards.Card; diff --git a/Mage/src/main/java/mage/abilities/SpellAbility.java b/Mage/src/main/java/mage/abilities/SpellAbility.java index d76b52e478..d8afd6ef6b 100644 --- a/Mage/src/main/java/mage/abilities/SpellAbility.java +++ b/Mage/src/main/java/mage/abilities/SpellAbility.java @@ -16,7 +16,6 @@ import mage.players.Player; import java.util.Optional; import java.util.UUID; -import javax.naming.directory.InvalidAttributesException; /** * @author BetaSteward_at_googlemail.com diff --git a/Mage/src/main/java/mage/abilities/common/TapForManaAllTriggeredManaAbility.java b/Mage/src/main/java/mage/abilities/common/TapForManaAllTriggeredManaAbility.java index 9949441de1..8c73d19bd0 100644 --- a/Mage/src/main/java/mage/abilities/common/TapForManaAllTriggeredManaAbility.java +++ b/Mage/src/main/java/mage/abilities/common/TapForManaAllTriggeredManaAbility.java @@ -2,7 +2,7 @@ package mage.abilities.common; import mage.abilities.effects.Effect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.TriggeredManaAbility; import mage.constants.SetTargetPointer; import mage.constants.Zone; diff --git a/Mage/src/main/java/mage/abilities/common/TapLandForManaAllTriggeredManaAbility.java b/Mage/src/main/java/mage/abilities/common/TapLandForManaAllTriggeredManaAbility.java index eedcc0c7ce..53526c7182 100644 --- a/Mage/src/main/java/mage/abilities/common/TapLandForManaAllTriggeredManaAbility.java +++ b/Mage/src/main/java/mage/abilities/common/TapLandForManaAllTriggeredManaAbility.java @@ -2,7 +2,7 @@ package mage.abilities.common; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.TriggeredManaAbility; import mage.constants.Zone; import mage.game.Game; diff --git a/Mage/src/main/java/mage/abilities/condition/Condition.java b/Mage/src/main/java/mage/abilities/condition/Condition.java index 512d372000..b5b3566e9a 100644 --- a/Mage/src/main/java/mage/abilities/condition/Condition.java +++ b/Mage/src/main/java/mage/abilities/condition/Condition.java @@ -5,7 +5,6 @@ import mage.game.Game; import java.io.Serializable; - /** * Interface describing condition occurrence. * @@ -16,10 +15,14 @@ public interface Condition extends Serializable { /** * Checks the game to see if this condition applies for the given ability. - * + * * @param game * @param source * @return */ boolean apply(Game game, Ability source); + + default String getManaText() { + return "{" + this.getClass().getSimpleName() + "}"; + } } diff --git a/Mage/src/main/java/mage/abilities/decorator/ConditionalManaEffect.java b/Mage/src/main/java/mage/abilities/decorator/ConditionalManaEffect.java index baebbec584..a316f08844 100644 --- a/Mage/src/main/java/mage/abilities/decorator/ConditionalManaEffect.java +++ b/Mage/src/main/java/mage/abilities/decorator/ConditionalManaEffect.java @@ -3,7 +3,7 @@ package mage.abilities.decorator; import mage.Mana; import mage.abilities.Ability; import mage.abilities.condition.Condition; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.effects.mana.BasicManaEffect; import mage.choices.ChoiceColor; import mage.game.Game; diff --git a/Mage/src/main/java/mage/abilities/effects/mana/AddConditionalColorlessManaEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/AddConditionalColorlessManaEffect.java index 7a2822f2f8..36edf6a502 100644 --- a/Mage/src/main/java/mage/abilities/effects/mana/AddConditionalColorlessManaEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/AddConditionalColorlessManaEffect.java @@ -6,6 +6,7 @@ package mage.abilities.effects.mana; import mage.Mana; +import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.mana.builder.ConditionalManaBuilder; /** @@ -15,7 +16,11 @@ import mage.abilities.mana.builder.ConditionalManaBuilder; public class AddConditionalColorlessManaEffect extends AddConditionalManaEffect { public AddConditionalColorlessManaEffect(int amount, ConditionalManaBuilder manaBuilder) { - super(Mana.ColorlessMana(amount), manaBuilder); + this(amount, manaBuilder, null); + } + + public AddConditionalColorlessManaEffect(int amount, ConditionalManaBuilder manaBuilder, DynamicValue netAmount) { + super(Mana.ColorlessMana(amount), manaBuilder, netAmount); } public AddConditionalColorlessManaEffect(final AddConditionalColorlessManaEffect effect) { diff --git a/Mage/src/main/java/mage/abilities/effects/mana/AddConditionalManaEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/AddConditionalManaEffect.java index 53c0794547..2f52eca97f 100644 --- a/Mage/src/main/java/mage/abilities/effects/mana/AddConditionalManaEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/AddConditionalManaEffect.java @@ -5,10 +5,13 @@ */ package mage.abilities.effects.mana; +import java.util.ArrayList; +import java.util.List; import mage.Mana; import mage.abilities.Ability; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.mana.builder.ConditionalManaBuilder; +import mage.constants.ManaType; import mage.game.Game; /** @@ -18,18 +21,26 @@ public class AddConditionalManaEffect extends ManaEffect { private final Mana mana; private final ConditionalManaBuilder manaBuilder; + private final DynamicValue netAmount; public AddConditionalManaEffect(Mana mana, ConditionalManaBuilder manaBuilder) { + this(mana, manaBuilder, null); + } + + public AddConditionalManaEffect(Mana mana, ConditionalManaBuilder manaBuilder, DynamicValue netAmount) { super(); this.mana = mana; this.manaBuilder = manaBuilder; + this.netAmount = netAmount; staticText = "Add " + this.mana.toString() + ". " + manaBuilder.getRule(); + } public AddConditionalManaEffect(final AddConditionalManaEffect effect) { super(effect); this.mana = effect.mana.copy(); this.manaBuilder = effect.manaBuilder; + this.netAmount = effect.netAmount; } @Override @@ -37,6 +48,23 @@ public class AddConditionalManaEffect extends ManaEffect { return new AddConditionalManaEffect(this); } + @Override + public List getNetMana(Game game, Ability source) { + if (game != null && game.inCheckPlayableState() && netAmount != null) { + List maxAvailableMana = new ArrayList<>(); + int amountAvailableMana = netAmount.calculate(game, source, this); + if (amountAvailableMana > 0) { + Mana calculatedMana = mana.copy(); + for(ManaType manaType: ManaType.getTrueManaTypes()) { + calculatedMana.set(manaType, calculatedMana.get(manaType) * amountAvailableMana); + } + maxAvailableMana.add(manaBuilder.setMana(calculatedMana, source, game).build()); + } + return maxAvailableMana; + } + return super.getNetMana(game, source); //To change body of generated methods, choose Tools | Templates. + } + @Override public Mana produceMana(Game game, Ability source) { if (game != null) { diff --git a/Mage/src/main/java/mage/abilities/effects/mana/AddConditionalManaOfAnyColorEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/AddConditionalManaOfAnyColorEffect.java index 4c4a23dafd..6e2bb56506 100644 --- a/Mage/src/main/java/mage/abilities/effects/mana/AddConditionalManaOfAnyColorEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/AddConditionalManaOfAnyColorEffect.java @@ -7,7 +7,6 @@ import mage.Mana; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; -import mage.abilities.effects.common.ManaEffect; import mage.abilities.mana.builder.ConditionalManaBuilder; import mage.choices.ChoiceColor; import mage.game.Game; diff --git a/Mage/src/main/java/mage/abilities/effects/mana/AddConditionalManaOfTwoDifferentColorsEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/AddConditionalManaOfTwoDifferentColorsEffect.java index 419a2c25a7..d4dba97fdf 100644 --- a/Mage/src/main/java/mage/abilities/effects/mana/AddConditionalManaOfTwoDifferentColorsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/AddConditionalManaOfTwoDifferentColorsEffect.java @@ -8,7 +8,6 @@ package mage.abilities.effects.mana; import mage.ConditionalMana; import mage.Mana; import mage.abilities.Ability; -import mage.abilities.effects.common.ManaEffect; import mage.abilities.mana.builder.ConditionalManaBuilder; import mage.choices.ManaChoice; import mage.game.Game; diff --git a/Mage/src/main/java/mage/abilities/effects/mana/AddManaAnyColorAttachedControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/AddManaAnyColorAttachedControllerEffect.java index 350219d964..2dffc38e4f 100644 --- a/Mage/src/main/java/mage/abilities/effects/mana/AddManaAnyColorAttachedControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/AddManaAnyColorAttachedControllerEffect.java @@ -2,7 +2,6 @@ package mage.abilities.effects.mana; import mage.Mana; import mage.abilities.Ability; -import mage.abilities.effects.common.ManaEffect; import mage.choices.ChoiceColor; import mage.game.Game; import mage.game.permanent.Permanent; diff --git a/Mage/src/main/java/mage/abilities/effects/mana/AddManaChosenColorEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/AddManaChosenColorEffect.java index 1b856a1d7f..a1a976f1e0 100644 --- a/Mage/src/main/java/mage/abilities/effects/mana/AddManaChosenColorEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/AddManaChosenColorEffect.java @@ -4,7 +4,6 @@ import mage.Mana; import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.Mode; -import mage.abilities.effects.common.ManaEffect; import mage.constants.ColoredManaSymbol; import mage.game.Game; diff --git a/Mage/src/main/java/mage/abilities/effects/mana/AddManaInAnyCombinationEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/AddManaInAnyCombinationEffect.java index bc80fc7fd7..a2243c23fd 100644 --- a/Mage/src/main/java/mage/abilities/effects/mana/AddManaInAnyCombinationEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/AddManaInAnyCombinationEffect.java @@ -10,7 +10,6 @@ import mage.Mana; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; -import mage.abilities.effects.common.ManaEffect; import mage.abilities.mana.ManaOptions; import mage.constants.ColoredManaSymbol; import mage.constants.ManaType; diff --git a/Mage/src/main/java/mage/abilities/effects/mana/AddManaOfAnyTypeProducedEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/AddManaOfAnyTypeProducedEffect.java index f849c21b69..16d37675c4 100644 --- a/Mage/src/main/java/mage/abilities/effects/mana/AddManaOfAnyTypeProducedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/AddManaOfAnyTypeProducedEffect.java @@ -2,7 +2,6 @@ package mage.abilities.effects.mana; import mage.Mana; import mage.abilities.Ability; -import mage.abilities.effects.common.ManaEffect; import mage.choices.Choice; import mage.choices.ChoiceColor; import mage.game.Game; diff --git a/Mage/src/main/java/mage/abilities/effects/mana/AddManaOfTwoDifferentColorsEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/AddManaOfTwoDifferentColorsEffect.java index 1bd4bd3f90..5b0aaaadef 100644 --- a/Mage/src/main/java/mage/abilities/effects/mana/AddManaOfTwoDifferentColorsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/AddManaOfTwoDifferentColorsEffect.java @@ -3,7 +3,6 @@ package mage.abilities.effects.mana; import mage.Mana; import mage.abilities.Ability; -import mage.abilities.effects.common.ManaEffect; import mage.choices.ManaChoice; import mage.game.Game; import mage.players.Player; diff --git a/Mage/src/main/java/mage/abilities/effects/mana/AddManaToManaPoolTargetControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/AddManaToManaPoolTargetControllerEffect.java index 0f8b2e21e4..9d9c94cd13 100644 --- a/Mage/src/main/java/mage/abilities/effects/mana/AddManaToManaPoolTargetControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/AddManaToManaPoolTargetControllerEffect.java @@ -7,7 +7,6 @@ package mage.abilities.effects.mana; import mage.Mana; import mage.abilities.Ability; -import mage.abilities.effects.common.ManaEffect; import mage.game.Game; import mage.players.Player; diff --git a/Mage/src/main/java/mage/abilities/effects/mana/BasicManaEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/BasicManaEffect.java index e50e521ce8..2179bce089 100644 --- a/Mage/src/main/java/mage/abilities/effects/mana/BasicManaEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/BasicManaEffect.java @@ -7,7 +7,6 @@ import mage.ConditionalMana; import mage.Mana; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; -import mage.abilities.effects.common.ManaEffect; import mage.game.Game; public class BasicManaEffect extends ManaEffect { @@ -28,10 +27,14 @@ public class BasicManaEffect extends ManaEffect { } public BasicManaEffect(ConditionalMana conditionalMana) { + this(conditionalMana, null); + } + + public BasicManaEffect(ConditionalMana conditionalMana, DynamicValue netAmount) { super(); this.manaTemplate = conditionalMana; staticText = "add " + manaTemplate.toString() + " " + conditionalMana.getDescription(); - this.netAmount = null; + this.netAmount = netAmount; } public BasicManaEffect(final BasicManaEffect effect) { @@ -46,7 +49,7 @@ public class BasicManaEffect extends ManaEffect { if (game != null && game.inCheckPlayableState() && netAmount != null) { // calculate the maximum available mana int count = netAmount.calculate(game, source, this); - Mana computedMana = new Mana(); + Mana computedMana = manaTemplate.copy(); // Copy to get condition if (count > 0) { if (manaTemplate.getBlack() > 0) { computedMana.setBlack(count * manaTemplate.getBlack()); diff --git a/Mage/src/main/java/mage/abilities/effects/mana/DoUnlessAnyPlayerPaysManaEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/DoUnlessAnyPlayerPaysManaEffect.java index 348b3808f4..4c0c3db084 100644 --- a/Mage/src/main/java/mage/abilities/effects/mana/DoUnlessAnyPlayerPaysManaEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/DoUnlessAnyPlayerPaysManaEffect.java @@ -10,7 +10,6 @@ import mage.Mana; import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.costs.Cost; -import mage.abilities.effects.common.ManaEffect; import mage.constants.Outcome; import mage.game.Game; import mage.players.Player; diff --git a/Mage/src/main/java/mage/abilities/effects/mana/DynamicManaEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/DynamicManaEffect.java index 38234d62f6..e0d80d1d8d 100644 --- a/Mage/src/main/java/mage/abilities/effects/mana/DynamicManaEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/DynamicManaEffect.java @@ -4,7 +4,6 @@ import mage.Mana; import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.dynamicvalue.DynamicValue; -import mage.abilities.effects.common.ManaEffect; import mage.choices.ChoiceColor; import mage.constants.Outcome; import mage.game.Game; diff --git a/Mage/src/main/java/mage/abilities/effects/common/ManaEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/ManaEffect.java similarity index 99% rename from Mage/src/main/java/mage/abilities/effects/common/ManaEffect.java rename to Mage/src/main/java/mage/abilities/effects/mana/ManaEffect.java index 554199b62f..471574c20d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ManaEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/ManaEffect.java @@ -1,4 +1,4 @@ -package mage.abilities.effects.common; +package mage.abilities.effects.mana; import mage.Mana; import mage.abilities.Ability; diff --git a/Mage/src/main/java/mage/abilities/mana/ActivatedManaAbilityImpl.java b/Mage/src/main/java/mage/abilities/mana/ActivatedManaAbilityImpl.java index 46b9a085c7..d24268a618 100644 --- a/Mage/src/main/java/mage/abilities/mana/ActivatedManaAbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/mana/ActivatedManaAbilityImpl.java @@ -4,7 +4,7 @@ import mage.Mana; import mage.abilities.ActivatedAbilityImpl; import mage.abilities.costs.Cost; import mage.abilities.effects.Effect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.constants.*; import mage.game.Game; import mage.game.stack.Spell; diff --git a/Mage/src/main/java/mage/abilities/mana/AnyColorLandsProduceManaAbility.java b/Mage/src/main/java/mage/abilities/mana/AnyColorLandsProduceManaAbility.java index ae0fd8f5f8..39d2604841 100644 --- a/Mage/src/main/java/mage/abilities/mana/AnyColorLandsProduceManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/AnyColorLandsProduceManaAbility.java @@ -4,7 +4,7 @@ import mage.Mana; import mage.abilities.Abilities; import mage.abilities.Ability; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.choices.Choice; import mage.constants.TargetController; import mage.constants.Zone; diff --git a/Mage/src/main/java/mage/abilities/mana/AnyColorManaAbility.java b/Mage/src/main/java/mage/abilities/mana/AnyColorManaAbility.java index c5921d5372..1dc32fb383 100644 --- a/Mage/src/main/java/mage/abilities/mana/AnyColorManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/AnyColorManaAbility.java @@ -7,7 +7,7 @@ import mage.abilities.costs.Cost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.effects.Effect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.effects.mana.AddManaOfAnyColorEffect; import mage.constants.Zone; import mage.game.Game; diff --git a/Mage/src/main/java/mage/abilities/mana/AnyColorPermanentTypesManaAbility.java b/Mage/src/main/java/mage/abilities/mana/AnyColorPermanentTypesManaAbility.java index 2123b7c408..26a538f47a 100644 --- a/Mage/src/main/java/mage/abilities/mana/AnyColorPermanentTypesManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/AnyColorPermanentTypesManaAbility.java @@ -9,7 +9,7 @@ import mage.Mana; import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.choices.Choice; import mage.choices.ChoiceColor; import mage.constants.ColoredManaSymbol; diff --git a/Mage/src/main/java/mage/abilities/mana/BasicManaAbility.java b/Mage/src/main/java/mage/abilities/mana/BasicManaAbility.java index 4f6b2eb2e8..e74ac006df 100644 --- a/Mage/src/main/java/mage/abilities/mana/BasicManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/BasicManaAbility.java @@ -1,7 +1,7 @@ package mage.abilities.mana; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.constants.Zone; /** diff --git a/Mage/src/main/java/mage/abilities/mana/CommanderColorIdentityManaAbility.java b/Mage/src/main/java/mage/abilities/mana/CommanderColorIdentityManaAbility.java index 804fa14f0f..3436bc05e2 100644 --- a/Mage/src/main/java/mage/abilities/mana/CommanderColorIdentityManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/CommanderColorIdentityManaAbility.java @@ -4,7 +4,7 @@ import mage.Mana; import mage.abilities.Ability; import mage.abilities.costs.Cost; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.cards.Card; import mage.choices.Choice; import mage.choices.ChoiceImpl; diff --git a/Mage/src/main/java/mage/abilities/mana/ConditionalColorlessManaAbility.java b/Mage/src/main/java/mage/abilities/mana/ConditionalColorlessManaAbility.java index 937c8d38d4..10995f0080 100644 --- a/Mage/src/main/java/mage/abilities/mana/ConditionalColorlessManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/ConditionalColorlessManaAbility.java @@ -7,6 +7,7 @@ package mage.abilities.mana; import mage.abilities.costs.Cost; import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.effects.mana.AddConditionalColorlessManaEffect; import mage.abilities.mana.builder.ConditionalManaBuilder; import mage.constants.Zone; @@ -21,7 +22,11 @@ public class ConditionalColorlessManaAbility extends ActivatedManaAbilityImpl { } public ConditionalColorlessManaAbility(Cost cost, int amount, ConditionalManaBuilder manaBuilder) { - super(Zone.BATTLEFIELD, new AddConditionalColorlessManaEffect(amount, manaBuilder), cost); + this(cost, amount, manaBuilder, null); + } + + public ConditionalColorlessManaAbility(Cost cost, int amount, ConditionalManaBuilder manaBuilder, DynamicValue netAmount) { + super(Zone.BATTLEFIELD, new AddConditionalColorlessManaEffect(amount, manaBuilder, netAmount), cost); } public ConditionalColorlessManaAbility(final ConditionalColorlessManaAbility ability) { diff --git a/Mage/src/main/java/mage/abilities/mana/DelayedTriggeredManaAbility.java b/Mage/src/main/java/mage/abilities/mana/DelayedTriggeredManaAbility.java index a6b77494d4..c257ee0410 100644 --- a/Mage/src/main/java/mage/abilities/mana/DelayedTriggeredManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/DelayedTriggeredManaAbility.java @@ -5,7 +5,7 @@ package mage.abilities.mana; import mage.constants.Zone; import mage.abilities.DelayedTriggeredAbility; import mage.abilities.effects.Effect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.constants.Duration; /** diff --git a/Mage/src/main/java/mage/abilities/mana/ManaOptions.java b/Mage/src/main/java/mage/abilities/mana/ManaOptions.java index 360f8a13c0..fb0100b6bb 100644 --- a/Mage/src/main/java/mage/abilities/mana/ManaOptions.java +++ b/Mage/src/main/java/mage/abilities/mana/ManaOptions.java @@ -10,8 +10,10 @@ import org.apache.log4j.Logger; import java.util.ArrayList; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.Set; +import mage.ConditionalMana; /** * @author BetaSteward_at_googlemail.com @@ -312,15 +314,27 @@ public class ManaOptions extends ArrayList { /** * Adds the given mana value to all existing options - * + * * @param addMana Mana to add to the existing options */ public void addMana(Mana addMana) { if (isEmpty()) { this.add(new Mana()); } - for (Mana mana : this) { - mana.add(addMana); + if (addMana instanceof ConditionalMana) { + ManaOptions copy = this.copy(); + this.clear(); + for (Mana mana : copy) { + ConditionalMana condMana = ((ConditionalMana) addMana).copy(); + condMana.add(mana); + add(condMana); // Add mana as option with condition + add(mana); // Add old mana without the condition + } + + } else { + for (Mana mana : this) { + mana.add(addMana); + } } forceManaDeduplication(); @@ -514,8 +528,15 @@ public class ManaOptions extends ArrayList { Set list = new HashSet<>(); for (int i = this.size() - 1; i >= 0; i--) { - String s = this.get(i).toString(); - if (list.contains(s)) { + String s; + if (this.get(i) instanceof ConditionalMana) { + s = this.get(i).toString() + ((ConditionalMana) this.get(i)).getConditionString(); + } else { + s = this.get(i).toString(); + } + if (s.isEmpty()) { + this.remove(i); + } else if (list.contains(s)) { // remove duplicated this.remove(i); } else { @@ -550,4 +571,25 @@ public class ManaOptions extends ArrayList { } return false; } + + public String toString() { + Iterator it = this.iterator(); + if (!it.hasNext()) { + return "[]"; + } + + StringBuilder sb = new StringBuilder(); + sb.append('['); + for (;;) { + Mana mana = it.next(); + sb.append(mana.toString()); + if (mana instanceof ConditionalMana) { + sb.append(((ConditionalMana) mana).getConditionString()); + } + if (!it.hasNext()) { + return sb.append(']').toString(); + } + sb.append(',').append(' '); + } + } } diff --git a/Mage/src/main/java/mage/abilities/mana/SimpleManaAbility.java b/Mage/src/main/java/mage/abilities/mana/SimpleManaAbility.java index 501ab6f5a3..76e34410ce 100644 --- a/Mage/src/main/java/mage/abilities/mana/SimpleManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/SimpleManaAbility.java @@ -5,7 +5,7 @@ import java.util.List; import mage.Mana; import mage.abilities.costs.Cost; import mage.abilities.dynamicvalue.DynamicValue; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.abilities.effects.mana.BasicManaEffect; import mage.constants.Zone; import mage.game.Game; diff --git a/Mage/src/main/java/mage/abilities/mana/TriggeredManaAbility.java b/Mage/src/main/java/mage/abilities/mana/TriggeredManaAbility.java index 7d3d424854..85796fec71 100644 --- a/Mage/src/main/java/mage/abilities/mana/TriggeredManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/TriggeredManaAbility.java @@ -3,7 +3,7 @@ package mage.abilities.mana; import mage.Mana; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; -import mage.abilities.effects.common.ManaEffect; +import mage.abilities.effects.mana.ManaEffect; import mage.constants.AbilityType; import mage.constants.Zone; import mage.game.Game; diff --git a/Mage/src/main/java/mage/abilities/mana/conditional/ConditionalSpellManaBuilder.java b/Mage/src/main/java/mage/abilities/mana/conditional/ConditionalSpellManaBuilder.java index 86f5939b30..9267685c21 100644 --- a/Mage/src/main/java/mage/abilities/mana/conditional/ConditionalSpellManaBuilder.java +++ b/Mage/src/main/java/mage/abilities/mana/conditional/ConditionalSpellManaBuilder.java @@ -5,7 +5,10 @@ */ package mage.abilities.mana.conditional; +import java.util.ArrayList; +import java.util.List; import java.util.UUID; +import javax.sql.rowset.Predicate; import mage.ConditionalMana; import mage.MageObject; import mage.Mana; @@ -14,8 +17,14 @@ import mage.abilities.SpellAbility; import mage.abilities.condition.Condition; import mage.abilities.costs.Cost; import mage.abilities.mana.builder.ConditionalManaBuilder; +import mage.cards.Card; +import mage.constants.DependencyType; +import mage.constants.SubType; +import mage.filter.FilterCard; import mage.filter.FilterSpell; +import mage.filter.predicate.Predicates; import mage.game.Game; +import mage.game.stack.Spell; import mage.game.stack.StackObject; /** @@ -63,6 +72,10 @@ class SpellCastManaCondition extends ManaCondition implements Condition { public boolean apply(Game game, Ability source) { if (source instanceof SpellAbility) { MageObject object = game.getObject(source.getSourceId()); + if (game.inCheckPlayableState() && object instanceof Card) { + Spell spell = new Spell((Card) object, (SpellAbility) source, source.getControllerId(), game.getState().getZone(source.getSourceId())); + return spell != null && filter.match(spell, source.getSourceId(), source.getControllerId(), game); + } if ((object instanceof StackObject)) { return filter.match((StackObject) object, source.getSourceId(), source.getControllerId(), game); } diff --git a/Mage/src/main/java/mage/constants/ManaType.java b/Mage/src/main/java/mage/constants/ManaType.java index e08407fda9..728be6324e 100644 --- a/Mage/src/main/java/mage/constants/ManaType.java +++ b/Mage/src/main/java/mage/constants/ManaType.java @@ -58,35 +58,35 @@ public enum ManaType { } return choice; } - - public static List getManaListFromManaTypes(Set manaTypes, boolean onlyColors) { + + public static List getManaListFromManaTypes(Set manaTypes, boolean onlyColors) { List netManas = new ArrayList<>(); - if ((manaTypes.size() == 5 && !manaTypes.contains(ManaType.COLORLESS)) || manaTypes.size() == 6) { // GENERIC should never be returned from getManaTypes - netManas.add(Mana.AnyMana(1)); - } else { - if (manaTypes.contains(ManaType.BLACK)) { - netManas.add(Mana.BlackMana(1)); - } - if (manaTypes.contains(ManaType.RED)) { - netManas.add(Mana.RedMana(1)); - } - if (manaTypes.contains(ManaType.BLUE)) { - netManas.add(Mana.BlueMana(1)); - } - if (manaTypes.contains(ManaType.GREEN)) { - netManas.add(Mana.GreenMana(1)); - } - if (manaTypes.contains(ManaType.WHITE)) { - netManas.add(Mana.WhiteMana(1)); - } + if ((manaTypes.size() == 5 && !manaTypes.contains(ManaType.COLORLESS)) || manaTypes.size() == 6) { // GENERIC should never be returned from getManaTypes + netManas.add(Mana.AnyMana(1)); + } else { + if (manaTypes.contains(ManaType.BLACK)) { + netManas.add(Mana.BlackMana(1)); } - if (!onlyColors && manaTypes.contains(ManaType.COLORLESS)) { - netManas.add(Mana.ColorlessMana(1)); + if (manaTypes.contains(ManaType.RED)) { + netManas.add(Mana.RedMana(1)); } - + if (manaTypes.contains(ManaType.BLUE)) { + netManas.add(Mana.BlueMana(1)); + } + if (manaTypes.contains(ManaType.GREEN)) { + netManas.add(Mana.GreenMana(1)); + } + if (manaTypes.contains(ManaType.WHITE)) { + netManas.add(Mana.WhiteMana(1)); + } + } + if (!onlyColors && manaTypes.contains(ManaType.COLORLESS)) { + netManas.add(Mana.ColorlessMana(1)); + } + return netManas; } - + public static Set getManaTypesFromManaList(Mana mana) { Set manaTypes = EnumSet.noneOf(ManaType.class); if (mana.getAny() > 0) { @@ -124,4 +124,7 @@ public enum ManaType { } return manaTypes; } + public static Set getTrueManaTypes() { + return EnumSet.of(BLACK, BLUE, GREEN, RED, WHITE, COLORLESS); + } } diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index 1364bdc6c0..a4de6ee5b3 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -3121,6 +3121,9 @@ public abstract class PlayerImpl implements Player, Serializable { MageObjectReference permittingObject = game.getContinuousEffects().asThough(ability.getSourceId(), AsThoughEffectType.SPEND_OTHER_MANA, ability, ability.getControllerId(), game); for (Mana mana : abilityOptions) { + if (mana.count() == 0) { + return true; + } for (Mana avail : availableMana) { // TODO: SPEND_OTHER_MANA effects with getAsThoughManaType can change mana type to pay, // but that code processing it as any color, need to test and fix another use cases @@ -3131,6 +3134,9 @@ public abstract class PlayerImpl implements Player, Serializable { if (permittingObject != null && mana.count() <= avail.count()) { return true; } + if (avail instanceof ConditionalMana && !((ConditionalMana) avail).apply(ability, game, getId(), ability.getManaCosts())) { + continue; + } if (mana.enough(avail)) { // here we need to check if spend mana as though allow to pay the mana cost return true; } @@ -4620,4 +4626,10 @@ public abstract class PlayerImpl implements Player, Serializable { public SpellAbility chooseAbilityForCast(Card card, Game game, boolean noMana) { return card.getSpellAbility(); } + + @Override + public String toString() { + return getName() + " " + super.toString(); + } + }