Merge pull request #1260 from LoneFox78/master

New cards and fixes
This commit is contained in:
LevelX2 2015-09-13 09:47:21 +02:00
commit a505173854
35 changed files with 1629 additions and 555 deletions

View file

@ -29,26 +29,18 @@ package mage.sets.conflux;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.BecomesTappedAttachedTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.abilities.effects.common.LoseLifeControllerAttachedEffect;
import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.Zone; import mage.filter.FilterPermanent;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetLandPermanent;
import mage.target.targetpointer.FixedTarget;
/** /**
* *
@ -56,7 +48,7 @@ import mage.target.targetpointer.FixedTarget;
*/ */
public class CorruptedRoots extends CardImpl { public class CorruptedRoots extends CardImpl {
private static final FilterLandPermanent filter = new FilterLandPermanent("Forest or Plains"); private static final FilterPermanent filter = new FilterPermanent("Forest or Plains");
static { static {
filter.add(Predicates.or( filter.add(Predicates.or(
@ -69,17 +61,15 @@ public class CorruptedRoots extends CardImpl {
this.expansionSetCode = "CON"; this.expansionSetCode = "CON";
this.subtype.add("Aura"); this.subtype.add("Aura");
// Enchant Forest or Plains // Enchant Forest or Plains
TargetPermanent auraTarget = new TargetLandPermanent(filter); TargetPermanent auraTarget = new TargetPermanent(filter);
this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment)); this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment));
Ability ability = new EnchantAbility(auraTarget.getTargetName()); Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability); this.addAbility(ability);
// Whenever enchanted land becomes tapped, its controller loses 2 life. // Whenever enchanted land becomes tapped, its controller loses 2 life.
this.addAbility(new CorruptedRootsTriggeredAbility()); this.addAbility(new BecomesTappedAttachedTriggeredAbility(new LoseLifeControllerAttachedEffect(2), "enchanted land"));
} }
public CorruptedRoots(final CorruptedRoots card) { public CorruptedRoots(final CorruptedRoots card) {
@ -91,44 +81,3 @@ public class CorruptedRoots extends CardImpl {
return new CorruptedRoots(this); return new CorruptedRoots(this);
} }
} }
class CorruptedRootsTriggeredAbility extends TriggeredAbilityImpl {
CorruptedRootsTriggeredAbility() {
super(Zone.BATTLEFIELD, new LoseLifeTargetEffect(2));
}
CorruptedRootsTriggeredAbility(final CorruptedRootsTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.TAPPED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent enchantment = game.getPermanent(this.sourceId);
if (enchantment != null && enchantment.getAttachedTo().equals(event.getTargetId())) {
Permanent attached = game.getPermanent(enchantment.getAttachedTo());
if (attached != null) {
for (Effect effect : getEffects()) {
effect.setTargetPointer(new FixedTarget(attached.getControllerId()));
}
return true;
}
}
return false;
}
@Override
public CorruptedRootsTriggeredAbility copy() {
return new CorruptedRootsTriggeredAbility(this);
}
@Override
public String getRule() {
return "Whenever enchanted land becomes tapped, its controller loses 2 life.";
}
}

View file

@ -29,19 +29,15 @@ package mage.sets.dragonsmaze;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.AttacksOrBlocksEnchantedTriggeredAbility; 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.OneShotEffect;
import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.LoseLifeControllerAttachedEffect;
import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
@ -81,61 +77,3 @@ public class SinisterPossession extends CardImpl {
return new SinisterPossession(this); return new SinisterPossession(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;
setText();
}
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;
}
private void setText() {
StringBuilder sb = new StringBuilder();
sb.append("it's controller loses ").append(amount.toString()).append(" life");
String message = amount.getMessage();
if (message.length() > 0) {
sb.append(" for each ");
sb.append(message);
}
staticText = sb.toString();
}
}

View file

