1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-02 03:18:09 -09:00

* Reworked some more card movement handling ().

This commit is contained in:
LevelX2 2018-05-26 22:39:20 +02:00
parent 07973c8bc1
commit b28bf51c02
86 changed files with 534 additions and 758 deletions
Mage.Sets/src/mage/cards
Mage.Tests/src/test/java/org/mage/test/cards/mana
Mage/src/main/java/mage

View file

@ -31,7 +31,7 @@ import java.util.UUID;
import mage.abilities.Mode;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamagePlayersEffect;
import mage.abilities.effects.common.PutLandFromHandOntoBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.effects.common.continuous.CantGainLifeAllEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
@ -41,6 +41,7 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.TargetController;
import mage.filter.StaticFilters;
/**
*
@ -49,35 +50,35 @@ import mage.constants.TargetController;
public class AtarkasCommand extends CardImpl {
public AtarkasCommand(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{R}{G}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{R}{G}");
// Choose two -
// Choose two -
this.getSpellAbility().getModes().setMinModes(2);
this.getSpellAbility().getModes().setMaxModes(2);
// Your opponents can't gain life this turn;
// Your opponents can't gain life this turn;
this.getSpellAbility().addEffect(new CantGainLifeAllEffect(Duration.EndOfTurn, TargetController.OPPONENT));
// or Atarka's Command deals 3 damage to each opponent;
// or Atarka's Command deals 3 damage to each opponent;
Mode mode = new Mode();
mode.getEffects().add(new DamagePlayersEffect(3, TargetController.OPPONENT));
this.getSpellAbility().addMode(mode);
// or You may put a land card from your hand onto the battlefield;
// or You may put a land card from your hand onto the battlefield;
mode = new Mode();
mode.getEffects().add(new PutLandFromHandOntoBattlefieldEffect());
mode.getEffects().add(new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_CARD_LAND_A));
this.getSpellAbility().addMode(mode);
// or Creatures you control get +1/+1 and gain reach until the end of turn.
mode = new Mode();
Effect effect = new BoostControlledEffect(1,1, Duration.EndOfTurn);
effect.setText("Creatures you control get +1/+1");
Effect effect = new BoostControlledEffect(1, 1, Duration.EndOfTurn);
effect.setText("Creatures you control get +1/+1");
mode.getEffects().add(effect);
effect = new GainAbilityControlledEffect(ReachAbility.getInstance(), Duration.EndOfTurn);
effect.setText("and gain reach until the end of turn");
effect.setText("and gain reach until the end of turn");
mode.getEffects().add(effect);
this.getSpellAbility().addMode(mode);
}
public AtarkasCommand(final AtarkasCommand card) {

View file

@ -34,7 +34,7 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.ChooseCreatureTypeEffect;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -58,7 +58,7 @@ public class BelbesPortal extends CardImpl {
FilterCreatureCard filter = new FilterCreatureCard("a creature card of the chosen type");
filter.add(new ChosenSubtypePredicate(this.getId()));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new PutPermanentOnBattlefieldEffect(filter),
new PutCardFromHandOntoBattlefieldEffect(filter),
new ManaCostsImpl("{3}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);

View file

@ -30,7 +30,7 @@ package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -64,7 +64,7 @@ public class BraidsConjurerAdept extends CardImpl {
this.toughness = new MageInt(2);
// At the beginning of each player's upkeep, that player may put an artifact, creature, or land card from their hand onto the battlefield.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new PutPermanentOnBattlefieldEffect(filter, true), TargetController.ANY, false));
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new PutCardFromHandOntoBattlefieldEffect(filter, true), TargetController.ANY, false));
}
public BraidsConjurerAdept(final BraidsConjurerAdept card) {

View file

@ -27,12 +27,14 @@
*/
package mage.cards.b;
import java.util.List;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.DealsDamageToOneOrMoreCreaturesTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.abilities.effects.keyword.InvestigateEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -40,14 +42,11 @@ import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.watchers.common.PermanentsSacrificedWatcher;
import java.util.List;
import java.util.UUID;
/**
* @author LevelX2
*/
@ -62,7 +61,7 @@ public class BriarbridgePatrol extends CardImpl {
// Whenever Briarbridge Patrol deals damage to one or more creatures, investigate (Create a colorless Clue artifact token with "2, Sacrifice this artifact: Draw a card.").
this.addAbility(new DealsDamageToOneOrMoreCreaturesTriggeredAbility(new InvestigateEffect(), false, false, false));
// At the beginning of each end step, if you sacrificed three or more Clues this turn, you may put a creature card from your hand onto the battlefield.
this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new PutPermanentOnBattlefieldEffect(new FilterCreatureCard("a creature card")), TargetController.ANY,
this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_CARD_CREATURE_A), TargetController.ANY,
BriarbridgePatrolCondition.instance, true), new PermanentsSacrificedWatcher());
}
@ -104,4 +103,4 @@ enum BriarbridgePatrolCondition implements Condition {
return "if you sacrificed three or more Clues this turn";
}
}
}

View file

