diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/DosanTheFallingLeaf.java b/Mage.Sets/src/mage/sets/championsofkamigawa/DosanTheFallingLeaf.java index ed1a389786d..34e679bf7c9 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/DosanTheFallingLeaf.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/DosanTheFallingLeaf.java @@ -86,10 +86,7 @@ class DosanTheFallingLeafEffect extends ReplacementEffectImpl { + + public DreadshipReef(UUID ownerId) { + super(ownerId, 271, "Dreadship Reef", Rarity.UNCOMMON, new CardType[]{CardType.LAND}, ""); + this.expansionSetCode = "CMD"; + + // {tap}: Add {1} to your mana pool. + this.addAbility(new ColorlessManaAbility()); + // {1}, {tap}: Put a storage counter on Dreadship Reef. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.STORAGE.createInstance()),new GenericManaCost(1)); + ability.addCost(new TapSourceCost()); + this.addAbility(ability); + // {1}, Remove X storage counters from Dreadship Reef: Add X mana in any combination of {U} and/or {B} to your mana pool. + ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, + new ManaInAnyCombinationEffect(new RemovedCountersForCostValue(), ColoredManaSymbol.U, ColoredManaSymbol.B), + new GenericManaCost(1)); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance())); + this.addAbility(ability); + + } + + public DreadshipReef(final DreadshipReef card) { + super(card); + } + + @Override + public DreadshipReef copy() { + return new DreadshipReef(this); + } +} diff --git a/Mage.Sets/src/mage/sets/commander/FungalReaches.java b/Mage.Sets/src/mage/sets/commander/FungalReaches.java new file mode 100644 index 00000000000..993a398d10a --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander/FungalReaches.java @@ -0,0 +1,82 @@ +/* + * 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.commander; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.RemoveVariableCountersSourceCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.dynamicvalue.common.RemovedCountersForCostValue; +import mage.abilities.effects.common.ManaInAnyCombinationEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.mana.ColorlessManaAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.ColoredManaSymbol; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.counters.CounterType; + +/** + * + * @author LevelX2 + */ +public class FungalReaches extends CardImpl { + + public FungalReaches(UUID ownerId) { + super(ownerId, 274, "Fungal Reaches", Rarity.UNCOMMON, new CardType[]{CardType.LAND}, ""); + this.expansionSetCode = "CMD"; + + // {tap}: Add {1} to your mana pool. + this.addAbility(new ColorlessManaAbility()); + + // {1}, {tap}: Put a storage counter on Fungal Reaches. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.STORAGE.createInstance()),new GenericManaCost(1)); + ability.addCost(new TapSourceCost()); + this.addAbility(ability); + + // {1}, Remove X storage counters from Fungal Reaches: Add X mana in any combination of {R} and/or {G} to your mana pool. + ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, + new ManaInAnyCombinationEffect(new RemovedCountersForCostValue(), ColoredManaSymbol.R, ColoredManaSymbol.G), + new GenericManaCost(1)); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance())); + this.addAbility(ability); + + } + + public FungalReaches(final FungalReaches card) { + super(card); + } + + @Override + public FungalReaches copy() { + return new FungalReaches(this); + } +} diff --git a/Mage.Sets/src/mage/sets/darksteel/Flamebreak.java b/Mage.Sets/src/mage/sets/darksteel/Flamebreak.java new file mode 100644 index 00000000000..99f26437131 --- /dev/null +++ b/Mage.Sets/src/mage/sets/darksteel/Flamebreak.java @@ -0,0 +1,120 @@ +/* + * 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.darksteel; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.DamageEverythingEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.AbilityPredicate; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.watchers.common.DamagedByWatcher; + +/** + * + * @author LevelX2 + */ +public class Flamebreak extends CardImpl { + + private static final FilterCreaturePermanent filter1 = new FilterCreaturePermanent("creature without flying"); + + static { + filter1.add(Predicates.not(new AbilityPredicate(FlyingAbility.class))); + } + + public Flamebreak(UUID ownerId) { + super(ownerId, 61, "Flamebreak", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{R}{R}{R}"); + this.expansionSetCode = "DST"; + + this.color.setRed(true); + + // Flamebreak deals 3 damage to each creature without flying and each player. Creatures dealt damage this way can't be regenerated this turn. + this.getSpellAbility().addEffect(new DamageEverythingEffect(new StaticValue(3), filter1)); + this.getSpellAbility().addEffect(new FlamebreakCantRegenerateEffect()); + this.addWatcher(new DamagedByWatcher()); + } + + public Flamebreak(final Flamebreak card) { + super(card); + } + + @Override + public Flamebreak copy() { + return new Flamebreak(this); + } +} + +class FlamebreakCantRegenerateEffect extends ReplacementEffectImpl { + + public FlamebreakCantRegenerateEffect() { + super(Duration.EndOfTurn, Outcome.Detriment); + staticText = "Creatures dealt damage this way can't be regenerated this turn"; + } + + public FlamebreakCantRegenerateEffect(final FlamebreakCantRegenerateEffect effect) { + super(effect); + } + + @Override + public FlamebreakCantRegenerateEffect copy() { + return new FlamebreakCantRegenerateEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + return true; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (event.getType() == EventType.REGENERATE) { + DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get("DamagedByWatcher", source.getSourceId()); + if (watcher != null) { + return watcher.damagedCreatures.contains(event.getTargetId()); + } + } + return false; + } + +} diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/EternalDominion.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/EternalDominion.java index 37e560fdb04..4589723eaae 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/EternalDominion.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/EternalDominion.java @@ -80,7 +80,7 @@ public class EternalDominion extends CardImpl { class EternalDominionEffect extends OneShotEffect { - private static final FilterCard filter = new FilterCard(); + private static final FilterCard filter = new FilterCard("an artifact, creature, enchantment, or land card"); static { filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), @@ -103,8 +103,7 @@ class EternalDominionEffect extends OneShotEffect { boolean applied = false; Player opponent = game.getPlayer(source.getFirstTarget()); Player you = game.getPlayer(source.getControllerId()); - if (opponent != null - && you != null) { + if (opponent != null && you != null) { TargetCardInLibrary target = new TargetCardInLibrary(filter); you.searchLibrary(target, game, opponent.getId()); Card targetCard = game.getCard(target.getFirstTarget()); diff --git a/Mage.Sets/src/mage/sets/shadowmoor/Firespout.java b/Mage.Sets/src/mage/sets/shadowmoor/Firespout.java index 30e01e61404..c312e1d314d 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/Firespout.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/Firespout.java @@ -28,15 +28,14 @@ package mage.sets.shadowmoor; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.ManaType; -import mage.constants.Rarity; import mage.abilities.condition.common.ManaWasSpentCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.DamageAllEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.ColoredManaSymbol; +import mage.constants.Rarity; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.AbilityPredicate; diff --git a/Mage.Sets/src/mage/sets/tenth/Incinerate.java b/Mage.Sets/src/mage/sets/tenth/Incinerate.java index 4c3f770dddb..ba24ff76110 100644 --- a/Mage.Sets/src/mage/sets/tenth/Incinerate.java +++ b/Mage.Sets/src/mage/sets/tenth/Incinerate.java @@ -100,8 +100,9 @@ class IncinerateEffect extends ReplacementEffectImpl { public boolean applies(GameEvent event, Ability source, Game game) { if (event.getType() == EventType.REGENERATE) { DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get("DamagedByWatcher", source.getSourceId()); - if (watcher != null) + if (watcher != null) { return watcher.damagedCreatures.contains(event.getTargetId()); + } } return false; } diff --git a/Mage.Sets/src/mage/sets/timespiral/CalciformPools.java b/Mage.Sets/src/mage/sets/timespiral/CalciformPools.java new file mode 100644 index 00000000000..e585f1327eb --- /dev/null +++ b/Mage.Sets/src/mage/sets/timespiral/CalciformPools.java @@ -0,0 +1,80 @@ +/* + * 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.timespiral; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.RemoveVariableCountersSourceCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.dynamicvalue.common.RemovedCountersForCostValue; +import mage.abilities.effects.common.ManaInAnyCombinationEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.mana.ColorlessManaAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.ColoredManaSymbol; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.counters.CounterType; + +/** + * + * @author LevelX2 + */ +public class CalciformPools extends CardImpl { + + public CalciformPools(UUID ownerId) { + super(ownerId, 270, "Calciform Pools", Rarity.UNCOMMON, new CardType[]{CardType.LAND}, ""); + this.expansionSetCode = "TSP"; + + // {tap}: Add {1} to your mana pool. + this.addAbility(new ColorlessManaAbility()); + // {1}, {tap}: Put a storage counter on Calciform Pools. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.STORAGE.createInstance()),new GenericManaCost(1)); + ability.addCost(new TapSourceCost()); + this.addAbility(ability); + // {1}, Remove X storage counters from Calciform Pools: Add X mana in any combination of {W} and/or {U} to your mana pool. + ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, + new ManaInAnyCombinationEffect(new RemovedCountersForCostValue(), ColoredManaSymbol.W, ColoredManaSymbol.U), + new GenericManaCost(1)); + ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance())); + this.addAbility(ability); + + } + + public CalciformPools(final CalciformPools card) { + super(card); + } + + @Override + public CalciformPools copy() { + return new CalciformPools(this); + } +} diff --git a/Mage.Sets/src/mage/sets/timespiral/DreadshipReef.java b/Mage.Sets/src/mage/sets/timespiral/DreadshipReef.java new file mode 100644 index 00000000000..442438f3ab1 --- /dev/null +++ b/Mage.Sets/src/mage/sets/timespiral/DreadshipReef.java @@ -0,0 +1,52 @@ +/* + * 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.timespiral; + +import java.util.UUID; + +/** + * + * @author LevelX2 + */ +public class DreadshipReef extends mage.sets.commander.DreadshipReef { + + public DreadshipReef(UUID ownerId) { + super(ownerId); + this.cardNumber = 271; + this.expansionSetCode = "TSP"; + } + + public DreadshipReef(final DreadshipReef card) { + super(card); + } + + @Override + public DreadshipReef copy() { + return new DreadshipReef(this); + } +} diff --git a/Mage.Sets/src/mage/sets/timespiral/FungalReaches.java b/Mage.Sets/src/mage/sets/timespiral/FungalReaches.java new file mode 100644 index 00000000000..1c45fc0e4ea --- /dev/null +++ b/Mage.Sets/src/mage/sets/timespiral/FungalReaches.java @@ -0,0 +1,52 @@ +/* + * 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.timespiral; + +import java.util.UUID; + +/** + * + * @author LevelX2 + */ +public class FungalReaches extends mage.sets.commander.FungalReaches { + + public FungalReaches(UUID ownerId) { + super(ownerId); + this.cardNumber = 273; + this.expansionSetCode = "TSP"; + } + + public FungalReaches(final FungalReaches card) { + super(card); + } + + @Override + public FungalReaches copy() { + return new FungalReaches(this); + } +} diff --git a/Mage.Sets/src/mage/sets/timespiral/TeferiMageOfZhalfir.java b/Mage.Sets/src/mage/sets/timespiral/TeferiMageOfZhalfir.java new file mode 100644 index 00000000000..da5c0d53dc3 --- /dev/null +++ b/Mage.Sets/src/mage/sets/timespiral/TeferiMageOfZhalfir.java @@ -0,0 +1,176 @@ +/* + * 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.timespiral; + +import java.util.UUID; +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.keyword.FlashAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Layer; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.SubLayer; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ +public class TeferiMageOfZhalfir extends CardImpl { + + public TeferiMageOfZhalfir(UUID ownerId) { + super(ownerId, 83, "Teferi, Mage of Zhalfir", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{U}{U}{U}"); + this.expansionSetCode = "TSP"; + this.supertype.add("Legendary"); + this.subtype.add("Human"); + this.subtype.add("Wizard"); + + this.color.setBlue(true); + this.power = new MageInt(3); + this.toughness = new MageInt(4); + + // Flash + this.addAbility(FlashAbility.getInstance()); + // Creature cards you own that aren't on the battlefield have flash. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new TeferiMageOfZhalfirAddFlashEffect())); + + // Each opponent can cast spells only any time he or she could cast a sorcery. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new TeferiMageOfZhalfirReplacementEffect())); + + + } + + public TeferiMageOfZhalfir(final TeferiMageOfZhalfir card) { + super(card); + } + + @Override + public TeferiMageOfZhalfir copy() { + return new TeferiMageOfZhalfir(this); + } +} + +class TeferiMageOfZhalfirAddFlashEffect extends ContinuousEffectImpl { + + public TeferiMageOfZhalfirAddFlashEffect() { + super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility); + this.staticText = "Creature cards you own that aren't on the battlefield have flash"; + } + + public TeferiMageOfZhalfirAddFlashEffect(final TeferiMageOfZhalfirAddFlashEffect effect) { + super(effect); + } + + @Override + public TeferiMageOfZhalfirAddFlashEffect copy() { + return new TeferiMageOfZhalfirAddFlashEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + // in graveyard + for (UUID cardId: controller.getGraveyard()) { + Card card = game.getCard(cardId); + if (card.getCardType().contains(CardType.CREATURE)) { + game.getState().addOtherAbility(cardId, FlashAbility.getInstance()); + } + } + // on Hand + for (UUID cardId: controller.getHand()) { + Card card = game.getCard(cardId); + if (card.getCardType().contains(CardType.CREATURE)) { + game.getState().addOtherAbility(cardId, FlashAbility.getInstance()); + } + } + // in Exile + for (Card card: game.getState().getExile().getAllCards(game)) { + if (card.getOwnerId().equals(controller.getId()) && card.getCardType().contains(CardType.CREATURE)) { + game.getState().addOtherAbility(card.getId(), FlashAbility.getInstance()); + } + } + // in Library seems not relevant yet + return true; + } + return false; + } +} + +class TeferiMageOfZhalfirReplacementEffect extends ReplacementEffectImpl { + TeferiMageOfZhalfirReplacementEffect() { + super(Duration.WhileOnBattlefield, Outcome.Detriment); + staticText = "Each opponent can cast spells only any time he or she could cast a sorcery"; + } + + TeferiMageOfZhalfirReplacementEffect(final TeferiMageOfZhalfirReplacementEffect effect) { + super(effect); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + MageObject mageObject = game.getObject(source.getSourceId()); + Player opponent = game.getPlayer(event.getPlayerId()); + if (opponent != null && mageObject != null) { + game.informPlayer(opponent, "You can cast spells only any time you could cast a sorcery (" + mageObject.getName() +")"); + } + return true; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (event.getType() == GameEvent.EventType.CAST_SPELL) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null && controller.hasOpponent(event.getPlayerId(), game)) { + return !game.canPlaySorcery(event.getPlayerId()); + } + } + return false; + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public TeferiMageOfZhalfirReplacementEffect copy() { + return new TeferiMageOfZhalfirReplacementEffect(this); + } +}