Merge pull request #2 from magefree/master

Merging
This commit is contained in:
Blinke 2015-10-19 16:12:39 +02:00
commit 5903a0d583
468 changed files with 7166 additions and 4912 deletions

View file

@ -161,6 +161,7 @@ public class BigCard extends JComponent {
}
public void addJXPanel(UUID cardId, JXPanel jxPanel) {
this.cardId = cardId;
bigImage = null;
synchronized (this) {
if (this.panel != null) { remove(this.panel); }

View file

@ -41,7 +41,7 @@ public class MageVersion implements Serializable, Comparable<MageVersion> {
public final static int MAGE_VERSION_MAJOR = 1;
public final static int MAGE_VERSION_MINOR = 4;
public final static int MAGE_VERSION_PATCH = 4;
public final static String MAGE_VERSION_MINOR_PATCH = "v8";
public final static String MAGE_VERSION_MINOR_PATCH = "v9";
public final static String MAGE_VERSION_INFO = "";
private final int major;

View file

@ -37,7 +37,7 @@ import mage.cards.decks.Constructed;
public class ShardsOfAlaraBlock extends Constructed {
public ShardsOfAlaraBlock() {
super("Constructed - Shards Of Alara Block");
super("Constructed - Shards of Alara Block");
setCodes.add("ALA");
setCodes.add("CON");
setCodes.add("ARB");

View file

@ -41,7 +41,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 +61,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,29 +92,29 @@ 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 = game.getPermanentEntering(source.getSourceId());
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 false;
}
}

View file

@ -28,14 +28,13 @@
package mage.sets.alarareborn;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.filter.common.FilterPermanentCard;
@ -54,10 +53,6 @@ public class Wargate extends CardImpl {
super(ownerId, 129, "Wargate", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{X}{G}{W}{U}");
this.expansionSetCode = "ARB";
// Search your library for a permanent card with converted mana cost X or less, put it onto the battlefield, then shuffle your library.
this.getSpellAbility().addEffect(new WargateEffect());
}
@ -72,8 +67,8 @@ public class Wargate extends CardImpl {
}
}
class WargateEffect extends OneShotEffect {
WargateEffect() {
super(Outcome.PutCreatureInPlay);
staticText = "Search your library for a permanent card with converted mana cost X or less, put it onto the battlefield, then shuffle your library";
@ -97,7 +92,7 @@ class WargateEffect extends OneShotEffect {
if (target.getTargets().size() > 0) {
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
if (card != null) {
controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
}

View file

@ -0,0 +1,84 @@
/*
* 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.ObjectColor;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.InvertCondition;
import mage.abilities.condition.common.SourceTappedCondition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
* @author LoneFox
*/
public class JuniperOrderAdvocate extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("green creatures you control");
static {
filter.add(new ColorPredicate(ObjectColor.GREEN));
filter.add(new ControllerPredicate(TargetController.YOU));
}
public JuniperOrderAdvocate(UUID ownerId) {
super(ownerId, 132, "Juniper Order Advocate", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{W}");
this.expansionSetCode = "ALL";
this.subtype.add("Human");
this.subtype.add("Knight");
this.power = new MageInt(1);
this.toughness = new MageInt(2);
// As long as Juniper Order Advocate is untapped, green creatures you control get +1/+1.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(
new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter, false),
new InvertCondition(new SourceTappedCondition()),
"As long as {this} is untapped, green creatures you control get +1/+1.")));
}
public JuniperOrderAdvocate(final JuniperOrderAdvocate card) {
super(card);
}
@Override
public JuniperOrderAdvocate copy() {
return new JuniperOrderAdvocate(this);
}
}

View file

@ -27,7 +27,6 @@
*/
package mage.sets.antiquities;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.mana.GenericManaCost;
@ -43,7 +42,6 @@ import mage.filter.common.FilterControlledArtifactPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetArtifactPermanent;
import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetControlledPermanent;
@ -57,7 +55,6 @@ public class TransmuteArtifact extends CardImpl {
super(ownerId, 58, "Transmute Artifact", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{U}{U}");
this.expansionSetCode = "ATQ";
// Sacrifice an artifact. If you do, search your library for an artifact card. If that card's converted mana cost is less than or equal to the sacrificed artifact's converted mana cost, put it onto the battlefield. If it's greater, you may pay {X}, where X is the difference. If you do, put it onto the battlefield. If you don't, put it into its owner's graveyard. Then shuffle your library.
this.getSpellAbility().addEffect(new TransmuteArtifactEffect());
}
@ -74,7 +71,6 @@ public class TransmuteArtifact extends CardImpl {
class TransmuteArtifactEffect extends SearchEffect {
public TransmuteArtifactEffect() {
super(new TargetCardInLibrary(new FilterArtifactCard()), Outcome.PutCardInPlay);
staticText = "Sacrifice an artifact. If you do, search your library for an artifact card. If that card's converted mana cost is less than or equal to the sacrificed artifact's converted mana cost, put it onto the battlefield. If it's greater, you may pay {X}, where X is the difference. If you do, put it onto the battlefield. If you don't, put it into its owner's graveyard. Then shuffle your library";
@ -105,9 +101,7 @@ class TransmuteArtifactEffect extends SearchEffect {
convertedManaCost = permanent.getManaCost().convertedManaCost();
sacrifice = permanent.sacrifice(source.getSourceId(), game);
}
}
else
{
} else {
return true;
}
//If you do, search your library for an artifact card.
@ -118,18 +112,15 @@ class TransmuteArtifactEffect extends SearchEffect {
if (card != null) {
//If that card's converted mana cost is less than or equal to the sacrificed artifact's converted mana cost, put it onto the battlefield.
if (card.getManaCost().convertedManaCost() <= convertedManaCost) {
controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
}
else
{
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
} else {
//If it's greater, you may pay {X}, where X is the difference. If you do, put it onto the battlefield.
GenericManaCost cost = new GenericManaCost(card.getManaCost().convertedManaCost() - convertedManaCost);
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
}
else{
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
} else {
//If you don't, put it into its owner's graveyard. Then shuffle your library
controller.moveCards(card, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
controller.moveCards(card, Zone.GRAVEYARD, source, game);
}
}
}
@ -142,5 +133,4 @@ class TransmuteArtifactEffect extends SearchEffect {
return false;
}
}

View file

@ -68,14 +68,14 @@ public class Anavolver extends CardImpl {
// If Anavolver was kicked with its {1}{U} kicker, it enters the battlefield with two +1/+1 counters on it and with flying.
EntersBattlefieldAbility ability1 = new EntersBattlefieldAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance(2),false),
new KickedCostCondition("{1}{U}"), true, "If {this} was kicked with its {1}{U} kicker, it enters the battlefield with two +1/+1 counters on it and with flying.",
new KickedCostCondition("{1}{U}"), "If {this} was kicked with its {1}{U} kicker, it enters the battlefield with two +1/+1 counters on it and with flying.",
"{this} enters the battlefield with two +1/+1 counters on it and with flying");
((EntersBattlefieldEffect)ability1.getEffects().get(0)).addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield));
this.addAbility(ability1);
// If Anavolver was kicked with its {B} kicker, it enters the battlefield with a +1/+1 counter on it and with "Pay 3 life: Regenerate Anavolver."
EntersBattlefieldAbility ability2 = new EntersBattlefieldAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance(1),false), new KickedCostCondition("{B}"), true,
new AddCountersSourceEffect(CounterType.P1P1.createInstance(1),false), new KickedCostCondition("{B}"),
"If {this} was kicked with its {B} kicker, it enters the battlefield with a +1/+1 counter on it and with \"Pay 3 life: Regenerate Anavolver.\"",
"{this} enters the battlefield with a +1/+1 counter on it and with \"Pay 3 life: Regenerate Anavolver.\"");
((EntersBattlefieldEffect)ability2.getEffects().get(0)).addEffect(new GainAbilitySourceEffect(new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new PayLifeCost(3)), Duration.WhileOnBattlefield));

View file

@ -65,14 +65,14 @@ public class Cetavolver extends CardImpl {
// If Cetavolver was kicked with its {1}{R} kicker, it enters the battlefield with two +1/+1 counters on it and with first strike.
EntersBattlefieldAbility ability1 = new EntersBattlefieldAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance(2),false),
new KickedCostCondition("{1}{R}"), true, "If Cetavolver was kicked with its {1}{R} kicker, it enters the battlefield with two +1/+1 counters on it and with first strike.",
new KickedCostCondition("{1}{R}"), "If Cetavolver was kicked with its {1}{R} kicker, it enters the battlefield with two +1/+1 counters on it and with first strike.",
"{this} enters the battlefield with two +1/+1 counters on it and with first strike");
((EntersBattlefieldEffect)ability1.getEffects().get(0)).addEffect(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance(), Duration.WhileOnBattlefield));
this.addAbility(ability1);
// If Cetavolver was kicked with its {G} kicker, it enters the battlefield with a +1/+1 counter on it and with trample.
EntersBattlefieldAbility ability2 = new EntersBattlefieldAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance(1),false), new KickedCostCondition("{G}"), true,
new AddCountersSourceEffect(CounterType.P1P1.createInstance(1),false), new KickedCostCondition("{G}"),
"If Cetavolver was kicked with its {G} kicker, it enters the battlefield with a +1/+1 counter on it and with trample.",
"{this} enters the battlefield with a +1/+1 counter on it and with trample");
((EntersBattlefieldEffect)ability2.getEffects().get(0)).addEffect(new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.WhileOnBattlefield));

View file

@ -69,14 +69,14 @@ public class Degavolver extends CardImpl {
// If Degavolver was kicked with its {1}{B} kicker, it enters the battlefield with two +1/+1 counters on it and with "Pay 3 life: Regenerate Degavolver."
EntersBattlefieldAbility ability1 = new EntersBattlefieldAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance(2),false),
new KickedCostCondition("{1}{B}"), true, "If Degavolver was kicked with its {1}{B} kicker, it enters the battlefield with two +1/+1 counters on it and with \"Pay 3 life: Regenerate Degavolver.\"",
new KickedCostCondition("{1}{B}"), "If Degavolver was kicked with its {1}{B} kicker, it enters the battlefield with two +1/+1 counters on it and with \"Pay 3 life: Regenerate Degavolver.\"",
"{this} enters the battlefield with two +1/+1 counters on it and with \"Pay 3 life: Regenerate Degavolver.\"");
((EntersBattlefieldEffect)ability1.getEffects().get(0)).addEffect(new GainAbilitySourceEffect(new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new PayLifeCost(3)), Duration.WhileOnBattlefield));
this.addAbility(ability1);
// If Degavolver was kicked with its {R} kicker, it enters the battlefield with a +1/+1 counter on it and with first strike.
EntersBattlefieldAbility ability2 = new EntersBattlefieldAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance(1),false), new KickedCostCondition("{R}"), true,
new AddCountersSourceEffect(CounterType.P1P1.createInstance(1),false), new KickedCostCondition("{R}"),
"If Degavolver was kicked with its {R} kicker, it enters the battlefield with a +1/+1 counter on it and with first strike.",
"{this} enters the battlefield with a +1/+1 counter on it and with first strike");
((EntersBattlefieldEffect)ability2.getEffects().get(0)).addEffect(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance(), Duration.WhileOnBattlefield));

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.apocalypse;
import java.util.UUID;
@ -34,11 +33,11 @@ import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BecomesCreatureAllEffect;
import mage.cards.Card;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.cards.SplitCard;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.common.FilterCreatureCard;
@ -52,7 +51,6 @@ import mage.target.common.TargetCardInYourGraveyard;
*
* @author LevelX2
*/
public class LifeDeath extends SplitCard {
public LifeDeath(UUID ownerId) {
@ -83,6 +81,7 @@ public class LifeDeath extends SplitCard {
}
class LifeLandToken extends Token {
public LifeLandToken() {
super("", "1/1 creatures");
cardType.add(CardType.CREATURE);
@ -115,10 +114,10 @@ class DeathEffect extends OneShotEffect {
if (creatureCard != null && controller != null) {
boolean result = false;
if (game.getState().getZone(creatureCard.getId()).equals(Zone.GRAVEYARD)) {
result = controller.putOntoBattlefieldWithInfo(creatureCard, game, Zone.GRAVEYARD, source.getSourceId());
controller.moveCards(creatureCard, Zone.BATTLEFIELD, source, game);
}
controller.loseLife(creatureCard.getManaCost().convertedManaCost(), game);
return result;
return true;
}
return false;
}

View file

@ -64,12 +64,12 @@ public class Necravolver extends CardImpl {
this.addAbility(kickerAbility);
// If Necravolver was kicked with its {1}{G} kicker, it enters the battlefield with two +1/+1 counters on it and with trample.
Ability ability = new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(2)),
new KickedCostCondition("{1}{G}"), true, "If {this} was kicked with its {1}{G} kicker, it enters the battlefield with two +1/+1 counters on it and with trample.", "");
new KickedCostCondition("{1}{G}"), "If {this} was kicked with its {1}{G} kicker, it enters the battlefield with two +1/+1 counters on it and with trample.", "");
ability.addEffect(new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.WhileOnBattlefield));
this.addAbility(ability);
// If Necravolver was kicked with its {W} kicker, it enters the battlefield with a +1/+1 counter on it and with "Whenever Necravolver deals damage, you gain that much life."
ability = new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(1)),
new KickedCostCondition("{W}"), true, "If {this} was kicked with its {W} kicker, it enters the battlefield with a +1/+1 counter on it and with \"Whenever {this} deals damage, you gain that much life.\"", "");
new KickedCostCondition("{W}"), "If {this} was kicked with its {W} kicker, it enters the battlefield with a +1/+1 counter on it and with \"Whenever {this} deals damage, you gain that much life.\"", "");
ability.addEffect(new GainAbilitySourceEffect(new DealsDamageGainLifeSourceTriggeredAbility(), Duration.WhileOnBattlefield));
this.addAbility(ability);
}