@ -30,7 +30,7 @@ package mage.cards.b;
import java.util.UUID;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.PutLandFromHandOntoBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -49,7 +49,7 @@ public class BrokenBond extends CardImpl {
// Destroy target artifact or enchantment. You may put a land card from your hand onto the battlefield.
this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT));
this.getSpellAbility().addEffect(new DestroyTargetEffect());
this.getSpellAbility().addEffect(new PutLandFromHandOntoBattlefieldEffect());
this.getSpellAbility().addEffect(new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_CARD_LAND_A));
}
public BrokenBond(final BrokenBond card) {

View file

@ -35,7 +35,6 @@ import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.FlipSourceEffect;
import mage.abilities.effects.common.PutLandFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
@ -44,10 +43,11 @@ import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.game.permanent.token.DokaiWeaverofLifeToken;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.players.Player;
import java.util.UUID;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.filter.StaticFilters;
/**
* @author Loki
@ -64,7 +64,7 @@ public class BudokaGardener extends CardImpl {
this.flipCardName = "Dokai, Weaver of Life";
// {T}: You may put a land card from your hand onto the battlefield. If you control ten or more lands, flip Budoka Gardener.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutLandFromHandOntoBattlefieldEffect(), new TapSourceCost());
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_BASIC_LAND_CARD_A), new TapSourceCost());
ability.addEffect(new BudokaGardenerEffect());
this.addAbility(ability);
}
@ -128,6 +128,7 @@ class DokaiWeaverofLife extends TokenImpl {
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}
public DokaiWeaverofLife(final DokaiWeaverofLife token) {
super(token);
}

View file

@ -29,11 +29,12 @@ package mage.cards.b;
import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.PutLandFromHandOntoBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
@ -45,7 +46,7 @@ import mage.game.permanent.Permanent;
public class Burgeoning extends CardImpl {
public Burgeoning(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{G}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{G}");
// Whenever an opponent plays a land, you may put a land card from your hand onto the battlefield.
this.addAbility(new BurgeoningTriggeredAbility());
@ -61,10 +62,10 @@ public class Burgeoning extends CardImpl {
}
}
class BurgeoningTriggeredAbility extends TriggeredAbilityImpl {
BurgeoningTriggeredAbility() {
super(Zone.BATTLEFIELD, new PutLandFromHandOntoBattlefieldEffect());
super(Zone.BATTLEFIELD, new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_CARD_LAND_A));
}
BurgeoningTriggeredAbility(BurgeoningTriggeredAbility ability) {

View file

@ -30,13 +30,13 @@ package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BecomesExertSourceTriggeredAbility;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.abilities.keyword.ExertAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.common.FilterCreatureCard;
import mage.filter.StaticFilters;
/**
*
@ -53,7 +53,7 @@ public class ChampionOfRhonas extends CardImpl {
this.toughness = new MageInt(3);
// You may exert Champion of Rhonas as it attacks. When you do, you may put a creature card from your hand onto the battlefield.
BecomesExertSourceTriggeredAbility ability = new BecomesExertSourceTriggeredAbility(new PutPermanentOnBattlefieldEffect(new FilterCreatureCard("a creature card")));
BecomesExertSourceTriggeredAbility ability = new BecomesExertSourceTriggeredAbility(new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_CARD_CREATURE_A));
this.addAbility(new ExertAbility(ability));
}

View file

@ -33,7 +33,7 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -54,7 +54,7 @@ public class CopperGnomes extends CardImpl {
this.toughness = new MageInt(1);
// {4}, Sacrifice Copper Gnomes: You may put an artifact card from your hand onto the battlefield.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutPermanentOnBattlefieldEffect(new FilterArtifactCard()), new ManaCostsImpl("{4}"));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutCardFromHandOntoBattlefieldEffect(new FilterArtifactCard()), new ManaCostsImpl("{4}"));
ability.addCost(new SacrificeSourceCost());
this.addAbility(ability);
}

View file

@ -33,7 +33,7 @@ import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.abilities.keyword.ChangelingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -223,7 +223,7 @@ class CrypticGatewayEffect extends OneShotEffect {
}
if (commonSubType) {
PutPermanentOnBattlefieldEffect putIntoPlay = new PutPermanentOnBattlefieldEffect(filter);
PutCardFromHandOntoBattlefieldEffect putIntoPlay = new PutCardFromHandOntoBattlefieldEffect(filter);
putIntoPlay.apply(game, source);
}
}

View file

@ -27,6 +27,7 @@
*/
package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
@ -42,8 +43,6 @@ import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
* @author nantuko
*/
@ -75,7 +74,7 @@ public class DearlyDeparted extends CardImpl {
class DearlyDepartedEntersBattlefieldEffect extends ReplacementEffectImpl {
public DearlyDepartedEntersBattlefieldEffect() {
super(Duration.OneUse, Outcome.BoostCreature);
super(Duration.WhileInGraveyard, Outcome.BoostCreature);
staticText = "As long as {this} is in your graveyard, each Human creature you control enters the battlefield with an additional +1/+1 counter on it";
}

View file

@ -35,7 +35,7 @@ import mage.abilities.keyword.FlyingAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.abilities.keyword.MorphAbility;
import mage.cards.CardImpl;
@ -103,7 +103,7 @@ class DermoplasmEffect extends OneShotEffect {
Permanent thisCreature = game.getPermanent(source.getId());
FilterCreatureCard filter = new FilterCreatureCard("a creature card with a morph ability");
filter.add(new AbilityPredicate(MorphAbility.class));
Effect effect = new PutPermanentOnBattlefieldEffect(new FilterCreatureCard(filter));
Effect effect = new PutCardFromHandOntoBattlefieldEffect(new FilterCreatureCard(filter));
if (effect.apply(game, source)) {
if (thisCreature != null) {
effect = new ReturnToHandTargetEffect();

View file

@ -30,7 +30,7 @@ package mage.cards.d;
import java.util.UUID;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -55,7 +55,7 @@ public class Didgeridoo extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}");
// {3}: You may put a Minotaur permanent card from your hand onto the battlefield.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutPermanentOnBattlefieldEffect(filter), new ManaCostsImpl("{3}")));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutCardFromHandOntoBattlefieldEffect(filter), new ManaCostsImpl("{3}")));
}
public Didgeridoo(final Didgeridoo card) {

View file

@ -32,7 +32,7 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -57,7 +57,7 @@ public class DragonArch extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{5}");
// {2}, {T}: You may put a multicolored creature card from your hand onto the battlefield.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutPermanentOnBattlefieldEffect(filter),
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutCardFromHandOntoBattlefieldEffect(filter),
new ManaCostsImpl("{2}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);

View file

@ -29,7 +29,7 @@ package mage.cards.d;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -52,7 +52,7 @@ public class DramaticEntrance extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{G}{G}");
// You may put a green creature card from your hand onto the battlefield.
this.getSpellAbility().addEffect(new PutPermanentOnBattlefieldEffect(filter));
this.getSpellAbility().addEffect(new PutCardFromHandOntoBattlefieldEffect(filter));
}

View file

@ -30,12 +30,12 @@ package mage.cards.e;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.PutLandFromHandOntoBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.common.FilterLandCard;
import mage.filter.StaticFilters;
/**
*
@ -44,7 +44,7 @@ import mage.filter.common.FilterLandCard;
public class ElvishPioneer extends CardImpl {
public ElvishPioneer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}");
this.subtype.add(SubType.ELF);
this.subtype.add(SubType.DRUID);
@ -52,7 +52,7 @@ public class ElvishPioneer extends CardImpl {
this.toughness = new MageInt(1);
// When Elvish Pioneer enters the battlefield, you may put a basic land card from your hand onto the battlefield tapped.
this.addAbility(new EntersBattlefieldTriggeredAbility(new PutLandFromHandOntoBattlefieldEffect(true, FilterLandCard.basicLandCard()), false));
this.addAbility(new EntersBattlefieldTriggeredAbility(new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_BASIC_LAND_CARD_A, false, true), false));
}
public ElvishPioneer(final ElvishPioneer card) {

View file

@ -27,19 +27,18 @@
*/
package mage.cards.e;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.filter.StaticFilters;
/**
*
@ -48,7 +47,7 @@ import mage.filter.common.FilterCreatureCard;
public class ElvishPiper extends CardImpl {
public ElvishPiper(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{G}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}");
this.subtype.add(SubType.ELF);
this.subtype.add(SubType.SHAMAN);
@ -57,7 +56,7 @@ public class ElvishPiper extends CardImpl {
// {G}, {tap}: You may put a creature card from your hand onto the battlefield.
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new PutPermanentOnBattlefieldEffect(new FilterCreatureCard("a creature card")),
new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_CARD_CREATURE_A),
new ManaCostsImpl("{G}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);

View file

@ -33,22 +33,13 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
import mage.filter.StaticFilters;
/**
*
@ -63,8 +54,9 @@ public class FirebrandRanger extends CardImpl {
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// {G}, {tap}: You may put a basic land card from your hand onto the battlefield.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutLandOnBattlefieldEffect(), new ManaCostsImpl("{G}"));
// {G}, {T}: You may put a basic land card from your hand onto the battlefield.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_BASIC_LAND_CARD_A), new ManaCostsImpl("{G}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}
@ -78,46 +70,3 @@ public class FirebrandRanger extends CardImpl {
return new FirebrandRanger(this);
}
}
class PutLandOnBattlefieldEffect extends OneShotEffect {
private static final FilterCard filter = new FilterCard("basic land card");
static {
filter.add(Predicates.and(new CardTypePredicate(CardType.LAND), new SupertypePredicate(SuperType.BASIC)));
}
private static final String choiceText = "Put a basic land card from your hand onto the battlefield?";
public PutLandOnBattlefieldEffect() {
super(Outcome.PutLandInPlay);
this.staticText = "you may put a basic land card from your hand onto the battlefield";
}
public PutLandOnBattlefieldEffect(final PutLandOnBattlefieldEffect effect) {
super(effect);
}
@Override
public PutLandOnBattlefieldEffect copy() {
return new PutLandOnBattlefieldEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null || !player.chooseUse(Outcome.PutLandInPlay, choiceText, source, game)) {
return false;
}
TargetCardInHand target = new TargetCardInHand(filter);
if (player.choose(Outcome.PutLandInPlay, target, source.getSourceId(), game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
card.putOntoBattlefield(game, Zone.HAND, source.getSourceId(), source.getControllerId());
return true;
}
}
return false;
}
}

View file

@ -27,6 +27,8 @@
*/
package mage.cards.f;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -50,8 +52,8 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.ExileZone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.players.Player;
import mage.target.Target;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
@ -63,7 +65,7 @@ import mage.target.common.TargetCreaturePermanent;
public class Flickerform extends CardImpl {
public Flickerform(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{W}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
this.subtype.add(SubType.AURA);
// Enchant creature
@ -128,7 +130,7 @@ class FlickerformEffect extends OneShotEffect {
}
}
if (!(enchantedCreature instanceof Token)) {
// At the beginning of the next end step, return that card to the battlefield under its owner's control.
// At the beginning of the next end step, return that card to the battlefield under its owner's control.
// If you do, return the other cards exiled this way to the battlefield under their owners' control attached to that creature
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
new FlickerformReturnEffect(enchantedCreature.getId(), exileZoneId));
@ -174,12 +176,17 @@ class FlickerformReturnEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
ExileZone exileZone = game.getExile().getExileZone(exileZoneId);
Card enchantedCard = exileZone.get(enchantedCardId, game);
if (enchantedCard != null) {
enchantedCard.putOntoBattlefield(game, Zone.EXILED, source.getSourceId(), enchantedCard.getOwnerId());
controller.moveCards(enchantedCard, Zone.BATTLEFIELD, source, game);
Permanent newPermanent = game.getPermanent(enchantedCardId);
if (newPermanent != null) {
Set<Card> toBattlefieldAttached = new HashSet<Card>();
for (Card enchantment : exileZone.getCards(game)) {
if (filterAura.match(enchantment, game)) {
boolean canTarget = false;
@ -196,9 +203,13 @@ class FlickerformReturnEffect extends OneShotEffect {
}
game.getState().setValue("attachTo:" + enchantment.getId(), newPermanent);
}
if (enchantment.putOntoBattlefield(game, Zone.EXILED, source.getSourceId(), enchantment.getOwnerId())) {
if (filterAura.match(enchantment, game)) {
newPermanent.addAttachment(enchantment.getId(), game);
toBattlefieldAttached.add(enchantment);
}
if (!toBattlefieldAttached.isEmpty()) {
controller.moveCards(toBattlefieldAttached, Zone.BATTLEFIELD, source, game);
for (Card card : toBattlefieldAttached) {
if (game.getState().getZone(card.getId()).equals(Zone.BATTLEFIELD)) {
newPermanent.addAttachment(card.getId(), game);
}
}
}

View file

@ -29,24 +29,17 @@ package mage.cards.g;
import java.util.UUID;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.abilities.mana.SimpleManaAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
/**
*
@ -55,10 +48,14 @@ import mage.target.common.TargetCardInHand;
public class GaeasTouch extends CardImpl {
public GaeasTouch(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{G}{G}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{G}{G}");
// You may put a basic Forest card from your hand onto the battlefield. Activate this ability only any time you could cast a sorcery and only once each turn.
LimitedTimesPerTurnActivatedAbility ability = new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new PutBasicForestOnBattlefieldEffect(), new GenericManaCost(0), 1);
FilterCard filter = new FilterCard("basic Forest card");
filter.add(new SupertypePredicate(SuperType.BASIC));
filter.add(new SubtypePredicate(SubType.FOREST));
LimitedTimesPerTurnActivatedAbility ability = new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD,
new PutCardFromHandOntoBattlefieldEffect(filter), new GenericManaCost(0), 1);
ability.setTiming(TimingRule.SORCERY);
addAbility(ability);
@ -75,47 +72,3 @@ public class GaeasTouch extends CardImpl {
return new GaeasTouch(this);
}
}
class PutBasicForestOnBattlefieldEffect extends OneShotEffect {
private static final FilterCard filter = new FilterCard("basic Forest card");
static {
filter.add(Predicates.and(new CardTypePredicate(CardType.LAND), new SupertypePredicate(SuperType.BASIC)));
filter.add(new SubtypePredicate(SubType.FOREST));
}
private static final String choiceText = "Put a basic Forest card from your hand onto the battlefield?";
public PutBasicForestOnBattlefieldEffect() {
super(Outcome.PutLandInPlay);
this.staticText = "put a basic Forest card from your hand onto the battlefield";
}
public PutBasicForestOnBattlefieldEffect(final PutBasicForestOnBattlefieldEffect effect) {
super(effect);
}
@Override
public PutBasicForestOnBattlefieldEffect copy() {
return new PutBasicForestOnBattlefieldEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null || !player.chooseUse(Outcome.PutLandInPlay, choiceText, source, game)) {
return false;
}
TargetCardInHand target = new TargetCardInHand(filter);
if (player.choose(Outcome.PutLandInPlay, target, source.getSourceId(), game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
card.putOntoBattlefield(game, Zone.HAND, source.getSourceId(), source.getControllerId());
return true;
}
}
return false;
}
}

View file

@ -32,7 +32,7 @@ import mage.ObjectColor;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.effects.common.GetEmblemEffect;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.abilities.effects.common.RevealLibraryPutIntoHandEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -67,7 +67,7 @@ public class GarrukCallerOfBeasts extends CardImpl {
this.addAbility(new LoyaltyAbility(new RevealLibraryPutIntoHandEffect(5, new FilterCreatureCard("creature cards"), Zone.LIBRARY), 1));
// -3: You may put a green creature card from your hand onto the battlefield.
this.addAbility(new LoyaltyAbility(new PutPermanentOnBattlefieldEffect(filterGreenCreature), -3));
this.addAbility(new LoyaltyAbility(new PutCardFromHandOntoBattlefieldEffect(filterGreenCreature), -3));
// -7: You get an emblem with "Whenever you cast a creature spell, you may search your library for a creature card, put it onto the battlefield, then shuffle your library.");
this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new GarrukCallerOfBeastsEmblem()), -7));

View file

@ -37,7 +37,10 @@ import mage.abilities.costs.Cost;
import mage.abilities.costs.common.ExileFromHandCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.decorator.ConditionalManaEffect;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.EntersBattlefieldEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.effects.mana.AddManaOfAnyColorEffect;
import mage.abilities.effects.mana.BasicManaEffect;
import mage.abilities.mana.ConditionalManaAbility;
@ -45,6 +48,7 @@ import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SuperType;
import mage.constants.Zone;
@ -143,14 +147,16 @@ class GemstoneCavernsEffect 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) {
Card card = game.getCard(source.getSourceId());
if (card != null) {
if (card.putOntoBattlefield(game, Zone.HAND, source.getSourceId(), source.getControllerId())) {
ContinuousEffect effect = new EntersBattlefieldEffect(new AddCountersSourceEffect(CounterType.LUCK.createInstance()), "");
effect.setDuration(Duration.OneUse);
game.addEffect(effect, source);
if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) {
permanent.addCounters(CounterType.LUCK.createInstance(), source, game);
Cost cost = new ExileFromHandCost(new TargetCardInHand());
if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game)) {
cost.pay(source, game, source.getSourceId(), source.getControllerId(), true, null);

View file

@ -39,8 +39,8 @@ import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -142,7 +142,7 @@ class GiftOfImmortalityReturnEnchantmentEffect extends OneShotEffect {
Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source));
if (controller != null && creature != null) {
game.getState().setValue("attachTo:" + aura.getId(), creature);
aura.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), controller.getId());
controller.moveCards(aura, Zone.BATTLEFIELD, source, game);
return creature.addAttachment(aura.getId(), game);
}
}

View file

@ -30,7 +30,7 @@ package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.DealsDamageToAPlayerTriggeredAbility;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -58,7 +58,7 @@ public class GoblinLackey extends CardImpl {
this.toughness = new MageInt(1);
// Whenever Goblin Lackey deals damage to a player, you may put a Goblin permanent card from your hand onto the battlefield.
this.addAbility(new DealsDamageToAPlayerTriggeredAbility(new PutPermanentOnBattlefieldEffect(filter), false));
this.addAbility(new DealsDamageToAPlayerTriggeredAbility(new PutCardFromHandOntoBattlefieldEffect(filter), false));
}
public GoblinLackey(final GoblinLackey card) {

View file

@ -34,7 +34,7 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.ProtectionAbility;
import mage.cards.CardImpl;
@ -72,7 +72,7 @@ public class GoblinWizard extends CardImpl {
// {tap}: You may put a Goblin permanent card from your hand onto the battlefield.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD,
new PutPermanentOnBattlefieldEffect(filter),
new PutCardFromHandOntoBattlefieldEffect(filter),
new TapSourceCost()));
// {R}: Target Goblin gains protection from white until end of turn.

View file

@ -28,6 +28,7 @@
package mage.cards.g;
import java.util.UUID;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
@ -42,9 +43,9 @@ import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -53,12 +54,12 @@ import mage.target.common.TargetCreaturePermanent;
public class GracefulReprieve extends CardImpl {
public GracefulReprieve(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{W}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W}");
// When target creature dies this turn, return that card to the battlefield under its owner's control.
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addEffect(new GracefulReprieveEffect());
}
public GracefulReprieve(final GracefulReprieve card) {
@ -89,7 +90,7 @@ class GracefulReprieveEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
DelayedTriggeredAbility delayedAbility = new GracefulReprieveDelayedTriggeredAbility(targetPointer.getFirst(game, source));
DelayedTriggeredAbility delayedAbility = new GracefulReprieveDelayedTriggeredAbility(new MageObjectReference(targetPointer.getFirst(game, source), game));
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
@ -97,10 +98,10 @@ class GracefulReprieveEffect extends OneShotEffect {
class GracefulReprieveDelayedTriggeredAbility extends DelayedTriggeredAbility {
private UUID target;
private MageObjectReference target;
public GracefulReprieveDelayedTriggeredAbility(UUID target) {
super(new GracefulReprieveDelayedEffect(target), Duration.EndOfTurn);
public GracefulReprieveDelayedTriggeredAbility(MageObjectReference target) {
super(new GracefulReprieveDelayedEffect(), Duration.EndOfTurn);
this.target = target;
}
@ -116,9 +117,10 @@ class GracefulReprieveDelayedTriggeredAbility extends DelayedTriggeredAbility {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getTargetId().equals(target)) {
if (target.refersTo(((ZoneChangeEvent) event).getTarget(), game)) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) {
getEffects().setTargetPointer(new FixedTarget(target.getSourceId()));
return true;
}
}
@ -138,17 +140,13 @@ class GracefulReprieveDelayedTriggeredAbility extends DelayedTriggeredAbility {
class GracefulReprieveDelayedEffect extends OneShotEffect {
private final UUID target;
public GracefulReprieveDelayedEffect(UUID target) {
public GracefulReprieveDelayedEffect() {
super(Outcome.PutCreatureInPlay);
this.target = target;
this.staticText = "return that card to the battlefield under its owner's control";
}
public GracefulReprieveDelayedEffect(final GracefulReprieveDelayedEffect effect) {
super(effect);
this.target = effect.target;
}
@Override
@ -159,17 +157,12 @@ class GracefulReprieveDelayedEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = (Permanent) game.getLastKnownInformation(target, Zone.BATTLEFIELD);
if (controller != null
&& permanent != null) {
Player player = game.getPlayer(permanent.getOwnerId());
if (player != null) {
Card card = game.getCard(target);
if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
return card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), player.getId());
}
return true;
if (controller != null) {
Card card = game.getCard(getTargetPointer().getFirst(game, source));
if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game, false, false, true, null);
}
return true;
}
return false;
}

View file

@ -43,6 +43,8 @@ import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInGraveyard;
import mage.target.targetpointer.FixedTarget;
@ -55,7 +57,6 @@ public class GraveUpheaval extends CardImpl {
public GraveUpheaval(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{B}{R}");
// Put target creature card from a graveyard onto the battlefield under your control. It gains haste.
this.getSpellAbility().addEffect(new GraveUpheavalEffect());
this.getSpellAbility().addTarget(new TargetCardInGraveyard());
@ -92,12 +93,19 @@ class GraveUpheavalEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Card card = game.getCard(source.getFirstTarget());
if (card != null) {
card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId());
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
effect.setTargetPointer(new FixedTarget(card.getId()));
game.addEffect(effect, source);
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) {
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
}
return true;
}

View file

@ -48,6 +48,8 @@ import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInOpponentsGraveyard;
import mage.target.targetpointer.FixedTarget;
@ -60,7 +62,7 @@ public class GruesomeEncore extends CardImpl {
private static final FilterCreatureCard filter = new FilterCreatureCard("creature card from an opponent's graveyard");
public GruesomeEncore(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{B}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{B}");
// Put target creature card from an opponent's graveyard onto the battlefield under your control. It gains haste.
this.getSpellAbility().addEffect(new GruesomeEncoreEffect());
@ -97,19 +99,23 @@ class GruesomeEncoreEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(source.getFirstTarget());
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Card card = game.getCard(getTargetPointer().getFirst(game, source));
if (card != null) {
card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId());
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
effect.setTargetPointer(new FixedTarget(card.getId()));
game.addEffect(effect, source);
ExileTargetEffect exileEffect = new ExileTargetEffect();
exileEffect.setTargetPointer(new FixedTarget(card.getId()));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
game.addDelayedTriggeredAbility(delayedAbility, source);
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) {
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
ExileTargetEffect exileEffect = new ExileTargetEffect();
exileEffect.setTargetPointer(new FixedTarget(permanent, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
game.addDelayedTriggeredAbility(delayedAbility, source);
}
return true;
}

View file

@ -45,6 +45,7 @@ import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
@ -55,7 +56,7 @@ import mage.target.common.TargetCreaturePermanent;
public class GryffsBoon extends CardImpl {
public GryffsBoon(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{W}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{W}");
this.subtype.add(SubType.AURA);
// Enchant creature
@ -102,12 +103,13 @@ class GryffsBoonEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Card aura = game.getCard(source.getSourceId());
if (aura != null
Player controller = game.getPlayer(source.getControllerId());
if (aura != null && controller != null
&& game.getState().getZone(aura.getId()) == Zone.GRAVEYARD) {
Permanent targetPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (!targetPermanent.cantBeAttachedBy(aura, game)) {
game.getState().setValue("attachTo:" + aura.getId(), targetPermanent);
aura.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId());
controller.moveCards(aura, Zone.BATTLEFIELD, source, game);
return targetPermanent.addAttachment(aura.getId(), game);
}
}

View file

@ -27,6 +27,7 @@
*/
package mage.cards.g;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
@ -43,8 +44,6 @@ import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetOpponent;
import java.util.UUID;
/**
*
* @author LevelX2
@ -52,7 +51,7 @@ import java.util.UUID;
public class GuildFeud extends CardImpl {
public GuildFeud(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{5}{R}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{5}{R}");
// At the beginning of your upkeep, target opponent reveals the top three cards
// of their library, may put a creature card from among them onto the battlefield,
@ -95,9 +94,8 @@ class GuildFeudEffect extends OneShotEffect {
if (opponent != null && controller != null && sourceObject != null) {
for (int activePlayer = 0; activePlayer < 2; activePlayer++) {
Player player = (activePlayer == 0 ? opponent : controller);
Cards topThreeCards = new CardsImpl();
topThreeCards.addAll(player.getLibrary().getTopCards(game, 3));
player.revealCards(sourceObject.getIdName() + " - " + player.getName() + " top library cards", topThreeCards, game);
Cards topThreeCards = new CardsImpl(player.getLibrary().getTopCards(game, 3));
player.revealCards(source, player.getName() + " top library cards", topThreeCards, game);
Card creatureToBattlefield;
if (!topThreeCards.isEmpty()) {
if (player.chooseUse(Outcome.PutCreatureInPlay, "Put a creature card among them to the battlefield?", source, game)) {
@ -108,9 +106,7 @@ class GuildFeudEffect extends OneShotEffect {
creatureToBattlefield = topThreeCards.get(target.getFirstTarget(), game);
if (creatureToBattlefield != null) {
topThreeCards.remove(creatureToBattlefield);
if (creatureToBattlefield.putOntoBattlefield(game, Zone.LIBRARY,
source.getSourceId(), player.getId())) {
game.informPlayers("Guild Feud: " + player.getLogName() + " put " + creatureToBattlefield.getName() + " to the battlefield");
if (player.moveCards(creatureToBattlefield, Zone.BATTLEFIELD, source, game)) {
if (activePlayer == 0) {
opponentCreature = game.getPermanent(creatureToBattlefield.getId());
} else {

View file

@ -31,18 +31,18 @@ import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -51,7 +51,7 @@ import mage.target.common.TargetCardInHand;
public class HuntedWumpus extends CardImpl {
public HuntedWumpus(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{G}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}");
this.subtype.add(SubType.BEAST);
this.power = new MageInt(6);
@ -92,20 +92,11 @@ class HuntedWumpusEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
for(UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
if (!playerId.equals(controller.getId())) {
Player player = game.getPlayer(playerId);
if (player != null) {
TargetCardInHand target = new TargetCardInHand(new FilterCreatureCard());
if (target.canChoose(source.getSourceId(), playerId, game)
&& player.chooseUse(Outcome.Neutral, "Put a creature card from your hand onto the battlefield?", source, game)
&& player.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
card.putOntoBattlefield(game, Zone.HAND, source.getSourceId(), player.getId());
}
}
}
Effect effect = new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_CARD_CREATURE_A, true);
effect.setTargetPointer(new FixedTarget(playerId));
effect.apply(game, source);
}
}
return true;

View file

@ -33,7 +33,7 @@ import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SpellCastOpponentTriggeredAbility;
import mage.abilities.condition.common.CardsInControllerGraveCondition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -53,7 +53,7 @@ public class HuntingGrounds extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{G}{W}");
// Threshold - As long as seven or more cards are in your graveyard, Hunting Grounds has "Whenever an opponent casts a spell, you may put a creature card from your hand onto the battlefield."
Ability gainedAbility = new SpellCastOpponentTriggeredAbility(new PutPermanentOnBattlefieldEffect(
Ability gainedAbility = new SpellCastOpponentTriggeredAbility(new PutCardFromHandOntoBattlefieldEffect(
new FilterCreatureCard("a creature card")), true);
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(
new GainAbilitySourceEffect(gainedAbility, Duration.WhileOnBattlefield), new CardsInControllerGraveCondition(7),

View file

@ -30,9 +30,9 @@ package mage.cards.i;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
@ -101,13 +101,7 @@ class IncomingEffect extends OneShotEffect {
if (player != null) {
TargetCardInLibrary target = new TargetCardInLibrary(0, Integer.MAX_VALUE, filter);
if (player.searchLibrary(target, game)) {
for (UUID cardId : target.getTargets()) {
Card card = player.getLibrary().getCard(cardId, game);
if (card != null) {
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), player.getId(), true);
}
}
player.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, source, game);
player.shuffleLibrary(source, game);
}
}

View file

@ -34,13 +34,11 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterLandCard;
import mage.game.Game;
import mage.players.Player;
@ -51,10 +49,9 @@ import mage.players.Player;
public class IntoTheWilds extends CardImpl {
public IntoTheWilds(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{G}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}");
// At the beginning of your upkeep, look at the top card of your library. If it's a land card, you may put it onto the battlefield.
// At the beginning of your upkeep, look at the top card of your library. If it's a land card, you may put it onto the battlefield.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new IntoTheWildsEffect(), TargetController.YOU, false));
}
@ -71,8 +68,6 @@ public class IntoTheWilds extends CardImpl {
class IntoTheWildsEffect extends OneShotEffect {
private final static FilterLandCard filter = new FilterLandCard();
public IntoTheWildsEffect() {
super(Outcome.PutLandInPlay);
this.staticText = "look at the top card of your library. If it's a land card, you may put it onto the battlefield";
@ -89,20 +84,18 @@ class IntoTheWildsEffect 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;
}
Card card = player.getLibrary().getFromTop(game);
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
Cards cards = new CardsImpl();
cards.add(card);
player.lookAtCards("Into the Wilds", cards, game);
if (filter.match(card, game)) {
controller.lookAtCards(source, "", new CardsImpl(card), game);
if (card.isLand()) {
String message = "Put " + card.getName() + " onto the battlefield?";
if (player.chooseUse(outcome, message, source, game)) {
return card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId(), false);
if (controller.chooseUse(outcome, message, source, game)) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
}

View file

@ -31,12 +31,13 @@ import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.effects.common.PutLandFromHandOntoBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
/**
*
@ -45,14 +46,15 @@ import mage.constants.Zone;
public class KrosanWayfarer extends CardImpl {
public KrosanWayfarer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.DRUID);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Sacrifice Krosan Wayfarer: You may put a land card from your hand onto the battlefield.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutLandFromHandOntoBattlefieldEffect(), new SacrificeSourceCost()));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD,
new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_BASIC_LAND_CARD_A), new SacrificeSourceCost()));
}
public KrosanWayfarer(final KrosanWayfarer card) {

View file

@ -37,10 +37,9 @@ import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -120,22 +119,18 @@ class KudzuEffect extends OneShotEffect {
Permanent landChosen = game.getPermanent(target.getFirstTarget());
if (landChosen != null) {
for (Target targetTest : kudzuCard.getSpellAbility().getTargets()) {
Filter filterTest = targetTest.getFilter();
if (filterTest.match(landChosen, game)) {
if (game.getBattlefield().containsPermanent(landChosen.getId())) { //verify that it is still on the battlefield
game.getState().setValue("attachTo:" + kudzuCard.getId(), landChosen);
Zone zone = game.getState().getZone(kudzuCard.getId());
kudzuCard.putOntoBattlefield(game, zone, source.getSourceId(), controller.getId());
return landChosen.addAttachment(kudzuCard.getId(), game);
}
if (targetTest.getFilter().match(landChosen, game)) {
landChosen.addAttachment(kudzu.getId(), game);
}
}
}
}
}
}
}
}
return true;
}
return false;
}

View file

@ -34,7 +34,6 @@ import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -43,7 +42,7 @@ import mage.constants.Outcome;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.common.FilterCreatureCard;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.CounterPredicate;
import mage.game.Game;
@ -111,11 +110,9 @@ class LilianaDeathWielderEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null){
for (Card card : player.getGraveyard().getCards(new FilterCreatureCard(), game)) {
card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId());
}
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.moveCards(controller.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game), Zone.BATTLEFIELD, source, game);
}
return true;
}

View file

@ -31,12 +31,13 @@ import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.PutLandFromHandOntoBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
/**
*
@ -53,7 +54,8 @@ public class LlanowarScout extends CardImpl {
this.toughness = new MageInt(3);
// {T}: You may put a land card from your hand onto the battlefield.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutLandFromHandOntoBattlefieldEffect(), new TapSourceCost()));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD,
new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_BASIC_LAND_CARD_A), new TapSourceCost()));
}
public LlanowarScout(final LlanowarScout card) {

View file

@ -30,7 +30,7 @@ package mage.cards.l;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.common.PutLandFromHandOntoBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -44,14 +44,16 @@ import mage.filter.StaticFilters;
public class LoamDweller extends CardImpl {
public LoamDweller(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{G}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}");
this.subtype.add(SubType.SPIRIT);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Whenever you cast a Spirit or Arcane spell, you may put a land card from your hand onto the battlefield tapped.
this.addAbility(new SpellCastControllerTriggeredAbility(new PutLandFromHandOntoBattlefieldEffect(true), StaticFilters.SPIRIT_OR_ARCANE_CARD, true));
this.addAbility(new SpellCastControllerTriggeredAbility(
new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_CARD_LAND_A, false, true),
StaticFilters.SPIRIT_OR_ARCANE_CARD, true));
}
public LoamDweller(final LoamDweller card) {

View file

@ -32,6 +32,7 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.TransformAbility;
import mage.abilities.keyword.VigilanceAbility;
@ -40,11 +41,12 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.u.UnhallowedCathar;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -53,7 +55,7 @@ import mage.game.permanent.Permanent;
public class LoyalCathar extends CardImpl {
public LoyalCathar(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{W}{W}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{W}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.SOLDIER);
@ -96,8 +98,11 @@ class LoyalCatharEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
//create delayed triggered ability
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnLoyalCatharEffect(source.getSourceId()));
game.addDelayedTriggeredAbility(delayedAbility, source);
if (Zone.GRAVEYARD == game.getState().getZone(source.getSourceId())) {
Effect effect = new ReturnLoyalCatharEffect();
effect.setTargetPointer(new FixedTarget(source.getSourceId(), game.getState().getZoneChangeCounter(source.getSourceId())));
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect), source);
}
return true;
}
@ -110,17 +115,13 @@ class LoyalCatharEffect extends OneShotEffect {
class ReturnLoyalCatharEffect extends OneShotEffect {
private UUID cardId;
public ReturnLoyalCatharEffect(UUID cardId) {
public ReturnLoyalCatharEffect() {
super(Outcome.PutCardInPlay);
this.cardId = cardId;
this.staticText = "return it to the battlefield transformed under your control";
}
public ReturnLoyalCatharEffect(final ReturnLoyalCatharEffect effect) {
super(effect);
this.cardId = effect.cardId;
}
@Override
@ -130,16 +131,16 @@ class ReturnLoyalCatharEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(cardId);
if (card != null) {
card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId());
Permanent perm = game.getPermanent(cardId);
if (perm != null && perm.isTransformable()) {
perm.transform(game);
return true;
}
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
return false;
Card card = game.getCard(getTargetPointer().getFirst(game, source));
if (card != null) {
game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId(), Boolean.TRUE);
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
return true;
}
}

View file

@ -34,7 +34,7 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.ReturnToHandChosenControlledPermanentCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -59,7 +59,7 @@ public class MasterTransmuter extends CardImpl {
this.toughness = new MageInt(2);
// {U}, {tap}, Return an artifact you control to its owner's hand: You may put an artifact card from your hand onto the battlefield.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutPermanentOnBattlefieldEffect(new FilterArtifactCard("an artifact card")), new ManaCostsImpl("{U}"));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutCardFromHandOntoBattlefieldEffect(new FilterArtifactCard("an artifact card")), new ManaCostsImpl("{U}"));
ability.addCost(new TapSourceCost());
ability.addCost(new ReturnToHandChosenControlledPermanentCost(new TargetControlledPermanent(new FilterControlledArtifactPermanent("an artifact"))));
this.addAbility(ability);

View file

@ -29,7 +29,6 @@ package mage.cards.m;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
@ -38,9 +37,9 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.ComparisonType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterPermanentCard;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
@ -54,7 +53,7 @@ import mage.players.Player;
public class MatterReshaper extends CardImpl {
public MatterReshaper(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{C}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{C}");
this.subtype.add(SubType.ELDRAZI);
this.power = new MageInt(3);
this.toughness = new MageInt(2);
@ -89,22 +88,20 @@ class MatterReshaperEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null && controller.getLibrary().hasCards()) {
if (controller != null) {
Card card = controller.getLibrary().getFromTop(game);
if (card == null) {
return false;
}
controller.revealCards(sourceObject.getIdName(), new CardsImpl(card), game);
FilterPermanentCard filter = new FilterPermanentCard("permanent card with converted mana cost 3 or less");
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, 4));
if (filter.match(card, game)) {
if (controller.chooseUse(Outcome.PutCardInPlay, "Put " + card.getName() + " onto the battlefield (otherwise put in hand)?", source, game)) {
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId(), false);
return true;
controller.revealCards(source, new CardsImpl(card), game);
FilterPermanentCard filter = new FilterPermanentCard("permanent card with converted mana cost 3 or less");
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, 4));
if (filter.match(card, game)) {
if (controller.chooseUse(Outcome.PutCardInPlay, "Put " + card.getName() + " onto the battlefield (otherwise put in hand)?", source, game)) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
return true;
}
}
controller.moveCards(card, Zone.HAND, source, game);
}
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
return true;
}
return false;

View file

@ -33,7 +33,7 @@ import mage.ObjectColor;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -81,7 +81,7 @@ public class MindwrackLiege extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter2, true)));
// {UR}{UR}{UR}{UR}: You may put a blue or red creature card from your hand onto the battlefield.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutPermanentOnBattlefieldEffect(filter3), new ManaCostsImpl("{U/R}{U/R}{U/R}{U/R}")));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutCardFromHandOntoBattlefieldEffect(filter3), new ManaCostsImpl("{U/R}{U/R}{U/R}{U/R}")));
}
public MindwrackLiege(final MindwrackLiege card) {

View file

@ -27,7 +27,6 @@
*/
package mage.cards.m;
import java.util.Set;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
@ -39,14 +38,15 @@ import mage.abilities.keyword.TrampleAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.util.RandomUtil;
/**
*
@ -98,34 +98,21 @@ class MoldgrafMonstrosityEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
boolean returned = false;
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Set<Card> cards = player.getGraveyard().getCards(new FilterCreatureCard("creature cards"), game);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Cards possibleCards = new CardsImpl(controller.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game));
// Set<Card> cards = controller.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game);
Cards toBattlefield = new CardsImpl();
for (int i = 0; i < 2; i++) {
Card card = getRandomCard(cards);
Card card = possibleCards.getRandom(game);
if (card != null) {
returned |= card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId());
cards.remove(card);
toBattlefield.add(card);
possibleCards.remove(card);
}
}
controller.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game);
return true;
}
return returned;
}
private Card getRandomCard(Set<Card> cards) {
if (cards == null || cards.size() < 1) {
return null;
}
int i = 0;
int pick = RandomUtil.nextInt(cards.size());
for (Card card : cards) {
if (i == pick) {
return card;
}
i = i + 1;
}
return null;
return false;
}
}

View file

@ -40,7 +40,6 @@ import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
@ -134,10 +133,7 @@ class NettlevineBlightEffect extends OneShotEffect {
if (chosenPermanent != null) {
Card nettlevineBlightCard = game.getCard(source.getSourceId());
if (nettlevineBlightCard != null) {
Zone zone = game.getState().getZone(nettlevineBlightCard.getId());
nettlevineBlightCard.putOntoBattlefield(game, zone, source.getSourceId(), newController.getId());
game.getState().setValue("attachTo:" + nettlevineBlight.getId(), chosenPermanent);
chosenPermanent.addAttachment(nettlevineBlight.getId(), game);
nettlevineBlight.attachTo(chosenPermanent.getId(), game);
return true;
}
}

View file

@ -29,7 +29,6 @@ package mage.cards.n;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -41,6 +40,7 @@ import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
import java.util.UUID;
import mage.cards.CardsImpl;
/**
*
@ -86,18 +86,12 @@ class NewFrontiersEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
int amount = source.getManaCostsToPay().getX();
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
if (player != null && player.chooseUse(outcome, "Search your library for up to " + amount + " basic lands?", source, game)) {
TargetCardInLibrary target = new TargetCardInLibrary(0, amount, StaticFilters.FILTER_BASIC_LAND_CARD);
if (player.searchLibrary(target, game)) {
for (UUID cardId : target.getTargets()) {
Card card = player.getLibrary().getCard(cardId, game);
if (card != null) {
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), player.getId(), true);
}
}
player.moveCards(new CardsImpl(target.getTargets()).getCards(game), Zone.BATTLEFIELD, source, game, true, false, false, null);
player.shuffleLibrary(source, game);
}

View file

@ -51,7 +51,6 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.game.Game;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.players.Player;
import mage.target.TargetPermanent;
@ -117,8 +116,8 @@ class NissaStewardOfElementsEffect 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;
}
int count = 1 + new CountersSourceCount(CounterType.LOYALTY).calculate(game, source, this);
@ -126,15 +125,12 @@ class NissaStewardOfElementsEffect extends OneShotEffect {
filter.add(Predicates.or(new CardTypePredicate(CardType.CREATURE),
new CardTypePredicate(CardType.LAND)));
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, count));
Card card = player.getLibrary().getFromTop(game);
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
Cards cards = new CardsImpl();
cards.add(card);
player.lookAtCards("Nissa, Steward of Elements", cards, game);
controller.lookAtCards(source, null, new CardsImpl(card), game);
if (filter.match(card, game)) {
String message = "Put " + card.getName() + " onto the battlefield?";
if (player.chooseUse(outcome, message, source, game)) {
return card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId(), false);
if (controller.chooseUse(outcome, "Put " + card.getName() + " onto the battlefield?", source, game)) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
}
@ -153,6 +149,7 @@ class NissaStewardOfElementsToken extends TokenImpl {
this.addAbility(FlyingAbility.getInstance());
this.addAbility(HasteAbility.getInstance());
}
public NissaStewardOfElementsToken(final NissaStewardOfElementsToken token) {
super(token);
}

View file

@ -40,10 +40,11 @@ import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterBasicLandCard;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
@ -55,7 +56,7 @@ import mage.target.common.TargetCardInLibrary;
public class NissasPilgrimage extends CardImpl {
public NissasPilgrimage(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{G}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}");
// Search your library for up to two basic Forest cards, reveal those cards, and put one onto the battlefield tapped and the rest into your hand. Then shuffle your library.
// <i>Spell Mastery</i> If there are two or more instant and/or sorcery cards in your graveyard, search your library for up to three basic Forest cards instead of two.
@ -74,9 +75,10 @@ public class NissasPilgrimage extends CardImpl {
class NissasPilgrimageEffect extends OneShotEffect {
private static final FilterCard filter = new FilterBasicLandCard("basic Forest");
private static final FilterCard filter = new FilterCard("basic Forest card");
static {
filter.add(new SupertypePredicate(SuperType.BASIC));
filter.add(new SubtypePredicate(SubType.FOREST));
}

View file

@ -110,8 +110,7 @@ class NomadMythmakerEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Card aura = game.getCard(source.getFirstTarget());
if (controller == null
|| aura == null) {
if (controller == null || aura == null) {
return false;
}
FilterControlledCreaturePermanent FILTER = new FilterControlledCreaturePermanent("Choose a creature you control");
@ -122,7 +121,7 @@ class NomadMythmakerEffect extends OneShotEffect {
if (permanent != null
&& !permanent.cantBeAttachedBy(aura, game)) {
game.getState().setValue("attachTo:" + aura.getId(), permanent);
aura.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), controller.getId());
controller.moveCards(aura, Zone.BATTLEFIELD, source, game);
return permanent.addAttachment(aura.getId(), game);
}
}

View file

@ -33,7 +33,7 @@ import mage.ObjectColor;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.condition.common.MyTurnBeforeAttackersDeclaredCondition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -64,7 +64,7 @@ public class NorwoodPriestess extends CardImpl {
// {tap}: You may put a green creature card from your hand onto the battlefield. Activate this ability only during your turn, before attackers are declared.
this.addAbility(new ActivateIfConditionActivatedAbility(
Zone.BATTLEFIELD,
new PutPermanentOnBattlefieldEffect(filter),
new PutCardFromHandOntoBattlefieldEffect(filter),
new TapSourceCost(),
MyTurnBeforeAttackersDeclaredCondition.instance
));

View file

@ -48,13 +48,13 @@ import mage.players.Player;
import mage.target.common.TargetCardInHand;
/**
*
*
* @author Rafbill
*/
public class PreeminentCaptain extends CardImpl {
public PreeminentCaptain(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{W}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}");
this.subtype.add(SubType.KITHKIN);
this.subtype.add(SubType.SOLDIER);
@ -96,20 +96,22 @@ class PreeminentCaptainEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Player controller = game.getPlayer(source.getControllerId());
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().isEmpty()) {
UUID cardId = target.getFirstTarget();
Card card = player.getHand().get(cardId, game);
Card card = controller.getHand().get(cardId, game);
if (card != null) {
if (card.putOntoBattlefield(game, Zone.HAND, source.getSourceId(), source.getControllerId(), true)) {
if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
Permanent permanent = game.getPermanent(card.getId());
game.getCombat().addAttackingCreature(permanent.getId(), game);
if (permanent != null) {
game.getCombat().addAttackingCreature(permanent.getId(), game);
}
}
}
return true;
}
return true;
}
return false;
}

View file

@ -5,7 +5,6 @@ import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.LegendarySpellAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
@ -15,8 +14,7 @@ import mage.game.Game;
import mage.players.Player;
/**
* @author JRHerlehy
* Created on 4/8/18.
* @author JRHerlehy Created on 4/8/18.
*/
public class PrimevalsGloriousRebirth extends CardImpl {
@ -61,11 +59,10 @@ class PrimevalsGloriousRebirthEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
for (Card card : player.getGraveyard().getCards(filter, game)) {
card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId());
}
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.moveCards(controller.getGraveyard().getCards(filter, game), Zone.BATTLEFIELD, source, game);
return true;
}
return false;
}

View file

@ -27,20 +27,25 @@
*/
package mage.cards.p;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.EntersBattlefieldEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -50,8 +55,7 @@ import mage.players.Player;
public class PyrrhicRevival extends CardImpl {
public PyrrhicRevival(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{W/B}{W/B}{W/B}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{W/B}{W/B}{W/B}");
// Each player returns each creature card from their graveyard to the battlefield with an additional -1/-1 counter on it.
this.getSpellAbility().addEffect(new PyrrhicRevivalEffect());
@ -86,23 +90,26 @@ class PyrrhicRevivalEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
boolean result = false;
for (Player player : game.getPlayers().values()) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Set<Card> toBattlefield = new HashSet<>();
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
Cards cards = player.getGraveyard();
for (Card card : cards.getCards(game)) {
for (Card card : player.getGraveyard().getCards(game)) {
if (card != null && card.isCreature()) {
if (card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), card.getOwnerId(), false)) {
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) {
permanent.addCounters(CounterType.M1M1.createInstance(), source, game);
}
result = true;
}
toBattlefield.add(card);
ContinuousEffect effect = new EntersBattlefieldEffect(new AddCountersTargetEffect(CounterType.M1M1.createInstance()));
effect.setDuration(Duration.OneUse);
effect.setTargetPointer(new FixedTarget(card.getId()));
game.addEffect(effect, source);
}
}
}
}
return result;
controller.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game, false, false, true, null);
return true;
}
}
}

