Conflicts:
	Mage.Sets/src/mage/sets/avacynrestored/CavernOfSouls.java
	Mage.Sets/src/mage/sets/shadowmoor/ManaReflection.java
This commit is contained in:
betasteward 2015-03-01 22:02:33 -05:00
commit 5c746e8ec2
137 changed files with 4932 additions and 633 deletions

View file

@ -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.ajanivsnicolbolas;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public class SapseepForest extends mage.sets.shadowmoor.SapseepForest {
public SapseepForest(UUID ownerId) {
super(ownerId);
this.cardNumber = 36;
this.expansionSetCode = "DDH";
}
public SapseepForest(final SapseepForest card) {
super(card);
}
@Override
public SapseepForest copy() {
return new SapseepForest(this);
}
}

View file

@ -36,9 +36,8 @@ import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.MonocoloredPredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -91,12 +90,11 @@ class DefilerOfSoulsEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
FilterCreaturePermanent filter = new FilterCreaturePermanent("monocolored creature");
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("monocolored creature");
Player player = game.getPlayer(targetPointer.getFirst(game, source));
if (player == null) {
return false;
}
filter.add(new ControllerPredicate(TargetController.YOU));
filter.add(new MonocoloredPredicate());
int amount;

View file

@ -37,7 +37,7 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterArtifactPermanent;
import mage.filter.common.FilterControlledArtifactPermanent;
import mage.target.common.TargetControlledPermanent;
/**
@ -50,12 +50,9 @@ public class TimeSieve extends CardImpl {
super(ownerId, 31, "Time Sieve", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{U}{B}");
this.expansionSetCode = "ARB";
// {tap}, Sacrifice five artifacts: Take an extra turn after this one.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddExtraTurnControllerEffect(), new TapSourceCost());
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(5, 5, new FilterArtifactPermanent("five artifacts"), true)));
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(5, 5, new FilterControlledArtifactPermanent("five artifacts"), true)));
this.addAbility(ability);
}

View file

@ -0,0 +1,53 @@
/*
* 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;
/**
*
* @author Plopman
*/
public class CircleOfProtectionArtifacts extends mage.sets.fifthdawn.CircleOfProtectionArtifacts {
public CircleOfProtectionArtifacts(UUID ownerId) {
super(ownerId);
this.cardNumber = 97;
this.expansionSetCode = "ATQ";
}
public CircleOfProtectionArtifacts(final CircleOfProtectionArtifacts card) {
super(card);
}
@Override
public CircleOfProtectionArtifacts copy() {
return new CircleOfProtectionArtifacts(this);
}
}

View file

@ -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.archenemy;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public class TorrentOfSouls extends mage.sets.shadowmoor.TorrentOfSouls {
public TorrentOfSouls(UUID ownerId) {
super(ownerId);
this.cardNumber = 96;
this.expansionSetCode = "ARC";
}
public TorrentOfSouls(final TorrentOfSouls card) {
super(card);
}
@Override
public TorrentOfSouls copy() {
return new TorrentOfSouls(this);
}
}

View file

@ -36,6 +36,7 @@ import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.mana.ColorlessManaAbility;
@ -79,7 +80,7 @@ public class CavernOfSouls extends CardImpl {
this.addAbility(new ColorlessManaAbility());
// {T}: Add one mana of any color to your mana pool. Spend this mana only to cast a creature spell of the chosen type, and that spell can't be countered.
this.addAbility(new ConditionalAnyColorManaAbility(1, new CavernOfSoulsManaBuilder()), new CavernOfSoulsWatcher());
this.addAbility(new ConditionalAnyColorManaAbility(new TapSourceCost(), 1, new CavernOfSoulsManaBuilder(), true), new CavernOfSoulsWatcher());
this.addAbility(new SimpleStaticAbility(Zone.ALL, new CavernOfSoulsCantCounterEffect()));
}

View file

@ -37,7 +37,7 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterPermanentCard;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.mageobject.SupertypePredicate;
@ -70,7 +70,7 @@ public class Lifespinner extends CardImpl {
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)),
new TapSourceCost());
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(3, 3, new FilterCreaturePermanent("Spirit", "three Spirits"), false)));
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(3, 3, new FilterControlledCreaturePermanent("Spirit", "three Spirits"), false)));
this.addAbility(ability);
}

View file

@ -34,7 +34,7 @@ import mage.abilities.keyword.SpliceOntoArcaneAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.common.FilterLandPermanent;
import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetControlledPermanent;
import mage.target.common.TargetCreaturePermanent;
@ -44,7 +44,7 @@ import mage.target.common.TargetCreaturePermanent;
* @author LevelX2
*/
public class TorrentOfStone extends CardImpl {
private static final FilterLandPermanent filterSacrifice = new FilterLandPermanent("two Mountains");
private static final FilterControlledLandPermanent filterSacrifice = new FilterControlledLandPermanent("two Mountains");
static {
filterSacrifice.add(new SubtypePredicate("Mountain"));

View file

@ -28,6 +28,7 @@
package mage.sets.bornofthegods;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
@ -162,6 +163,7 @@ class SearingBloodDelayedEffect extends OneShotEffect {
if (permanent != null) {
Player player = game.getPlayer(permanent.getControllerId());
if (player != null) {
MageObject sourceObject = source.getSourceObject(game);
player.damage(3, source.getSourceId(), game, false, true);
return true;
}

View file

@ -32,13 +32,12 @@ 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.filter.FilterPermanent;
import mage.filter.common.FilterLandPermanent;
import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -93,22 +92,24 @@ class FeastOfWormsEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = (Permanent) game.getLastKnownInformation(source.getFirstTarget(), Zone.BATTLEFIELD);
Player targetPlayer = game.getPlayer(permanent.getControllerId());
if (targetPlayer != null && permanent != null && (permanent.getSupertype().get(0).toString().equals("Legendary"))) {
FilterPermanent filter = new FilterLandPermanent("land to sacrifice");
filter.add(new ControllerIdPredicate(targetPlayer.getId()));
TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, false);
Permanent permanent = game.getPermanentOrLKIBattlefield(id);
Player targetPlayer = null;
if (permanent != null) {
targetPlayer = game.getPlayer(permanent.getControllerId());
}
if (targetPlayer != null && permanent != null && (permanent.getSupertype().get(0).equals("Legendary"))) {
FilterControlledPermanent filter = new FilterControlledLandPermanent("land to sacrifice");
filter.add(new ControllerIdPredicate(targetPlayer.getId()));
TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, false);
if (target.canChoose(targetPlayer.getId(), game)) {
targetPlayer.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
Permanent land = game.getPermanent(target.getFirstTarget());
if (land != null) {
return land.sacrifice(source.getSourceId(), game);
}
return true;
if (target.canChoose(targetPlayer.getId(), game)) {
targetPlayer.chooseTarget(Outcome.Sacrifice, target, source, game);
Permanent land = game.getPermanent(target.getFirstTarget());
if (land != null) {
land.sacrifice(source.getSourceId(), game);
}
}
return true;
}
return false;
}

View file

@ -36,7 +36,7 @@ import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
@ -106,7 +106,7 @@ class ShimatsuTheBloodcloakedEffect extends ReplacementEffectImpl {
Permanent creature = game.getPermanent(event.getTargetId());
Player controller = game.getPlayer(source.getControllerId());
if (creature != null && controller != null) {
Target target = new TargetControlledPermanent(0, Integer.MAX_VALUE, new FilterPermanent(), true);
Target target = new TargetControlledPermanent(0, Integer.MAX_VALUE, new FilterControlledPermanent(), true);
if (!target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
return false;
}

View file

@ -41,7 +41,7 @@ import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.common.FilterLandPermanent;
import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.target.TargetSpell;
@ -67,7 +67,7 @@ public class UyoSilentProphet extends CardImpl {
this.supertype.add("Legendary");
this.subtype.add("Moonfolk");
this.subtype.add("Wizard");
this.color.setBlue(true);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
@ -75,7 +75,7 @@ public class UyoSilentProphet extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// {2}, Return two lands you control to their owner's hand: Copy target instant or sorcery spell. You may choose new targets for the copy.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CopyTargetSpellEffect(), new GenericManaCost(2));
ability.addCost(new ReturnToHandTargetCost(new TargetControlledPermanent(2, 2, new FilterLandPermanent("lands"), false)));
ability.addCost(new ReturnToHandTargetCost(new TargetControlledPermanent(2, 2, new FilterControlledLandPermanent("lands"), false)));
ability.addTarget(new TargetSpell(filter));
this.addAbility(ability);
}

View file

@ -68,7 +68,7 @@ public class PhantomNantuko extends CardImpl {
// Trample
this.addAbility(TrampleAbility.getInstance());
// Phantom Nantuko enters the battlefield with two +1/+1 counters on it.
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(2), true)));
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(2), true), "with two +1/+1 counters on it"));
// If damage would be dealt to Phantom Nantuko, prevent that damage. Remove a +1/+1 counter from Phantom Nantuko.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PhantomNantukoPreventionEffect()));
// {tap}: Put a +1/+1 counter on Phantom Nantuko.

View file