View file

@ -64,12 +64,12 @@ public class Rakavolver extends CardImpl {
this.addAbility(kickerAbility);
// If Rakavolver was kicked with its {1}{W} kicker, it enters the battlefield with two +1/+1 counters on it and with "Whenever Rakavolver deals damage, you gain that much life."
Ability ability = new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(2)),
new KickedCostCondition("{1}{W}"), true, "If {this} was kicked with its {1}{W} kicker, it enters the battlefield with two +1/+1 counters on it and with \"Whenever {this} deals damage, you gain that much life.\"", "");
new KickedCostCondition("{1}{W}"), "If {this} was kicked with its {1}{W} kicker, it enters the battlefield with two +1/+1 counters on it and with \"Whenever {this} deals damage, you gain that much life.\"", "");
ability.addEffect(new GainAbilitySourceEffect(new DealsDamageGainLifeSourceTriggeredAbility(), Duration.WhileOnBattlefield));
this.addAbility(ability);
// If Rakavolver was kicked with its {U} kicker, it enters the battlefield with a +1/+1 counter on it and with flying.
ability = new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(1)),
new KickedCostCondition("{U}"), true, "If {this} was kicked with its {U} kicker, it enters the battlefield with a +1/+1 counter on it and with flying.", "");
new KickedCostCondition("{U}"), "If {this} was kicked with its {U} kicker, it enters the battlefield with a +1/+1 counter on it and with flying.", "");
ability.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield));
this.addAbility(ability);

View file

@ -44,6 +44,7 @@ import mage.constants.Rarity;
import mage.constants.SubLayer;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.counters.Counters;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -99,12 +100,14 @@ class MakeshiftMannequinEffect extends OneShotEffect {
UUID cardId = this.getTargetPointer().getFirst(game, source);
Card card = controller.getGraveyard().get(cardId, game);
if (card != null) {
if (controller.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId())) {
Counters counters = new Counters();
counters.addCounter(CounterType.MANNEQUIN.createInstance());
game.setEnterWithCounters(cardId, counters);
if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
Permanent permanent = game.getPermanent(cardId);
if (permanent != null) {
permanent.addCounters(CounterType.MANNEQUIN.createInstance(), game);
ContinuousEffect gainedEffect = new MakeshiftMannequinGainAbilityEffect();
gainedEffect.setTargetPointer(new FixedTarget(cardId));
gainedEffect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(gainedEffect, source);
}
}

View file

@ -38,15 +38,12 @@ import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ChooseCreatureTypeEffect;
import mage.abilities.mana.ColorlessManaAbility;
import mage.abilities.mana.ConditionalAnyColorManaAbility;
import mage.abilities.mana.builder.ConditionalManaBuilder;
import mage.abilities.mana.conditional.CreatureCastManaCondition;
import mage.cards.CardImpl;
import mage.cards.repository.CardRepository;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
@ -55,10 +52,8 @@ import mage.constants.WatcherScope;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import mage.players.Player;
import mage.util.CardUtil;
import mage.watchers.Watcher;
/**
@ -67,14 +62,12 @@ import mage.watchers.Watcher;
*/
public class CavernOfSouls extends CardImpl {
private static final String ruleText = "choose a creature type";
public CavernOfSouls(UUID ownerId) {
super(ownerId, 226, "Cavern of Souls", Rarity.RARE, new CardType[]{CardType.LAND}, "");
this.expansionSetCode = "AVR";
// As Cavern of Souls enters the battlefield, choose a creature type.
this.addAbility(new AsEntersBattlefieldAbility(new CavernOfSoulsEffect(), ruleText));
this.addAbility(new AsEntersBattlefieldAbility(new ChooseCreatureTypeEffect(Outcome.BoostCreature)));
// {T}: Add {1} to your mana pool.
this.addAbility(new ColorlessManaAbility());
@ -95,43 +88,6 @@ public class CavernOfSouls extends CardImpl {
}
}
class CavernOfSoulsEffect extends OneShotEffect {
public CavernOfSoulsEffect() {
super(Outcome.Benefit);
staticText = "As {this} enters the battlefield, choose a creature type";
}
public CavernOfSoulsEffect(final CavernOfSoulsEffect 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) {
Choice typeChoice = new ChoiceImpl(true);
typeChoice.setMessage("Choose creature type");
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
while (!player.choose(Outcome.Benefit, typeChoice, game)) {
if (!player.canRespond()) {
return false;
}
}
game.informPlayers(permanent.getName() + ": " + player.getLogName() + " has chosen " + typeChoice.getChoice());
game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice());
permanent.addInfo("chosen type", CardUtil.addToolTipMarkTags("Chosen type: " + typeChoice.getChoice()), game);
}
return false;
}
@Override
public CavernOfSoulsEffect copy() {
return new CavernOfSoulsEffect(this);
}
}
class CavernOfSoulsManaBuilder extends ConditionalManaBuilder {
String creatureType;
@ -145,8 +101,8 @@ class CavernOfSoulsManaBuilder extends ConditionalManaBuilder {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
game.informPlayers(controller.getLogName() + " produces " + mana.toString() + " with " + sourceObject.getLogName() +
" (can only be spend to cast for creatures of type " + creatureType + " and that spell can't be countered)");
game.informPlayers(controller.getLogName() + " produces " + mana.toString() + " with " + sourceObject.getLogName()
+ " (can only be spend to cast for creatures of type " + creatureType + " and that spell can't be countered)");
}
return super.setMana(mana, source, game);
}

View file

@ -51,7 +51,7 @@ import mage.target.common.TargetControlledCreaturePermanent;
/**
*
* @author noxx
*
*/
public class RestorationAngel extends CardImpl {
@ -111,11 +111,13 @@ class RestorationAngelEffect extends OneShotEffect {
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (permanent != null && sourcePermanent != null) {
controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourcePermanent.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true);
Card card = game.getCard(targetPointer.getFirst(game, source));
if (card != null) {
Zone currentZone = game.getState().getZone(card.getId());
return controller.putOntoBattlefieldWithInfo(card, game, currentZone, source.getSourceId());
int zcc = permanent.getZoneChangeCounter(game);
controller.moveCards(permanent, Zone.EXILED, source, game);
Card card = game.getCard(permanent.getId());
if (card != null
&& card.getZoneChangeCounter(game) == zcc + 1
&& game.getState().getZone(card.getId()).equals(Zone.EXILED)) {
return controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
}

View file

@ -27,27 +27,28 @@
*/
package mage.sets.avacynrestored;
import mage.constants.*;
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.OneShotEffect;
import mage.abilities.effects.common.ChooseCreatureTypeEffect;
import mage.abilities.keyword.ProtectionAbility;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl;
import mage.cards.repository.CardRepository;
import mage.choices.Choice;
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.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
/**
* @author noxx
@ -66,7 +67,7 @@ public class RidersOfGavony extends CardImpl {
this.addAbility(VigilanceAbility.getInstance());
// As Riders of Gavony enters the battlefield, choose a creature type.
this.addAbility(new AsEntersBattlefieldAbility(new RidersOfGavonyEffect()));
this.addAbility(new AsEntersBattlefieldAbility(new ChooseCreatureTypeEffect(Outcome.Protect)));
// Human creatures you control have protection from creatures of the chosen type.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new RidersOfGavonyGainAbilityControlledEffect()));
@ -82,46 +83,6 @@ public class RidersOfGavony extends CardImpl {
}
}
class RidersOfGavonyEffect extends OneShotEffect {
public RidersOfGavonyEffect() {
super(Outcome.BoostCreature);
staticText = "choose a creature type";
}
public RidersOfGavonyEffect(final RidersOfGavonyEffect 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) {
Choice typeChoice = new ChoiceImpl(true);
typeChoice.setMessage("Choose creature type");
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
if (!player.canRespond()) {
return false;
}
}
if (typeChoice.getChoice() != null) {
game.informPlayers(permanent.getName() + ": " + player.getLogName() + " has chosen " + typeChoice.getChoice());
game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice());
permanent.addInfo("chosen type", "<i>Chosen type: " + typeChoice.getChoice() + "</i>", game);
}
}
return false;
}
@Override
public RidersOfGavonyEffect copy() {
return new RidersOfGavonyEffect(this);
}
}
class RidersOfGavonyGainAbilityControlledEffect extends ContinuousEffectImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Human creatures you control");

View file

@ -30,19 +30,18 @@ package mage.sets.avacynrestored;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.common.PutCardIntoGraveFromAnywhereAllTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.GetEmblemEffect;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect;
import mage.abilities.effects.common.TapTargetEffect;
import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect;
import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect.HandSizeModification;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
@ -50,7 +49,6 @@ import mage.constants.Rarity;
import mage.constants.SetTargetPointer;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.TappedPredicate;
@ -71,8 +69,7 @@ public class TamiyoTheMoonSage extends CardImpl {
this.expansionSetCode = "AVR";
this.subtype.add("Tamiyo");
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(4)), false));
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4));
// +1: Tap target permanent. It doesn't untap during its controller's next untap step.
LoyaltyAbility ability = new LoyaltyAbility(new TapTargetEffect(), 1);
@ -130,7 +127,8 @@ class TappedCreaturesControlledByTargetCount implements DynamicValue {
}
/**
* Emblem with "You have no maximum hand size" and "Whenever a card is put into your graveyard from anywhere, you may return it to your hand."
* Emblem with "You have no maximum hand size" and "Whenever a card is put into
* your graveyard from anywhere, you may return it to your hand."
*/
class TamiyoTheMoonSageEmblem extends Emblem {

View file

@ -29,29 +29,27 @@ package mage.sets.avacynrestored;
import java.util.List;
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.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.discard.DiscardControllerEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.effects.common.discard.DiscardControllerEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.counters.CounterType;
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.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -70,8 +68,7 @@ public class TibaltTheFiendBlooded extends CardImpl {
this.expansionSetCode = "AVR";
this.subtype.add("Tibalt");
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(2)), false));
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(2));
// +1: Draw a card, then discard a card at random.
LoyaltyAbility ability = new LoyaltyAbility(new DrawCardSourceControllerEffect(1), 1);

View file

@ -31,7 +31,7 @@ import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateTokenEffect;
@ -39,14 +39,12 @@ import mage.abilities.effects.common.GetEmblemEffect;
import mage.abilities.effects.common.PreventAllDamageToSourceEffect;
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.command.Emblem;
import mage.game.permanent.token.Token;
@ -61,7 +59,7 @@ public class GideonAllyOfZendikar extends CardImpl {
this.expansionSetCode = "BFZ";
this.subtype.add("Gideon");
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(4)), false));
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4));
// +1: Until end of turn, Gideon, Ally of Zendikar becomes a 5/5 Human Soldier Ally creature with indestructible that's still a planeswalker. Prevent all damage that would be dealt to him this turn.
LoyaltyAbility ability = new LoyaltyAbility(new BecomesCreatureSourceEffect(new GideonAllyOfZendikarToken(), "planeswalker", Duration.EndOfTurn), 1);

View file

@ -32,13 +32,12 @@ import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.GetEmblemEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
@ -48,7 +47,6 @@ import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.SetTargetPointer;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.common.FilterCreatureCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterLandCard;
@ -73,7 +71,7 @@ public class KioraMasterOfTheDepths extends CardImpl {
this.expansionSetCode = "BFZ";
this.subtype.add("Kiora");
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(4)), false));
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4));
// +1: Untap up to one target creature and up to one target land.
LoyaltyAbility ability1 = new LoyaltyAbility(new KioraUntapEffect(), 1);

View file

@ -30,18 +30,16 @@ package mage.sets.battleforzendikar;
import java.util.UUID;
import mage.abilities.LoyaltyAbility;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.GetEmblemTargetPlayerEffect;
import mage.abilities.effects.common.LoseLifeSourceControllerEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.command.Emblem;
import mage.game.events.GameEvent;
@ -60,7 +58,7 @@ public class ObNixilisReignited extends CardImpl {
this.expansionSetCode = "BFZ";
this.subtype.add("Nixilis");
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(5)), false));
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(5));
// +1: You draw a card and you lose 1 life.
Effect effect = new DrawCardSourceControllerEffect(1);