View file

@ -31,7 +31,9 @@ import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -47,7 +49,6 @@ import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
/**
*
@ -56,13 +57,19 @@ import mage.target.common.TargetCardInHand;
public class QuestForUlasTemple extends CardImpl {
public QuestForUlasTemple(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{U}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{U}");
// At the beginning of your upkeep, you may look at the top card of your library. If it's a creature card, you may reveal it and put a quest counter on Quest for Ula's Temple.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new QuestForUlasTempleEffect(), TargetController.YOU, true));
// At the beginning of each end step, if there are three or more quest counters on Quest for Ula's Temple, you may put a Kraken, Leviathan, Octopus, or Serpent creature card from your hand onto the battlefield.
this.addAbility(new QuestForUlasTempleTriggeredAbility());
FilterCreatureCard filter = new FilterCreatureCard("Kraken, Leviathan, Octopus, or Serpent creature card");
filter.add(Predicates.or(
new SubtypePredicate(SubType.KRAKEN),
new SubtypePredicate(SubType.LEVIATHAN),
new SubtypePredicate(SubType.OCTOPUS),
new SubtypePredicate(SubType.SERPENT)));
this.addAbility(new QuestForUlasTempleTriggeredAbility(new PutCardFromHandOntoBattlefieldEffect(filter)));
}
public QuestForUlasTemple(final QuestForUlasTemple card) {
@ -116,8 +123,8 @@ class QuestForUlasTempleEffect extends OneShotEffect {
class QuestForUlasTempleTriggeredAbility extends TriggeredAbilityImpl {
public QuestForUlasTempleTriggeredAbility() {
super(Zone.BATTLEFIELD, new QuestForUlasTempleEffect2(), true);
public QuestForUlasTempleTriggeredAbility(Effect effect) {
super(Zone.BATTLEFIELD, effect, true);
}
public QuestForUlasTempleTriggeredAbility(final QuestForUlasTempleTriggeredAbility ability) {
@ -142,50 +149,6 @@ class QuestForUlasTempleTriggeredAbility extends TriggeredAbilityImpl {
@Override
public String getRule() {
return "At the beginning of each end step, if there are three or more quest counters on {this}, you may put a Kraken, Leviathan, Octopus, or Serpent creature card from your hand onto the battlefield.";
}
}
class QuestForUlasTempleEffect2 extends OneShotEffect {
private static final String query = "Do you want to put a Kraken, Leviathan, Octopus, or Serpent creature card from your hand onto the battlefield?";
private static final FilterCreatureCard filter = new FilterCreatureCard("Kraken, Leviathan, Octopus, or Serpent creature card from your hand");
static {
filter.add(Predicates.or(
new SubtypePredicate(SubType.KRAKEN),
new SubtypePredicate(SubType.LEVIATHAN),
new SubtypePredicate(SubType.OCTOPUS),
new SubtypePredicate(SubType.SERPENT)));
}
QuestForUlasTempleEffect2() {
super(Outcome.PutCreatureInPlay);
}
QuestForUlasTempleEffect2(final QuestForUlasTempleEffect2 effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
TargetCardInHand target = new TargetCardInHand(filter);
if (target.canChoose(source.getSourceId(), controller.getId(), game)
&& controller.chooseUse(Outcome.PutCreatureInPlay, query, source, game)) {
if (controller.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) {
Card card = game.getCard(target.getFirstTarget());
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
return true;
}
return false;
}
@Override
public QuestForUlasTempleEffect2 copy() {
return new QuestForUlasTempleEffect2(this);
return "At the beginning of each end step, if there are three or more quest counters on {this}, " + super.getRule();
}
}

View file

@ -31,12 +31,12 @@ import java.util.UUID;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.filter.StaticFilters;
/**
*
@ -45,11 +45,11 @@ import mage.filter.common.FilterCreatureCard;
public class QuicksilverAmulet extends CardImpl {
public QuicksilverAmulet(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{4}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
// {4}, {tap}: You may put a creature card from your hand onto the battlefield.
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new PutPermanentOnBattlefieldEffect(new FilterCreatureCard("a creature card")),
new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_CARD_CREATURE_A),
new ManaCostsImpl("{4}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
@ -64,5 +64,3 @@ public class QuicksilverAmulet extends CardImpl {
return new QuicksilverAmulet(this);
}
}

View file

@ -57,7 +57,7 @@ import mage.target.common.TargetCreaturePermanent;
public class Reincarnation extends CardImpl {
public Reincarnation(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{G}{G}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{G}{G}");
// Choose target creature. When that creature dies this turn, return a creature card from its owner's graveyard to the battlefield under the control of that creature's owner.
this.getSpellAbility().addEffect(new ReincarnationEffect());
@ -141,7 +141,7 @@ class ReincarnationDelayedTriggeredAbility extends DelayedTriggeredAbility {
class ReincarnationDelayedEffect extends OneShotEffect {
private UUID target;
private final UUID target;
public ReincarnationDelayedEffect(UUID target) {
super(Outcome.Detriment);
@ -166,14 +166,14 @@ class ReincarnationDelayedEffect extends OneShotEffect {
if (permanent != null && controller != null) {
Player player = game.getPlayer(permanent.getOwnerId());
if (player != null) {
FilterCreatureCard filter = new FilterCreatureCard(new StringBuilder("a creature card from ").append(player.getLogName()).append("'s graveyard").toString());
FilterCreatureCard filter = new FilterCreatureCard("a creature card from " + player.getName() + "'s graveyard");
filter.add(new OwnerIdPredicate(player.getId()));
Target targetCreature = new TargetCardInGraveyard(filter);
if (targetCreature.canChoose(source.getSourceId(), controller.getId(), game)
&& controller.chooseTarget(outcome, targetCreature, source, game)) {
Card card = game.getCard(targetCreature.getFirstTarget());
if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
return card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), player.getId());
controller.moveCards(card, Zone.BATTLEFIELD, source, game, false, false, true, null);
}
}
return true;

View file

@ -27,6 +27,9 @@
*/
package mage.cards.r;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.DiesAttachedTriggeredAbility;
@ -49,10 +52,6 @@ import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
*
* @author jeffwadsworth
@ -60,7 +59,7 @@ import java.util.UUID;
public class ReinsOfTheVinesteed extends CardImpl {
public ReinsOfTheVinesteed(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{G}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}");
this.subtype.add(SubType.AURA);
// Enchant creature
@ -127,7 +126,7 @@ class ReinsOfTheVinesteedEffect extends OneShotEffect {
Permanent targetPermanent = game.getPermanent(target.getFirstTarget());
if (!targetPermanent.cantBeAttachedBy(aura, game)) {
game.getState().setValue("attachTo:" + aura.getId(), targetPermanent);
aura.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), controller.getId());
controller.moveCards(aura, Zone.BATTLEFIELD, source, game);
return targetPermanent.addAttachment(aura.getId(), game);
}
}

