diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/CatchRelease.java b/Mage.Sets/src/mage/sets/dragonsmaze/CatchRelease.java new file mode 100644 index 00000000000..e727e553ceb --- /dev/null +++ b/Mage.Sets/src/mage/sets/dragonsmaze/CatchRelease.java @@ -0,0 +1,228 @@ +/* + * 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.dragonsmaze; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Duration; +import mage.Constants.Outcome; +import mage.Constants.Rarity; +import mage.Constants.Zone; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.MustBlockSourceEffect; +import mage.abilities.effects.common.UntapTargetEffect; +import mage.abilities.effects.common.continious.GainAbilityTargetEffect; +import mage.abilities.effects.common.continious.GainControlTargetEffect; +import mage.abilities.keyword.HasteAbility; +import mage.cards.SplitCard; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterArtifactPermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.common.FilterEnchantmentPermanent; +import mage.filter.common.FilterLandPermanent; +import mage.filter.common.FilterPlaneswalkerPermanent; +import mage.filter.predicate.permanent.ControllerPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.Target; +import mage.target.TargetPermanent; +import mage.target.common.TargetControlledPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ + + +public class CatchRelease extends SplitCard { + + public CatchRelease(UUID ownerId) { + super(ownerId, 125, "Catch", "Release", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{1}{U}{R}", "{4}{R}{W}",true); + this.expansionSetCode = "DGM"; + + this.color.setBlue(true); + this.color.setRed(true); + this.color.setWhite(true); + + // Catch + // Gain control of target permanent until end of turn. Untap it. It gains haste until end of turn. + getLeftHalfCard().getColor().setRed(true); + getLeftHalfCard().getSpellAbility().addTarget(new TargetPermanent(new FilterPermanent())); + getLeftHalfCard().getSpellAbility().addEffect(new GainControlTargetEffect(Duration.EndOfTurn)); + getLeftHalfCard().getSpellAbility().addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn)); + getLeftHalfCard().getSpellAbility().addEffect(new UntapTargetEffect()); + + // Release + // Each player sacrifices an artifact, a creature, an enchantment, a land, and a planeswalker. + getRightHalfCard().getColor().setGreen(true); + getRightHalfCard().getSpellAbility().addEffect(new ReleaseSacrificeEffect()); + + } + + public CatchRelease(final CatchRelease card) { + super(card); + } + + @Override + public CatchRelease copy() { + return new CatchRelease(this); + } +} + +class ReleaseSacrificeEffect extends OneShotEffect { + + private static final FilterArtifactPermanent filter1 = new FilterArtifactPermanent("artifact you control"); + private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("creature you control"); + private static final FilterEnchantmentPermanent filter3 = new FilterEnchantmentPermanent("enchantment you control"); + private static final FilterLandPermanent filter4 = new FilterLandPermanent("land you control"); + private static final FilterPlaneswalkerPermanent filter5 = new FilterPlaneswalkerPermanent("planeswalker you control"); + + static { + filter1.add(new ControllerPredicate(Constants.TargetController.YOU)); + filter2.add(new ControllerPredicate(Constants.TargetController.YOU)); + filter3.add(new ControllerPredicate(Constants.TargetController.YOU)); + filter4.add(new ControllerPredicate(Constants.TargetController.YOU)); + filter5.add(new ControllerPredicate(Constants.TargetController.YOU)); + } + + public ReleaseSacrificeEffect() { + super(Constants.Outcome.DestroyPermanent); + staticText = "Each player sacrifices an artifact, a creature, an enchantment, a land, and a planeswalker"; + } + + public ReleaseSacrificeEffect(ReleaseSacrificeEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + List chosen = new ArrayList(); + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + for (UUID playerId : controller.getInRange()) { + Player player = game.getPlayer(playerId); + + Target target1 = new TargetControlledPermanent(1, 1, filter1, false); + Target target2 = new TargetControlledPermanent(1, 1, filter2, false); + Target target3 = new TargetControlledPermanent(1, 1, filter3, false); + Target target4 = new TargetControlledPermanent(1, 1, filter4, false); + Target target5 = new TargetControlledPermanent(1, 1, filter5, false); + + target1.setRequired(true); + target2.setRequired(true); + target3.setRequired(true); + target4.setRequired(true); + target5.setRequired(true); + + target1.setNotTarget(true); + target2.setNotTarget(true); + target3.setNotTarget(true); + target4.setNotTarget(true); + target5.setNotTarget(true); + + if (target1.canChoose(player.getId(), game)) { + while (!target1.isChosen() && target1.canChoose(player.getId(), game)) { + player.chooseTarget(Outcome.Benefit, target1, source, game); + } + Permanent artifact = game.getPermanent(target1.getFirstTarget()); + if (artifact != null) { + chosen.add(artifact.getId()); + } + target1.clearChosen(); + } + + if (target2.canChoose(player.getId(), game)) { + while (!target2.isChosen() && target2.canChoose(player.getId(), game)) { + player.chooseTarget(Outcome.Benefit, target2, source, game); + } + Permanent creature = game.getPermanent(target2.getFirstTarget()); + if (creature != null) { + chosen.add(creature.getId()); + } + target2.clearChosen(); + } + + if (target3.canChoose(player.getId(), game)) { + while (!target3.isChosen() && target3.canChoose(player.getId(), game)) { + player.chooseTarget(Outcome.Benefit, target3, source, game); + } + Permanent enchantment = game.getPermanent(target3.getFirstTarget()); + if (enchantment != null) { + chosen.add(enchantment.getId()); + } + target3.clearChosen(); + } + + if (target4.canChoose(player.getId(), game)) { + while (!target4.isChosen() && target4.canChoose(player.getId(), game)) { + player.chooseTarget(Outcome.Benefit, target4, source, game); + } + Permanent land = game.getPermanent(target4.getFirstTarget()); + if (land != null) { + chosen.add(land.getId()); + } + target4.clearChosen(); + } + + if (target5.canChoose(player.getId(), game)) { + while (!target5.isChosen() && target5.canChoose(player.getId(), game)) { + player.chooseTarget(Outcome.Benefit, target5, source, game); + } + Permanent planeswalker = game.getPermanent(target5.getFirstTarget()); + if (planeswalker != null) { + chosen.add(planeswalker.getId()); + } + target5.clearChosen(); + } + + } + + for (UUID uuid : chosen) { + Permanent permanent = game.getPermanent(uuid); + if (permanent != null) { + permanent.sacrifice(source.getId(), game); + } + } + return true; + } + + @Override + public ReleaseSacrificeEffect copy() { + return new ReleaseSacrificeEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/FleshBlood.java b/Mage.Sets/src/mage/sets/dragonsmaze/FleshBlood.java new file mode 100644 index 00000000000..5ac29e7ba96 --- /dev/null +++ b/Mage.Sets/src/mage/sets/dragonsmaze/FleshBlood.java @@ -0,0 +1,168 @@ +/* + * 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.dragonsmaze; + +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Outcome; +import mage.Constants.Rarity; +import mage.Constants.Zone; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.SplitCard; +import mage.counters.CounterType; +import mage.filter.common.FilterCreatureCard; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.Target; +import mage.target.common.TargetCardInGraveyard; +import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetCreatureOrPlayer; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ + + +public class FleshBlood extends SplitCard { + + public FleshBlood(UUID ownerId) { + super(ownerId, 128, "Flesh", "Blood", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{B}{G}", "{R}{G}",true); + this.expansionSetCode = "DGM"; + + this.color.setBlack(true); + this.color.setGreen(true); + this.color.setRed(true); + + // Flesh + // Exile target creature card from a graveyard. Put X +1/+1 counters on target creature, where X is the power of the card you exiled. + getLeftHalfCard().getColor().setBlack(true); + getLeftHalfCard().getColor().setGreen(true); + Target target = new TargetCardInGraveyard(new FilterCreatureCard()); + target.setRequired(true); + getLeftHalfCard().getSpellAbility().addTarget(target); + getLeftHalfCard().getSpellAbility().addTarget(new TargetCreaturePermanent(true)); + getLeftHalfCard().getSpellAbility().addEffect(new FleshEffect()); + + // Blood + // Target creature you control deals damage equal to its power to target creature or player. + getRightHalfCard().getColor().setRed(true); + getRightHalfCard().getColor().setGreen(true); + getRightHalfCard().getSpellAbility().addTarget(new TargetControlledCreaturePermanent(true)); + getRightHalfCard().getSpellAbility().addTarget(new TargetCreatureOrPlayer(true)); + getRightHalfCard().getSpellAbility().addEffect(new BloodEffect()); + + } + + public FleshBlood(final FleshBlood card) { + super(card); + } + + @Override + public FleshBlood copy() { + return new FleshBlood(this); + } +} + +class FleshEffect extends OneShotEffect { + + public FleshEffect() { + super(Outcome.BoostCreature); + staticText = "Exile target creature card from a graveyard. Put X +1/+1 counters on target creature, where X is the power of the card you exiled"; + } + + public FleshEffect(final FleshEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Card targetCard = game.getCard(source.getFirstTarget()); + if (targetCard != null) { + int power = targetCard.getPower().getValue(); + targetCard.moveToExile(null, null, source.getSourceId(), game); + if (power > 0) { + Permanent targetCreature = game.getPermanent(source.getTargets().get(1).getFirstTarget()); + if (targetCreature != null) { + targetCreature.addCounters(CounterType.P1P1.createInstance(power), game); + } + } + return true; + } + return false; + } + + @Override + public FleshEffect copy() { + return new FleshEffect(this); + } + +} + +class BloodEffect extends OneShotEffect { + + public BloodEffect() { + super(Outcome.Damage); + staticText = "Target creature you control deals damage equal to its power to target creature or player"; + } + + public BloodEffect(final BloodEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent sourcePermanent = game.getPermanent(source.getFirstTarget()); + if (sourcePermanent == null) { + sourcePermanent = (Permanent) game.getLastKnownInformation(source.getFirstTarget(), Zone.BATTLEFIELD); + } + + Permanent targetCreature = game.getPermanent(source.getTargets().get(1).getFirstTarget()); + if (sourcePermanent != null && targetCreature != null) { + targetCreature.damage(sourcePermanent.getPower().getValue(), sourcePermanent.getId(), game, true, false); + return true; + } + Player targetPlayer = game.getPlayer(source.getTargets().get(1).getFirstTarget()); + if (sourcePermanent != null && targetPlayer != null) { + targetPlayer.damage(sourcePermanent.getPower().getValue(), sourcePermanent.getId(), game, false, true); + return true; + } + return false; + } + + @Override + public BloodEffect copy() { + return new BloodEffect(this); + } + +} diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/ToilTrouble.java b/Mage.Sets/src/mage/sets/dragonsmaze/ToilTrouble.java new file mode 100644 index 00000000000..89fb71e2059 --- /dev/null +++ b/Mage.Sets/src/mage/sets/dragonsmaze/ToilTrouble.java @@ -0,0 +1,113 @@ +/* + * 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.dragonsmaze; + +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.effects.common.DrawCardTargetEffect; +import mage.abilities.effects.common.LoseLifeTargetEffect; +import mage.cards.SplitCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetPlayer; + +/** + * + * @author LevelX2 + */ + + +public class ToilTrouble extends SplitCard { + + public ToilTrouble(UUID ownerId) { + super(ownerId, 133, "Toil", "Trouble", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{2}{B}", "{2}{R}",true); + this.expansionSetCode = "DGM"; + + this.color.setBlack(true); + this.color.setRed(true); + + // Toil + // Target player draws two cards and loses 2 life. + getLeftHalfCard().getColor().setBlack(true); + getLeftHalfCard().getSpellAbility().addTarget(new TargetPlayer(true)); + getLeftHalfCard().getSpellAbility().addEffect(new DrawCardTargetEffect(2)); + getLeftHalfCard().getSpellAbility().addEffect(new LoseLifeTargetEffect(2)); + + // Trouble + // Trouble deals damage to target player equal to the number of cards in that player's hand. + getRightHalfCard().getColor().setRed(true); + Effect effect = new DamageTargetEffect(new TargetPlayerCardsInHandCount()); + effect.setText("Trouble deals damage to target player equal to the number of cards in that player's hand"); + getRightHalfCard().getSpellAbility().addEffect(effect); + getRightHalfCard().getSpellAbility().addTarget(new TargetPlayer(true)); + + } + + public ToilTrouble(final ToilTrouble card) { + super(card); + } + + @Override + public ToilTrouble copy() { + return new ToilTrouble(this); + } +} + +class TargetPlayerCardsInHandCount implements DynamicValue { + + @Override + public int calculate(Game game, Ability sourceAbility) { + Player targetPlayer = game.getPlayer(sourceAbility.getFirstTarget()); + if (targetPlayer != null) { + return targetPlayer.getHand().size(); + } + + return 0; + } + + @Override + public DynamicValue copy() { + return new TargetPlayerCardsInHandCount(); + } + + @Override + public String toString() { + return "1"; + } + + @Override + public String getMessage() { + return "target player's cards in hand"; + } +}