From 4c446bd1c57b080b81b724c54f11f919e36f599b Mon Sep 17 00:00:00 2001 From: LoneFox Date: Sat, 29 Aug 2015 17:38:42 +0300 Subject: [PATCH] Add SacrificeCostConvertedMana and use it for Bosh, Iron Golem. Implement cards: Faith Healer, Priest of Yawgmoth, Sacrifice, and Soldevi Adnate --- .../mage/sets/alliances/SoldeviAdnate1.java | 83 +++++++++++++++++++ .../mage/sets/alliances/SoldeviAdnate2.java | 55 ++++++++++++ .../sets/antiquities/PriestOfYawgmoth.java | 73 ++++++++++++++++ .../src/mage/sets/limitedalpha/Sacrifice.java | 52 ++++++++++++ .../src/mage/sets/limitedbeta/Sacrifice.java | 52 ++++++++++++ .../mage/sets/planechase/BoshIronGolem.java | 74 +++-------------- .../mage/sets/revisededition/Sacrifice.java | 52 ++++++++++++ .../mage/sets/unlimitededition/Sacrifice.java | 65 +++++++++++++++ .../src/mage/sets/urzassaga/FaithHealer.java | 70 ++++++++++++++++ .../common/SacrificeCostConvertedMana.java | 82 ++++++++++++++++++ 10 files changed, 596 insertions(+), 62 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/alliances/SoldeviAdnate1.java create mode 100644 Mage.Sets/src/mage/sets/alliances/SoldeviAdnate2.java create mode 100644 Mage.Sets/src/mage/sets/antiquities/PriestOfYawgmoth.java create mode 100644 Mage.Sets/src/mage/sets/limitedalpha/Sacrifice.java create mode 100644 Mage.Sets/src/mage/sets/limitedbeta/Sacrifice.java create mode 100644 Mage.Sets/src/mage/sets/revisededition/Sacrifice.java create mode 100644 Mage.Sets/src/mage/sets/unlimitededition/Sacrifice.java create mode 100644 Mage.Sets/src/mage/sets/urzassaga/FaithHealer.java create mode 100644 Mage/src/mage/abilities/dynamicvalue/common/SacrificeCostConvertedMana.java diff --git a/Mage.Sets/src/mage/sets/alliances/SoldeviAdnate1.java b/Mage.Sets/src/mage/sets/alliances/SoldeviAdnate1.java new file mode 100644 index 0000000000..6dc868b548 --- /dev/null +++ b/Mage.Sets/src/mage/sets/alliances/SoldeviAdnate1.java @@ -0,0 +1,83 @@ +/* + * 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.alliances; + +import java.util.UUID; +import mage.MageInt; +import mage.Mana; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.dynamicvalue.common.SacrificeCostConvertedMana; +import mage.abilities.mana.DynamicManaAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.target.common.TargetControlledPermanent; + +/** + * + * @author LoneFox + */ +public class SoldeviAdnate1 extends CardImpl { + + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("black or artifact creature"); + + static { + filter.add(Predicates.or(new ColorPredicate(ObjectColor.BLACK), new CardTypePredicate(CardType.ARTIFACT))); + } + + public SoldeviAdnate1(UUID ownerId) { + super(ownerId, 25, "Soldevi Adnate", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{B}"); + this.expansionSetCode = "ALL"; + this.subtype.add("Human"); + this.subtype.add("Cleric"); + this.power = new MageInt(1); + this.toughness = new MageInt(2); + + // {T}, Sacrifice a black or artifact creature: Add to your mana pool an amount of {B} equal to the sacrificed creature's converted mana cost. + Ability ability = new DynamicManaAbility(Mana.BlackMana, new SacrificeCostConvertedMana("creature"), + new TapSourceCost(), "add to your mana pool an amount of {B} equal to the sacrificed creature's converted mana cost"); + ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter))); + this.addAbility(ability); + } + + public SoldeviAdnate1(final SoldeviAdnate1 card) { + super(card); + } + + @Override + public SoldeviAdnate1 copy() { + return new SoldeviAdnate1(this); + } +} diff --git a/Mage.Sets/src/mage/sets/alliances/SoldeviAdnate2.java b/Mage.Sets/src/mage/sets/alliances/SoldeviAdnate2.java new file mode 100644 index 0000000000..644ac23148 --- /dev/null +++ b/Mage.Sets/src/mage/sets/alliances/SoldeviAdnate2.java @@ -0,0 +1,55 @@ +/* + * 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.alliances; + +import java.util.UUID; +import mage.MageInt; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; + +/** + * + * @author LoneFox + */ +public class SoldeviAdnate2 extends SoldeviAdnate1 { + + public SoldeviAdnate2(UUID ownerId) { + super(ownerId); + this.cardNumber = 26; + } + + public SoldeviAdnate2(final SoldeviAdnate2 card) { + super(card); + } + + @Override + public SoldeviAdnate2 copy() { + return new SoldeviAdnate2(this); + } +} diff --git a/Mage.Sets/src/mage/sets/antiquities/PriestOfYawgmoth.java b/Mage.Sets/src/mage/sets/antiquities/PriestOfYawgmoth.java new file mode 100644 index 0000000000..e648e0db97 --- /dev/null +++ b/Mage.Sets/src/mage/sets/antiquities/PriestOfYawgmoth.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.antiquities; + +import java.util.UUID; +import mage.MageInt; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.dynamicvalue.common.SacrificeCostConvertedMana; +import mage.abilities.mana.DynamicManaAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.common.FilterControlledArtifactPermanent; +import mage.target.common.TargetControlledPermanent; + +/** + * + * @author LoneFox + */ +public class PriestOfYawgmoth extends CardImpl { + + public PriestOfYawgmoth(UUID ownerId) { + super(ownerId, 49, "Priest of Yawgmoth", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{B}"); + this.expansionSetCode = "ATQ"; + this.subtype.add("Human"); + this.subtype.add("Cleric"); + this.power = new MageInt(1); + this.toughness = new MageInt(2); + + // {T}, Sacrifice an artifact: Add to your mana pool an amount of {B} equal to the sacrificed artifact's converted mana cost. + Ability ability = new DynamicManaAbility(Mana.BlackMana, new SacrificeCostConvertedMana("artifact"), + new TapSourceCost(), "add to your mana pool an amount of {B} equal to the sacrificed artifact's converted mana cost"); + ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(new FilterControlledArtifactPermanent()))); + this.addAbility(ability); + } + + public PriestOfYawgmoth(final PriestOfYawgmoth card) { + super(card); + } + + @Override + public PriestOfYawgmoth copy() { + return new PriestOfYawgmoth(this); + } +} diff --git a/Mage.Sets/src/mage/sets/limitedalpha/Sacrifice.java b/Mage.Sets/src/mage/sets/limitedalpha/Sacrifice.java new file mode 100644 index 0000000000..678d76f7bc --- /dev/null +++ b/Mage.Sets/src/mage/sets/limitedalpha/Sacrifice.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.limitedalpha; + +import java.util.UUID; + +/** + * + * @author LoneFox + */ +public class Sacrifice extends mage.sets.unlimitededition.Sacrifice { + + public Sacrifice(UUID ownerId) { + super(ownerId); + this.cardNumber = 33; + this.expansionSetCode = "LEA"; + } + + public Sacrifice(final Sacrifice card) { + super(card); + } + + @Override + public Sacrifice copy() { + return new Sacrifice(this); + } +} diff --git a/Mage.Sets/src/mage/sets/limitedbeta/Sacrifice.java b/Mage.Sets/src/mage/sets/limitedbeta/Sacrifice.java new file mode 100644 index 0000000000..e218a2307d --- /dev/null +++ b/Mage.Sets/src/mage/sets/limitedbeta/Sacrifice.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.limitedbeta; + +import java.util.UUID; + +/** + * + * @author LoneFox + */ +public class Sacrifice extends mage.sets.unlimitededition.Sacrifice { + + public Sacrifice(UUID ownerId) { + super(ownerId); + this.cardNumber = 33; + this.expansionSetCode = "LEB"; + } + + public Sacrifice(final Sacrifice card) { + super(card); + } + + @Override + public Sacrifice copy() { + return new Sacrifice(this); + } +} diff --git a/Mage.Sets/src/mage/sets/planechase/BoshIronGolem.java b/Mage.Sets/src/mage/sets/planechase/BoshIronGolem.java index 769221d7eb..34c051fa00 100644 --- a/Mage.Sets/src/mage/sets/planechase/BoshIronGolem.java +++ b/Mage.Sets/src/mage/sets/planechase/BoshIronGolem.java @@ -29,24 +29,20 @@ package mage.sets.planechase; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; -import mage.abilities.costs.Cost; import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.dynamicvalue.common.SacrificeCostConvertedMana; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; -import mage.constants.Outcome; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; -import mage.filter.common.FilterControlledPermanent; -import mage.filter.predicate.mageobject.CardTypePredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.players.Player; +import mage.filter.common.FilterControlledArtifactPermanent; import mage.target.common.TargetControlledPermanent; import mage.target.common.TargetCreatureOrPlayer; @@ -55,13 +51,7 @@ import mage.target.common.TargetCreatureOrPlayer; * @author jeffwadsworth */ public class BoshIronGolem extends CardImpl { - - private static final FilterControlledPermanent filter = new FilterControlledPermanent("artifact"); - - static { - filter.add(new CardTypePredicate(CardType.ARTIFACT)); - } - + public BoshIronGolem(UUID ownerId) { super(ownerId, 108, "Bosh, Iron Golem", Rarity.RARE, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{8}"); this.expansionSetCode = "HOP"; @@ -73,10 +63,12 @@ public class BoshIronGolem extends CardImpl { // Trample this.addAbility(TrampleAbility.getInstance()); - + // {3}{R}, Sacrifice an artifact: Bosh, Iron Golem deals damage equal to the sacrificed artifact's converted mana cost to target creature or player. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoshIronGolemEffect(), new ManaCostsImpl("{3}{R}")); - ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter))); + Effect effect = new DamageTargetEffect(new SacrificeCostConvertedMana("artifact")); + effect.setText("{this} deals damage equal to the sacrificed artifact's converted mana cost to target creature or player"); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{3}{R}")); + ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(new FilterControlledArtifactPermanent("an artifact")))); ability.addTarget(new TargetCreatureOrPlayer()); this.addAbility(ability); } @@ -90,45 +82,3 @@ public class BoshIronGolem extends CardImpl { return new BoshIronGolem(this); } } - -class BoshIronGolemEffect extends OneShotEffect { - - public BoshIronGolemEffect() { - super(Outcome.Damage); - staticText = "{this} deals damage equal to the sacrificed artifact's converted mana cost to target creature or player"; - } - - public BoshIronGolemEffect(final BoshIronGolemEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - int amount = 0; - for (Cost cost: source.getCosts()) { - if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost)cost).getPermanents().size() > 0) { - amount = ((SacrificeTargetCost)cost).getPermanents().get(0).getManaCost().convertedManaCost(); - break; - } - } - if (amount > 0) { - Permanent permanent = game.getPermanent(source.getFirstTarget()); - if (permanent != null) { - permanent.damage(amount, source.getSourceId(), game, false, true); - return true; - } - Player player = game.getPlayer(source.getFirstTarget()); - if (player != null) { - player.damage(amount, source.getSourceId(), game, false, true); - return true; - } - } - return false; - } - - @Override - public BoshIronGolemEffect copy() { - return new BoshIronGolemEffect(this); - } - -} diff --git a/Mage.Sets/src/mage/sets/revisededition/Sacrifice.java b/Mage.Sets/src/mage/sets/revisededition/Sacrifice.java new file mode 100644 index 0000000000..acce4e3f6e --- /dev/null +++ b/Mage.Sets/src/mage/sets/revisededition/Sacrifice.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.revisededition; + +import java.util.UUID; + +/** + * + * @author LoneFox + */ +public class Sacrifice extends mage.sets.unlimitededition.Sacrifice { + + public Sacrifice(UUID ownerId) { + super(ownerId); + this.cardNumber = 34; + this.expansionSetCode = "3ED"; + } + + public Sacrifice(final Sacrifice card) { + super(card); + } + + @Override + public Sacrifice copy() { + return new Sacrifice(this); + } +} diff --git a/Mage.Sets/src/mage/sets/unlimitededition/Sacrifice.java b/Mage.Sets/src/mage/sets/unlimitededition/Sacrifice.java new file mode 100644 index 0000000000..b62d1a7e56 --- /dev/null +++ b/Mage.Sets/src/mage/sets/unlimitededition/Sacrifice.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.unlimitededition; + +import java.util.UUID; +import mage.Mana; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.dynamicvalue.common.SacrificeCostConvertedMana; +import mage.abilities.effects.common.DynamicManaEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.target.common.TargetControlledCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class Sacrifice extends CardImpl { + + public Sacrifice(UUID ownerId) { + super(ownerId, 33, "Sacrifice", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{B}"); + this.expansionSetCode = "2ED"; + + // As an additional cost to cast Sacrifice, sacrifice a creature. + this.getSpellAbility().addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent())); + // Add to your mana pool an amount of {B} equal to the sacrificed creature's converted mana cost. + this.getSpellAbility().addEffect(new DynamicManaEffect(Mana.BlackMana, new SacrificeCostConvertedMana("creature"), + "add to your mana pool an amount of {B} equal to the sacrificed creature's converted mana cost")); + } + + public Sacrifice(final Sacrifice card) { + super(card); + } + + @Override + public Sacrifice copy() { + return new Sacrifice(this); + } +} diff --git a/Mage.Sets/src/mage/sets/urzassaga/FaithHealer.java b/Mage.Sets/src/mage/sets/urzassaga/FaithHealer.java new file mode 100644 index 0000000000..37a5258072 --- /dev/null +++ b/Mage.Sets/src/mage/sets/urzassaga/FaithHealer.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.urzassaga; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.dynamicvalue.common.SacrificeCostConvertedMana; +import mage.abilities.effects.common.GainLifeEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterControlledEnchantmentPermanent; +import mage.target.common.TargetControlledPermanent; + +/** + * + * @author LoneFox + */ +public class FaithHealer extends CardImpl { + + public FaithHealer(UUID ownerId) { + super(ownerId, 14, "Faith Healer", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{W}"); + this.expansionSetCode = "USG"; + this.subtype.add("Human"); + this.subtype.add("Cleric"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Sacrifice an enchantment: You gain life equal to the sacrificed enchantment's converted mana cost. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainLifeEffect(new SacrificeCostConvertedMana("enchantment")), + new SacrificeTargetCost(new TargetControlledPermanent(new FilterControlledEnchantmentPermanent())))); + } + + public FaithHealer(final FaithHealer card) { + super(card); + } + + @Override + public FaithHealer copy() { + return new FaithHealer(this); + } +} diff --git a/Mage/src/mage/abilities/dynamicvalue/common/SacrificeCostConvertedMana.java b/Mage/src/mage/abilities/dynamicvalue/common/SacrificeCostConvertedMana.java new file mode 100644 index 0000000000..5de2bff16d --- /dev/null +++ b/Mage/src/mage/abilities/dynamicvalue/common/SacrificeCostConvertedMana.java @@ -0,0 +1,82 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.abilities.dynamicvalue.common; + +import mage.abilities.Ability; +import mage.abilities.costs.Cost; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * @author LoneFox + */ +public class SacrificeCostConvertedMana implements DynamicValue { + + private final String type; + + public SacrificeCostConvertedMana(String type) { + this.type = type; + } + + public SacrificeCostConvertedMana(SacrificeCostConvertedMana value) { + this.type = value.type; + } + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + for(Cost cost : sourceAbility.getCosts()) { + if(cost instanceof SacrificeTargetCost) { + SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost; + int totalCMC = 0; + for(Permanent permanent : sacrificeCost.getPermanents()) { + totalCMC += permanent.getManaCost().convertedManaCost(); + } + return totalCMC; + } + } + return 0; + } + + @Override + public SacrificeCostConvertedMana copy() { + return new SacrificeCostConvertedMana(this); + } + + @Override + public String toString() { + return "X"; + } + + @Override + public String getMessage() { + return "the sacrificed " + type + "'s converted mana cost"; + } +}