diff --git a/Mage.Sets/src/mage/sets/odyssey/BelovedChaplain.java b/Mage.Sets/src/mage/sets/odyssey/BelovedChaplain.java index b84e176803..d8fd111047 100644 --- a/Mage.Sets/src/mage/sets/odyssey/BelovedChaplain.java +++ b/Mage.Sets/src/mage/sets/odyssey/BelovedChaplain.java @@ -29,10 +29,10 @@ package mage.sets.odyssey; import java.util.UUID; import mage.MageInt; +import mage.abilities.keyword.ProtectionAbility; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; -import mage.abilities.keyword.ProtectionAbility; import mage.filter.FilterCard; import mage.filter.predicate.mageobject.CardTypePredicate; @@ -41,12 +41,12 @@ import mage.filter.predicate.mageobject.CardTypePredicate; * @author cbt33, BetaSteward (Black Knight) */ public class BelovedChaplain extends CardImpl { - - public static final FilterCard filter = new FilterCard("creature"); - - static { - filter.add(new CardTypePredicate(CardType.CREATURE)); - } + + public static final FilterCard filter = new FilterCard("creatures"); + + static { + filter.add(new CardTypePredicate(CardType.CREATURE)); + } public BelovedChaplain(UUID ownerId) { super(ownerId, 11, "Beloved Chaplain", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{W}"); diff --git a/Mage.Sets/src/mage/sets/odyssey/Bloodcurdler.java b/Mage.Sets/src/mage/sets/odyssey/Bloodcurdler.java index 5251880df4..7303d34662 100644 --- a/Mage.Sets/src/mage/sets/odyssey/Bloodcurdler.java +++ b/Mage.Sets/src/mage/sets/odyssey/Bloodcurdler.java @@ -35,7 +35,6 @@ import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.Condition; import mage.abilities.condition.common.CardsInControllerGraveCondition; -import mage.abilities.costs.common.ExileFromGraveCost; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.common.ExileCardFromOwnGraveyardControllerEffect; @@ -49,8 +48,6 @@ import mage.constants.Duration; import mage.constants.Rarity; import mage.constants.TargetController; import mage.constants.Zone; -import mage.filter.FilterCard; -import mage.target.common.TargetCardInYourGraveyard; /** * diff --git a/Mage.Sets/src/mage/sets/odyssey/CabalInquisitor.java b/Mage.Sets/src/mage/sets/odyssey/CabalInquisitor.java index c47f1f383a..cf5a4ccdac 100644 --- a/Mage.Sets/src/mage/sets/odyssey/CabalInquisitor.java +++ b/Mage.Sets/src/mage/sets/odyssey/CabalInquisitor.java @@ -68,8 +68,8 @@ public class CabalInquisitor extends CardImpl { this.power = new MageInt(1); this.toughness = new MageInt(1); - // Threshold - {1}{B}, {tap}, Exile two cards from your graveyard: Target player discards a card. Activate this ability only any time you could cast a sorcery, and only if seven or more cards are in your graveyard. - Ability ability = new ActivateAsSorceryConditionalActivatedAbility(Zone.BATTLEFIELD, new DiscardTargetEffect(1), new ManaCostsImpl("{1}{B}"), new CardsInControllerGraveCondition(7), "

Threshold - {1}{B}, {tap}, Exile two cards from your graveyard: Target player discards a card. Activate this ability only any time you could cast a sorcery, and only if seven or more cards are in your graveyard."); + // Threshold - {1}{B}, {T}, Exile two cards from your graveyard: Target player discards a card. Activate this ability only any time you could cast a sorcery, and only if seven or more cards are in your graveyard. + Ability ability = new ActivateAsSorceryConditionalActivatedAbility(Zone.BATTLEFIELD, new DiscardTargetEffect(1), new ManaCostsImpl("{1}{B}"), new CardsInControllerGraveCondition(7), "

Threshold - {1}{B}, {T}, Exile two cards from your graveyard: Target player discards a card. Activate this ability only any time you could cast a sorcery, and only if seven or more cards are in your graveyard."); ability.addTarget(new TargetPlayer()); ability.addCost(new TapSourceCost()); ability.addCost(new ExileFromGraveCost(new TargetCardInYourGraveyard(2, new FilterCard("cards from your graveyard")))); diff --git a/Mage.Sets/src/mage/sets/planechase/IvyElemental.java b/Mage.Sets/src/mage/sets/planechase/IvyElemental.java index 4c49e2f8b9..11a7c22091 100644 --- a/Mage.Sets/src/mage/sets/planechase/IvyElemental.java +++ b/Mage.Sets/src/mage/sets/planechase/IvyElemental.java @@ -29,13 +29,20 @@ package mage.sets.planechase; import java.util.UUID; import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.SpellAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.dynamicvalue.common.ManacostVariableValue; +import mage.abilities.effects.EntersBattlefieldEffect; +import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; import mage.constants.CardType; +import mage.constants.Outcome; import mage.constants.Rarity; import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; /** * @@ -53,7 +60,7 @@ public class IvyElemental extends CardImpl { this.toughness = new MageInt(0); // Ivy Elemental enters the battlefield with X +1/+1 counters on it. - this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(), new ManacostVariableValue(), true), "with X +1/+1 counters on it")); + this.addAbility(new EntersBattlefieldAbility(new IvyElementalEntersBattlefieldEffect() ,"with X +1/+1 counters on it")); } public IvyElemental(final IvyElemental card) { @@ -65,3 +72,41 @@ public class IvyElemental extends CardImpl { return new IvyElemental(this); } } + +class IvyElementalEntersBattlefieldEffect extends OneShotEffect { + + public IvyElementalEntersBattlefieldEffect() { + super(Outcome.BoostCreature); + staticText = "{this} enters the battlefield with X +1/+1 counters on it"; + } + + public IvyElementalEntersBattlefieldEffect(final IvyElementalEntersBattlefieldEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null) { + Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); + if (obj != null && obj instanceof SpellAbility) { + // delete to prevent using it again if put into battlefield from other effect + setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null); + SpellAbility spellAbility = (SpellAbility) obj; + if (spellAbility.getSourceId().equals(source.getSourceId())) { // put into play by normal cast + int amount = spellAbility.getManaCostsToPay().getX(); + if (amount > 0) { + permanent.addCounters(CounterType.P1P1.createInstance(amount), game); + } + } + } + } + return true; + } + + @Override + public IvyElementalEntersBattlefieldEffect copy() { + return new IvyElementalEntersBattlefieldEffect(this); + } + +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/returntoravnica/SavageSurge.java b/Mage.Sets/src/mage/sets/returntoravnica/SavageSurge.java index 9dd7f3edc1..e0a1b1e331 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/SavageSurge.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/SavageSurge.java @@ -28,6 +28,7 @@ package mage.sets.returntoravnica; import java.util.UUID; +import mage.abilities.effects.Effect; import mage.constants.CardType; import mage.constants.Rarity; @@ -52,7 +53,9 @@ public class SavageSurge extends CardImpl { // Target creature gets +2/+2 until end of turn. Untap that creature. this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addEffect(new BoostTargetEffect(2, 2, Duration.EndOfTurn)); - this.getSpellAbility().addEffect(new UntapTargetEffect()); + Effect effect = new UntapTargetEffect(); + effect.setText("Untap that creature"); + this.getSpellAbility().addEffect(effect); } public SavageSurge(final SavageSurge card) { diff --git a/Mage/src/mage/abilities/costs/common/DiscardTargetCost.java b/Mage/src/mage/abilities/costs/common/DiscardTargetCost.java index 4e42c9db00..0f242c87bf 100644 --- a/Mage/src/mage/abilities/costs/common/DiscardTargetCost.java +++ b/Mage/src/mage/abilities/costs/common/DiscardTargetCost.java @@ -68,29 +68,26 @@ public class DiscardTargetCost extends CostImpl { @Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + this.cards.clear(); Player player = game.getPlayer(controllerId); - if (randomDiscard) { - int amount = this.getTargets().get(0).getMaxNumberOfTargets(); - int maxAmount = Math.min(amount, player.getHand().size()); - for (int i = 0; i < maxAmount; i++) { - Card card = player.getHand().getRandom(game); - if (card != null) { - paid |= player.discard(card, null, game); - } - } + if (player == null) { + return false; + } + int amount = this.getTargets().get(0).getNumberOfTargets(); + if (randomDiscard) { + this.cards.addAll(player.discard(amount, true, ability, game).getCards(game)); } else { - if (targets.choose(Outcome.Discard, controllerId, sourceId, game)) { - + if (targets.choose(Outcome.Discard, controllerId, sourceId, game)) { for (UUID targetId: targets.get(0).getTargets()) { Card card = player.getHand().get(targetId, game); if (card == null) { return false; } this.cards.add(card.copy()); - paid |= player.discard(card, ability, game); } } } + paid = cards.size() >= amount; return paid; } diff --git a/Mage/src/mage/abilities/effects/common/ExileCardFromOwnGraveyardControllerEffect.java b/Mage/src/mage/abilities/effects/common/ExileCardFromOwnGraveyardControllerEffect.java index 8686e6af46..201e0605a7 100644 --- a/Mage/src/mage/abilities/effects/common/ExileCardFromOwnGraveyardControllerEffect.java +++ b/Mage/src/mage/abilities/effects/common/ExileCardFromOwnGraveyardControllerEffect.java @@ -81,7 +81,7 @@ public class ExileCardFromOwnGraveyardControllerEffect extends OneShotEffect { } private String setText() { - StringBuilder sb = new StringBuilder("Exile "); + StringBuilder sb = new StringBuilder("exile "); if (amount == 1) { sb.append(" a card "); } else { diff --git a/Mage/src/mage/abilities/effects/common/PreventDamageToTargetEffect.java b/Mage/src/mage/abilities/effects/common/PreventDamageToTargetEffect.java index a505b91c09..3b6e22f950 100644 --- a/Mage/src/mage/abilities/effects/common/PreventDamageToTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/PreventDamageToTargetEffect.java @@ -73,6 +73,9 @@ public class PreventDamageToTargetEffect extends PreventionEffectImpl { @Override public String getText(Mode mode) { + if (staticText != null && !staticText.isEmpty()) { + return staticText; + } StringBuilder sb = new StringBuilder(); if (amountToPrevent == Integer.MAX_VALUE) { sb.append("Prevent all damage that would be dealt to target ");