Merge origin/master

This commit is contained in:
fireshoes 2015-09-29 17:13:43 -05:00
commit 3203df54c5
62 changed files with 1193 additions and 822 deletions

View file

@ -2565,6 +2565,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
private static void load(Preferences prefs, JCheckBox checkBox, String propName, String yesValue, String defaultValue) { private static void load(Preferences prefs, JCheckBox checkBox, String propName, String yesValue, String defaultValue) {
String prop = prefs.get(propName, defaultValue); String prop = prefs.get(propName, defaultValue);
checkBox.setSelected(prop.equals(yesValue)); checkBox.setSelected(prop.equals(yesValue));
updateCache(propName, prop);
} }
private static void load(Preferences prefs, JTextField field, String propName, String defaultValue) { private static void load(Preferences prefs, JTextField field, String propName, String defaultValue) {

View file

@ -92,6 +92,7 @@
<deckType name="Variant Magic - Commander" jar="mage-deck-constructed.jar" className="mage.deck.Commander"/> <deckType name="Variant Magic - Commander" jar="mage-deck-constructed.jar" className="mage.deck.Commander"/>
<deckType name="Variant Magic - Duel Commander" jar="mage-deck-constructed.jar" className="mage.deck.DuelCommander"/> <deckType name="Variant Magic - Duel Commander" jar="mage-deck-constructed.jar" className="mage.deck.DuelCommander"/>
<deckType name="Variant Magic - Tiny Leaders" jar="mage-deck-constructed.jar" className="mage.deck.TinyLeaders"/> <deckType name="Variant Magic - Tiny Leaders" jar="mage-deck-constructed.jar" className="mage.deck.TinyLeaders"/>
<deckType name="Block Constructed - Battle for Zendikar" jar="mage-deck-constructed.jar" className="mage.deck.BattleForZendikarBlock"/>
<deckType name="Block Constructed - Innistrad" jar="mage-deck-constructed.jar" className="mage.deck.InnistradBlock"/> <deckType name="Block Constructed - Innistrad" jar="mage-deck-constructed.jar" className="mage.deck.InnistradBlock"/>
<deckType name="Block Constructed - Kamigawa" jar="mage-deck-constructed.jar" className="mage.deck.KamigawaBlock"/> <deckType name="Block Constructed - Kamigawa" jar="mage-deck-constructed.jar" className="mage.deck.KamigawaBlock"/>
<deckType name="Block Constructed - Khans of Tarkir" jar="mage-deck-constructed.jar" className="mage.deck.KhansOfTarkirBlock"/> <deckType name="Block Constructed - Khans of Tarkir" jar="mage-deck-constructed.jar" className="mage.deck.KhansOfTarkirBlock"/>

View file

@ -71,6 +71,7 @@
<deckType name="Variant Magic - Commander" jar="mage-deck-constructed-${project.version}.jar" className="mage.deck.Commander"/> <deckType name="Variant Magic - Commander" jar="mage-deck-constructed-${project.version}.jar" className="mage.deck.Commander"/>
<deckType name="Variant Magic - Duel Commander" jar="mage-deck-constructed-${project.version}.jar" className="mage.deck.DuelCommander"/> <deckType name="Variant Magic - Duel Commander" jar="mage-deck-constructed-${project.version}.jar" className="mage.deck.DuelCommander"/>
<deckType name="Variant Magic - Tiny Leaders" jar="mage-deck-constructed-${project.version}.jar" className="mage.deck.TinyLeaders"/> <deckType name="Variant Magic - Tiny Leaders" jar="mage-deck-constructed-${project.version}.jar" className="mage.deck.TinyLeaders"/>
<deckType name="Block Constructed - Battle for Zendikar" jar="mage-deck-constructed.jar" className="mage.deck.BattleForZendikarBlock"/>
<deckType name="Block Constructed - Innistrad" jar="mage-deck-constructed-${project.version}.jar" className="mage.deck.InnistradBlock"/> <deckType name="Block Constructed - Innistrad" jar="mage-deck-constructed-${project.version}.jar" className="mage.deck.InnistradBlock"/>
<deckType name="Block Constructed - Kamigawa" jar="mage-deck-constructed-${project.version}.jar" className="mage.deck.KamigawaBlock"/> <deckType name="Block Constructed - Kamigawa" jar="mage-deck-constructed-${project.version}.jar" className="mage.deck.KamigawaBlock"/>
<deckType name="Block Constructed - Khans of Tarkir" jar="mage-deck-constructed-${project.version}.jar" className="mage.deck.KhansOfTarkirBlock"/> <deckType name="Block Constructed - Khans of Tarkir" jar="mage-deck-constructed-${project.version}.jar" className="mage.deck.KhansOfTarkirBlock"/>

View file

@ -92,15 +92,15 @@ public class Session {
return "User name Admin already in use"; return "User name Admin already in use";
} }
if (userName.length() > ConfigSettings.getInstance().getMaxUserNameLength()) { if (userName.length() > ConfigSettings.getInstance().getMaxUserNameLength()) {
return new StringBuilder("User name may not be longer than ").append(ConfigSettings.getInstance().getMaxUserNameLength()).append(" characters").toString(); return "User name may not be longer than " + ConfigSettings.getInstance().getMaxUserNameLength() + " characters";
} }
if (userName.length() < ConfigSettings.getInstance().getMinUserNameLength()) { if (userName.length() < ConfigSettings.getInstance().getMinUserNameLength()) {
return new StringBuilder("User name may not be shorter than ").append(ConfigSettings.getInstance().getMinUserNameLength()).append(" characters").toString(); return "User name may not be shorter than " + ConfigSettings.getInstance().getMinUserNameLength() + " characters";
} }
Pattern p = Pattern.compile(ConfigSettings.getInstance().getUserNamePattern(), Pattern.CASE_INSENSITIVE); Pattern p = Pattern.compile(ConfigSettings.getInstance().getUserNamePattern(), Pattern.CASE_INSENSITIVE);
Matcher m = p.matcher(userName); Matcher m = p.matcher(userName);
if (m.find()) { if (m.find()) {
return new StringBuilder("User name '").append(userName).append("' includes not allowed characters: use a-z, A-Z and 0-9").toString(); return "User name '" + userName + "' includes not allowed characters: use a-z, A-Z and 0-9";
} }
User user = UserManager.getInstance().createUser(userName, host); User user = UserManager.getInstance().createUser(userName, host);
boolean reconnect = false; boolean reconnect = false;
@ -118,11 +118,11 @@ public class Session {
SessionManager.getInstance().disconnect(user.getSessionId(), DisconnectReason.ConnectingOtherInstance); SessionManager.getInstance().disconnect(user.getSessionId(), DisconnectReason.ConnectingOtherInstance);
} }
} else { } else {
return new StringBuilder("User name ").append(userName).append(" already in use (or your IP address changed)").toString(); return "User name " + userName + " already in use (or your IP address changed)";
} }
} }
if (!UserManager.getInstance().connectToSession(sessionId, user.getId())) { if (!UserManager.getInstance().connectToSession(sessionId, user.getId())) {
return new StringBuilder("Error connecting ").append(userName).toString(); return "Error connecting " + userName;
} }
this.userId = user.getId(); this.userId = user.getId();
if (reconnect) { // must be connected to receive the message if (reconnect) { // must be connected to receive the message

View file

@ -0,0 +1,88 @@
/*
* 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.alliances;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SkipUntapOptionalAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.DontUntapAsLongAsSourceTappedEffect;
import mage.abilities.effects.common.TapTargetEffect;
import mage.abilities.keyword.DefenderAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.ReachAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.filter.predicate.permanent.BlockedByIdPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LoneFox
*/
public class WhipVine1 extends CardImpl {
public WhipVine1(UUID ownerId) {
super(ownerId, 89, "Whip Vine", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{G}");
this.expansionSetCode = "ALL";
this.subtype.add("Plant");
this.subtype.add("Wall");
this.power = new MageInt(1);
this.toughness = new MageInt(4);
// Defender
this.addAbility(DefenderAbility.getInstance());
// Reach
this.addAbility(ReachAbility.getInstance());
// You may choose not to untap Whip Vine during your untap step.
this.addAbility(new SkipUntapOptionalAbility());
// {tap}: Tap target creature with flying blocked by Whip Vine. That creature doesn't untap during its controller's untap step for as long as Whip Vine remains tapped.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(), new TapSourceCost());
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying blocked by {this}");
filter.add(new AbilityPredicate(FlyingAbility.class));
filter.add(new BlockedByIdPredicate(this.getId()));
ability.addTarget(new TargetCreaturePermanent(filter));
ability.addEffect(new DontUntapAsLongAsSourceTappedEffect());
this.addAbility(ability);
}
public WhipVine1(final WhipVine1 card) {
super(card);
}
@Override
public WhipVine1 copy() {
return new WhipVine1(this);
}
}

View file

@ -0,0 +1,51 @@
/*
* 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.alliances;
import java.util.UUID;
/**
*
* @author LoneFox
*/
public class WhipVine2 extends WhipVine1 {
public WhipVine2(UUID ownerId) {
super(ownerId);
this.cardNumber = 90;
}
public WhipVine2(final WhipVine2 card) {
super(card);
}
@Override
public WhipVine2 copy() {
return new WhipVine2(this);
}
}

View file

@ -0,0 +1,74 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.antiquities;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SkipUntapOptionalAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.DontUntapAsLongAsSourceTappedEffect;
import mage.abilities.effects.common.TapTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.target.common.TargetArtifactPermanent;
/**
*
* @author LoneFox
*/
public class PhyrexianGremlins extends CardImpl {
public PhyrexianGremlins(UUID ownerId) {
super(ownerId, 48, "Phyrexian Gremlins", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{B}");
this.expansionSetCode = "ATQ";
this.subtype.add("Gremlin");
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// You may choose not to untap Phyrexian Gremlins during your untap step.
this.addAbility(new SkipUntapOptionalAbility());
// {tap}: Tap target artifact. It doesn't untap during its controller's untap step for as long as Phyrexian Gremlins remains tapped.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(), new TapSourceCost());
ability.addTarget(new TargetArtifactPermanent());
ability.addEffect(new DontUntapAsLongAsSourceTappedEffect());
this.addAbility(ability);
}
public PhyrexianGremlins(final PhyrexianGremlins card) {
super(card);
}
@Override
public PhyrexianGremlins copy() {
return new PhyrexianGremlins(this);
}
}

View file

@ -58,7 +58,7 @@ public class FungalShambler extends CardImpl {
// Whenever Fungal Shambler deals damage to an opponent, you draw a card and that opponent discards a card. // Whenever Fungal Shambler deals damage to an opponent, you draw a card and that opponent discards a card.
Effect effect = new DrawCardSourceControllerEffect(1); Effect effect = new DrawCardSourceControllerEffect(1);
effect.setText("you draw a card"); effect.setText("you draw a card");
Ability ability = new DealsDamageToOpponentTriggeredAbility(effect, false); Ability ability = new DealsDamageToOpponentTriggeredAbility(effect, false, false, true);
effect = new DiscardTargetEffect(1); effect = new DiscardTargetEffect(1);
effect.setText("and that opponent discards a card"); effect.setText("and that opponent discards a card");
ability.addEffect(effect); ability.addEffect(effect);

View file

@ -40,7 +40,7 @@ import mage.abilities.keyword.TributeAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.game.permanent.token.Token; import mage.game.permanent.token.BirdToken;
/** /**
* *
@ -75,20 +75,3 @@ public class Ornitharch extends CardImpl {
return new Ornitharch(this); return new Ornitharch(this);
} }
} }
class BirdToken extends Token {
public BirdToken() {
super("Bird", "1/1 white Bird creature tokens with flying");
this.setOriginalExpansionSetCode("BNG");
cardType.add(CardType.CREATURE);
color.setWhite(true);
subtype.add("Bird");
power = new MageInt(1);
toughness = new MageInt(1);
this.addAbility(FlyingAbility.getInstance());
}
}

View file

@ -28,16 +28,15 @@
package mage.sets.commander; package mage.sets.commander;
import java.util.UUID; import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
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.game.Game; import mage.game.Game;
import mage.game.permanent.token.DragonToken2;
import mage.game.permanent.token.Token; import mage.game.permanent.token.Token;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
@ -90,7 +89,7 @@ class DeathByDragonsEffect extends OneShotEffect {
if (controller != null) { if (controller != null) {
for (UUID playerId : controller.getInRange()) { for (UUID playerId : controller.getInRange()) {
if (!playerId.equals(this.getTargetPointer().getFirst(game, source))) { if (!playerId.equals(this.getTargetPointer().getFirst(game, source))) {
Token token = new DragonToken(); Token token = new DragonToken2();
token.putOntoBattlefield(1, game, source.getSourceId(), playerId); token.putOntoBattlefield(1, game, source.getSourceId(), playerId);
} }
} }
@ -99,18 +98,3 @@ class DeathByDragonsEffect extends OneShotEffect {
return false; return false;
} }
} }
class DragonToken extends Token {
public DragonToken() {
super("Dragon", "5/5 red Dragon creature token with flying");
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add("Dragon");
power = new MageInt(5);
toughness = new MageInt(5);
addAbility(FlyingAbility.getInstance());
// set a set with correct token image
this.setOriginalExpansionSetCode("WWK");
}
}

View file

@ -55,7 +55,7 @@ public class HydraOmnivore extends CardImpl {
this.toughness = new MageInt(8); this.toughness = new MageInt(8);
// Whenever Hydra Omnivore deals combat damage to an opponent, it deals that much damage to each other opponent. // Whenever Hydra Omnivore deals combat damage to an opponent, it deals that much damage to each other opponent.
this.addAbility(new DealsDamageToOpponentTriggeredAbility(new HydraOmnivoreEffect(), false, true)); this.addAbility(new DealsDamageToOpponentTriggeredAbility(new HydraOmnivoreEffect(), false, true, true));
} }
public HydraOmnivore(final HydraOmnivore card) { public HydraOmnivore(final HydraOmnivore card) {

View file

@ -29,14 +29,12 @@
package mage.sets.dragonsmaze; package mage.sets.dragonsmaze;
import java.util.UUID; import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.game.permanent.token.Token; import mage.game.permanent.token.WurmToken2;
/** /**
* *
@ -50,9 +48,8 @@ public class AdventOfTheWurm extends CardImpl {
super(ownerId, 51, "Advent of the Wurm", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{1}{G}{G}{W}"); super(ownerId, 51, "Advent of the Wurm", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{1}{G}{G}{W}");
this.expansionSetCode = "DGM"; this.expansionSetCode = "DGM";
// Put a 5/5 green Wurm creature token with trample onto the battlefield. // Put a 5/5 green Wurm creature token with trample onto the battlefield.
this.getSpellAbility().addEffect(new CreateTokenEffect(new WurmToken())); this.getSpellAbility().addEffect(new CreateTokenEffect(new WurmToken2()));
} }
public AdventOfTheWurm(final AdventOfTheWurm card) { public AdventOfTheWurm(final AdventOfTheWurm card) {
@ -63,21 +60,4 @@ public class AdventOfTheWurm extends CardImpl {
public AdventOfTheWurm copy() { public AdventOfTheWurm copy() {
return new AdventOfTheWurm(this); return new AdventOfTheWurm(this);
} }
private class WurmToken extends Token {
private WurmToken() {
super("Wurm", "5/5 green Wurm creature token with trample");
cardType.add(CardType.CREATURE);
color.setGreen(true);
subtype.add("Wurm");
power = new MageInt(5);
toughness = new MageInt(5);
addAbility(TrampleAbility.getInstance());
// for image
setOriginalExpansionSetCode("RTR");
}
}
} }

View file

@ -39,9 +39,10 @@ import mage.constants.Duration;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType; import mage.game.events.GameEvent.EventType;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.game.permanent.token.BirdToken;

View file

@ -31,22 +31,20 @@ package mage.sets.dragonsmaze;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt; import mage.MageInt;
import mage.MageObject; import mage.MageObject;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType; import mage.game.events.GameEvent.EventType;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token; import mage.game.permanent.token.SoldierTokenWithHaste;
import mage.game.stack.StackObject; import mage.game.stack.StackObject;
/** /**
@ -82,12 +80,13 @@ public class BlazeCommando extends CardImpl {
} }
} }
class BlazeCommandoTriggeredAbility extends TriggeredAbilityImpl { class BlazeCommandoTriggeredAbility extends TriggeredAbilityImpl {
private final List<UUID> handledStackObjects = new ArrayList<>(); private final List<UUID> handledStackObjects = new ArrayList<>();
public BlazeCommandoTriggeredAbility() { public BlazeCommandoTriggeredAbility() {
super(Zone.BATTLEFIELD, new CreateTokenEffect(new BlazeCommandoSoldierToken(), 2), false); super(Zone.BATTLEFIELD, new CreateTokenEffect(new SoldierTokenWithHaste(), 2), false);
} }
public BlazeCommandoTriggeredAbility(final BlazeCommandoTriggeredAbility ability) { public BlazeCommandoTriggeredAbility(final BlazeCommandoTriggeredAbility ability) {
@ -138,17 +137,3 @@ class BlazeCommandoTriggeredAbility extends TriggeredAbilityImpl {
return new StringBuilder("Whenever an instant or sorcery spell you control deals damage, ").append(super.getRule()).toString(); return new StringBuilder("Whenever an instant or sorcery spell you control deals damage, ").append(super.getRule()).toString();
} }
} }
class BlazeCommandoSoldierToken extends Token {
public BlazeCommandoSoldierToken() {
super("Soldier", "1/1 red and white Soldier creature tokens with haste");
cardType.add(CardType.CREATURE);
color.setRed(true);
color.setWhite(true);
subtype.add("Soldier");
power = new MageInt(1);
toughness = new MageInt(1);
this.addAbility(HasteAbility.getInstance());
}
}

View file

@ -29,8 +29,6 @@
package mage.sets.dragonsmaze; package mage.sets.dragonsmaze;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
@ -38,9 +36,10 @@ import mage.abilities.condition.common.CastFromHandCondition;
import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.PopulateEffect; import mage.abilities.effects.common.PopulateEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.game.permanent.token.Token; import mage.constants.CardType;
import mage.constants.Rarity;
import mage.game.permanent.token.BirdToken;
import mage.watchers.common.CastFromHandWatcher; import mage.watchers.common.CastFromHandWatcher;
/** /**
@ -77,17 +76,3 @@ public class ScionOfVituGhazi extends CardImpl {
} }
} }
class BirdToken extends Token {
public BirdToken() {
super("Bird", "1/1 white Bird creature token with flying");
cardType.add(CardType.CREATURE);
color.setWhite(true);
subtype.add("Bird");
power = new MageInt(1);
toughness = new MageInt(1);
addAbility(FlyingAbility.getInstance());
setOriginalExpansionSetCode("RTR");
}
}

View file

@ -0,0 +1,74 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.fifthedition;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SkipUntapOptionalAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.DontUntapAsLongAsSourceTappedEffect;
import mage.abilities.effects.common.TapTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.target.common.TargetLandPermanent;
/**
*
* @author LoneFox
*/
public class MoleWorms extends CardImpl {
public MoleWorms(UUID ownerId) {
super(ownerId, 41, "Mole Worms", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{B}");
this.expansionSetCode = "5ED";
this.subtype.add("Worm");
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// You may choose not to untap Mole Worms during your untap step.
this.addAbility(new SkipUntapOptionalAbility());
// {tap}: Tap target land. It doesn't untap during its controller's untap step for as long as Mole Worms remains tapped.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(), new TapSourceCost());
ability.addTarget(new TargetLandPermanent());
ability.addEffect(new DontUntapAsLongAsSourceTappedEffect());
this.addAbility(ability);
}
public MoleWorms(final MoleWorms card) {
super(card);
}
@Override
public MoleWorms copy() {
return new MoleWorms(this);
}
}

View file

@ -28,20 +28,17 @@
package mage.sets.gatecrash; package mage.sets.gatecrash;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.dynamicvalue.common.CountersCount;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.counters.Counter; import mage.constants.CardType;
import mage.game.Game; import mage.constants.Rarity;
import mage.game.permanent.Permanent; import mage.constants.TargetController;
import mage.counters.CounterType;
import mage.game.permanent.token.SoldierTokenWithHaste;
/** /**
* *
@ -55,7 +52,9 @@ public class AssembleTheLegion extends CardImpl {
// At the beginning of your upkeep, put a muster counter on Assemble the Legion. Then put a 1/1 red and white Soldier creature token with haste onto the battlefield for each muster counter on Assemble the Legion. // At the beginning of your upkeep, put a muster counter on Assemble the Legion. Then put a 1/1 red and white Soldier creature token with haste onto the battlefield for each muster counter on Assemble the Legion.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new AssembleTheLegionEffect(), TargetController.YOU, false)); Ability ability = new BeginningOfUpkeepTriggeredAbility(new AddCountersSourceEffect(CounterType.MUSTER.createInstance()), TargetController.YOU, false);
ability.addEffect(new CreateTokenEffect(new SoldierTokenWithHaste(), new CountersCount(CounterType.MUSTER)));
this.addAbility(ability);
} }
public AssembleTheLegion(final AssembleTheLegion card) { public AssembleTheLegion(final AssembleTheLegion card) {
@ -67,46 +66,3 @@ public class AssembleTheLegion extends CardImpl {
return new AssembleTheLegion(this); return new AssembleTheLegion(this);
} }
} }
class AssembleTheLegionEffect extends OneShotEffect {
private static final String MUSTER_COUNTER_NAME = "Muster";
public AssembleTheLegionEffect() {
super(Outcome.Copy);
this.staticText = "put a muster counter on {this}. Then put a 1/1 red and white Soldier creature token with haste onto the battlefield for each muster counter on {this}";
}
public AssembleTheLegionEffect(final AssembleTheLegionEffect effect) {
super(effect);
}
@Override
public AssembleTheLegionEffect copy() {
return new AssembleTheLegionEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
/* 1/24/2013: If Assemble the Legion isnt on the battlefield when its ability resolves,
* use the number of muster counters it had when it was last on the battlefield to
* determine how many Soldier tokens to put onto the battlefield.
*/
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
int amountCounters = 0;
if (sourcePermanent == null) {
Permanent lki = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (lki != null) {
amountCounters = lki.getCounters().getCount(MUSTER_COUNTER_NAME);
}
} else {
new AddCountersSourceEffect(new Counter(MUSTER_COUNTER_NAME),false).apply(game, source);
amountCounters = sourcePermanent.getCounters().getCount(MUSTER_COUNTER_NAME);
}
if (amountCounters > 0) {
return new CreateTokenEffect(new SoldierToken(), amountCounters).apply(game, source);
}
return false;
}
}

View file

@ -34,13 +34,12 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.continuous.BoostControlledEffect; import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.permanent.token.Token; import mage.game.permanent.token.SoldierTokenWithHaste;
/** /**
* *
@ -54,17 +53,14 @@ public class SunhomeGuildmage extends CardImpl {
this.subtype.add("Human"); this.subtype.add("Human");
this.subtype.add("Wizard"); this.subtype.add("Wizard");
this.power = new MageInt(2); this.power = new MageInt(2);
this.toughness = new MageInt(2); this.toughness = new MageInt(2);
//{1}{R}{W}: Creatures you control get +1/+0 until end of turn. //{1}{R}{W}: Creatures you control get +1/+0 until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{1}{R}{W}"))); this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{1}{R}{W}")));
//{2}{R}{W}: Put a 1/1 red and white Soldier creature token with haste onto the battlefield. //{2}{R}{W}: Put a 1/1 red and white Soldier creature token with haste onto the battlefield.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new SoldierToken()), new ManaCostsImpl("{2}{R}{W}"))); this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new SoldierTokenWithHaste()), new ManaCostsImpl("{2}{R}{W}")));
} }
public SunhomeGuildmage(final SunhomeGuildmage card) { public SunhomeGuildmage(final SunhomeGuildmage card) {
@ -76,20 +72,3 @@ public class SunhomeGuildmage extends CardImpl {
return new SunhomeGuildmage(this); return new SunhomeGuildmage(this);
} }
} }
class SoldierToken extends Token {
public SoldierToken() {
super("Soldier", "1/1 red and white Soldier creature token with haste");
cardType.add(CardType.CREATURE);
color.setWhite(true);
color.setRed(true);
subtype.add("Soldier");
power = new MageInt(1);
toughness = new MageInt(1);
this.addAbility(HasteAbility.getInstance());
}
}

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

View file

@ -29,21 +29,16 @@ package mage.sets.journeyintonyx;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SkipUntapOptionalAbility; import mage.abilities.common.SkipUntapOptionalAbility;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.RestrictionEffect; import mage.abilities.effects.common.DontUntapAsLongAsSourceTappedEffect;
import mage.abilities.effects.common.TapTargetEffect; import mage.abilities.effects.common.TapTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration;
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.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
/** /**
@ -60,12 +55,11 @@ public class DesertersQuarters extends CardImpl {
this.addAbility(new SkipUntapOptionalAbility()); this.addAbility(new SkipUntapOptionalAbility());
// {6}, T: Tap target creature. It doesn't untap during its controller's untap step for as long as Deserter's Quarters remains tapped. // {6}, T: Tap target creature. It doesn't untap during its controller's untap step for as long as Deserter's Quarters remains tapped.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DesertersQuartersTapTargetEffect(), new GenericManaCost(6)); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(), new GenericManaCost(6));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent()); ability.addTarget(new TargetCreaturePermanent());
ability.addEffect(new DontUntapAsLongAsSourceTappedEffect());
this.addAbility(ability); this.addAbility(ability);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DesertersQuartersRestrictionEffect()));
} }
public DesertersQuarters(final DesertersQuarters card) { public DesertersQuarters(final DesertersQuarters card) {
@ -77,79 +71,3 @@ public class DesertersQuarters extends CardImpl {
return new DesertersQuarters(this); return new DesertersQuarters(this);
} }
} }
class DesertersQuartersTapTargetEffect extends TapTargetEffect {
public DesertersQuartersTapTargetEffect() {
super();
staticText = "Tap target creature. It doesn't untap during its controller's untap step for as long as {this} remains tapped";
}
public DesertersQuartersTapTargetEffect(final DesertersQuartersTapTargetEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (sourcePermanent != null) {
sourcePermanent.clearConnectedCards("DesertersQuarters");
}
for (UUID target : targetPointer.getTargets(game, source)) {
Permanent permanent = game.getPermanent(target);
if (sourcePermanent != null) {
sourcePermanent.addConnectedCard("DesertersQuarters", permanent.getId());
}
if (permanent != null) {
permanent.tap(game);
}
}
return true;
}
@Override
public DesertersQuartersTapTargetEffect copy() {
return new DesertersQuartersTapTargetEffect(this);
}
@Override
public String getText(Mode mode) {
return staticText;
}
}
class DesertersQuartersRestrictionEffect extends RestrictionEffect {
public DesertersQuartersRestrictionEffect() {
super(Duration.WhileOnBattlefield);
}
public DesertersQuartersRestrictionEffect(final DesertersQuartersRestrictionEffect effect) {
super(effect);
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
Permanent rustTick = game.getPermanent(source.getSourceId());
if (rustTick != null && rustTick.isTapped()) {
if (rustTick.getConnectedCards("DesertersQuarters").size() > 0) {
UUID target = rustTick.getConnectedCards("DesertersQuarters").get(0);
if (target != null && target.equals(permanent.getId())) {
return true;
}
}
}
return false;
}
@Override
public boolean canBeUntapped(Permanent permanent, Ability source, Game game) {
return false;
}
@Override
public DesertersQuartersRestrictionEffect copy() {
return new DesertersQuartersRestrictionEffect(this);
}
}

View file

@ -28,12 +28,10 @@
package mage.sets.judgment; package mage.sets.judgment;
import java.util.UUID; import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.costs.common.TapTargetCost; import mage.abilities.costs.common.TapTargetCost;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.FlashbackAbility; import mage.abilities.keyword.FlashbackAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Rarity; import mage.constants.Rarity;
@ -42,7 +40,7 @@ import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
import mage.filter.predicate.permanent.TappedPredicate; import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.permanent.token.Token; import mage.game.permanent.token.BirdToken;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
/** /**
@ -79,20 +77,3 @@ public class BattleScreech extends CardImpl {
return new BattleScreech(this); return new BattleScreech(this);
} }
} }
class BirdToken extends Token {
public BirdToken() {
super("Bird", "1/1 white Bird creature tokens with flying");
this.setOriginalExpansionSetCode("BNG");
cardType.add(CardType.CREATURE);
color.setWhite(true);
subtype.add("Bird");
power = new MageInt(1);
toughness = new MageInt(1);
this.addAbility(FlyingAbility.getInstance());
}
}

View file

@ -28,7 +28,6 @@
package mage.sets.khansoftarkir; package mage.sets.khansoftarkir;
import java.util.UUID; import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SpellCastControllerTriggeredAbility; import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
@ -40,7 +39,7 @@ import mage.constants.Rarity;
import mage.filter.FilterSpell; import mage.filter.FilterSpell;
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.permanent.token.Token; import mage.game.permanent.token.GoblinTokenWithHaste;
/** /**
* *
@ -58,9 +57,8 @@ public class Goblinslide extends CardImpl {
super(ownerId, 109, "Goblinslide", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}"); super(ownerId, 109, "Goblinslide", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}");
this.expansionSetCode = "KTK"; this.expansionSetCode = "KTK";
// Whenever you cast a noncreature spell, you may pay {1}. If you do, put a 1/1 red Goblin creature token with haste onto the battlefield. // Whenever you cast a noncreature spell, you may pay {1}. If you do, put a 1/1 red Goblin creature token with haste onto the battlefield.
this.addAbility(new SpellCastControllerTriggeredAbility(new DoIfCostPaid(new CreateTokenEffect(new GoblinslideGoblinToken()), new GenericManaCost(1)), filter, false)); this.addAbility(new SpellCastControllerTriggeredAbility(new DoIfCostPaid(new CreateTokenEffect(new GoblinTokenWithHaste()), new GenericManaCost(1)), filter, false));
} }
public Goblinslide(final Goblinslide card) { public Goblinslide(final Goblinslide card) {
@ -72,17 +70,3 @@ public class Goblinslide extends CardImpl {
return new Goblinslide(this); return new Goblinslide(this);
} }
} }
class GoblinslideGoblinToken extends Token {
GoblinslideGoblinToken() {
super("Goblin", "1/1 red Goblin creature token with haste");
this.setOriginalExpansionSetCode("KTK");
cardType.add(CardType.CREATURE);
subtype.add("Goblin");
color.setRed(true);
power = new MageInt(1);
toughness = new MageInt(1);
addAbility(HasteAbility.getInstance());
}
}

View file

@ -62,7 +62,7 @@ public class NicolBolas extends CardImpl {
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new ManaCostsImpl("{U}{B}{R}")), TargetController.YOU, false)); this.addAbility(new BeginningOfUpkeepTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new ManaCostsImpl("{U}{B}{R}")), TargetController.YOU, false));
// Whenever Nicol Bolas deals damage to an opponent, that player discards his or her hand. // Whenever Nicol Bolas deals damage to an opponent, that player discards his or her hand.
this.addAbility(new DealsDamageToOpponentTriggeredAbility(new DiscardHandTargetEffect("that player"), false)); this.addAbility(new DealsDamageToOpponentTriggeredAbility(new DiscardHandTargetEffect("that player"), false, false, true));
} }
public NicolBolas(final NicolBolas card) { public NicolBolas(final NicolBolas card) {

View file

@ -54,7 +54,7 @@ public class HypnoticSpecter extends CardImpl {
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
// Whenever Hypnotic Specter deals damage to an opponent, that player discards a card at random. // Whenever Hypnotic Specter deals damage to an opponent, that player discards a card at random.
this.addAbility(new DealsDamageToOpponentTriggeredAbility(new DiscardTargetEffect(1, true))); this.addAbility(new DealsDamageToOpponentTriggeredAbility(new DiscardTargetEffect(1, true), false, false, true));
} }
public HypnoticSpecter(final HypnoticSpecter card) { public HypnoticSpecter(final HypnoticSpecter card) {

View file

@ -38,7 +38,6 @@ import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.combat.AttacksIfAbleAllEffect; import mage.abilities.effects.common.combat.AttacksIfAbleAllEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
@ -49,7 +48,7 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate; import mage.filter.predicate.permanent.AnotherPredicate;
import mage.filter.predicate.permanent.AttackingPredicate; import mage.filter.predicate.permanent.AttackingPredicate;
import mage.filter.predicate.permanent.ControllerPredicate; import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.permanent.token.Token; import mage.game.permanent.token.GoblinTokenWithHaste;
import mage.watchers.common.AttackedThisTurnWatcher; import mage.watchers.common.AttackedThisTurnWatcher;
/** /**
@ -83,7 +82,7 @@ public class GoblinRabblemaster extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect), new AttackedThisTurnWatcher()); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect), new AttackedThisTurnWatcher());
// At the beginning of combat on your turn, put a 1/1 red Goblin creature token with haste onto the battlefield. // At the beginning of combat on your turn, put a 1/1 red Goblin creature token with haste onto the battlefield.
this.addAbility(new BeginningOfCombatTriggeredAbility(new CreateTokenEffect(new GoblinToken()), TargetController.YOU, false)); this.addAbility(new BeginningOfCombatTriggeredAbility(new CreateTokenEffect(new GoblinTokenWithHaste()), TargetController.YOU, false));
// When Goblin Rabblemaster attacks, it gets +1/+0 until end of turn for each other attacking Goblin. // When Goblin Rabblemaster attacks, it gets +1/+0 until end of turn for each other attacking Goblin.
this.addAbility(new AttacksTriggeredAbility(new BoostSourceEffect(new PermanentsOnBattlefieldCount(attackingFilter), new StaticValue(0), Duration.EndOfTurn, true), false)); this.addAbility(new AttacksTriggeredAbility(new BoostSourceEffect(new PermanentsOnBattlefieldCount(attackingFilter), new StaticValue(0), Duration.EndOfTurn, true), false));
@ -98,18 +97,3 @@ public class GoblinRabblemaster extends CardImpl {
return new GoblinRabblemaster(this); return new GoblinRabblemaster(this);
} }
} }
class GoblinToken extends Token {
public GoblinToken() {
super("Goblin", "1/1 red Goblin creature token with haste");
this.setOriginalExpansionSetCode("M15");
cardType.add(CardType.CREATURE);
subtype.add("Goblin");
color.setRed(true);
power = new MageInt(1);
toughness = new MageInt(1);
addAbility(HasteAbility.getInstance());
}
}

View file

@ -57,7 +57,7 @@ import mage.game.command.Emblem;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent; import mage.game.events.ZoneChangeEvent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCardInGraveyard; import mage.target.common.TargetCardInYourGraveyard;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.common.TargetOpponent; import mage.target.common.TargetOpponent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
@ -88,7 +88,7 @@ public class JaceTelepathUnbound extends CardImpl {
// -3: You may cast target instant or sorcery card from your graveyard this turn. If that card would be put into your graveyard this turn, exile it instead. // -3: You may cast target instant or sorcery card from your graveyard this turn. If that card would be put into your graveyard this turn, exile it instead.
ability = new LoyaltyAbility(new JaceTelepathUnboundEffect(), -3); ability = new LoyaltyAbility(new JaceTelepathUnboundEffect(), -3);
ability.addTarget(new TargetCardInGraveyard(new FilterInstantOrSorceryCard())); ability.addTarget(new TargetCardInYourGraveyard(new FilterInstantOrSorceryCard()));
this.addAbility(ability); this.addAbility(ability);
// -9: You get an emblem with "Whenever you cast a spell, target opponent puts the top five cards of his or her library into his or her graveyard". // -9: You get an emblem with "Whenever you cast a spell, target opponent puts the top five cards of his or her library into his or her graveyard".

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.mercadianmasques;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SkipUntapOptionalAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.DontUntapAsLongAsSourceTappedEffect;
import mage.abilities.effects.common.TapTargetEffect;
import mage.abilities.keyword.IslandwalkAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LoneFox
*/
public class SandSquid extends CardImpl {
public SandSquid(UUID ownerId) {
super(ownerId, 96, "Sand Squid", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{U}");
this.expansionSetCode = "MMQ";
this.subtype.add("Squid");
this.subtype.add("Beast");
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Islandwalk
this.addAbility(new IslandwalkAbility());
// You may choose not to untap Sand Squid during your untap step.
this.addAbility(new SkipUntapOptionalAbility());
// {tap}: Tap target creature. That creature doesn't untap during its controller's untap step for as long as Sand Squid remains tapped.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(), new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent());
ability.addEffect(new DontUntapAsLongAsSourceTappedEffect());
this.addAbility(ability);
}
public SandSquid(final SandSquid card) {
super(card);
}
@Override
public SandSquid copy() {
return new SandSquid(this);
}
}

View file

@ -29,27 +29,19 @@ package mage.sets.mirage;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SkipUntapOptionalAbility; import mage.abilities.common.SkipUntapOptionalAbility;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DontUntapAsLongAsSourceTappedEffect;
import mage.abilities.effects.RestrictionEffect; import mage.abilities.effects.common.TapTargetEffect;
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.constants.Zone; 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;
/** /**
@ -75,12 +67,11 @@ public class AmberPrison extends CardImpl {
this.addAbility(new SkipUntapOptionalAbility()); this.addAbility(new SkipUntapOptionalAbility());
// {4}, {tap}: Tap target artifact, creature, or land. That permanent doesn't untap during its controller's untap step for as long as Amber Prison remains tapped. // {4}, {tap}: Tap target artifact, creature, or land. That permanent doesn't untap during its controller's untap step for as long as Amber Prison remains tapped.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AmberPrisonTapTargetEffect(), new GenericManaCost(4)); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(), new GenericManaCost(4));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addTarget(new TargetPermanent(filter)); ability.addTarget(new TargetPermanent(filter));
ability.addEffect(new DontUntapAsLongAsSourceTappedEffect());
this.addAbility(ability); this.addAbility(ability);
this.addAbility(new AmberPrisonUntapTriggeredAbility());
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AmberPrisonRestrictionEffect()));
} }
public AmberPrison(final AmberPrison card) { public AmberPrison(final AmberPrison card) {
@ -92,124 +83,3 @@ public class AmberPrison extends CardImpl {
return new AmberPrison(this); return new AmberPrison(this);
} }
} }
class AmberPrisonTapTargetEffect extends OneShotEffect {
public AmberPrisonTapTargetEffect() {
super(Outcome.Tap);
this.staticText = "Tap target artifact, creature, or land. That permanent doesn't untap during its controller's untap step for as long as {source} remains tapped.";
}
public AmberPrisonTapTargetEffect(final AmberPrisonTapTargetEffect effect) {
super(effect);
}
@Override
public AmberPrisonTapTargetEffect copy() {
return new AmberPrisonTapTargetEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
for (UUID target : targetPointer.getTargets(game, source)) {
Permanent permanent = game.getPermanent(target);
if (permanent != null) {
if (sourcePermanent != null) {
sourcePermanent.addConnectedCard("AmberPrison", permanent.getId());
}
permanent.tap(game);
}
}
return true;
}
}
class AmberPrisonRestrictionEffect extends RestrictionEffect {
public AmberPrisonRestrictionEffect() {
super(Duration.WhileOnBattlefield);
}
public AmberPrisonRestrictionEffect(final AmberPrisonRestrictionEffect effect) {
super(effect);
}
@Override
public AmberPrisonRestrictionEffect copy() {
return new AmberPrisonRestrictionEffect(this);
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (sourcePermanent != null && sourcePermanent.isTapped()) {
if (sourcePermanent.getConnectedCards("AmberPrison") != null) {
return sourcePermanent.getConnectedCards("AmberPrison").contains(permanent.getId());
}
}
return false;
}
@Override
public boolean canBeUntapped(Permanent permanent, Ability source, Game game) {
return false;
}
}
class AmberPrisonUntapTriggeredAbility extends TriggeredAbilityImpl {
public AmberPrisonUntapTriggeredAbility() {
super(Zone.BATTLEFIELD, new AmberPrisonReleaseOnUntapEffect(), false);
this.usesStack = false;
this.ruleVisible = false;
}
public AmberPrisonUntapTriggeredAbility(final AmberPrisonUntapTriggeredAbility ability) {
super(ability);
}
@Override
public AmberPrisonUntapTriggeredAbility copy() {
return new AmberPrisonUntapTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.UNTAP;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return event.getTargetId().equals(this.getSourceId());
}
}
class AmberPrisonReleaseOnUntapEffect extends OneShotEffect {
public AmberPrisonReleaseOnUntapEffect() {
super(Outcome.Detriment);
}
public AmberPrisonReleaseOnUntapEffect(final AmberPrisonReleaseOnUntapEffect effect) {
super(effect);
}
@Override
public AmberPrisonReleaseOnUntapEffect copy() {
return new AmberPrisonReleaseOnUntapEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (sourcePermanent != null) {
sourcePermanent.clearConnectedCards("AmberPrison");
return true;
}
return false;
}
}

View file

@ -50,6 +50,7 @@ import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
@ -76,6 +77,7 @@ public class GiltLeafArchdruid extends CardImpl {
// Whenever you cast a Druid spell, you may draw a card. // Whenever you cast a Druid spell, you may draw a card.
this.addAbility(new SpellCastControllerTriggeredAbility(new DrawCardSourceControllerEffect(1), filterSpell, true)); this.addAbility(new SpellCastControllerTriggeredAbility(new DrawCardSourceControllerEffect(1), filterSpell, true));
// Tap seven untapped Druids you control: Gain control of all lands target player controls. // Tap seven untapped Druids you control: Gain control of all lands target player controls.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainControlAllLandsEffect(Duration.EndOfGame), new TapTargetCost(new TargetControlledCreaturePermanent(7, 7, new FilterControlledCreaturePermanent("Druid", "Druids you control"), true))); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainControlAllLandsEffect(Duration.EndOfGame), new TapTargetCost(new TargetControlledCreaturePermanent(7, 7, new FilterControlledCreaturePermanent("Druid", "Druids you control"), true)));
ability.addTarget(new TargetPlayer()); ability.addTarget(new TargetPlayer());
@ -109,14 +111,17 @@ class GainControlAllLandsEffect extends ContinuousEffectImpl {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
if (targetPointer != null) { Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
for(Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterLandPermanent(), targetPointer.getFirst(game, source), game)){ if (targetPlayer != null && targetPlayer.isInGame()) {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterLandPermanent(), targetPointer.getFirst(game, source), game)) {
if (permanent != null) { if (permanent != null) {
permanent.changeControllerId(source.getControllerId(), game); permanent.changeControllerId(source.getControllerId(), game);
} }
} }
} else {
discard();
} }
return false; return true;
} }
@Override @Override

View file

@ -35,7 +35,6 @@ import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Rarity; import mage.constants.Rarity;
@ -45,7 +44,7 @@ import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType; import mage.game.events.GameEvent.EventType;
import mage.game.permanent.token.Token; import mage.game.permanent.token.GoblinTokenWithHaste;
/** /**
* *
@ -73,7 +72,7 @@ public class ChancellorOfTheForge extends CardImpl {
// When Chancellor of the Forge enters the battlefield, put X 1/1 red Goblin creature tokens with haste onto the battlefield, where X is the number of creatures you control. // When Chancellor of the Forge enters the battlefield, put X 1/1 red Goblin creature tokens with haste onto the battlefield, where X is the number of creatures you control.
DynamicValue value = new PermanentsOnBattlefieldCount(filter); DynamicValue value = new PermanentsOnBattlefieldCount(filter);
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new GoblinToken(), value), false)); this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new GoblinTokenWithHaste(), value), false));
} }
public ChancellorOfTheForge(final ChancellorOfTheForge card) { public ChancellorOfTheForge(final ChancellorOfTheForge card) {
@ -89,7 +88,7 @@ public class ChancellorOfTheForge extends CardImpl {
class ChancellorOfTheForgeDelayedTriggeredAbility extends DelayedTriggeredAbility { class ChancellorOfTheForgeDelayedTriggeredAbility extends DelayedTriggeredAbility {
ChancellorOfTheForgeDelayedTriggeredAbility () { ChancellorOfTheForgeDelayedTriggeredAbility () {
super(new CreateTokenEffect(new GoblinToken())); super(new CreateTokenEffect(new GoblinTokenWithHaste()));
} }
ChancellorOfTheForgeDelayedTriggeredAbility(ChancellorOfTheForgeDelayedTriggeredAbility ability) { ChancellorOfTheForgeDelayedTriggeredAbility(ChancellorOfTheForgeDelayedTriggeredAbility ability) {
@ -110,15 +109,3 @@ class ChancellorOfTheForgeDelayedTriggeredAbility extends DelayedTriggeredAbilit
return new ChancellorOfTheForgeDelayedTriggeredAbility(this); return new ChancellorOfTheForgeDelayedTriggeredAbility(this);
} }
} }
class GoblinToken extends Token {
public GoblinToken() {
super("Goblin", "1/1 red Goblin creature token with haste");
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add("Goblin");
power = new MageInt(1);
toughness = new MageInt(1);
addAbility(HasteAbility.getInstance());
}
}

View file

@ -28,7 +28,6 @@
package mage.sets.odyssey; package mage.sets.odyssey;
import java.util.UUID; import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
@ -37,7 +36,7 @@ import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.TimingRule; import mage.constants.TimingRule;
import mage.game.permanent.token.Token; import mage.game.permanent.token.BeastToken2;
/** /**
* *
@ -49,9 +48,8 @@ public class BeastAttack extends CardImpl {
super(ownerId, 230, "Beast Attack", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{2}{G}{G}{G}"); super(ownerId, 230, "Beast Attack", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{2}{G}{G}{G}");
this.expansionSetCode = "ODY"; this.expansionSetCode = "ODY";
// Put a 4/4 green Beast creature token onto the battlefield. // Put a 4/4 green Beast creature token onto the battlefield.
this.getSpellAbility().addEffect(new CreateTokenEffect(new BeastToken_44())); this.getSpellAbility().addEffect(new CreateTokenEffect(new BeastToken2()));
// Flashback {2}{G}{G}{G} // Flashback {2}{G}{G}{G}
this.addAbility(new FlashbackAbility(new ManaCostsImpl("{2}{G}{G}{G}"), TimingRule.INSTANT)); this.addAbility(new FlashbackAbility(new ManaCostsImpl("{2}{G}{G}{G}"), TimingRule.INSTANT));
@ -66,18 +64,3 @@ public class BeastAttack extends CardImpl {
return new BeastAttack(this); return new BeastAttack(this);
} }
} }
class BeastToken_44 extends Token {
public BeastToken_44() {
super("Beast", "4/4 green Beast creature token");
cardType.add(CardType.CREATURE);
color.setGreen(true);
subtype.add("Beast");
power = new MageInt(4);
toughness = new MageInt(4);
// to get an image for the token
this.setOriginalExpansionSetCode("ZEN");
}
}

View file

@ -53,7 +53,7 @@ public class WeiNightRaiders extends CardImpl {
// Horsemanship // Horsemanship
this.addAbility(HorsemanshipAbility.getInstance()); this.addAbility(HorsemanshipAbility.getInstance());
// Whenever Wei Night Raiders deals damage to an opponent, that player discards a card. // Whenever Wei Night Raiders deals damage to an opponent, that player discards a card.
this.addAbility(new DealsDamageToOpponentTriggeredAbility(new DiscardTargetEffect(1), false)); this.addAbility(new DealsDamageToOpponentTriggeredAbility(new DiscardTargetEffect(1), false, false, true));
} }
public WeiNightRaiders(final WeiNightRaiders card) { public WeiNightRaiders(final WeiNightRaiders card) {

View file

@ -51,7 +51,7 @@ public class ZhangLiaoHeroOfHefei extends CardImpl {
this.toughness = new MageInt(3); this.toughness = new MageInt(3);
// Whenever Zhang Liao, Hero of Hefei deals damage to an opponent, that opponent discards a card. // Whenever Zhang Liao, Hero of Hefei deals damage to an opponent, that opponent discards a card.
this.addAbility(new DealsDamageToOpponentTriggeredAbility(new DiscardTargetEffect(1), false)); this.addAbility(new DealsDamageToOpponentTriggeredAbility(new DiscardTargetEffect(1), false, false, true));
} }
public ZhangLiaoHeroOfHefei(final ZhangLiaoHeroOfHefei card) { public ZhangLiaoHeroOfHefei(final ZhangLiaoHeroOfHefei card) {

View file

@ -28,15 +28,14 @@
package mage.sets.ravnica; package mage.sets.ravnica;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.ConvokeAbility; import mage.abilities.keyword.ConvokeAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.Filter; import mage.filter.Filter;
import mage.filter.FilterCard; import mage.filter.FilterCard;
@ -56,8 +55,7 @@ public class ChordOfCalling extends CardImpl {
super(ownerId, 156, "Chord of Calling", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{X}{G}{G}{G}"); super(ownerId, 156, "Chord of Calling", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{X}{G}{G}{G}");
this.expansionSetCode = "RAV"; this.expansionSetCode = "RAV";
// Convoke (Your creatures can help cast this spell. Each creature you tap while casting this spell pays for {1} or one mana of that creature's color.)
// Convoke
this.addAbility(new ConvokeAbility()); this.addAbility(new ConvokeAbility());
// Search your library for a creature card with converted mana cost X or less and put it onto the battlefield. Then shuffle your library. // Search your library for a creature card with converted mana cost X or less and put it onto the battlefield. Then shuffle your library.
@ -97,7 +95,7 @@ class ChordofCallingSearchEffect extends OneShotEffect {
filter.add(new CardTypePredicate(CardType.CREATURE)); filter.add(new CardTypePredicate(CardType.CREATURE));
//Set the mana cost one higher to 'emulate' a less than or equal to comparison. //Set the mana cost one higher to 'emulate' a less than or equal to comparison.
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, xCost + 1)); filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, xCost + 1));
TargetCardInLibrary target = new TargetCardInLibrary(0,1,filter); TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter);
if (player.searchLibrary(target, game)) { if (player.searchLibrary(target, game)) {
if (target.getTargets().size() > 0) { if (target.getTargets().size() > 0) {
Card card = player.getLibrary().getCard(target.getFirstTarget(), game); Card card = player.getLibrary().getCard(target.getFirstTarget(), game);

View file

@ -38,7 +38,7 @@ import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.game.permanent.token.Token; import mage.game.permanent.token.WurmToken2;
/** /**
* *
@ -59,7 +59,7 @@ public class ArmadaWurm extends CardImpl {
this.addAbility(TrampleAbility.getInstance()); this.addAbility(TrampleAbility.getInstance());
// When Armada Wurm enters the battlefield, put a 5/5 green Wurm creature token with trample onto the battlefield. // When Armada Wurm enters the battlefield, put a 5/5 green Wurm creature token with trample onto the battlefield.
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new ArmadaWurmToken()), false)); this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new WurmToken2()), false));
} }
@ -71,18 +71,4 @@ public class ArmadaWurm extends CardImpl {
public ArmadaWurm copy() { public ArmadaWurm copy() {
return new ArmadaWurm(this); return new ArmadaWurm(this);
} }
private class ArmadaWurmToken extends Token {
private ArmadaWurmToken() {
super("Wurm", "a 5/5 green Wurm creature token with trample");
cardType.add(CardType.CREATURE);
color.setGreen(true);
subtype.add("Wurm");
power = new MageInt(5);
toughness = new MageInt(5);
addAbility(TrampleAbility.getInstance());
}
}
} }

View file

@ -28,14 +28,12 @@
package mage.sets.returntoravnica; package mage.sets.returntoravnica;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.PopulateEffect; import mage.abilities.effects.common.PopulateEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.game.permanent.token.Token; import mage.constants.CardType;
import mage.constants.Rarity;
import mage.game.permanent.token.BirdToken;
/** /**
* *
@ -47,7 +45,6 @@ public class EyesInTheSkies extends CardImpl {
super(ownerId, 10, "Eyes in the Skies", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{3}{W}"); super(ownerId, 10, "Eyes in the Skies", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{3}{W}");
this.expansionSetCode = "RTR"; this.expansionSetCode = "RTR";
// Put a 1/1 white Bird creature token with flying onto the battlefield, then populate. // Put a 1/1 white Bird creature token with flying onto the battlefield, then populate.
// (Put a token onto the battlefield that's a copy of a creature token you control.) // (Put a token onto the battlefield that's a copy of a creature token you control.)
this.getSpellAbility().addEffect(new CreateTokenEffect(new BirdToken())); this.getSpellAbility().addEffect(new CreateTokenEffect(new BirdToken()));
@ -62,17 +59,5 @@ public class EyesInTheSkies extends CardImpl {
public EyesInTheSkies copy() { public EyesInTheSkies copy() {
return new EyesInTheSkies(this); return new EyesInTheSkies(this);
} }
private class BirdToken extends Token {
public BirdToken() {
super("Bird", "1/1 white Bird creature token with flying");
cardType.add(CardType.CREATURE);
color.setWhite(true);
subtype.add("Bird");
power = new MageInt(1);
toughness = new MageInt(1);
addAbility(FlyingAbility.getInstance());
}
}
} }

View file

@ -28,14 +28,14 @@
package mage.sets.returntoravnica; package mage.sets.returntoravnica;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.game.permanent.token.Token; import mage.constants.CardType;
import mage.constants.Rarity;
import mage.game.permanent.token.BirdToken;
/** /**
* @author LevelX2 * @author LevelX2
@ -63,17 +63,4 @@ public class SellerOfSongbirds extends CardImpl {
public SellerOfSongbirds copy() { public SellerOfSongbirds copy() {
return new SellerOfSongbirds(this); return new SellerOfSongbirds(this);
} }
private class BirdToken extends Token {
public BirdToken() {
super("Bird", "1/1 white Bird creature token with flying");
cardType.add(CardType.CREATURE);
color.setWhite(true);
subtype.add("Bird");
power = new MageInt(1);
toughness = new MageInt(1);
addAbility(FlyingAbility.getInstance());
}
}
} }

View file

@ -37,7 +37,7 @@ import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.game.permanent.token.Token; import mage.game.permanent.token.WurmToken2;
/** /**
* *
@ -57,7 +57,7 @@ public class WorldspineWurm extends CardImpl {
this.addAbility(TrampleAbility.getInstance()); this.addAbility(TrampleAbility.getInstance());
// When Worldspine Wurm dies, put three 5/5 green Wurm creature tokens with trample onto the battlefield. // When Worldspine Wurm dies, put three 5/5 green Wurm creature tokens with trample onto the battlefield.
this.addAbility(new DiesTriggeredAbility(new CreateTokenEffect(new WorldspineWurmToken(), 3))); this.addAbility(new DiesTriggeredAbility(new CreateTokenEffect(new WurmToken2(), 3)));
// When Worldspine Wurm is put into a graveyard from anywhere, shuffle it into its owner's library. // When Worldspine Wurm is put into a graveyard from anywhere, shuffle it into its owner's library.
this.addAbility(new PutIntoGraveFromAnywhereSourceTriggeredAbility(new ShuffleIntoLibrarySourceEffect())); this.addAbility(new PutIntoGraveFromAnywhereSourceTriggeredAbility(new ShuffleIntoLibrarySourceEffect()));
@ -72,17 +72,3 @@ public class WorldspineWurm extends CardImpl {
return new WorldspineWurm(this); return new WorldspineWurm(this);
} }
} }
class WorldspineWurmToken extends Token {
public WorldspineWurmToken() {
super("Wurm", "5/5 green Wurm creature tokens with trample");
cardType.add(CardType.CREATURE);
color.setGreen(true);
subtype.add("Wurm");
power = new MageInt(5);
toughness = new MageInt(5);
this.addAbility(TrampleAbility.getInstance());
}
}

View file

@ -30,22 +30,17 @@ package mage.sets.scarsofmirrodin;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SkipUntapOptionalAbility; import mage.abilities.common.SkipUntapOptionalAbility;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.RestrictionEffect;
import mage.abilities.effects.common.TapTargetEffect; import mage.abilities.effects.common.TapTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration;
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.target.common.TargetArtifactPermanent; import mage.target.common.TargetArtifactPermanent;
import mage.abilities.effects.common.DontUntapAsLongAsSourceTappedEffect;
/** /**
* @author nantuko * @author nantuko
@ -64,12 +59,11 @@ public class RustTick extends CardImpl {
this.addAbility(new SkipUntapOptionalAbility()); this.addAbility(new SkipUntapOptionalAbility());
// {1}, {tap}: Tap target artifact. It doesn't untap during its controller's untap step for as long as Rust Tick remains tapped. // {1}, {tap}: Tap target artifact. It doesn't untap during its controller's untap step for as long as Rust Tick remains tapped.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RustTickTapTargetEffect(), new GenericManaCost(1)); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(), new GenericManaCost(1));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addTarget(new TargetArtifactPermanent()); ability.addTarget(new TargetArtifactPermanent());
ability.addEffect(new DontUntapAsLongAsSourceTappedEffect());
this.addAbility(ability); this.addAbility(ability);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new RustTickRestrictionEffect()));
} }
public RustTick(final RustTick card) { public RustTick(final RustTick card) {
@ -81,79 +75,3 @@ public class RustTick extends CardImpl {
return new RustTick(this); return new RustTick(this);
} }
} }
class RustTickTapTargetEffect extends TapTargetEffect {
public RustTickTapTargetEffect() {
super();
staticText = "Tap target artifact. It doesn't untap during its controller's untap step for as long as Rust Tick remains tapped";
}
public RustTickTapTargetEffect(final RustTickTapTargetEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent rustTick = game.getPermanent(source.getSourceId());
if (rustTick != null) {
rustTick.clearConnectedCards("RustTick");
}
for (UUID target : targetPointer.getTargets(game, source)) {
Permanent permanent = game.getPermanent(target);
if (permanent != null) {
rustTick.addConnectedCard("RustTick", permanent.getId());
permanent.tap(game);
} else {
return false;
}
}
return true;
}
@Override
public RustTickTapTargetEffect copy() {
return new RustTickTapTargetEffect(this);
}
@Override
public String getText(Mode mode) {
return staticText;
}
}
class RustTickRestrictionEffect extends RestrictionEffect {
public RustTickRestrictionEffect() {
super(Duration.WhileOnBattlefield);
}
public RustTickRestrictionEffect(final RustTickRestrictionEffect effect) {
super(effect);
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
Permanent rustTick = game.getPermanent(source.getSourceId());
if (rustTick != null && rustTick.isTapped()) {
if (rustTick.getConnectedCards("RustTick").size() > 0) {
UUID target = rustTick.getConnectedCards("RustTick").get(0);
if (target != null && target.equals(permanent.getId())) {
return true;
}
}
}
return false;
}
@Override
public boolean canBeUntapped(Permanent permanent, Ability source, Game game) {
return false;
}
@Override
public RustTickRestrictionEffect copy() {
return new RustTickRestrictionEffect(this);
}
}

View file

@ -28,17 +28,19 @@
package mage.sets.scourge; package mage.sets.scourge;
import java.util.UUID; import java.util.UUID;
import mage.constants.*;
import mage.MageInt; import mage.MageInt;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.LeavesBattlefieldTriggeredAbility; import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate;
@ -46,7 +48,7 @@ import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.ExileZone; import mage.game.ExileZone;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token; import mage.game.permanent.token.DragonToken2;
/** /**
* *
@ -106,7 +108,7 @@ class DayOfTheDragonsEntersEffect extends OneShotEffect {
} }
} }
} }
DragonToken token = new DragonToken(); DragonToken2 token = new DragonToken2();
token.putOntoBattlefield(creaturesExiled, game, source.getSourceId(), source.getControllerId()); token.putOntoBattlefield(creaturesExiled, game, source.getSourceId(), source.getControllerId());
return true; return true;
} }
@ -163,16 +165,3 @@ class DayOfTheDragonsLeavesEffect extends OneShotEffect {
return new DayOfTheDragonsLeavesEffect(this); return new DayOfTheDragonsLeavesEffect(this);
} }
} }
class DragonToken extends Token {
public DragonToken() {
super("Dragon", "5/5 red Dragon creature token with flying");
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add("Dragon");
power = new MageInt(5);
toughness = new MageInt(5);
addAbility(FlyingAbility.getInstance());
}
}

View file

@ -30,12 +30,10 @@ package mage.sets.scourge;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.StormAbility; import mage.abilities.keyword.StormAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.game.permanent.token.Token; import mage.game.permanent.token.BeastToken2;
/** /**
* *
@ -47,9 +45,8 @@ public class HuntingPack extends CardImpl {
super(ownerId, 121, "Hunting Pack", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{5}{G}{G}"); super(ownerId, 121, "Hunting Pack", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{5}{G}{G}");
this.expansionSetCode = "SCG"; this.expansionSetCode = "SCG";
// Put a 4/4 green Beast creature token onto the battlefield. // Put a 4/4 green Beast creature token onto the battlefield.
this.getSpellAbility().addEffect(new CreateTokenEffect(new HuntingPackToken(), 1)); this.getSpellAbility().addEffect(new CreateTokenEffect(new BeastToken2(), 1));
// Storm // Storm
this.addAbility(new StormAbility()); this.addAbility(new StormAbility());
} }
@ -63,15 +60,3 @@ public class HuntingPack extends CardImpl {
return new HuntingPack(this); return new HuntingPack(this);
} }
} }
class HuntingPackToken extends Token {
public HuntingPackToken() {
super("Beast", "4/4 green Beast creature token");
cardType.add(CardType.CREATURE);
subtype.add("Beast");
this.color.setGreen(true);
power = new MageInt(4);
toughness = new MageInt(4);
}
}

View file

@ -28,12 +28,10 @@
package mage.sets.shardsofalara; package mage.sets.shardsofalara;
import java.util.UUID; import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.combat.AttacksIfAbleAllEffect; import mage.abilities.effects.common.combat.AttacksIfAbleAllEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
@ -42,7 +40,7 @@ import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.permanent.token.Token; import mage.game.permanent.token.GoblinTokenWithHaste;
import mage.watchers.common.AttackedThisTurnWatcher; import mage.watchers.common.AttackedThisTurnWatcher;
/** /**
@ -62,7 +60,7 @@ public class GoblinAssault extends CardImpl {
this.expansionSetCode = "ALA"; this.expansionSetCode = "ALA";
// At the beginning of your upkeep, put a 1/1 red Goblin creature token with haste onto the battlefield. // At the beginning of your upkeep, put a 1/1 red Goblin creature token with haste onto the battlefield.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new CreateTokenEffect(new GoblinAssaultToken()), TargetController.YOU, false)); this.addAbility(new BeginningOfUpkeepTriggeredAbility(new CreateTokenEffect(new GoblinTokenWithHaste()), TargetController.YOU, false));
// Goblin creatures attack each turn if able. // Goblin creatures attack each turn if able.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AttacksIfAbleAllEffect(filter, Duration.WhileOnBattlefield)), new AttackedThisTurnWatcher()); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AttacksIfAbleAllEffect(filter, Duration.WhileOnBattlefield)), new AttackedThisTurnWatcher());
@ -77,17 +75,3 @@ public class GoblinAssault extends CardImpl {
return new GoblinAssault(this); return new GoblinAssault(this);
} }
} }
class GoblinAssaultToken extends Token {
public GoblinAssaultToken() {
super("Goblin", "1/1 red Goblin creature token with haste");
cardType.add(CardType.CREATURE);
subtype.add("Goblin");
color.setRed(true);
power = new MageInt(1);
toughness = new MageInt(1);
this.addAbility(HasteAbility.getInstance());
}
}

View file

@ -0,0 +1,76 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.tempest;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.common.SkipUntapOptionalAbility;
import mage.abilities.effects.common.DontUntapAsLongAsSourceTappedEffect;
import mage.abilities.effects.common.TapTargetEffect;
import mage.abilities.keyword.ShadowAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LoneFox
*/
public class ThalakosDreamsower extends CardImpl {
public ThalakosDreamsower(UUID ownerId) {
super(ownerId, 92, "Thalakos Dreamsower", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{U}");
this.expansionSetCode = "TMP";
this.subtype.add("Thalakos");
this.subtype.add("Wizard");
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Shadow
this.addAbility(ShadowAbility.getInstance());
// You may choose not to untap Thalakos Dreamsower during your untap step.
this.addAbility(new SkipUntapOptionalAbility());
// Whenever Thalakos Dreamsower deals damage to an opponent, tap target creature. That creature doesn't untap during its controller's untap step for as long as Thalakos Dreamsower remains tapped.
Ability ability = new DealsDamageToOpponentTriggeredAbility(new TapTargetEffect(), false);
ability.addTarget(new TargetCreaturePermanent());
ability.addEffect(new DontUntapAsLongAsSourceTappedEffect());
this.addAbility(ability);
}
public ThalakosDreamsower(final ThalakosDreamsower card) {
super(card);
}
@Override
public ThalakosDreamsower copy() {
return new ThalakosDreamsower(this);
}
}

View file

@ -28,18 +28,15 @@
package mage.sets.tenthedition; package mage.sets.tenthedition;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.permanent.token.Token; import mage.game.permanent.token.DragonToken2;
/** /**
* *
@ -63,16 +60,3 @@ public class DragonRoost extends CardImpl {
return new DragonRoost(this); return new DragonRoost(this);
} }
} }
class DragonToken2 extends Token {
DragonToken2() {
super("Dragon", "5/5 red Dragon creature token with flying");
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add("Dragon");
power = new MageInt(5);
toughness = new MageInt(5);
addAbility(FlyingAbility.getInstance());
}
}

View file

@ -0,0 +1,74 @@
/*
* 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.urzassaga;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SkipUntapOptionalAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.DontUntapAsLongAsSourceTappedEffect;
import mage.abilities.effects.common.TapTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.target.common.TargetLandPermanent;
/**
*
* @author LoneFox
*/
public class ManaLeech extends CardImpl {
public ManaLeech(UUID ownerId) {
super(ownerId, 141, "Mana Leech", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{B}");
this.expansionSetCode = "USG";
this.subtype.add("Leech");
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// You may choose not to untap Mana Leech during your untap step.
this.addAbility(new SkipUntapOptionalAbility());
// {tap}: Tap target land. It doesn't untap during its controller's untap step for as long as Mana Leech remains tapped.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(), new TapSourceCost());
ability.addTarget(new TargetLandPermanent());
ability.addEffect(new DontUntapAsLongAsSourceTappedEffect());
this.addAbility(ability);
}
public ManaLeech(final ManaLeech card) {
super(card);
}
@Override
public ManaLeech copy() {
return new ManaLeech(this);
}
}

View file

@ -38,12 +38,11 @@ import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.permanent.token.Token; import mage.game.permanent.token.DragonToken2;
/** /**
* *
@ -67,7 +66,7 @@ public class DragonmasterOutcast extends CardImpl {
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// At the beginning of your upkeep, if you control six or more lands, put a 5/5 red Dragon creature token with flying onto the battlefield. // At the beginning of your upkeep, if you control six or more lands, put a 5/5 red Dragon creature token with flying onto the battlefield.
TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(new CreateTokenEffect(new DragonToken(), 1), TargetController.YOU, false); TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(new CreateTokenEffect(new DragonToken2(), 1), TargetController.YOU, false);
this.addAbility(new ConditionalTriggeredAbility(ability, new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 5), "At the beginning of your upkeep, if you control six or more lands, put a 5/5 red Dragon creature token with flying onto the battlefield.")); this.addAbility(new ConditionalTriggeredAbility(ability, new PermanentsOnTheBattlefieldCondition(filter, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 5), "At the beginning of your upkeep, if you control six or more lands, put a 5/5 red Dragon creature token with flying onto the battlefield."));
} }
@ -80,16 +79,3 @@ public class DragonmasterOutcast extends CardImpl {
return new DragonmasterOutcast(this); return new DragonmasterOutcast(this);
} }
} }
class DragonToken extends Token {
public DragonToken() {
super("Dragon", "5/5 red Dragon creature token with flying");
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add("Dragon");
power = new MageInt(5);
toughness = new MageInt(5);
addAbility(FlyingAbility.getInstance());
}
}

View file

@ -28,21 +28,19 @@
package mage.sets.zendikar; package mage.sets.zendikar;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.costs.AlternativeCostImpl; import mage.abilities.costs.AlternativeCostImpl;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.WatcherScope; import mage.constants.WatcherScope;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token; import mage.game.permanent.token.BeastToken2;
import mage.watchers.Watcher; import mage.watchers.Watcher;
/** /**
@ -62,7 +60,7 @@ public class BalothCageTrap extends CardImpl {
this.getSpellAbility().addWatcher(new BalothCageTrapWatcher()); this.getSpellAbility().addWatcher(new BalothCageTrapWatcher());
// Put a 4/4 green Beast creature token onto the battlefield. // Put a 4/4 green Beast creature token onto the battlefield.
this.getSpellAbility().addEffect(new CreateTokenEffect(new BeastGreenToken())); this.getSpellAbility().addEffect(new CreateTokenEffect(new BeastToken2()));
} }
public BalothCageTrap(final BalothCageTrap card) { public BalothCageTrap(final BalothCageTrap card) {
@ -140,15 +138,3 @@ class BalothCageTrapAlternativeCost extends AlternativeCostImpl {
return "If an opponent had an artifact enter the battlefield under his or her control this turn, you may pay {1}{G} rather than pay Baloth Cage Trap's mana cost"; return "If an opponent had an artifact enter the battlefield under his or her control this turn, you may pay {1}{G} rather than pay Baloth Cage Trap's mana cost";
} }
} }
class BeastGreenToken extends Token {
public BeastGreenToken() {
super("Beast", "4/4 green Beast creature token");
cardType.add(CardType.CREATURE);
color.setGreen(true);
subtype.add("Beast");
power = new MageInt(4);
toughness = new MageInt(4);
}
}

View file

@ -36,7 +36,7 @@ import mage.abilities.common.LandfallAbility;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.game.permanent.token.Token; import mage.game.permanent.token.BirdToken;
/** /**
* *
@ -66,16 +66,3 @@ public class EmeriaAngel extends CardImpl {
} }
} }
class BirdToken extends Token {
public BirdToken() {
super("Bird", "1/1 white Bird creature token with flying");
cardType.add(CardType.CREATURE);
color.setWhite(true);
subtype.add("Bird");
power = new MageInt(1);
toughness = new MageInt(1);
addAbility(FlyingAbility.getInstance());
}
}

View file

@ -29,14 +29,14 @@
package mage.sets.zendikar; package mage.sets.zendikar;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.LandfallAbility; import mage.abilities.common.LandfallAbility;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.game.permanent.token.Token; import mage.constants.CardType;
import mage.constants.Rarity;
import mage.game.permanent.token.BeastToken2;
/** /**
* *
@ -52,7 +52,7 @@ public class RampagingBaloths extends CardImpl {
this.power = new MageInt(6); this.power = new MageInt(6);
this.toughness = new MageInt(6); this.toughness = new MageInt(6);
this.addAbility(TrampleAbility.getInstance()); this.addAbility(TrampleAbility.getInstance());
this.addAbility(new LandfallAbility(new CreateTokenEffect(new RampagingBalothsToken()), true)); this.addAbility(new LandfallAbility(new CreateTokenEffect(new BeastToken2()), true));
} }
public RampagingBaloths(final RampagingBaloths card) { public RampagingBaloths(final RampagingBaloths card) {
@ -65,15 +65,3 @@ public class RampagingBaloths extends CardImpl {
} }
} }
class RampagingBalothsToken extends Token {
public RampagingBalothsToken() {
super("Beast", "4/4 green Beast creature token");
cardType.add(CardType.CREATURE);
subtype.add("Beast");
this.color.setGreen(true);
power = new MageInt(4);
toughness = new MageInt(4);
}
}

View file

@ -0,0 +1,72 @@
/*
* 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 org.mage.test.cards.planeswalker;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class JaceTest extends CardTestPlayerBase {
@Test
public void TelepathUnboundSecondAbility() {
// +1: Up to one target creature gets -2/-0 until your next turn.
// -3: You may cast target instant or sorcery card from your graveyard this turn. If that card would be put into your graveyard this turn, exile it instead.
// -9: You get an emblem with "Whenever you cast a spell, target opponent puts the top five cards of his or her library into his or her graveyard".
addCard(Zone.BATTLEFIELD, playerA, "Jace, Telepath Unbound"); // starts with 7 Loyality counters
// As an additional cost to cast Magmatic Insight, discard a land card.
// Draw two cards.
addCard(Zone.GRAVEYARD, playerA, "Magmatic Insight");// {R}
addCard(Zone.HAND, playerA, "Plains");
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "-3: You may cast target instant", "Magmatic Insight");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Magmatic Insight");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Jace, Telepath Unbound", 1);
assertCounterCount("Jace, Telepath Unbound", CounterType.LOYALTY, 2); // 5 - 3 = 2
assertExileCount("Magmatic Insight", 1);
assertHandCount(playerA, 2);
}
}

View file

@ -40,24 +40,30 @@ import mage.target.targetpointer.FixedTarget;
*/ */
public class DealsDamageToOpponentTriggeredAbility extends TriggeredAbilityImpl { public class DealsDamageToOpponentTriggeredAbility extends TriggeredAbilityImpl {
boolean onlyCombat; private final boolean onlyCombat, setTargetPointer;
public DealsDamageToOpponentTriggeredAbility(Effect effect) { public DealsDamageToOpponentTriggeredAbility(Effect effect) {
this(effect, false, false); this(effect, false, false, false);
} }
public DealsDamageToOpponentTriggeredAbility(Effect effect, boolean optional) { public DealsDamageToOpponentTriggeredAbility(Effect effect, boolean optional) {
this(effect, optional, false); this(effect, optional, false, false);
} }
public DealsDamageToOpponentTriggeredAbility(Effect effect, boolean optional, boolean onlyCombat) { public DealsDamageToOpponentTriggeredAbility(Effect effect, boolean optional, boolean onlyCombat) {
this(effect, optional, onlyCombat, false);
}
public DealsDamageToOpponentTriggeredAbility(Effect effect, boolean optional, boolean onlyCombat, boolean setTargetPointer) {
super(Zone.BATTLEFIELD, effect, optional); super(Zone.BATTLEFIELD, effect, optional);
this.onlyCombat = onlyCombat; this.onlyCombat = onlyCombat;
this.setTargetPointer = setTargetPointer;
} }
public DealsDamageToOpponentTriggeredAbility(final DealsDamageToOpponentTriggeredAbility ability) { public DealsDamageToOpponentTriggeredAbility(final DealsDamageToOpponentTriggeredAbility ability) {
super(ability); super(ability);
this.onlyCombat = ability.onlyCombat; this.onlyCombat = ability.onlyCombat;
this.setTargetPointer = ability.setTargetPointer;
} }
@Override @Override
@ -80,9 +86,11 @@ public class DealsDamageToOpponentTriggeredAbility extends TriggeredAbilityImpl
return false; return false;
} }
} }
for (Effect effect : getEffects()) { if(setTargetPointer) {
effect.setTargetPointer(new FixedTarget(event.getTargetId())); for (Effect effect : getEffects()) {
effect.setValue("damage", event.getAmount()); effect.setTargetPointer(new FixedTarget(event.getTargetId()));
effect.setValue("damage", event.getAmount());
}
} }
return true; return true;
} }

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.abilities.effects.common;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.condition.common.SourceTappedCondition;
import mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect;
import mage.abilities.effects.common.DontUntapInControllersUntapStepTargetEffect;
import mage.constants.Duration;
import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
* @author LoneFox
*/
public class DontUntapAsLongAsSourceTappedEffect extends ConditionalContinuousRuleModifyingEffect {
public DontUntapAsLongAsSourceTappedEffect() {
super(new DontUntapInControllersUntapStepTargetEffect(Duration.Custom), SourceTappedCondition.getInstance());
staticText = "It doesn't untap during its controller's untap step for as long as {source} remains tapped.";
}
public DontUntapAsLongAsSourceTappedEffect(final DontUntapAsLongAsSourceTappedEffect effect) {
super(effect);
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if(event.getType() == GameEvent.EventType.UNTAP && event.getTargetId().equals(source.getSourceId())) {
effect.discard();
}
return super.applies(event, source, game);
}
@Override
public DontUntapAsLongAsSourceTappedEffect copy() {
return new DontUntapAsLongAsSourceTappedEffect(this);
}
}

View file

@ -28,15 +28,14 @@
package mage.abilities.effects.common; package mage.abilities.effects.common;
import mage.constants.Outcome; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.Mode; import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.Target; import mage.target.Target;
import java.util.UUID;
import mage.util.CardUtil; import mage.util.CardUtil;
/** /**
@ -49,8 +48,10 @@ public class TapTargetEffect extends OneShotEffect {
} }
public TapTargetEffect(String text) { public TapTargetEffect(String text) {
this(); super(Outcome.Tap);
this.staticText = text; if(text != null) {
this.staticText = text;
}
} }
public TapTargetEffect(final TapTargetEffect effect) { public TapTargetEffect(final TapTargetEffect effect) {

View file

@ -71,6 +71,7 @@ public enum CounterType {
M1M1(new BoostCounter(-1, -1).name), M1M1(new BoostCounter(-1, -1).name),
M2M2(new BoostCounter(-2, -2).name), M2M2(new BoostCounter(-2, -2).name),
MINING("mining"), MINING("mining"),
MUSTER("muster"),
P1P0(new BoostCounter(1, 0).name), P1P0(new BoostCounter(1, 0).name),
P1P1(new BoostCounter(1, 1).name), P1P1(new BoostCounter(1, 1).name),
P2P2(new BoostCounter(2, 2).name), P2P2(new BoostCounter(2, 2).name),

View file

@ -0,0 +1,67 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.game.permanent.token;
import java.util.Arrays;
import mage.constants.CardType;
import mage.MageInt;
/**
*
* @author LoneFox
*/
public class BeastToken2 extends Token {
public BeastToken2() {
super("Beast", "4/4 green Beast creature token");
cardType.add(CardType.CREATURE);
color.setGreen(true);
subtype.add("Beast");
power = new MageInt(4);
toughness = new MageInt(4);
availableImageSetCodes.addAll(Arrays.asList("ZEN", "C14", "DDD"));
}
public BeastToken2(final BeastToken2 token) {
super(token);
}
@Override
public BeastToken2 copy() {
return new BeastToken2(this);
}
@Override
public void setExpansionSetCodeForImage(String code) {
super.setExpansionSetCodeForImage(code);
if(getOriginalExpansionSetCode().equals("C14") || getOriginalExpansionSetCode().equals("DDD")) {
this.setTokenType(2);
}
}
}

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.game.permanent.token;
import java.util.Arrays;
import mage.constants.CardType;
import mage.MageInt;
import mage.abilities.keyword.FlyingAbility;
/**
*
* @author LoneFox
*/
public class BirdToken extends Token {
public BirdToken() {
super("Bird", "1/1 white Bird creature token with flying");
cardType.add(CardType.CREATURE);
color.setWhite(true);
subtype.add("Bird");
power = new MageInt(1);
toughness = new MageInt(1);
addAbility(FlyingAbility.getInstance());
availableImageSetCodes.addAll(Arrays.asList("BNG", "RTR", "ZEN"));
}
public BirdToken(final BirdToken token) {
super(token);
}
@Override
public BirdToken copy() {
return new BirdToken(this);
}
@Override
public void setExpansionSetCodeForImage(String code) {
super.setExpansionSetCodeForImage(code);
if (getOriginalExpansionSetCode().equals("BNG")) {
this.setTokenType(1);
}
}
}

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.game.permanent.token;
import java.util.Arrays;
import mage.constants.CardType;
import mage.MageInt;
import mage.abilities.keyword.FlyingAbility;
/**
*
* @author LoneFox
*/
public class DragonToken2 extends Token {
public DragonToken2() {
super("Dragon", "5/5 red Dragon creature token with flying");
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add("Dragon");
power = new MageInt(5);
toughness = new MageInt(5);
addAbility(FlyingAbility.getInstance());
availableImageSetCodes.addAll(Arrays.asList("WWK", "10E"));
}
}

View file

@ -39,7 +39,8 @@ public class GoblinToken extends Token {
public GoblinToken() { public GoblinToken() {
super("Goblin", "1/1 red Goblin creature token"); super("Goblin", "1/1 red Goblin creature token");
availableImageSetCodes.addAll(Arrays.asList("SOM", "M10", "C14", "KTK", "EVG", "DTK", "ORI", "DDG")); availableImageSetCodes.addAll(Arrays.asList("10E", "ALA", "SOM", "M10", "NPH", "M13", "RTR",
"MMA", "M15", "C14", "KTK", "EVG", "DTK", "ORI", "DDG", "DDN"));
cardType.add(CardType.CREATURE); cardType.add(CardType.CREATURE);
subtype.add("Goblin"); subtype.add("Goblin");

View file

@ -0,0 +1,45 @@
/*
* 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.game.permanent.token;
import mage.abilities.keyword.HasteAbility;
/**
*
* @author LoneFox
*/
// Currently there are no separate images for this, let's use the same ones as the regular Goblin token.
public class GoblinTokenWithHaste extends GoblinToken {
public GoblinTokenWithHaste() {
super();
addAbility(HasteAbility.getInstance());
}
}

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.game.permanent.token;
import mage.constants.CardType;
import mage.MageInt;
import mage.abilities.keyword.HasteAbility;
/**
*
* @author LoneFox
*/
public class SoldierTokenWithHaste extends Token {
public SoldierTokenWithHaste() {
super("Soldier", "1/1 red and white Soldier creature token with haste");
cardType.add(CardType.CREATURE);
color.setWhite(true);
color.setRed(true);
subtype.add("Soldier");
power = new MageInt(1);
toughness = new MageInt(1);
addAbility(HasteAbility.getInstance());
setOriginalExpansionSetCode("GTC");
}
}

View file

@ -44,7 +44,7 @@ public class ThopterColorlessToken extends Token {
final static private List<String> tokenImageSets = new ArrayList<>(); final static private List<String> tokenImageSets = new ArrayList<>();
static { static {
tokenImageSets.addAll(Arrays.asList("EXO", "ORI")); tokenImageSets.addAll(Arrays.asList("MBS", "ORI"));
} }
public ThopterColorlessToken() { public ThopterColorlessToken() {

View file

@ -0,0 +1,51 @@
/*
* 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.game.permanent.token;
import mage.constants.CardType;
import mage.MageInt;
import mage.abilities.keyword.TrampleAbility;
/**
*
* @author LoneFox
*/
public class WurmToken2 extends Token {
public WurmToken2() {
super("Wurm", "5/5 green Wurm creature token with trample");
cardType.add(CardType.CREATURE);
color.setGreen(true);
subtype.add("Wurm");
power = new MageInt(5);
toughness = new MageInt(5);
addAbility(TrampleAbility.getInstance());
setOriginalExpansionSetCode("RTR");
}
}