From aadb89a8effa3f3dbac28e5ff3aa8c311771fda8 Mon Sep 17 00:00:00 2001 From: magenoxx Date: Thu, 10 Jul 2014 01:02:41 +0400 Subject: [PATCH] [M15] 6 black cards --- .../src/mage/sets/magic2015/FleshToDust.java | 62 +++++++ .../mage/sets/magic2015/InGarruksWake.java | 70 ++++++++ .../mage/sets/magic2015/LeechingSliver.java | 73 +++++++++ .../sets/magic2015/NecromancersAssistant.java | 66 ++++++++ .../sets/magic2015/NecromancersStockpile.java | 154 ++++++++++++++++++ .../src/mage/sets/magic2015/Ulcerate.java | 65 ++++++++ .../common/LoseLifeDefendingPlayerEffect.java | 87 ++++++++++ 7 files changed, 577 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/magic2015/FleshToDust.java create mode 100644 Mage.Sets/src/mage/sets/magic2015/InGarruksWake.java create mode 100644 Mage.Sets/src/mage/sets/magic2015/LeechingSliver.java create mode 100644 Mage.Sets/src/mage/sets/magic2015/NecromancersAssistant.java create mode 100644 Mage.Sets/src/mage/sets/magic2015/NecromancersStockpile.java create mode 100644 Mage.Sets/src/mage/sets/magic2015/Ulcerate.java create mode 100644 Mage/src/mage/abilities/effects/common/LoseLifeDefendingPlayerEffect.java diff --git a/Mage.Sets/src/mage/sets/magic2015/FleshToDust.java b/Mage.Sets/src/mage/sets/magic2015/FleshToDust.java new file mode 100644 index 00000000000..9bc22ab67f8 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magic2015/FleshToDust.java @@ -0,0 +1,62 @@ +/* + * 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.magic2015; + +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author noxx + */ +public class FleshToDust extends CardImpl { + + public FleshToDust(UUID ownerId) { + super(ownerId, 98, "Flesh to Dust", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{3}{B}{B}"); + this.expansionSetCode = "M15"; + + this.color.setBlack(true); + + // Destroy target creature. It can't be regenerated. + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + this.getSpellAbility().addEffect(new DestroyTargetEffect(true)); + } + + public FleshToDust(final FleshToDust card) { + super(card); + } + + @Override + public FleshToDust copy() { + return new FleshToDust(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magic2015/InGarruksWake.java b/Mage.Sets/src/mage/sets/magic2015/InGarruksWake.java new file mode 100644 index 00000000000..7609cf4973e --- /dev/null +++ b/Mage.Sets/src/mage/sets/magic2015/InGarruksWake.java @@ -0,0 +1,70 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.magic2015; + +import mage.abilities.effects.common.DestroyAllEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterCreatureOrPlaneswalkerPermanent; +import mage.filter.predicate.permanent.ControllerPredicate; + +import java.util.UUID; + +/** + * @author noxx + */ +public class InGarruksWake extends CardImpl { + + private static final FilterPermanent filter = new FilterCreatureOrPlaneswalkerPermanent("creatures you don't control and all planeswalkers you don't control"); + + static { + filter.add(new ControllerPredicate(TargetController.NOT_YOU)); + } + + public InGarruksWake(UUID ownerId) { + super(ownerId, 100, "In Garruk's Wake", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{7}{B}{B}"); + this.expansionSetCode = "M15"; + + this.color.setBlack(true); + + // Destroy all creatures you don't control and all planeswalkers you don't control. + this.getSpellAbility().addEffect(new DestroyAllEffect(filter)); + } + + public InGarruksWake(final InGarruksWake card) { + super(card); + } + + @Override + public InGarruksWake copy() { + return new InGarruksWake(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magic2015/LeechingSliver.java b/Mage.Sets/src/mage/sets/magic2015/LeechingSliver.java new file mode 100644 index 00000000000..779de36d925 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magic2015/LeechingSliver.java @@ -0,0 +1,73 @@ +/* + * 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.magic2015; + +import mage.MageInt; +import mage.abilities.common.AttacksCreatureYourControlTriggeredAbility; +import mage.abilities.effects.common.LoseLifeDefendingPlayerEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; + +import java.util.UUID; + +/** + * @author noxx + */ +public class LeechingSliver extends CardImpl { + + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Sliver you control"); + + static { + filter.add(new SubtypePredicate("Sliver")); + } + + public LeechingSliver(UUID ownerId) { + super(ownerId, 102, "Leeching Sliver", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{B}"); + this.expansionSetCode = "M15"; + this.subtype.add("Sliver"); + + this.color.setBlack(true); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Whenever a Sliver you control attacks, defending player loses 1 life. + this.addAbility(new AttacksCreatureYourControlTriggeredAbility(new LoseLifeDefendingPlayerEffect(1), false, filter)); + } + + public LeechingSliver(final LeechingSliver card) { + super(card); + } + + @Override + public LeechingSliver copy() { + return new LeechingSliver(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magic2015/NecromancersAssistant.java b/Mage.Sets/src/mage/sets/magic2015/NecromancersAssistant.java new file mode 100644 index 00000000000..f59f0270faa --- /dev/null +++ b/Mage.Sets/src/mage/sets/magic2015/NecromancersAssistant.java @@ -0,0 +1,66 @@ +/* + * 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.magic2015; + +import mage.MageInt; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.common.PutTopCardOfLibraryIntoGraveControllerEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; + +import java.util.UUID; + +/** + * + * @author anonymous + */ +public class NecromancersAssistant extends CardImpl { + + public NecromancersAssistant(UUID ownerId) { + super(ownerId, 107, "Necromancer's Assistant", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{B}"); + this.expansionSetCode = "M15"; + this.subtype.add("Zombie"); + + this.color.setBlack(true); + this.power = new MageInt(3); + this.toughness = new MageInt(1); + + // When Necromancer's Assistant enters the battlefield, put the top three cards of your library into your graveyard. + this.addAbility(new EntersBattlefieldTriggeredAbility(new PutTopCardOfLibraryIntoGraveControllerEffect(3))); + } + + public NecromancersAssistant(final NecromancersAssistant card) { + super(card); + } + + @Override + public NecromancersAssistant copy() { + return new NecromancersAssistant(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magic2015/NecromancersStockpile.java b/Mage.Sets/src/mage/sets/magic2015/NecromancersStockpile.java new file mode 100644 index 00000000000..74c9346c8fd --- /dev/null +++ b/Mage.Sets/src/mage/sets/magic2015/NecromancersStockpile.java @@ -0,0 +1,154 @@ +/* + * 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.magic2015; + +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.CostImpl; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.common.FilterCreatureCard; +import mage.game.Game; +import mage.game.permanent.token.ZombieToken; +import mage.players.Player; +import mage.target.common.TargetCardInHand; + +import java.util.UUID; + +/** + * @author noxx + */ +public class NecromancersStockpile extends CardImpl { + + private final FilterCard filter = new FilterCreatureCard(); + + public NecromancersStockpile(UUID ownerId) { + super(ownerId, 108, "Necromancer's Stockpile", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}"); + this.expansionSetCode = "M15"; + + this.color.setBlack(true); + + // {1}{B}, Discard a creature card: Draw a card. + // If the discarded card was a Zombie card, put a 2/2 black Zombie creature token onto the battlefield tapped. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), new ManaCostsImpl("{1}{B}")); + ability.addCost(new NecromancersStockpileDiscardTargetCost(new TargetCardInHand(filter))); + ability.addEffect(new NecromancersStockpilePutTokenEffect()); + this.addAbility(ability); + } + + public NecromancersStockpile(final NecromancersStockpile card) { + super(card); + } + + @Override + public NecromancersStockpile copy() { + return new NecromancersStockpile(this); + } + +} + +class NecromancersStockpileDiscardTargetCost extends CostImpl { + + protected boolean isZombieCard; + + public NecromancersStockpileDiscardTargetCost(TargetCardInHand target) { + this.addTarget(target); + this.text = "Discard " + target.getTargetName(); + } + + public NecromancersStockpileDiscardTargetCost(NecromancersStockpileDiscardTargetCost cost) { + super(cost); + } + + @Override + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + if (targets.choose(Outcome.Discard, controllerId, sourceId, game)) { + Player player = game.getPlayer(controllerId); + for (UUID targetId: targets.get(0).getTargets()) { + Card card = player.getHand().get(targetId, game); + if (card == null) { + return false; + } + isZombieCard = card.getSubtype().contains("Zombie"); + paid |= player.discard(card, null, game); + + } + } + return paid; + } + + @Override + public boolean canPay(UUID sourceId, UUID controllerId, Game game) { + return targets.canChoose(controllerId, game); + } + + @Override + public NecromancersStockpileDiscardTargetCost copy() { + return new NecromancersStockpileDiscardTargetCost(this); + } + + public boolean isZombieCard() { + return isZombieCard; + } + +} + +class NecromancersStockpilePutTokenEffect extends OneShotEffect { + NecromancersStockpilePutTokenEffect() { + super(Outcome.Neutral); + staticText = "If the discarded card was a Zombie card, put a 2/2 black Zombie creature token onto the battlefield tapped"; + } + + NecromancersStockpilePutTokenEffect(final NecromancersStockpilePutTokenEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + NecromancersStockpileDiscardTargetCost cost = (NecromancersStockpileDiscardTargetCost) source.getCosts().get(0); + if (cost != null && cost.isZombieCard()) { + new CreateTokenEffect(new ZombieToken("M15"), 1, true, false).apply(game, source); + } + return true; + } + + @Override + public NecromancersStockpilePutTokenEffect copy() { + return new NecromancersStockpilePutTokenEffect(this); + } +} + diff --git a/Mage.Sets/src/mage/sets/magic2015/Ulcerate.java b/Mage.Sets/src/mage/sets/magic2015/Ulcerate.java new file mode 100644 index 00000000000..b819d352d9d --- /dev/null +++ b/Mage.Sets/src/mage/sets/magic2015/Ulcerate.java @@ -0,0 +1,65 @@ +/* + * 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.magic2015; + +import mage.abilities.effects.common.LoseLifeSourceControllerEffect; +import mage.abilities.effects.common.continious.BoostTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author noxx + */ +public class Ulcerate extends CardImpl { + + public Ulcerate(UUID ownerId) { + super(ownerId, 119, "Ulcerate", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{B}"); + this.expansionSetCode = "M15"; + + this.color.setBlack(true); + + // Target creature gets -3/-3 until end of turn. You lose 3 life. + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + this.getSpellAbility().addEffect(new BoostTargetEffect(-3, -3, Duration.EndOfTurn)); + this.getSpellAbility().addEffect(new LoseLifeSourceControllerEffect(3)); + } + + public Ulcerate(final Ulcerate card) { + super(card); + } + + @Override + public Ulcerate copy() { + return new Ulcerate(this); + } +} diff --git a/Mage/src/mage/abilities/effects/common/LoseLifeDefendingPlayerEffect.java b/Mage/src/mage/abilities/effects/common/LoseLifeDefendingPlayerEffect.java new file mode 100644 index 00000000000..df12e71b950 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/LoseLifeDefendingPlayerEffect.java @@ -0,0 +1,87 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ + +package mage.abilities.effects.common; + +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.OneShotEffect; +import mage.constants.Outcome; +import mage.game.Game; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author noxx + */ +public class LoseLifeDefendingPlayerEffect extends OneShotEffect { + + protected DynamicValue amount; + + public LoseLifeDefendingPlayerEffect(int amount) { + this(new StaticValue(amount)); + } + + public LoseLifeDefendingPlayerEffect(DynamicValue amount) { + super(Outcome.Damage); + this.amount = amount; + } + + public LoseLifeDefendingPlayerEffect(final LoseLifeDefendingPlayerEffect effect) { + super(effect); + this.amount = effect.amount.copy(); + } + + @Override + public LoseLifeDefendingPlayerEffect copy() { + return new LoseLifeDefendingPlayerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + for (UUID defenderId : game.getCombat().getDefenders()) { + Player defender = game.getPlayer(defenderId); + if (defender != null) { + defender.loseLife(amount.calculate(game, source), game); + } + } + return true; + } + + @Override + public String getText(Mode mode) { + StringBuilder sb = new StringBuilder("defending player loses "); + sb.append(amount); + sb.append(" life"); + return sb.toString(); + } + +}