diff --git a/Mage.Sets/src/mage/sets/alarareborn/Anathemancer.java b/Mage.Sets/src/mage/sets/alarareborn/Anathemancer.java new file mode 100644 index 0000000000..a6be067107 --- /dev/null +++ b/Mage.Sets/src/mage/sets/alarareborn/Anathemancer.java @@ -0,0 +1,107 @@ +/* + * 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.alarareborn; + +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.keyword.UnearthAbility; +import mage.cards.CardImpl; +import mage.filter.common.FilterLandPermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.SupertypePredicate; +import mage.filter.predicate.permanent.ControllerIdPredicate; +import mage.game.Game; +import mage.target.TargetPlayer; + +/** + * + * @author North + */ +public class Anathemancer extends CardImpl { + + public Anathemancer(UUID ownerId) { + super(ownerId, 33, "Anathemancer", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{B}{R}"); + this.expansionSetCode = "ARB"; + this.subtype.add("Zombie"); + this.subtype.add("Wizard"); + + this.color.setRed(true); + this.color.setBlack(true); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // When Anathemancer enters the battlefield, it deals damage to target player equal to the number of nonbasic lands that player controls. + EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(new AnathemancerCount())); + ability.addTarget(new TargetPlayer()); + this.addAbility(ability); + // Unearth {5}{B}{R} + this.addAbility(new UnearthAbility(new ManaCostsImpl("{5}{B}{R}"))); + } + + public Anathemancer(final Anathemancer card) { + super(card); + } + + @Override + public Anathemancer copy() { + return new Anathemancer(this); + } +} + +class AnathemancerCount implements DynamicValue { + + @Override + public int calculate(Game game, Ability sourceAbility) { + if (sourceAbility.getFirstTarget() == null) { + return 0; + } + + FilterLandPermanent filter = new FilterLandPermanent(); + filter.add(Predicates.not(new SupertypePredicate("Basic"))); + filter.add(new ControllerIdPredicate(sourceAbility.getFirstTarget())); + + return game.getBattlefield().count(filter, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game); + } + + @Override + public DynamicValue clone() { + return new AnathemancerCount(); + } + + @Override + public String getMessage() { + return "nonbasic lands that player controls"; + } +} diff --git a/Mage.Sets/src/mage/sets/mirrodin/MoltenRain.java b/Mage.Sets/src/mage/sets/mirrodin/MoltenRain.java new file mode 100644 index 0000000000..835d4ea90d --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirrodin/MoltenRain.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.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.abilities.effects.common.DestroyTargetEffect; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetLandPermanent; + +/** + * + * @author North + */ +public class MoltenRain extends CardImpl { + + public MoltenRain(UUID ownerId) { + super(ownerId, 101, "Molten Rain", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{1}{R}{R}"); + this.expansionSetCode = "MRD"; + + this.color.setRed(true); + + // Destroy target land. + this.getSpellAbility().addEffect(new DestroyTargetEffect()); + this.getSpellAbility().addTarget(new TargetLandPermanent()); + // If that land was nonbasic, Molten Rain deals 2 damage to the land's controller. + this.getSpellAbility().addEffect(new MoltenRainEffect()); + } + + public MoltenRain(final MoltenRain card) { + super(card); + } + + @Override + public MoltenRain copy() { + return new MoltenRain(this); + } +} + +class MoltenRainEffect extends OneShotEffect { + + public MoltenRainEffect() { + super(Outcome.Damage); + this.staticText = "If that land was nonbasic, Molten Rain deals 2 damage to the land's controller"; + } + + public MoltenRainEffect(final MoltenRainEffect effect) { + super(effect); + } + + @Override + public MoltenRainEffect copy() { + return new MoltenRainEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = (Permanent) game.getLastKnownInformation(source.getFirstTarget(), Zone.BATTLEFIELD); + if (permanent != null && !permanent.getSupertype().contains("Basic")) { + Player player = game.getPlayer(permanent.getControllerId()); + if (player != null) { + player.damage(2, source.getSourceId(), game, false, true); + return true; + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/odyssey/EarthRift.java b/Mage.Sets/src/mage/sets/odyssey/EarthRift.java new file mode 100644 index 0000000000..7e521f8cd8 --- /dev/null +++ b/Mage.Sets/src/mage/sets/odyssey/EarthRift.java @@ -0,0 +1,67 @@ +/* + * 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.odyssey; + +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.Constants.TimingRule; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.keyword.FlashbackAbility; +import mage.cards.CardImpl; +import mage.target.common.TargetLandPermanent; + +/** + * + * @author North + */ +public class EarthRift extends CardImpl { + + public EarthRift(UUID ownerId) { + super(ownerId, 189, "Earth Rift", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{3}{R}"); + this.expansionSetCode = "ODY"; + + this.color.setRed(true); + + // Destroy target land. + this.getSpellAbility().addEffect(new DestroyTargetEffect()); + this.getSpellAbility().addTarget(new TargetLandPermanent()); + // Flashback {5}{R}{R} + this.addAbility(new FlashbackAbility(new ManaCostsImpl("{5}{R}{R}"), TimingRule.SORCERY)); + } + + public EarthRift(final EarthRift card) { + super(card); + } + + @Override + public EarthRift copy() { + return new EarthRift(this); + } +} diff --git a/Mage.Sets/src/mage/sets/shardsofalara/NayaCharm.java b/Mage.Sets/src/mage/sets/shardsofalara/NayaCharm.java new file mode 100644 index 0000000000..10afe7a87d --- /dev/null +++ b/Mage.Sets/src/mage/sets/shardsofalara/NayaCharm.java @@ -0,0 +1,120 @@ +/* + * 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.shardsofalara; + +import java.util.List; +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Outcome; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.effects.common.ReturnToHandTargetEffect; +import mage.cards.CardImpl; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.ControllerIdPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPlayer; +import mage.target.common.TargetCardInGraveyard; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author North + */ +public class NayaCharm extends CardImpl { + + public NayaCharm(UUID ownerId) { + super(ownerId, 180, "Naya Charm", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{R}{G}{W}"); + this.expansionSetCode = "ALA"; + + this.color.setRed(true); + this.color.setGreen(true); + this.color.setWhite(true); + + // Choose one - Naya Charm deals 3 damage to target creature; + this.getSpellAbility().addEffect(new DamageTargetEffect(3)); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + // or return target card from a graveyard to its owner's hand; + Mode mode = new Mode(); + mode.getEffects().add(new ReturnToHandTargetEffect()); + mode.getTargets().add(new TargetCardInGraveyard()); + this.getSpellAbility().addMode(mode); + // or tap all creatures target player controls. + mode = new Mode(); + mode.getEffects().add(new NayaCharmEffect()); + mode.getTargets().add(new TargetPlayer()); + this.getSpellAbility().addMode(mode); + } + + public NayaCharm(final NayaCharm card) { + super(card); + } + + @Override + public NayaCharm copy() { + return new NayaCharm(this); + } +} + +class NayaCharmEffect extends OneShotEffect { + + public NayaCharmEffect() { + super(Outcome.Tap); + staticText = "Tap all creatures target player controls"; + } + + public NayaCharmEffect(final NayaCharmEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + if (source.getFirstTarget() == null) { + return false; + } + + FilterCreaturePermanent filter = new FilterCreaturePermanent(); + filter.add(new ControllerIdPredicate(source.getFirstTarget())); + + List creatures = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); + for (Permanent creature : creatures) { + creature.tap(game); + } + return true; + } + + @Override + public NayaCharmEffect copy() { + return new NayaCharmEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/shardsofalara/QuietusSpike.java b/Mage.Sets/src/mage/sets/shardsofalara/QuietusSpike.java new file mode 100644 index 0000000000..991e108d3a --- /dev/null +++ b/Mage.Sets/src/mage/sets/shardsofalara/QuietusSpike.java @@ -0,0 +1,146 @@ +/* + * 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.shardsofalara; + +import java.util.UUID; +import mage.Constants.AttachmentType; +import mage.Constants.CardType; +import mage.Constants.Outcome; +import mage.Constants.Rarity; +import mage.Constants.Zone; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continious.GainAbilityAttachedEffect; +import mage.abilities.keyword.DeathtouchAbility; +import mage.abilities.keyword.EquipAbility; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.events.DamagedPlayerEvent; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author North + */ +public class QuietusSpike extends CardImpl { + + public QuietusSpike(UUID ownerId) { + super(ownerId, 217, "Quietus Spike", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{3}"); + this.expansionSetCode = "ALA"; + this.subtype.add("Equipment"); + + // Equipped creature has deathtouch. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(DeathtouchAbility.getInstance(), AttachmentType.EQUIPMENT))); + // Whenever equipped creature deals combat damage to a player, that player loses half his or her life, rounded up. + this.addAbility(new QuietusSpikeTriggeredAbility()); + // Equip {3} + this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(3))); + } + + public QuietusSpike(final QuietusSpike card) { + super(card); + } + + @Override + public QuietusSpike copy() { + return new QuietusSpike(this); + } +} + +class QuietusSpikeTriggeredAbility extends TriggeredAbilityImpl { + + public QuietusSpikeTriggeredAbility() { + super(Zone.BATTLEFIELD, new QuietusSpikeEffect()); + } + + public QuietusSpikeTriggeredAbility(final QuietusSpikeTriggeredAbility ability) { + super(ability); + } + + @Override + public QuietusSpikeTriggeredAbility copy() { + return new QuietusSpikeTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event instanceof DamagedPlayerEvent) { + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; + Permanent p = game.getPermanent(event.getSourceId()); + if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); + } + return true; + } + } + return false; + } + + @Override + public String getRule() { + return "Whenever equipped creature deals combat damage to a player, " + super.getRule(); + } +} + +class QuietusSpikeEffect extends OneShotEffect { + + public QuietusSpikeEffect() { + super(Outcome.Damage); + this.staticText = "that player loses half his or her life, rounded up"; + } + + public QuietusSpikeEffect(final QuietusSpikeEffect effect) { + super(effect); + } + + @Override + public QuietusSpikeEffect copy() { + return new QuietusSpikeEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(targetPointer.getFirst(game, source)); + if (player != null) { + Integer amount = (int) Math.ceil(player.getLife() / 2f); + if (amount > 0) { + player.loseLife(amount, game); + return true; + } + } + return false; + } +}