@ -43,14 +43,12 @@ import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.effects.common.continious.GainControlTargetEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.SplitCard;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterArtifactPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterEnchantmentPermanent;
import mage.filter.common.FilterLandPermanent;
import mage.filter.common.FilterPlaneswalkerPermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.filter.common.FilterControlledArtifactPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterControlledEnchantmentPermanent;
import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.common.FilterControlledPlaneswalkerPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -70,13 +68,8 @@ public class CatchRelease extends SplitCard {
super(ownerId, 125, "Catch", "Release", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{1}{U}{R}", "{4}{R}{W}",true);
this.expansionSetCode = "DGM";
this.color.setBlue(true);
this.color.setRed(true);
this.color.setWhite(true);
// Catch
// Gain control of target permanent until end of turn. Untap it. It gains haste until end of turn.
getLeftHalfCard().getColor().setRed(true);
getLeftHalfCard().getSpellAbility().addTarget(new TargetPermanent(new FilterPermanent()));
getLeftHalfCard().getSpellAbility().addEffect(new GainControlTargetEffect(Duration.EndOfTurn));
getLeftHalfCard().getSpellAbility().addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn));
@ -84,7 +77,6 @@ public class CatchRelease extends SplitCard {
// Release
// Each player sacrifices an artifact, a creature, an enchantment, a land, and a planeswalker.
getRightHalfCard().getColor().setGreen(true);
getRightHalfCard().getSpellAbility().addEffect(new ReleaseSacrificeEffect());
}
@ -101,20 +93,6 @@ public class CatchRelease extends SplitCard {
class ReleaseSacrificeEffect extends OneShotEffect {
private static final FilterArtifactPermanent filter1 = new FilterArtifactPermanent("artifact you control");
private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("creature you control");
private static final FilterEnchantmentPermanent filter3 = new FilterEnchantmentPermanent("enchantment you control");
private static final FilterLandPermanent filter4 = new FilterLandPermanent("land you control");
private static final FilterPlaneswalkerPermanent filter5 = new FilterPlaneswalkerPermanent("planeswalker you control");
static {
filter1.add(new ControllerPredicate(TargetController.YOU));
filter2.add(new ControllerPredicate(TargetController.YOU));
filter3.add(new ControllerPredicate(TargetController.YOU));
filter4.add(new ControllerPredicate(TargetController.YOU));
filter5.add(new ControllerPredicate(TargetController.YOU));
}
public ReleaseSacrificeEffect() {
super(Outcome.DestroyPermanent);
staticText = "Each player sacrifices an artifact, a creature, an enchantment, a land, and a planeswalker";
@ -126,7 +104,7 @@ class ReleaseSacrificeEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
List<UUID> chosen = new ArrayList<UUID>();
List<UUID> chosen = new ArrayList<>();
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
@ -134,18 +112,11 @@ class ReleaseSacrificeEffect extends OneShotEffect {
for (UUID playerId : controller.getInRange()) {
Player player = game.getPlayer(playerId);
Target target1 = new TargetControlledPermanent(1, 1, filter1, false);
Target target2 = new TargetControlledPermanent(1, 1, filter2, false);
Target target3 = new TargetControlledPermanent(1, 1, filter3, false);
Target target4 = new TargetControlledPermanent(1, 1, filter4, false);
Target target5 = new TargetControlledPermanent(1, 1, filter5, false);
target1.setNotTarget(false);
target2.setNotTarget(false);
target3.setNotTarget(false);
target4.setNotTarget(false);
target5.setNotTarget(false);
Target target1 = new TargetControlledPermanent(1, 1, new FilterControlledArtifactPermanent(), true);
Target target2 = new TargetControlledPermanent(1, 1, new FilterControlledCreaturePermanent(), true);
Target target3 = new TargetControlledPermanent(1, 1, new FilterControlledEnchantmentPermanent(), true);
Target target4 = new TargetControlledPermanent(1, 1, new FilterControlledLandPermanent(), true);
Target target5 = new TargetControlledPermanent(1, 1, new FilterControlledPlaneswalkerPermanent(), true);
if (target1.canChoose(player.getId(), game)) {
while (player.isInGame() && !target1.isChosen() && target1.canChoose(player.getId(), game)) {

View file

@ -37,12 +37,10 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.filter.common.FilterArtifactPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterEnchantmentPermanent;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.filter.common.FilterControlledArtifactPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterControlledEnchantmentPermanent;
import mage.filter.common.FilterControlledLandPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -59,8 +57,6 @@ public class Cataclysm extends CardImpl {
super(ownerId, 3, "Cataclysm", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{2}{W}{W}");
this.expansionSetCode = "EXO";
this.color.setWhite(true);
// Each player chooses from the permanents he or she controls an artifact, a creature, an enchantment, and a land, then sacrifices the rest.
this.getSpellAbility().addEffect(new CataclysmEffect());
}
@ -77,18 +73,6 @@ public class Cataclysm extends CardImpl {
class CataclysmEffect extends OneShotEffect {
private static final FilterArtifactPermanent filter1 = new FilterArtifactPermanent("artifact you control");
private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("creature you control");
private static final FilterEnchantmentPermanent filter3 = new FilterEnchantmentPermanent("enchantment you control");
private static final FilterLandPermanent filter4 = new FilterLandPermanent("land you control");
static {
filter1.add(new ControllerPredicate(TargetController.YOU));
filter2.add(new ControllerPredicate(TargetController.YOU));
filter3.add(new ControllerPredicate(TargetController.YOU));
filter4.add(new ControllerPredicate(TargetController.YOU));
}
public CataclysmEffect() {
super(Outcome.DestroyPermanent);
staticText = "Each player chooses from among the permanents he or she controls an artifact, a creature, an enchantment, and a land, then sacrifices the rest";
@ -105,20 +89,14 @@ class CataclysmEffect extends OneShotEffect {
for (UUID playerId : game.getPlayerList()) {
Player player = game.getPlayer(playerId);
Target target1 = new TargetControlledPermanent(1, 1, filter1, false);
Target target2 = new TargetControlledPermanent(1, 1, filter2, false);
Target target3 = new TargetControlledPermanent(1, 1, filter3, false);
Target target4 = new TargetControlledPermanent(1, 1, filter4, false);
target1.setNotTarget(true);
target2.setNotTarget(true);
target3.setNotTarget(true);
target4.setNotTarget(true);
Target target1 = new TargetControlledPermanent(1, 1, new FilterControlledArtifactPermanent(), true);
Target target2 = new TargetControlledPermanent(1, 1, new FilterControlledCreaturePermanent(), true);
Target target3 = new TargetControlledPermanent(1, 1, new FilterControlledEnchantmentPermanent(), true);
Target target4 = new TargetControlledPermanent(1, 1, new FilterControlledLandPermanent(), true);
if (target1.canChoose(player.getId(), game)) {
while (player.isInGame() && !target1.isChosen() && target1.canChoose(player.getId(), game)) {
player.choose(Outcome.Benefit, target1, source.getSourceId(), game);
player.chooseTarget(Outcome.Benefit, target1, source, game);
}
Permanent artifact = game.getPermanent(target1.getFirstTarget());
if (artifact != null) {
@ -129,7 +107,7 @@ class CataclysmEffect extends OneShotEffect {
if (target2.canChoose(player.getId(), game)) {
while (player.isInGame() && !target2.isChosen() && target2.canChoose(player.getId(), game)) {
player.choose(Outcome.Benefit, target2, source.getSourceId(), game);
player.chooseTarget(Outcome.Benefit, target2, source, game);
}
Permanent creature = game.getPermanent(target2.getFirstTarget());
if (creature != null) {
@ -140,7 +118,7 @@ class CataclysmEffect extends OneShotEffect {
if (target3.canChoose(player.getId(), game)) {
while (player.isInGame() && !target3.isChosen() && target3.canChoose(player.getId(), game)) {
player.choose(Outcome.Benefit, target3, source.getSourceId(), game);
player.chooseTarget(Outcome.Benefit, target3, source, game);
}
Permanent enchantment = game.getPermanent(target3.getFirstTarget());
if (enchantment != null) {
@ -151,7 +129,7 @@ class CataclysmEffect extends OneShotEffect {
if (target4.canChoose(player.getId(), game)) {
while (player.isInGame() && !target4.isChosen() && target4.canChoose(player.getId(), game)) {
player.choose(Outcome.Benefit, target4, source.getSourceId(), game);
player.chooseTarget(Outcome.Benefit, target4, source, game);
}
Permanent land = game.getPermanent(target4.getFirstTarget());
if (land != null) {

View file

@ -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.fifthdawn;
import java.util.UUID;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
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.FilterControlledArtifactPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetAttackingCreature;
/**
*
* @author Plopman
*/
public class ArmedResponse extends CardImpl {
private static final FilterControlledArtifactPermanent filter = new FilterControlledArtifactPermanent("Equipment you control");
static {
filter.add(new SubtypePredicate("Equipment"));
}
public ArmedResponse(UUID ownerId) {
super(ownerId, 2, "Armed Response", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{W}");
this.expansionSetCode = "5DN";
// Armed Response deals damage to target attacking creature equal to the number of Equipment you control.
Effect effect = new DamageTargetEffect(new PermanentsOnBattlefieldCount(filter));
effect.setText("{source} deals damage to target attacking creature equal to the number of Equipment you control");
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addTarget(new TargetAttackingCreature());
}
public ArmedResponse(final ArmedResponse card) {
super(card);
}
@Override
public ArmedResponse copy() {
return new ArmedResponse(this);
}
}

View file

@ -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.fifthdawn;
import java.util.UUID;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.PreventNextDamageFromChosenSourceToYouEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterObject;
import mage.filter.predicate.mageobject.CardTypePredicate;
/**
*
* @author Plopman
*/
public class CircleOfProtectionArtifacts extends CardImpl {
private static final FilterObject filter = new FilterObject("artifact source");
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
}
public CircleOfProtectionArtifacts(UUID ownerId) {
super(ownerId, 8, "Circle of Protection: Artifacts", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
this.expansionSetCode = "5DN";
// {2}: The next time an artifact source of your choice would deal damage to you this turn, prevent that damage.
Effect effect = new PreventNextDamageFromChosenSourceToYouEffect(Duration.EndOfTurn, filter);
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("2")));
}
public CircleOfProtectionArtifacts(final CircleOfProtectionArtifacts card) {
super(card);
}
@Override
public CircleOfProtectionArtifacts copy() {
return new CircleOfProtectionArtifacts(this);
}
}

View file

@ -37,8 +37,7 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterLandPermanent;
import mage.filter.common.FilterControlledLandPermanent;
import mage.target.common.TargetControlledPermanent;
/**
@ -59,7 +58,7 @@ public class CosmicLarva extends CardImpl {
// Trample
this.addAbility(TrampleAbility.getInstance());
// At the beginning of your upkeep, sacrifice Cosmic Larva unless you sacrifice two lands.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new SacrificeTargetCost(new TargetControlledPermanent(2, 2, new FilterLandPermanent("two lands"), true))), TargetController.YOU, false));
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new SacrificeTargetCost(new TargetControlledPermanent(2, 2, new FilterControlledLandPermanent("two lands"), true))), TargetController.YOU, false));
}
public CosmicLarva(final CosmicLarva card) {

View file

@ -0,0 +1,89 @@
/*
* 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.fifthdawn;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.BecomesCreatureSourceEffect;
import mage.abilities.effects.common.continious.BoostEquippedEffect;
import mage.abilities.keyword.EquipAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.permanent.token.Token;
/**
*
* @author Plopman
*/
public class EnsouledScimitar extends CardImpl {
public EnsouledScimitar(UUID ownerId) {
super(ownerId, 119, "Ensouled Scimitar", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{3}");
this.expansionSetCode = "5DN";
this.subtype.add("Equipment");
// {3}: Ensouled Scimitar becomes a 1/5 Spirit artifact creature with flying until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new EnsouledScimitarToken(), "", Duration.EndOfTurn), new ManaCostsImpl("{3}")));
// Equipped creature gets +1/+5.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(1, 5)));
// Equip {2}
this.addAbility(new EquipAbility(Outcome.BoostCreature, new ManaCostsImpl("{2}")));
}
public EnsouledScimitar(final EnsouledScimitar card) {
super(card);
}
@Override
public EnsouledScimitar copy() {
return new EnsouledScimitar(this);
}
}
class EnsouledScimitarToken extends Token {
public EnsouledScimitarToken() {
super("Pincher", "1/5 Spirit artifact creature with flying");
setOriginalExpansionSetCode("5ND");
cardType.add(CardType.CREATURE);
subtype.add("Spirit");
power = new MageInt(1);
toughness = new MageInt(5);
this.addAbility(FlyingAbility.getInstance());
}
}

View file

@ -38,7 +38,7 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterArtifactPermanent;
import mage.filter.common.FilterControlledArtifactPermanent;
import mage.target.common.TargetArtifactPermanent;
import mage.target.common.TargetControlledPermanent;
@ -54,13 +54,12 @@ public class KrarkClanEngineers extends CardImpl {
this.subtype.add("Goblin");
this.subtype.add("Artificer");
this.color.setRed(true);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// {R}, Sacrifice two artifacts: Destroy target artifact.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{R}"));
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(2, 2, new FilterArtifactPermanent("two artifacts"), true)));
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(2, 2, new FilterControlledArtifactPermanent("two artifacts"), true)));
ability.addTarget(new TargetArtifactPermanent());
this.addAbility(ability);

View file

@ -39,7 +39,7 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterArtifactPermanent;
import mage.filter.common.FilterControlledArtifactPermanent;
import mage.target.common.TargetControlledPermanent;
import mage.target.common.TargetCreaturePermanent;
@ -60,7 +60,7 @@ public class KrarkClanOgre extends CardImpl {
// {R}, Sacrifice an artifact: Target creature can't block this turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CantBlockTargetEffect(Duration.EndOfTurn), new ManaCostsImpl("{R}"));
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(1, 1, new FilterArtifactPermanent("an artifact"), true)));
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(1, 1, new FilterControlledArtifactPermanent("an artifact"), true)));
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}

View file

@ -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.fifthdawn;
import java.util.UUID;
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.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.DamagedPlayerThisTurnPredicate;
/**
*
* @author Plopman
*/
public class Retaliate extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures that dealt damage to you this turn");
static {
filter.add(new DamagedPlayerThisTurnPredicate(TargetController.YOU));
}
public Retaliate(UUID ownerId) {
super(ownerId, 13, "Retaliate", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{2}{W}{W}");
this.expansionSetCode = "5DN";
// Destroy all creatures that dealt damage to you this turn.
this.getSpellAbility().addEffect(new DestroyAllEffect(filter));
}
public Retaliate(final Retaliate card) {
super(card);
}
@Override
public Retaliate copy() {
return new Retaliate(this);
}
}

View file

@ -0,0 +1,79 @@
/*
* 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.fifthdawn;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.combat.CantBlockAttackActivateAttachedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.target.TargetPermanent;
import mage.target.common.TargetArtifactPermanent;
/**
*
* @author Plopman
*/
public class StasisCocoon extends CardImpl {
public StasisCocoon(UUID ownerId) {
super(ownerId, 18, "Stasis Cocoon", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
this.expansionSetCode = "5DN";
this.subtype.add("Aura");
// Enchant artifact
TargetPermanent auraTarget = new TargetArtifactPermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Enchanted artifact can't attack or block, and its activated abilities can't be activated.
Effect effect = new CantBlockAttackActivateAttachedEffect();
effect.setText("Enchanted artifact can't attack or block, and its activated abilities can't be activated");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}
public StasisCocoon(final StasisCocoon card) {
super(card);
}
@Override
public StasisCocoon copy() {
return new StasisCocoon(this);
}
}

View file

@ -0,0 +1,160 @@
/*
* 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.fifthdawn;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
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.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetCard;
import mage.util.CardUtil;
/**
*
* @author Plopman
*/
public class SummonersEgg extends CardImpl {
public SummonersEgg(UUID ownerId) {
super(ownerId, 157, "Summoner's Egg", Rarity.RARE, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{4}");
this.expansionSetCode = "5DN";
this.subtype.add("Construct");
this.power = new MageInt(0);
this.toughness = new MageInt(4);
// Imprint - When Summoner's Egg enters the battlefield, you may exile a card from your hand face down.
this.addAbility(new EntersBattlefieldTriggeredAbility(new SummonersEggImprintEffect(), true, "<i>Imprint - </i>"));
// When Summoner's Egg dies, turn the exiled card face up. If it's a creature card, put it onto the battlefield under your control.
this.addAbility(new DiesTriggeredAbility(new SummonersEggPutOntoBattlefieldEffect()));
}
public SummonersEgg(final SummonersEgg card) {
super(card);
}
@Override
public SummonersEgg copy() {
return new SummonersEgg(this);
}
}
class SummonersEggImprintEffect extends OneShotEffect {
public SummonersEggImprintEffect() {
super(Outcome.Benefit);
staticText = "exile a card from your hand face down";
}
public SummonersEggImprintEffect(SummonersEggImprintEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null) {
if (controller.getHand().size() > 0) {
TargetCard target = new TargetCard(Zone.HAND, new FilterCard());
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)
&& controller.choose(Outcome.Benefit, controller.getHand(), target, game)) {
Card card = controller.getHand().get(target.getFirstTarget(), game);
if (card != null) {
card.setFaceDown(true);
controller.moveCardToExileWithInfo(card, source.getSourceId(), sourcePermanent.getLogName() +" (Imprint)", source.getSourceId(), game, Zone.HAND);
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
permanent.imprint(card.getId(), game);
permanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card]"));
}
}
}
}
return true;
}
return false;
}
@Override
public SummonersEggImprintEffect copy() {
return new SummonersEggImprintEffect(this);
}
}
class SummonersEggPutOntoBattlefieldEffect extends OneShotEffect {
public SummonersEggPutOntoBattlefieldEffect() {
super(Outcome.PutCreatureInPlay);
this.staticText = "turn the exiled card face up. If it's a creature card, put it onto the battlefield under your control";
}
public SummonersEggPutOntoBattlefieldEffect(final SummonersEggPutOntoBattlefieldEffect effect) {
super(effect);
}
@Override
public SummonersEggPutOntoBattlefieldEffect copy() {
return new SummonersEggPutOntoBattlefieldEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Permanent SummonersEgg = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (SummonersEgg != null && SummonersEgg.getImprinted() != null && !SummonersEgg.getImprinted().isEmpty()) {
Card imprintedCard = game.getCard(SummonersEgg.getImprinted().get(0));
if (imprintedCard != null && game.getState().getZone(imprintedCard.getId()).equals(Zone.EXILED)) {
//turn the exiled card face up.
imprintedCard.turnFaceUp(game, source.getControllerId());
//If it's a creature card,
if(imprintedCard.getCardType().contains(CardType.CREATURE)){
//put it onto the battlefield under your control
imprintedCard.putOntoBattlefield(game, Zone.EXILED, source.getSourceId(), source.getControllerId());
}
}
}
return true;
}
return false;
}
}

View file

@ -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.sets.fifthdawn;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.PutIntoGraveFromBattlefieldAllTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.UntapSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterArtifactPermanent;
import mage.game.permanent.token.Token;
/**
*
* @author Plopman
*/
public class SummoningStation extends CardImpl {
public SummoningStation(UUID ownerId) {
super(ownerId, 158, "Summoning Station", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{7}");
this.expansionSetCode = "5DN";
// {tap}: Put a 2/2 colorless Pincher creature token onto the battlefield.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD,new CreateTokenEffect(new PincherToken()), new TapSourceCost()));
// Whenever an artifact is put into a graveyard from the battlefield, you may untap Summoning Station.
this.addAbility(new PutIntoGraveFromBattlefieldAllTriggeredAbility(new UntapSourceEffect(),true, new FilterArtifactPermanent(), false));
}
public SummoningStation(final SummoningStation card) {
super(card);
}
@Override
public SummoningStation copy() {
return new SummoningStation(this);
}
}
class PincherToken extends Token {
public PincherToken() {
super("Pincher", "2/2 colorless Pincher creature token");
setOriginalExpansionSetCode("5ND");
cardType.add(CardType.CREATURE);
subtype.add("Pincher");
power = new MageInt(2);
toughness = new MageInt(2);
}
}

View file

@ -0,0 +1,53 @@
/*
* 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.fifhedition;
import java.util.UUID;
/**
*
* @author Plopman
*/
public class CircleOfProtectionArtifacts extends mage.sets.fifthdawn.CircleOfProtectionArtifacts {
public CircleOfProtectionArtifacts(UUID ownerId) {
super(ownerId);
this.cardNumber = 292;
this.expansionSetCode = "5ED";
}
public CircleOfProtectionArtifacts(final CircleOfProtectionArtifacts card) {
super(card);
}
@Override
public CircleOfProtectionArtifacts copy() {
return new CircleOfProtectionArtifacts(this);
}
}

View file

@ -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.fifthedition;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public class ForceOfNature extends mage.sets.fourthedition.ForceOfNature {
public ForceOfNature(UUID ownerId) {
super(ownerId);
this.cardNumber = 156;
this.expansionSetCode = "5ED";
}
public ForceOfNature(final ForceOfNature card) {
super(card);
}
@Override
public ForceOfNature copy() {
return new ForceOfNature(this);
}
}

View file

@ -0,0 +1,53 @@
/*
* 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.fourthedition;
import java.util.UUID;
/**
*
* @author Plopman
*/
public class CircleOfProtectionArtifacts extends mage.sets.fifthdawn.CircleOfProtectionArtifacts {
public CircleOfProtectionArtifacts(UUID ownerId) {
super(ownerId);
this.cardNumber = 263;
this.expansionSetCode = "4ED";
}
public CircleOfProtectionArtifacts(final CircleOfProtectionArtifacts card) {
super(card);
}
@Override
public CircleOfProtectionArtifacts copy() {
return new CircleOfProtectionArtifacts(this);
}
}

View file

@ -0,0 +1,108 @@
/*
* 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.fourthedition;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author jeffwadsworth
*/
public class ForceOfNature extends CardImpl {
public ForceOfNature(UUID ownerId) {
super(ownerId, 129, "Force of Nature", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{G}{G}{G}{G}");
this.expansionSetCode = "4ED";
this.subtype.add("Elemental");
this.power = new MageInt(8);
this.toughness = new MageInt(8);
// Trample
this.addAbility(TrampleAbility.getInstance());
// At the beginning of your upkeep, Force of Nature deals 8 damage to you unless you pay {G}{G}{G}{G}.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new ForceOfNatureEffect(), TargetController.YOU, false));
}
public ForceOfNature(final ForceOfNature card) {
super(card);
}
@Override
public ForceOfNature copy() {
return new ForceOfNature(this);
}
}
class ForceOfNatureEffect extends OneShotEffect {
public ForceOfNatureEffect() {
super(Outcome.Damage);
this.staticText = "{this} deals 8 damage to you unless you pay {G}{G}{G}{G}";
}
public ForceOfNatureEffect(final ForceOfNatureEffect effect) {
super(effect);
}
@Override
public ForceOfNatureEffect copy() {
return new ForceOfNatureEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Cost cost = new ManaCostsImpl("{G}{G}{G}{G}");
String message = "Would you like to pay {G}{G}{G}{G} to prevent taking 8 damage from {this}?";
if (!(controller.chooseUse(Outcome.Benefit, message, game)
&& cost.pay(source, game, source.getSourceId(), controller.getId(), false))) {
controller.damage(8, source.getSourceId(), game, false, true);
}
return true;
}
return false;
}
}

View file

@ -35,10 +35,7 @@ import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.constants.TargetController;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -52,17 +49,10 @@ import mage.target.common.TargetControlledPermanent;
*/
public class DevourFlesh extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature an opponent controls");
static{
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public DevourFlesh (UUID ownerId) {
super(ownerId, 63, "Devour Flesh", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{B}");
this.expansionSetCode = "GTC";
this.color.setBlack(true);
// Target player sacrifices a creature, then gains life equal to that creature's toughness.
this.getSpellAbility().addEffect(new DevourFleshSacrificeEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
@ -100,13 +90,12 @@ class DevourFleshSacrificeEffect extends OneShotEffect {
if (player == null) {
return false;
}
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(new ControllerIdPredicate(player.getId()));
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
int realCount = game.getBattlefield().countAll(filter, player.getId(), game);
if (realCount > 0) {
Target target = new TargetControlledPermanent(1, 1, filter, true);
while (player.isInGame() && !target.isChosen() && target.canChoose(player.getId(), game)) {
player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
player.chooseTarget(Outcome.Sacrifice, target, source, game);
}
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) {

View file

@ -139,7 +139,7 @@ class HellkiteTyrantControlEffect extends ContinuousEffectImpl {
private final UUID controllerId;
public HellkiteTyrantControlEffect(UUID controllerId) {
super(Duration.EndOfCombat, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
super(Duration.EndOfGame, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
this.controllerId = controllerId;
}

View file

@ -28,18 +28,24 @@
package mage.sets.guildpact;
import java.util.UUID;
import mage.constants.*;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ReturnFromExileEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.util.CardUtil;
/**
*
@ -51,8 +57,6 @@ public class Ghostway extends CardImpl {
super(ownerId, 6, "Ghostway", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{2}{W}");
this.expansionSetCode = "GPT";
this.color.setWhite(true);
// Exile each creature you control. Return those cards to the battlefield under their owner's control at the beginning of the next end step.
this.getSpellAbility().addEffect(new GhostwayEffect());
}
@ -87,19 +91,25 @@ class GhostwayEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
UUID exileId = source.getSourceId();
if (exileId != null) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (sourceObject != null && controller != null) {
int numberCreatures = 0;
UUID exileId = CardUtil.getObjectExileZoneId(game, sourceObject);
for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
if (creature != null) {
if (creature.moveToExile(source.getSourceId(), "Ghostway Exile", source.getSourceId(), game)) {
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD, true));
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game));
game.addDelayedTriggeredAbility(delayedAbility);
}
controller.moveCardToExileWithInfo(creature, exileId,sourceObject.getLogName(), source.getSourceId(), game, Zone.BATTLEFIELD);
numberCreatures++;
}
}
if (numberCreatures > 0) {
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
new ReturnFromExileEffect(exileId, Zone.BATTLEFIELD, false));
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game));
game.addDelayedTriggeredAbility(delayedAbility);
}
return true;
}
return false;
@ -109,4 +119,4 @@ class GhostwayEffect extends OneShotEffect {
public GhostwayEffect copy() {
return new GhostwayEffect(this);
}
}
}

View file

@ -27,29 +27,23 @@
*/
package mage.sets.iceage;
import mage.abilities.Ability;
import java.util.UUID;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.PayLifeCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.PreventAllDamageToControllerEffect;
import mage.abilities.effects.common.SacrificeControllerEffect;
import mage.abilities.effects.common.combat.CantAttackAllAnyPlayerEffect;
import mage.abilities.keyword.CumulativeUpkeepAbility;
import mage.cards.CardImpl;
import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterLandPermanent;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetControlledPermanent;
import java.util.UUID;
/**
*
@ -64,9 +58,11 @@ public class GlacialChasm extends CardImpl {
// Cumulative upkeep-Pay 2 life.
this.addAbility(new CumulativeUpkeepAbility(new PayLifeCost(2)));
// When Glacial Chasm enters the battlefield, sacrifice a land.
this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeControllerEffect(new FilterLandPermanent(), 1, "")));
this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeControllerEffect(new FilterControlledLandPermanent(), 1, "")));
// Creatures you control can't attack.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackEffect()));
FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures you control");
filter.add(new ControllerPredicate(TargetController.YOU));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackAllAnyPlayerEffect(Duration.WhileOnBattlefield, filter)));
// Prevent all damage that would be dealt to you.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PreventAllDamageToControllerEffect(Duration.WhileOnBattlefield)));
}
@ -80,108 +76,3 @@ public class GlacialChasm extends CardImpl {
return new GlacialChasm(this);
}
}
class SacrificeControllerEffect extends OneShotEffect{
private FilterPermanent filter;
private DynamicValue count;
public SacrificeControllerEffect ( FilterPermanent filter, DynamicValue count, String preText ) {
super(Outcome.Sacrifice);
this.filter = filter;
this.count = count;
staticText = "sacrifice a land";
}
public SacrificeControllerEffect ( FilterPermanent filter, int count, String preText ) {
this(filter, new StaticValue(count), preText);
}
public SacrificeControllerEffect ( SacrificeControllerEffect effect ) {
super(effect);
this.filter = effect.filter;
this.count = effect.count;
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
filter.add(new ControllerPredicate(TargetController.YOU));
int amount = count.calculate(game, source, this);
int realCount = game.getBattlefield().countAll(filter, player.getId(), game);
amount = Math.min(amount, realCount);
Target target = new TargetControlledPermanent(amount, amount, filter, false);
//A spell or ability could have removed the only legal target this player
//had, if thats the case this ability should fizzle.
if (amount > 0 && target.canChoose(source.getSourceId(), player.getId(), game)) {
boolean abilityApplied = false;
while (player.isInGame() && !target.isChosen() && target.canChoose(player.getId(), game)) {
player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
}
for ( int idx = 0; idx < target.getTargets().size(); idx++) {
Permanent permanent = game.getPermanent((UUID)target.getTargets().get(idx));
if ( permanent != null ) {
abilityApplied |= permanent.sacrifice(source.getSourceId(), game);
}
}
return abilityApplied;
}
return false;
}
public void setAmount(DynamicValue amount) {
this.count = amount;
}
@Override
public SacrificeControllerEffect copy() {
return new SacrificeControllerEffect(this);
}
}
class CantAttackEffect extends ReplacementEffectImpl {
public CantAttackEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
staticText = "Creatures you control can't attack";
}
public CantAttackEffect(final CantAttackEffect effect) {
super(effect);
}
@Override
public CantAttackEffect copy() {
return new CantAttackEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
return true;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.DECLARE_ATTACKER && source.getControllerId().equals(event.getPlayerId())) {
return true;
}
return false;
}
}

View file

@ -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.iceage;
import java.util.UUID;
import mage.Mana;
import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount;
import mage.abilities.effects.common.DynamicManaEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.common.FilterCreatureCard;
/**
*
* @author fireshoes
*/
public class SongsOfTheDamned extends CardImpl {
public SongsOfTheDamned(UUID ownerId) {
super(ownerId, 48, "Songs of the Damned", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{B}");
this.expansionSetCode = "ICE";
// Add {B} to your mana pool for each creature card in your graveyard.
DynamicManaEffect effect = new DynamicManaEffect(Mana.BlackMana, new CardsInControllerGraveyardCount(new FilterCreatureCard()));
this.getSpellAbility().addEffect(effect);
}
public SongsOfTheDamned(final SongsOfTheDamned card) {
super(card);
}
@Override
public SongsOfTheDamned copy() {
return new SongsOfTheDamned(this);
}
}

View file

@ -49,6 +49,7 @@ import mage.target.common.TargetControlledPermanent;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.filter.common.FilterControlledCreaturePermanent;
/**
* @author nantuko
@ -59,8 +60,6 @@ public class DivineReckoning extends CardImpl {
super(ownerId, 10, "Divine Reckoning", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{2}{W}{W}");
this.expansionSetCode = "ISD";
this.color.setWhite(true);
// Each player chooses a creature he or she controls. Destroy the rest.
this.getSpellAbility().addEffect(new DivineReckoningEffect());
@ -79,13 +78,7 @@ public class DivineReckoning extends CardImpl {
}
class DivineReckoningEffect extends OneShotEffect {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature you control");
static {
filter.add(new ControllerPredicate(TargetController.YOU));
}
public DivineReckoningEffect() {
super(Outcome.DestroyPermanent);
staticText = "Each player chooses a creature he or she controls. Destroy the rest";
@ -97,16 +90,16 @@ class DivineReckoningEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
List<Card> chosen = new ArrayList<Card>();
List<Card> chosen = new ArrayList<>();
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
for (UUID playerId : controller.getInRange()) {
Player player = game.getPlayer(playerId);
Target target = new TargetControlledPermanent(1, 1, filter, false);
Target target = new TargetControlledPermanent(1, 1, new FilterControlledCreaturePermanent(), false);
if (target.canChoose(player.getId(), game)) {
while (player.isInGame() && !target.isChosen() && target.canChoose(player.getId(), game)) {
player.choose(Outcome.Benefit, target, source.getSourceId(), game);
player.chooseTarget(Outcome.Benefit, target, source, game);
}
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) {

View file

@ -42,11 +42,8 @@ import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreatureCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.WolfTokenWithDeathtouch;
@ -56,6 +53,7 @@ import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetControlledPermanent;
import java.util.UUID;
import mage.filter.common.FilterControlledCreaturePermanent;
/**
* @author nantuko
@ -132,12 +130,7 @@ class GarrukTheVeilCursedValue implements DynamicValue {
class GarrukTheVeilCursedEffect extends OneShotEffect {
private static final FilterPermanent filterCreature = new FilterPermanent("a creature you control");
static {
filterCreature.add(new CardTypePredicate(CardType.CREATURE));
filterCreature.add(new ControllerPredicate(TargetController.YOU));
}
private static final FilterControlledCreaturePermanent filterCreature = new FilterControlledCreaturePermanent("a creature you control");
public GarrukTheVeilCursedEffect() {
super(Outcome.Benefit);
@ -150,22 +143,22 @@ class GarrukTheVeilCursedEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Player controller = game.getPlayer(source.getControllerId());
if (player == null) {
if (controller == null) {
return false;
}
// sacrifice a creature
Target target = new TargetControlledPermanent(1, 1, filterCreature, false);
boolean sacrificed = false;
if (target.canChoose(player.getId(), game)) {
while (player.isInGame() && !target.isChosen() && target.canChoose(player.getId(), game)) {
player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
if (target.canChoose(controller.getId(), game)) {
while (controller.isInGame() && !target.isChosen() && target.canChoose(controller.getId(), game)) {
controller.chooseTarget(Outcome.Sacrifice, target, source, game);
}
for (int idx = 0; idx < target.getTargets().size(); idx++) {
Permanent permanent = game.getPermanent((UUID) target.getTargets().get(idx));
Permanent permanent = game.getPermanent(target.getTargets().get(idx));
if (permanent != null) {
sacrificed |= permanent.sacrifice(source.getSourceId(), game);
}
@ -177,9 +170,9 @@ class GarrukTheVeilCursedEffect extends OneShotEffect {
FilterCreatureCard filter = new FilterCreatureCard();
TargetCardInLibrary targetInLibrary = new TargetCardInLibrary(filter);
Cards cards = new CardsImpl();
if (player.searchLibrary(targetInLibrary, game)) {
if (controller.searchLibrary(targetInLibrary, game)) {
for (UUID cardId : targetInLibrary.getTargets()) {
Card card = player.getLibrary().remove(cardId, game);
Card card = controller.getLibrary().remove(cardId, game);
if (card != null) {
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
cards.add(card);
@ -188,10 +181,10 @@ class GarrukTheVeilCursedEffect extends OneShotEffect {
}
// reveal
if (cards.size() > 0) {
player.revealCards("Garruk, the Veil-Cursed", cards, game);
controller.revealCards("Garruk, the Veil-Cursed", cards, game);
}
// shuffle
player.shuffleLibrary(game);
controller.shuffleLibrary(game);
return true;
}
return false;

View file

@ -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.invasion;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continious.PlayWithTheTopCardRevealedEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
/**
*
* @author michael.napoleon@gmail.com
*/
public class GoblinSpy extends CardImpl {
public GoblinSpy(UUID ownerId) {
super(ownerId, 145, "Goblin Spy", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{R}");
this.expansionSetCode = "INV";
this.subtype.add("Goblin");
this.subtype.add("Rogue");
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Play with the top card of your library revealed.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlayWithTheTopCardRevealedEffect()));
}
public GoblinSpy(final GoblinSpy card) {
super(card);
}
@Override
public GoblinSpy copy() {
return new GoblinSpy(this);
}
}

View file

@ -0,0 +1,78 @@
/*
* 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.invasion;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.ReturnToHandSourceEffect;
import mage.abilities.effects.common.continious.BoostEnchantedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.constants.*;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author michael.napoleon@gmail.com
*/
public class Mourning extends CardImpl {
public Mourning(UUID ownerId) {
super(ownerId, 111, "Mourning", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}");
this.expansionSetCode = "INV";
this.subtype.add("Aura");
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Enchanted creature gets -2/-0.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(-2, 0)));
// {B}: Return Mourning to its owner's hand.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandSourceEffect(true), new ManaCostsImpl("{B}")));
}
public Mourning(final Mourning card) {
super(card);
}
@Override
public Mourning copy() {
return new Mourning(this);
}
}

View file

@ -36,7 +36,7 @@ import mage.abilities.keyword.MorphAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetControlledPermanent;
@ -46,7 +46,7 @@ import mage.target.common.TargetControlledPermanent;
*/
public class FathomSeer extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("Islands");
private static final FilterControlledPermanent filter = new FilterControlledPermanent("Islands");
static {
filter.add(new SubtypePredicate("Island"));

View file

@ -26,7 +26,7 @@ import mage.filter.predicate.mageobject.SupertypePredicate;
*/
public class ArenaOfTheAncients extends CardImpl {
final static FilterCreaturePermanent legendaryFilter = new FilterCreaturePermanent("all legendary creatures");
final static FilterCreaturePermanent legendaryFilter = new FilterCreaturePermanent("legendary creatures");
static {
legendaryFilter.add(new SupertypePredicate("Legendary"));
}

View file

@ -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 jeffwadsworth
*/
public class ForceOfNature extends mage.sets.fourthedition.ForceOfNature {
public ForceOfNature(UUID ownerId) {
super(ownerId);
this.cardNumber = 103;
this.expansionSetCode = "LEA";
}
public ForceOfNature(final ForceOfNature card) {
super(card);
}
@Override
public ForceOfNature copy() {
return new ForceOfNature(this);
}
}

View file

@ -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 jeffwadsworth
*/
public class Fork extends mage.sets.limitedbeta.Fork {
public Fork(UUID ownerId) {
super(ownerId);
this.cardNumber = 153;
this.expansionSetCode = "LEA";
}
public Fork(final Fork card) {
super(card);
}
@Override
public Fork copy() {
return new Fork(this);
}
}

View file

@ -62,14 +62,14 @@ public class ManaVault extends CardImpl {
// At the beginning of your upkeep, you may pay {4}. If you do, untap Mana Vault.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
Zone.BATTLEFIELD,
new DoIfCostPaid(new UntapSourceEffect(), new GenericManaCost(4)),
new DoIfCostPaid(new UntapSourceEffect(), new GenericManaCost(4),"Pay {4} to untap {this}?"),
TargetController.YOU,
false));
// At the beginning of your draw step, if Mana Vault is tapped, it deals 1 damage to you.
this.addAbility(new ConditionalTriggeredAbility(
new BeginningOfDrawTriggeredAbility(Zone.BATTLEFIELD, new DamageControllerEffect(1), TargetController.YOU, false),
SourceTappedCondition.getInstance(),
"At the beginning of your draw step, if Mana Vault is tapped, it deals 1 damage to you.", false));
"At the beginning of your draw step, if {this} is tapped, it deals 1 damage to you.", false));
// {tap}: Add {3} to your mana pool.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.ColorlessMana(3), new TapSourceCost()));
}

View file

@ -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 jeffwadsworth
*/
public class ForceOfNature extends mage.sets.fourthedition.ForceOfNature {
public ForceOfNature(UUID ownerId) {
super(ownerId);
this.cardNumber = 103;
this.expansionSetCode = "LEB";
}
public ForceOfNature(final ForceOfNature card) {
super(card);
}
@Override
public ForceOfNature copy() {
return new ForceOfNature(this);
}
}

View file

@ -0,0 +1,117 @@
/*
* 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;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.players.Player;
import mage.target.TargetSpell;
/**
*
* @author jeffwadsworth
*/
public class Fork extends CardImpl {
private static final FilterSpell filter = new FilterSpell("target instant or sorcery spell");
static {
filter.add(Predicates.or(new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
}
public Fork(UUID ownerId) {
super(ownerId, 154, "Fork", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{R}{R}");
this.expansionSetCode = "LEB";
// Copy target instant or sorcery spell, except that the copy is red. You may choose new targets for the copy.
this.getSpellAbility().addEffect(new ForkEffect());
this.getSpellAbility().addTarget(new TargetSpell(filter));
}
public Fork(final Fork card) {
super(card);
}
@Override
public Fork copy() {
return new Fork(this);
}
}
class ForkEffect extends OneShotEffect {
public ForkEffect() {
super(Outcome.Copy);
staticText = "Copy target instant or sorcery spell, except that the copy is red. You may choose new targets for the copy";
}
public ForkEffect(final ForkEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
if (spell != null) {
Spell copy = spell.copySpell();
copy.getColor().setRed(true);
copy.setControllerId(controller.getId());
copy.setCopiedSpell(true);
game.getStack().push(copy);
copy.chooseNewTargets(game, controller.getId());
return true;
}
return false;
}
@Override
public ForkEffect copy() {
return new ForkEffect(this);
}
@Override
public String getText(Mode mode) {
StringBuilder sb = new StringBuilder();
sb.append("Copy target ").append(mode.getTargets().get(0).getTargetName()).append(", except that the copy is red. You may choose new targets for the copy");
return sb.toString();
}
}

View file

@ -28,22 +28,24 @@
package mage.sets.magic2012;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.DeathtouchAbility;
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.game.Game;
import mage.game.events.DamagedEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.game.turn.Step;
import mage.players.Player;
import mage.target.common.TargetAttackingCreature;
@ -58,11 +60,13 @@ public class VengefulPharaoh extends CardImpl {
this.expansionSetCode = "M12";
this.subtype.add("Zombie");
this.color.setBlack(true);
this.power = new MageInt(5);
this.toughness = new MageInt(4);
// Deathtouch (Any amount of damage this deals to a creature is enough to destroy it.)
this.addAbility(DeathtouchAbility.getInstance());
// Whenever combat damage is dealt to you or a planeswalker you control, if Vengeful Pharaoh is in your graveyard, destroy target attacking creature, then put Vengeful Pharaoh on top of your library.
this.addAbility(new VengefulPharaohTriggeredAbility());
}
@ -78,6 +82,12 @@ public class VengefulPharaoh extends CardImpl {
class VengefulPharaohTriggeredAbility extends TriggeredAbilityImpl {
Step stepTriggeredPlayer;
int turnTriggeredPlayer;
Step stepTriggeredPlansewalker;
int turnTriggeredPlaneswalker;
public VengefulPharaohTriggeredAbility() {
super(Zone.GRAVEYARD, new VengefulPharaohEffect(), false);
this.addTarget(new TargetAttackingCreature());
@ -85,6 +95,10 @@ class VengefulPharaohTriggeredAbility extends TriggeredAbilityImpl {
public VengefulPharaohTriggeredAbility(final VengefulPharaohTriggeredAbility ability) {
super(ability);
this.stepTriggeredPlansewalker = ability.stepTriggeredPlansewalker;
this.turnTriggeredPlaneswalker = ability.turnTriggeredPlaneswalker;
this.stepTriggeredPlayer = ability.stepTriggeredPlayer;
this.turnTriggeredPlayer = ability.turnTriggeredPlayer;
}
@Override
@ -92,16 +106,41 @@ class VengefulPharaohTriggeredAbility extends TriggeredAbilityImpl {
return new VengefulPharaohTriggeredAbility(this);
}
@Override
public boolean checkInterveningIfClause(Game game) {
// 9/22/2011 - If multiple creatures deal combat damage to you and to a planeswalker you control
// simultaneously, Vengeful Pharaoh will trigger twice. The first trigger will cause Vengeful Pharaoh
// to be put on top of your library. The second trigger will then do nothing, as Vengeful Pharaoh is
// no longer in your graveyard when it tries to resolve. Note that the second trigger will do nothing
// even if Vengeful Pharaoh is put back into your graveyard before it tries to resolve, as it's a
// different Vengeful Pharaoh than the one that was there before.
MageObjectReference mor = new MageObjectReference(getSourceId(), game);
return mor.refersTo(this.getSourceObject(game));
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_PLAYER || event.getType() == EventType.DAMAGED_PLANESWALKER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if ((event.getType() == EventType.DAMAGED_PLAYER && event.getTargetId().equals(this.getControllerId()))
&& ((DamagedEvent) event).isCombatDamage()) {
return true;
if (!game.getPhase().getStep().equals(stepTriggeredPlayer) || game.getTurnNum() != turnTriggeredPlayer) {
stepTriggeredPlayer = game.getPhase().getStep();
turnTriggeredPlayer = game.getTurnNum();
return true;
}
}
if (event.getType() == EventType.DAMAGED_PLANESWALKER && ((DamagedEvent) event).isCombatDamage()) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getControllerId().equals(this.getControllerId())) {
return true;
if (!game.getPhase().getStep().equals(stepTriggeredPlansewalker) || game.getTurnNum() != turnTriggeredPlaneswalker) {
stepTriggeredPlansewalker = game.getPhase().getStep();
turnTriggeredPlaneswalker = game.getTurnNum();
return true;
}
}
}
return false;
@ -131,19 +170,16 @@ class VengefulPharaohEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
boolean applied = false;
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
permanent.destroy(source.getSourceId(), game, false);
applied = true;
}
Player player = game.getPlayer(source.getControllerId());
Player controller = game.getPlayer(source.getControllerId());
Card card = game.getCard(source.getSourceId());
if (card != null && player != null) {
player.getGraveyard().remove(card);
card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
applied = true;
if (card != null && controller != null) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
permanent.destroy(source.getSourceId(), game, false);
}
controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD, true, true);
return true;
}
return applied;
return false;
}
}

View file

@ -106,6 +106,7 @@ class AEtherspoutsEffect extends OneShotEffect {
PlayerList playerList = game.getPlayerList();
playerList.setCurrent(game.getActivePlayerId());
Player player = game.getPlayer(game.getActivePlayerId());
Player activePlayer = player;
do {
ArrayList<Permanent> permanentsToTop = new ArrayList<>();
ArrayList<Permanent> permanentsToBottom = new ArrayList<>();
@ -134,7 +135,10 @@ class AEtherspoutsEffect extends OneShotEffect {
}
}
TargetCard target = new TargetCard(Zone.BATTLEFIELD, new FilterCard("order to put on the top of library (last choosen will be the top most)"));
while (player.isInGame() && cards.size() > 1) {
while (cards.size() > 1) {
if (!player.isInGame()) {
return false;
}
player.choose(Outcome.Neutral, cards, target, game);
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
@ -173,6 +177,7 @@ class AEtherspoutsEffect extends OneShotEffect {
target = new TargetCard(Zone.BATTLEFIELD, new FilterCard("order to put on bottom of library (last choosen will be bottommost card)"));
while (player.isInGame() && cards.size() > 1) {
player.choose(Outcome.Neutral, cards, target, game);
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
cards.remove(card);
@ -195,7 +200,7 @@ class AEtherspoutsEffect extends OneShotEffect {
player.moveCardToLibraryWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD, false, false);
}
player = playerList.getNext(game);
} while (player != null && !player.getId().equals(game.getActivePlayerId()));
} while (player != null && !player.getId().equals(game.getActivePlayerId()) && activePlayer.isInGame());
return true;
}
return false;

View file

@ -29,7 +29,6 @@ package mage.sets.magic2015;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.common.GetXValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
import mage.abilities.keyword.ConvokeAbility;
@ -58,8 +57,6 @@ public class ReturnToTheRanks extends CardImpl {
super(ownerId, 29, "Return to the Ranks", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{X}{W}{W}");
this.expansionSetCode = "M15";
this.color.setWhite(true);
// Convoke
this.addAbility(new ConvokeAbility());
// Return X target creature cards with converted mana cost 2 or less from your graveyard to the battlefield.

View file

@ -34,8 +34,8 @@ import mage.abilities.effects.common.DestroyAllEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterArtifactPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetControlledPermanent;
@ -45,7 +45,7 @@ import mage.target.common.TargetControlledPermanent;
*/
public class Pulverize extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("two Mountains");
private static final FilterControlledPermanent filter = new FilterControlledPermanent("two Mountains");
static {
filter.add(new SubtypePredicate("Mountain"));
}

View file

@ -178,7 +178,8 @@ class AmberPrisonUntapTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.UNTAPPED) && event.getTargetId().equals(this.getSourceId());
return event.getType().equals(GameEvent.EventType.UNTAP) && event.getTargetId().equals(this.getSourceId());
}
}

View file

@ -0,0 +1,55 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.sets.mirage;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.target.Target;
import mage.target.common.TargetNonBasicLandPermanent;
/**
*
* @author nick.myers
*/
public class DwarvenMiner extends CardImpl {
public DwarvenMiner(UUID ownerId) {
super(ownerId, 169, "Dwarven Miner", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.expansionSetCode = "MIR";
this.subtype.add("Dwarf");
this.power = new MageInt(1);
this.toughness = new MageInt(2);
// {2}{R}, {tap}: Destroy target nonbasic land
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{2}{R}"));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetNonBasicLandPermanent());
this.addAbility(ability);
}
public DwarvenMiner(final DwarvenMiner card) {
super(card);
}
@Override
public DwarvenMiner copy() {
return new DwarvenMiner(this);
}
}

View file

@ -0,0 +1,83 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.sets.mirrodin;
import java.util.UUID;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfPreCombatMainTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.filter.common.FilterArtifactPermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author nickmyers
*/
public class BlinkmothUrn extends CardImpl {
public BlinkmothUrn(UUID ownerId) {
super(ownerId, 145, "Blinkmoth Urn", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{5}");
this.expansionSetCode = "MRD";
// At the beginning of each player's precombat main phase, if
// Blinkmoth Urn is untapped, that player adds {1} to his or her
// mana pool for each artifact he or she controls.
this.addAbility(new BeginningOfPreCombatMainTriggeredAbility(new BlinkmothUrnEffect(), TargetController.ANY, false));
}
public BlinkmothUrn(final BlinkmothUrn card) {
super(card);
}
@Override
public BlinkmothUrn copy() {
return new BlinkmothUrn(this);
}
}
class BlinkmothUrnEffect extends OneShotEffect {
public BlinkmothUrnEffect() {
super(Outcome.PutManaInPool);
this.staticText = "if Blinkmoth Urn is untapped, that player adds {1} to his or her mana pool for each artifact he or she controls";
}
public BlinkmothUrnEffect(final BlinkmothUrnEffect effect) {
super(effect);
}
@Override
public BlinkmothUrnEffect copy() {
return new BlinkmothUrnEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(game.getActivePlayerId());
FilterArtifactPermanent filter = new FilterArtifactPermanent("artifacts you control");
filter.add(new ControllerIdPredicate(game.getActivePlayerId()));
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if(player != null && sourcePermanent != null && !sourcePermanent.isTapped()) {
player.getManaPool().addMana(Mana.ColorlessMana(
game.getState().
getBattlefield().
getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game).
size()), game, source, true);
return true;
}
return false;
}
}

View file

@ -0,0 +1,177 @@
/*
* 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.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AddManaOfAnyTypeProducedEffect;
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.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ManaEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.targetpointer.FixedTarget;
import mage.util.CardUtil;
/**
*
* @author jeffwadsworth
*/
public class ExtraplanarLens extends CardImpl {
public ExtraplanarLens(UUID ownerId) {
super(ownerId, 169, "Extraplanar Lens", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{3}");
this.expansionSetCode = "MRD";
// Imprint - When Extraplanar Lens enters the battlefield, you may exile target land you control.
this.addAbility(new EntersBattlefieldTriggeredAbility(new ExtraplanarLensImprintEffect(), true, "<i>Imprint - </i>"));
// Whenever a land with the same name as the exiled card is tapped for mana, its controller adds one mana to his or her mana pool of any type that land produced.
this.addAbility(new ExtraplanarLensTriggeredAbility());
}
public ExtraplanarLens(final ExtraplanarLens card) {
super(card);
}
@Override
public ExtraplanarLens copy() {
return new ExtraplanarLens(this);
}
}
class ExtraplanarLensImprintEffect extends OneShotEffect {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("land you control");
static {
filter.add(new CardTypePredicate(CardType.LAND));
}
public ExtraplanarLensImprintEffect() {
super(Outcome.Neutral);
staticText = "you may exile target land you control";
}
public ExtraplanarLensImprintEffect(ExtraplanarLensImprintEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent extraplanarLens = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null) {
if (game.getBattlefield().countAll(filter, controller.getId(), game) > 0) {
TargetPermanent target = new TargetPermanent(1, filter);
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)
&& controller.choose(Outcome.Neutral, target, source.getSourceId(), game)) {
Permanent targetLand = game.getPermanent(target.getFirstTarget());
if (targetLand != null) {
targetLand.moveToExile(null, extraplanarLens.getLogName() + " (Imprint)", source.getSourceId(), game);
extraplanarLens.imprint(targetLand.getId(), game);
extraplanarLens.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + targetLand.getLogName() + "]"));
}
}
return true;
}
}
return false;
}
@Override
public ExtraplanarLensImprintEffect copy() {
return new ExtraplanarLensImprintEffect(this);
}
}
class ExtraplanarLensTriggeredAbility extends TriggeredAbilityImpl {
public ExtraplanarLensTriggeredAbility() {
super(Zone.BATTLEFIELD, new AddManaOfAnyTypeProducedEffect());
}
public ExtraplanarLensTriggeredAbility(final ExtraplanarLensTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent landTappedForMana = game.getPermanentOrLKIBattlefield(event.getSourceId());
Permanent extraplanarLens = game.getPermanent(getSourceId());
if (extraplanarLens != null
&& landTappedForMana != null
&& !extraplanarLens.getImprinted().isEmpty()) {
Card imprinted = game.getCard(extraplanarLens.getImprinted().get(0));
if (imprinted != null
&& game.getState().getZone(imprinted.getId()).equals(Zone.EXILED)) {
if (landTappedForMana.getName().equals(imprinted.getName())
&& landTappedForMana.getCardType().contains(CardType.LAND)) {
ManaEvent mEvent = (ManaEvent) event;
for (Effect effect : getEffects()) {
effect.setValue("mana", mEvent.getMana());
}
getEffects().get(0).setTargetPointer(new FixedTarget(landTappedForMana.getId()));
return true;
}
}
}
return false;
}
@Override
public String getRule() {
return new StringBuilder("Whenever a land with the same name as the exiled card is tapped for mana, ").append(super.getRule()).toString();
}
@Override
public ExtraplanarLensTriggeredAbility copy() {
return new ExtraplanarLensTriggeredAbility(this);
}
}

View file

@ -0,0 +1,188 @@
/*
* 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.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.VariableCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
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.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.EmptyToken;
import mage.players.Player;
import mage.target.TargetCard;
import mage.util.CardUtil;
/**
*
* @author jeffwadsworth
*/
public class SoulFoundry extends CardImpl {
public SoulFoundry(UUID ownerId) {
super(ownerId, 246, "Soul Foundry", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{4}");
this.expansionSetCode = "MRD";
// Imprint - When Soul Foundry enters the battlefield, you may exile a creature card from your hand.
this.addAbility(new EntersBattlefieldTriggeredAbility(new SoulFoundryImprintEffect(), true, "<i>Imprint - </i>"));
// {X}, {tap}: Put a token that's a copy of the exiled card onto the battlefield. X is the converted mana cost of that card.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SoulFoundryEffect(), new ManaCostsImpl("{X}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}
public SoulFoundry(final SoulFoundry card) {
super(card);
}
@Override
public void adjustCosts(Ability ability, Game game) {
Permanent card = game.getPermanent(ability.getSourceId());
if (card != null) {
if (card.getImprinted().size() > 0) {
Card imprinted = game.getCard(card.getImprinted().get(0));
if (imprinted != null) {
ability.getManaCostsToPay().add(0, new GenericManaCost(imprinted.getManaCost().convertedManaCost()));
}
}
}
// no {X} anymore as we already have imprinted the card with defined manacost
for (ManaCost cost : ability.getManaCostsToPay()) {
if (cost instanceof VariableCost) {
cost.setPaid();
}
}
}
@Override
public SoulFoundry copy() {
return new SoulFoundry(this);
}
}
class SoulFoundryImprintEffect extends OneShotEffect {
private static final FilterCard filter = new FilterCard("creature card from your hand");
static {
filter.add(new CardTypePredicate(CardType.CREATURE));
}
public SoulFoundryImprintEffect() {
super(Outcome.Neutral);
staticText = "you may exile a creature card from your hand";
}
public SoulFoundryImprintEffect(SoulFoundryImprintEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null) {
if (controller.getHand().size() > 0) {
TargetCard target = new TargetCard(Zone.HAND, filter);
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)
&& controller.choose(Outcome.Benefit, controller.getHand(), target, game)) {
Card card = controller.getHand().get(target.getFirstTarget(), game);
if (card != null) {
controller.moveCardToExileWithInfo(card, source.getSourceId(), sourcePermanent.getLogName() + " (Imprint)", source.getSourceId(), game, Zone.HAND);
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
permanent.imprint(card.getId(), game);
permanent.addInfo("imprint", CardUtil.addToolTipMarkTags("[Imprinted card - " + card.getLogName() + "]"));
}
}
}
}
return true;
}
return false;
}
@Override
public SoulFoundryImprintEffect copy() {
return new SoulFoundryImprintEffect(this);
}
}
class SoulFoundryEffect extends OneShotEffect {
public SoulFoundryEffect() {
super(Outcome.PutCreatureInPlay);
this.staticText = "Put a token that's a copy of the exiled card onto the battlefield. X is the converted mana cost of that card";
}
public SoulFoundryEffect(final SoulFoundryEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Permanent soulFoundry = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (soulFoundry != null
&& soulFoundry.getImprinted() != null
&& !soulFoundry.getImprinted().isEmpty()) {
Card imprinted = game.getCard(soulFoundry.getImprinted().get(0));
if (imprinted != null
&& game.getState().getZone(imprinted.getId()).equals(Zone.EXILED)) {
EmptyToken token = new EmptyToken();
CardUtil.copyTo(token).from(imprinted);
return token.putOntoBattlefield(1, game, source.getSourceId(), controller.getId());
}
}
}
return false;
}
@Override
public SoulFoundryEffect copy() {
return new SoulFoundryEffect(this);
}
}

View file

@ -142,12 +142,14 @@ class JhoiraOfTheGhituSuspendEffect extends OneShotEffect {
for (Ability ability :card.getAbilities()) {
if (!oldAbilities.contains(ability)) {
ability.setControllerId(source.getControllerId());
game.getState().addAbility(ability, card.getId(), card);
ability.setSourceId(source.getSourceId());
ability.setSourceObject(source.getSourceObject(game));
game.getState().addAbility(ability, card);
}
}
}
game.informPlayers(new StringBuilder(controller.getName()).append(" suspends (").append(4).append(") ").append(card.getName()).toString());
game.informPlayers(controller.getName() + " suspends 4 - " + card.getName());
return true;
}
}

View file

@ -106,7 +106,7 @@ class BramblewoodParagonReplacementEffect extends ReplacementEffectImpl {
Permanent creature = game.getPermanent(event.getTargetId());
if (creature != null && creature.getControllerId().equals(source.getControllerId())
&& creature.getCardType().contains(CardType.CREATURE)
&& creature.getSubtype().contains("Warrior")
&& creature.hasSubtype("Warrior")
&& !event.getTargetId().equals(source.getSourceId())) {
return true;
}

View file

@ -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.sets.morningtide;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CounterTargetEffect;
import mage.abilities.effects.common.NameACardEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.NamePredicate;
import mage.game.Game;
import mage.target.TargetSpell;
/**
*
* @author jeffwadsworth
*/
public class DeclarationOfNaught extends CardImpl {
static final private FilterSpell filter = new FilterSpell("spell with the chosen name");
public DeclarationOfNaught(UUID ownerId) {
super(ownerId, 29, "Declaration of Naught", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{U}{U}");
this.expansionSetCode = "MOR";
// As Declaration of Naught enters the battlefield, name a card.
this.addAbility(new AsEntersBattlefieldAbility(new NameACardEffect(NameACardEffect.TypeOfName.ALL)));
// {U}: Counter target spell with the chosen name.
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CounterTargetEffect(), new ManaCostsImpl("{U}"));
ability.addTarget(new TargetSpell(filter));
this.addAbility(ability);
}
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability instanceof SimpleActivatedAbility) {
ability.getTargets().clear();
FilterSpell filter2 = new FilterSpell("spell with the chosen name");
filter2.add(new NamePredicate((String) game.getState().getValue(ability.getSourceId().toString() + NameACardEffect.INFO_KEY)));
TargetSpell target = new TargetSpell(1, filter2);
ability.addTarget(target);
}
}
public DeclarationOfNaught(final DeclarationOfNaught card) {
super(card);
}
@Override
public DeclarationOfNaught copy() {
return new DeclarationOfNaught(this);
}
}

View file

@ -27,6 +27,8 @@
*/
package mage.sets.newphyrexia;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.abilities.effects.OneShotEffect;
@ -34,14 +36,18 @@ import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.*;
import mage.constants.AsThoughEffectType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.ExileZone;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetOpponent;
import java.util.UUID;
import mage.game.permanent.Permanent;
import mage.util.CardUtil;
/**
*
@ -90,16 +96,18 @@ class PraetorsGraspEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player opponent = game.getPlayer(source.getFirstTarget());
Player player = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (player != null && opponent != null && sourcePermanent != null) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && opponent != null && sourceObject != null) {
TargetCardInLibrary target = new TargetCardInLibrary();
if (player.searchLibrary(target, game, opponent.getId())) {
if (controller.searchLibrary(target, game, opponent.getId())) {
UUID targetId = target.getFirstTarget();
Card card = opponent.getLibrary().remove(targetId, game);
if (card != null) {
Card card = opponent.getLibrary().getCard(targetId, game);
UUID exileId = CardUtil.getObjectExileZoneId(game, sourceObject);
if (card != null && exileId != null) {
card.setFaceDown(true);
card.moveToExile(getId(), sourcePermanent.getName(), source.getSourceId(), game);
game.informPlayers(controller.getName() + " moves the searched card face down to exile");
card.moveToExile(exileId, sourceObject.getName(), source.getSourceId(), game);
game.addEffect(new PraetorsGraspPlayEffect(card.getId()), source);
game.addEffect(new PraetorsGraspRevealEffect(card.getId()), source);
}
@ -139,10 +147,18 @@ class PraetorsGraspPlayEffect extends AsThoughEffectImpl {
@Override
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
if (sourceId.equals(cardId)) {
Card card = game.getCard(cardId);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && card != null && game.getState().getZone(cardId) == Zone.EXILED) {
return true;
MageObject sourceObject = source.getSourceObject(game);
UUID exileId = CardUtil.getObjectExileZoneId(game, sourceObject, true);
if (exileId != null && sourceObject != null && controller != null) {
ExileZone exileZone = game.getExile().getExileZone(exileId);
if (exileZone != null && exileZone.contains(cardId)) {
if (controller.chooseUse(outcome, "Play the exiled card?", game)) {
return true;
}
} else {
discard();
}
}
}
return false;
@ -178,17 +194,25 @@ class PraetorsGraspRevealEffect extends AsThoughEffectImpl {
@Override
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
if (sourceId.equals(cardId)) {
Card card = game.getCard(cardId);
Card sourceCard = game.getCard(source.getSourceId());
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && card != null && game.getState().getZone(cardId) == Zone.EXILED) {
if (controller.chooseUse(outcome, "Reveal exiled card?", game)) {
Cards cards = new CardsImpl(card);
controller.lookAtCards("Exiled with " + sourceCard.getName(), cards, game);
MageObject sourceObject = source.getSourceObject(game);
UUID exileId = CardUtil.getObjectExileZoneId(game, sourceObject, true);
if (exileId != null && sourceObject != null) {
ExileZone exileZone = game.getExile().getExileZone(exileId);
if (exileZone != null && exileZone.contains(cardId)) {
Player controller = game.getPlayer(source.getControllerId());
Card card = game.getCard(cardId);
if (controller != null && card != null && game.getState().getZone(cardId) == Zone.EXILED) {
if (controller.chooseUse(outcome, "Reveal exiled card?", game)) {
Cards cards = new CardsImpl(card);
controller.lookAtCards("Exiled with " + sourceObject.getName(), cards, game);
}
}
} else {
discard();
}
}
}
return false;
}
}
}

View file

@ -28,17 +28,21 @@
package mage.sets.ninthedition;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.common.AttacksOrBlocksEnchantedTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.LoseLifeSourceControllerEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
@ -53,16 +57,15 @@ public class ContaminatedBond extends CardImpl {
this.expansionSetCode = "9ED";
this.subtype.add("Aura");
this.color.setBlack(true);
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
this.getSpellAbility().addEffect(new AttachEffect(Outcome.UnboostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Whenever enchanted creature attacks or blocks, its controller loses 3 life.
this.addAbility(new AttacksOrBlocksEnchantedTriggeredAbility(Zone.BATTLEFIELD, new LoseLifeSourceControllerEffect(3)));
this.addAbility(new AttacksOrBlocksEnchantedTriggeredAbility(Zone.BATTLEFIELD, new LoseLifeControllerAttachedEffect(3)));
}
public ContaminatedBond(final ContaminatedBond card) {
@ -74,3 +77,50 @@ public class ContaminatedBond extends CardImpl {
return new ContaminatedBond(this);
}
}
class LoseLifeControllerAttachedEffect extends OneShotEffect {
protected DynamicValue amount;
public LoseLifeControllerAttachedEffect(int amount) {
this(new StaticValue(amount));
}
public LoseLifeControllerAttachedEffect(DynamicValue amount) {
super(Outcome.Damage);
this.amount = amount;
staticText = "its controller loses " + amount.toString() +" life";
}
public LoseLifeControllerAttachedEffect(final LoseLifeControllerAttachedEffect effect) {
super(effect);
this.amount = effect.amount.copy();
}
@Override
public LoseLifeControllerAttachedEffect copy() {
return new LoseLifeControllerAttachedEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent enchantment = game.getPermanent(source.getSourceId());
if (enchantment == null) {
enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
}
if (enchantment != null && enchantment.getAttachedTo() != null) {
Permanent creature = game.getPermanent(enchantment.getAttachedTo());
if (creature == null) {
creature = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
}
if (creature != null) {
Player player = game.getPlayer(creature.getControllerId());
if (player != null) {
player.loseLife(amount.calculate(game, source, this), game);
return true;
}
}
}
return false;
}
}

View file

@ -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.ninthedition;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public class ForceOfNature extends mage.sets.fourthedition.ForceOfNature {
public ForceOfNature(UUID ownerId) {
super(ownerId);
this.cardNumber = 242;
this.expansionSetCode = "9ED";
}
public ForceOfNature(final ForceOfNature card) {
super(card);
}
@Override
public ForceOfNature copy() {
return new ForceOfNature(this);
}
}

View file

@ -41,7 +41,9 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.Target;
import mage.target.common.TargetControlledPermanent;
import mage.target.common.TargetLandPermanent;
@ -57,7 +59,6 @@ public class Dreamwinder extends CardImpl {
this.expansionSetCode = "ODY";
this.subtype.add("Serpent");
this.color.setBlue(true);
this.power = new MageInt(4);
this.toughness = new MageInt(3);
@ -67,7 +68,9 @@ public class Dreamwinder extends CardImpl {
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesBasicLandTargetEffect(Duration.EndOfTurn, "Island"), new ManaCostsImpl("{U}"));
Target target = new TargetLandPermanent();
ability.addTarget(target);
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(1, 1, new FilterLandPermanent("Island","an Island"), true)));
FilterControlledLandPermanent filter = new FilterControlledLandPermanent("an Island");
filter.add(new SubtypePredicate("Island"));
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(1, 1, filter, true)));
this.addAbility(ability);
}

View file

@ -34,7 +34,7 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -85,11 +85,11 @@ class ReadTheRunesEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
int drawnCards = player.drawCards(source.getManaCostsToPay().getX(), game);
Target target = new TargetControlledPermanent(0, drawnCards, new FilterPermanent(), true);
target.choose(Outcome.Sacrifice, player.getId(), source.getSourceId(), game);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
int drawnCards = controller.drawCards(source.getManaCostsToPay().getX(), game);
Target target = new TargetControlledPermanent(0, drawnCards, new FilterControlledPermanent(), true);
controller.chooseTarget(Outcome.Sacrifice, target, source, game);
int sacrificedPermanents = 0;
for (UUID permanentId : target.getTargets()) {
Permanent permanent = game.getPermanent(permanentId);
@ -99,7 +99,7 @@ class ReadTheRunesEffect extends OneShotEffect {
}
}
}
player.discard(drawnCards - sacrificedPermanents, source, game);
controller.discard(drawnCards - sacrificedPermanents, false, source, game);
return true;
}
return false;

View file

@ -38,8 +38,7 @@ import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -97,10 +96,7 @@ class ReturnToHandEffect extends OneShotEffect {
return false;
}
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(new ControllerPredicate(TargetController.YOU));
Target target = new TargetControlledPermanent(1, 1, filter, true);
Target target = new TargetControlledPermanent(1, 1, new FilterControlledCreaturePermanent(), true);
if (target.canChoose(player.getId(), game)) {
while (player.isInGame() && !target.isChosen() && target.canChoose(player.getId(), game)) {
player.chooseTarget(Outcome.ReturnToHand, target, source, game);

View file

@ -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 jeffwadsworth
*/
public class ForceOfNature extends mage.sets.fourthedition.ForceOfNature {
public ForceOfNature(UUID ownerId) {
super(ownerId);
this.cardNumber = 103;
this.expansionSetCode = "3ED";
}
public ForceOfNature(final ForceOfNature card) {
super(card);
}
@Override
public ForceOfNature copy() {
return new ForceOfNature(this);
}
}

View file

@ -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 jeffwadsworth
*/
public class Fork extends mage.sets.limitedbeta.Fork {
public Fork(UUID ownerId) {
super(ownerId);
this.cardNumber = 152;
this.expansionSetCode = "3ED";
}
public Fork(final Fork card) {
super(card);
}
@Override
public Fork copy() {
return new Fork(this);
}
}

View file

@ -66,8 +66,10 @@ public class ContaminatedGround extends CardImpl {
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Enchanted land is a Swamp.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesBasicLandEnchantedEffect("Swamp")));
// Whenever enchanted land becomes tapped, its controller loses 2 life.
this.addAbility(new ContaminatedGroundAbility());
}

View file

@ -35,9 +35,12 @@ import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.cards.CardImpl;
import mage.choices.ChoiceImpl;
import mage.constants.AbilityType;
import mage.constants.CardType;
import mage.constants.CostModificationType;
import mage.constants.Duration;
@ -48,6 +51,7 @@ import mage.filter.common.FilterControlledCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.util.CardUtil;
/**
*
@ -76,10 +80,7 @@ public class TrainingGrounds extends CardImpl {
class TrainingGroundsEffect extends CostModificationEffectImpl {
private static final String effectText = "Activated abilities of creatures you control cost up to {2} less to activate. This effect can't reduce the amount of mana an ability costs to activate to less than one mana";
private static final FilterControlledCreaturePermanent filter;
static {
filter = new FilterControlledCreaturePermanent();
}
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
public TrainingGroundsEffect() {
super(Duration.Custom, Outcome.Benefit, CostModificationType.REDUCE_COST);
@ -113,8 +114,7 @@ class TrainingGroundsEffect extends CostModificationEffectImpl {
choice.setMessage("Reduce ability cost");
if(controller.choose(Outcome.Benefit, choice, game)){
int reduce = Integer.parseInt(choice.getChoice());
mana.setColorless(mana.getColorless() - reduce);
abilityToModify.getManaCostsToPay().load(mana.toString());
CardUtil.reduceCost(abilityToModify, reduce);
}
}
return true;
@ -124,7 +124,7 @@ class TrainingGroundsEffect extends CostModificationEffectImpl {
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof ActivatedAbility) {
if (abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED)) {
//Activated abilities of creatures you control
Permanent permanent = game.getPermanent(abilityToModify.getSourceId());
if (permanent != null && filter.match(permanent, source.getSourceId(), source.getControllerId(), game)) {

View file

@ -36,6 +36,7 @@ import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -54,8 +55,6 @@ public class ChoiceOfDamnations extends CardImpl {
this.expansionSetCode = "SOK";
this.subtype.add("Arcane");
this.color.setBlack(true);
// Target opponent chooses a number. You may have that player lose that much life. If you don't, that player sacrifices all but that many permanents.
this.getSpellAbility().addEffect(new ChoiceOfDamnationsEffect());
this.getSpellAbility().addTarget(new TargetOpponent());
@ -94,14 +93,14 @@ class ChoiceOfDamnationsEffect extends OneShotEffect {
int amount = targetPlayer.getAmount(0, Integer.MAX_VALUE, "Chooses a number", game);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
StringBuilder sb = new StringBuilder("Shall ").append(targetPlayer.getName()).append(" lose ").append(amount).append(" life?");
if (controller.chooseUse(outcome, sb.toString(), game)) {
String sb = String.valueOf("Shall " + targetPlayer.getName() + " lose ") + Integer.toString(amount) + " life?";
if (controller.chooseUse(outcome, sb, game)) {
targetPlayer.loseLife(amount, game);
} else {
int numberPermanents = game.getState().getBattlefield().countAll(new FilterPermanent(), targetPlayer.getId(), game);
if (numberPermanents > amount) {
int numberToSacrifice = numberPermanents - amount;
Target target = new TargetControlledPermanent(numberToSacrifice, numberToSacrifice, new FilterPermanent(), false);
Target target = new TargetControlledPermanent(numberToSacrifice, numberToSacrifice, new FilterControlledPermanent(), false);
targetPlayer.chooseTarget(Outcome.Sacrifice, target, source, game);
for (UUID uuid : target.getTargets()) {
Permanent permanent = game.getPermanent(uuid);

View file

@ -38,7 +38,7 @@ import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterArtifactCard;
import mage.filter.common.FilterArtifactPermanent;
import mage.filter.common.FilterControlledArtifactPermanent;
import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetControlledPermanent;
@ -49,7 +49,7 @@ import mage.target.common.TargetControlledPermanent;
public class KuldothaForgemaster extends CardImpl {
private static final FilterArtifactCard filterArtifactCard = new FilterArtifactCard();
private static final FilterArtifactPermanent filterArtifactPermanent = new FilterArtifactPermanent();
private static final FilterControlledArtifactPermanent filterArtifactPermanent = new FilterControlledArtifactPermanent();
public KuldothaForgemaster(UUID ownerId) {
super(ownerId, 169, "Kuldotha Forgemaster", Rarity.RARE, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{5}");

View file

@ -0,0 +1,130 @@
/*
* 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.scourge;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.CycleTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroyAllEffect;
import mage.abilities.keyword.CyclingAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author fireshoes
*/
public class DecreeOfAnnihilation extends CardImpl {
public DecreeOfAnnihilation(UUID ownerId) {
super(ownerId, 85, "Decree of Annihilation", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{8}{R}{R}");
this.expansionSetCode = "SCG";
// Exile all artifacts, creatures, and lands from the battlefield, all cards from all graveyards, and all cards from all hands.
this.getSpellAbility().addEffect(new DecreeOfAnnihilationEffect());
// Cycling {5}{R}{R}
this.addAbility(new CyclingAbility(new ManaCostsImpl("{5}{R}{R}")));
// When you cycle Decree of Annihilation, destroy all lands.
Ability ability = new CycleTriggeredAbility(new DestroyAllEffect(new FilterLandPermanent("lands")), false);
this.addAbility(ability);
}
public DecreeOfAnnihilation(final DecreeOfAnnihilation card) {
super(card);
}
@Override
public DecreeOfAnnihilation copy() {
return new DecreeOfAnnihilation(this);
}
}
class DecreeOfAnnihilationEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterPermanent("");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.CREATURE),
new CardTypePredicate(CardType.LAND)));
}
public DecreeOfAnnihilationEffect() {
super(Outcome.Detriment);
staticText = "Exile all artifacts, creatures, and lands from the battlefield, all cards from all graveyards, and all cards from all hands";
}
public DecreeOfAnnihilationEffect(final DecreeOfAnnihilationEffect effect) {
super(effect);
}
@Override
public DecreeOfAnnihilationEffect copy() {
return new DecreeOfAnnihilationEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
permanent.moveToExile(id, "all artifacts, creatures, and land", id, game);
}
for (UUID playerId : game.getPlayerList()) {
Player player = game.getPlayer(playerId);
if (player != null) {
for (UUID cid : player.getHand().copy()) {
Card c = game.getCard(cid);
if (c != null) {
c.moveToExile(null, null, source.getSourceId(), game);
}
}
for (UUID cid : player.getGraveyard().copy()) {
Card c = game.getCard(cid);
if (c != null) {
c.moveToExile(null, null, source.getSourceId(), game);
}
}
}
}
return true;
}
}

View file

@ -0,0 +1,134 @@
/*
* 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.shadowmoor;
import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
/**
*
* @author jeffwadsworth
*/
public class AdviceFromTheFae extends CardImpl {
public AdviceFromTheFae(UUID ownerId) {
super(ownerId, 28, "Advice from the Fae", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{2/U}{2/U}{2/U}");
this.expansionSetCode = "SHM";
// <i>({2U} can be paid with any two mana or with {U}. This card's converted mana cost is 6.)</i>
// Look at the top five cards of your library. If you control more creatures than each other player, put two of those cards into your hand. Otherwise, put one of them into your hand. Then put the rest on the bottom of your library in any order.
this.getSpellAbility().addEffect(new AdviceFromTheFaeEffect());
}
public AdviceFromTheFae(final AdviceFromTheFae card) {
super(card);
}
@Override
public AdviceFromTheFae copy() {
return new AdviceFromTheFae(this);
}
}
class AdviceFromTheFaeEffect extends OneShotEffect {
public AdviceFromTheFaeEffect() {
super(Outcome.DrawCard);
this.staticText = "Look at the top five cards of your library. If you control more creatures than each other player, put two of those cards into your hand. Otherwise, put one of them into your hand. Then put the rest on the bottom of your library in any order";
}
public AdviceFromTheFaeEffect(final AdviceFromTheFaeEffect effect) {
super(effect);
}
@Override
public AdviceFromTheFaeEffect copy() {
return new AdviceFromTheFaeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject mageObject = game.getObject(source.getSourceId());
if (controller != null) {
List<Card> cardsFromTopLibrary = controller.getLibrary().getTopCards(game, 5);
Cards cards = new CardsImpl(Zone.LIBRARY);
for (Card card : cardsFromTopLibrary) {
cards.add(card);
}
controller.lookAtCards(mageObject.getLogName(), cards, game);
int max = 0;
for (UUID playerId : controller.getInRange()) {
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(new ControllerIdPredicate(playerId));
if (playerId != controller.getId()) {
if (max < game.getBattlefield().countAll(filter, playerId, game)) {
max = game.getBattlefield().countAll(filter, playerId, game);
}
}
}
if (game.getBattlefield().countAll(new FilterControlledCreaturePermanent(), controller.getId(), game) > max) {
TargetCard target = new TargetCard(2, Zone.LIBRARY, new FilterCard());
if (controller.choose(Outcome.DrawCard, cards, target, game)) {
controller.moveCardToHandWithInfo(game.getCard(target.getFirstTarget()), source.getSourceId(), game, Zone.LIBRARY);
cards.remove(game.getCard(target.getFirstTarget()));
controller.moveCardToHandWithInfo(game.getCard(target.getTargets().get(1)), source.getSourceId(), game, Zone.LIBRARY);
cards.remove(game.getCard(target.getTargets().get(1)));
}
} else {
TargetCard target = new TargetCard(1, Zone.LIBRARY, new FilterCard());
if (controller.choose(Outcome.DrawCard, cards, target, game)) {
controller.moveCardToHandWithInfo(game.getCard(target.getFirstTarget()), source.getSourceId(), game, Zone.LIBRARY);
cards.remove(game.getCard(target.getFirstTarget()));
}
}
controller.putCardsOnBottomOfLibrary(cards, game, source, true);
return true;
}
return false;
}
}

View file

@ -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.shadowmoor;
import java.util.UUID;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.ConspireAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.target.common.TargetCreatureOrPlayer;
/**
*
* @author jeffwadsworth
*/
public class BurnTrail extends CardImpl {
public BurnTrail(UUID ownerId) {
super(ownerId, 86, "Burn Trail", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{3}{R}");
this.expansionSetCode = "SHM";
// Burn Trail deals 3 damage to target creature or player.
this.getSpellAbility().addEffect(new DamageTargetEffect(3));
this.getSpellAbility().addTarget(new TargetCreatureOrPlayer());
// Conspire
this.addAbility(new ConspireAbility(this));
}
public BurnTrail(final BurnTrail card) {
super(card);
}
@Override
public BurnTrail copy() {
return new BurnTrail(this);
}
}

View file

@ -0,0 +1,81 @@
/*
* 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.shadowmoor;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.continious.GainAbilityAllEffect;
import mage.abilities.keyword.PersistAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.target.common.TargetCreatureOrPlayer;
/**
*
* @author jeffwadsworth
*/
public class FurystokeGiant extends CardImpl {
public FurystokeGiant(UUID ownerId) {
super(ownerId, 93, "Furystoke Giant", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{R}{R}");
this.expansionSetCode = "SHM";
this.subtype.add("Giant");
this.subtype.add("Warrior");
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// When Furystoke Giant enters the battlefield, other creatures you control gain "{tap}: This creature deals 2 damage to target creature or player" until end of turn.
SimpleActivatedAbility FurystokeGiantAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(2), new TapSourceCost());
FurystokeGiantAbility.addTarget(new TargetCreatureOrPlayer());
Effect effect = new GainAbilityAllEffect(FurystokeGiantAbility, Duration.EndOfTurn, new FilterControlledCreaturePermanent("other creatures"), true);
effect.setText("other creatures you control gain \"{T}: This creature deals 2 damage to target creature or player.\" until end of turn.");
this.addAbility(new EntersBattlefieldTriggeredAbility(effect));
// Persist
this.addAbility(new PersistAbility());
}
public FurystokeGiant(final FurystokeGiant card) {
super(card);
}
@Override
public FurystokeGiant copy() {
return new FurystokeGiant(this);
}
}

View file

@ -0,0 +1,188 @@
/*
* 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.shadowmoor;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.RevealTargetFromHandCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
/**
*
* @author jeffwadsworth
*/
public class IlluminatedFolio extends CardImpl {
public IlluminatedFolio(UUID ownerId) {
super(ownerId, 254, "Illuminated Folio", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{5}");
this.expansionSetCode = "SHM";
// {1}, {tap}, Reveal two cards from your hand that share a color: Draw a card.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), new ManaCostsImpl("{1}"));
ability.addCost(new TapSourceCost());
ability.addCost(new RevealTwoCardsSharedColorFromHandCost());
this.addAbility(ability);
}
public IlluminatedFolio(final IlluminatedFolio card) {
super(card);
}
@Override
public IlluminatedFolio copy() {
return new IlluminatedFolio(this);
}
}
class RevealTwoCardsSharedColorFromHandCost extends RevealTargetFromHandCost {
public RevealTwoCardsSharedColorFromHandCost() {
super(new TargetTwoCardsWithTheSameColorInHand());
}
public RevealTwoCardsSharedColorFromHandCost(RevealTwoCardsSharedColorFromHandCost cost) {
super(cost);
}
@Override
public RevealTwoCardsSharedColorFromHandCost copy() {
return new RevealTwoCardsSharedColorFromHandCost(this);
}
}
class TargetTwoCardsWithTheSameColorInHand extends TargetCardInHand {
public TargetTwoCardsWithTheSameColorInHand() {
super(2, 2, new FilterCard("two cards from your hand that share a color"));
}
public TargetTwoCardsWithTheSameColorInHand(final TargetTwoCardsWithTheSameColorInHand target) {
super(target);
}
@Override
public Set<UUID> possibleTargets(UUID sourceControllerId, Game game) {
Set<UUID> newPossibleTargets = new HashSet<>();
Set<UUID> possibleTargets = new HashSet<>();
Player player = game.getPlayer(sourceControllerId);
for (Card card : player.getHand().getCards(filter, game)) {
possibleTargets.add(card.getId());
}
Cards cardsToCheck = new CardsImpl();
cardsToCheck.addAll(possibleTargets);
if (targets.size() == 1) {
// first target is already choosen, now only targets with the shared color are selectable
for (Map.Entry<UUID, Integer> entry : targets.entrySet()) {
Card chosenCard = cardsToCheck.get(entry.getKey(), game);
if (chosenCard != null) {
for (UUID cardToCheck : cardsToCheck) {
if (!cardToCheck.equals(chosenCard.getId()) && chosenCard.getColor().equals(game.getCard(cardToCheck).getColor())) {
newPossibleTargets.add(cardToCheck);
}
}
}
}
} else {
for (UUID cardToCheck : cardsToCheck) {
FilterCard colorFilter = new FilterCard();
colorFilter.add(new ColorPredicate(game.getCard(cardToCheck).getColor()));
if (cardsToCheck.count(colorFilter, game) > 1) {
newPossibleTargets.add(cardToCheck);
}
}
}
return newPossibleTargets;
}
@Override
public boolean canChoose(UUID sourceControllerId, Game game) {
Cards cardsToCheck = new CardsImpl();
Player player = game.getPlayer(sourceControllerId);
for (Card card : player.getHand().getCards(filter, game)) {
cardsToCheck.add(card.getId());
}
int possibleCards = 0;
for (UUID cardToCheck : cardsToCheck) {
FilterCard colorFilter = new FilterCard();
colorFilter.add(new ColorPredicate(game.getCard(cardToCheck).getColor()));
if (cardsToCheck.count(colorFilter, game) > 1) {
++possibleCards;
}
}
return possibleCards > 0;
}
@Override
public boolean canTarget(UUID id, Game game) {
if (super.canTarget(id, game)) {
Card card = game.getCard(id);
if (card != null) {
if (targets.size() == 1) {
Card card2 = game.getCard(targets.entrySet().iterator().next().getKey());
if (card2 != null && card2.getColor().equals(card.getColor())) {
return true;
}
} else {
FilterCard colorFilter = new FilterCard();
colorFilter.add(new ColorPredicate(card.getColor()));
Player player = game.getPlayer(card.getOwnerId());
if (player.getHand().getCards(colorFilter, game).size() > 1) {
return true;
}
}
}
}
return false;
}
@Override
public TargetTwoCardsWithTheSameColorInHand copy() {
return new TargetTwoCardsWithTheSameColorInHand(this);
}
}

View file

@ -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.shadowmoor;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.combat.MustBeBlockedByAtLeastOneSourceEffect;
import mage.abilities.keyword.WitherAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
/**
*
* @author jeffwadsworth
*/
public class InescapableBrute extends CardImpl {
public InescapableBrute(UUID ownerId) {
super(ownerId, 95, "Inescapable Brute", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{5}{R}");
this.expansionSetCode = "SHM";
this.subtype.add("Giant");
this.subtype.add("Warrior");
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Wither
this.addAbility(WitherAbility.getInstance());
// Inescapable Brute must be blocked if able.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new MustBeBlockedByAtLeastOneSourceEffect()));
}
public InescapableBrute(final InescapableBrute card) {
super(card);
}
@Override
public InescapableBrute copy() {
return new InescapableBrute(this);
}
}

View file

@ -42,7 +42,6 @@ import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ManaEvent;
import mage.watchers.common.PermanentTappedForManaWatcher;
/**
*
@ -57,7 +56,7 @@ public class ManaReflection extends CardImpl {
this.color.setGreen(true);
// If you tap a permanent for mana, it produces twice as much of that mana instead.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ManaReflectionReplacementEffect()), new PermanentTappedForManaWatcher());
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ManaReflectionReplacementEffect()));
}
@ -91,41 +90,35 @@ class ManaReflectionReplacementEffect extends ReplacementEffectImpl {
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Mana mana = ((ManaEvent) event).getMana();
if (mana.getBlack() > 0) {
((ManaEvent) event).getMana().set(ManaType.BLACK, mana.count() * 2);
((ManaEvent) event).getMana().set(ManaType.BLACK, mana.getBlack()* 2);
}
if (mana.getBlue() > 0) {
((ManaEvent) event).getMana().set(ManaType.BLUE, mana.count() * 2);
((ManaEvent) event).getMana().set(ManaType.BLUE, mana.getBlue() * 2);
}
if (mana.getWhite() > 0) {
((ManaEvent) event).getMana().set(ManaType.WHITE, mana.count() * 2);
((ManaEvent) event).getMana().set(ManaType.WHITE, mana.getWhite() * 2);
}
if (mana.getGreen() > 0) {
((ManaEvent) event).getMana().set(ManaType.GREEN, mana.count() * 2);
((ManaEvent) event).getMana().set(ManaType.GREEN, mana.getGreen() * 2);
}
if (mana.getRed() > 0) {
((ManaEvent) event).getMana().set(ManaType.RED, mana.count() * 2);
((ManaEvent) event).getMana().set(ManaType.RED, mana.getRed() * 2);
}
if (mana.getColorless() > 0) {
((ManaEvent) event).getMana().set(ManaType.COLORLESS, mana.count() * 2);
((ManaEvent) event).getMana().set(ManaType.COLORLESS, mana.getColorless() * 2);
}
return false;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.ADD_MANA
&& event.getPlayerId().equals(source.getControllerId())
&& game.getPermanentOrLKIBattlefield(event.getSourceId()) != null) {
UUID permanentId = game.getPermanentOrLKIBattlefield(event.getSourceId()).getId();
PermanentTappedForManaWatcher watcher = (PermanentTappedForManaWatcher) game.getState().getWatchers().get("PermanentTappedForMana");
if (watcher != null) {
if (watcher.permanentId.contains(permanentId)) {
watcher.permanentId.remove(permanentId);
return true;
}
}
}
return false;
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return event.getPlayerId().equals(source.getControllerId())
&& game.getPermanentOrLKIBattlefield(event.getSourceId()) != null;
}
@Override

View file

@ -0,0 +1,170 @@
/*
* 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.shadowmoor;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.common.continious.ExchangeControlTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetControlledPermanent;
/**
*
* @author jeffwadsworth
*/
public class PucasMischief extends CardImpl {
private static final String rule = "you may exchange control of target nonland permanent you control and target nonland permanent an opponent controls with an equal or lesser converted mana cost";
public PucasMischief(UUID ownerId) {
super(ownerId, 47, "Puca's Mischief", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}");
this.expansionSetCode = "SHM";
// At the beginning of your upkeep, you may exchange control of target nonland permanent you control and target nonland permanent an opponent controls with an equal or lesser converted mana cost.
Ability ability = new BeginningOfUpkeepTriggeredAbility(new ExchangeControlTargetEffect(Duration.EndOfGame, rule, false, true), TargetController.YOU, true);
ability.addTarget(new TargetControlledPermanentWithCMCGreaterOrLessThanOpponentPermanent());
ability.addTarget(new PucasMischiefSecondTarget());
this.addAbility(ability);
}
public PucasMischief(final PucasMischief card) {
super(card);
}
@Override
public PucasMischief copy() {
return new PucasMischief(this);
}
}
class TargetControlledPermanentWithCMCGreaterOrLessThanOpponentPermanent extends TargetControlledPermanent {
public TargetControlledPermanentWithCMCGreaterOrLessThanOpponentPermanent() {
super();
filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
setTargetName("nonland permanent you control");
}
public TargetControlledPermanentWithCMCGreaterOrLessThanOpponentPermanent(final TargetControlledPermanentWithCMCGreaterOrLessThanOpponentPermanent target) {
super(target);
}
@Override
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
return super.canTarget(controllerId, id, source, game);
}
@Override
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
Set<UUID> possibleTargets = new HashSet<>();
MageObject targetSource = game.getObject(sourceId);
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, sourceControllerId, sourceId, game)) {
if (!targets.containsKey(permanent.getId()) && permanent.canBeTargetedBy(targetSource, sourceControllerId, game)) {
possibleTargets.add(permanent.getId());
}
}
return possibleTargets;
}
@Override
public TargetControlledPermanentWithCMCGreaterOrLessThanOpponentPermanent copy() {
return new TargetControlledPermanentWithCMCGreaterOrLessThanOpponentPermanent(this);
}
}
class PucasMischiefSecondTarget extends TargetPermanent {
private Permanent firstTarget = null;
public PucasMischiefSecondTarget() {
super();
filter.add(new ControllerPredicate(TargetController.OPPONENT));
filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
setTargetName("permanent an opponent controls with an equal or lesser converted mana cost");
}
public PucasMischiefSecondTarget(final PucasMischiefSecondTarget target) {
super(target);
this.firstTarget = target.firstTarget;
}
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
if (super.canTarget(id, source, game)) {
Permanent target1 = game.getPermanent(source.getFirstTarget());
Permanent opponentPermanent = game.getPermanent(id);
if (target1 != null && opponentPermanent != null) {
return target1.getManaCost().convertedManaCost() >= opponentPermanent.getManaCost().convertedManaCost();
}
}
return false;
}
@Override
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
Set<UUID> possibleTargets = new HashSet<>();
if (firstTarget != null) {
MageObject targetSource = game.getObject(sourceId);
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, sourceControllerId, sourceId, game)) {
if (!targets.containsKey(permanent.getId()) && permanent.canBeTargetedBy(targetSource, sourceControllerId, game)) {
if (firstTarget.getManaCost().convertedManaCost() >= permanent.getManaCost().convertedManaCost()) {
possibleTargets.add(permanent.getId());
}
}
}
}
return possibleTargets;
}
@Override
public boolean chooseTarget(Outcome outcome, UUID playerId, Ability source, Game game) {
firstTarget = game.getPermanent(source.getFirstTarget());
return super.chooseTarget(Outcome.GainControl, playerId, source, game);
}
@Override
public PucasMischiefSecondTarget copy() {
return new PucasMischiefSecondTarget(this);
}
}

