diff --git a/Mage.Sets/src/mage/sets/tempest/EmeraldMedallion.java b/Mage.Sets/src/mage/sets/tempest/EmeraldMedallion.java new file mode 100644 index 00000000000..4b17fc5394b --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/EmeraldMedallion.java @@ -0,0 +1,64 @@ +/* + * 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.tempest; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.ObjectColor; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.cost.ColorCostReductionEffect; +import mage.cards.CardImpl; + +import java.util.UUID; + +/** + * @author noxx + */ +public class EmeraldMedallion extends CardImpl { + + private static final String ruleText = "Green spells you cast cost {1} less to cast"; + + public EmeraldMedallion(UUID ownerId) { + super(ownerId, 273, "Emerald Medallion", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}"); + this.expansionSetCode = "TMP"; + + // Green spells you cast cost {1} less to cast. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new ColorCostReductionEffect(ObjectColor.GREEN, 1, ruleText))); + } + + public EmeraldMedallion(final EmeraldMedallion card) { + super(card); + } + + @Override + public EmeraldMedallion copy() { + return new EmeraldMedallion(this); + } +} + diff --git a/Mage.Sets/src/mage/sets/tempest/JetMedallion.java b/Mage.Sets/src/mage/sets/tempest/JetMedallion.java new file mode 100644 index 00000000000..c4d65325d58 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/JetMedallion.java @@ -0,0 +1,63 @@ +/* + * 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.tempest; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.ObjectColor; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.cost.ColorCostReductionEffect; +import mage.cards.CardImpl; + +import java.util.UUID; + +/** + * @author noxx + */ +public class JetMedallion extends CardImpl { + + private static final String ruleText = "Black spells you cast cost {1} less to cast"; + + public JetMedallion(UUID ownerId) { + super(ownerId, 282, "Jet Medallion", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}"); + this.expansionSetCode = "TMP"; + + // Black spells you cast cost {1} less to cast. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new ColorCostReductionEffect(ObjectColor.BLACK, 1, ruleText))); + } + + public JetMedallion(final JetMedallion card) { + super(card); + } + + @Override + public JetMedallion copy() { + return new JetMedallion(this); + } +} diff --git a/Mage.Sets/src/mage/sets/tempest/PearlMedallion.java b/Mage.Sets/src/mage/sets/tempest/PearlMedallion.java new file mode 100644 index 00000000000..69784d69928 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/PearlMedallion.java @@ -0,0 +1,63 @@ +/* + * 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.tempest; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.ObjectColor; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.cost.ColorCostReductionEffect; +import mage.cards.CardImpl; + +import java.util.UUID; + +/** + * @author noxx + */ +public class PearlMedallion extends CardImpl { + + private static final String ruleText = "White spells you cast cost {1} less to cast"; + + public PearlMedallion(UUID ownerId) { + super(ownerId, 290, "Pearl Medallion", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}"); + this.expansionSetCode = "TMP"; + + // White spells you cast cost {1} less to cast. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new ColorCostReductionEffect(ObjectColor.WHITE, 1, ruleText))); + } + + public PearlMedallion(final PearlMedallion card) { + super(card); + } + + @Override + public PearlMedallion copy() { + return new PearlMedallion(this); + } +} diff --git a/Mage.Sets/src/mage/sets/tempest/RubyMedallion.java b/Mage.Sets/src/mage/sets/tempest/RubyMedallion.java new file mode 100644 index 00000000000..b24d162a713 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/RubyMedallion.java @@ -0,0 +1,63 @@ +/* + * 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.tempest; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.ObjectColor; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.cost.ColorCostReductionEffect; +import mage.cards.CardImpl; + +import java.util.UUID; + +/** + * @author noxx + */ +public class RubyMedallion extends CardImpl { + + private static final String ruleText = "Red spells you cast cost {1} less to cast"; + + public RubyMedallion(UUID ownerId) { + super(ownerId, 295, "Ruby Medallion", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}"); + this.expansionSetCode = "TMP"; + + // Red spells you cast cost {1} less to cast. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new ColorCostReductionEffect(ObjectColor.RED, 1, ruleText))); + } + + public RubyMedallion(final RubyMedallion card) { + super(card); + } + + @Override + public RubyMedallion copy() { + return new RubyMedallion(this); + } +} diff --git a/Mage.Sets/src/mage/sets/tempest/SapphireMedallion.java b/Mage.Sets/src/mage/sets/tempest/SapphireMedallion.java new file mode 100644 index 00000000000..0d41c76f142 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/SapphireMedallion.java @@ -0,0 +1,63 @@ +/* + * 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.tempest; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.ObjectColor; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.cost.ColorCostReductionEffect; +import mage.cards.CardImpl; + +import java.util.UUID; + +/** + * @author noxx + */ +public class SapphireMedallion extends CardImpl { + + private static final String ruleText = "Blue spells you cast cost {1} less to cast"; + + public SapphireMedallion(UUID ownerId) { + super(ownerId, 296, "Sapphire Medallion", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}"); + this.expansionSetCode = "TMP"; + + // Blue spells you cast cost {1} less to cast. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new ColorCostReductionEffect(ObjectColor.BLUE, 1, ruleText))); + } + + public SapphireMedallion(final SapphireMedallion card) { + super(card); + } + + @Override + public SapphireMedallion copy() { + return new SapphireMedallion(this); + } +} diff --git a/Mage/src/mage/abilities/effects/common/cost/ColorCostReductionEffect.java b/Mage/src/mage/abilities/effects/common/cost/ColorCostReductionEffect.java new file mode 100644 index 00000000000..b0dd249a414 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/cost/ColorCostReductionEffect.java @@ -0,0 +1,56 @@ +package mage.abilities.effects.common.cost; + +import mage.Constants; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.SpellAbility; +import mage.abilities.effects.CostModificationEffectImpl; +import mage.cards.Card; +import mage.game.Game; +import mage.util.CardUtil; + +/** + * @author noxx + */ +public class ColorCostReductionEffect extends CostModificationEffectImpl { + + private ObjectColor color; + private int reduceCount; + + public ColorCostReductionEffect(ObjectColor color, int reduceCount, String ruleText) { + super(Constants.Duration.WhileOnBattlefield, Constants.Outcome.Benefit); + staticText = ruleText; + this.color = color; + this.reduceCount = reduceCount; + } + + private ColorCostReductionEffect(ColorCostReductionEffect effect) { + super(effect); + this.color = effect.color; + this.reduceCount = effect.reduceCount; + } + + @Override + public boolean apply(Game game, Ability source, Ability abilityToModify) { + SpellAbility spellAbility = (SpellAbility) abilityToModify; + CardUtil.adjustCost(spellAbility, this.reduceCount); + return true; + } + + @Override + public boolean applies(Ability abilityToModify, Ability source, Game game) { + if ( abilityToModify instanceof SpellAbility ) { + Card sourceCard = game.getCard(abilityToModify.getSourceId()); + if ( sourceCard != null && sourceCard.getColor().contains(color) && sourceCard.getOwnerId().equals(source.getControllerId()) ) { + return true; + } + } + return false; + } + + @Override + public ColorCostReductionEffect copy() { + return new ColorCostReductionEffect(this); + } + +} \ No newline at end of file