View file

@ -51,8 +51,7 @@ public class Restore extends CardImpl {
private static final FilterLandCard filter = new FilterLandCard();
public Restore(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{G}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{G}");
// Put target land card from a graveyard onto the battlefield under your control.
this.getSpellAbility().addEffect(new RestoreEffect());
@ -91,7 +90,8 @@ class RestoreEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
Card land = game.getCard(this.getTargetPointer().getFirst(game, source));
if (controller != null && game.getState().getZone(land.getId()) == Zone.GRAVEYARD) {
return land.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), controller.getId());
controller.moveCards(land, Zone.BATTLEFIELD, source, game);
return true;
}
return false;
}

View file

@ -58,7 +58,7 @@ import mage.target.Target;
public class Retether extends CardImpl {
public Retether(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{W}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{W}");
// Return each Aura card from your graveyard to the battlefield. Only creatures can be enchanted this way.
this.getSpellAbility().addEffect(new RetetherEffect());
@ -108,7 +108,7 @@ class RetetherEffect extends OneShotEffect {
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature to enchant (" + aura.getLogName() + ')');
filter.add(new CanBeEnchantedByPredicate(aura));
Target target = null;
auraLegalitySearch:
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, playerId, game)) {
@ -135,6 +135,7 @@ class RetetherEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null && !permanent.cantBeAttachedBy(aura, game)) {
auraMap.put(aura, permanent);
game.getState().setValue("attachTo:" + aura.getId(), permanent);
continue auraCardsInGraveyard;
}
}
@ -143,17 +144,12 @@ class RetetherEffect extends OneShotEffect {
game.informPlayers("No valid creature targets for " + aura.getLogName());
}
}
controller.moveCards(auraMap.keySet(), Zone.BATTLEFIELD, source, game);
for (Entry<Card, Permanent> entry : auraMap.entrySet()) {
Card aura = entry.getKey();
Permanent permanent = entry.getValue();
if (aura != null) {
if (permanent != null) {
game.getState().setValue("attachTo:" + aura.getId(), permanent);
}
aura.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), controller.getId());
if (permanent != null) {
permanent.addAttachment(aura.getId(), game);
}
if (aura != null && permanent != null) {
permanent.addAttachment(aura.getId(), game);
}
}
return true;

