diff --git a/Mage.Sets/src/mage/cards/e/EvenTheScore.java b/Mage.Sets/src/mage/cards/e/EvenTheScore.java new file mode 100644 index 00000000000..2ebfd4638d2 --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/EvenTheScore.java @@ -0,0 +1,60 @@ +package mage.cards.e; + +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.Condition; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.common.ManacostVariableValue; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.cost.SpellCostReductionSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.game.Game; +import mage.watchers.common.CardsDrawnThisTurnWatcher; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class EvenTheScore extends CardImpl { + + public EvenTheScore(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{U}{U}{U}"); + + // This spell costs {U}{U}{U} less to cast if an opponent has drawn four or more cards this turn. + this.addAbility(new SimpleStaticAbility( + Zone.ALL, + new SpellCostReductionSourceEffect( + new ManaCostsImpl<>("{U}{U}{U}"), + EvenTheScoreCondition.instance + ) + ).setRuleAtTheTop(true), new CardsDrawnThisTurnWatcher()); + + // Draw X cards. + this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(ManacostVariableValue.REGULAR)); + } + + private EvenTheScore(final EvenTheScore card) { + super(card); + } + + @Override + public EvenTheScore copy() { + return new EvenTheScore(this); + } +} + +enum EvenTheScoreCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + return game.getOpponents(source.getControllerId()) + .stream() + .mapToInt(game.getState().getWatcher(CardsDrawnThisTurnWatcher.class)::getCardsDrawnThisTurn) + .anyMatch(x -> x >= 4); + } +} diff --git a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java index 45e15d90dba..0efb5963cbb 100644 --- a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java +++ b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java @@ -99,6 +99,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet { cards.add(new SetCardInfo("Elspeth Resplendent", 11, Rarity.MYTHIC, mage.cards.e.ElspethResplendent.class)); cards.add(new SetCardInfo("Endless Detour", 183, Rarity.RARE, mage.cards.e.EndlessDetour.class)); cards.add(new SetCardInfo("Errant, Street Artist", 41, Rarity.RARE, mage.cards.e.ErrantStreetArtist.class)); + cards.add(new SetCardInfo("Even the Score", 42, Rarity.MYTHIC, mage.cards.e.EvenTheScore.class)); cards.add(new SetCardInfo("Evolving Door", 144, Rarity.RARE, mage.cards.e.EvolvingDoor.class)); cards.add(new SetCardInfo("Exhibition Magician", 106, Rarity.COMMON, mage.cards.e.ExhibitionMagician.class)); cards.add(new SetCardInfo("Exotic Pets", 185, Rarity.UNCOMMON, mage.cards.e.ExoticPets.class));