mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
* Replaced some custom card effects. Updated enters battlefield replacement effects for new handling.
This commit is contained in:
parent
ff0aace404
commit
9ab9988307
29 changed files with 437 additions and 632 deletions
|
@ -31,6 +31,7 @@ import java.util.UUID;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
|
@ -41,7 +42,6 @@ import mage.constants.Rarity;
|
|||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterArtifactCard;
|
||||
import mage.filter.predicate.mageobject.AnotherCardPredicate;
|
||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
@ -62,7 +62,8 @@ public class ArsenalThresher extends CardImpl {
|
|||
this.toughness = new MageInt(2);
|
||||
|
||||
// As Arsenal Thresher enters the battlefield, you may reveal any number of other artifact cards from your hand. Arsenal Thresher enters the battlefield with a +1/+1 counter on it for each card revealed this way.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ArsenalThresherEffect(), "you may reveal any number of other artifact cards from your hand. {this} enters the battlefield with a +1/+1 counter on it for each card revealed this way"));
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ArsenalThresherEffect(),
|
||||
"you may reveal any number of other artifact cards from your hand. {this} enters the battlefield with a +1/+1 counter on it for each card revealed this way"));
|
||||
}
|
||||
|
||||
public ArsenalThresher(final ArsenalThresher card) {
|
||||
|
@ -92,28 +93,28 @@ class ArsenalThresherEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
if (you == null) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
Permanent arsenalThresher = game.getPermanent(source.getSourceId());
|
||||
Permanent arsenalThresher = (Permanent) getValue(EntersBattlefieldEffect.ENTERING_PERMANENT);
|
||||
FilterArtifactCard filter = new FilterArtifactCard();
|
||||
filter.add(new AnotherCardPredicate());
|
||||
if (you.chooseUse(Outcome.Benefit, "Do you want to reveal other artifacts in your hand?", source, game)) {
|
||||
if (controller.chooseUse(Outcome.Benefit, "Do you want to reveal other artifacts in your hand?", source, game)) {
|
||||
Cards cards = new CardsImpl();
|
||||
if (you.getHand().count(filter, source.getSourceId(), source.getControllerId(), game) > 0) {
|
||||
if (controller.getHand().count(filter, source.getSourceId(), source.getControllerId(), game) > 0) {
|
||||
TargetCardInHand target = new TargetCardInHand(0, Integer.MAX_VALUE, filter);
|
||||
if (you.choose(Outcome.Benefit, target, source.getSourceId(), game)) {
|
||||
if (controller.choose(Outcome.Benefit, target, source.getSourceId(), game)) {
|
||||
for (UUID uuid : target.getTargets()) {
|
||||
cards.add(you.getHand().get(uuid, game));
|
||||
cards.add(controller.getHand().get(uuid, game));
|
||||
}
|
||||
you.revealCards("Revealed cards", cards, game);
|
||||
if (arsenalThresher != null) {
|
||||
controller.revealCards(arsenalThresher.getIdName(), cards, game);
|
||||
arsenalThresher.addCounters(CounterType.P1P1.createInstance(cards.size()), game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import mage.MageInt;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.dynamicvalue.common.CardsInAllGraveyardsCount;
|
||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CopyEffect;
|
||||
import mage.cards.Card;
|
||||
|
@ -97,7 +98,7 @@ class TheMimeoplasmEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
Permanent permanent = (Permanent) getValue(EntersBattlefieldEffect.ENTERING_PERMANENT);
|
||||
if (controller != null && permanent != null) {
|
||||
if (new CardsInAllGraveyardsCount(new FilterCreatureCard()).calculate(game, source, this) >= 2) {
|
||||
if (controller.chooseUse(Outcome.Benefit, "Do you want to exile two creature cards from graveyards?", source, game)) {
|
||||
|
|
|
@ -32,6 +32,7 @@ import mage.MageObject;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.cards.Card;
|
||||
|
@ -91,7 +92,7 @@ class BitterFeudEntersBattlefieldEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
Permanent permanent = (Permanent) getValue(EntersBattlefieldEffect.ENTERING_PERMANENT);
|
||||
if (controller != null && permanent != null) {
|
||||
TargetPlayer target = new TargetPlayer(2, 2, true);
|
||||
controller.chooseTarget(outcome, target, source, game);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.sets.conflux;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
|
@ -34,16 +35,16 @@ import mage.abilities.common.SimpleStaticAbility;
|
|||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.SignInversionDynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ChooseOpponentEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -60,7 +61,7 @@ public class Nyxathid extends CardImpl {
|
|||
this.toughness = new MageInt(7);
|
||||
|
||||
// As Nyxathid enters the battlefield, choose an opponent.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseOpponent()));
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseOpponentEffect(Outcome.Detriment)));
|
||||
|
||||
// Nyxathid gets -1/-1 for each card in the chosen player's hand.
|
||||
DynamicValue chosenPlayerHand = new SignInversionDynamicValue(new CardsInChosenPlayerHandCount());
|
||||
|
@ -78,48 +79,12 @@ public class Nyxathid extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class ChooseOpponent extends OneShotEffect {
|
||||
|
||||
public ChooseOpponent() {
|
||||
super(Outcome.Neutral);
|
||||
this.staticText = "choose an opponent";
|
||||
}
|
||||
|
||||
public ChooseOpponent(final ChooseOpponent effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChooseOpponent copy() {
|
||||
return new ChooseOpponent(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (player != null && permanent != null) {
|
||||
TargetOpponent target = new TargetOpponent();
|
||||
target.setNotTarget(true);
|
||||
if (player.choose(this.outcome, target, source.getSourceId(), game)) {
|
||||
Player chosenPlayer = game.getPlayer(target.getFirstTarget());
|
||||
if (chosenPlayer != null) {
|
||||
game.informPlayers(permanent.getName() + ": " + player.getLogName() + " has chosen " + chosenPlayer.getLogName());
|
||||
game.getState().setValue(permanent.getId() + "_player", target.getFirstTarget());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class CardsInChosenPlayerHandCount implements DynamicValue {
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
if (sourceAbility != null) {
|
||||
UUID playerId = (UUID) game.getState().getValue(sourceAbility.getSourceId() + "_player");
|
||||
UUID playerId = (UUID) game.getState().getValue(sourceAbility.getSourceId() + ChooseOpponentEffect.VALUE_KEY);
|
||||
Player chosenPlayer = game.getPlayer(playerId);
|
||||
if (chosenPlayer != null) {
|
||||
return chosenPlayer.getHand().size();
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.util.UUID;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
|
@ -61,11 +62,7 @@ public class CankerAbomination extends CardImpl {
|
|||
this.toughness = new MageInt(6);
|
||||
|
||||
// As Canker Abomination enters the battlefield, choose an opponent. Canker Abomination enters the battlefield with a -1/-1 counter on it for each creature that player controls.
|
||||
Ability ability = new AsEntersBattlefieldAbility(new CankerAbominationEffect());
|
||||
Target target = new TargetOpponent();
|
||||
target.setNotTarget(true);
|
||||
ability.addTarget(target);
|
||||
this.addAbility(ability);
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new CankerAbominationEffect()));
|
||||
|
||||
}
|
||||
|
||||
|
@ -97,14 +94,19 @@ class CankerAbominationEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent CankerAbomination = game.getPermanent(source.getSourceId());
|
||||
if (player != null && CankerAbomination != null) {
|
||||
Player chosenPlayer = game.getPlayer(source.getFirstTarget());
|
||||
if (chosenPlayer != null) {
|
||||
game.informPlayers(CankerAbomination.getName() + ": " + player.getLogName() + " has chosen " + chosenPlayer.getLogName());
|
||||
int amount = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), chosenPlayer.getId(), game).size();
|
||||
CankerAbomination.addCounters(CounterType.M1M1.createInstance(amount), game);
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent cankerAbomination = (Permanent) getValue(EntersBattlefieldEffect.ENTERING_PERMANENT);
|
||||
if (controller != null && cankerAbomination != null) {
|
||||
Target target = new TargetOpponent();
|
||||
target.setNotTarget(true);
|
||||
controller.choose(outcome, target, source.getSourceId(), game);
|
||||
Player opponent = game.getPlayer(target.getFirstTarget());
|
||||
if (opponent != null) {
|
||||
game.informPlayers(cankerAbomination.getName() + ": " + controller.getLogName() + " has chosen " + opponent.getLogName());
|
||||
int amount = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), opponent.getId(), game).size();
|
||||
if (amount > 0) {
|
||||
cankerAbomination.addCounters(CounterType.M1M1.createInstance(amount), game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.sets.exodus;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
|
@ -34,18 +35,18 @@ import mage.abilities.common.DealsDamageToAPlayerTriggeredAbility;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ChooseOpponentEffect;
|
||||
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
|
||||
import mage.abilities.effects.common.discard.DiscardTargetEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -66,7 +67,7 @@ public class EntropicSpecter extends CardImpl {
|
|||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// As Entropic Specter enters the battlefield, choose an opponent.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseOpponent()));
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseOpponentEffect(Outcome.Detriment)));
|
||||
|
||||
// Entropic Specter's power and toughness are each equal to the number of cards in the chosen player's hand.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(new CardsInTargetPlayerHandCount(), Duration.WhileOnBattlefield)));
|
||||
|
@ -85,47 +86,12 @@ public class EntropicSpecter extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class ChooseOpponent extends OneShotEffect {
|
||||
|
||||
public ChooseOpponent() {
|
||||
super(Outcome.Neutral);
|
||||
this.staticText = "choose an opponent";
|
||||
}
|
||||
|
||||
public ChooseOpponent(final ChooseOpponent effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChooseOpponent copy() {
|
||||
return new ChooseOpponent(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (player != null && permanent != null) {
|
||||
TargetOpponent target = new TargetOpponent();
|
||||
target.setNotTarget(true);
|
||||
if (player.choose(this.outcome, target, source.getSourceId(), game)) {
|
||||
Player chosenPlayer = game.getPlayer(target.getFirstTarget());
|
||||
if (chosenPlayer != null) {
|
||||
game.informPlayers(permanent.getName() + ": " + player.getLogName() + " has chosen " + chosenPlayer.getLogName());
|
||||
game.getState().setValue(permanent.getId() + "_player", target.getFirstTarget());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class CardsInTargetPlayerHandCount implements DynamicValue {
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
if (sourceAbility != null) {
|
||||
UUID playerId = (UUID) game.getState().getValue(sourceAbility.getSourceId() + "_player");
|
||||
UUID playerId = (UUID) game.getState().getValue(sourceAbility.getSourceId() + ChooseOpponentEffect.VALUE_KEY);
|
||||
Player chosenPlayer = game.getPlayer(playerId);
|
||||
if (chosenPlayer != null) {
|
||||
return chosenPlayer.getHand().size();
|
||||
|
|
|
@ -32,6 +32,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ChooseOpponentEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
|
@ -40,9 +41,7 @@ import mage.constants.Zone;
|
|||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -55,7 +54,7 @@ public class TheRack extends CardImpl {
|
|||
this.expansionSetCode = "4ED";
|
||||
|
||||
// As The Rack enters the battlefield, choose an opponent.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseOpponent()));
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseOpponentEffect(Outcome.Detriment)));
|
||||
// At the beginning of the chosen player's upkeep, The Rack deals X damage to that player, where X is 3 minus the number of cards in his or her hand.
|
||||
this.addAbility(new TheRackTriggeredAbility());
|
||||
}
|
||||
|
@ -72,7 +71,6 @@ public class TheRack extends CardImpl {
|
|||
|
||||
class TheRackTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
|
||||
public TheRackTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new TheRackEffect(), false);
|
||||
}
|
||||
|
@ -93,7 +91,7 @@ class TheRackTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
return event.getPlayerId().equals((UUID) game.getState().getValue(new StringBuilder(this.getSourceId().toString()).append("_player").toString()));
|
||||
return event.getPlayerId().equals((UUID) game.getState().getValue(this.getSourceId().toString() + ChooseOpponentEffect.VALUE_KEY));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -103,42 +101,6 @@ class TheRackTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
}
|
||||
|
||||
class ChooseOpponent extends OneShotEffect {
|
||||
|
||||
public ChooseOpponent() {
|
||||
super(Outcome.Neutral);
|
||||
this.staticText = "choose an opponent";
|
||||
}
|
||||
|
||||
public ChooseOpponent(final ChooseOpponent effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChooseOpponent copy() {
|
||||
return new ChooseOpponent(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (player != null && permanent != null) {
|
||||
TargetOpponent target = new TargetOpponent();
|
||||
target.setNotTarget(true);
|
||||
if (player.choose(this.outcome, target, source.getSourceId(), game)) {
|
||||
Player chosenPlayer = game.getPlayer(target.getFirstTarget());
|
||||
if (chosenPlayer != null) {
|
||||
game.informPlayers(permanent.getName() + ": " + player.getLogName() + " has chosen " + chosenPlayer.getLogName());
|
||||
game.getState().setValue(permanent.getId() + "_player", target.getFirstTarget());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class TheRackEffect extends OneShotEffect {
|
||||
|
||||
public TheRackEffect() {
|
||||
|
|
|
@ -11,6 +11,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||
import mage.cards.Card;
|
||||
|
@ -23,6 +24,7 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
|
@ -73,8 +75,11 @@ class CloudKeyChooseTypeEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (sourceObject != null && controller != null) {
|
||||
MageObject mageObject = (Permanent) getValue(EntersBattlefieldEffect.ENTERING_PERMANENT);
|
||||
if (mageObject == null) {
|
||||
mageObject = game.getObject(source.getSourceId());
|
||||
}
|
||||
if (mageObject != null && controller != null) {
|
||||
ChoiceImpl choices = new ChoiceImpl(true);
|
||||
choices.setMessage("Choose a spell type");
|
||||
choices.getChoices().add(CardType.ARTIFACT.toString());
|
||||
|
@ -82,9 +87,12 @@ class CloudKeyChooseTypeEffect extends OneShotEffect {
|
|||
choices.getChoices().add(CardType.ENCHANTMENT.toString());
|
||||
choices.getChoices().add(CardType.INSTANT.toString());
|
||||
choices.getChoices().add(CardType.SORCERY.toString());
|
||||
if(controller.choose(Outcome.Neutral, choices, game)) {
|
||||
game.informPlayers(sourceObject.getLogName() + ": chosen spell type is " + choices.getChoice());
|
||||
if (controller.choose(Outcome.Neutral, choices, game)) {
|
||||
game.informPlayers(mageObject.getLogName() + ": chosen spell type is " + choices.getChoice());
|
||||
game.getState().setValue(source.getSourceId().toString() + "_CloudKey", choices.getChoice());
|
||||
if (mageObject instanceof Permanent) {
|
||||
((Permanent) mageObject).addInfo("chosenCardType", CardUtil.addToolTipMarkTags("Chosen card type: " + choices.getChoice()), game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -129,4 +137,3 @@ class CloudKeyCostModificationEffect extends CostModificationEffectImpl {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,18 @@ package mage.sets.gatecrash;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.ChooseBasicLandTypeEffect;
|
||||
import mage.abilities.mana.BlackManaAbility;
|
||||
import mage.abilities.mana.BlueManaAbility;
|
||||
import mage.abilities.mana.GreenManaAbility;
|
||||
import mage.abilities.mana.RedManaAbility;
|
||||
import mage.abilities.mana.WhiteManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
|
@ -36,15 +48,6 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.mana.*;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.filter.common.FilterControlledLandPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -66,7 +69,7 @@ public class Realmwright extends CardImpl {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// As Realmwright enters the battlefield, choose a basic land type.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new RealmwrightEffect()));
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseBasicLandTypeEffect(Outcome.Neutral)));
|
||||
|
||||
// Lands you control are the chosen type in addition to their other types.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new RealmwrightEffect2()));
|
||||
|
@ -82,44 +85,6 @@ public class Realmwright extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class RealmwrightEffect extends OneShotEffect {
|
||||
|
||||
public RealmwrightEffect() {
|
||||
super(Outcome.Neutral);
|
||||
this.staticText = "Choose a basic land type";
|
||||
}
|
||||
|
||||
public RealmwrightEffect(final RealmwrightEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RealmwrightEffect copy() {
|
||||
return new RealmwrightEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
if (you != null) {
|
||||
ChoiceImpl choices = new ChoiceImpl(true);
|
||||
choices.setMessage("Choose basic land type");
|
||||
choices.isRequired();
|
||||
choices.getChoices().add("Forest");
|
||||
choices.getChoices().add("Plains");
|
||||
choices.getChoices().add("Mountain");
|
||||
choices.getChoices().add("Island");
|
||||
choices.getChoices().add("Swamp");
|
||||
if (you.choose(Outcome.Neutral, choices, game)) {
|
||||
game.informPlayers(new StringBuilder("Realmwright: ").append(" Chosen basic land type is ").append(choices.getChoice()).toString());
|
||||
game.getState().setValue(source.getSourceId().toString() + "_Realmwright", choices.getChoice());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class RealmwrightEffect2 extends ContinuousEffectImpl {
|
||||
|
||||
public RealmwrightEffect2() {
|
||||
|
@ -140,7 +105,7 @@ class RealmwrightEffect2 extends ContinuousEffectImpl {
|
|||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
List<Permanent> lands = game.getBattlefield().getAllActivePermanents(new FilterControlledLandPermanent(), source.getControllerId(), game);
|
||||
String choice = (String) game.getState().getValue(source.getSourceId().toString() + "_Realmwright");
|
||||
String choice = (String) game.getState().getValue(source.getSourceId().toString() + ChooseBasicLandTypeEffect.VALUE_KEY);
|
||||
if (you != null && choice != null) {
|
||||
for (Permanent land : lands) {
|
||||
if (land != null) {
|
||||
|
|
|
@ -25,18 +25,17 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.sets.guildpact;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.costs.common.PayLifeCost;
|
||||
import mage.abilities.effects.common.TapSourceUnlessPaysEffect;
|
||||
import mage.abilities.mana.GreenManaAbility;
|
||||
import mage.abilities.mana.RedManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -44,17 +43,19 @@ import mage.cards.CardImpl;
|
|||
*/
|
||||
public class StompingGround extends CardImpl {
|
||||
|
||||
public StompingGround (UUID ownerId) {
|
||||
public StompingGround(UUID ownerId) {
|
||||
super(ownerId, 165, "Stomping Ground", Rarity.RARE, new CardType[]{CardType.LAND}, null);
|
||||
this.expansionSetCode = "GPT";
|
||||
this.subtype.add("Mountain");
|
||||
this.subtype.add("Forest");
|
||||
|
||||
this.addAbility(new RedManaAbility());
|
||||
this.addAbility(new GreenManaAbility());
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new TapSourceUnlessPaysEffect(new PayLifeCost(2)), "you may pay 2 life. If you don't, Stomping Ground enters the battlefield tapped"));
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new TapSourceUnlessPaysEffect(new PayLifeCost(2)),
|
||||
"you may pay 2 life. If you don't, {this} enters the battlefield tapped"));
|
||||
}
|
||||
|
||||
public StompingGround (final StompingGround card) {
|
||||
public StompingGround(final StompingGround card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,9 +33,8 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ChooseColorEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.choices.ChoiceColor;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
|
@ -46,8 +45,6 @@ import mage.constants.Zone;
|
|||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -61,7 +58,7 @@ public class HallOfTriumph extends CardImpl {
|
|||
this.supertype.add("Legendary");
|
||||
|
||||
// As Hall of Triumph enters the battlefield choose a color.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new HallOfTriumphEffect()));
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseColorEffect(Outcome.Neutral)));
|
||||
// Creatures you control of the chosen color get +1/+1.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new HallOfTriumphBoostControlledEffect()));
|
||||
}
|
||||
|
@ -76,45 +73,6 @@ public class HallOfTriumph extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class HallOfTriumphEffect extends OneShotEffect {
|
||||
|
||||
public HallOfTriumphEffect() {
|
||||
super(Outcome.BoostCreature);
|
||||
staticText = "choose a color";
|
||||
}
|
||||
|
||||
public HallOfTriumphEffect(final HallOfTriumphEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (player != null && permanent != null) {
|
||||
ChoiceColor colorChoice = new ChoiceColor();
|
||||
colorChoice.setMessage("Choose color");
|
||||
while (!player.choose(Outcome.BoostCreature, colorChoice, game)) {
|
||||
if (!player.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (colorChoice.getChoice() != null) {
|
||||
game.informPlayers(permanent.getName() + ": " + player.getLogName() + " has chosen " + colorChoice.getChoice());
|
||||
game.getState().setValue(permanent.getId() + "_color", colorChoice.getColor());
|
||||
permanent.addInfo("chosen color", "<font color = 'blue'>Chosen color: " + colorChoice.getColor().getDescription() + "</font>", game);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HallOfTriumphEffect copy() {
|
||||
return new HallOfTriumphEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class HallOfTriumphBoostControlledEffect extends ContinuousEffectImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
|
@ -137,7 +95,7 @@ class HallOfTriumphBoostControlledEffect extends ContinuousEffectImpl {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
ObjectColor color = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color");
|
||||
if (color != null) {
|
||||
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||
for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||
if (perm.getColor(game).shares(color)) {
|
||||
perm.addPower(1);
|
||||
perm.addToughness(1);
|
||||
|
|
|
@ -32,6 +32,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ChooseOpponentEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
|
@ -40,9 +41,7 @@ import mage.constants.Zone;
|
|||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -55,7 +54,7 @@ public class BlackVise extends CardImpl {
|
|||
this.expansionSetCode = "LEA";
|
||||
|
||||
// As Black Vise enters the battlefield, choose an opponent.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new BlackViseChooseOpponent()));
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseOpponentEffect(Outcome.Detriment)));
|
||||
// At the beginning of the chosen player's upkeep, Black Vise deals X damage to that player, where X is the number of cards in his or her hand minus 4.
|
||||
this.addAbility(new BlackViseTriggeredAbility());
|
||||
}
|
||||
|
@ -70,42 +69,6 @@ public class BlackVise extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class BlackViseChooseOpponent extends OneShotEffect {
|
||||
|
||||
public BlackViseChooseOpponent() {
|
||||
super(Outcome.Neutral);
|
||||
this.staticText = "choose an opponent";
|
||||
}
|
||||
|
||||
public BlackViseChooseOpponent(final BlackViseChooseOpponent effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlackViseChooseOpponent copy() {
|
||||
return new BlackViseChooseOpponent(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (player != null && permanent != null) {
|
||||
TargetOpponent target = new TargetOpponent();
|
||||
target.setNotTarget(true);
|
||||
if (player.choose(this.outcome, target, source.getSourceId(), game)) {
|
||||
Player chosenPlayer = game.getPlayer(target.getFirstTarget());
|
||||
if (chosenPlayer != null) {
|
||||
game.informPlayers(permanent.getName() + ": " + player.getLogName() + " has chosen " + chosenPlayer.getLogName());
|
||||
game.getState().setValue(permanent.getId() + "_player", target.getFirstTarget());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class BlackViseTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public BlackViseTriggeredAbility() {
|
||||
|
@ -128,12 +91,12 @@ class BlackViseTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
return event.getPlayerId().equals(game.getState().getValue(getSourceId().toString() + "_player"));
|
||||
return event.getPlayerId().equals(game.getState().getValue(getSourceId().toString() + ChooseOpponentEffect.VALUE_KEY));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return new StringBuilder("At the beginning of the chosen player's upkeep, ").append(super.getRule()).toString();
|
||||
return "At the beginning of the chosen player's upkeep, " + super.getRule();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,7 +118,7 @@ class BlackViseEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
UUID playerId = (UUID) game.getState().getValue(source.getSourceId().toString() + "_player");
|
||||
UUID playerId = (UUID) game.getState().getValue(source.getSourceId().toString() + ChooseOpponentEffect.VALUE_KEY);
|
||||
Player chosenPlayer = game.getPlayer(playerId);
|
||||
if (chosenPlayer != null) {
|
||||
int damage = chosenPlayer.getHand().size() - 4;
|
||||
|
|
|
@ -28,13 +28,12 @@
|
|||
package mage.sets.limitedalpha;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.ChooseBasicLandTypeEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.abilities.mana.BlackManaAbility;
|
||||
import mage.abilities.mana.BlueManaAbility;
|
||||
|
@ -42,7 +41,6 @@ import mage.abilities.mana.GreenManaAbility;
|
|||
import mage.abilities.mana.RedManaAbility;
|
||||
import mage.abilities.mana.WhiteManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
|
@ -52,7 +50,6 @@ import mage.constants.SubLayer;
|
|||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
|
||||
|
@ -74,7 +71,7 @@ public class PhantasmalTerrain extends CardImpl {
|
|||
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
|
||||
|
||||
// As Phantasmal Terrain enters the battlefield, choose a basic land type.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new PhantasmalTerrainChooseEffect()));
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseBasicLandTypeEffect(Outcome.Neutral)));
|
||||
|
||||
// Enchanted land is the chosen type.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PhantasmalTerrainContinuousEffect()));
|
||||
|
@ -90,48 +87,9 @@ public class PhantasmalTerrain extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class PhantasmalTerrainChooseEffect extends OneShotEffect {
|
||||
|
||||
public PhantasmalTerrainChooseEffect() {
|
||||
super(Outcome.Neutral);
|
||||
this.staticText = "choose a basic land type";
|
||||
}
|
||||
|
||||
public PhantasmalTerrainChooseEffect(final PhantasmalTerrainChooseEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PhantasmalTerrainChooseEffect copy() {
|
||||
return new PhantasmalTerrainChooseEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (sourceObject != null && controller != null) {
|
||||
ChoiceImpl choices = new ChoiceImpl(true);
|
||||
choices.setMessage("Choose basic land type");
|
||||
choices.getChoices().add("Forest");
|
||||
choices.getChoices().add("Plains");
|
||||
choices.getChoices().add("Mountain");
|
||||
choices.getChoices().add("Island");
|
||||
choices.getChoices().add("Swamp");
|
||||
if (controller.choose(Outcome.Neutral, choices, game)) {
|
||||
game.informPlayers(sourceObject.getLogName() + ": chosen basic land type is " + choices.getChoice());
|
||||
game.getState().setValue(source.getSourceId().toString() + "_PhantasmalTerrain", choices.getChoice());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class PhantasmalTerrainContinuousEffect extends ContinuousEffectImpl {
|
||||
|
||||
public PhantasmalTerrainContinuousEffect(){
|
||||
public PhantasmalTerrainContinuousEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Neutral);
|
||||
this.staticText = "enchanted land is the chosen type";
|
||||
}
|
||||
|
@ -148,7 +106,7 @@ class PhantasmalTerrainContinuousEffect extends ContinuousEffectImpl {
|
|||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Permanent enchantment = game.getPermanent(source.getSourceId());
|
||||
String choice = (String) game.getState().getValue(source.getSourceId().toString() + "_PhantasmalTerrain");
|
||||
String choice = (String) game.getState().getValue(source.getSourceId().toString() + ChooseBasicLandTypeEffect.VALUE_KEY);
|
||||
if (enchantment != null && enchantment.getAttachedTo() != null && choice != null) {
|
||||
Permanent land = game.getPermanent(enchantment.getAttachedTo());
|
||||
if (land != null) {
|
||||
|
|
|
@ -27,21 +27,13 @@
|
|||
*/
|
||||
package mage.sets.magic2010;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.ChooseBasicLandTypeEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.abilities.mana.BlackManaAbility;
|
||||
import mage.abilities.mana.BlueManaAbility;
|
||||
|
@ -49,10 +41,15 @@ import mage.abilities.mana.GreenManaAbility;
|
|||
import mage.abilities.mana.RedManaAbility;
|
||||
import mage.abilities.mana.WhiteManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
|
||||
|
@ -67,13 +64,12 @@ public class ConvincingMirage extends CardImpl {
|
|||
this.expansionSetCode = "M10";
|
||||
this.subtype.add("Aura");
|
||||
|
||||
|
||||
// Enchant land
|
||||
TargetPermanent auraTarget = new TargetLandPermanent();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment));
|
||||
// As Convincing Mirage enters the battlefield, choose a basic land type.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ConvincingMirageEffect()));
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseBasicLandTypeEffect(Outcome.Neutral)));
|
||||
// Enchanted land is the chosen type.
|
||||
Ability ability = new EnchantAbility(auraTarget.getTargetName());
|
||||
this.addAbility(ability);
|
||||
|
@ -90,42 +86,6 @@ public class ConvincingMirage extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class ConvincingMirageEffect extends OneShotEffect {
|
||||
|
||||
public ConvincingMirageEffect() {
|
||||
super(Outcome.Neutral);
|
||||
this.staticText = "choose a basic land type";
|
||||
}
|
||||
|
||||
public ConvincingMirageEffect(final ConvincingMirageEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConvincingMirageEffect copy() {
|
||||
return new ConvincingMirageEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
ChoiceImpl choices = new ChoiceImpl(true);
|
||||
Set choicesSet = choices.getChoices();
|
||||
choicesSet.add("Forest");
|
||||
choicesSet.add("Plains");
|
||||
choicesSet.add("Mountain");
|
||||
choicesSet.add("Island");
|
||||
choicesSet.add("Swamp");
|
||||
if (player.choose(Outcome.Neutral, choices, game)) {
|
||||
game.getState().setValue(source.getSourceId().toString() + "_ConvincingMirage", choices.getChoice());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class ConvincingMirageContinousEffect extends ContinuousEffectImpl {
|
||||
|
||||
public ConvincingMirageContinousEffect() {
|
||||
|
@ -145,7 +105,7 @@ class ConvincingMirageContinousEffect extends ContinuousEffectImpl {
|
|||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Permanent enchantment = game.getPermanent(source.getSourceId());
|
||||
String choice = (String) game.getState().getValue(source.getSourceId().toString() + "_ConvincingMirage");
|
||||
String choice = (String) game.getState().getValue(source.getSourceId().toString() + ChooseBasicLandTypeEffect.VALUE_KEY);
|
||||
if (enchantment != null && enchantment.getAttachedTo() != null && choice != null) {
|
||||
Permanent land = game.getPermanent(enchantment.getAttachedTo());
|
||||
if (land != null) {
|
||||
|
@ -160,19 +120,19 @@ class ConvincingMirageContinousEffect extends ContinuousEffectImpl {
|
|||
if (sublayer == SubLayer.NA) {
|
||||
land.getAbilities().clear();
|
||||
if (choice.equals("Forest")) {
|
||||
land.addAbility(new GreenManaAbility(), game);
|
||||
land.addAbility(new GreenManaAbility(), source.getSourceId(), game);
|
||||
}
|
||||
if (choice.equals("Plains")) {
|
||||
land.addAbility(new WhiteManaAbility(), game);
|
||||
land.addAbility(new WhiteManaAbility(), source.getSourceId(), game);
|
||||
}
|
||||
if (choice.equals("Mountain")) {
|
||||
land.addAbility(new RedManaAbility(), game);
|
||||
land.addAbility(new RedManaAbility(), source.getSourceId(), game);
|
||||
}
|
||||
if (choice.equals("Island")) {
|
||||
land.addAbility(new BlueManaAbility(), game);
|
||||
land.addAbility(new BlueManaAbility(), source.getSourceId(), game);
|
||||
}
|
||||
if (choice.equals("Swamp")) {
|
||||
land.addAbility(new BlackManaAbility(), game);
|
||||
land.addAbility(new BlackManaAbility(), source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -27,26 +27,32 @@
|
|||
*/
|
||||
package mage.sets.magic2012;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.*;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
*/
|
||||
|
@ -97,30 +103,32 @@ class SuturedGhoulEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (player.getGraveyard().size() > 0) {
|
||||
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = (Permanent) getValue(EntersBattlefieldEffect.ENTERING_PERMANENT);
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
if (controller.getGraveyard().size() > 0) {
|
||||
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(0, Integer.MAX_VALUE, new FilterCreatureCard("creature cards from your graveyard"));
|
||||
if (player.chooseTarget(Outcome.Benefit, target, source, game)) {
|
||||
if (controller.chooseTarget(Outcome.Benefit, target, source, game)) {
|
||||
int count = 0;
|
||||
for (UUID uuid : target.getTargets()) {
|
||||
Card card = player.getGraveyard().get(uuid, game);
|
||||
Card card = controller.getGraveyard().get(uuid, game);
|
||||
if (card != null) {
|
||||
card.moveToExile(getId(), "Sutured Ghoul", source.getSourceId(), game);
|
||||
if (permanent != null) {
|
||||
permanent.imprint(card.getId(), game);
|
||||
count++;
|
||||
}
|
||||
card.moveToExile(getId(), permanent.getIdName(), source.getSourceId(), game);
|
||||
permanent.imprint(card.getId(), game);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
Cards cardsToExile = new CardsImpl(target.getTargets());
|
||||
controller.moveCards(cardsToExile, null, Zone.EXILED, source, game);
|
||||
|
||||
String msg = count == 1 ? "1 card" : count + "cards";
|
||||
game.informPlayers("Sutured Ghoul: " + player.getLogName() + " exiled " + msg);
|
||||
game.informPlayers(permanent.getLogName() + ": " + controller.getLogName() + " exiled " + msg);
|
||||
}
|
||||
|
||||
} else {
|
||||
game.informPlayers("Sutured Ghoul: No cards in graveyard.");
|
||||
game.informPlayers(permanent.getLogName() + ": No cards in graveyard.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -147,7 +155,7 @@ class SuturedGhoulPowerCount implements DynamicValue {
|
|||
int amount = 0;
|
||||
Permanent permanent = game.getPermanent(sourceAbility.getSourceId());
|
||||
if (permanent != null) {
|
||||
for (UUID uuid: permanent.getImprinted()) {
|
||||
for (UUID uuid : permanent.getImprinted()) {
|
||||
Card card = game.getCard(uuid);
|
||||
if (card != null) {
|
||||
amount += card.getPower().getValue();
|
||||
|
@ -189,7 +197,7 @@ class SuturedGhoulToughnessCount implements DynamicValue {
|
|||
int amount = 0;
|
||||
Permanent permanent = game.getPermanent(sourceAbility.getSourceId());
|
||||
if (permanent != null) {
|
||||
for (UUID uuid: permanent.getImprinted()) {
|
||||
for (UUID uuid : permanent.getImprinted()) {
|
||||
Card card = game.getCard(uuid);
|
||||
if (card != null) {
|
||||
amount += card.getToughness().getValue();
|
||||
|
@ -214,5 +222,3 @@ class SuturedGhoulToughnessCount implements DynamicValue {
|
|||
return "the total toughness of the exiled cards";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -28,17 +28,17 @@
|
|||
package mage.sets.returntoravnica;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SpellCastControllerTriggeredAbility;
|
||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.choices.ChoiceColor;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -59,7 +59,7 @@ public class TabletOfTheGuilds extends CardImpl {
|
|||
this.addAbility(new AsEntersBattlefieldAbility(new TabletOfTheGuildsEntersBattlefieldEffect()));
|
||||
|
||||
// Whenever you cast a spell, if it's at least one of the chosen colors, you gain 1 life for each of the chosen colors it is.
|
||||
this.addAbility(new SpellCastControllerTriggeredAbility(new TabletOfTheGuildsGainLifeEffect(), new FilterSpell("a spell"), false, true ));
|
||||
this.addAbility(new SpellCastControllerTriggeredAbility(new TabletOfTheGuildsGainLifeEffect(), new FilterSpell("a spell"), false, true));
|
||||
}
|
||||
|
||||
public TabletOfTheGuilds(final TabletOfTheGuilds card) {
|
||||
|
@ -86,7 +86,7 @@ class TabletOfTheGuildsEntersBattlefieldEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
Permanent permanent = (Permanent) getValue(EntersBattlefieldEffect.ENTERING_PERMANENT);
|
||||
if (player != null && permanent != null) {
|
||||
String colors;
|
||||
ChoiceColor colorChoice = new ChoiceColor();
|
||||
|
@ -101,7 +101,7 @@ class TabletOfTheGuildsEntersBattlefieldEffect extends OneShotEffect {
|
|||
|
||||
colorChoice.getChoices().remove(colorChoice.getChoice());
|
||||
colorChoice.setMessage("Choose the second color");
|
||||
while (!player.choose(Outcome.GainLife, colorChoice, game) && player.canRespond()) {
|
||||
while (!player.choose(Outcome.GainLife, colorChoice, game) && player.canRespond()) {
|
||||
game.debugMessage("player canceled choosing type. retrying.");
|
||||
}
|
||||
game.getState().setValue(permanent.getId() + "_color2", colorChoice.getColor().toString());
|
||||
|
|
|
@ -29,13 +29,11 @@ package mage.sets.riseoftheeldrazi;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ChooseColorEffect;
|
||||
import mage.abilities.effects.common.LoseLifeTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.choices.ChoiceColor;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
|
@ -45,7 +43,6 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
|
@ -57,9 +54,8 @@ public class CurseOfWizardry extends CardImpl {
|
|||
super(ownerId, 104, "Curse of Wizardry", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}{B}");
|
||||
this.expansionSetCode = "ROE";
|
||||
|
||||
|
||||
// As Curse of Wizardry enters the battlefield, choose a color.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new CurseOfWizardryChooseColorEffect()));
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseColorEffect(Outcome.Neutral)));
|
||||
|
||||
// Whenever a player casts a spell of the chosen color, that player loses 1 life.
|
||||
this.addAbility(new CurseOfWizardryPlayerCastsSpellChosenColorTriggeredAbility());
|
||||
|
@ -76,38 +72,6 @@ public class CurseOfWizardry extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class CurseOfWizardryChooseColorEffect extends OneShotEffect {
|
||||
|
||||
public CurseOfWizardryChooseColorEffect() {
|
||||
super(Outcome.Detriment);
|
||||
staticText = "choose a color";
|
||||
}
|
||||
|
||||
public CurseOfWizardryChooseColorEffect(final CurseOfWizardryChooseColorEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent curseOfWizardry = game.getPermanent(source.getSourceId());
|
||||
if (player != null && curseOfWizardry != null) {
|
||||
ChoiceColor colorChoice = new ChoiceColor();
|
||||
if (player.choose(Outcome.Detriment, colorChoice, game)) {
|
||||
game.informPlayers(curseOfWizardry.getName() + ": " + player.getLogName() + " has chosen " + colorChoice.getChoice());
|
||||
game.getState().setValue(curseOfWizardry.getId() + "_color", colorChoice.getColor());
|
||||
curseOfWizardry.addInfo("chosen color", "<font color = 'blue'>Chosen color: " + colorChoice.getColor().getDescription() + "</font>", game);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CurseOfWizardryChooseColorEffect copy() {
|
||||
return new CurseOfWizardryChooseColorEffect(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CurseOfWizardryPlayerCastsSpellChosenColorTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public CurseOfWizardryPlayerCastsSpellChosenColorTriggeredAbility() {
|
||||
|
|
|
@ -32,9 +32,11 @@ import mage.MageInt;
|
|||
import mage.ObjectColor;
|
||||
import mage.abilities.StateTriggeredAbility;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.effects.common.ChooseColorEffect;
|
||||
import mage.abilities.effects.common.SacrificeSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
|
@ -56,7 +58,7 @@ public class LureboundScarecrow extends CardImpl {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
// As Lurebound Scarecrow enters the battlefield, choose a color.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseColorEffect()));
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseColorEffect(Outcome.Detriment)));
|
||||
|
||||
// When you control no permanents of the chosen color, sacrifice Lurebound Scarecrow.
|
||||
this.addAbility(new LureboundScarecrowTriggeredAbility());
|
||||
|
|
|
@ -35,10 +35,9 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ChooseColorEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.choices.ChoiceColor;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
|
@ -68,7 +67,7 @@ public class PaintersServant extends CardImpl {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
// As Painter's Servant enters the battlefield, choose a color.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseColorEffect()));
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseColorEffect(Outcome.Detriment)));
|
||||
|
||||
// All cards that aren't on the battlefield, spells, and permanents are the chosen color in addition to their other colors.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PaintersServantEffect()));
|
||||
|
@ -84,40 +83,6 @@ public class PaintersServant extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class ChooseColorEffect extends OneShotEffect {
|
||||
|
||||
public ChooseColorEffect() {
|
||||
super(Outcome.Detriment);
|
||||
staticText = "choose a color";
|
||||
}
|
||||
|
||||
public ChooseColorEffect(final ChooseColorEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (player != null && permanent != null) {
|
||||
ChoiceColor colorChoice = new ChoiceColor();
|
||||
if (player.choose(Outcome.Neutral, colorChoice, game)) {
|
||||
game.informPlayers(new StringBuilder(permanent.getName()).append(": ").append(player.getLogName()).append(" has chosen ").append(colorChoice.getChoice()).toString());
|
||||
game.getState().setValue(source.getSourceId() + "_color", colorChoice.getColor());
|
||||
permanent.addInfo("chosen color", "<font color = 'blue'>Chosen color: " + colorChoice.getColor().getDescription() + "</font>", game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChooseColorEffect copy() {
|
||||
return new ChooseColorEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class PaintersServantEffect extends ContinuousEffectImpl {
|
||||
|
||||
public PaintersServantEffect() {
|
||||
|
|
|
@ -33,8 +33,9 @@ public class CavernOfSoulsTest extends CardTestPlayerBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Tests "Cavern of Souls" with "Human" creature type chosen.
|
||||
* Then tests casting Azure Drake (should fail) and Elite Vanguard (should be ok as it has "Human" subtype)
|
||||
* Tests "Cavern of Souls" with "Human" creature type chosen. Then tests
|
||||
* casting Azure Drake (should fail) and Elite Vanguard (should be ok as it
|
||||
* has "Human" subtype)
|
||||
*/
|
||||
@Test
|
||||
public void testNoCastBecauseOfCreatureType() {
|
||||
|
@ -87,6 +88,9 @@ public class CavernOfSoulsTest extends CardTestPlayerBase {
|
|||
@Test
|
||||
public void testDrakeCantBeCountered() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
||||
// As Cavern of Souls enters the battlefield, choose a creature type.
|
||||
// {T}: Add {1} to your mana pool.
|
||||
// {T}: Add one mana of any color to your mana pool. Spend this mana only to cast a creature spell of the chosen type, and that spell can't be countered.
|
||||
addCard(Zone.HAND, playerA, "Cavern of Souls");
|
||||
addCard(Zone.HAND, playerA, "Azure Drake");
|
||||
|
||||
|
@ -108,6 +112,7 @@ public class CavernOfSoulsTest extends CardTestPlayerBase {
|
|||
assertGraveyardCount(playerA, "Azure Drake", 0);
|
||||
assertPermanentCount(playerA, "Azure Drake", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests spell can be countered if cast with colorless mana from Cavern
|
||||
*/
|
||||
|
@ -138,7 +143,8 @@ public class CavernOfSoulsTest extends CardTestPlayerBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Tests conditional mana from Cavern in pool will still work if Cavern got back to hand and is played again with other creature type
|
||||
* Tests conditional mana from Cavern in pool will still work if Cavern got
|
||||
* back to hand and is played again with other creature type
|
||||
*/
|
||||
@Test
|
||||
public void testConditionlManaWorksIfCavernIsReplayed() {
|
||||
|
@ -172,11 +178,9 @@ public class CavernOfSoulsTest extends CardTestPlayerBase {
|
|||
|
||||
// the black mana usable for Horror should be in the mana pool
|
||||
// castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Fume Spitter");
|
||||
|
||||
setStopAt(3, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
|
||||
assertGraveyardCount(playerB, "Boomerang", 1);
|
||||
assertPermanentCount(playerA, "Cavern of Souls", 1);
|
||||
|
||||
|
@ -187,8 +191,9 @@ public class CavernOfSoulsTest extends CardTestPlayerBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return to the Ranks cannot be countered if mana produced by Cavern of Souls
|
||||
* was used to pay X. Can be bug also for all other spells with X in their cost, not sure.
|
||||
* Return to the Ranks cannot be countered if mana produced by Cavern of
|
||||
* Souls was used to pay X. Can be bug also for all other spells with X in
|
||||
* their cost, not sure.
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
|
@ -205,7 +210,6 @@ public class CavernOfSoulsTest extends CardTestPlayerBase {
|
|||
addCard(Zone.HAND, playerB, "Counterspell");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
|
||||
|
||||
|
||||
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cavern of Souls");
|
||||
setChoice(playerA, "Drake");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Return to the Ranks", "Silvercoat Lion");
|
||||
|
@ -225,9 +229,10 @@ public class CavernOfSoulsTest extends CardTestPlayerBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Cavern of Souls can produce any colour of mana with its second ability when Contamination is in play.
|
||||
* Cavern of Souls can produce any colour of mana with its second ability
|
||||
* when Contamination is in play.
|
||||
*/
|
||||
@Test
|
||||
@Test
|
||||
public void testUseWithConversionInPlay() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 3);
|
||||
addCard(Zone.HAND, playerA, "Cavern of Souls");
|
||||
|
@ -236,8 +241,6 @@ public class CavernOfSoulsTest extends CardTestPlayerBase {
|
|||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Contamination", 1);
|
||||
|
||||
|
||||
|
||||
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cavern of Souls");
|
||||
setChoice(playerA, "Drake");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Desert Drake");
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class ChooseBasicLandTypeEffect extends OneShotEffect {
|
||||
|
||||
public static String VALUE_KEY = "BasicLandType";
|
||||
|
||||
public ChooseBasicLandTypeEffect(Outcome outcome) {
|
||||
super(outcome);
|
||||
this.staticText = "Choose a basic land type";
|
||||
}
|
||||
|
||||
public ChooseBasicLandTypeEffect(final ChooseBasicLandTypeEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChooseBasicLandTypeEffect copy() {
|
||||
return new ChooseBasicLandTypeEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject mageObject = (Permanent) getValue(EntersBattlefieldEffect.ENTERING_PERMANENT);
|
||||
if (mageObject == null) {
|
||||
mageObject = game.getObject(source.getSourceId());
|
||||
}
|
||||
if (controller != null && mageObject != null) {
|
||||
ChoiceImpl choices = new ChoiceImpl(true);
|
||||
choices.setMessage("Choose basic land type");
|
||||
choices.isRequired();
|
||||
choices.getChoices().add("Forest");
|
||||
choices.getChoices().add("Plains");
|
||||
choices.getChoices().add("Mountain");
|
||||
choices.getChoices().add("Island");
|
||||
choices.getChoices().add("Swamp");
|
||||
if (controller.choose(Outcome.Neutral, choices, game)) {
|
||||
game.informPlayers(mageObject.getName() + ": Chosen basic land type is " + choices.getChoice());
|
||||
game.getState().setValue(mageObject.getId().toString() + VALUE_KEY, choices.getChoice());
|
||||
if (mageObject instanceof Permanent) {
|
||||
((Permanent) mageObject).addInfo("chosen color", CardUtil.addToolTipMarkTags("Chosen basic land type: " + choices.getChoice()), game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -55,11 +56,11 @@ public class ChooseColorEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent == null) {
|
||||
permanent = (Permanent) getValue(EntersBattlefieldEffect.ENTERING_PERMANENT);
|
||||
MageObject mageObject = (Permanent) getValue(EntersBattlefieldEffect.ENTERING_PERMANENT);
|
||||
if (mageObject == null) {
|
||||
mageObject = game.getObject(source.getSourceId());
|
||||
}
|
||||
if (controller != null && permanent != null) {
|
||||
if (controller != null && mageObject != null) {
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
while (!choice.isChosen()) {
|
||||
controller.choose(outcome, choice, game);
|
||||
|
@ -68,10 +69,12 @@ public class ChooseColorEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(permanent.getLogName() + ": " + controller.getLogName() + " has chosen " + choice.getChoice());
|
||||
game.informPlayers(mageObject.getLogName() + ": " + controller.getLogName() + " has chosen " + choice.getChoice());
|
||||
}
|
||||
game.getState().setValue(mageObject.getId() + "_color", choice.getColor());
|
||||
if (mageObject instanceof Permanent) {
|
||||
((Permanent) mageObject).addInfo("chosen color", CardUtil.addToolTipMarkTags("Chosen color: " + choice.getChoice()), game);
|
||||
}
|
||||
game.getState().setValue(source.getSourceId() + "_color", choice.getColor());
|
||||
permanent.addInfo("chosen color", CardUtil.addToolTipMarkTags("Chosen color: " + choice.getChoice()), game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -27,7 +27,9 @@
|
|||
*/
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.choices.Choice;
|
||||
|
@ -42,7 +44,6 @@ import mage.util.CardUtil;
|
|||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class ChooseCreatureTypeEffect extends OneShotEffect {
|
||||
|
||||
public ChooseCreatureTypeEffect(Outcome outcome) {
|
||||
|
@ -57,8 +58,11 @@ public class ChooseCreatureTypeEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (controller != null && permanent != null) {
|
||||
MageObject mageObject = (Permanent) getValue(EntersBattlefieldEffect.ENTERING_PERMANENT);
|
||||
if (mageObject == null) {
|
||||
mageObject = game.getObject(source.getSourceId());
|
||||
}
|
||||
if (controller != null && mageObject != null) {
|
||||
Choice typeChoice = new ChoiceImpl(true);
|
||||
typeChoice.setMessage("Choose creature type");
|
||||
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
|
||||
|
@ -68,10 +72,12 @@ public class ChooseCreatureTypeEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(permanent.getName() + ": " + controller.getLogName() + " has chosen " + typeChoice.getChoice());
|
||||
game.informPlayers(mageObject.getName() + ": " + controller.getLogName() + " has chosen " + typeChoice.getChoice());
|
||||
}
|
||||
game.getState().setValue(mageObject.getId() + "_type", typeChoice.getChoice());
|
||||
if (mageObject instanceof Permanent) {
|
||||
((Permanent) mageObject).addInfo("chosen type", CardUtil.addToolTipMarkTags("Chosen type: " + typeChoice.getChoice()), game);
|
||||
}
|
||||
game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice());
|
||||
permanent.addInfo("chosen type", CardUtil.addToolTipMarkTags("Chosen type: " + typeChoice.getChoice()), game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
*/
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.choices.Choice;
|
||||
|
@ -34,8 +36,11 @@ public class ChooseLandTypeEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (controller != null && permanent != null) {
|
||||
MageObject mageObject = (Permanent) getValue(EntersBattlefieldEffect.ENTERING_PERMANENT);
|
||||
if (mageObject == null) {
|
||||
mageObject = game.getObject(source.getSourceId());
|
||||
}
|
||||
if (controller != null && mageObject != null) {
|
||||
Choice typeChoice = new ChoiceImpl(true);
|
||||
typeChoice.setMessage("Choose land type");
|
||||
typeChoice.setChoices(CardRepository.instance.getLandTypes());
|
||||
|
@ -45,10 +50,12 @@ public class ChooseLandTypeEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(permanent.getName() + ": " + controller.getLogName() + " has chosen " + typeChoice.getChoice());
|
||||
game.informPlayers(mageObject.getName() + ": " + controller.getLogName() + " has chosen " + typeChoice.getChoice());
|
||||
}
|
||||
game.getState().setValue(mageObject.getId() + "_type", typeChoice.getChoice());
|
||||
if (mageObject instanceof Permanent) {
|
||||
((Permanent) mageObject).addInfo("chosen type", CardUtil.addToolTipMarkTags("Chosen type: " + typeChoice.getChoice()), game);
|
||||
}
|
||||
game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice());
|
||||
permanent.addInfo("chosen type", CardUtil.addToolTipMarkTags("Chosen type: " + typeChoice.getChoice()), game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,38 +1,36 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.constants.Outcome;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.filter.Filter;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.StackObject;
|
||||
|
@ -50,17 +48,18 @@ public class ChooseNewTargetsTargetEffect extends OneShotEffect {
|
|||
public ChooseNewTargetsTargetEffect() {
|
||||
this(false, false);
|
||||
}
|
||||
|
||||
public ChooseNewTargetsTargetEffect(boolean forceChange, boolean onlyOneTarget) {
|
||||
this(forceChange, onlyOneTarget, null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param forceChange forces the user to choose another target (only targets with maxtargets = 1 supported)
|
||||
* @param forceChange forces the user to choose another target (only targets
|
||||
* with maxtargets = 1 supported)
|
||||
* @param onlyOneTarget only one target can be selected for the change
|
||||
* @param filterNewTarget restriction to the new target
|
||||
*/
|
||||
|
||||
public ChooseNewTargetsTargetEffect(boolean forceChange, boolean onlyOneTarget, FilterPermanent filterNewTarget) {
|
||||
super(Outcome.Benefit);
|
||||
this.forceChange = forceChange;
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetOpponent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class ChooseOpponentEffect extends OneShotEffect {
|
||||
|
||||
public static String VALUE_KEY = "_opponent";
|
||||
|
||||
public ChooseOpponentEffect(Outcome outcome) {
|
||||
super(outcome);
|
||||
this.staticText = "choose an opponent";
|
||||
}
|
||||
|
||||
public ChooseOpponentEffect(final ChooseOpponentEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChooseOpponentEffect copy() {
|
||||
return new ChooseOpponentEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject mageObject = (Permanent) getValue(EntersBattlefieldEffect.ENTERING_PERMANENT);
|
||||
if (mageObject == null) {
|
||||
mageObject = game.getObject(source.getSourceId());
|
||||
}
|
||||
if (controller != null && mageObject != null) {
|
||||
TargetOpponent target = new TargetOpponent(true);
|
||||
if (controller.choose(this.outcome, target, source.getSourceId(), game)) {
|
||||
Player chosenPlayer = game.getPlayer(target.getFirstTarget());
|
||||
if (chosenPlayer != null) {
|
||||
game.informPlayers(mageObject.getName() + ": " + controller.getLogName() + " has chosen " + chosenPlayer.getLogName());
|
||||
game.getState().setValue(mageObject.getId() + VALUE_KEY, target.getFirstTarget());
|
||||
if (mageObject instanceof Permanent) {
|
||||
((Permanent) mageObject).addInfo("chosen opponent", CardUtil.addToolTipMarkTags("Chosen player: " + chosenPlayer.getLogName()), game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -5,7 +5,9 @@
|
|||
*/
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
|
@ -36,16 +38,21 @@ public class ChoosePlayerEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (player != null && permanent != null) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject mageObject = (Permanent) getValue(EntersBattlefieldEffect.ENTERING_PERMANENT);
|
||||
if (mageObject == null) {
|
||||
mageObject = game.getObject(source.getSourceId());
|
||||
}
|
||||
if (controller != null && mageObject != null) {
|
||||
TargetPlayer target = new TargetPlayer(1, 1, true);
|
||||
if (player.choose(this.outcome, target, source.getSourceId(), game)) {
|
||||
if (controller.choose(this.outcome, target, source.getSourceId(), game)) {
|
||||
Player chosenPlayer = game.getPlayer(target.getFirstTarget());
|
||||
if (chosenPlayer != null) {
|
||||
game.informPlayers(permanent.getName() + ": " + player.getLogName() + " has chosen " + chosenPlayer.getLogName());
|
||||
game.getState().setValue(permanent.getId() + "_player", target.getFirstTarget());
|
||||
permanent.addInfo("chosen player", CardUtil.addToolTipMarkTags("Chosen player: " + chosenPlayer.getLogName()), game);
|
||||
game.informPlayers(mageObject.getName() + ": " + controller.getLogName() + " has chosen " + chosenPlayer.getLogName());
|
||||
game.getState().setValue(mageObject.getId() + "_player", target.getFirstTarget());
|
||||
if (mageObject instanceof Permanent) {
|
||||
((Permanent) mageObject).addInfo("chosen player", CardUtil.addToolTipMarkTags("Chosen player: " + chosenPlayer.getLogName()), game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
|
@ -59,6 +59,9 @@ public class TapSourceUnlessPaysEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent == null) {
|
||||
permanent = (Permanent) getValue(EntersBattlefieldEffect.ENTERING_PERMANENT);
|
||||
}
|
||||
if (player != null && permanent != null) {
|
||||
if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game)
|
||||
&& player.chooseUse(Outcome.Benefit, cost.getText() + "? (otherwise " + permanent.getName() + " becomes tapped)", source, game)) {
|
||||
|
@ -78,5 +81,4 @@ public class TapSourceUnlessPaysEffect extends OneShotEffect {
|
|||
return new TapSourceUnlessPaysEffect(this);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -22,24 +22,24 @@ import mage.target.Target;
|
|||
import mage.target.common.TargetArtifactPermanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 702.41. Modular
|
||||
*
|
||||
* 702.41a Modular represents both a static ability and a triggered ability.
|
||||
* "Modular N" means "This permanent enters the battlefield with N +1/+1
|
||||
* counters on it" and "When this permanent is put into a graveyard
|
||||
* from the battlefield, you may put a +1/+1 counter on target artifact
|
||||
* creature for each +1/+1 counter on this permanent."
|
||||
* 702.41b If a creature has multiple instances of modular, each one works separately.
|
||||
* 702.41a Modular represents both a static ability and a triggered ability.
|
||||
* "Modular N" means "This permanent enters the battlefield with N +1/+1
|
||||
* counters on it" and "When this permanent is put into a graveyard from the
|
||||
* battlefield, you may put a +1/+1 counter on target artifact creature for each
|
||||
* +1/+1 counter on this permanent." 702.41b If a creature has multiple
|
||||
* instances of modular, each one works separately.
|
||||
*
|
||||
*
|
||||
* @author Loki, LevelX2
|
||||
*/
|
||||
|
||||
public class ModularAbility extends DiesTriggeredAbility {
|
||||
|
||||
private static final FilterArtifactPermanent filter = new FilterArtifactPermanent("artifact creature");
|
||||
|
||||
static {
|
||||
filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class ModularAbility extends DiesTriggeredAbility {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (super.checkTrigger(event, game)) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.getTarget().getCounters().getCount(CounterType.P1P1) > 0) {
|
||||
return true;
|
||||
}
|
||||
|
@ -94,9 +94,9 @@ public class ModularAbility extends DiesTriggeredAbility {
|
|||
sb.append("-Sunburst <i>(This enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it. When it dies, you may put its +1/+1 counters on target artifact creature.)</i>");
|
||||
} else {
|
||||
sb.append(" ").append(amount).append(" <i>(This enters the battlefield with ")
|
||||
.append(CardUtil.numberToText(amount, "a"))
|
||||
.append(" +1/+1 counter").append(amount != 1 ? "s":"")
|
||||
.append(" on it. When it dies, you may put its +1/+1 counters on target artifact creature.)</i>");
|
||||
.append(CardUtil.numberToText(amount, "a"))
|
||||
.append(" +1/+1 counter").append(amount != 1 ? "s" : "")
|
||||
.append(" on it. When it dies, you may put its +1/+1 counters on target artifact creature.)</i>");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -109,9 +109,7 @@ class ModularStaticAbility extends StaticAbility {
|
|||
|
||||
public ModularStaticAbility(int amount) {
|
||||
super(Zone.BATTLEFIELD, new EntersBattlefieldEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance(amount))));
|
||||
ruleText = new StringBuilder("This enters the battlefield with ").append(CardUtil.numberToText(amount, "a"))
|
||||
.append(" +1/+1 counter").append(amount != 1 ? "s":"")
|
||||
.append(" on it.").toString();
|
||||
ruleText = "This enters the battlefield with " + CardUtil.numberToText(amount, "a") + " +1/+1 counter" + (amount != 1 ? "s" : "") + " on it.";
|
||||
this.setRuleVisible(false);
|
||||
}
|
||||
|
||||
|
@ -131,9 +129,10 @@ class ModularStaticAbility extends StaticAbility {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class ModularDistributeCounterEffect extends OneShotEffect {
|
||||
|
||||
private static final FilterArtifactPermanent filter = new FilterArtifactPermanent("artifact creature");
|
||||
|
||||
static {
|
||||
filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue