From 147ad8f86ce123a81aa0250500d2af6c94eca351 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 16 Mar 2015 18:24:26 +0100 Subject: [PATCH] [DTK] Added 8 blue cards and some fixes. --- .../sets/dragonsoftarkir/DraconicRoar.java | 55 +------ .../DragonlordsPrerogative.java | 21 ++- .../dragonsoftarkir/SilumgarSorcerer.java | 86 +++++++++++ .../dragonsoftarkir/SilumgarSpellEater.java | 74 +++++++++ .../sets/dragonsoftarkir/SilumgarsScorn.java | 140 ++++++++++++++++++ .../dragonsoftarkir/SkywiseTeachings.java | 88 +++++++++++ .../sets/dragonsoftarkir/TaigamsStrike.java | 70 +++++++++ .../dragonsoftarkir/TapestryOfTheAges.java | 2 +- .../mage/sets/dragonsoftarkir/VoidSquall.java | 64 ++++++++ .../sets/dragonsoftarkir/YouthfulScholar.java | 64 ++++++++ .../sets/dragonsoftarkir/ZephyrScribe.java | 84 +++++++++++ .../mage/sets/scarsofmirrodin/Disperse.java | 2 +- .../effects/common/CounterTargetEffect.java | 2 +- ...heBattlefieldWhileSpellWasCastWatcher.java | 87 +++++++++++ 14 files changed, 780 insertions(+), 59 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/dragonsoftarkir/SilumgarSorcerer.java create mode 100644 Mage.Sets/src/mage/sets/dragonsoftarkir/SilumgarSpellEater.java create mode 100644 Mage.Sets/src/mage/sets/dragonsoftarkir/SilumgarsScorn.java create mode 100644 Mage.Sets/src/mage/sets/dragonsoftarkir/SkywiseTeachings.java create mode 100644 Mage.Sets/src/mage/sets/dragonsoftarkir/TaigamsStrike.java create mode 100644 Mage.Sets/src/mage/sets/dragonsoftarkir/VoidSquall.java create mode 100644 Mage.Sets/src/mage/sets/dragonsoftarkir/YouthfulScholar.java create mode 100644 Mage.Sets/src/mage/sets/dragonsoftarkir/ZephyrScribe.java create mode 100644 Mage/src/mage/watchers/common/DragonOnTheBattlefieldWhileSpellWasCastWatcher.java diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/DraconicRoar.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/DraconicRoar.java index 7a3df5f350..44f9721138 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/DraconicRoar.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/DraconicRoar.java @@ -27,8 +27,6 @@ */ package mage.sets.dragonsoftarkir; -import java.util.HashSet; -import java.util.Set; import java.util.UUID; import mage.abilities.Ability; import mage.abilities.costs.Cost; @@ -40,18 +38,14 @@ import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Rarity; -import mage.constants.WatcherScope; import mage.filter.common.FilterCreatureCard; -import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; -import mage.game.events.GameEvent; import mage.game.permanent.Permanent; -import mage.game.stack.Spell; import mage.players.Player; import mage.target.common.TargetCardInHand; import mage.target.common.TargetCreaturePermanent; -import mage.watchers.Watcher; +import mage.watchers.common.DragonOnTheBattlefieldWhileSpellWasCastWatcher; /** * @@ -76,7 +70,7 @@ public class DraconicRoar extends CardImpl { this.getSpellAbility().addEffect(new DamageTargetEffect(3)); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addEffect(new DraconicRoarEffect()); - this.getSpellAbility().addWatcher(new DraconicRoarCastWatcher()); + this.getSpellAbility().addWatcher(new DragonOnTheBattlefieldWhileSpellWasCastWatcher()); } @Override @@ -120,7 +114,7 @@ class DraconicRoarEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - DraconicRoarCastWatcher watcher = (DraconicRoarCastWatcher) game.getState().getWatchers().get("DraconicRoarCastWatcher"); + DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get("DragonOnTheBattlefieldWhileSpellWasCastWatcher"); boolean condition = watcher != null && watcher.castWithConditionTrue(source.getId()); if (!condition) { for (Cost cost: source.getCosts()) { @@ -144,46 +138,3 @@ class DraconicRoarEffect extends OneShotEffect { } } -class DraconicRoarCastWatcher extends Watcher { - - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Dragon", "Dragons"); - - private final Set castWithDragonOnTheBattlefield = new HashSet<>(); - - public DraconicRoarCastWatcher() { - super("DraconicRoarCastWatcher", WatcherScope.GAME); - } - - public DraconicRoarCastWatcher(final DraconicRoarCastWatcher watcher) { - super(watcher); - this.castWithDragonOnTheBattlefield.addAll(watcher.castWithDragonOnTheBattlefield); - } - - @Override - public void watch(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - // targetId is the unique ID of the spell - Spell spell = game.getState().getStack().getSpell(event.getTargetId()); - if (spell != null) { - if (game.getBattlefield().countAll(filter, spell.getControllerId(), game) > 0) { - castWithDragonOnTheBattlefield.add(spell.getId()); - } - - } - } - } - - @Override - public void reset() { - castWithDragonOnTheBattlefield.clear(); - } - - public boolean castWithConditionTrue(UUID spellId) { - return castWithDragonOnTheBattlefield.contains(spellId); - } - - @Override - public DraconicRoarCastWatcher copy() { - return new DraconicRoarCastWatcher(this); - } -} diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/DragonlordsPrerogative.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/DragonlordsPrerogative.java index 42dc56ae9f..bed365f726 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/DragonlordsPrerogative.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/DragonlordsPrerogative.java @@ -36,6 +36,7 @@ import mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect; import mage.abilities.effects.ContinuousRuleModifyingEffect; import mage.abilities.effects.common.CantBeCounteredSourceEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.InfoEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; @@ -45,6 +46,7 @@ import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.game.stack.Spell; +import mage.players.Player; import mage.target.common.TargetCardInHand; /** @@ -64,20 +66,31 @@ public class DragonlordsPrerogative extends CardImpl { this.expansionSetCode = "DTK"; // As an additional cost to cast Dragonlord's Prerogative, you may reveal a Dragon card from your hand. - // If you revealed a Dragon card or controlled a Dragon as you cast Dragonlord's Prerogative, Dragonlord's Prerogative can't be countered. - // Draw four cards. + this.getSpellAbility().addEffect(new InfoEffect("As an additional cost to cast {this}, you may reveal a Dragon card from your hand")); - this.getSpellAbility().addCost(new RevealTargetFromHandCost(new TargetCardInHand(0, 1, filter))); + // If you revealed a Dragon card or controlled a Dragon as you cast Dragonlord's Prerogative, Dragonlord's Prerogative can't be countered. Condition condition = new DragonlordsPrerogativeCondition(); ContinuousRuleModifyingEffect cantBeCountered = new CantBeCounteredSourceEffect(); ConditionalContinuousRuleModifyingEffect conditionalCantBeCountered = new ConditionalContinuousRuleModifyingEffect(cantBeCountered, condition); conditionalCantBeCountered.setText("If you revealed a Dragon card or controlled a Dragon as you cast {this}, {this} can't be countered"); Ability ability = new SimpleStaticAbility(Zone.STACK, conditionalCantBeCountered); this.addAbility(ability); + + // Draw four cards. this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(4)); } - + + @Override + public void adjustCosts(Ability ability, Game game) { + Player controller = game.getPlayer(ability.getControllerId()); + if (controller != null) { + if (controller.getHand().count(filter, game) > 0) { + ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0,1, filter))); + } + } + } + public DragonlordsPrerogative(final DragonlordsPrerogative card) { super(card); } diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/SilumgarSorcerer.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/SilumgarSorcerer.java new file mode 100644 index 0000000000..c7b044424a --- /dev/null +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/SilumgarSorcerer.java @@ -0,0 +1,86 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.dragonsoftarkir; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.ExploitCreatureTriggeredAbility; +import mage.abilities.effects.common.CounterTargetEffect; +import mage.abilities.keyword.FlashAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.ExploitAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.FilterSpell; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.target.TargetSpell; + +/** + * + * @author LevelX2 + */ +public class SilumgarSorcerer extends CardImpl { + + private static final FilterSpell filter = new FilterSpell("creature spell"); + + static { + filter.add(new CardTypePredicate(CardType.CREATURE)); + } + + public SilumgarSorcerer(UUID ownerId) { + super(ownerId, 76, "Silumgar Sorcerer", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{U}{U}"); + this.expansionSetCode = "DTK"; + this.subtype.add("Human"); + this.subtype.add("Wizard"); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Flash + this.addAbility(FlashAbility.getInstance()); + // Flying + this.addAbility(FlyingAbility.getInstance()); + // Exploit (When this creature enters the battlefield, you may sacrifice a creature.) + this.addAbility(new ExploitAbility()); + + // When Silumgar Sorcerer exploits a creature, counter target creature spell. + Ability ability = new ExploitCreatureTriggeredAbility(new CounterTargetEffect(), false); + ability.addTarget(new TargetSpell(filter)); + this.addAbility(ability); + } + + public SilumgarSorcerer(final SilumgarSorcerer card) { + super(card); + } + + @Override + public SilumgarSorcerer copy() { + return new SilumgarSorcerer(this); + } +} diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/SilumgarSpellEater.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/SilumgarSpellEater.java new file mode 100644 index 0000000000..c82c99fe59 --- /dev/null +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/SilumgarSpellEater.java @@ -0,0 +1,74 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.dragonsoftarkir; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.TurnedFaceUpSourceTriggeredAbility; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.CounterUnlessPaysEffect; +import mage.abilities.keyword.MorphAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.target.TargetSpell; + +/** + * + * @author LevelX2 + */ +public class SilumgarSpellEater extends CardImpl { + + public SilumgarSpellEater(UUID ownerId) { + super(ownerId, 77, "Silumgar Spell-Eater", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{U}"); + this.expansionSetCode = "DTK"; + this.subtype.add("Naga"); + this.subtype.add("Wizard"); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // Megamorph {4}{U} + this.addAbility(new MorphAbility(this, new ManaCostsImpl("{4}{U}"), true)); + + // When Silumgar Spell-Eater is turned face up, counter target spell unless its controller pays {3}. + Ability ability = new TurnedFaceUpSourceTriggeredAbility(new CounterUnlessPaysEffect(new GenericManaCost(3)), false, false); + ability.addTarget(new TargetSpell()); + this.addAbility(ability); + } + + public SilumgarSpellEater(final SilumgarSpellEater card) { + super(card); + } + + @Override + public SilumgarSpellEater copy() { + return new SilumgarSpellEater(this); + } +} diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/SilumgarsScorn.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/SilumgarsScorn.java new file mode 100644 index 0000000000..b19b8cdf1f --- /dev/null +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/SilumgarsScorn.java @@ -0,0 +1,140 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.dragonsoftarkir; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.costs.Cost; +import mage.abilities.costs.common.RevealTargetFromHandCost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.InfoEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.common.FilterCreatureCard; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.game.stack.StackObject; +import mage.players.Player; +import mage.target.TargetSpell; +import mage.target.common.TargetCardInHand; +import mage.watchers.common.DragonOnTheBattlefieldWhileSpellWasCastWatcher; + +/** + * + * @author LevelX2 + */ +public class SilumgarsScorn extends CardImpl { + + private static final FilterCreatureCard filter = new FilterCreatureCard("a Dragon card from your hand (you don't have to)"); + + static { + filter.add(new SubtypePredicate("Dragon")); + } + + public SilumgarsScorn(UUID ownerId) { + super(ownerId, 78, "Silumgar's Scorn", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{U}{U}"); + this.expansionSetCode = "DTK"; + + // As an additional cost to cast Silumgar's Scorn, you may reveal a Dragon card from your hand. + this.getSpellAbility().addEffect(new InfoEffect("As an additional cost to cast {this}, you may reveal a Dragon card from your hand
")); + + // Counter target spell unless its controller pays {1}. If you revealed a Dragon card or controlled a Dragon as you cast Silumgar's Scorn, counter that spell instead. + this.getSpellAbility().addEffect(new SilumgarsScornCounterEffect()); + this.getSpellAbility().addTarget(new TargetSpell()); + this.getSpellAbility().addWatcher(new DragonOnTheBattlefieldWhileSpellWasCastWatcher()); + + } + + + @Override + public void adjustCosts(Ability ability, Game game) { + Player controller = game.getPlayer(ability.getControllerId()); + if (controller != null) { + if (controller.getHand().count(filter, game) > 0) { + ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0,1, filter))); + } + } + } + + public SilumgarsScorn(final SilumgarsScorn card) { + super(card); + } + + @Override + public SilumgarsScorn copy() { + return new SilumgarsScorn(this); + } +} + +class SilumgarsScornCounterEffect extends OneShotEffect { + + public SilumgarsScornCounterEffect() { + super(Outcome.Detriment); + staticText = "Counter target spell unless its controller pays {1}. If you revealed a Dragon card or controlled a Dragon as you cast {this}, counter that spell instead"; + } + + public SilumgarsScornCounterEffect(final SilumgarsScornCounterEffect effect) { + super(effect); + } + + @Override + public SilumgarsScornCounterEffect copy() { + return new SilumgarsScornCounterEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + StackObject spell = game.getStack().getStackObject(targetPointer.getFirst(game, source)); + if (spell != null) { + Player player = game.getPlayer(spell.getControllerId()); + if (player != null) { + DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher = (DragonOnTheBattlefieldWhileSpellWasCastWatcher) game.getState().getWatchers().get("DragonOnTheBattlefieldWhileSpellWasCastWatcher"); + boolean condition = watcher != null && watcher.castWithConditionTrue(source.getId()); + if (!condition) { + for (Cost cost: source.getCosts()) { + if (cost instanceof RevealTargetFromHandCost) { + condition = ((RevealTargetFromHandCost)cost).getNumberRevealedCards() > 0; + } + } + } + if (condition) { + return game.getStack().counter(spell.getId(), source.getSourceId(), game); + } + if (!(player.chooseUse(Outcome.Benefit, "Would you like to pay {1} to prevent counter effect?", game) && + new GenericManaCost(1).pay(source, game, spell.getSourceId(), spell.getControllerId(), false))) { + return game.getStack().counter(spell.getId(), source.getSourceId(), game); + } + } + } + return true; + } + +} diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/SkywiseTeachings.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/SkywiseTeachings.java new file mode 100644 index 0000000000..452e55e509 --- /dev/null +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/SkywiseTeachings.java @@ -0,0 +1,88 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.dragonsoftarkir; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SpellCastControllerTriggeredAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.DoIfCostPaid; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.FilterSpell; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.game.permanent.token.Token; + +/** + * + * @author LevelX2 + */ +public class SkywiseTeachings extends CardImpl { + + private static final FilterSpell filter = new FilterSpell("a noncreature spell"); + + static { + filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE))); + } + + public SkywiseTeachings(UUID ownerId) { + super(ownerId, 79, "Skywise Teachings", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}"); + this.expansionSetCode = "DTK"; + + // Whenever you cast a noncreature spell, you may pay {1}{U}. If you do, put a 2/2 blue Djinn Monk creature token with flying onto the battlefield. + this.addAbility(new SpellCastControllerTriggeredAbility(new DoIfCostPaid(new CreateTokenEffect(new SkywiseTeachingsToken()), new ManaCostsImpl("{1}{U}")), filter, false)); + + } + + public SkywiseTeachings(final SkywiseTeachings card) { + super(card); + } + + @Override + public SkywiseTeachings copy() { + return new SkywiseTeachings(this); + } +} + +class SkywiseTeachingsToken extends Token { + + SkywiseTeachingsToken() { + super("Djinn Monk", "a 2/2 blue Djinn Monk creature token with flying"); + cardType.add(CardType.CREATURE); + color.setRed(true); + this.subtype.add("Djinn"); + this.subtype.add("Monk"); + power = new MageInt(2); + toughness = new MageInt(2); + this.addAbility(FlyingAbility.getInstance()); + } +} diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/TaigamsStrike.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/TaigamsStrike.java new file mode 100644 index 0000000000..c88da4fca3 --- /dev/null +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/TaigamsStrike.java @@ -0,0 +1,70 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.dragonsoftarkir; + +import java.util.UUID; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.combat.CantBeBlockedTargetEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.keyword.ReboundAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class TaigamsStrike extends CardImpl { + + public TaigamsStrike(UUID ownerId) { + super(ownerId, 81, "Taigam's Strike", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{3}{U}"); + this.expansionSetCode = "DTK"; + + // Target creature gets +2/+0 until end of turn and can't be blocked this turn. + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + this.getSpellAbility().addEffect(new BoostTargetEffect(2, 0, Duration.EndOfTurn)); + Effect effect = new CantBeBlockedTargetEffect(); + effect.setText("and can't be blocked this turn"); + this.getSpellAbility().addEffect(effect); + + // Rebound + this.addAbility(new ReboundAbility()); + } + + public TaigamsStrike(final TaigamsStrike card) { + super(card); + } + + @Override + public TaigamsStrike copy() { + return new TaigamsStrike(this); + } +} diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/TapestryOfTheAges.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/TapestryOfTheAges.java index a06844574f..cd737b9530 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/TapestryOfTheAges.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/TapestryOfTheAges.java @@ -54,7 +54,7 @@ import mage.watchers.Watcher; public class TapestryOfTheAges extends CardImpl { public TapestryOfTheAges(UUID ownerId) { - super(ownerId, 246, "Tapestry of the Ages", Rarity.UNCOMMON, new CardType[]{}, "Artifact"); + super(ownerId, 246, "Tapestry of the Ages", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT},"{4}" ); this.expansionSetCode = "DTK"; // {2}, {T}: Draw a card. Activate this ability only if you've cast a noncreature spell this turn. diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/VoidSquall.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/VoidSquall.java new file mode 100644 index 0000000000..3b2347442a --- /dev/null +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/VoidSquall.java @@ -0,0 +1,64 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.dragonsoftarkir; + +import java.util.UUID; +import mage.abilities.effects.common.ReturnToHandTargetEffect; +import mage.abilities.keyword.ReboundAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.target.common.TargetNonlandPermanent; + +/** + * + * @author LevelX2 + */ +public class VoidSquall extends CardImpl { + + public VoidSquall(UUID ownerId) { + super(ownerId, 83, "Void Squall", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{4}{U}"); + this.expansionSetCode = "DTK"; + + // Return target nonland permanent to its owner's hand. + this.getSpellAbility().addTarget(new TargetNonlandPermanent()); + this.getSpellAbility().addEffect(new ReturnToHandTargetEffect()); + + // Rebound + this.addAbility(new ReboundAbility()); + } + + public VoidSquall(final VoidSquall card) { + super(card); + } + + @Override + public VoidSquall copy() { + return new VoidSquall(this); + } +} diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/YouthfulScholar.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/YouthfulScholar.java new file mode 100644 index 0000000000..6acd269116 --- /dev/null +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/YouthfulScholar.java @@ -0,0 +1,64 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.dragonsoftarkir; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; + +/** + * + * @author LevelX2 + */ +public class YouthfulScholar extends CardImpl { + + public YouthfulScholar(UUID ownerId) { + super(ownerId, 84, "Youthful Scholar", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{U}"); + this.expansionSetCode = "DTK"; + this.subtype.add("Human"); + this.subtype.add("Wizard"); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // When Youthful Scholar dies, draw two cards. + this.addAbility(new DiesTriggeredAbility(new DrawCardSourceControllerEffect(2), false)); + } + + public YouthfulScholar(final YouthfulScholar card) { + super(card); + } + + @Override + public YouthfulScholar copy() { + return new YouthfulScholar(this); + } +} diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/ZephyrScribe.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/ZephyrScribe.java new file mode 100644 index 0000000000..aa237076c2 --- /dev/null +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/ZephyrScribe.java @@ -0,0 +1,84 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.dragonsoftarkir; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SpellCastControllerTriggeredAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.DrawDiscardControllerEffect; +import mage.abilities.effects.common.UntapSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.FilterSpell; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; + +/** + * + * @author LevelX2 + */ +public class ZephyrScribe extends CardImpl { + + private static final FilterSpell filter = new FilterSpell("a noncreature spell"); + + static { + filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE))); + } + + public ZephyrScribe(UUID ownerId) { + super(ownerId, 85, "Zephyr Scribe", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{U}"); + this.expansionSetCode = "DTK"; + this.subtype.add("Human"); + this.subtype.add("Monk"); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // {U}, {T}: Draw a card, then discard a card. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawDiscardControllerEffect(1,1), new ManaCostsImpl("{U}")); + ability.addCost(new TapSourceCost()); + this.addAbility(ability); + + // Whenever you cast a noncreature spell, untap Zephyr Scribe. + this.addAbility(new SpellCastControllerTriggeredAbility(new UntapSourceEffect(), filter, false)); + } + + public ZephyrScribe(final ZephyrScribe card) { + super(card); + } + + @Override + public ZephyrScribe copy() { + return new ZephyrScribe(this); + } +} diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/Disperse.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/Disperse.java index e3bf2ead10..d336944849 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/Disperse.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/Disperse.java @@ -44,8 +44,8 @@ public class Disperse extends CardImpl { public Disperse (UUID ownerId) { super(ownerId, 31, "Disperse", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{U}"); this.expansionSetCode = "SOM"; - this.color.setBlue(true); + // Return target nonland permanent to its owner's hand. this.getSpellAbility().addTarget(new TargetNonlandPermanent()); this.getSpellAbility().addEffect(new ReturnToHandTargetEffect()); } diff --git a/Mage/src/mage/abilities/effects/common/CounterTargetEffect.java b/Mage/src/mage/abilities/effects/common/CounterTargetEffect.java index 0bddcee488..ea1c987bb9 100644 --- a/Mage/src/mage/abilities/effects/common/CounterTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/CounterTargetEffect.java @@ -69,6 +69,6 @@ public class CounterTargetEffect extends OneShotEffect { if (staticText != null && !staticText.isEmpty()) { return staticText; } - return "Counter target " + mode.getTargets().get(0).getTargetName(); + return "counter target " + mode.getTargets().get(0).getTargetName(); } } diff --git a/Mage/src/mage/watchers/common/DragonOnTheBattlefieldWhileSpellWasCastWatcher.java b/Mage/src/mage/watchers/common/DragonOnTheBattlefieldWhileSpellWasCastWatcher.java new file mode 100644 index 0000000000..d7c3bd50b0 --- /dev/null +++ b/Mage/src/mage/watchers/common/DragonOnTheBattlefieldWhileSpellWasCastWatcher.java @@ -0,0 +1,87 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.watchers.common; + +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; +import mage.constants.WatcherScope; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.stack.Spell; +import mage.watchers.Watcher; + +/** + * + * @author LevelX2 + */ + +public class DragonOnTheBattlefieldWhileSpellWasCastWatcher extends Watcher { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Dragon", "Dragons"); + + private final Set castWithDragonOnTheBattlefield = new HashSet<>(); + + public DragonOnTheBattlefieldWhileSpellWasCastWatcher() { + super("DragonOnTheBattlefieldWhileSpellWasCastWatcher", WatcherScope.GAME); + } + + public DragonOnTheBattlefieldWhileSpellWasCastWatcher(final DragonOnTheBattlefieldWhileSpellWasCastWatcher watcher) { + super(watcher); + this.castWithDragonOnTheBattlefield.addAll(watcher.castWithDragonOnTheBattlefield); + } + + @Override + public void watch(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.SPELL_CAST) { + // targetId is the unique ID of the spell + Spell spell = game.getState().getStack().getSpell(event.getTargetId()); + if (spell != null) { + if (game.getBattlefield().countAll(filter, spell.getControllerId(), game) > 0) { + castWithDragonOnTheBattlefield.add(spell.getId()); + } + + } + } + } + + @Override + public void reset() { + castWithDragonOnTheBattlefield.clear(); + } + + public boolean castWithConditionTrue(UUID spellId) { + return castWithDragonOnTheBattlefield.contains(spellId); + } + + @Override + public DragonOnTheBattlefieldWhileSpellWasCastWatcher copy() { + return new DragonOnTheBattlefieldWhileSpellWasCastWatcher(this); + } +}