View file

@ -30,7 +30,6 @@ package mage.cards.r;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -79,7 +78,7 @@ class ReturnOfTheNightstalkersEffect extends OneShotEffect {
public ReturnOfTheNightstalkersEffect() {
super(Outcome.PutCreatureInPlay);
staticText = "Return all Nightstalker permanent cards from your graveyard to the battlefield. Then destroy all Swamps you control.";
staticText = "Return all Nightstalker permanent cards from your graveyard to the battlefield. Then destroy all Swamps you control";
}
public ReturnOfTheNightstalkersEffect(final ReturnOfTheNightstalkersEffect effect) {
@ -93,15 +92,14 @@ class ReturnOfTheNightstalkersEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
for (Card card : player.getGraveyard().getCards(filter1, game)) {
card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId());
}
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.moveCards(controller.getGraveyard().getCards(filter1, game), Zone.BATTLEFIELD, source, game);
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter2, source.getControllerId(), source.getSourceId(), game)) {
permanent.destroy(source.getSourceId(), game, false);
}
return true;
}
return true;
return false;
}
}

View file

@ -30,14 +30,12 @@ package mage.cards.r;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.common.FilterArtifactCard;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
@ -48,7 +46,7 @@ import mage.players.Player;
public class RoarOfReclamation extends CardImpl {
public RoarOfReclamation(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{5}{W}{W}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{5}{W}{W}");
// Each player returns all artifact cards from their graveyard to the battlefield.
this.getSpellAbility().addEffect(new RoarOfReclamationEffect());
@ -65,7 +63,7 @@ public class RoarOfReclamation extends CardImpl {
}
class RoarOfReclamationEffect extends OneShotEffect {
public RoarOfReclamationEffect() {
super(Outcome.PutCardInPlay);
staticText = "Each player returns all artifact cards from their graveyard to the battlefield";
@ -82,19 +80,12 @@ class RoarOfReclamationEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
boolean result = true;
for (Player player : game.getPlayers().values()) {
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
Cards cards = player.getGraveyard();
for (Card card : cards.getCards(new FilterArtifactCard(), game)) {
if (card != null) {
if (!card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), card.getOwnerId(), false)) {
result = false;
}
}
}
player.moveCards(player.getGraveyard().getCards(StaticFilters.FILTER_CARD_ARTIFACT, game), Zone.BATTLEFIELD, source, game);
}
}
return result;
return true;
}
}
}

