From 6b3f61ce4caa78a828627cdac9b8c2adfe34e579 Mon Sep 17 00:00:00 2001 From: LoneFox Date: Tue, 15 Dec 2015 10:43:50 +0200 Subject: [PATCH] Implement cards: Electrostatic Bolt, Forge Armor, Power Conduit, and Relic Bane --- .../mage/sets/mirrodin/ElectrostaticBolt.java | 101 ++++++++++++++++++ .../src/mage/sets/mirrodin/ForgeArmor.java | 68 ++++++++++++ .../src/mage/sets/mirrodin/PowerConduit.java | 75 +++++++++++++ .../src/mage/sets/mirrodin/RelicBane.java | 77 +++++++++++++ 4 files changed, 321 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/mirrodin/ElectrostaticBolt.java create mode 100644 Mage.Sets/src/mage/sets/mirrodin/ForgeArmor.java create mode 100644 Mage.Sets/src/mage/sets/mirrodin/PowerConduit.java create mode 100644 Mage.Sets/src/mage/sets/mirrodin/RelicBane.java diff --git a/Mage.Sets/src/mage/sets/mirrodin/ElectrostaticBolt.java b/Mage.Sets/src/mage/sets/mirrodin/ElectrostaticBolt.java new file mode 100644 index 0000000000..81c301a4f8 --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirrodin/ElectrostaticBolt.java @@ -0,0 +1,101 @@ +/* + * 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.mirrodin; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class ElectrostaticBolt extends CardImpl { + + public ElectrostaticBolt(UUID ownerId) { + super(ownerId, 89, "Electrostatic Bolt", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{R}"); + this.expansionSetCode = "MRD"; + + // Electrostatic Bolt deals 2 damage to target creature. If it's an artifact creature, Electrostatic Bolt deals 4 damage to it instead. + Effect effect = new DamageTargetEffect(new ElectrostaticBoltDamageValue()); + effect.setText("{this} deals 2 damage to target creature. If it's an artifact creature, {this} deals 4 damage to it instead."); + this.getSpellAbility().addEffect(effect); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + } + + public ElectrostaticBolt(final ElectrostaticBolt card) { + super(card); + } + + @java.lang.Override + public ElectrostaticBolt copy() { + return new ElectrostaticBolt(this); + } +} + +class ElectrostaticBoltDamageValue implements DynamicValue { + + final static FilterCreaturePermanent filter = new FilterCreaturePermanent(); + + static { + filter.add(new CardTypePredicate(CardType.ARTIFACT)); + } + + @java.lang.Override + public int calculate(Game game, Ability source, Effect effect) { + Permanent targetPermanent = game.getPermanent(source.getFirstTarget()); + if(targetPermanent != null) { + if(filter.match(targetPermanent, game)) { + return 4; + } + return 2; + } + return 0; + } + + @java.lang.Override + public ElectrostaticBoltDamageValue copy() { + return new ElectrostaticBoltDamageValue(); + } + + @java.lang.Override + public String getMessage() { + return ""; + } +} + diff --git a/Mage.Sets/src/mage/sets/mirrodin/ForgeArmor.java b/Mage.Sets/src/mage/sets/mirrodin/ForgeArmor.java new file mode 100644 index 0000000000..1e732153d7 --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirrodin/ForgeArmor.java @@ -0,0 +1,68 @@ +/* + * 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.mirrodin; + +import java.util.UUID; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.dynamicvalue.common.SacrificeCostConvertedMana; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.counters.CounterType; +import mage.filter.common.FilterControlledArtifactPermanent; +import mage.target.common.TargetControlledPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class ForgeArmor extends CardImpl { + + public ForgeArmor(UUID ownerId) { + super(ownerId, 92, "Forge Armor", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{4}{R}"); + this.expansionSetCode = "MRD"; + + // As an additional cost to cast Forge Armor, sacrifice an artifact. + this.getSpellAbility().addCost(new SacrificeTargetCost(new TargetControlledPermanent(new FilterControlledArtifactPermanent()))); + // Put X +1/+1 counters on target creature, where X is the sacrificed artifact's converted mana cost. + this.getSpellAbility().addEffect(new AddCountersTargetEffect(new AddCountersTargetEffect( + CounterType.P1P1.createInstance(), new SacrificeCostConvertedMana("artifact")))); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + } + + public ForgeArmor(final ForgeArmor card) { + super(card); + } + + @java.lang.Override + public ForgeArmor copy() { + return new ForgeArmor(this); + } +} diff --git a/Mage.Sets/src/mage/sets/mirrodin/PowerConduit.java b/Mage.Sets/src/mage/sets/mirrodin/PowerConduit.java new file mode 100644 index 0000000000..c3c4c169da --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirrodin/PowerConduit.java @@ -0,0 +1,75 @@ +/* + * 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.mirrodin; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.RemoveCounterCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.target.common.TargetArtifactPermanent; +import mage.target.common.TargetControlledPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class PowerConduit extends CardImpl { + + public PowerConduit(UUID ownerId) { + super(ownerId, 229, "Power Conduit", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{2}"); + this.expansionSetCode = "MRD"; + + // {tap}, Remove a counter from a permanent you control: Choose one - Put a charge counter on target artifact; or put a +1/+1 counter on target creature. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersTargetEffect(CounterType.CHARGE.createInstance()), new TapSourceCost()); + ability.addCost(new RemoveCounterCost(new TargetControlledPermanent())); + ability.addTarget(new TargetArtifactPermanent()); + Mode mode = new Mode(); + mode.getEffects().add(new AddCountersTargetEffect(CounterType.P1P1.createInstance())); + mode.getTargets().add(new TargetCreaturePermanent()); + ability.addMode(mode); + this.addAbility(ability); + } + + public PowerConduit(final PowerConduit card) { + super(card); + } + + @java.lang.Override + public PowerConduit copy() { + return new PowerConduit(this); + } +} diff --git a/Mage.Sets/src/mage/sets/mirrodin/RelicBane.java b/Mage.Sets/src/mage/sets/mirrodin/RelicBane.java new file mode 100644 index 0000000000..991a01830b --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirrodin/RelicBane.java @@ -0,0 +1,77 @@ +/* + * 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.mirrodin; + +import java.util.UUID; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.LoseLifeSourceControllerEffect; +import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.target.TargetPermanent; +import mage.target.common.TargetArtifactPermanent; + +/** + * + * @author LoneFox + */ +public class RelicBane extends CardImpl { + + public RelicBane(UUID ownerId) { + super(ownerId, 76, "Relic Bane", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}{B}"); + this.expansionSetCode = "MRD"; + this.subtype.add("Aura"); + + // Enchant artifact + TargetPermanent auraTarget = new TargetArtifactPermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment)); + this.addAbility(new EnchantAbility(auraTarget.getTargetName())); + // Enchanted artifact has "At the beginning of your upkeep, you lose 2 life." + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect( + new BeginningOfUpkeepTriggeredAbility(new LoseLifeSourceControllerEffect(2), + TargetController.YOU, false), AttachmentType.AURA))); + } + + public RelicBane(final RelicBane card) { + super(card); + } + + @java.lang.Override + public RelicBane copy() { + return new RelicBane(this); + } +}