diff --git a/Mage.Sets/src/mage/cards/t/TemporalIntervention.java b/Mage.Sets/src/mage/cards/t/TemporalIntervention.java new file mode 100644 index 00000000000..9dd39b7c3fb --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TemporalIntervention.java @@ -0,0 +1,46 @@ +package mage.cards.t; + +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.VoidCondition; +import mage.abilities.effects.common.cost.SpellCostReductionSourceEffect; +import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.AbilityWord; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.target.common.TargetOpponent; +import mage.watchers.common.VoidWatcher; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class TemporalIntervention extends CardImpl { + + public TemporalIntervention(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{B}"); + + // Void -- This spell costs {2} less to cast if a nonland permanent left the battlefield this turn or a spell was warped this turn. + this.addAbility(new SimpleStaticAbility( + Zone.ALL, new SpellCostReductionSourceEffect(2, VoidCondition.instance) + .setText("this spell costs {2} less to cast if a nonland permanent " + + "left the battlefield this turn or a spell was warped this turn") + ).setRuleAtTheTop(true).setAbilityWord(AbilityWord.VOID).addHint(VoidCondition.getHint()), new VoidWatcher()); + + // Target opponent reveals their hand. You choose a nonland card from it. That player discards that card. + this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetEffect(StaticFilters.FILTER_CARD_NON_LAND)); + this.getSpellAbility().addTarget(new TargetOpponent()); + } + + private TemporalIntervention(final TemporalIntervention card) { + super(card); + } + + @Override + public TemporalIntervention copy() { + return new TemporalIntervention(this); + } +} diff --git a/Mage.Sets/src/mage/sets/EdgeOfEternities.java b/Mage.Sets/src/mage/sets/EdgeOfEternities.java index 23ae700334b..66a9aeb6c40 100644 --- a/Mage.Sets/src/mage/sets/EdgeOfEternities.java +++ b/Mage.Sets/src/mage/sets/EdgeOfEternities.java @@ -44,6 +44,7 @@ public final class EdgeOfEternities extends ExpansionSet { cards.add(new SetCardInfo("Swamp", 264, Rarity.LAND, mage.cards.basiclands.Swamp.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Swamp", 369, Rarity.LAND, mage.cards.basiclands.Swamp.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Tannuk, Memorial Ensign", 233, Rarity.UNCOMMON, mage.cards.t.TannukMemorialEnsign.class)); + cards.add(new SetCardInfo("Temporal Intervention", 120, Rarity.COMMON, mage.cards.t.TemporalIntervention.class)); cards.add(new SetCardInfo("Tezzeret, Cruel Captain", 2, Rarity.MYTHIC, mage.cards.t.TezzeretCruelCaptain.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Tezzeret, Cruel Captain", 287, Rarity.MYTHIC, mage.cards.t.TezzeretCruelCaptain.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Watery Grave", 261, Rarity.RARE, mage.cards.w.WateryGrave.class)); diff --git a/Mage/src/main/java/mage/abilities/condition/common/VoidCondition.java b/Mage/src/main/java/mage/abilities/condition/common/VoidCondition.java new file mode 100644 index 00000000000..c701de76610 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/condition/common/VoidCondition.java @@ -0,0 +1,32 @@ +package mage.abilities.condition.common; + +import mage.abilities.Ability; +import mage.abilities.condition.Condition; +import mage.abilities.hint.ConditionHint; +import mage.abilities.hint.Hint; +import mage.game.Game; +import mage.watchers.common.VoidWatcher; + +/** + * Requires {@link mage.watchers.common.VoidWatcher} + * + * @author TheElk801 + */ +public enum VoidCondition implements Condition { + instance; + private static final Hint hint = new ConditionHint(instance); + + public static Hint getHint() { + return hint; + } + + @Override + public boolean apply(Game game, Ability source) { + return VoidWatcher.checkPlayer(source.getControllerId(), game); + } + + @Override + public String toString() { + return "a nonland permanent left the battlefield this turn or a spell was warped this turn"; + } +} diff --git a/Mage/src/main/java/mage/constants/AbilityWord.java b/Mage/src/main/java/mage/constants/AbilityWord.java index 6e79b03c841..c8044d3c38c 100644 --- a/Mage/src/main/java/mage/constants/AbilityWord.java +++ b/Mage/src/main/java/mage/constants/AbilityWord.java @@ -63,6 +63,7 @@ public enum AbilityWord { THRESHOLD("Threshold"), UNDERGROWTH("Undergrowth"), VALIANT("Valiant"), + VOID("Void"), WILL_OF_THE_COUNCIL("Will of the council"), WILL_OF_THE_PLANESWALKERS("Will of the planeswalkers"); diff --git a/Mage/src/main/java/mage/watchers/common/VoidWatcher.java b/Mage/src/main/java/mage/watchers/common/VoidWatcher.java new file mode 100644 index 00000000000..a355438a857 --- /dev/null +++ b/Mage/src/main/java/mage/watchers/common/VoidWatcher.java @@ -0,0 +1,56 @@ +package mage.watchers.common; + +import mage.constants.WatcherScope; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.watchers.Watcher; + +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; + +/** + * TODO: this doesn't handle warp yet + * + * @author TheElk801 + */ +public class VoidWatcher extends Watcher { + + // need to track separately for each player as it needs to be in range + private final Set players = new HashSet<>(); + + public VoidWatcher() { + super(WatcherScope.GAME); + } + + @Override + public void watch(GameEvent event, Game game) { + switch (event.getType()) { + case SPELL_CAST: + return; + case ZONE_CHANGE: + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (Zone.BATTLEFIELD.match(zEvent.getFromZone()) + && zEvent.getTarget() != null + && !zEvent.getTarget().isLand(game)) { + players.addAll(game.getState().getPlayersInRange(zEvent.getTarget().getControllerId(), game)); + } + } + } + + @Override + public void reset() { + super.reset(); + players.clear(); + } + + public static boolean checkPlayer(UUID playerId, Game game) { + return game + .getState() + .getWatcher(VoidWatcher.class) + .players + .contains(playerId); + } +} diff --git a/Utils/mtg-cards-data.txt b/Utils/mtg-cards-data.txt index 8b240c0d0e9..dd5f675e781 100644 --- a/Utils/mtg-cards-data.txt +++ b/Utils/mtg-cards-data.txt @@ -59112,6 +59112,7 @@ Tezzeret, Cruel Captain|Edge of Eternities|2|M|{3}|Legendary Planeswalker - Tezz The Seriema|Edge of Eternities|35|R|{1}{W}{W}|Legendary Artifact - Spacecraft|||When The Seriema enters, search your library for a legendary creature card, reveal it, put it into your hand, then shuffle.$Station$STATION 7+$Flying$Other tapped legendary creatures you control have indestructible.$5/5| Embrace Oblivion|Edge of Eternities|98|C|{B}|Sorcery|||As an additional cost to cast this spell, sacrifice an artifact or creature.$Destroy target creature or Spacecraft.| Sothera, the Supervoid|Edge of Eternities|115|M|{2}{B}{B}|Legendary Enchantment|||Whenever a creature you control dies, each opponent chooses a creature they control and exiles it.$At the beginning of your end step, if a player controls no creatures, sacrifice Sothera, then put a creature card exiled with it onto the battlefield under your control with two additional +1/+1 counters on it.| +Temporal Intervention|Edge of Eternities|120|C|{2}{B}|Sorcery|||Void -- This spell costs {2} less to cast if a nonland permanent left the battlefield this turn or a spell was warped this turn.$Target opponent reveals their hand. You choose a nonland card from it. That player discards that card.| Harmonious Grovestrider|Edge of Eternities|189|U|{3}{G}{G}|Creature - Beast|*|*|Ward {2}$This creature's power and toughness are each equal to the number of lands you control.| Alpharael, Dreaming Acolyte|Edge of Eternities|212|U|{1}{U}{B}|Legendary Creature - Human Cleric|2|3|When Alpharael enters, draw two cards. Then discard two cards unless you discard an artifact card. During your turn, Alpharael has deathtouch.| Sami, Ship's Engineer|Edge of Eternities|225|U|{2}{R}{W}|Legendary Creature - Human Artificer|2|4|At the beginning of your end step, if you control two or more tapped creatures, create a tapped 2/2 colorless Robot artifact creature token.|