@ -29,23 +29,16 @@ package mage.sets.fifthedition;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.BecomesTappedAttachedTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.DestroyAttachedEffect;
import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetLandPermanent; import mage.target.common.TargetLandPermanent;
import mage.target.targetpointer.FixedTarget;
/** /**
* *
@ -67,7 +60,7 @@ public class Blight extends CardImpl {
this.addAbility(ability); this.addAbility(ability);
// When enchanted land becomes tapped, destroy it. // When enchanted land becomes tapped, destroy it.
this.addAbility(new BlightTriggeredAbility()); this.addAbility(new BecomesTappedAttachedTriggeredAbility(new DestroyAttachedEffect("it"), "enchanted land"));
} }
public Blight(final Blight card) { public Blight(final Blight card) {
@ -79,43 +72,3 @@ public class Blight extends CardImpl {
return new Blight(this); return new Blight(this);
} }
} }
class BlightTriggeredAbility extends TriggeredAbilityImpl {
BlightTriggeredAbility() {
super(Zone.BATTLEFIELD, new DestroyTargetEffect());
}
BlightTriggeredAbility(final BlightTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.TAPPED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent enchantment = game.getPermanent(this.sourceId);
if (enchantment != null && enchantment.getAttachedTo().equals(event.getTargetId())) {
Permanent attached = game.getPermanent(enchantment.getAttachedTo());
if (attached != null) {
for (Effect e : getEffects()) {
e.setTargetPointer(new FixedTarget(attached.getId()));
}
return true;
}
}
return false;
}
@Override
public BlightTriggeredAbility copy() {
return new BlightTriggeredAbility(this);
}
@Override
public String getRule() {
return "When enchanted land becomes tapped, destroy it.";
}
}

View file

@ -0,0 +1,66 @@
/*
* 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.futuresight;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.keyword.BloodthirstAbility;
import mage.abilities.keyword.FlankingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
/**
*
* @author LoneFox
*/
public class BogardanLancer extends CardImpl {
public BogardanLancer(UUID ownerId) {
super(ownerId, 95, "Bogardan Lancer", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.expansionSetCode = "FUT";
this.subtype.add("Human");
this.subtype.add("Knight");
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Bloodthirst 1
this.addAbility(new BloodthirstAbility(1));
// Flanking
this.addAbility(new FlankingAbility());
}
public BogardanLancer(final BogardanLancer card) {
super(card);
}
@Override
public BogardanLancer copy() {
return new BogardanLancer(this);
}
}

View file

@ -0,0 +1,69 @@
/*
* 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.futuresight;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.keyword.DoubleStrikeAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
/**
*
* @author LoneFox
*/
public class CharRumbler extends CardImpl {
public CharRumbler(UUID ownerId) {
super(ownerId, 96, "Char-Rumbler", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{R}{R}");
this.expansionSetCode = "FUT";
this.subtype.add("Elemental");
this.power = new MageInt(-1);
this.toughness = new MageInt(3);
// Double strike
this.addAbility(DoubleStrikeAbility.getInstance());
// {R}: Char-Rumbler gets +1/+0 until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{R}")));
}
public CharRumbler(final CharRumbler card) {
super(card);
}
@Override
public CharRumbler copy() {
return new CharRumbler(this);
}
}

View file

@ -0,0 +1,94 @@
/*
* 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.futuresight;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.CanBlockOnlyFlyingAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.DiscardCardCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.permanent.token.Token;
/**
*
* @author LoneFox
*/
public class Cloudseeder extends CardImpl {
public Cloudseeder(UUID ownerId) {
super(ownerId, 33, "Cloudseeder", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{U}");
this.expansionSetCode = "FUT";
this.subtype.add("Faerie");
this.subtype.add("Spellshaper");
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Flying
this.addAbility(FlyingAbility.getInstance());
// {U}, {tap}, Discard a card: Put a 1/1 blue Faerie creature token named Cloud Sprite onto the battlefield. It has flying and "Cloud Sprite can block only creatures with flying."
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new CloudSpriteToken()), new ManaCostsImpl("{U}"));
ability.addCost(new TapSourceCost());
ability.addCost(new DiscardCardCost());
this.addAbility(ability);
}
public Cloudseeder(final Cloudseeder card) {
super(card);
}
@Override
public Cloudseeder copy() {
return new Cloudseeder(this);
}
}
class CloudSpriteToken extends Token {
public CloudSpriteToken() {
super("Cloud Sprite", "1/1 blue faerie creature token named Cloud Sprite with flying and \"Cloud Sprite can block only creatures with flying.\"");
this.setOriginalExpansionSetCode("FUT");
cardType.add(CardType.CREATURE);
color.setBlue(true);
subtype.add("Faerie");
power = new MageInt(1);
toughness = new MageInt(1);
this.addAbility(FlyingAbility.getInstance());
this.addAbility(new CanBlockOnlyFlyingAbility());
}
}

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.futuresight;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.keyword.ScryEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
/**
*
* @author LoneFox
*/
public class CrypticAnnelid extends CardImpl {
public CrypticAnnelid(UUID ownerId) {
super(ownerId, 34, "Cryptic Annelid", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{U}");
this.expansionSetCode = "FUT";
this.subtype.add("Worm");
this.subtype.add("Beast");
this.power = new MageInt(1);
this.toughness = new MageInt(4);
// When Cryptic Annelid enters the battlefield, scry 1, then scry 2, then scry 3.
Ability ability = new EntersBattlefieldTriggeredAbility(new ScryEffect(1));
Effect effect = new ScryEffect(2);
effect.setText(", then scry 2");
ability.addEffect(effect);
effect = new ScryEffect(3);
effect.setText(", then scry 3");
ability.addEffect(effect);
this.addAbility(ability);
}
public CrypticAnnelid(final CrypticAnnelid card) {
super(card);
}
@Override
public CrypticAnnelid copy() {
return new CrypticAnnelid(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.futuresight;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.keyword.FlankingAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.SuspendAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
/**
*
* @author LoneFox
*/
public class KnightOfSursi extends CardImpl {
public KnightOfSursi(UUID ownerId) {
super(ownerId, 10, "Knight of Sursi", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{W}");
this.expansionSetCode = "FUT";
this.subtype.add("Human");
this.subtype.add("Knight");
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Flying
this.addAbility(FlyingAbility.getInstance());
// flanking
this.addAbility(new FlankingAbility());
// Suspend 3-{W}
this.addAbility(new SuspendAbility(3, new ManaCostsImpl("{W}"), this));
}
public KnightOfSursi(final KnightOfSursi card) {
super(card);
}
@Override
public KnightOfSursi copy() {
return new KnightOfSursi(this);
}
}

View file

@ -0,0 +1,90 @@
/*
* 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.futuresight;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.DiscardCardCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.mana.GreenManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.permanent.token.Token;
/**
*
* @author LoneFox
*/
public class LlanowarMentor extends CardImpl {
public LlanowarMentor(UUID ownerId) {
super(ownerId, 131, "Llanowar Mentor", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{G}");
this.expansionSetCode = "FUT";
this.subtype.add("Elf");
this.subtype.add("Spellshaper");
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// {G}, {tap}, Discard a card: Put a 1/1 green Elf Druid creature token named Llanowar Elves onto the battlefield. It has "{tap}: Add {G} to your mana pool."
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new LlanowarElvesToken()), new ManaCostsImpl("{G}"));
ability.addCost(new TapSourceCost());
ability.addCost(new DiscardCardCost());
this.addAbility(ability);
}
public LlanowarMentor(final LlanowarMentor card) {
super(card);
}
@Override
public LlanowarMentor copy() {
return new LlanowarMentor(this);
}
}
class LlanowarElvesToken extends Token {
public LlanowarElvesToken() {
super("Llanowar Elves", "1/1 green Elf Druid creature token named Llanowar Elves with \"{T}: Add {G} to your mana pool.\"");
this.setOriginalExpansionSetCode("FUT");
cardType.add(CardType.CREATURE);
color.setGreen(true);
subtype.add("Elf");
subtype.add("Druid");
power = new MageInt(1);
toughness = new MageInt(1);
this.addAbility(new GreenManaAbility());
}
}

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.futuresight;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.BecomesTappedAttachedTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.DestroyAttachedEffect;
import mage.abilities.effects.common.LoseLifeControllerAttachedEffect;
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.TargetLandPermanent;
/**
*
* @author LoneFox
*/
public class PoolingVenom extends CardImpl {
public PoolingVenom(UUID ownerId) {
super(ownerId, 74, "Pooling Venom", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}");
this.expansionSetCode = "FUT";
this.subtype.add("Aura");
// Enchant land
TargetPermanent auraTarget = new TargetLandPermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Whenever enchanted land becomes tapped, its controller loses 2 life.
this.addAbility(new BecomesTappedAttachedTriggeredAbility(new LoseLifeControllerAttachedEffect(2), "enchanted land"));
// {3}{B}: Destroy enchanted land.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyAttachedEffect("enchanted land"), new ManaCostsImpl("{3}{B}")));
}
public PoolingVenom(final PoolingVenom card) {
super(card);
}
@Override
public PoolingVenom copy() {
return new PoolingVenom(this);
}
}

View file

@ -0,0 +1,96 @@
/*
* 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.futuresight;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.Ability;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.DiscardCardCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.permanent.token.Token;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LoneFox
*/
public class SkirkRidgeExhumer extends CardImpl {
public SkirkRidgeExhumer(UUID ownerId) {
super(ownerId, 77, "Skirk Ridge Exhumer", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{B}");
this.expansionSetCode = "FUT";
this.subtype.add("Zombie");
this.subtype.add("Spellshaper");
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// {B}, {tap}, Discard a card: Put a 1/1 black Zombie Goblin creature token named Festering Goblin onto the battlefield. It has "When Festering Goblin dies, target creature gets -1/-1 until end of turn."
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new FesteringGoblinToken()), new ManaCostsImpl("{B}"));
ability.addCost(new TapSourceCost());
ability.addCost(new DiscardCardCost());
this.addAbility(ability);
}
public SkirkRidgeExhumer(final SkirkRidgeExhumer card) {
super(card);
}
@Override
public SkirkRidgeExhumer copy() {
return new SkirkRidgeExhumer(this);
}
}
class FesteringGoblinToken extends Token {
public FesteringGoblinToken() {
super("Festering Goblin", "1/1 black Zombie Goblin creature token named Festering Goblin with \"When Festering Goblin dies, target creature gets -1/-1 until end of turn.\"");
this.setOriginalExpansionSetCode("FUT");
cardType.add(CardType.CREATURE);
color.setBlack(true);
subtype.add("Zombie");
subtype.add("Goblin");
power = new MageInt(1);
toughness = new MageInt(1);
Ability ability = new DiesTriggeredAbility(new BoostTargetEffect(-1, -1, Duration.EndOfTurn), false);
ability.addTarget(new TargetCreaturePermanent());
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.futuresight;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.DiscardCardCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.permanent.token.Token;
/**
*
* @author LoneFox
*/
public class Sparkspitter extends CardImpl {
public Sparkspitter(UUID ownerId) {
super(ownerId, 109, "Sparkspitter", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{R}");
this.expansionSetCode = "FUT";
this.subtype.add("Elemental");
this.subtype.add("Spellshaper");
this.power = new MageInt(1);
this.toughness = new MageInt(3);
// {R}, {tap}, Discard a card: Put a 3/1 red Elemental creature token named Spark Elemental onto the battlefield. It has trample, haste, and "At the beginning of the end step, sacrifice Spark Elemental."
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new SparkElementalToken()), new ManaCostsImpl("{R}"));
ability.addCost(new TapSourceCost());
ability.addCost(new DiscardCardCost());
this.addAbility(ability);
}
public Sparkspitter(final Sparkspitter card) {
super(card);
}
@Override
public Sparkspitter copy() {
return new Sparkspitter(this);
}
}
class SparkElementalToken extends Token {
public SparkElementalToken() {
super("Spark Elemental", "3/1 red Elemental creature token named Spark Elemental with trample, haste, and \"At the beginning of the end step, sacrifice Spark Elemental.\"");
this.setOriginalExpansionSetCode("FUT");
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add("Elemental");
power = new MageInt(3);
toughness = new MageInt(1);
this.addAbility(TrampleAbility.getInstance());
this.addAbility(HasteAbility.getInstance());
this.addAbility(new BeginningOfEndStepTriggeredAbility(new SacrificeSourceEffect(), TargetController.ANY, false));
}
}

View file

@ -63,7 +63,7 @@ public class Seizures extends CardImpl {
Ability ability = new EnchantAbility(auraTarget.getTargetName()); Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability); this.addAbility(ability);
// Whenever enchanted creature becomes tapped, Seizures deals 3 damage to that creature's controller unless that player pays {3}. // Whenever enchanted creature becomes tapped, Seizures deals 3 damage to that creature's controller unless that player pays {3}.
this.addAbility(new BecomesTappedAttachedTriggeredAbility(new SeizuresEffect(), false)); this.addAbility(new BecomesTappedAttachedTriggeredAbility(new SeizuresEffect(), "enchanted creature"));
} }
public Seizures(final Seizures card) { public Seizures(final Seizures card) {

View file

@ -30,22 +30,17 @@ package mage.sets.limitedalpha;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.BecomesTappedAttachedTriggeredAbility;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.DamageAttachedControllerEffect;
import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetLandPermanent; import mage.target.common.TargetLandPermanent;
import mage.target.targetpointer.FixedTarget;
/** /**
* *
@ -67,7 +62,9 @@ public class PsychicVenom extends CardImpl {
Ability ability = new EnchantAbility(auraTarget.getTargetName()); Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability); this.addAbility(ability);
// Whenever enchanted land becomes tapped, Psychic Venom deals 2 damage to that land's controller. // Whenever enchanted land becomes tapped, Psychic Venom deals 2 damage to that land's controller.
this.addAbility(new PsychicVenomAbility()); Effect effect = new DamageAttachedControllerEffect(2);
effect.setText("{this} deals 2 damage to that land's controller");
this.addAbility(new BecomesTappedAttachedTriggeredAbility(effect, "enchanted land"));
} }
public PsychicVenom(final PsychicVenom card) { public PsychicVenom(final PsychicVenom card) {
@ -79,43 +76,3 @@ public class PsychicVenom extends CardImpl {
return new PsychicVenom(this); return new PsychicVenom(this);
} }
} }
class PsychicVenomAbility extends TriggeredAbilityImpl {
PsychicVenomAbility() {
super(Zone.BATTLEFIELD, new DamageTargetEffect(2, true, "that land's controller"));
}
PsychicVenomAbility(final PsychicVenomAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.TAPPED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent source = game.getPermanent(this.sourceId);
if (source != null && source.getAttachedTo().equals(event.getTargetId())) {
Permanent attached = game.getPermanent(source.getAttachedTo());
if (attached != null) {
for (Effect e : getEffects()) {
e.setTargetPointer(new FixedTarget(attached.getControllerId()));
}
return true;
}
}
return false;
}
@Override
public PsychicVenomAbility copy() {
return new PsychicVenomAbility(this);
}
@Override
public String getRule() {
return "Whenever enchanted land becomes tapped, " + super.getRule();
}
}

View file

@ -0,0 +1,58 @@
/*
* 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.masterseditioniv;
import java.util.UUID;
import mage.abilities.effects.common.turn.AddExtraTurnControllerEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
/**
*
* @author LoneFox
*/
public class LastChance extends CardImpl {
public LastChance(UUID ownerId) {
super(ownerId, 125, "Last Chance", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{R}{R}");
this.expansionSetCode = "ME4";
// Take an extra turn after this one. At the beginning of that turn's end step, you lose the game.
this.getSpellAbility().addEffect(new AddExtraTurnControllerEffect(true));
}
public LastChance(final LastChance card) {
super(card);
}
@Override
public LastChance copy() {
return new LastChance(this);
}
}

View file

@ -30,19 +30,14 @@ package mage.sets.ninthedition;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.AttacksOrBlocksEnchantedTriggeredAbility; 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.AttachEffect;
import mage.abilities.effects.common.LoseLifeControllerAttachedEffect;
import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
@ -77,50 +72,3 @@ public class ContaminatedBond extends CardImpl {
return new ContaminatedBond(this); 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

@ -60,7 +60,7 @@ public class Insolence extends CardImpl {
Ability ability = new EnchantAbility(auraTarget.getTargetName()); Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability); this.addAbility(ability);
// Whenever enchanted creature becomes tapped, Insolence deals 2 damage to that creature's controller. // Whenever enchanted creature becomes tapped, Insolence deals 2 damage to that creature's controller.
this.addAbility(new BecomesTappedAttachedTriggeredAbility(new DamageAttachedControllerEffect(2), false)); this.addAbility(new BecomesTappedAttachedTriggeredAbility(new DamageAttachedControllerEffect(2), "enchanted creature"));
} }
public Insolence(final Insolence card) { public Insolence(final Insolence card) {

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.portal;
import java.util.UUID;
/**
*
* @author LoneFox
*/
public class LastChance extends mage.sets.masterseditioniv.LastChance {
public LastChance(UUID ownerId) {
super(ownerId);
this.cardNumber = 141;
this.expansionSetCode = "POR";
}
public LastChance(final LastChance card) {
super(card);
}
@Override
public LastChance copy() {
return new LastChance(this);
}
}

View file

@ -0,0 +1,58 @@
/*
* 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.portalthreekingdoms;
import java.util.UUID;
import mage.abilities.effects.common.turn.AddExtraTurnControllerEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
/**
*
* @author LoneFox
*/
public class WarriorsOath extends CardImpl {
public WarriorsOath(UUID ownerId) {
super(ownerId, 124, "Warrior's Oath", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{R}{R}");
this.expansionSetCode = "PTK";
// Take an extra turn after this one. At the beginning of that turn's end step, you lose the game.
this.getSpellAbility().addEffect(new AddExtraTurnControllerEffect(true));
}
public WarriorsOath(final WarriorsOath card) {
super(card);
}
@Override
public WarriorsOath copy() {
return new WarriorsOath(this);
}
}

View file

@ -29,11 +29,10 @@ package mage.sets.riseoftheeldrazi;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.BecomesTappedAttachedTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.abilities.effects.common.LoseLifeControllerAttachedEffect;
import mage.abilities.effects.common.continuous.BecomesBasicLandEnchantedEffect; import mage.abilities.effects.common.continuous.BecomesBasicLandEnchantedEffect;
import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -41,13 +40,8 @@ import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetLandPermanent; import mage.target.common.TargetLandPermanent;
import mage.target.targetpointer.FixedTarget;
/** /**
* @author Loki * @author Loki
@ -71,7 +65,7 @@ public class ContaminatedGround extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesBasicLandEnchantedEffect("Swamp"))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesBasicLandEnchantedEffect("Swamp")));
// Whenever enchanted land becomes tapped, its controller loses 2 life. // Whenever enchanted land becomes tapped, its controller loses 2 life.
this.addAbility(new ContaminatedGroundAbility()); this.addAbility(new BecomesTappedAttachedTriggeredAbility(new LoseLifeControllerAttachedEffect(2), "enchanted land"));
} }
public ContaminatedGround(final ContaminatedGround card) { public ContaminatedGround(final ContaminatedGround card) {
@ -83,44 +77,3 @@ public class ContaminatedGround extends CardImpl {
return new ContaminatedGround(this); return new ContaminatedGround(this);
} }
} }
class ContaminatedGroundAbility extends TriggeredAbilityImpl {
ContaminatedGroundAbility() {
super(Zone.BATTLEFIELD, new LoseLifeTargetEffect(2));
}
ContaminatedGroundAbility(final ContaminatedGroundAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.TAPPED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent source = game.getPermanent(this.sourceId);
if (source != null && source.getAttachedTo().equals(event.getTargetId())) {
Permanent attached = game.getPermanent(source.getAttachedTo());
if (attached != null) {
for (Effect e : getEffects()) {
e.setTargetPointer(new FixedTarget(attached.getControllerId()));
}
return true;
}
}
return false;
}
@Override
public ContaminatedGroundAbility copy() {
return new ContaminatedGroundAbility(this);
}
@Override
public String getRule() {
return "Whenever enchanted land becomes tapped, its controller loses 2 life.";
}
}

View file

@ -64,7 +64,7 @@ public class LustForWar extends CardImpl {
this.addAbility(ability); this.addAbility(ability);
// Whenever enchanted creature becomes tapped, Lust for War deals 3 damage to that creature's controller. // Whenever enchanted creature becomes tapped, Lust for War deals 3 damage to that creature's controller.
this.addAbility(new BecomesTappedAttachedTriggeredAbility(new DamageAttachedControllerEffect(3), false)); this.addAbility(new BecomesTappedAttachedTriggeredAbility(new DamageAttachedControllerEffect(3), "enchanted creature"));
// Enchanted creature attacks each turn if able. // Enchanted creature attacks each turn if able.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,

View file

@ -0,0 +1,69 @@
/*
* 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.MageInt;
import mage.abilities.common.TurnedFaceUpAllTriggeredAbility;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
/**
*
* @author LoneFox
*/
public class AvenFarseer extends CardImpl {
public AvenFarseer(UUID ownerId) {
super(ownerId, 3, "Aven Farseer", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{W}");
this.expansionSetCode = "SCG";
this.subtype.add("Bird");
this.subtype.add("Soldier");
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever a permanent is turned face up, put a +1/+1 counter on Aven Farseer.
this.addAbility(new TurnedFaceUpAllTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), new FilterPermanent("a permanent")));
}
public AvenFarseer(final AvenFarseer card) {
super(card);
}
@Override
public AvenFarseer copy() {
return new AvenFarseer(this);
}
}

View file

@ -0,0 +1,115 @@
/*
* 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.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.DestroyAttachedEffect;
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.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LoneFox
*/
public class FatalMutation extends CardImpl {
public FatalMutation(UUID ownerId) {
super(ownerId, 66, "Fatal Mutation", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{B}");
this.expansionSetCode = "SCG";
this.subtype.add("Aura");
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// When enchanted creature is turned face up, destroy it. It can't be regenerated.
this.addAbility(new FatalMutationAbility(new DestroyAttachedEffect("it", true)));
}
public FatalMutation(final FatalMutation card) {
super(card);
}
@Override
public FatalMutation copy() {
return new FatalMutation(this);
}
}
class FatalMutationAbility extends TriggeredAbilityImpl {
public FatalMutationAbility(Effect effect) {
super(Zone.BATTLEFIELD, effect, false);
}
public FatalMutationAbility(final FatalMutationAbility ability) {
super(ability);
}
@Override
public FatalMutationAbility copy() {
return new FatalMutationAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.TURNEDFACEUP;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent attachment = game.getPermanent(this.getSourceId());
if(attachment != null && event.getTargetId().equals(attachment.getAttachedTo())) {
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever enchanted creature is turned face up, " + super.getRule();
}
}

View file

@ -0,0 +1,68 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.scourge;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.TurnedFaceUpSourceTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.keyword.MorphAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.common.FilterCreatureCard;
/**
*
* @author LoneFox
*/
public class RootElemental extends CardImpl {
public RootElemental(UUID ownerId) {
super(ownerId, 127, "Root Elemental", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{G}{G}");
this.expansionSetCode = "SCG";
this.subtype.add("Elemental");
this.power = new MageInt(6);
this.toughness = new MageInt(5);
// Morph {5}{G}{G}
this.addAbility(new MorphAbility(this, new ManaCostsImpl("{5}{G}{G}")));
// When Root Elemental is turned face up, you may put a creature card from your hand onto the battlefield.
this.addAbility(new TurnedFaceUpSourceTriggeredAbility(new PutPermanentOnBattlefieldEffect(new FilterCreatureCard("a creature card"))));
}
public RootElemental(final RootElemental card) {
super(card);
}
@Override
public RootElemental copy() {
return new RootElemental(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.scourge;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.BecomesTappedAttachedTriggeredAbility;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.DestroyAttachedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.target.TargetPermanent;
import mage.target.common.TargetLandPermanent;
/**
*
* @author LoneFox
*/
public class UncontrolledInfestation extends CardImpl {
private static final FilterLandPermanent filter = new FilterLandPermanent("nonbasic land");
static{
filter.add(Predicates.not(new SupertypePredicate("Basic")));
}
public UncontrolledInfestation(UUID ownerId) {
super(ownerId, 108, "Uncontrolled Infestation", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
this.expansionSetCode = "SCG";
this.subtype.add("Aura");
// Enchant nonbasic land
TargetPermanent auraTarget = new TargetLandPermanent(filter);
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// When enchanted land becomes tapped, destroy it.
this.addAbility(new BecomesTappedAttachedTriggeredAbility(new DestroyAttachedEffect("it"), "enchanted land"));
}
public UncontrolledInfestation(final UncontrolledInfestation card) {
super(card);
}
@Override
public UncontrolledInfestation copy() {
return new UncontrolledInfestation(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.scourge;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.MorphAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.target.common.TargetCreaturePermanent;
import mage.abilities.common.TurnedFaceUpSourceTriggeredAbility;
/**
*
* @author LoneFox
*/
public class Woodcloaker extends CardImpl {
public Woodcloaker(UUID ownerId) {
super(ownerId, 134, "Woodcloaker", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{5}{G}");
this.expansionSetCode = "SCG";
this.subtype.add("Elf");
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Morph {2}{G}{G}
this.addAbility(new MorphAbility(this, new ManaCostsImpl("{2}{G}{G}")));
// When Woodcloaker is turned face up, target creature gains trample until end of turn.
Ability ability = new TurnedFaceUpSourceTriggeredAbility(new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn));
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
public Woodcloaker(final Woodcloaker card) {
super(card);
}
@Override
public Woodcloaker copy() {
return new Woodcloaker(this);
}
}

View file

@ -28,19 +28,10 @@
package mage.sets.seventhedition; package mage.sets.seventhedition;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.effects.common.turn.AddExtraTurnControllerEffect;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.turn.TurnMod;
import mage.players.Player;
/** /**
* *
@ -52,9 +43,8 @@ public class FinalFortune extends CardImpl {
super(ownerId, 182, "Final Fortune", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{R}{R}"); super(ownerId, 182, "Final Fortune", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{R}{R}");
this.expansionSetCode = "7ED"; this.expansionSetCode = "7ED";
// Take an extra turn after this one. At the beginning of that turn's end step, you lose the game. // Take an extra turn after this one. At the beginning of that turn's end step, you lose the game.
this.getSpellAbility().addEffect(new FinalFortuneEffect()); this.getSpellAbility().addEffect(new AddExtraTurnControllerEffect(true));
} }
public FinalFortune(final FinalFortune card) { public FinalFortune(final FinalFortune card) {
@ -66,103 +56,3 @@ public class FinalFortune extends CardImpl {
return new FinalFortune(this); return new FinalFortune(this);
} }
} }
class FinalFortuneEffect extends OneShotEffect {
public FinalFortuneEffect() {
super(Outcome.AIDontUseIt);
this.staticText = "Take an extra turn after this one. At the beginning of that turn's end step, you lose the game.";
}
public FinalFortuneEffect(final FinalFortuneEffect effect) {
super(effect);
}
@Override
public FinalFortuneEffect copy() {
return new FinalFortuneEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
// Take an extra turn after this one
TurnMod extraTurn = new TurnMod(source.getControllerId(), false);
game.getState().getTurnMods().add(extraTurn);
FinalFortuneLoseDelayedTriggeredAbility delayedTriggeredAbility = new FinalFortuneLoseDelayedTriggeredAbility();
delayedTriggeredAbility.setSourceId(source.getSourceId());
delayedTriggeredAbility.setControllerId(source.getControllerId());
delayedTriggeredAbility.setConnectedTurnMod(extraTurn.getId());
game.addDelayedTriggeredAbility(delayedTriggeredAbility);
return true;
}
}
class FinalFortuneLoseDelayedTriggeredAbility extends DelayedTriggeredAbility {
private UUID connectedTurnMod;
public FinalFortuneLoseDelayedTriggeredAbility() {
super(new FinalFortuneLoseEffect(), Duration.EndOfGame);
}
public FinalFortuneLoseDelayedTriggeredAbility(final FinalFortuneLoseDelayedTriggeredAbility ability) {
super(ability);
this.connectedTurnMod = ability.connectedTurnMod;
}
@Override
public FinalFortuneLoseDelayedTriggeredAbility copy() {
return new FinalFortuneLoseDelayedTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.END_TURN_STEP_PRE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return connectedTurnMod != null && connectedTurnMod.equals(game.getState().getTurnId());
}
public void setConnectedTurnMod(UUID connectedTurnMod) {
this.connectedTurnMod = connectedTurnMod;
}
@Override
public String getRule() {
return "At the beginning of that turn's end step, you lose the game";
}
}
class FinalFortuneLoseEffect extends OneShotEffect {
public FinalFortuneLoseEffect() {
super(Outcome.Detriment);
this.staticText = "You lose the game";
}
public FinalFortuneLoseEffect(final FinalFortuneLoseEffect effect) {
super(effect);
}
@Override
public FinalFortuneLoseEffect copy() {
return new FinalFortuneLoseEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
player.lost(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.starter1999;
import java.util.UUID;
/**
*
* @author LoneFox
*/
public class LastChance extends mage.sets.masterseditioniv.LastChance {
public LastChance(UUID ownerId) {
super(ownerId);
this.cardNumber = 110;
this.expansionSetCode = "S99";
}
public LastChance(final LastChance card) {
super(card);
}
@Override
public LastChance copy() {
return new LastChance(this);
}
}

View file

@ -29,11 +29,10 @@ package mage.sets.urzassaga;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.BecomesTappedAttachedTriggeredAbility;
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility; import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.DestroyAttachedEffect;
import mage.abilities.effects.common.ReturnToHandSourceEffect; import mage.abilities.effects.common.ReturnToHandSourceEffect;
import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -41,15 +40,9 @@ import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterLandPermanent; import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetLandPermanent;
import mage.target.targetpointer.FixedTarget;
/** /**
* *
@ -57,25 +50,25 @@ import mage.target.targetpointer.FixedTarget;
*/ */
public class SpreadingAlgae extends CardImpl { public class SpreadingAlgae extends CardImpl {
private static final FilterLandPermanent filter = new FilterLandPermanent("Swamp"); private static final FilterPermanent filter = new FilterPermanent("Swamp");
static{ static{
filter.add(new SubtypePredicate("Swamp")); filter.add(new SubtypePredicate("Swamp"));
} }
public SpreadingAlgae(UUID ownerId) { public SpreadingAlgae(UUID ownerId) {
super(ownerId, 274, "Spreading Algae", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{G}"); super(ownerId, 274, "Spreading Algae", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{G}");
this.expansionSetCode = "USG"; this.expansionSetCode = "USG";
this.subtype.add("Aura"); this.subtype.add("Aura");
// Enchant Swamp // Enchant Swamp
TargetPermanent auraTarget = new TargetPermanent(filter);
TargetPermanent auraTarget = new TargetLandPermanent();
this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility)); this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment));
Ability ability = new EnchantAbility(auraTarget.getTargetName()); Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability); this.addAbility(ability);
// When enchanted land becomes tapped, destroy it. // When enchanted land becomes tapped, destroy it.
this.addAbility(new SpreadingAlgaeTriggeredAbility(new DestroyTargetEffect())); this.addAbility(new BecomesTappedAttachedTriggeredAbility(new DestroyAttachedEffect("it"), "enchanted land"));
// When Spreading Algae is put into a graveyard from the battlefield, return Spreading Algae to its owner's hand. // When Spreading Algae is put into a graveyard from the battlefield, return Spreading Algae to its owner's hand.
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new ReturnToHandSourceEffect())); this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new ReturnToHandSourceEffect()));
@ -91,43 +84,3 @@ public class SpreadingAlgae extends CardImpl {
return new SpreadingAlgae(this); return new SpreadingAlgae(this);
} }
} }
class SpreadingAlgaeTriggeredAbility extends TriggeredAbilityImpl {
public SpreadingAlgaeTriggeredAbility(Effect effect) {
super(Zone.BATTLEFIELD, effect);
}
public SpreadingAlgaeTriggeredAbility(final SpreadingAlgaeTriggeredAbility ability) {
super(ability);
}
@Override
public SpreadingAlgaeTriggeredAbility copy() {
return new SpreadingAlgaeTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.TAPPED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent enchant = game.getPermanent(sourceId);
if (enchant != null && enchant.getAttachedTo() != null) {
if (event.getTargetId().equals(enchant.getAttachedTo())) {
getEffects().get(0).setTargetPointer(new FixedTarget(enchant.getAttachedTo()));
return true;
}
}
return false;
}
@Override
public String getRule() {
return "When enchanted permanent becomes tapped, destroy it.";
}
}

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.venservskoth;
import java.util.UUID;
/**
*
* @author LoneFox
*/
public class CrypticAnnelid extends mage.sets.futuresight.CrypticAnnelid {
public CrypticAnnelid(UUID ownerId) {
super(ownerId);
this.cardNumber = 15;
this.expansionSetCode = "DDI";
}
public CrypticAnnelid(final CrypticAnnelid card) {
super(card);
}
@Override
public CrypticAnnelid copy() {
return new CrypticAnnelid(this);
}
}

View file

@ -67,7 +67,7 @@ public class Betrayal extends CardImpl {
Ability ability = new EnchantAbility(auraTarget.getTargetName()); Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability); this.addAbility(ability);
// Whenever enchanted creature becomes tapped, you draw a card. // Whenever enchanted creature becomes tapped, you draw a card.
this.addAbility(new BecomesTappedAttachedTriggeredAbility(new DrawCardSourceControllerEffect(1), false)); this.addAbility(new BecomesTappedAttachedTriggeredAbility(new DrawCardSourceControllerEffect(1), "enchanted creature"));
} }
public Betrayal(final Betrayal card) { public Betrayal(final Betrayal card) {

View file

@ -28,24 +28,19 @@
package mage.sets.worldwake; package mage.sets.worldwake;
import java.util.UUID; import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.Ability;
import mage.abilities.effects.Effect; import mage.abilities.common.BecomesTappedAttachedTriggeredAbility;
import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.DestroyAttachedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.targetpointer.FixedTarget;
/** /**
* *
@ -53,7 +48,7 @@ import mage.target.targetpointer.FixedTarget;
*/ */
public class BrinkOfDisaster extends CardImpl { public class BrinkOfDisaster extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent(); private static final FilterPermanent filter = new FilterPermanent("creature or land");
static { static {
filter.add(Predicates.or( filter.add(Predicates.or(
@ -68,12 +63,14 @@ public class BrinkOfDisaster extends CardImpl {
// Enchant creature or land // Enchant creature or land
TargetPermanent auraTarget = new TargetPermanent(); TargetPermanent auraTarget = new TargetPermanent(filter);
this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility)); this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// When enchanted permanent becomes tapped, destroy it. // When enchanted permanent becomes tapped, destroy it.
this.addAbility(new EnchantedBecomesTappedTriggeredAbility(new DestroyTargetEffect())); this.addAbility(new BecomesTappedAttachedTriggeredAbility(new DestroyAttachedEffect("it"), "enchanted permanent"));
} }
public BrinkOfDisaster(final BrinkOfDisaster card) { public BrinkOfDisaster(final BrinkOfDisaster card) {
@ -85,41 +82,3 @@ public class BrinkOfDisaster extends CardImpl {
return new BrinkOfDisaster(this); return new BrinkOfDisaster(this);
} }
} }
class EnchantedBecomesTappedTriggeredAbility extends TriggeredAbilityImpl {
public EnchantedBecomesTappedTriggeredAbility(Effect effect) {
super(Zone.BATTLEFIELD, effect);
}
public EnchantedBecomesTappedTriggeredAbility(final EnchantedBecomesTappedTriggeredAbility ability) {
super(ability);
}
@Override
public EnchantedBecomesTappedTriggeredAbility copy() {
return new EnchantedBecomesTappedTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.TAPPED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent enchant = game.getPermanent(sourceId);
if (enchant != null && enchant.getAttachedTo() != null) {
if (event.getTargetId().equals(enchant.getAttachedTo())) {
getEffects().get(0).setTargetPointer(new FixedTarget(enchant.getAttachedTo()));
return true;
}
}
return false;
}
@Override
public String getRule() {
return "When enchanted permanent becomes tapped, destroy it.";
}
}

View file

@ -41,16 +41,20 @@ import mage.game.permanent.Permanent;
*/ */
public class BecomesTappedAttachedTriggeredAbility extends TriggeredAbilityImpl { public class BecomesTappedAttachedTriggeredAbility extends TriggeredAbilityImpl {
public BecomesTappedAttachedTriggeredAbility(Effect effect, boolean isOptional) { private final String description;
super(Zone.BATTLEFIELD, effect, isOptional);
public BecomesTappedAttachedTriggeredAbility(Effect effect, String description) {
this(effect, description, false);
} }
public BecomesTappedAttachedTriggeredAbility(Effect effect) { public BecomesTappedAttachedTriggeredAbility(Effect effect, String description, boolean isOptional) {
super(Zone.BATTLEFIELD, effect); super(Zone.BATTLEFIELD, effect, isOptional);
this.description = description;
} }
public BecomesTappedAttachedTriggeredAbility(final BecomesTappedAttachedTriggeredAbility ability) { public BecomesTappedAttachedTriggeredAbility(final BecomesTappedAttachedTriggeredAbility ability) {
super(ability); super(ability);
this.description = ability.description;
} }
@Override @Override
@ -75,6 +79,6 @@ public class BecomesTappedAttachedTriggeredAbility extends TriggeredAbilityImpl
@Override @Override
public String getRule() { public String getRule() {
return "Whenever enchanted creature becomes tapped, " + super.getRule(); return "Whenever " + description + " becomes tapped, " + super.getRule();
} }
} }

View file

@ -0,0 +1,98 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
public class LoseLifeControllerAttachedEffect extends OneShotEffect {
protected DynamicValue amount;
public LoseLifeControllerAttachedEffect(int amount) {
this(new StaticValue(amount));
}
public LoseLifeControllerAttachedEffect(DynamicValue amount) {
super(Outcome.LoseLife);
this.amount = amount;
setText();
}
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;
}
private void setText() {
StringBuilder sb = new StringBuilder();
sb.append("it's controller loses ").append(amount.toString()).append(" life");
String message = amount.getMessage();
if (message.length() > 0) {
sb.append(" for each ");
sb.append(message);
}
staticText = sb.toString();
}
}

View file

@ -27,10 +27,16 @@
*/ */
package mage.abilities.effects.common.turn; package mage.abilities.effects.common.turn;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.LoseGameSourceControllerEffect;
import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.turn.TurnMod; import mage.game.turn.TurnMod;
import mage.players.Player; import mage.players.Player;
@ -39,13 +45,24 @@ import mage.players.Player;
*/ */
public class AddExtraTurnControllerEffect extends OneShotEffect { public class AddExtraTurnControllerEffect extends OneShotEffect {
private final boolean loseGameAtEnd;
public AddExtraTurnControllerEffect() { public AddExtraTurnControllerEffect() {
super(Outcome.ExtraTurn); this(false);
}
public AddExtraTurnControllerEffect(boolean loseGameAtEnd) {
super(loseGameAtEnd ? Outcome.AIDontUseIt : Outcome.ExtraTurn);
this.loseGameAtEnd = loseGameAtEnd;
staticText = "Take an extra turn after this one"; staticText = "Take an extra turn after this one";
if(loseGameAtEnd) {
staticText += ". At the beginning of that turn's end step, you lose the game";
}
} }
public AddExtraTurnControllerEffect(final AddExtraTurnControllerEffect effect) { public AddExtraTurnControllerEffect(final AddExtraTurnControllerEffect effect) {
super(effect); super(effect);
this.loseGameAtEnd = effect.loseGameAtEnd;
} }
@Override @Override
@ -57,9 +74,55 @@ public class AddExtraTurnControllerEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
if (player != null) { if (player != null) {
game.getState().getTurnMods().add(new TurnMod(player.getId(), false)); TurnMod extraTurn = new TurnMod(player.getId(), false);
game.getState().getTurnMods().add(extraTurn);
if(loseGameAtEnd) {
LoseGameDelayedTriggeredAbility delayedTriggeredAbility = new LoseGameDelayedTriggeredAbility();
delayedTriggeredAbility.setSourceId(source.getSourceId());
delayedTriggeredAbility.setControllerId(source.getControllerId());
delayedTriggeredAbility.setConnectedTurnMod(extraTurn.getId());
game.addDelayedTriggeredAbility(delayedTriggeredAbility);
}
} }
return true; return true;
} }
} }
class LoseGameDelayedTriggeredAbility extends DelayedTriggeredAbility {
private UUID connectedTurnMod;
public LoseGameDelayedTriggeredAbility() {
super(new LoseGameSourceControllerEffect(), Duration.EndOfGame);
}
public LoseGameDelayedTriggeredAbility(final LoseGameDelayedTriggeredAbility ability) {
super(ability);
this.connectedTurnMod = ability.connectedTurnMod;
}
@Override
public LoseGameDelayedTriggeredAbility copy() {
return new LoseGameDelayedTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.END_TURN_STEP_PRE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return connectedTurnMod != null && connectedTurnMod.equals(game.getState().getTurnId());
}
public void setConnectedTurnMod(UUID connectedTurnMod) {
this.connectedTurnMod = connectedTurnMod;
}
@Override
public String getRule() {
return "At the beginning of that turn's end step, you lose the game";
}
}