diff --git a/Mage.Sets/src/mage/sets/conspiracy/ReignOfThePit.java b/Mage.Sets/src/mage/sets/conspiracy/ReignOfThePit.java new file mode 100644 index 0000000000..da60b466e3 --- /dev/null +++ b/Mage.Sets/src/mage/sets/conspiracy/ReignOfThePit.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.conspiracy; + +import java.util.UUID; + +/** + * + * @author emerald000 + */ +public class ReignOfThePit extends mage.sets.vintagemasters.ReignOfThePit { + + public ReignOfThePit(UUID ownerId) { + super(ownerId); + this.cardNumber = 29; + this.expansionSetCode = "CNS"; + } + + public ReignOfThePit(final ReignOfThePit card) { + super(card); + } + + @Override + public ReignOfThePit copy() { + return new ReignOfThePit(this); + } +} diff --git a/Mage.Sets/src/mage/sets/fifthedition/KrovikanSorcerer.java b/Mage.Sets/src/mage/sets/fifthedition/KrovikanSorcerer.java new file mode 100644 index 0000000000..eaa10d2e7c --- /dev/null +++ b/Mage.Sets/src/mage/sets/fifthedition/KrovikanSorcerer.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.fifthedition; + +import java.util.UUID; + +/** + * + * @author emerald000 + */ +public class KrovikanSorcerer extends mage.sets.vintagemasters.KrovikanSorcerer { + + public KrovikanSorcerer(UUID ownerId) { + super(ownerId); + this.cardNumber = 96; + this.expansionSetCode = "5ED"; + } + + public KrovikanSorcerer(final KrovikanSorcerer card) { + super(card); + } + + @Override + public KrovikanSorcerer copy() { + return new KrovikanSorcerer(this); + } +} diff --git a/Mage.Sets/src/mage/sets/iceage/KrovikanSorcerer.java b/Mage.Sets/src/mage/sets/iceage/KrovikanSorcerer.java new file mode 100644 index 0000000000..b2cedf2cc3 --- /dev/null +++ b/Mage.Sets/src/mage/sets/iceage/KrovikanSorcerer.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.iceage; + +import java.util.UUID; + +/** + * + * @author emerald000 + */ +public class KrovikanSorcerer extends mage.sets.vintagemasters.KrovikanSorcerer { + + public KrovikanSorcerer(UUID ownerId) { + super(ownerId); + this.cardNumber = 81; + this.expansionSetCode = "ICE"; + } + + public KrovikanSorcerer(final KrovikanSorcerer card) { + super(card); + } + + @Override + public KrovikanSorcerer copy() { + return new KrovikanSorcerer(this); + } +} diff --git a/Mage.Sets/src/mage/sets/legions/GoblinGoon.java b/Mage.Sets/src/mage/sets/legions/GoblinGoon.java new file mode 100644 index 0000000000..ebbeb3010f --- /dev/null +++ b/Mage.Sets/src/mage/sets/legions/GoblinGoon.java @@ -0,0 +1,151 @@ +/* + * 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.legions; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.RestrictionEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author emerald000 + */ +public class GoblinGoon extends CardImpl { + + public GoblinGoon(UUID ownerId) { + super(ownerId, 99, "Goblin Goon", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{R}"); + this.expansionSetCode = "LGN"; + this.subtype.add("Goblin"); + this.subtype.add("Mutant"); + this.power = new MageInt(6); + this.toughness = new MageInt(6); + + // Goblin Goon can't attack unless you control more creatures than defending player. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GoblinGoonCantAttackEffect())); + + // Goblin Goon can't block unless you control more creatures than attacking player. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GoblinGoonCantBlockEffect())); + } + + public GoblinGoon(final GoblinGoon card) { + super(card); + } + + @Override + public GoblinGoon copy() { + return new GoblinGoon(this); + } +} + +class GoblinGoonCantAttackEffect extends RestrictionEffect { + + GoblinGoonCantAttackEffect() { + super(Duration.WhileOnBattlefield); + staticText = "{this} can't attack unless you control more creatures than defending player"; + } + + GoblinGoonCantAttackEffect(final GoblinGoonCantAttackEffect effect) { + super(effect); + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + return permanent.getId().equals(source.getSourceId()); + } + + @Override + public boolean canAttack(UUID defenderId, Ability source, Game game) { + UUID defendingPlayerId; + Player defender = game.getPlayer(defenderId); + if (defender == null) { + Permanent permanent = game.getPermanent(defenderId); + if (permanent != null) { + defendingPlayerId = permanent.getControllerId(); + } + else { + return false; + } + } + else { + defendingPlayerId = defenderId; + } + if (defendingPlayerId != null) { + return game.getBattlefield().countAll(new FilterControlledCreaturePermanent(), source.getControllerId(), game) > game.getBattlefield().countAll(new FilterControlledCreaturePermanent(), defendingPlayerId, game); + } + else { + return true; + } + } + + @Override + public GoblinGoonCantAttackEffect copy() { + return new GoblinGoonCantAttackEffect(this); + } +} + +class GoblinGoonCantBlockEffect extends RestrictionEffect { + + GoblinGoonCantBlockEffect() { + super(Duration.WhileOnBattlefield); + staticText = "Goblin Goon can't block unless you control more creatures than attacking player"; + } + + GoblinGoonCantBlockEffect(final GoblinGoonCantBlockEffect effect) { + super(effect); + } + + @Override + public GoblinGoonCantBlockEffect copy() { + return new GoblinGoonCantBlockEffect(this); + } + + @Override + public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) { + UUID attackingPlayerId = attacker.getControllerId(); + if (attackingPlayerId != null) { + return game.getBattlefield().countAll(new FilterControlledCreaturePermanent(), source.getControllerId(), game) > game.getBattlefield().countAll(new FilterControlledCreaturePermanent(), attackingPlayerId, game); + } + return true; + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + return permanent.getId().equals(source.getSourceId()); + } +} diff --git a/Mage.Sets/src/mage/sets/masterseditionii/KrovikanSorcerer.java b/Mage.Sets/src/mage/sets/masterseditionii/KrovikanSorcerer.java new file mode 100644 index 0000000000..82b5a5abc2 --- /dev/null +++ b/Mage.Sets/src/mage/sets/masterseditionii/KrovikanSorcerer.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.masterseditionii; + +import java.util.UUID; + +/** + * + * @author emerald000 + */ +public class KrovikanSorcerer extends mage.sets.vintagemasters.KrovikanSorcerer { + + public KrovikanSorcerer(UUID ownerId) { + super(ownerId); + this.cardNumber = 51; + this.expansionSetCode = "ME2"; + } + + public KrovikanSorcerer(final KrovikanSorcerer card) { + super(card); + } + + @Override + public KrovikanSorcerer copy() { + return new KrovikanSorcerer(this); + } +} diff --git a/Mage.Sets/src/mage/sets/nemesis/SaprolingBurst.java b/Mage.Sets/src/mage/sets/nemesis/SaprolingBurst.java new file mode 100644 index 0000000000..1b1d9f7c8e --- /dev/null +++ b/Mage.Sets/src/mage/sets/nemesis/SaprolingBurst.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.nemesis; + +import java.util.UUID; + +/** + * + * @author emerald000 + */ +public class SaprolingBurst extends mage.sets.vintagemasters.SaprolingBurst { + + public SaprolingBurst(UUID ownerId) { + super(ownerId); + this.cardNumber = 113; + this.expansionSetCode = "NMS"; + } + + public SaprolingBurst(final SaprolingBurst card) { + super(card); + } + + @Override + public SaprolingBurst copy() { + return new SaprolingBurst(this); + } +} diff --git a/Mage.Sets/src/mage/sets/odyssey/RitesOfInitiation.java b/Mage.Sets/src/mage/sets/odyssey/RitesOfInitiation.java new file mode 100644 index 0000000000..d043489ce3 --- /dev/null +++ b/Mage.Sets/src/mage/sets/odyssey/RitesOfInitiation.java @@ -0,0 +1,106 @@ +/* + * 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.odyssey; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.BoostControlledEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.FilterCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.Target; +import mage.target.common.TargetCardInHand; + +/** + * + * @author emerald000 + */ +public class RitesOfInitiation extends CardImpl { + + public RitesOfInitiation(UUID ownerId) { + super(ownerId, 217, "Rites of Initiation", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{R}"); + this.expansionSetCode = "ODY"; + + // Discard any number of cards at random. Creatures you control get +1/+0 until end of turn for each card discarded this way. + this.getSpellAbility().addEffect(new RitesOfInitiationEffect()); + } + + public RitesOfInitiation(final RitesOfInitiation card) { + super(card); + } + + @Override + public RitesOfInitiation copy() { + return new RitesOfInitiation(this); + } +} + +class RitesOfInitiationEffect extends OneShotEffect { + + RitesOfInitiationEffect() { + super(Outcome.BoostCreature); + this.staticText = "Discard any number of cards at random. Creatures you control get +1/+0 until end of turn for each card discarded this way"; + } + + RitesOfInitiationEffect(final RitesOfInitiationEffect effect) { + super(effect); + } + + @Override + public RitesOfInitiationEffect copy() { + return new RitesOfInitiationEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player != null) { + Target target = new TargetCardInHand(0, Integer.MAX_VALUE, new FilterCard("cards to discard")); + while (player.canRespond() && !target.isChosen()) { + target.choose(Outcome.BoostCreature, player.getId(), source.getSourceId(), game); + } + int numDiscarded = 0; + for (UUID targetId : target.getTargets()) { + Card card = player.getHand().get(targetId, game); + if (player.discard(card, source, game)) { + numDiscarded++; + } + } + game.addEffect(new BoostControlledEffect(numDiscarded, 0, Duration.EndOfTurn), source); + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/odyssey/SacredRites.java b/Mage.Sets/src/mage/sets/odyssey/SacredRites.java index 9b81acc9b9..b066c5a748 100644 --- a/Mage.Sets/src/mage/sets/odyssey/SacredRites.java +++ b/Mage.Sets/src/mage/sets/odyssey/SacredRites.java @@ -41,7 +41,6 @@ import mage.filter.FilterCard; import mage.game.Game; import mage.players.Player; import mage.target.Target; -import mage.target.Targets; import mage.target.common.TargetCardInHand; /** @@ -56,7 +55,6 @@ public class SacredRites extends CardImpl { // Discard any number of cards. Creatures you control get +0/+1 until end of turn for each card discarded this way. - this.getSpellAbility().addTarget(new TargetCardInHand(0, Integer.MAX_VALUE, new FilterCard())); this.getSpellAbility().addEffect(new SacredRitesEffect()); } @@ -72,12 +70,12 @@ public class SacredRites extends CardImpl { class SacredRitesEffect extends OneShotEffect { - public SacredRitesEffect() { + SacredRitesEffect() { super(Outcome.Benefit); this.staticText = "Discard any number of cards. Creatures you control get +0/+1 until end of turn for each card discarded this way."; } - public SacredRitesEffect(final SacredRitesEffect effect) { + SacredRitesEffect(final SacredRitesEffect effect) { super(effect); } @@ -90,14 +88,18 @@ class SacredRitesEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - Targets targets = source.getTargets(); - int i = 0; - for (Target target: targets) { - Card card = game.getCard(target.getFirstTarget()); - player.discard(card, source, game); - i++; + Target target = new TargetCardInHand(0, Integer.MAX_VALUE, new FilterCard("cards to discard")); + while (player.canRespond() && !target.isChosen()) { + target.choose(Outcome.BoostCreature, player.getId(), source.getSourceId(), game); + } + int numDiscarded = 0; + for (UUID targetId : target.getTargets()) { + Card card = player.getHand().get(targetId, game); + if (player.discard(card, source, game)) { + numDiscarded++; + } } - game.addEffect(new BoostControlledEffect(0, i, Duration.EndOfTurn), source); + game.addEffect(new BoostControlledEffect(0, numDiscarded, Duration.EndOfTurn), source); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/urzassaga/LurkingEvil.java b/Mage.Sets/src/mage/sets/urzassaga/LurkingEvil.java new file mode 100644 index 0000000000..d3958d12dc --- /dev/null +++ b/Mage.Sets/src/mage/sets/urzassaga/LurkingEvil.java @@ -0,0 +1,122 @@ +/* + * 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.urzassaga; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.CostImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.token.Token; +import mage.players.Player; + +/** + * + * @author emerald000 + */ +public class LurkingEvil extends CardImpl { + + public LurkingEvil(UUID ownerId) { + super(ownerId, 140, "Lurking Evil", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{B}{B}{B}"); + this.expansionSetCode = "USG"; + + // Pay half your life, rounded up: Lurking Evil becomes a 4/4 Horror creature with flying. + Effect effect = new BecomesCreatureSourceEffect(new LurkingEvilToken(), null, Duration.EndOfGame, true); + effect.setText("{this} becomes a 4/4 Horror creature with flying"); + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new LurkingEvilCost())); + } + + public LurkingEvil(final LurkingEvil card) { + super(card); + } + + @Override + public LurkingEvil copy() { + return new LurkingEvil(this); + } +} + +class LurkingEvilCost extends CostImpl { + + LurkingEvilCost() { + this.text = "Pay half your life, rounded up"; + } + + LurkingEvilCost(LurkingEvilCost cost) { + super(cost); + } + + @Override + public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + Player controller = game.getPlayer(controllerId); + return controller != null && !(controller.getLife() > 0 && !controller.canPayLifeCost()); + } + + @Override + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + Player controller = game.getPlayer(controllerId); + if (controller != null) { + int currentLife = controller.getLife(); + int lifeToPay = (currentLife + currentLife%2) / 2; // Divide by two and round up. + if (lifeToPay < 0) { + this.paid = true; + } + else { + this.paid = (controller.loseLife(lifeToPay, game) == lifeToPay); + } + return this.paid; + } + return false; + } + + @Override + public LurkingEvilCost copy() { + return new LurkingEvilCost(this); + } +} + +class LurkingEvilToken extends Token { + + LurkingEvilToken() { + super("Horror", "4/4 Horror creature with flying"); + power = new MageInt(4); + toughness = new MageInt(4); + subtype.add("Horror"); + cardType.add(CardType.CREATURE); + this.addAbility(FlyingAbility.getInstance()); + } +} diff --git a/Mage.Sets/src/mage/sets/vintagemasters/GoblinGoon.java b/Mage.Sets/src/mage/sets/vintagemasters/GoblinGoon.java new file mode 100644 index 0000000000..e36435f489 --- /dev/null +++ b/Mage.Sets/src/mage/sets/vintagemasters/GoblinGoon.java @@ -0,0 +1,54 @@ +/* + * 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.vintagemasters; + +import java.util.UUID; +import mage.constants.Rarity; + +/** + * + * @author emerald000 + */ +public class GoblinGoon extends mage.sets.legions.GoblinGoon { + + public GoblinGoon(UUID ownerId) { + super(ownerId); + this.cardNumber = 166; + this.expansionSetCode = "VMA"; + this.rarity = Rarity.UNCOMMON; + } + + public GoblinGoon(final GoblinGoon card) { + super(card); + } + + @Override + public GoblinGoon copy() { + return new GoblinGoon(this); + } +} diff --git a/Mage.Sets/src/mage/sets/vintagemasters/KrovikanSorcerer.java b/Mage.Sets/src/mage/sets/vintagemasters/KrovikanSorcerer.java new file mode 100644 index 0000000000..dbc7f43996 --- /dev/null +++ b/Mage.Sets/src/mage/sets/vintagemasters/KrovikanSorcerer.java @@ -0,0 +1,139 @@ +/* + * 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.vintagemasters; + +import java.util.UUID; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.DiscardTargetCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetCardInHand; + +/** + * + * @author emerald000 + */ +public class KrovikanSorcerer extends CardImpl { + + private static final FilterCard filterNonBlack = new FilterCard("a nonblack card"); + private static final FilterCard filterBlack = new FilterCard("a black card"); + static { + filterNonBlack.add(Predicates.not(new ColorPredicate(ObjectColor.BLACK))); + filterBlack.add(new ColorPredicate(ObjectColor.BLACK)); + } + + public KrovikanSorcerer(UUID ownerId) { + super(ownerId, 77, "Krovikan Sorcerer", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{U}"); + this.expansionSetCode = "VMA"; + this.subtype.add("Human"); + this.subtype.add("Wizard"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // {tap}, Discard a nonblack card: Draw a card. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), new TapSourceCost()); + ability.addCost(new DiscardTargetCost(new TargetCardInHand(filterNonBlack))); + this.addAbility(ability); + + // {tap}, Discard a black card: Draw two cards, then discard one of them. + ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new KrovikanSorcererEffect(), new TapSourceCost()); + ability.addCost(new DiscardTargetCost(new TargetCardInHand(filterBlack))); + this.addAbility(ability); + } + + public KrovikanSorcerer(final KrovikanSorcerer card) { + super(card); + } + + @Override + public KrovikanSorcerer copy() { + return new KrovikanSorcerer(this); + } +} + +class KrovikanSorcererEffect extends OneShotEffect { + + KrovikanSorcererEffect() { + super(Outcome.DrawCard); + this.staticText = "Draw two cards, then discard one of them"; + } + + KrovikanSorcererEffect(final KrovikanSorcererEffect effect) { + super(effect); + } + + @Override + public KrovikanSorcererEffect copy() { + return new KrovikanSorcererEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player != null) { + Cards initialHand = player.getHand().copy(); + player.drawCards(2, game); + Cards drawnCards = new CardsImpl(Zone.PICK); + for (UUID cardId : player.getHand()) { + if (!initialHand.contains(cardId)) { + drawnCards.add(cardId); + } + } + if (drawnCards.size() > 0) { + TargetCard cardToDiscard = new TargetCard(Zone.PICK, new FilterCard("card to discard")); + cardToDiscard.setNotTarget(true); + if (player.choose(Outcome.Discard, drawnCards, cardToDiscard, game)) { + Card card = player.getHand().get(cardToDiscard.getFirstTarget(), game); + if (card != null) { + return player.discard(card, source, game); + } + } + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/vintagemasters/LurkingEvil.java b/Mage.Sets/src/mage/sets/vintagemasters/LurkingEvil.java new file mode 100644 index 0000000000..14cbf8bb01 --- /dev/null +++ b/Mage.Sets/src/mage/sets/vintagemasters/LurkingEvil.java @@ -0,0 +1,54 @@ +/* + * 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.vintagemasters; + +import java.util.UUID; +import mage.constants.Rarity; + +/** + * + * @author emerald000 + */ +public class LurkingEvil extends mage.sets.urzassaga.LurkingEvil { + + public LurkingEvil(UUID ownerId) { + super(ownerId); + this.cardNumber = 127; + this.expansionSetCode = "VMA"; + this.rarity = Rarity.UNCOMMON; + } + + public LurkingEvil(final LurkingEvil card) { + super(card); + } + + @Override + public LurkingEvil copy() { + return new LurkingEvil(this); + } +} diff --git a/Mage.Sets/src/mage/sets/vintagemasters/ReignOfThePit.java b/Mage.Sets/src/mage/sets/vintagemasters/ReignOfThePit.java new file mode 100644 index 0000000000..46e2cf0c3a --- /dev/null +++ b/Mage.Sets/src/mage/sets/vintagemasters/ReignOfThePit.java @@ -0,0 +1,134 @@ +/* + * 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.vintagemasters; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.Token; +import mage.players.Player; +import mage.target.common.TargetControlledCreaturePermanent; + +/** + * + * @author emerald000 + */ +public class ReignOfThePit extends CardImpl { + + public ReignOfThePit(UUID ownerId) { + super(ownerId, 138, "Reign of the Pit", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{4}{B}{B}"); + this.expansionSetCode = "VMA"; + + // Each player sacrifices a creature. Put an X/X black Demon creature token with flying onto the battlefield, where X is the total power of the creatures sacrificed this way. + this.getSpellAbility().addEffect(new ReignOfThePitEffect()); + } + + public ReignOfThePit(final ReignOfThePit card) { + super(card); + } + + @Override + public ReignOfThePit copy() { + return new ReignOfThePit(this); + } +} + +class ReignOfThePitEffect extends OneShotEffect { + + ReignOfThePitEffect() { + super(Outcome.Sacrifice); + this.staticText = "Each player sacrifices a creature. Put an X/X black Demon creature token with flying onto the battlefield, where X is the total power of the creatures sacrificed this way"; + } + + ReignOfThePitEffect(final ReignOfThePitEffect effect) { + super(effect); + } + + @Override + public ReignOfThePitEffect copy() { + return new ReignOfThePitEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + int totalPowerSacrificed = 0; + List perms = new ArrayList<>(); + for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { + Player player = game.getPlayer(playerId); + if (player != null) { + TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(1, 1, new FilterControlledCreaturePermanent(), true); + if (target.canChoose(player.getId(), game)) { + while (!target.isChosen() && player.canRespond()) { + player.choose(Outcome.Sacrifice, target, source.getSourceId(), game); + } + perms.addAll(target.getTargets()); + } + } + } + for (UUID permID : perms) { + Permanent permanent = game.getPermanent(permID); + if (permanent != null) { + int power = permanent.getPower().getValue(); + if (permanent.sacrifice(source.getSourceId(), game)) { + totalPowerSacrificed += power; + } + } + } + new CreateTokenEffect(new ReignOfThePitToken(totalPowerSacrificed)).apply(game, source); + return true; + } +} + +class ReignOfThePitToken extends Token { + + ReignOfThePitToken(int xValue) { + super("Demon", "X/X black Demon creature token with flying"); + power = new MageInt(xValue); + toughness = new MageInt(xValue); + color.setBlack(true); + subtype.add("Demon"); + cardType.add(CardType.CREATURE); + this.addAbility(FlyingAbility.getInstance()); + } +} diff --git a/Mage.Sets/src/mage/sets/vintagemasters/RitesOfInitiation.java b/Mage.Sets/src/mage/sets/vintagemasters/RitesOfInitiation.java new file mode 100644 index 0000000000..7ce9f398b1 --- /dev/null +++ b/Mage.Sets/src/mage/sets/vintagemasters/RitesOfInitiation.java @@ -0,0 +1,54 @@ +/* + * 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.vintagemasters; + +import java.util.UUID; +import mage.constants.Rarity; + +/** + * + * @author emerald000 + */ +public class RitesOfInitiation extends mage.sets.odyssey.RitesOfInitiation { + + public RitesOfInitiation(UUID ownerId) { + super(ownerId); + this.cardNumber = 182; + this.expansionSetCode = "VMA"; + this.rarity = Rarity.UNCOMMON; + } + + public RitesOfInitiation(final RitesOfInitiation card) { + super(card); + } + + @Override + public RitesOfInitiation copy() { + return new RitesOfInitiation(this); + } +} diff --git a/Mage.Sets/src/mage/sets/vintagemasters/SaprolingBurst.java b/Mage.Sets/src/mage/sets/vintagemasters/SaprolingBurst.java new file mode 100644 index 0000000000..3e8b281f8f --- /dev/null +++ b/Mage.Sets/src/mage/sets/vintagemasters/SaprolingBurst.java @@ -0,0 +1,242 @@ +/* + * 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.vintagemasters; + +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; +import mage.MageObjectReference; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.common.ZoneChangeTriggeredAbility; +import mage.abilities.costs.common.RemoveCountersSourceCost; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect; +import mage.abilities.keyword.FadingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.Token; +import mage.util.CardUtil; + +/** + * + * @author emerald000 + */ +public class SaprolingBurst extends CardImpl { + + public SaprolingBurst(UUID ownerId) { + super(ownerId, 230, "Saproling Burst", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{4}{G}"); + this.expansionSetCode = "VMA"; + + // Fading 7 + this.addAbility(new FadingAbility(7, this)); + + // Remove a fade counter from Saproling Burst: Put a green Saproling creature token onto the battlefield. It has "This creature's power and toughness are each equal to the number of fade counters on Saproling Burst." + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new SaprolingBurstCreateTokenEffect(), new RemoveCountersSourceCost(CounterType.FADE.createInstance()))); + + // When Saproling Burst leaves the battlefield, destroy all tokens put onto the battlefield with Saproling Burst. They can't be regenerated. + this.addAbility(new SaprolingBurstLeavesBattlefieldTriggeredAbility()); + } + + public SaprolingBurst(final SaprolingBurst card) { + super(card); + } + + @Override + public SaprolingBurst copy() { + return new SaprolingBurst(this); + } +} + +class SaprolingBurstCreateTokenEffect extends OneShotEffect { + + SaprolingBurstCreateTokenEffect() { + super(Outcome.PutCreatureInPlay); + this.staticText = "Put a green Saproling creature token onto the battlefield. It has \"This creature's power and toughness are each equal to the number of fade counters on {this}.\""; + } + + SaprolingBurstCreateTokenEffect(final SaprolingBurstCreateTokenEffect effect) { + super(effect); + } + + @Override + public SaprolingBurstCreateTokenEffect copy() { + return new SaprolingBurstCreateTokenEffect(this); + } + + @Override + @SuppressWarnings("unchecked") + public boolean apply(Game game, Ability source) { + Token token = new SaprolingBurstToken(new MageObjectReference(source.getSourceObject(game), game)); + token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null) { + Object object = game.getState().getValue(CardUtil.getCardZoneString("_tokensCreated", source.getSourceId(), game)); + Set tokensCreated; + if (object != null) { + tokensCreated = (Set) object; + } + else { + tokensCreated = new HashSet<>(); + } + for (UUID tokenId : token.getLastAddedTokenIds()) { + tokensCreated.add(tokenId); + } + game.getState().setValue(CardUtil.getCardZoneString("_tokensCreated", source.getSourceId(), game), tokensCreated); + } + return true; + } +} + +class SaprolingBurstToken extends Token { + + SaprolingBurstToken(MageObjectReference saprolingBurstMOR) { + super("Saproling", "green Saproling creature token with \"This creature's power and toughness are each equal to the number of fade counters on Saproling Burst.\""); + this.color.setGreen(true); + this.subtype.add("Saproling"); + this.cardType.add(CardType.CREATURE); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetPowerToughnessSourceEffect(new SaprolingBurstTokenDynamicValue(saprolingBurstMOR), Duration.WhileOnBattlefield))); + } +} + +class SaprolingBurstTokenDynamicValue implements DynamicValue { + + private final MageObjectReference saprolingBurstMOR; + + SaprolingBurstTokenDynamicValue(MageObjectReference saprolingBurstMOR) { + this.saprolingBurstMOR = saprolingBurstMOR; + } + + SaprolingBurstTokenDynamicValue(final SaprolingBurstTokenDynamicValue dynamicValue) { + this.saprolingBurstMOR = dynamicValue.saprolingBurstMOR; + } + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + Permanent permanent = this.saprolingBurstMOR.getPermanent(game); + if (permanent != null) { + return permanent.getCounters().getCount(CounterType.FADE); + } + return 0; + } + + @Override + public SaprolingBurstTokenDynamicValue copy() { + return new SaprolingBurstTokenDynamicValue(this); + } + + @Override + public String toString() { + return "X"; + } + + @Override + public String getMessage() { + return "the number of fade counters on Saproling Burst"; + } +} + +class SaprolingBurstLeavesBattlefieldTriggeredAbility extends ZoneChangeTriggeredAbility { + + SaprolingBurstLeavesBattlefieldTriggeredAbility() { + super(Zone.BATTLEFIELD, null, new SaprolingBurstDestroyEffect(), "When {this} leaves the battlefield, ", false); + } + + SaprolingBurstLeavesBattlefieldTriggeredAbility(SaprolingBurstLeavesBattlefieldTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (super.checkTrigger(event, game)) { + for (Effect effect : this.getEffects()) { + if (effect instanceof SaprolingBurstDestroyEffect) { + ((SaprolingBurstDestroyEffect) effect).setCardZoneString(CardUtil.getCardZoneString("_tokensCreated", this.getSourceId(), game, true)); + } + } + return true; + } + return false; + } + + @Override + public SaprolingBurstLeavesBattlefieldTriggeredAbility copy() { + return new SaprolingBurstLeavesBattlefieldTriggeredAbility(this); + } +} + +class SaprolingBurstDestroyEffect extends OneShotEffect { + + private String cardZoneString; + + SaprolingBurstDestroyEffect() { + super(Outcome.Benefit); + this.staticText = "destroy all tokens put onto the battlefield with {this}. They can't be regenerated"; + } + + SaprolingBurstDestroyEffect(final SaprolingBurstDestroyEffect effect) { + super(effect); + this.cardZoneString = effect.cardZoneString; + } + + @Override + public SaprolingBurstDestroyEffect copy() { + return new SaprolingBurstDestroyEffect(this); + } + + @Override + @SuppressWarnings("unchecked") + public boolean apply(Game game, Ability source) { + Object object = game.getState().getValue(cardZoneString); + if (object != null) { + Set tokensCreated = (Set) object; + for (UUID tokenId : tokensCreated) { + Permanent token = game.getPermanent(tokenId); + if (token != null) { + token.destroy(source.getSourceId(), game, true); + } + } + } + return true; + } + + public void setCardZoneString(String cardZoneString) { + this.cardZoneString = cardZoneString; + } +}