View file

@ -78,8 +78,8 @@ public class OranRiefHydra extends CardImpl {
class OranRiefHydraTriggeredAbility extends TriggeredAbilityImpl {
private static final String text = "<i>Landfall</i> - Whenever a land enters the battlefield under your control, put a +1/+1 counter on Oran-Rief Hydra. "
+ "If that land is a Forest, put two +1/+1 counters on Oran-Rief Hydra instead.";
private static final String text = "<i>Landfall</i> - Whenever a land enters the battlefield under your control, put a +1/+1 counter on {this}. "
+ "If that land is a Forest, put two +1/+1 counters on {this} instead.";
public OranRiefHydraTriggeredAbility() {
super(Zone.BATTLEFIELD, new OranRiefHydraEffect());
@ -106,7 +106,7 @@ class OranRiefHydraTriggeredAbility extends TriggeredAbilityImpl {
&& permanent.getCardType().contains(CardType.LAND)
&& permanent.getControllerId().equals(getControllerId())) {
Permanent sourcePermanent = game.getPermanent(getSourceId());
if (sourcePermanent != null)
if (sourcePermanent != null) {
for (Effect effect : getEffects()) {
if (effect instanceof OranRiefHydraEffect) {
effect.setTargetPointer(new FixedTarget(permanent, game));
@ -114,6 +114,7 @@ class OranRiefHydraTriggeredAbility extends TriggeredAbilityImpl {
return true;
}
}
}
return false;
}

View file

@ -57,7 +57,7 @@ public class PrismArray extends CardImpl {
// <i>Converge</i> - Prism Array enters the battlefield with a crystal counter on it for each color of mana spent to cast it.
this.addAbility(new EntersBattlefieldAbility(
new AddCountersSourceEffect(CounterType.CRYSTAL.createInstance(), ColorsOfManaSpentToCastCount.getInstance(), true),
null, true, "<i>Converge</i> &mdash; {this} enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it.", null));
null, "<i>Converge</i> &mdash; {this} enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it.", null));
// Remove a crystal counter from Prism Array: Tap target creature.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,

View file

@ -59,7 +59,7 @@ public class SkyriderElf extends CardImpl {
// <i>Converge</i>-Skyrider Elf enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it.
this.addAbility(new EntersBattlefieldAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance(), ColorsOfManaSpentToCastCount.getInstance(), true),
null, true, "<i>Converge</i> &mdash; {this} enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it.", null));
null, "<i>Converge</i> &mdash; {this} enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it.", null));
}

View file

@ -55,7 +55,7 @@ public class TajuruStalwart extends CardImpl {
// <i>Converge</i> - Tajuru Stalwart enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it.
this.addAbility(new EntersBattlefieldAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance(), ColorsOfManaSpentToCastCount.getInstance(), true),
null, true, "<i>Converge</i> - {this} enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it.", null));
null, "<i>Converge</i> - {this} enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it.", null));
}

View file

@ -64,7 +64,7 @@ public class UlamogsDespoiler extends CardImpl {
this.toughness = new MageInt(5);
// As Ulamog's Despoiler enters the battlefield, you may put two cards your opponents own from exile into their owners' graveyards. If you do, Ulamog's Despoiler enters the battlefield with four +1/+1 counters on it.
this.addAbility(new EntersBattlefieldAbility(new UlamogsDespoilerEffect(), null, true,
this.addAbility(new EntersBattlefieldAbility(new UlamogsDespoilerEffect(), null,
"As {this} enters the battlefield, you may put two cards your opponents own from exile into their owners' graveyards. If you do, {this} enters the battlefield with four +1/+1 counters on it", null));
}

View file

@ -59,7 +59,7 @@ public class WoodlandWanderer extends CardImpl {
// <i>Converge</i> - Woodland Wanderer enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it.
this.addAbility(new EntersBattlefieldAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance(), ColorsOfManaSpentToCastCount.getInstance(), true),
null, true, "<i>Converge</i> &mdash; {this} enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it.", null));
null, "<i>Converge</i> &mdash; {this} enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it.", null));
}
public WoodlandWanderer(final WoodlandWanderer card) {

View file

@ -110,12 +110,12 @@ class GoryosVengeanceEffect extends OneShotEffect {
if (controller != null) {
Card card = game.getCard(targetPointer.getFirst(game, source));
if (card != null) {
if (controller.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId())) {
if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) {
// Haste
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
effect.setTargetPointer(new FixedTarget(permanent.getId()));
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
// Exile it at end of turn
Effect exileEffect = new ExileTargetEffect("Exile " + permanent.getName() + " at the beginning of the next end step");

View file

@ -123,14 +123,7 @@ class IwamoriOfTheOpenFistEffect extends OneShotEffect {
}
}
}
if (cards.size() > 0) {
for (Card card: cards.getCards(game)) {
Player player = game.getPlayer(card.getOwnerId());
if (player != null) {
player.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId());
}
}
}
controller.moveCards(cards.getCards(game), Zone.BATTLEFIELD, source, game, false, false, true, null);
return true;
}

View file

@ -28,13 +28,17 @@
package mage.sets.betrayersofkamigawa;
import java.util.UUID;
import mage.constants.*;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
@ -79,7 +83,7 @@ public class OrbOfDreams extends CardImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId());
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null) {
permanent.setTapped(true);
}
@ -98,4 +102,3 @@ public class OrbOfDreams extends CardImpl {
}
}

View file

@ -35,8 +35,8 @@ import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.OfferingAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
@ -100,13 +100,8 @@ class PatronOfTheMoonEffect extends OneShotEffect {
if (controller != null) {
TargetCard target = new TargetCardInHand(0, 2, new FilterLandCard("up to two land cards to put onto the battlefield tapped"));
controller.chooseTarget(outcome, controller.getHand(), target, source, game);
for (UUID cardId : target.getTargets()) {
Card card = game.getCard(cardId);
if (card != null) {
controller.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId(), true);
}
}
return true;
return controller.moveCards(new CardsImpl(target.getTargets()).getCards(game),
Zone.BATTLEFIELD, source, game, true, false, false, null);
}
return false;
}

View file

@ -32,20 +32,18 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.effects.PreventionEffectImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.GetEmblemEffect;
import mage.abilities.effects.common.continuous.PlayAdditionalLandsControllerEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
@ -64,6 +62,7 @@ import mage.util.CardUtil;
public class KioraTheCrashingWave extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("permanent an opponent control");
static {
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
@ -73,8 +72,7 @@ public class KioraTheCrashingWave extends CardImpl {
this.expansionSetCode = "BNG";
this.subtype.add("Kiora");
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(2)), false));
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(2));
// +1: Until your next turn, prevent all damage that would be dealt to and dealt by target permanent an opponent controls.
LoyaltyAbility ability = new LoyaltyAbility(new KioraPreventionEffect(), 1);
@ -89,7 +87,6 @@ public class KioraTheCrashingWave extends CardImpl {
// -5: You get an emblem with "At the beginning of your end step, put a 9/9 blue Kraken creature token onto the battlefield."
this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new KioraEmblem()), -5));
}
public KioraTheCrashingWave(final KioraTheCrashingWave card) {
@ -162,9 +159,11 @@ class KioraPreventionEffect extends PreventionEffectImpl {
}
/**
* Emblem: "At the beginning of your end step, put a 9/9 blue Kraken creature token onto the battlefield."
* Emblem: "At the beginning of your end step, put a 9/9 blue Kraken creature
* token onto the battlefield."
*/
class KioraEmblem extends Emblem {
public KioraEmblem() {
this.setName("EMBLEM: Kiora, the Crashing Wave");
Ability ability = new BeginningOfEndStepTriggeredAbility(Zone.COMMAND, new CreateTokenEffect(new KioraKrakenToken()), TargetController.YOU, null, false);

View file

@ -29,7 +29,6 @@ package mage.sets.bornofthegods;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.TributeNotPaidCondition;

View file

@ -113,14 +113,13 @@ class PeregrinationEffect extends OneShotEffect {
TargetCard target2 = new TargetCard(Zone.LIBRARY, filter);
controller.choose(Outcome.Benefit, revealed, target2, game);
Card card = revealed.get(target2.getFirstTarget(), game);
controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId(), true);
controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
revealed.remove(card);
card = revealed.getCards(game).iterator().next();
controller.moveCards(card, null, Zone.HAND, source, game);
controller.moveCards(card, Zone.HAND, source, game);
} else if (target.getTargets().size() == 1) {
Card card = revealed.getCards(game).iterator().next();
controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId(), true);
controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
}
}

View file

@ -59,7 +59,7 @@ public class MyojinOfInfiniteRage extends CardImpl {
private static final FilterLandPermanent filter = new FilterLandPermanent("lands");
public MyojinOfInfiniteRage(UUID ownerId) {
super(ownerId, 181, "Myojin Of Infinite Rage", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{7}{R}{R}{R}");
super(ownerId, 181, "Myojin of Infinite Rage", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{7}{R}{R}{R}");
this.expansionSetCode = "CHK";
this.supertype.add("Legendary");
this.subtype.add("Spirit");

View file

@ -25,14 +25,10 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.championsofkamigawa;
import java.util.UUID;
import mage.MageObjectReference;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
@ -40,12 +36,15 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.ExileZone;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
@ -102,8 +101,8 @@ class OtherworldlyJourneyEffect extends OneShotEffect {
Card card = game.getCard(permanent.getId());
if (card != null) {
//create delayed triggered ability
DelayedTriggeredAbility delayedAbility =
new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new OtherworldlyJourneyReturnFromExileEffect(new MageObjectReference(card, game)));
DelayedTriggeredAbility delayedAbility
= new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new OtherworldlyJourneyReturnFromExileEffect(new MageObjectReference(card, game)));
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
@ -126,6 +125,7 @@ class OtherworldlyJourneyEffect extends OneShotEffect {
class OtherworldlyJourneyReturnFromExileEffect extends OneShotEffect {
MageObjectReference objectToReturn;
public OtherworldlyJourneyReturnFromExileEffect(MageObjectReference objectToReturn) {
super(Outcome.PutCardInPlay);
this.objectToReturn = objectToReturn;
@ -149,14 +149,13 @@ class OtherworldlyJourneyReturnFromExileEffect extends OneShotEffect {
Player owner = game.getPlayer(card.getOwnerId());
if (owner != null) {
game.addEffect(new OtherworldlyJourneyEntersBattlefieldEffect(objectToReturn), source);
owner.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId());
owner.moveCards(card, Zone.BATTLEFIELD, source, game, false, false, true, null);
}
}
return true;
}
}
class OtherworldlyJourneyEntersBattlefieldEffect extends ReplacementEffectImpl {
MageObjectReference objectToReturn;
@ -187,7 +186,7 @@ class OtherworldlyJourneyEntersBattlefieldEffect extends ReplacementEffectImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId());
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null) {
permanent.addCounters(CounterType.P1P1.createInstance(), game);
discard(); // use only once

View file

@ -28,6 +28,7 @@
package mage.sets.championsofkamigawa;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.SpliceOntoArcaneAbility;
@ -58,7 +59,6 @@ public class Reweave extends CardImpl {
this.expansionSetCode = "CHK";
this.subtype.add("Arcane");
// Target permanent's controller sacrifices it. If he or she does, that player reveals cards from the top of his or her library until he or she reveals a permanent card that shares a card type with the sacrificed permanent, puts that card onto the battlefield, then shuffles his or her library.
this.getSpellAbility().addEffect(new ReweaveEffect());
Target target = new TargetPermanent();
@ -98,8 +98,9 @@ class ReweaveEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getTargets().getFirstTarget());
if (permanent != null) {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
MageObject sourceObject = source.getSourceObject(game);
if (permanent != null && sourceObject != null) {
if (permanent.sacrifice(source.getSourceId(), game)) {
Player permanentController = game.getPlayer(permanent.getControllerId());
if (permanentController != null) {
@ -122,11 +123,11 @@ class ReweaveEffect extends OneShotEffect {
}
}
} while (!cardFound && library.size() > 0);
permanentController.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
permanentController.moveCards(card, Zone.BATTLEFIELD, source, game);
}
if (cards.size() > 0) {
permanentController.revealCards("Reweave", cards, game);
permanentController.revealCards(sourceObject.getIdName(), cards, game);
if (cardFound && card != null) {
cards.remove(card);
}

View file

@ -53,7 +53,7 @@ public class RyuseiTheFallingStar extends CardImpl {
}
public RyuseiTheFallingStar(UUID ownerID) {
super(ownerID, 185, "Ryusei, The Falling Star", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{5}{R}");
super(ownerID, 185, "Ryusei, the Falling Star", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{5}{R}");
this.expansionSetCode = "CHK";
this.supertype.add("Legendary");
this.subtype.add("Dragon");

View file

@ -28,16 +28,20 @@
package mage.sets.championsofkamigawa;
import java.util.UUID;
import mage.constants.*;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -61,7 +65,7 @@ public class ShimatsuTheBloodcloaked extends CardImpl {
this.toughness = new MageInt(0);
// As Shimatsu the Bloodcloaked enters the battlefield, sacrifice any number of permanents. Shimatsu enters the battlefield with that many +1/+1 counters on it.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ShimatsuTheBloodcloakedEffect()));
this.addAbility(new SimpleStaticAbility(Zone.ALL, new ShimatsuTheBloodcloakedEffect()));
}
public ShimatsuTheBloodcloaked(final ShimatsuTheBloodcloaked card) {
@ -77,7 +81,7 @@ public class ShimatsuTheBloodcloaked extends CardImpl {
class ShimatsuTheBloodcloakedEffect extends ReplacementEffectImpl {
public ShimatsuTheBloodcloakedEffect() {
super(Duration.WhileOnBattlefield, Outcome.BoostCreature);
super(Duration.EndOfGame, Outcome.BoostCreature);
this.staticText = "As {this} enters the battlefield, sacrifice any number of permanents. {this} enters the battlefield with that many +1/+1 counters on it";
}
@ -102,7 +106,7 @@ class ShimatsuTheBloodcloakedEffect extends ReplacementEffectImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent creature = game.getPermanent(event.getTargetId());
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
Player controller = game.getPlayer(source.getControllerId());
if (creature != null && controller != null) {
Target target = new TargetControlledPermanent(0, Integer.MAX_VALUE, new FilterControlledPermanent(), true);
@ -112,7 +116,7 @@ class ShimatsuTheBloodcloakedEffect extends ReplacementEffectImpl {
controller.chooseTarget(Outcome.Detriment, target, source, game);
if (target.getTargets().size() > 0) {
int sacrificedCreatures = target.getTargets().size();
game.informPlayers(new StringBuilder(controller.getLogName()).append(" sacrifices ").append(sacrificedCreatures).append(" creatures for ").append(creature.getName()).toString());
game.informPlayers(controller.getLogName() + " sacrifices " + sacrificedCreatures + " creatures for " + creature.getLogName());
for (UUID targetId : target.getTargets()) {
Permanent targetCreature = game.getPermanent(targetId);
if (targetCreature == null || !targetCreature.sacrifice(source.getSourceId(), game)) {

View file

@ -106,7 +106,7 @@ class ThroughTheBreachEffect extends OneShotEffect {
if (controller.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
if (controller.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId())) {
if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) {
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);

View file

@ -58,6 +58,7 @@ import mage.target.common.TargetCardInLibrary;
public class ArcumDagsson extends CardImpl {
private static final FilterPermanent filter = new FilterArtifactPermanent("artifact creature");
static {
filter.add(new CardTypePredicate(CardType.CREATURE));
}
@ -90,6 +91,7 @@ public class ArcumDagsson extends CardImpl {
class ArcumDagssonEffect extends OneShotEffect {
private static final FilterCard filter = new FilterArtifactCard("noncreature artifact card");
static {
filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE)));
}
@ -120,7 +122,7 @@ class ArcumDagssonEffect extends OneShotEffect {
if (player.searchLibrary(target, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
player.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
player.shuffleLibrary(game);

View file

@ -0,0 +1,93 @@
/*
* 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.coldsnap;
import java.util.UUID;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.costs.CostImpl;
import mage.abilities.keyword.CumulativeUpkeepAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author AlumiuN
*/
public class BraidOfFire extends CardImpl {
public BraidOfFire(UUID ownerId) {
super(ownerId, 78, "Braid of Fire", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
this.expansionSetCode = "CSP";
// Cumulative upkeep-Add {R} to your mana pool.
this.addAbility(new CumulativeUpkeepAbility(new BraidOfFireCost()));
}
public BraidOfFire(final BraidOfFire card) {
super(card);
}
@Override
public BraidOfFire copy() {
return new BraidOfFire(this);
}
}
class BraidOfFireCost extends CostImpl {
public BraidOfFireCost() {
this.text = "Add {R} to your mana pool";
}
public BraidOfFireCost(BraidOfFireCost cost) {
super(cost);
}
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
Player player = game.getPlayer(controllerId);
player.getManaPool().addMana(Mana.RedMana, game, ability);
paid = true;
return true;
}
@Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
return game.getPlayer(controllerId) != null;
}
@Override
public BraidOfFireCost copy() {
return new BraidOfFireCost(this);
}
}

View file

@ -46,6 +46,7 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -101,33 +102,6 @@ class ChorusOfTheConclaveReplacementEffect extends ReplacementEffectImpl {
return new ChorusOfTheConclaveReplacementEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
int xCost = 0;
Player you = game.getPlayer(source.getControllerId());
if (you != null) {
if (you.chooseUse(Outcome.Benefit, "Do you wish to pay the additonal cost to add +1/+1 counters to the creature you cast?", source, game)) {
xCost += playerPaysXGenericMana(you, source, game);
// save the x value to be available for ETB replacement effect
Object object = game.getState().getValue("spellX" + source.getSourceId());
Map<String, Integer> spellX;
if (object != null && object instanceof Map) {
spellX = (Map<String, Integer>) object;
} else {
spellX = new HashMap<>();
}
spellX.put(event.getSourceId().toString() + game.getState().getZoneChangeCounter(event.getSourceId()), xCost);
game.getState().setValue("spellX" + source.getSourceId(), spellX);
}
}
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.CAST_SPELL;
@ -144,6 +118,28 @@ class ChorusOfTheConclaveReplacementEffect extends ReplacementEffectImpl {
return false;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
int xCost = 0;
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
if (controller.chooseUse(Outcome.Benefit, "Do you wish to pay the additonal cost to add +1/+1 counters to the creature you cast?", source, game)) {
xCost += playerPaysXGenericMana(controller, source, game);
// save the x value to be available for ETB replacement effect
Object object = game.getState().getValue("spellX" + source.getSourceId());
Map<String, Integer> spellX;
if (object != null && object instanceof Map) {
spellX = (Map<String, Integer>) object;
} else {
spellX = new HashMap<>();
}
spellX.put(event.getSourceId().toString() + game.getState().getZoneChangeCounter(event.getSourceId()), xCost);
game.getState().setValue("spellX" + source.getSourceId(), spellX);
}
}
return false;
}
protected static int playerPaysXGenericMana(Player player, Ability source, Game game) {
int xValue = 0;
boolean payed = false;
@ -191,16 +187,18 @@ class ChorusOfTheConclaveReplacementEffect2 extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Map<String, Integer> spellX = (Map<String, Integer>) game.getState().getValue("spellX" + source.getSourceId());
return spellX != null && event.getSourceId() != null && spellX.containsKey(event.getSourceId().toString() + (game.getState().getZoneChangeCounter(event.getSourceId()) - 2));
return spellX != null
&& event.getSourceId() != null
&& spellX.containsKey(event.getSourceId().toString() + (game.getState().getZoneChangeCounter(event.getSourceId()) - 1));
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent creature = game.getPermanent(event.getSourceId());
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
Map<String, Integer> spellX = (Map<String, Integer>) game.getState().getValue("spellX" + source.getSourceId());
MageObject sourceObject = source.getSourceObject(game);
if (sourceObject != null && creature != null && spellX != null) {
String key = event.getSourceId().toString() + (game.getState().getZoneChangeCounter(event.getSourceId()) - 2);
String key = event.getSourceId().toString() + (game.getState().getZoneChangeCounter(event.getSourceId()) - 1);
int xValue = spellX.get(key);
if (xValue > 0) {
creature.addCounters(CounterType.P1P1.createInstance(xValue), game);

View file

@ -148,20 +148,20 @@ class KaaliaOfTheVastEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null || !player.chooseUse(Outcome.PutCreatureInPlay, "Put an Angel, Demon, or Dragon creature card from your hand onto the battlefield tapped and attacking?", source, game)) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null || !controller.chooseUse(Outcome.PutCreatureInPlay, "Put an Angel, Demon, or Dragon creature card from your hand onto the battlefield tapped and attacking?", source, game)) {
return false;
}
TargetCardInHand target = new TargetCardInHand(filter);
if (target.canChoose(player.getId(), game) && target.choose(getOutcome(), player.getId(), source.getSourceId(), game)) {
if (target.canChoose(controller.getId(), game) && target.choose(getOutcome(), controller.getId(), source.getSourceId(), game)) {
if (target.getTargets().size() > 0) {
UUID cardId = target.getFirstTarget();
Card card = game.getCard(cardId);
if (card != null && game.getCombat() != null) {
UUID defenderId = game.getCombat().getDefendingPlayerId(source.getSourceId(), game);
if (defenderId != null) {
player.getHand().remove(card);
player.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId(), true);
controller.getHand().remove(card);
controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
Permanent creature = game.getPermanent(cardId);
if (creature != null) {
game.getCombat().addAttackerToCombat(card.getId(), defenderId, game);

View file

@ -110,17 +110,17 @@ class KodamasReachEffect extends OneShotEffect {
controller.choose(Outcome.Benefit, revealed, target2, game);
Card card = revealed.get(target2.getFirstTarget(), game);
if (card != null) {
controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId(), true);
controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
revealed.remove(card);
}
card = revealed.getCards(game).iterator().next();
if (card != null) {
controller.moveCards(card, null, Zone.HAND, source, game);
controller.moveCards(card, Zone.HAND, source, game);
}
} else if (target.getTargets().size() == 1) {
Card card = revealed.getCards(game).iterator().next();
if (card != null) {
controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId(), true);
controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
}
}

View file

@ -35,7 +35,7 @@ import mage.abilities.common.AsEntersBattlefieldAbility;
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.ChoosePlayerEffect;
import mage.abilities.effects.common.PutTopCardOfLibraryIntoGraveTargetEffect;
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
import mage.cards.CardImpl;
@ -47,9 +47,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.TargetPlayer;
import mage.target.targetpointer.FixedTarget;
/**
@ -67,7 +65,7 @@ public class SewerNemesis extends CardImpl {
this.toughness = new MageInt(0);
// As Sewer Nemesis enters the battlefield, choose a player.
this.addAbility(new AsEntersBattlefieldAbility(new SewerNemesisChoosePlayerEffect()));
this.addAbility(new AsEntersBattlefieldAbility(new ChoosePlayerEffect(Outcome.Detriment)));
// Sewer Nemesis's power and toughness are each equal to the number of cards in the chosen player's graveyard.
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(new CardsInTargetOpponentsGraveyardCount(), Duration.WhileOnBattlefield)));
// Whenever the chosen player casts a spell, that player puts the top card of his or her library into his or her graveyard.
@ -85,42 +83,8 @@ public class SewerNemesis extends CardImpl {
}
}
class SewerNemesisChoosePlayerEffect extends OneShotEffect {
public SewerNemesisChoosePlayerEffect() {
super(Outcome.Detriment);
this.staticText = "choose a player";
}
public SewerNemesisChoosePlayerEffect(final SewerNemesisChoosePlayerEffect effect) {
super(effect);
}
@Override
public SewerNemesisChoosePlayerEffect copy() {
return new SewerNemesisChoosePlayerEffect(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) {
TargetPlayer target = new TargetPlayer(1,1,true);
if (player.choose(this.outcome, target, source.getSourceId(), game)) {
Player chosenPlayer = game.getPlayer(target.getFirstTarget());
if (chosenPlayer != null) {
game.informPlayers(permanent.getLogName() + ": " + player.getLogName() + " has chosen " + chosenPlayer.getLogName());
game.getState().setValue(permanent.getId() + "_player", target.getFirstTarget());
return true;
}
}
}
return false;
}
}
class CardsInTargetOpponentsGraveyardCount implements DynamicValue {
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
if (sourceAbility != null) {

View file

@ -110,7 +110,7 @@ class TarielReckonerOfSoulsEffect extends OneShotEffect {
}
if (!creatureCards.isEmpty()) {
Card card = creatureCards.getRandom(game);
controller.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId());
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
return true;
}

View file

@ -97,7 +97,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 = game.getPermanentEntering(source.getSourceId());
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)) {

View file

@ -66,8 +66,9 @@ public class NayaSoulbeast extends CardImpl {
// Trample
this.addAbility(TrampleAbility.getInstance());
// When you cast Naya Soulbeast, each player reveals the top card of his or her library. Naya Soulbeast enters the battlefield with X +1/+1 counters on it, where X is the total converted mana cost of all cards revealed this way.
// When you cast Naya Soulbeast, each player reveals the top card of his or her library.
Ability ability = new CastSourceTriggeredAbility(new NayaSoulbeastCastEffect(), false);
// Naya Soulbeast enters the battlefield with X +1/+1 counters on it, where X is the total converted mana cost of all cards revealed this way.
ability.addEffect(new NayaSoulbeastReplacementEffect());
this.addAbility(ability);
}

View file

@ -47,6 +47,7 @@ import mage.constants.WatcherScope;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
@ -157,13 +158,13 @@ class OpalPalaceEntersBattlefieldEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
OpalPalaceWatcher watcher = (OpalPalaceWatcher) game.getState().getWatchers().get("ManaPaidFromOpalPalaceWatcher", source.getSourceId());
return watcher != null &&
watcher.commanderId.contains(event.getTargetId());
return watcher != null
&& watcher.commanderId.contains(event.getTargetId());
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId());
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null) {
Integer castCount = (Integer) game.getState().getValue(permanent.getId() + "_castCount");
if (castCount != null && castCount > 0) {

View file

@ -51,7 +51,6 @@ public class PrimalVigor extends CardImpl {
super(ownerId, 162, "Primal Vigor", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{4}{G}");
this.expansionSetCode = "C13";
// If one or more tokens would be put onto the battlefield, twice that many of those tokens are put onto the battlefield instead.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PrimalVigorTokenEffect()));
// If one or more +1/+1 counters would be placed on a creature, twice that many +1/+1 counters are placed on that creature instead.
@ -132,8 +131,11 @@ class PrimalVigorCounterEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent target = game.getPermanent(event.getTargetId());
if (target != null && target.getCardType().contains(CardType.CREATURE)
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent == null) {
permanent = game.getPermanentEntering(event.getTargetId());
}
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)
&& event.getData() != null && event.getData().equals("+1/+1")) {
return true;
}

View file

@ -30,9 +30,8 @@ package mage.sets.commander2013;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ChoosePlayerEffect;
import mage.abilities.keyword.ProtectionAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
@ -44,18 +43,19 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import mage.game.stack.StackObject;
import mage.players.Player;
import mage.target.TargetPlayer;
/**
* Protection from a player is a new variant of the protection ability. It means the following:
* -- True-Name Nemesis cant be the target of spells or abilities controlled by the chosen player.
* -- True-Name Nemesis cant be enchanted by Auras or equipped by Equipment controlled
* by the chosen player. (The same is true for Fortifications controlled by the chosen player,
* if True-Name Nemesis becomes a land.)
* -- True-Name Nemesis cant be blocked by creatures controlled by the chosen player.
* -- All damage that would be dealt to True-Name Nemesis by sources controlled by the chosen player
* is prevented. (The same is true for sources owned by the chosen player that dont have controllers.)
* Protection from a player is a new variant of the protection ability. It means
* the following: -- True-Name Nemesis cant be the target of spells or
* abilities controlled by the chosen player. -- True-Name Nemesis cant be
* enchanted by Auras or equipped by Equipment controlled by the chosen player.
* (The same is true for Fortifications controlled by the chosen player, if
* True-Name Nemesis becomes a land.) -- True-Name Nemesis cant be blocked by
* creatures controlled by the chosen player. -- All damage that would be dealt
* to True-Name Nemesis by sources controlled by the chosen player is prevented.
* (The same is true for sources owned by the chosen player that dont have
* controllers.)
*
* @author LevelX2
*/
public class TrueNameNemesis extends CardImpl {
@ -70,7 +70,7 @@ public class TrueNameNemesis extends CardImpl {
this.toughness = new MageInt(1);
// As True-Name Nemesis enters the battlefield, choose a player.
this.addAbility(new AsEntersBattlefieldAbility(new TrueNameNemesisChoosePlayerEffect()));
this.addAbility(new AsEntersBattlefieldAbility(new ChoosePlayerEffect(Outcome.Protect)));
// True-Name Nemesis has protection from the chosen player.
this.addAbility(new ProtectionFromPlayerAbility());
}
@ -85,42 +85,6 @@ public class TrueNameNemesis extends CardImpl {
}
}
class TrueNameNemesisChoosePlayerEffect extends OneShotEffect {
public TrueNameNemesisChoosePlayerEffect() {
super(Outcome.Detriment);
this.staticText = "choose a player";
}
public TrueNameNemesisChoosePlayerEffect(final TrueNameNemesisChoosePlayerEffect effect) {
super(effect);
}
@Override
public TrueNameNemesisChoosePlayerEffect copy() {
return new TrueNameNemesisChoosePlayerEffect(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) {
TargetPlayer target = new TargetPlayer(1,1,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());
permanent.addInfo("chosen player", "<i>Chosen player: " + chosenPlayer.getLogName() + "</i>", game);
return true;
}
}
}
return false;
}
}
class ProtectionFromPlayerAbility extends ProtectionAbility {
public ProtectionFromPlayerAbility() {

View file

@ -91,7 +91,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 = game.getPermanentEntering(source.getSourceId());
if (controller != null && permanent != null) {
TargetPlayer target = new TargetPlayer(2, 2, true);
controller.chooseTarget(outcome, target, source, game);

View file

@ -33,13 +33,12 @@ import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.LoyaltyAbility;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.CanBeYourCommanderAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.GetEmblemEffect;
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
@ -47,7 +46,6 @@ import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.FilterCard;
import mage.filter.common.FilterArtifactCard;
import mage.filter.common.FilterControlledArtifactPermanent;
@ -75,7 +73,7 @@ public class DarettiScrapSavant extends CardImpl {
this.expansionSetCode = "C14";
this.subtype.add("Daretti");
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), false));
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3));
// +2: Discard up to two cards, then draw that many cards.
this.addAbility(new LoyaltyAbility(new DarettiDiscardDrawEffect(), 2));
@ -166,7 +164,7 @@ class DarettiSacrificeEffect extends OneShotEffect {
if (artifact != null && artifact.sacrifice(source.getSourceId(), game)) {
Card card = game.getCard(getTargetPointer().getFirst(game, source));
if (card != null) {
return controller.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId());
return controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
}
@ -179,7 +177,6 @@ class DarettiSacrificeEffect extends OneShotEffect {
class DarettiScrapSavantEmblem extends Emblem {
// You get an emblem with "Whenever an artifact is put into your graveyard from the battlefield, return that card to the battlefield at the beginning of the next end step."
public DarettiScrapSavantEmblem() {
this.setName("Emblem - Daretti");
this.getAbilities().add(new DarettiScrapSavantTriggeredAbility());

View file

@ -32,19 +32,17 @@ import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.CanBeYourCommanderAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.mana.GreenManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.counters.CounterType;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.permanent.token.Token;
import mage.target.TargetPermanent;
@ -56,6 +54,7 @@ import mage.target.TargetPermanent;
public class FreyaliseLlanowarsFury extends CardImpl {
private static final FilterControlledCreaturePermanent filterGreen = new FilterControlledCreaturePermanent("green creature you control");
static {
filterGreen.add(new ColorPredicate(ObjectColor.GREEN));
}
@ -65,7 +64,7 @@ public class FreyaliseLlanowarsFury extends CardImpl {
this.expansionSetCode = "C14";
this.subtype.add("Freyalise");
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), false));
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3));
// +2: Put a 1/1 green Elf Druid creature token onto the battlefield with "{T}: Add {G} to your mana pool."
this.addAbility(new LoyaltyAbility(new CreateTokenEffect(new FreyaliseLlanowarsFuryToken()), 2));

View file

@ -104,7 +104,7 @@ class InfernalOfferingSacrificeEffect extends OneShotEffect {
if (opponent != null) {
//Choose creatures to sacrifice
Map<UUID, UUID> toSacrifice = new HashMap<>(2);
for (UUID playerId : player.getInRange()) {
for (UUID playerId : game.getState().getPlayersInRange(player.getId(), game)) {
if (playerId.equals(player.getId()) || playerId.equals(opponent.getId())) {
target = new TargetControlledCreaturePermanent(1, 1, new FilterControlledCreaturePermanent(), true);
if (target.choose(Outcome.Sacrifice, playerId, source.getControllerId(), game)) {
@ -154,16 +154,16 @@ class InfernalOfferingReturnEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Target target = new TargetOpponent(true);
target.choose(Outcome.PutCreatureInPlay, source.getControllerId(), source.getSourceId(), game);
Player opponent = game.getPlayer(target.getFirstTarget());
target = new TargetCardInYourGraveyard(new FilterCreatureCard("creature card in your graveyard"));
if (target.choose(Outcome.PutCreatureInPlay, player.getId(), source.getSourceId(), game)) {
Card card = player.getGraveyard().get(target.getFirstTarget(), game);
if (target.choose(Outcome.PutCreatureInPlay, controller.getId(), source.getSourceId(), game)) {
Card card = controller.getGraveyard().get(target.getFirstTarget(), game);
if (card != null) {
player.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId());
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
if (opponent != null) {
@ -171,7 +171,7 @@ class InfernalOfferingReturnEffect extends OneShotEffect {
if (target.choose(Outcome.PutCreatureInPlay, opponent.getId(), source.getSourceId(), game)) {
Card card = opponent.getGraveyard().get(target.getFirstTarget(), game);
if (card != null) {
opponent.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId());
opponent.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
}

View file

@ -28,14 +28,11 @@
package mage.sets.commander2014;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.EntersBattlefieldEffect;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.effects.common.CopyPermanentEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
@ -45,6 +42,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
* @author LevelX2
*/
public class MasterworkOfIngenuity extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact");
static {
@ -58,12 +56,7 @@ public class MasterworkOfIngenuity extends CardImpl {
this.subtype.add("Equipment");
// You may have Masterwork of Ingenuity enter the battlefield as a copy of any Equipment on the battlefield.
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect(
new CopyPermanentEffect(filter),
"You may have {this} enter the battlefield as a copy of any Equipment on the battlefield",
true));
this.addAbility(ability);
this.addAbility(new EntersBattlefieldAbility(new CopyPermanentEffect(filter), true));
}
public MasterworkOfIngenuity(final MasterworkOfIngenuity card) {

View file

@ -27,15 +27,11 @@
*/
package mage.sets.commander2014;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.CanBeYourCommanderAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.Effect;
@ -43,7 +39,6 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.DoubleStrikeAbility;
import mage.abilities.keyword.EquipAbility;
import mage.abilities.keyword.IndestructibleAbility;
@ -55,7 +50,6 @@ import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.FilterCard;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
@ -80,8 +74,7 @@ public class NahiriTheLithomancer extends CardImpl {
this.expansionSetCode = "C14";
this.subtype.add("Nahiri");
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), false));
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3));
// +2: Put a 1/1 white Kor Soldier creature token onto the battlefield. You may attach an Equipment you control to it.
this.addAbility(new LoyaltyAbility(new NahiriTheLithomancerFirstAbilityEffect(), 2));
@ -111,6 +104,7 @@ public class NahiriTheLithomancer extends CardImpl {
class NahiriTheLithomancerFirstAbilityEffect extends OneShotEffect {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("an Equipment you control");
static {
filter.add(new SubtypePredicate("Equipment"));
}
@ -139,8 +133,8 @@ class NahiriTheLithomancerFirstAbilityEffect extends OneShotEffect {
if (tokenPermanent != null) {
//TODO: Make sure the Equipment can legally enchant the token, preferably on targetting.
Target target = new TargetControlledPermanent(0, 1, filter, true);
if (target.canChoose(source.getSourceId(), controller.getId(), game) &&
controller.chooseUse(outcome, "Attach an Equipment you control to the created Token?", source, game)) {
if (target.canChoose(source.getSourceId(), controller.getId(), game)
&& controller.chooseUse(outcome, "Attach an Equipment you control to the created Token?", source, game)) {
if (target.choose(Outcome.Neutral, source.getControllerId(), source.getSourceId(), game)) {
Permanent equipmentPermanent = game.getPermanent(target.getFirstTarget());
if (equipmentPermanent != null) {
@ -164,6 +158,7 @@ class NahiriTheLithomancerFirstAbilityEffect extends OneShotEffect {
class NahiriTheLithomancerSecondAbilityEffect extends OneShotEffect {
private static final FilterCard filter = new FilterCard("an Equipment");
static {
filter.add(new SubtypePredicate("Equipment"));
}
@ -191,15 +186,14 @@ class NahiriTheLithomancerSecondAbilityEffect extends OneShotEffect {
controller.choose(outcome, target, source.getSourceId(), game);
Card card = controller.getHand().get(target.getFirstTarget(), game);
if (card != null) {
controller.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId());
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
else {
} else {
Target target = new TargetCardInYourGraveyard(0, 1, filter);
target.choose(Outcome.PutCardInPlay, source.getControllerId(), source.getSourceId(), game);
Card card = controller.getGraveyard().get(target.getFirstTarget(), game);
if (card != null) {
controller.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId());
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
return true;

View file

@ -71,7 +71,6 @@ public class NecromanticSelection extends CardImpl {
super(ownerId, 26, "Necromantic Selection", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{4}{B}{B}{B}");
this.expansionSetCode = "C14";
// Destroy all creatures, then return a creature card put into a graveyard this way to the battlefield under your control. It's a black Zombie in addition to its other colors and types. Exile Necromantic Selection.
this.getSpellAbility().addEffect(new NecromanticSelectionEffect());
this.getSpellAbility().addEffect(ExileSpellEffect.getInstance());
@ -126,7 +125,7 @@ class NecromanticSelectionEffect extends OneShotEffect {
if (controller.chooseTarget(outcome, target, source, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
controller.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId());
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
ContinuousEffect effect = new NecromanticSelectionContinuousEffect();
effect.setTargetPointer(new FixedTarget(card.getId()));
game.addEffect(effect, source);

View file

@ -31,7 +31,7 @@ import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.CanBeYourCommanderAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -44,14 +44,11 @@ import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.GetEmblemEffect;
import mage.abilities.effects.common.LoseLifeSourceControllerEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.command.Emblem;
import mage.game.permanent.token.DemonToken;
@ -69,8 +66,7 @@ public class ObNixilisOfTheBlackOath extends CardImpl {
this.expansionSetCode = "C14";
this.subtype.add("Nixilis");
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), false));
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3));
// +2: Each opponent loses 1 life. You gain life equal to the life lost this way.
this.addAbility(new LoyaltyAbility(new ObNixilisOfTheBlackOathEffect1(), 2));
@ -134,7 +130,9 @@ class ObNixilisOfTheBlackOathEffect1 extends OneShotEffect {
}
class ObNixilisOfTheBlackOathEmblem extends Emblem {
// You get an emblem with "{1}{B}, Sacrifice a creature: You gain X life and draw X cards, where X is the sacrificed creature's power."
public ObNixilisOfTheBlackOathEmblem() {
this.setName("EMBLEM: Ob Nixilis of the Black Oath");
DynamicValue xValue = new SacrificeCostCreaturesPower();

View file

@ -28,14 +28,14 @@
package mage.sets.commander2014;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
@ -56,7 +56,6 @@ public class ScrapMastery extends CardImpl {
super(ownerId, 38, "Scrap Mastery", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{R}{R}");
this.expansionSetCode = "C14";
// Each player exiles all artifact cards from his or her graveyard, then sacrifices all artifacts he or she controls, then puts all cards he or she exiled this way onto the battlefield.
this.getSpellAbility().addEffect(new ScrapMasteryEffect());
}
@ -93,19 +92,16 @@ class ScrapMasteryEffect extends OneShotEffect {
if (controller != null) {
Map<UUID, Set<UUID>> exiledCards = new HashMap<>();
// exile artifacts from graveyard
for (UUID playerId: controller.getInRange()) {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
Set<UUID> cards = new HashSet<>();
for (Card card: player.getGraveyard().getCards(new FilterArtifactCard(), game)) {
cards.add(card.getId());
player.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true);
}
Set cards = player.getGraveyard().getCards(new FilterArtifactCard(), game);
controller.moveCards(cards, Zone.EXILED, source, game);
exiledCards.put(player.getId(), cards);
}
}
// sacrifice all artifacts
for (UUID playerId: controller.getInRange()) {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterArtifactPermanent(), playerId, game)) {
@ -114,15 +110,11 @@ class ScrapMasteryEffect extends OneShotEffect {
}
}
// puts all cards he or she exiled this way onto the battlefield
for (UUID playerId: controller.getInRange()) {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
for (UUID cardId: exiledCards.get(playerId)) {
Card card = game.getCard(cardId);
if (card != null) {
player.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, cardId);
}
}
Cards playersExiledCards = new CardsImpl(exiledCards.get(playerId));
controller.moveCards(playersExiledCards, Zone.BATTLEFIELD, source, game);
}
}
return true;

View file

@ -31,14 +31,13 @@ import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.CanBeYourCommanderAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.abilities.effects.common.GetEmblemEffect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.UntapTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.constants.AsThoughEffectType;
import mage.constants.CardType;
@ -46,7 +45,6 @@ import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.FilterCard;
import mage.filter.FilterPermanent;
import mage.game.Game;
@ -64,7 +62,7 @@ public class TeferiTemporalArchmage extends CardImpl {
this.expansionSetCode = "C14";
this.subtype.add("Teferi");
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(5)), false));
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(5));
// +1: Look at the top two cards of your library. Put one of them into your hand and the other on the bottom of your library.
this.addAbility(new LoyaltyAbility(new LookLibraryAndPickControllerEffect(
@ -96,7 +94,6 @@ public class TeferiTemporalArchmage extends CardImpl {
class TeferiTemporalArchmageEmblem extends Emblem {
// "You may activate loyalty abilities of planeswalkers you control on any player's turn any time you could cast an instant."
public TeferiTemporalArchmageEmblem() {
this.setName("EMBLEM: Teferi, Temporal Archmage");
this.getAbilities().add(new SimpleStaticAbility(Zone.COMMAND, new TeferiTemporalArchmageAsThoughEffect()));

View file

@ -37,8 +37,9 @@ import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.SacrificeTargetEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
@ -148,17 +149,15 @@ class WakeTheDeadReturnFromGraveyardToBattlefieldTargetEffect extends OneShotEff
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
for (UUID targetId : getTargetPointer().getTargets(game, source)) {
Card card = game.getCard(targetId);
if (card != null) {
if (player.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId(), false)) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
permanent.changeControllerId(source.getControllerId(), game);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Cards cards = new CardsImpl(getTargetPointer().getTargets(game, source));
controller.moveCards(cards, Zone.BATTLEFIELD, source, game);
for (UUID targetId : cards) {
Permanent creature = game.getPermanent(targetId);
if (creature != null) {
Effect effect = new SacrificeTargetEffect("Sacrifice those creatures at the beginning of the next end step", source.getControllerId());
effect.setTargetPointer(new FixedTarget(permanent, game));
effect.setTargetPointer(new FixedTarget(creature, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
@ -167,8 +166,6 @@ class WakeTheDeadReturnFromGraveyardToBattlefieldTargetEffect extends OneShotEff
}
}
}
}
return true;
}
return false;

View file

@ -28,12 +28,15 @@
package mage.sets.commander2014;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
@ -86,9 +89,9 @@ class WaveOfVitriolEffect extends OneShotEffect {
new CardTypePredicate(CardType.LAND),
Predicates.not(new SupertypePredicate("Basic"))
)
));
}
public WaveOfVitriolEffect() {
super(Outcome.Benefit);
this.staticText = "Each player sacrifices all artifacts, enchantments, and nonbasic lands he or she controls. For each land sacrificed this way, its controller may search his or her library for a basic land card and put it onto the battlefield tapped. Then each player who searched his or her library this way shuffles it";
@ -123,25 +126,19 @@ class WaveOfVitriolEffect extends OneShotEffect {
}
}
game.getState().handleSimultaneousEvent(game);
Cards toBattlefield = new CardsImpl();
Set<Player> playersToShuffle = new LinkedHashSet<>();
for (Map.Entry<Player, Integer> entry : sacrificedLands.entrySet()) {
if (entry.getKey().chooseUse(Outcome.PutLandInPlay, "Search your library for up to " + entry.getValue() + " basic lands?", source, game)) {
Target target = new TargetCardInLibrary(0, entry.getValue(), new FilterBasicLandCard());
entry.getKey().chooseTarget(outcome, target, source, game);
for(UUID targetId: target.getTargets()) {
Card card = game.getCard(targetId);
if (card != null) {
entry.getKey().putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId(), true);
toBattlefield.addAll(target.getTargets());
playersToShuffle.add(entry.getKey());
}
}
entry.getKey().shuffleLibrary(game);
} else {
entry.setValue(0);
}
}
for(Map.Entry<Player, Integer> entry: sacrificedLands.entrySet()) {
if (entry.getValue() > 0) {
entry.getKey().shuffleLibrary(game);
}
controller.moveCards(toBattlefield.getCards(game), Zone.BATTLEFIELD, source, game, true, false, true, null);
for (Player player : playersToShuffle) {
player.shuffleLibrary(game);
}
return true;

View file

@ -63,7 +63,8 @@ public class ApocalypseHydra extends CardImpl {
this.toughness = new MageInt(0);
// Apocalypse Hydra enters the battlefield with X +1/+1 counters on it. If X is 5 or more, it enters the battlefield with an additional X +1/+1 counters on it.
this.addAbility(new EntersBattlefieldAbility(new ApocalypseHydraEffect(), true));
this.addAbility(new EntersBattlefieldAbility(new ApocalypseHydraEffect()));
// {1}{R}, Remove a +1/+1 counter from Apocalypse Hydra: Apocalypse Hydra deals 1 damage to target creature or player.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new ManaCostsImpl("{1}{R}"));
ability.addCost(new RemoveCountersSourceCost(CounterType.P1P1.createInstance()));
@ -94,12 +95,12 @@ class ApocalypseHydraEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
Permanent permanent = game.getPermanentEntering(source.getSourceId());
if (permanent != null) {
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
if (spellAbility != null
&& spellAbility.getSourceId().equals(source.getSourceId())
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
&& permanent.getZoneChangeCounter(game) == spellAbility.getSourceObjectZoneChangeCounter()) {
int amount = spellAbility.getManaCostsToPay().getX();
if (amount > 0) {
if (amount < 5) {

View file

@ -28,19 +28,17 @@
package mage.sets.conflux;
import java.util.UUID;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.SacrificeEffect;
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
import mage.abilities.effects.common.discard.DiscardTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.discard.DiscardTargetEffect;
import mage.abilities.effects.common.SacrificeEffect;
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
@ -65,8 +63,7 @@ public class NicolBolasPlaneswalker extends CardImpl {
this.expansionSetCode = "CON";
this.subtype.add("Bolas");
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(5)), false));
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(5));
// +3: Destroy target noncreature permanent.
LoyaltyAbility ability = new LoyaltyAbility(new DestroyTargetEffect(), 3);

View file

@ -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();

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.conflux;
import java.util.UUID;
@ -99,7 +98,7 @@ class PathToExileEffect extends OneShotEffect {
if (player.searchLibrary(target, game)) {
Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
if (card != null) {
player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId(), true);
controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
}
}
player.shuffleLibrary(game);

View file

@ -106,9 +106,9 @@ public class SkywardEyeProphets extends CardImpl {
cards.add(card);
controller.revealCards(sourceObject.getName(), cards, game);
if (card.getCardType().contains(CardType.LAND)) {
return controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
return controller.moveCards(card, Zone.BATTLEFIELD, source, game);
} else {
controller.moveCards(card, null, Zone.HAND, source, game);
controller.moveCards(card, Zone.HAND, source, game);
}
}
return true;

View file

@ -103,7 +103,7 @@ class AcademyEliteEffect1 extends OneShotEffect {
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
if (spellAbility != null
&& spellAbility.getSourceId().equals(source.getSourceId())
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
&& permanent.getZoneChangeCounter(game) == spellAbility.getSourceObjectZoneChangeCounter()) {
CardsInAllGraveyardsCount instantsAndSorceries = new CardsInAllGraveyardsCount(new FilterInstantOrSorceryCard("instant or sorcery cards"));
int instantsAndSorceriesCount = instantsAndSorceries.calculate(game, source, this);
if (instantsAndSorceriesCount > 0) {

View file

@ -34,13 +34,12 @@ import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.SpellAbility;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DrawCardTargetEffect;
import mage.abilities.effects.common.GetEmblemEffect;
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.effects.common.discard.DiscardTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
@ -50,7 +49,6 @@ import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.SubLayer;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.command.Emblem;
import mage.game.events.GameEvent;
@ -73,8 +71,7 @@ public class DackFayden extends CardImpl {
this.expansionSetCode = "CNS";
this.subtype.add("Dack");
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), false));
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3));
// +1: Target player draws two cards, then discards two cards.
LoyaltyAbility ability = new LoyaltyAbility(new DrawCardTargetEffect(2), 1);

View file

@ -30,7 +30,6 @@ package mage.sets.conspiracy;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
@ -114,14 +113,13 @@ class ExtractFromDarknessReturnFromGraveyardToBattlefieldEffect extends OneShotE
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Target target = new TargetCardInGraveyard(new FilterCreatureCard());
target.setNotTarget(true);
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)
&& player.chooseTarget(outcome, target, source, game)) {
Card card = game.getCard(target.getFirstTarget());
player.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId());
&& controller.chooseTarget(outcome, target, source, game)) {
return controller.moveCards(game.getCard(target.getFirstTarget()), Zone.BATTLEFIELD, source, game);
}
return true;
}

View file

@ -106,7 +106,7 @@ class GrenzoDungeonWardenEffect extends OneShotEffect {
if (card.getCardType().contains(CardType.CREATURE)) {
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (sourcePermanent != null && card.getPower().getValue() <= sourcePermanent.getPower().getValue()) {
controller.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId());
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
}

View file

@ -99,14 +99,14 @@ class MuzzioVisionaryArchitectEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (player == null || sourcePermanent == null) {
if (controller == null || sourcePermanent == null) {
return false;
}
int highCMC = 0;
List<Permanent> controlledArtifacts = game.getBattlefield().getAllActivePermanents(new FilterArtifactPermanent(), player.getId(), game);
List<Permanent> controlledArtifacts = game.getBattlefield().getAllActivePermanents(new FilterArtifactPermanent(), controller.getId(), game);
for (Permanent permanent : controlledArtifacts) {
if (permanent.getSpellAbility() != null) {
int cmc = permanent.getSpellAbility().getManaCosts().convertedManaCost();
@ -119,26 +119,26 @@ class MuzzioVisionaryArchitectEffect extends OneShotEffect {
Cards cards = new CardsImpl();
for (int i = 0; i < highCMC; i++) {
Card card = player.getLibrary().removeFromTop(game);
Card card = controller.getLibrary().removeFromTop(game);
if (card != null) {
cards.add(card);
}
}
player.lookAtCards(sourcePermanent.getName(), cards, game);
controller.lookAtCards(sourcePermanent.getIdName(), cards, game);
if (!cards.isEmpty()) {
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterArtifactCard("artifact card to put onto the battlefield"));
if (target.canChoose(source.getSourceId(), player.getId(), game) && player.choose(Outcome.Benefit, cards, target, game)) {
if (target.canChoose(source.getSourceId(), controller.getId(), game) && controller.choose(Outcome.Benefit, cards, target, game)) {
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
player.revealCards(sourcePermanent.getName(), new CardsImpl(card), game);
controller.revealCards(sourcePermanent.getIdName(), new CardsImpl(card), game);
cards.remove(card);
player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
}
player.putCardsOnBottomOfLibrary(cards, game, source, true);
controller.putCardsOnBottomOfLibrary(cards, game, source, true);
return true;
}
}

View file

@ -31,8 +31,8 @@ import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
@ -91,12 +91,8 @@ class VictimizeEffect extends OneShotEffect {
if (controller != null) {
SacrificeTargetCost cost = new SacrificeTargetCost(new TargetControlledCreaturePermanent(new FilterControlledCreaturePermanent("a creature")));
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
for (UUID targetId: getTargetPointer().getTargets(game, source)) {
Card card = game.getCard(targetId);
if (card != null) {
controller.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId(), true);
}
}
controller.moveCards(new CardsImpl(getTargetPointer().getTargets(game, source)).getCards(game),
Zone.BATTLEFIELD, source, game, true, false, false, null);
}
return true;
}

View file

@ -28,10 +28,6 @@
package mage.sets.darkascension;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
@ -41,6 +37,10 @@ import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.IntimidateAbility;
import mage.abilities.keyword.UndyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
@ -74,6 +74,7 @@ public class MikaeusTheUnhallowed extends CardImpl {
this.addAbility(IntimidateAbility.getInstance());
// Whenever a Human deals damage to you, destroy it.
this.addAbility(new MikaeusTheUnhallowedAbility());
// Other non-Human creatures you control get +1/+1 and have undying.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filter, true)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(new UndyingAbility(), Duration.WhileOnBattlefield, filter, true)));
@ -109,7 +110,6 @@ class MikaeusTheUnhallowedAbility extends TriggeredAbilityImpl {
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getTargetId().equals(this.controllerId)) {

View file

@ -27,25 +27,24 @@
*/
package mage.sets.darkascension;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.GetEmblemEffect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.LifelinkAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.counters.CounterType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
@ -56,8 +55,6 @@ import mage.game.permanent.token.Token;
import mage.players.Player;
import mage.target.TargetPermanent;
import java.util.UUID;
/**
*
* @author BetaSteward
@ -77,8 +74,7 @@ public class SorinLordOfInnistrad extends CardImpl {
this.expansionSetCode = "DKA";
this.subtype.add("Sorin");
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), false));
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3));
// +1: Put a 1/1 black Vampire creature token with lifelink onto the battlefield.
this.addAbility(new LoyaltyAbility(new CreateTokenEffect(new VampireToken()), 1));
@ -103,6 +99,7 @@ public class SorinLordOfInnistrad extends CardImpl {
}
class VampireToken extends Token {
VampireToken() {
super("Vampire", "a 1/1 black Vampire creature token with lifelink");
cardType.add(CardType.CREATURE);

View file

@ -28,11 +28,6 @@
package mage.sets.darksteel;
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.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
@ -41,6 +36,11 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.Card;
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.counters.CounterType;
import mage.filter.Filter;
import mage.filter.common.FilterCreatureCard;
@ -107,18 +107,20 @@ class AEtherVialEffect extends OneShotEffect {
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, count));
String choiceText = "Put a " + filter.getMessage() + " from your hand onto the battlefield?";
Player player = game.getPlayer(source.getControllerId());
if (player == null || player.getHand().count(filter, game) == 0
|| !player.chooseUse(this.outcome, choiceText, source, game)) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
if (controller.getHand().count(filter, game) == 0
|| !controller.chooseUse(this.outcome, choiceText, source, game)) {
return true;
}
TargetCardInHand target = new TargetCardInHand(filter);
if (player.choose(this.outcome, target, source.getSourceId(), game)) {
if (controller.choose(this.outcome, target, source.getSourceId(), game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
player.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId());
return true;
return controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
return false;

View file

@ -28,15 +28,14 @@
package mage.sets.darksteel;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.filter.FilterCard;
@ -64,7 +63,6 @@ public class Reshape extends CardImpl {
super(ownerId, 31, "Reshape", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{X}{U}{U}");
this.expansionSetCode = "DST";
// As an additional cost to cast Reshape, sacrifice an artifact.
this.getSpellAbility().addCost(new SacrificeTargetCost(new TargetControlledPermanent(1, 1, filter, false)));
// Search your library for an artifact card with converted mana cost X or less and put it onto the battlefield. Then shuffle your library.
@ -94,8 +92,8 @@ class ReshapeSearchEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
//Set the mana cost one higher to 'emulate' a less than or equal to comparison.
@ -104,17 +102,17 @@ class ReshapeSearchEffect extends OneShotEffect {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, xValue));
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (player.searchLibrary(target, game)) {
if (controller.searchLibrary(target, game)) {
if (target.getTargets().size() > 0) {
Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
if (card != null) {
player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
player.shuffleLibrary(game);
controller.shuffleLibrary(game);
return true;
}
player.shuffleLibrary(game);
controller.shuffleLibrary(game);
return false;
}

View file

@ -0,0 +1,144 @@
/*
* 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.darksteel;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.CostImpl;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.SourcePermanentPowerCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.keyword.EquipAbility;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.CardImpl;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPlayer;
/**
*
* @author AlumiuN
*/
public class SurestrikeTrident extends CardImpl {
public SurestrikeTrident(UUID ownerId) {
super(ownerId, 147, "Surestrike Trident", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{2}");
this.expansionSetCode = "DST";
this.subtype.add("Equipment");
// Equipped creature has first strike and "{T}, Unattach Surestrike Trident: This creature deals damage equal to its power to target player."
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(FirstStrikeAbility.getInstance(), AttachmentType.EQUIPMENT));
DynamicValue xValue = new SourcePermanentPowerCount();
Effect effect = new DamageTargetEffect(xValue);
effect.setText("This creature deals damage equal to its power to target player");
Ability gainedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new TapSourceCost());
gainedAbility.addTarget(new TargetPlayer());
gainedAbility.addCost(new SurestrikeTridentUnattachCost(getName(), getId()));
effect = new GainAbilityAttachedEffect(gainedAbility, AttachmentType.EQUIPMENT);
effect.setText("and \"{T}, Unattach {this}: This creature deals damage equal to its power to target player.\"");
ability.addEffect(effect);
this.addAbility(ability);
// Equip {4}
this.addAbility(new EquipAbility(Outcome.Benefit, new GenericManaCost(4)));
}
public SurestrikeTrident(final SurestrikeTrident card) {
super(card);
}
@Override
public SurestrikeTrident copy() {
return new SurestrikeTrident(this);
}
}
class SurestrikeTridentUnattachCost extends CostImpl {
protected UUID sourceEquipmentId;
public SurestrikeTridentUnattachCost(String name, UUID sourceId) {
this.text = "Unattach " + name;
this.sourceEquipmentId = sourceId;
}
public SurestrikeTridentUnattachCost(final SurestrikeTridentUnattachCost cost) {
super(cost);
this.sourceEquipmentId = cost.sourceEquipmentId;
}
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
Permanent permanent = game.getPermanent(sourceId);
if (permanent != null) {
for (UUID attachmentId : permanent.getAttachments()) {
Permanent attachment = game.getPermanent(attachmentId);
if (attachment != null && attachment.getId().equals(sourceEquipmentId)) {
paid = permanent.removeAttachment(attachmentId, game);
if (paid) {
break;
}
}
}
}
return paid;
}
@Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
Permanent permanent = game.getPermanent(sourceId);
if (permanent != null) {
for (UUID attachmentId : permanent.getAttachments()) {
Permanent attachment = game.getPermanent(attachmentId);
if (attachment != null && attachment.getId().equals(sourceEquipmentId)) {
return true;
}
}
}
return false;
}
@Override
public SurestrikeTridentUnattachCost copy() {
return new SurestrikeTridentUnattachCost(this);
}
}

View file

@ -107,7 +107,7 @@ class CryptChampionEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
for (UUID playerId : controller.getInRange()) {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
FilterCard filter = new FilterCreatureCard("creature card with converted mana cost 3 or less from your graveyard");
@ -117,7 +117,7 @@ class CryptChampionEffect extends OneShotEffect {
if (target.canChoose(playerId, game) && player.chooseTarget(outcome, target, source, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
player.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId());
player.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
}

View file

@ -29,9 +29,9 @@ package mage.sets.dissension;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.EnchantedCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalContinuousEffect;
@ -50,10 +50,6 @@ import mage.constants.Zone;
*/
public class FlaringFlameKin extends CardImpl {
private static final String rule1 = "As long as {this} is enchanted, it gets +2/+2";
private static final String rule2 = "As long as {this} is enchanted, it has trample";
private static final String rule3 = "As long as {this} is enchanted, it has \"{R}: {this} gets +1/+0 until end of turn.\"";
public FlaringFlameKin(UUID ownerId) {
super(ownerId, 62, "Flaring Flame-Kin", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{R}");
this.expansionSetCode = "DIS";
@ -63,17 +59,19 @@ public class FlaringFlameKin extends CardImpl {
this.power = new MageInt(2);
this.toughness = new MageInt(2);
SimpleActivatedAbility grantedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new BoostSourceEffect(1, 0, Duration.EndOfTurn),
new ManaCostsImpl("{R}"));
Condition enchanted = new EnchantedCondition();
ConditionalContinuousEffect effect1 = new ConditionalContinuousEffect(new BoostSourceEffect(2, 2, Duration.WhileOnBattlefield), enchanted, rule1);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect1));
ConditionalContinuousEffect effect2 = new ConditionalContinuousEffect(new GainAbilitySourceEffect(TrampleAbility.getInstance()), enchanted, rule2);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect2));
ConditionalContinuousEffect effect3 = new ConditionalContinuousEffect(new GainAbilitySourceEffect(grantedAbility), enchanted, rule3);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect3));
// As long as Flaring Flame-Kin is enchanted, it gets +2/+2, has trample, and has "{R}: Flaring Flame-Kin gets +1/+0 until end of turn."
EnchantedCondition enchanted = new EnchantedCondition();
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(
new BoostSourceEffect(2, 2, Duration.WhileOnBattlefield), enchanted,
"As long as {this} is enchanted, it gets +2/+2"));
ability.addEffect(new ConditionalContinuousEffect(
new GainAbilitySourceEffect(TrampleAbility.getInstance()), enchanted,
", has trample"));
Ability grantedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{R}"));
ability.addEffect(new ConditionalContinuousEffect(new GainAbilitySourceEffect(grantedAbility),
enchanted, ", and has \"{R}: {this} gets +1/+0 until end of turn.\""));
this.addAbility(ability);
}
public FlaringFlameKin(final FlaringFlameKin card) {

View file

@ -95,23 +95,18 @@ class ProteanHulkEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Cards cardsPicked = this.ProteanHulkSearch(game, source);
for (UUID cardId : cardsPicked) {
Card card = game.getCard(cardId);
if (card != null) {
player.putOntoBattlefieldWithInfo(card, game, Zone.PICK, source.getSourceId());
}
}
player.shuffleLibrary(game);
controller.moveCards(cardsPicked.getCards(game), Zone.BATTLEFIELD, source, game);
controller.shuffleLibrary(game);
return true;
}
return false;
}
Cards ProteanHulkSearch(Game game, Ability source) {
Cards cardsPicked = new CardsImpl(Zone.PICK);
Cards cardsPicked = new CardsImpl(Zone.LIBRARY);
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
GameEvent event = GameEvent.getEvent(GameEvent.EventType.SEARCH_LIBRARY, source.getControllerId(), source.getControllerId(), source.getControllerId(), Integer.MAX_VALUE);
@ -131,7 +126,6 @@ class ProteanHulkEffect extends OneShotEffect {
break;
}
cardsPicked.add(card);
game.setZone(card.getId(), Zone.PICK);
game.getState().getLookedAt(source.getControllerId()).add("Protean Hulk", cardsPicked);
librarySearchLimit--;

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.dragonsmaze;
import java.util.UUID;
@ -39,13 +38,11 @@ import mage.constants.Duration;
import mage.constants.Rarity;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent.EventType;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.BirdToken;
public class BeckCall extends SplitCard {
public BeckCall(UUID ownerId) {
@ -94,10 +91,7 @@ class BeckTriggeredAbility extends DelayedTriggeredAbility {
public boolean checkTrigger(GameEvent event, Game game) {
UUID targetId = event.getTargetId();
Permanent permanent = game.getPermanent(targetId);
if (filter.match(permanent, getSourceId(), getControllerId(), game)) {
return true;
}
return false;
return filter.match(permanent, getSourceId(), getControllerId(), game);
}
@Override

View file

@ -25,17 +25,9 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.dragonsmaze;
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.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
@ -45,6 +37,13 @@ import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.LifelinkAbility;
import mage.abilities.keyword.ProtectionAbility;
import mage.cards.CardImpl;
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.filter.FilterCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate;
@ -52,15 +51,10 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class BloodBaronOfVizkopa extends CardImpl {
private static final FilterCard filter = new FilterCard("white and from black");
static {
filter.add(Predicates.or(
new ColorPredicate(ObjectColor.WHITE),
@ -72,7 +66,6 @@ public class BloodBaronOfVizkopa extends CardImpl {
this.expansionSetCode = "DGM";
this.subtype.add("Vampire");
this.power = new MageInt(4);
this.toughness = new MageInt(4);
@ -141,12 +134,14 @@ class BloodBaronOfVizkopaEffect extends ContinuousEffectImpl {
Player player = game.getPlayer(source.getControllerId());
if (player != null && player.getLife() >= 30) {
for (UUID opponentId : player.getInRange()) {
if (player.hasOpponent(opponentId, game)) {
Player opponent = game.getPlayer(opponentId);
if (opponent != null && opponent.getLife() < 11) {
return true;
}
}
}
}
return false;
}

View file

@ -30,18 +30,16 @@ package mage.sets.dragonsmaze;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.condition.common.SourceMatchesFilterCondition;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.EntersBattlefieldEffect;
import mage.abilities.effects.PutTokenOntoBattlefieldCopySourceEffect;
import mage.abilities.effects.common.CopyPermanentEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.TokenPredicate;
@ -72,17 +70,16 @@ public class ProgenitorMimic extends CardImpl {
// put a token onto the battlefield that's a copy of this creature."
Effect effect = new PutTokenOntoBattlefieldCopySourceEffect();
effect.setText("put a token onto the battlefield that's a copy of this creature");
AbilityApplier applier = new AbilityApplier(
new ConditionalTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(effect, TargetController.YOU, false),
new SourceMatchesFilterCondition(filter),
"At the beginning of your upkeep, if this creature isn't a token, put a token onto the battlefield that's a copy of this creature.")
);
this.addAbility(new SimpleStaticAbility(
Zone.BATTLEFIELD,
new EntersBattlefieldEffect(new CopyPermanentEffect(applier),
"You may have {this} enter the battlefield as a copy of any creature on the battlefield except it gains \"At the beginning of your upkeep, if this creature isn't a token, put a token onto the battlefield that's a copy of this creature.\"",
true)));
effect = new CopyPermanentEffect();
effect.setText("as a copy of any creature on the battlefield except it gains \"At the beginning of your upkeep, if this creature isn't a token, put a token onto the battlefield that's a copy of this creature.\"");
this.addAbility(new EntersBattlefieldAbility(new CopyPermanentEffect(applier), true));
}
public ProgenitorMimic(final ProgenitorMimic card) {

View file

@ -28,17 +28,15 @@
package mage.sets.dragonsmaze;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -58,8 +56,7 @@ public class RalZarek extends CardImpl {
this.expansionSetCode = "DGM";
this.subtype.add("Ral");
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(4)), false));
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4));
// +1: Tap target permanent, then untap another target permanent.
LoyaltyAbility ability1 = new LoyaltyAbility(new RalZarekTapUntapEffect(), 1);
@ -86,7 +83,6 @@ public class RalZarek extends CardImpl {
}
}
class RalZarekTapUntapEffect extends OneShotEffect {
public RalZarekTapUntapEffect() {

View file

@ -104,7 +104,7 @@ class VoiceOfResurgenceTriggeredAbility extends TriggeredAbilityImpl {
return true;
}
}
// Voice Of Resurgence Dies
// Voice of Resurgence Dies
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && getSourceId().equals(event.getTargetId())) {
ZoneChangeEvent zce = (ZoneChangeEvent) event;
return zce.getFromZone().equals(Zone.BATTLEFIELD) && zce.getToZone().equals(Zone.GRAVEYARD);

View file

@ -101,9 +101,9 @@ class DeathmistRaptorEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObjectIfItStillExists(game);
if (controller != null && (sourceObject instanceof Card)) {
controller.putOntoBattlefieldWithInfo((Card) sourceObject, game, Zone.GRAVEYARD, source.getSourceId(), false,
controller.chooseUse(Outcome.Detriment, "Return " + sourceObject.getLogName() + " face down to battlefield (otherwise face up)?", source, game));
return true;
return controller.moveCards((Card) sourceObject, Zone.BATTLEFIELD, source, game, false,
controller.chooseUse(Outcome.Detriment, "Return " + sourceObject.getLogName() + " face down to battlefield (otherwise face up)?", source, game),
false, null);
}
return false;
}

View file

@ -32,7 +32,7 @@ import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
@ -40,7 +40,6 @@ import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.effects.common.GetEmblemEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.ReboundAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
@ -52,7 +51,6 @@ import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.SubLayer;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.command.Emblem;
import mage.game.events.GameEvent;
@ -71,7 +69,7 @@ public class NarsetTranscendent extends CardImpl {
this.expansionSetCode = "DTK";
this.subtype.add("Narset");
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(6)), false));
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(6));
// +1: Look at the top card of your library. If it's a noncreature, nonland card, you may reveal it and put it into your hand.
this.addAbility(new LoyaltyAbility(new NarsetTranscendentEffect1(), 1));

View file

@ -33,10 +33,9 @@ import java.util.UUID;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
import mage.cards.CardImpl;
import mage.choices.Choice;
@ -44,7 +43,6 @@ import mage.choices.ChoiceImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.counters.CounterType;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
@ -69,7 +67,7 @@ public class SarkhanUnbroken extends CardImpl {
this.expansionSetCode = "DTK";
this.subtype.add("Sarkhan");
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(4)), false));
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4));
// +1: Draw a card, then add one mana of any color to your mana pool.
this.addAbility(new LoyaltyAbility(new SarkhanUnbrokenAbility1(), 1));

View file

@ -122,7 +122,7 @@ class SwiftWarkiteEffect extends OneShotEffect {
controller.choose(outcome, target, source.getSourceId(), game);
Card card = controller.getHand().get(target.getFirstTarget(), game);
if (card != null) {
if (controller.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId())) {
if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
Permanent creature = game.getPermanent(card.getId());
if (creature != null) {
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
@ -143,7 +143,7 @@ class SwiftWarkiteEffect extends OneShotEffect {
target.choose(Outcome.PutCardInPlay, source.getControllerId(), source.getSourceId(), game);
Card card = controller.getGraveyard().get(target.getFirstTarget(), game);
if (card != null) {
controller.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId());
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
Permanent creature = game.getPermanent(card.getId());
if (creature != null) {
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);

View file

@ -37,7 +37,6 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
@ -108,23 +107,20 @@ class SkirkDrillSergeantEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (player == null || sourceObject == null) {
if (controller == null || sourceObject == null) {
return false;
}
if (player.getLibrary().size() > 0) {
Card card = player.getLibrary().getFromTop(game);
Cards cards = new CardsImpl();
cards.add(card);
player.revealCards(sourceObject.getName(), cards, game);
if (controller.getLibrary().size() > 0) {
Card card = controller.getLibrary().getFromTop(game);
controller.revealCards(sourceObject.getIdName(), new CardsImpl(card), game);
if (card != null) {
if (filter.match(card, game)) {
player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
} else {
player.moveCards(card, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
controller.moveCards(card, Zone.GRAVEYARD, source, game);
}
}
}

View file

@ -61,11 +61,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 +93,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 = game.getPermanentEntering(source.getSourceId());
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;
}
}

View file

@ -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();

View file

@ -65,7 +65,6 @@ public class OathOfDruids extends CardImpl {
super(ownerId, 115, "Oath of Druids", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}");
this.expansionSetCode = "EXO";
// At the beginning of each player's upkeep, that player chooses target player who controls more creatures than he or she does and is his or her opponent. The first player may reveal cards from the top of his or her library until he or she reveals a creature card. If he or she does, that player puts that card onto the battlefield and all other cards revealed this way into his or her graveyard.
Ability ability = new BeginningOfUpkeepTriggeredAbility(new OathOfDruidsEffect(), TargetController.ANY, true);
ability.addTarget(new TargetPlayer(1, 1, false, filter));
@ -136,16 +135,16 @@ class OathOfDruidsEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
MageObject sourceObject = game.getObject(source.getSourceId());
Player player = game.getPlayer(source.getControllerId());
if (player == null || sourceObject == null) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null || sourceObject == null) {
return false;
}
Cards revealed = new CardsImpl();
Card creatureCard = null;
Cards nonCreatureCards = new CardsImpl();
//The first player may reveal cards from the top of his or her library
while (creatureCard == null && player.getLibrary().size() > 0) {
Card card = player.getLibrary().removeFromTop(game);
while (creatureCard == null && controller.getLibrary().size() > 0) {
Card card = controller.getLibrary().removeFromTop(game);
revealed.add(card);
// until he or she reveals a creature card.
if (card.getCardType().contains(CardType.CREATURE)) {
@ -154,14 +153,14 @@ class OathOfDruidsEffect extends OneShotEffect {
nonCreatureCards.add(card);
}
}
player.revealCards(sourceObject.getName(), revealed, game);
controller.revealCards(sourceObject.getIdName(), revealed, game);
//If he or she does, that player puts that card onto the battlefield
if (creatureCard != null) {
player.putOntoBattlefieldWithInfo(creatureCard, game, Zone.LIBRARY, source.getSourceId());
controller.moveCards(creatureCard, Zone.BATTLEFIELD, source, game);
}
// and all other cards revealed this way into his or her graveyard
player.moveCards(nonCreatureCards, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
controller.moveCards(nonCreatureCards, Zone.GRAVEYARD, source, game);
return true;
}

View file

@ -65,7 +65,7 @@ public class OathOfLieges extends CardImpl {
this.expansionSetCode = "EXO";
// At the beginning of each player's upkeep, that player chooses target player who controls more lands than he or she does and is his or her opponent. The first player may search his or her library for a basic land card, put that card onto the battlefield, then shuffle his or her library.
Effect effect = new SearchLibraryPutInPlayTargetPlayerEffect(new TargetCardInLibrary(new FilterBasicLandCard()), false, Outcome.PutLandInPlay);
Effect effect = new SearchLibraryPutInPlayTargetPlayerEffect(new TargetCardInLibrary(new FilterBasicLandCard()), false, true, Outcome.PutLandInPlay, true);
effect.setText("that player chooses target player who controls more lands than he or she does and is his or her opponent. The first player may search his or her library for a basic land card, put that card onto the battlefield, then shuffle his or her library");
Ability ability = new BeginningOfUpkeepTriggeredAbility(effect, TargetController.ANY, true);
ability.addTarget(new TargetPlayer(1, 1, false, filter));

View file

@ -61,7 +61,7 @@ public class CitadelSiege extends CardImpl {
this.expansionSetCode = "FRF";
// As Citadel Siege enters the battlefield, choose Khans or Dragons.
this.addAbility(new EntersBattlefieldAbility(new ChooseModeEffect("Khans or Dragons?","Khans", "Dragons"),null, true,
this.addAbility(new EntersBattlefieldAbility(new ChooseModeEffect("Khans or Dragons?","Khans", "Dragons"),null,
"As {this} enters the battlefield, choose Khans or Dragons.",""));
// * Khans - At the beginning of combat on your turn, put two +1/+1 counters on target creature you control.

View file

@ -53,7 +53,7 @@ public class FrontierMastodon extends CardImpl {
// <i>Ferocious</i> - Frontier Mastodon enters the battlefield with a +1/+1 counter on it if you control a creature with power 4 or greater.
this.addAbility(new EntersBattlefieldAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance(1)),
FerociousCondition.getInstance(), true,
FerociousCondition.getInstance(),
"<i>Ferocious</i> &mdash; {this} enters the battlefield with a +1/+1 counter on it if you control a creature with power 4 or greater.",""
));
}

Some files were not shown because too many files have changed in this diff Show more