View file

@ -0,0 +1,89 @@
/*
* 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.shadowmoor;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.common.continious.GainAbilitySourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.PersistAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
/**
*
* @author jeffwadsworth
*/
public class WingrattleScarecrow extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("a blue creature");
private static final FilterControlledCreaturePermanent filter2 = new FilterControlledCreaturePermanent("a black creature");
static {
filter.add(new ColorPredicate(ObjectColor.BLUE));
filter2.add(new ColorPredicate(ObjectColor.BLACK));
}
private static final String rule = "{this} has flying as long as you control a blue creature";
private static final String rule2 = "{this} has persist as long as you control a black creature";
public WingrattleScarecrow(UUID ownerId) {
super(ownerId, 270, "Wingrattle Scarecrow", Rarity.COMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}");
this.expansionSetCode = "SHM";
this.subtype.add("Scarecrow");
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Wingrattle Scarecrow has flying as long as you control a blue creature.
ContinuousEffect effect = new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(effect, new PermanentsOnTheBattlefieldCondition(filter), rule)));
// Wingrattle Scarecrow has persist as long as you control a black creature.
ContinuousEffect effect2 = new GainAbilitySourceEffect(new PersistAbility(), Duration.WhileOnBattlefield);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(effect2, new PermanentsOnTheBattlefieldCondition(filter2), rule2)));
}
public WingrattleScarecrow(final WingrattleScarecrow card) {
super(card);
}
@Override
public WingrattleScarecrow copy() {
return new WingrattleScarecrow(this);
}
}