View file

@ -31,13 +31,13 @@ import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.TurnedFaceUpSourceTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.abilities.keyword.MorphAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.common.FilterCreatureCard;
import mage.filter.StaticFilters;
/**
*
@ -46,7 +46,7 @@ import mage.filter.common.FilterCreatureCard;
public class RootElemental extends CardImpl {
public RootElemental(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{G}{G}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{G}");
this.subtype.add(SubType.ELEMENTAL);
this.power = new MageInt(6);
this.toughness = new MageInt(5);
@ -54,7 +54,7 @@ public class RootElemental extends CardImpl {
// Morph {5}{G}{G}
this.addAbility(new MorphAbility(this, new ManaCostsImpl("{5}{G}{G}")));
// When Root Elemental is turned face up, you may put a creature card from your hand onto the battlefield.
this.addAbility(new TurnedFaceUpSourceTriggeredAbility(new PutPermanentOnBattlefieldEffect(new FilterCreatureCard("a creature card"))));
this.addAbility(new TurnedFaceUpSourceTriggeredAbility(new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_CARD_CREATURE_A)));
}
public RootElemental(final RootElemental card) {

View file

@ -31,12 +31,13 @@ import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.PutLandFromHandOntoBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
/**
*
@ -45,7 +46,7 @@ import mage.constants.Zone;
public class SakuraTribeScout extends CardImpl {
public SakuraTribeScout(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}");
this.subtype.add(SubType.SNAKE);
this.subtype.add(SubType.SHAMAN);
this.subtype.add(SubType.SCOUT);
@ -54,7 +55,8 @@ public class SakuraTribeScout extends CardImpl {
this.toughness = new MageInt(1);
// {tap}: You may put a land card from your hand onto the battlefield.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutLandFromHandOntoBattlefieldEffect(), new TapSourceCost()));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD,
new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_BASIC_LAND_CARD_A), new TapSourceCost()));
}
public SakuraTribeScout(final SakuraTribeScout card) {

View file

@ -39,8 +39,8 @@ import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.CardTypePredicate;
@ -56,7 +56,7 @@ import mage.target.common.TargetCardInGraveyard;
public class ScionOfDarkness extends CardImpl {
public ScionOfDarkness(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{B}{B}{B}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{B}{B}{B}");
this.subtype.add(SubType.AVATAR);
this.power = new MageInt(6);
@ -102,20 +102,22 @@ class ScionOfDarknessEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player damagedPlayer = game.getPlayer(targetPointer.getFirst(game, source));
Player you = game.getPlayer(source.getControllerId());
FilterCard filter = new FilterCard("creature in that player's graveyard");
Player controller = game.getPlayer(source.getControllerId());
if (controller == null || damagedPlayer == null) {
return false;
}
FilterCard filter = new FilterCard("creature in " + damagedPlayer.getName() + "'s graveyard");
filter.add(new CardTypePredicate(CardType.CREATURE));
filter.add(new OwnerIdPredicate(damagedPlayer.getId()));
TargetCardInGraveyard target = new TargetCardInGraveyard(filter);
if (target.canChoose(source.getSourceId(), you.getId(), game)) {
if (you.chooseTarget(Outcome.PutCreatureInPlay, target, source, game)) {
if (target.canChoose(source.getSourceId(), controller.getId(), game)) {
if (controller.chooseTarget(Outcome.PutCreatureInPlay, target, source, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), you.getId());
return true;
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
}
return false;
return true;
}
}

View file

@ -27,13 +27,16 @@
*/
package mage.cards.s;
import java.util.HashSet;
import java.util.Iterator;
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.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
@ -87,28 +90,27 @@ class SettleTheWreckageEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
if (player != null) {
int attackers = 0;
Iterator<UUID> creatureIds = game.getCombat().getAttackers().iterator();
while (creatureIds.hasNext()) {
Permanent creature = game.getPermanent(creatureIds.next());
if (creature != null && creature.getControllerId().equals(player.getId())) {
creature.moveToExile(null, null, source.getId(), game);
attackers++;
}
}
TargetCardInLibrary target = new TargetCardInLibrary(0, attackers, StaticFilters.FILTER_BASIC_LAND_CARD);
if (player.chooseUse(Outcome.Benefit, "Search for up to " + attackers + " basic land" + ((attackers == 1) ? "" : "s") + "?", source, game) && player.searchLibrary(target, game)) {
for (UUID cardId : target.getTargets()) {
Card card = player.getLibrary().getCard(cardId, game);
if (card != null) {
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), player.getId(), true);
}
}
player.shuffleLibrary(source, game);
}
return true;
Player controller = game.getPlayer(source.getControllerId());
if (controller == null || player == null) {
return false;
}
return false;
int attackers = 0;
Set<Card> toExile = new HashSet<>();
Iterator<UUID> creatureIds = game.getCombat().getAttackers().iterator();
while (creatureIds.hasNext()) {
Permanent creature = game.getPermanent(creatureIds.next());
if (creature != null && creature.getControllerId().equals(player.getId())) {
toExile.add(creature);
attackers++;
}
}
controller.moveCards(toExile, Zone.EXILED, source, game);
TargetCardInLibrary target = new TargetCardInLibrary(0, attackers, StaticFilters.FILTER_BASIC_LAND_CARD);
if (player.chooseUse(Outcome.Benefit, "Search for up to " + attackers + " basic land" + ((attackers == 1) ? "" : "s") + "?", source, game) && player.searchLibrary(target, game)) {
player.moveCards(new CardsImpl(target.getTargets()).getCards(game), Zone.BATTLEFIELD, source, game, true, false, false, null);
player.shuffleLibrary(source, game);
}
return true;
}
}