View file

@ -36,7 +36,7 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.filter.common.FilterLandPermanent;
import mage.filter.common.FilterControlledLandPermanent;
import mage.game.permanent.token.Token;
import mage.target.common.TargetControlledPermanent;
@ -59,7 +59,7 @@ public class AnthousaSetessanHero extends CardImpl {
// <i>Heroic</i> - Whenever you cast a spell that targets Anthousa, Setessan Hero, up to three target lands you control each become 2/2 Warrior creatures until end of turn. They're still lands.
Ability ability = new HeroicAbility(new BecomesCreatureTargetEffect(new AnthousaWarriorToken(), false, true, Duration.EndOfTurn));
ability.addTarget(new TargetControlledPermanent(0,3,new FilterLandPermanent("lands"), false));
ability.addTarget(new TargetControlledPermanent(0,3,new FilterControlledLandPermanent("lands"), false));
this.addAbility(ability);
}

View file

@ -0,0 +1,95 @@
/*
* 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.timespiral;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInYourGraveyard;
/**
*
* @author fireshoes
*/
public class PitKeeper extends CardImpl {
public PitKeeper(UUID ownerId) {
super(ownerId, 123, "Pit Keeper", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{B}");
this.expansionSetCode = "TSP";
this.subtype.add("Human");
this.subtype.add("Wizard");
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// When Pit Keeper enters the battlefield, if you have four or more creature cards in your graveyard, you may return target creature card from your graveyard to your hand.
TriggeredAbility triggeredAbility = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect(), true);
triggeredAbility.addTarget(new TargetCardInYourGraveyard(new FilterCreatureCard("creature card from your graveyard")));
this.addAbility(new ConditionalTriggeredAbility(
triggeredAbility,
new CreatureCardsInControllerGraveCondition(4),
"When {this} enters the battlefield, if you have four or more creature cards in your graveyard, you may return target creature card from your graveyard to your hand."));
}
public PitKeeper(final PitKeeper card) {
super(card);
}
@Override
public PitKeeper copy() {
return new PitKeeper(this);
}
}
class CreatureCardsInControllerGraveCondition implements Condition {
private int value;
public CreatureCardsInControllerGraveCondition(int value) {
this.value = value;
}
@Override
public boolean apply(Game game, Ability source) {
Player p = game.getPlayer(source.getControllerId());
if (p != null && p.getGraveyard().count(new FilterCreatureCard(), game) >= value)
{
return true;
}
return false;
}
}

View file

@ -36,7 +36,7 @@ import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.BuybackAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterLandPermanent;
import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.turn.TurnMod;
@ -49,7 +49,7 @@ import mage.target.common.TargetControlledPermanent;
*/
public class WalkTheAeons extends CardImpl {
private static final FilterLandPermanent filter = new FilterLandPermanent("three Islands");
private static final FilterControlledLandPermanent filter = new FilterControlledLandPermanent("three Islands");
static {
filter.add(new SubtypePredicate("Island"));

View file

@ -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.unlimitededition;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public class ForceOfNature extends mage.sets.fourthedition.ForceOfNature {
public ForceOfNature(UUID ownerId) {
super(ownerId);
this.cardNumber = 103;
this.expansionSetCode = "2ED";
}
public ForceOfNature(final ForceOfNature card) {
super(card);
}
@Override
public ForceOfNature copy() {
return new ForceOfNature(this);
}
}

View file

@ -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.unlimitededition;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public class Fork extends mage.sets.limitedbeta.Fork {
public Fork(UUID ownerId) {
super(ownerId);
this.cardNumber = 153;
this.expansionSetCode = "2ED";
}
public Fork(final Fork card) {
super(card);
}
@Override
public Fork copy() {
return new Fork(this);
}
}

View file

@ -0,0 +1,86 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.sets.urzasdestiny;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continious.GainControlTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.filter.common.FilterEnchantmentPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author nick.myers
*/
public class AuraThief extends CardImpl {
public AuraThief(UUID ownerId) {
super(ownerId, 26, "Aura Thief", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{U}");
this.expansionSetCode = "UDS";
this.subtype.add("Illusion");
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Flying
this.addAbility(FlyingAbility.getInstance());
// When Aura Thief dies, you gain control of all enchantments. You don't get
// to move Auras.
this.addAbility(new DiesTriggeredAbility(new AuraThiefDiesTriggeredEffect()));
}
public AuraThief(final AuraThief card) {
super(card);
}
@Override
public AuraThief copy() {
return new AuraThief(this);
}
}
class AuraThiefDiesTriggeredEffect extends OneShotEffect {
public AuraThiefDiesTriggeredEffect() {
super(Outcome.Benefit);
this.staticText = "gain control of all enchantments. <i>(You don't get to move Auras.)</i>";
}
public AuraThiefDiesTriggeredEffect(final AuraThiefDiesTriggeredEffect effect) {
super(effect);
}
@Override
public AuraThiefDiesTriggeredEffect copy() {
return new AuraThiefDiesTriggeredEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
boolean ret = false;
for(Permanent enchantment : game.getBattlefield().getActivePermanents(new FilterEnchantmentPermanent(), source.getControllerId(), source.getControllerId(), game)) {
ContinuousEffect gainControl = new GainControlTargetEffect(Duration.EndOfGame);
gainControl.setTargetPointer(new FixedTarget(enchantment.getId()));
game.addEffect(gainControl, source);
ret = true;
}
return ret;
}
}

View file

@ -114,7 +114,7 @@ class ContaminationReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
MageObject mageObject = source.getSourceObject(game);
MageObject mageObject = game.getObject(event.getSourceId());
return mageObject != null && mageObject.getCardType().contains(CardType.LAND);
}
}

View file

@ -33,7 +33,7 @@ import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.common.FilterLandPermanent;
import mage.filter.common.FilterControlledLandPermanent;
import mage.target.common.TargetControlledPermanent;
import mage.target.common.TargetLandPermanent;
@ -50,7 +50,7 @@ public class Raze extends CardImpl {
this.color.setRed(true);
// As an additional cost to cast Raze, sacrifice a land.
this.getSpellAbility().addCost(new SacrificeTargetCost(new TargetControlledPermanent(1,1, new FilterLandPermanent(), true)));
this.getSpellAbility().addCost(new SacrificeTargetCost(new TargetControlledPermanent(1,1, new FilterControlledLandPermanent(), true)));
// Destroy target land.
this.getSpellAbility().addEffect(new DestroyTargetEffect());
this.getSpellAbility().addTarget(new TargetLandPermanent());

View file

@ -39,7 +39,10 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.common.FilterNonlandPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.target.common.TargetControlledPermanent;
/**
@ -65,7 +68,9 @@ public class BragoKingEternal extends CardImpl {
Effect effect = new ExileTargetEffect(this.getId(), this.getName(), Zone.BATTLEFIELD);
effect.setText("exile any number of target nonland permanents you control");
Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(effect, false);
ability.addTarget(new TargetControlledPermanent(0, Integer.MAX_VALUE, new FilterNonlandPermanent(), false));
FilterControlledPermanent filterControlledNonlandPermanent = new FilterControlledPermanent();
filterControlledNonlandPermanent.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
ability.addTarget(new TargetControlledPermanent(0, Integer.MAX_VALUE, filterControlledNonlandPermanent, false));
ability.addEffect(new ReturnFromExileEffect(this.getId(), Zone.BATTLEFIELD, ", then return those cards to the battlefield under their owner's control"));
this.addAbility(ability);
}

View file

@ -30,15 +30,12 @@ package mage.sets.visions;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.abilities.costs.AlternativeCostSourceAbility;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.common.TargetControlledPermanent;
import mage.target.common.TargetCreatureOrPlayer;
@ -49,7 +46,7 @@ import mage.target.common.TargetCreatureOrPlayer;
*/
public class Fireblast extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("Mountain");
private static final FilterControlledPermanent filter = new FilterControlledPermanent("Mountain");
static {
filter.add(new SubtypePredicate("Mountain"));

View file

@ -53,8 +53,6 @@ public class CometStorm extends CardImpl {
super(ownerId, 76, "Comet Storm", Rarity.MYTHIC, new CardType[]{CardType.INSTANT}, "{X}{R}{R}");
this.expansionSetCode = "WWK";
this.color.setRed(true);
// Multikicker {1}
this.addAbility(new MultikickerAbility("{1}"));
@ -96,8 +94,8 @@ class CometStormEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
int damage = source.getManaCostsToPay().getX();
Player you = game.getPlayer(source.getControllerId());
if (you != null) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
for (UUID uuid : this.getTargetPointer().getTargets(game, source)) {
Permanent permanent = game.getPermanent(uuid);
Player player = game.getPlayer(uuid);
@ -105,7 +103,7 @@ class CometStormEffect extends OneShotEffect {
permanent.damage(damage, source.getSourceId(), game, false, true);
}
if (player != null) {
player.damage(damage, source.getSourceId(), game, true, false);
player.damage(damage, source.getSourceId(), game, false, true);
}
}
return true;

View file

@ -100,7 +100,7 @@ public class StoneforgeMystic extends CardImpl {
class StoneforgeMysticEffect extends OneShotEffect {
private static final FilterArtifactCard filter = new FilterArtifactCard("Equipment card");
private static final FilterArtifactCard filter = new FilterArtifactCard("an Equipment card from your hand");
static {
filter.add(new SubtypePredicate("Equipment"));
@ -124,7 +124,7 @@ class StoneforgeMysticEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Target target = new TargetCardInHand(new FilterArtifactCard("an Equipment card from your hand"));
Target target = new TargetCardInHand(filter);
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)
&& controller.chooseUse(outcome, "Put an Equipment from your hand to battlefield?", game)
&& controller.chooseTarget(outcome, target, source, game)) {

View file

@ -28,17 +28,17 @@
package mage.sets.worldwake;
import java.util.UUID;
import mage.constants.*;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
@ -58,7 +58,6 @@ public class TuktukScrapper extends CardImpl {
this.subtype.add("Artificer");
this.subtype.add("Ally");
this.color.setRed(true);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
@ -80,6 +79,7 @@ class TuktukScrapperTriggeredAbility extends TriggeredAbilityImpl {
public TuktukScrapperTriggeredAbility() {
super(Zone.BATTLEFIELD, new TuktukScrapperEffect(), true);
this.addTarget(new TargetArtifactPermanent());
}
public TuktukScrapperTriggeredAbility(final TuktukScrapperTriggeredAbility ability) {
@ -91,15 +91,19 @@ class TuktukScrapperTriggeredAbility extends TriggeredAbilityImpl {
return new TuktukScrapperTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getId() == this.getSourceId()) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null) {
if (permanent.getId() == this.getSourceId()) {
return true;
}
if (permanent != null
&& permanent.hasSubtype("Ally")
if (permanent.hasSubtype("Ally")
&& permanent.getControllerId().equals(this.getControllerId())) {
return true;
}
@ -115,11 +119,10 @@ class TuktukScrapperTriggeredAbility extends TriggeredAbilityImpl {
class TuktukScrapperEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterPermanent();
private static final FilterControlledPermanent filter = new FilterControlledPermanent();
static {
filter.add(new SubtypePredicate("Ally"));
filter.add(new ControllerPredicate(TargetController.YOU));
}
public TuktukScrapperEffect() {
@ -137,22 +140,18 @@ class TuktukScrapperEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
TargetArtifactPermanent target = new TargetArtifactPermanent();
Player you = game.getPlayer(source.getControllerId());
if (you != null) {
if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.DestroyPermanent, source.getControllerId(), source.getSourceId(), game)) {
Permanent targetedArtifact = game.getPermanent(target.getFirstTarget());
if (targetedArtifact != null) {
Card artifact = game.getCard(targetedArtifact.getId());
Player controller = game.getPlayer(targetedArtifact.getControllerId());
targetedArtifact.destroy(id, game, true);
if (controller.getGraveyard().contains(artifact.getId())) {
int alliesControlled = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game);
controller.damage(alliesControlled, id, game, false, true);
return true;
}
Permanent targetArtifact = game.getPermanent(getTargetPointer().getFirst(game, source));
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && targetArtifact != null) {
targetArtifact.destroy(source.getSourceId(), game, false);
Player targetController = game.getPlayer(targetArtifact.getControllerId());
if (targetController != null && game.getState().getZone(targetArtifact.getId()).equals(Zone.GRAVEYARD)) {
int alliesControlled = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game);
if (alliesControlled > 0) {
targetController.damage(alliesControlled, source.getSourceId(), game, false, true);
}
}
return true;
}
return false;
}

View file

@ -143,7 +143,7 @@ class WorldQuellerEffect extends OneShotEffect {
type = CardType.TRIBAL;
}
if (type != null) {
FilterPermanent filter = new FilterControlledPermanent(new StringBuilder("permanent you control of type ").append(type.toString()).toString());
FilterControlledPermanent filter = new FilterControlledPermanent(new StringBuilder("permanent you control of type ").append(type.toString()).toString());
filter.add(new CardTypePredicate(type));
TargetPermanent target = new TargetControlledPermanent(1, 1, filter, false);
@ -168,7 +168,7 @@ class WorldQuellerEffect extends OneShotEffect {
Player player = game.getPlayer(playerId);
if (target.canChoose(playerId, game)) {
while (!target.isChosen() && target.canChoose(playerId, game)) {
player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
player.chooseTarget(Outcome.Sacrifice, target, source, game);
}
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) {