View file

@ -31,12 +31,13 @@ import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.PutLandFromHandOntoBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
/**
*
@ -45,15 +46,16 @@ import mage.constants.Zone;
public class SkyshroudRanger extends CardImpl {
public SkyshroudRanger(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}");
this.subtype.add(SubType.ELF);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// {tap}: You may put a land card from your hand onto the battlefield. Activate this ability only any time you could cast a sorcery.
this.addAbility(new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new PutLandFromHandOntoBattlefieldEffect(), new TapSourceCost()));
this.addAbility(new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD,
new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_BASIC_LAND_CARD_A), new TapSourceCost()));
}
public SkyshroudRanger(final SkyshroudRanger card) {

View file

@ -34,7 +34,7 @@ import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -70,7 +70,7 @@ public class StoneforgeMystic extends CardImpl {
this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInHandEffect(target, true, true), true));
// {1}{W}, {T}: You may put an Equipment card from your hand onto the battlefield.
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutPermanentOnBattlefieldEffect(filter), new ManaCostsImpl("{1}{W}"));
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutCardFromHandOntoBattlefieldEffect(filter), new ManaCostsImpl("{1}{W}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}

View file

@ -28,12 +28,13 @@
package mage.cards.s;
import java.util.UUID;
import mage.abilities.effects.common.PutLandFromHandOntoBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.filter.StaticFilters;
import mage.target.common.TargetCreaturePermanent;
/**
@ -43,12 +44,12 @@ import mage.target.common.TargetCreaturePermanent;
public class SwellOfGrowth extends CardImpl {
public SwellOfGrowth(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{G}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{G}");
// Target creature gets +2/+2 until end of turn. You may put a land card from your hand onto the battlefield.
this.getSpellAbility().addEffect(new BoostTargetEffect(2, 2, Duration.EndOfTurn));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addEffect(new PutLandFromHandOntoBattlefieldEffect());
this.getSpellAbility().addEffect(new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_BASIC_LAND_CARD_A));
}
public SwellOfGrowth(final SwellOfGrowth card) {

View file

@ -32,13 +32,13 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.PutLandFromHandOntoBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.common.FilterLandCard;
import mage.filter.StaticFilters;
/**
*
@ -47,13 +47,14 @@ import mage.filter.common.FilterLandCard;
public class TerrainGenerator extends CardImpl {
public TerrainGenerator(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.LAND},"");
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
// {tap}: Add {C}.
this.addAbility(new ColorlessManaAbility());
// {2}, {tap}: You may put a basic land card from your hand onto the battlefield tapped.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutLandFromHandOntoBattlefieldEffect(true, FilterLandCard.basicLandCard()), new ManaCostsImpl("{2}"));
// {2}, {T}: You may put a basic land card from your hand onto the battlefield tapped.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_BASIC_LAND_CARD_A, false, true), new ManaCostsImpl("{2}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}

View file

@ -27,6 +27,9 @@
*/
package mage.cards.t;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.MageInt;
import mage.MageObjectReference;
import mage.abilities.Ability;
@ -34,13 +37,14 @@ import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterCard;
import mage.filter.StaticFilters;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
@ -48,10 +52,6 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.watchers.Watcher;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
/**
* @author TheElk801
*/
@ -180,7 +180,7 @@ class TheUrDragonEffect extends OneShotEffect {
public TheUrDragonEffect() {
super(Outcome.Benefit);
this.staticText = "draw that many cards, then you may put a permanent card from your hand onto the battlefield.";
this.staticText = "draw that many cards, then you may put a permanent card from your hand onto the battlefield";
}
public TheUrDragonEffect(final TheUrDragonEffect effect) {
@ -207,9 +207,7 @@ class TheUrDragonEffect extends OneShotEffect {
if (attackingDragons > 0) {
controller.drawCards(attackingDragons, game);
}
Effect effect = new PutPermanentOnBattlefieldEffect();
effect.apply(game, source);
return true;
return new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_CARD_LAND_A).apply(game, source);
}
}
return false;

View file

@ -31,7 +31,7 @@ import java.util.UUID;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -59,7 +59,7 @@ public class ThranTemporalGateway extends CardImpl {
// {4}, {t}: You may put a historic permanent card from your hand onto the battlefield. (Artifacts, legendaries, and Sagas are historic.)
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new PutPermanentOnBattlefieldEffect(filter)
new PutCardFromHandOntoBattlefieldEffect(filter)
.setText("You may put a historic permanent card from your hand onto the battlefield. "
+ "<i>(Artifacts, legendaries, and Sagas are historic.)</i>"),
new ManaCostsImpl("{4}"));

View file

@ -30,16 +30,16 @@ package mage.cards.t;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import java.util.UUID;
import mage.filter.StaticFilters;
/**
*
@ -48,7 +48,7 @@ import java.util.UUID;
public class TimmyPowerGamer extends CardImpl {
public TimmyPowerGamer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{G}{G}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{G}");
this.supertype.add(SuperType.LEGENDARY);
@ -60,7 +60,7 @@ public class TimmyPowerGamer extends CardImpl {
// {4}: You may put a creature card from your hand onto the battlefield.
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new PutPermanentOnBattlefieldEffect(new FilterCreatureCard("a creature card")),
new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_CARD_CREATURE_A),
new ManaCostsImpl("{4}"));
this.addAbility(ability);
}

View file

@ -36,7 +36,7 @@ import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.decorator.ConditionalActivatedAbility;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
@ -45,7 +45,6 @@ import mage.constants.CardType;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreatureCard;
import mage.target.Target;
import mage.target.common.TargetCardInYourGraveyard;
@ -67,7 +66,7 @@ public class TriassicEgg extends CardImpl {
// Sacrifice Triassic Egg: Choose one - You may put a creature card from your hand onto the battlefield;
ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD,
new PutPermanentOnBattlefieldEffect(new FilterCreatureCard("a creature card")),
new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_CARD_CREATURE_A),
new SacrificeSourceCost(),
new SourceHasCounterCondition(CounterType.HATCHLING, 2, Integer.MAX_VALUE),
"Sacrifice Triassic Egg: Choose one - You may put a creature card from your hand onto the battlefield; or return target creature card from your graveyard to the battlefield. Activate this ability only if two or more hatchling counters are on {this}.");

View file

@ -25,19 +25,19 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.cards.w;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.PutLandFromHandOntoBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
/**
*
@ -45,17 +45,18 @@ import mage.constants.Zone;
*/
public class WalkingAtlas extends CardImpl {
public WalkingAtlas (UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{2}");
public WalkingAtlas(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}");
this.subtype.add(SubType.CONSTRUCT);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// {tap}: You may put a land card from your hand onto the battlefield.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutLandFromHandOntoBattlefieldEffect(), new TapSourceCost()));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD,
new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_BASIC_LAND_CARD_A), new TapSourceCost()));
}
public WalkingAtlas (final WalkingAtlas card) {
public WalkingAtlas(final WalkingAtlas card) {
super(card);
}

View file

@ -30,7 +30,7 @@ package mage.cards.w;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.abilities.keyword.DoubleStrikeAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -62,7 +62,7 @@ public class WarrenInstigator extends CardImpl {
this.addAbility(DoubleStrikeAbility.getInstance());
// Whenever Warren Instigator deals damage to an opponent, you may put a Goblin creature card from your hand onto the battlefield.
this.addAbility(new DealsDamageToOpponentTriggeredAbility(new PutPermanentOnBattlefieldEffect(filter), false));
this.addAbility(new DealsDamageToOpponentTriggeredAbility(new PutCardFromHandOntoBattlefieldEffect(filter), false));
}
public WarrenInstigator(final WarrenInstigator card) {

View file

@ -34,7 +34,7 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.ProtectionAbility;
import mage.cards.CardImpl;
@ -73,7 +73,7 @@ public class WillowPriestess extends CardImpl {
// {T}: You may put a Faerie permanent card from your hand onto the battlefield.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD,
new PutPermanentOnBattlefieldEffect(filter),
new PutCardFromHandOntoBattlefieldEffect(filter),
new TapSourceCost()));
// {2}{G}: Target green creature gains protection from black until end of turn.

View file

@ -110,6 +110,7 @@ public class VorinclexVoiceOfHungerTest extends CardTestPlayerBase {
execute();
assertPermanentCount(playerB, "Gemstone Caverns", 1);
assertCounterCount("Gemstone Caverns", CounterType.LUCK, 1);
assertPermanentCount(playerB, "Silvercoat Lion", 1);
assertExileCount("Silvercoat Lion", 1);
assertTapped("Gemstone Caverns", true);

View file

@ -851,6 +851,9 @@ public class ContinuousEffects implements Serializable {
if (rEffect != null) {
event.getAppliedEffects().add(rEffect.getId());
caught = rEffect.replaceEvent(event, rAbility, game);
if (Duration.OneUse.equals(rEffect.getDuration())) {
rEffect.discard();
}
}
if (caught) { // Event was completely replaced -> stop applying effects to it
break;

View file

@ -15,34 +15,41 @@ import mage.target.common.TargetCardInHand;
/**
* @author magenoxx_at_gmail.com
*/
public class PutPermanentOnBattlefieldEffect extends OneShotEffect {
public class PutCardFromHandOntoBattlefieldEffect extends OneShotEffect {
private final FilterCard filter;
private final boolean useTargetController;
private final boolean tapped;
public PutPermanentOnBattlefieldEffect() {
public PutCardFromHandOntoBattlefieldEffect() {
this(new FilterPermanentCard("a permanent card"), false);
}
public PutPermanentOnBattlefieldEffect(FilterCard filter) {
public PutCardFromHandOntoBattlefieldEffect(FilterCard filter) {
this(filter, false);
}
public PutPermanentOnBattlefieldEffect(FilterCard filter, boolean useTargetController) {
public PutCardFromHandOntoBattlefieldEffect(FilterCard filter, boolean useTargetController) {
this(filter, useTargetController, false);
}
public PutCardFromHandOntoBattlefieldEffect(FilterCard filter, boolean useTargetController, boolean tapped) {
super(Outcome.PutCardInPlay);
this.filter = filter;
this.useTargetController = useTargetController;
this.tapped = tapped;
}
public PutPermanentOnBattlefieldEffect(final PutPermanentOnBattlefieldEffect effect) {
public PutCardFromHandOntoBattlefieldEffect(final PutCardFromHandOntoBattlefieldEffect effect) {
super(effect);
this.filter = effect.filter.copy();
this.useTargetController = effect.useTargetController;
this.tapped = effect.tapped;
}
@Override
public PutPermanentOnBattlefieldEffect copy() {
return new PutPermanentOnBattlefieldEffect(this);
public PutCardFromHandOntoBattlefieldEffect copy() {
return new PutCardFromHandOntoBattlefieldEffect(this);
}
@Override
@ -58,10 +65,10 @@ public class PutPermanentOnBattlefieldEffect extends OneShotEffect {
}
if (player.chooseUse(Outcome.PutCardInPlay, "Put " + filter.getMessage() + " from your hand onto the battlefield?", source, game)) {
TargetCardInHand target = new TargetCardInHand(filter);
if (player.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) {
if (player.choose(Outcome.PutCardInPlay, target, source.getSourceId(), game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
return player.moveCards(card, Zone.BATTLEFIELD, source, game);
return player.moveCards(card, Zone.BATTLEFIELD, source, game, tapped, false, false, null);
}
}
}

View file

@ -1,96 +0,0 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterLandCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetCardInHand;
/**
*
* @author LevelX2
*/
public class PutLandFromHandOntoBattlefieldEffect extends OneShotEffect {
private FilterCard filter;
private boolean tapped;
public PutLandFromHandOntoBattlefieldEffect() {
this(false);
}
public PutLandFromHandOntoBattlefieldEffect(boolean tapped) {
this(tapped, new FilterLandCard());
}
public PutLandFromHandOntoBattlefieldEffect(boolean tapped, FilterCard filter) {
super(Outcome.PutLandInPlay);
this.tapped = tapped;
this.filter = filter;
staticText = "you may put a " + filter.getMessage() + " from your hand onto the battlefield" + (tapped ? " tapped" : "");
}
public PutLandFromHandOntoBattlefieldEffect(final PutLandFromHandOntoBattlefieldEffect effect) {
super(effect);
this.tapped = effect.tapped;
this.filter = effect.filter;
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Target target = new TargetCardInHand(filter);
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)
&& controller.chooseUse(outcome, "Put land onto battlefield?", source, game)
&& controller.choose(outcome, target, source.getSourceId(), game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game, tapped, false, false, null);
}
}
return true;
}
return false;
}
@Override
public PutLandFromHandOntoBattlefieldEffect copy() {
return new PutLandFromHandOntoBattlefieldEffect(this);
}
}

View file

@ -1,16 +1,16 @@
/*
* 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
@ -20,22 +20,21 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.effects.common;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
@ -59,12 +58,15 @@ public class ReturnToBattlefieldUnderOwnerControlAttachedEffect extends OneShotE
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Object object = getValue("attachedTo");
if (object != null && object instanceof Permanent) {
Card card = game.getCard(((Permanent) object).getId());
if (card != null) {
Zone currentZone = game.getState().getZone(card.getId());
if (card.putOntoBattlefield(game, currentZone, source.getSourceId(), card.getOwnerId())) {
if (controller.moveCards(card, Zone.BATTLEFIELD, source, game, false, false, true, null)) {
return true;
}
}

View file

@ -1,16 +1,16 @@
/*
* 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
@ -20,22 +20,22 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.effects.common;
import java.util.UUID;
import mage.constants.Outcome;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.ExileZone;
import mage.game.Game;
import mage.players.Player;
import mage.util.CardUtil;
/**
@ -60,11 +60,16 @@ public class ReturnToBattlefieldUnderYourControlSourceEffect extends OneShotEffe
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
ExileZone exileZone = game.getExile().getExileZone(exileZoneId);
if (exileZone != null && exileZone.contains(source.getSourceId())) {
Card card = game.getCard(source.getSourceId());
if (card != null && card.putOntoBattlefield(game, Zone.EXILED, source.getSourceId(), source.getControllerId())) {
Card card = game.getCard(source.getSourceId());
if (card != null
&& controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
return true;
}
}

View file

@ -103,11 +103,11 @@ class AuraSwapEffect extends OneShotEffect {
Card auraInHand = game.getCard(target.getFirstTarget());
if (auraInHand != null) {
game.getState().setValue("attachTo:" + auraInHand.getId(), enchantedPermanent);
auraInHand.putOntoBattlefield(game, Zone.HAND, source.getSourceId(), controller.getId());
controller.moveCards(auraInHand, Zone.BATTLEFIELD, source, game);
enchantedPermanent.addAttachment(auraInHand.getId(), game);
game.informPlayers(controller.getLogName() + " put " + auraInHand.getLogName() + " on the battlefield attached to " + enchantedPermanent.getLogName() + '.');
enchantedPermanent.removeAttachment(auraSourcePermanent.getId(), game);
return controller.moveCards(game.getCard(source.getSourceId()), Zone.HAND, source, game);
return controller.moveCards(auraSourcePermanent, Zone.HAND, source, game);
}
}
}

View file

@ -120,9 +120,13 @@ class NinjutsuEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Card card = game.getCard(source.getSourceId());
if (card != null) {
card.putOntoBattlefield(game, Zone.HAND, source.getSourceId(), source.getControllerId());
controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
UUID defendingPlayerId = null;
@ -133,7 +137,6 @@ class NinjutsuEffect extends OneShotEffect {
}
if (defendingPlayerId != null) {
game.getCombat().addAttackerToCombat(permanent.getId(), defendingPlayerId, game);
permanent.setTapped(true);
return true;
}
}

View file

@ -71,6 +71,13 @@ public final class StaticFilters {
static {
FILTER_CARD_CREATURE.setLockedFilter(true);
}
public static final FilterCreatureCard FILTER_CARD_CREATURE_A = new FilterCreatureCard("a creature card");
static {
FILTER_CARD_CREATURE_A.setLockedFilter(true);
}
public static final FilterCreatureCard FILTER_CARD_CREATURE_YOUR_GRAVEYARD = new FilterCreatureCard("creature card from your graveyard");
static {
@ -88,6 +95,12 @@ public final class StaticFilters {
static {
FILTER_CARD_LAND.setLockedFilter(true);
}
public static final FilterLandCard FILTER_CARD_LAND_A = new FilterLandCard("a land card");
static {
FILTER_CARD_LAND_A.setLockedFilter(true);
}
public static final FilterNonlandCard FILTER_CARD_NON_LAND = new FilterNonlandCard();
static {
@ -292,6 +305,12 @@ public final class StaticFilters {
FILTER_BASIC_LAND_CARD.setLockedFilter(true);
}
public static final FilterBasicLandCard FILTER_BASIC_LAND_CARD_A = new FilterBasicLandCard("a basic land card");
static {
FILTER_BASIC_LAND_CARD_A.setLockedFilter(true);
}
// Used for sacrifice targets that don't need the "you control" text
public static final FilterControlledLandPermanent FILTER_CONTROLLED_LAND_SHORT_TEXT = new FilterControlledLandPermanent("a land");

View file

@ -152,7 +152,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
this.blocking = permanent.blocking;
this.maxBlocks = permanent.maxBlocks;
this.deathtouched = permanent.deathtouched;
// this.attachments.addAll(permanent.attachments);
for (Map.Entry<String, List<UUID>> entry : permanent.connectedCards.entrySet()) {
this.connectedCards.put(entry.getKey(), entry.getValue());
}
@ -696,7 +696,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
for (Iterator<Effect> ite = ability.getEffects(game, EffectType.CONTINUOUS).iterator(); ite.hasNext();) {
ContinuousEffect effect = (ContinuousEffect) ite.next();
game.getContinuousEffects().setOrder(effect);
// It's important is to update timestamp of the copied effect in ContinuousEffects because it does the action
// It's important to update the timestamp of the copied effect in ContinuousEffects because it does the action
for (ContinuousEffect conEffect : game.getContinuousEffects().getLayeredEffects(game)) {
if (conEffect.getId().equals(effect.getId())) {
game.getContinuousEffects().setOrder(conEffect);