Merge pull request #4940 from magefree/master

merge
This commit is contained in:
theelk801 2018-05-14 14:08:30 -04:00 committed by GitHub
commit fbde510bac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
935 changed files with 13628 additions and 12155 deletions

View file

@ -52,7 +52,7 @@ import mage.target.targetpointer.FixedTarget;
public class AbbotOfKeralKeep extends CardImpl {
public AbbotOfKeralKeep(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{R}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.MONK);
this.power = new MageInt(2);
@ -97,7 +97,7 @@ class AbbotOfKeralKeepExileEffect extends OneShotEffect {
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (sourcePermanent != null && controller != null && controller.getLibrary().hasCards()) {
Library library = controller.getLibrary();
Card card = library.removeFromTop(game);
Card card = library.getFromTop(game);
if (card != null) {
String exileName = sourcePermanent.getIdName() + " <this card may be played the turn it was exiled>";
controller.moveCardsToExile(card, source, game, true, source.getSourceId(), exileName);

View file

@ -51,7 +51,7 @@ import mage.players.Player;
public class Abundance extends CardImpl {
public Abundance(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{G}{G}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}{G}");
// If you would draw a card, you may instead choose land or nonland and reveal cards from the top of your library until you reveal a card of the chosen kind. Put that card into your hand and put all other cards revealed this way on the bottom of your library in any order.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AbundanceReplacementEffect()));
@ -94,22 +94,29 @@ class AbundanceReplacementEffect extends ReplacementEffectImpl {
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
FilterCard filter = new FilterCard();
if (controller.chooseUse(Outcome.Benefit, "Choose land? (No = nonland)", source, game)) {
if (controller.chooseUse(Outcome.Detriment, "Choose card type:",
source.getSourceObject(game).getLogName(), "land", "nonland", source, game)) {
game.informPlayers(controller.getLogName() + "chooses land.");
filter.add(new CardTypePredicate(CardType.LAND));
} else {
game.informPlayers(controller.getLogName() + "chooses nonland.");
filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
}
Cards cards = new CardsImpl();
while (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().removeFromTop(game);
Cards toReveal = new CardsImpl();
Card selectedCard = null;
for (Card card : controller.getLibrary().getCards(game)) {
toReveal.add(card);
if (filter.match(card, source.getSourceId(), source.getControllerId(), game)) {
controller.moveCards(card, Zone.HAND, source, game);
selectedCard = card;
break;
}
cards.add(card);
}
controller.revealCards(sourceObject.getIdName(), cards, game);
controller.putCardsOnBottomOfLibrary(cards, game, source, true);
controller.moveCards(selectedCard, Zone.HAND, source, game);
controller.revealCards(sourceObject.getIdName(), toReveal, game);
toReveal.remove(selectedCard);
controller.putCardsOnBottomOfLibrary(toReveal, game, source, true);
}
return true;
}
@ -124,7 +131,8 @@ class AbundanceReplacementEffect extends ReplacementEffectImpl {
if (event.getPlayerId().equals(source.getControllerId())) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
return player.chooseUse(Outcome.Benefit, "Choose land or nonland?", source, game);
return player.chooseUse(Outcome.Detriment, "Choose:", source.getSourceObject(game).getLogName(),
"land or nonland and reveal cards from the top", "normal card draw", source, game);
}
}
return false;

View file

@ -27,19 +27,21 @@
*/
package mage.cards.a;
import java.util.ArrayList;
import java.util.List;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.players.Library;
import mage.players.Player;
import mage.target.targetpointer.FixedTargets;
/**
*
@ -48,8 +50,7 @@ import mage.players.Player;
public class ActOnImpulse extends CardImpl {
public ActOnImpulse(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{R}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{R}");
// Exile the top three cards of your library. Until end of turn, you may play cards exiled this way.
this.getSpellAbility().addEffect(new ActOnImpulseExileEffect());
@ -66,12 +67,12 @@ public class ActOnImpulse extends CardImpl {
}
class ActOnImpulseExileEffect extends OneShotEffect {
public ActOnImpulseExileEffect() {
super(Outcome.Benefit);
this.staticText = "Exile the top three cards of your library. Until end of turn, you may play cards exiled this way.";
}
public ActOnImpulseExileEffect(final ActOnImpulseExileEffect effect) {
super(effect);
}
@ -80,69 +81,58 @@ class ActOnImpulseExileEffect extends OneShotEffect {
public ActOnImpulseExileEffect copy() {
return new ActOnImpulseExileEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Library library = controller.getLibrary();
List<Card> cards = new ArrayList<>();
int count = Math.min(3, library.size());
for (int i = 0; i < count; i++) {
Card card = library.removeFromTop(game);
if (card != null) {
cards.add(card);
}
}
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
Set<Card> cards = new HashSet<>(controller.getLibrary().getTopCards(game, 3));
if (!cards.isEmpty()) {
List<UUID> cardsId = new ArrayList<>();
controller.moveCardsToExile(cards, source, game, true, source.getSourceId(), sourceObject.getIdName());
// remove cards that could not be moved to exile
for (Card card : cards) {
card.moveToExile(source.getSourceId(), "Act on Impulse", source.getSourceId(), game);
cardsId.add(card.getId());
if (!Zone.EXILED.equals(game.getState().getZone(card.getId()))) {
cards.remove(card);
}
}
if (!cards.isEmpty()) {
ContinuousEffect effect = new ActOnImpulseMayPlayExiledEffect();
effect.setTargetPointer(new FixedTargets(cards, game));
game.addEffect(effect, source);
}
game.addEffect(new ActOnImpulseMayPlayExiledEffect(cardsId), source);
}
return true;
}
return false;
}
}
class ActOnImpulseMayPlayExiledEffect extends AsThoughEffectImpl {
public List<UUID> cards = new ArrayList<>();
public ActOnImpulseMayPlayExiledEffect(List<UUID> cards) {
public ActOnImpulseMayPlayExiledEffect() {
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
this.cards.addAll(cards);
}
public ActOnImpulseMayPlayExiledEffect(final ActOnImpulseMayPlayExiledEffect effect) {
super(effect);
this.cards.addAll(effect.cards);
}
@Override
public ActOnImpulseMayPlayExiledEffect copy() {
return new ActOnImpulseMayPlayExiledEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
Card card = game.getCard(sourceId);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && card != null && game.getState().getZone(sourceId) == Zone.EXILED) {
if (cards.contains(sourceId)) {
return true;
}
}
return false;
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
return affectedControllerId.equals(source.getControllerId())
&& getTargetPointer().getTargets(game, source).contains(objectId);
}
}

View file

@ -87,7 +87,7 @@ class AdNauseamEffect extends OneShotEffect {
return false;
}
while (controller.chooseUse(outcome, message, source, game) && controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().removeFromTop(game);
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
controller.moveCards(card, Zone.HAND, source, game);
int cmc = card.getConvertedManaCost();

View file

@ -35,7 +35,6 @@ import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.constants.SubType;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
@ -44,6 +43,7 @@ import mage.constants.AsThoughEffectType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Library;
@ -103,7 +103,7 @@ class AerialCaravanExileEffect extends OneShotEffect {
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (sourcePermanent != null && controller != null && controller.getLibrary().hasCards()) {
Library library = controller.getLibrary();
Card card = library.removeFromTop(game);
Card card = library.getFromTop(game);
if (card != null) {
String exileName = sourcePermanent.getIdName() + " <this card may be played the turn it was exiled>";
controller.moveCardsToExile(card, source, game, true, source.getSourceId(), exileName);

View file

@ -53,7 +53,7 @@ public class AerieWorshippers extends CardImpl {
this.power = new MageInt(2);
this.toughness = new MageInt(4);
// <i>Inspired</i> - Whenever Aerie Worshipers becomes untapped, you may pay {2}{U}. If you do, create a 2/2 blue Bird enchantment creature token with flying.
// <i>Inspired</i> &mdash; Whenever Aerie Worshipers becomes untapped, you may pay {2}{U}. If you do, create a 2/2 blue Bird enchantment creature token with flying.
this.addAbility(new InspiredAbility(new DoIfCostPaid(new CreateTokenEffect(new AerieWorshippersBirdToken()), new ManaCostsImpl("{2}{U}"))));
}

View file

@ -28,6 +28,7 @@
package mage.cards.a;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.effects.ContinuousEffect;
@ -38,6 +39,7 @@ import mage.cards.*;
import mage.constants.*;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.targetpointer.FixedTarget;
@ -49,8 +51,7 @@ import mage.target.targetpointer.FixedTarget;
public class AethermagesTouch extends CardImpl {
public AethermagesTouch(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{W}{U}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{W}{U}");
// Reveal the top four cards of your library. You may put a creature card from among them onto the battlefield. It gains "At the beginning of your end step, return this creature to its owner's hand." Then put the rest of the cards revealed this way on the bottom of your library in any order.
this.getSpellAbility().addEffect(new AethermagesTouchEffect());
@ -65,12 +66,11 @@ public class AethermagesTouch extends CardImpl {
return new AethermagesTouch(this);
}
}
class AethermagesTouchEffect extends OneShotEffect {
private static final FilterCreatureCard filterPutOntoBattlefield = new FilterCreatureCard("a creature card to put onto the battlefield");
public AethermagesTouchEffect() {
super(Outcome.DrawCard);
super(Outcome.PutCardInPlay);
this.staticText = "Reveal the top four cards of your library. You may put a creature card from among them onto the battlefield. It gains \"At the beginning of your end step, return this creature to its owner's hand.\" Then put the rest of the cards revealed this way on the bottom of your library in any order";
}
@ -85,40 +85,32 @@ class AethermagesTouchEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Cards cards = new CardsImpl();
boolean properCardFound = false;
int count = Math.min(player.getLibrary().size(), 4);
for (int i = 0; i < count; i++) {
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
cards.add(card);
if (filterPutOntoBattlefield.match(card, source.getSourceId(), source.getControllerId(), game)) {
properCardFound = true;
}
}
}
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 4));
if (!cards.isEmpty()) {
player.revealCards("Aethermage's Touch", cards, game);
TargetCard target = new TargetCard(Zone.LIBRARY, filterPutOntoBattlefield);
if (properCardFound && player.choose(Outcome.PutCreatureInPlay, cards, target, game)) {
FilterCreatureCard filter = new FilterCreatureCard("a creature card to put onto the battlefield");
controller.revealCards(sourceObject.getIdName(), cards, game);
TargetCard target = new TargetCard(Zone.LIBRARY, filter);
if (cards.count(filter, game) > 0 && controller.choose(outcome, cards, target, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
cards.remove(card);
if (card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId())) {
if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
// It gains \"At the beginning of your end step, return this creature to its owner's hand.\"
Ability ability = new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new ReturnToHandSourceEffect(true), TargetController.YOU, null, false);
ContinuousEffect effect = new GainAbilityTargetEffect(ability, Duration.Custom);
effect.setTargetPointer(new FixedTarget(card.getId()));
game.addEffect(effect, source);
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) {
Ability ability = new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new ReturnToHandSourceEffect(true), TargetController.YOU, null, false);
ContinuousEffect effect = new GainAbilityTargetEffect(ability, Duration.Custom);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
}
}
}
}
player.putCardsOnBottomOfLibrary(cards, game, source, true);
controller.putCardsOnBottomOfLibrary(cards, game, source, true);
}
return true;

View file

@ -31,7 +31,7 @@ import java.util.UUID;
import mage.MageInt;
import mage.Mana;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.BasicManaEffect;
import mage.abilities.effects.mana.BasicManaEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;

View file

@ -82,7 +82,7 @@ public class AkoumHellkite extends CardImpl {
class AkoumHellkiteTriggeredAbility extends TriggeredAbilityImpl {
private static final String text = "<i>Landfall</i> - Whenever a land enters the battlefield under your control, {this} deals 1 damage to any target. "
private static final String text = "<i>Landfall</i> &mdash; Whenever a land enters the battlefield under your control, {this} deals 1 damage to any target. "
+ "If that land is a Mountain, Akoum Hellkite deals 2 damage to that permanent or player instead.";
public AkoumHellkiteTriggeredAbility() {

View file

@ -65,7 +65,7 @@ public class AkroanConscriptor extends CardImpl {
this.power = new MageInt(3);
this.toughness = new MageInt(2);
// <i>Heroic</i> - Whenever you cast a spell that targets Akroan Conscriptor, gain control of another target creature until end of turn. Untap that creature. It gains haste until end of turn.
// <i>Heroic</i> &mdash; Whenever you cast a spell that targets Akroan Conscriptor, gain control of another target creature until end of turn. Untap that creature. It gains haste until end of turn.
Ability ability = new HeroicAbility(new GainControlTargetEffect(Duration.EndOfTurn, true), false);
Effect effect = new UntapTargetEffect();
effect.setText("Untap that creature");

View file

@ -54,7 +54,7 @@ public class AkroanSkyguard extends CardImpl {
// Flying
this.addAbility(FlyingAbility.getInstance());
// <i>Heroic</i> - Whenever you cast a spell that targets Akroan Skyguard, put a +1/+1 counter on Akroan Skyguard.
// <i>Heroic</i> &mdash; Whenever you cast a spell that targets Akroan Skyguard, put a +1/+1 counter on Akroan Skyguard.
this.addAbility(new HeroicAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(), true)));
}

View file

@ -51,15 +51,14 @@ import mage.target.TargetCard;
public class AladdinsLamp extends CardImpl {
public AladdinsLamp(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{10}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{10}");
// {X}, {tap}: The next time you would draw a card this turn, instead look at the top X cards of your library, put all but one of them on the bottom of your library in a random order, then draw a card. X can't be 0.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AladdinsLampEffect(), new ManaCostsImpl("{X}"));
// {X}, {T}: The next time you would draw a card this turn, instead look at the top X cards of your library, put all but one of them on the bottom of your library in a random order, then draw a card. X can't be 0.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AladdinsLampEffect(), new ManaCostsImpl("{X}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}
public AladdinsLamp(final AladdinsLamp card) {
super(card);
@ -88,53 +87,32 @@ class AladdinsLampEffect extends ReplacementEffectImpl {
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Cards cards = new CardsImpl();
int count = source.getManaCostsToPay().getX();
count = Math.min(player.getLibrary().size(), count);
for (int i = 0; i < count; i++) {
Card card = player.getLibrary().removeFromTop(game);// I'd like to use .getTopCards(game, count), but it returns a set which I dunno how to work with and would break the copied code adding to effort/time;
if (card != null) {
cards.add(card);
}
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, source.getManaCostsToPay().getX()));
controller.lookAtCards(source, null, cards, game);
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to stay at the top of library"));
if (controller.choose(outcome, cards, target, game)) {
cards.remove(target.getFirstTarget());
}
player.lookAtCards("Aladdin's Lamp", cards, game);
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard());
if (player.choose(outcome, cards, target, game)) {
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
cards.remove(card);
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
}
}
// Put the rest on the bottom of your library in a random order
while (!cards.isEmpty()) {
Card card = cards.getRandom(game);
if (card != null) {
cards.remove(card);
card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, false);
}
}
//player.drawCards(1, game); // Technically I should move it to the top and then draw but, I cant confirm that flag above refers to bottom of library
controller.putCardsOnBottomOfLibrary(cards, game, source, false);
game.applyEffects();
controller.drawCards(1, game, event.getAppliedEffects());
discard();
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DRAW_CARD;
}
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return source.getControllerId().equals(event.getPlayerId());
}
}
}

View file

@ -97,7 +97,7 @@ class AliFromCairoReplacementEffect extends ReplacementEffectImpl {
&& (controller.getLife() > 0) &&(controller.getLife() - event.getAmount()) < 1
&& event.getPlayerId().equals(controller.getId())
) {
return true;
return true;
}
}
return false;
@ -106,17 +106,12 @@ class AliFromCairoReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
// 10/1/2008: The ability doesn't change how much damage is dealt;
// it just changes how much life that damage makes you lose.
// An effect such as Spirit Link will see the full amount of damage being dealt.
game.fireEvent(event);
if (controller != null) {
controller.setLife(1, game, source);
// 10/1/2008: The ability doesn't change how much damage is dealt;
// it just changes how much life that damage makes you lose.
// An effect such as Spirit Link will see the full amount of damage being dealt.
event.setAmount(controller.getLife() - 1);
}
return true;
return false;
}
}

View file

@ -72,7 +72,7 @@ class AllianceOfArmsEffect extends OneShotEffect {
public AllianceOfArmsEffect() {
super(Outcome.Detriment);
this.staticText = "<i>Join forces</i> - Starting with you, each player may pay any amount of mana. Each player creates X 1/1 white Soldier creature tokens, where X is the total amount of mana paid this way";
this.staticText = "<i>Join forces</i> &mdash; Starting with you, each player may pay any amount of mana. Each player creates X 1/1 white Soldier creature tokens, where X is the total amount of mana paid this way";
}
public AllianceOfArmsEffect(final AllianceOfArmsEffect effect) {

View file

@ -45,6 +45,7 @@ import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
@ -69,9 +70,12 @@ public class AmbushCommander extends CardImpl {
this.toughness = new MageInt(2);
// Forests you control are 1/1 green Elf creatures that are still lands.
ContinuousEffect effect = new BecomesCreatureAllEffect(new AmbushCommanderToken(), "lands", filter2, Duration.WhileOnBattlefield);
ContinuousEffect effect = new BecomesCreatureAllEffect(
new CreatureToken(1, 1, "1/1 green Elf creature").withColor("G").withSubType(SubType.ELF),
"lands", filter2, Duration.WhileOnBattlefield, true);
effect.getDependencyTypes().add(DependencyType.BecomeForest);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
// {1}{G}, Sacrifice an Elf: Target creature gets +3/+3 until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(3, 3, Duration.EndOfTurn),
new ManaCostsImpl("{1}{G}"));
@ -89,23 +93,3 @@ public class AmbushCommander extends CardImpl {
return new AmbushCommander(this);
}
}
class AmbushCommanderToken extends TokenImpl {
public AmbushCommanderToken() {
super("Elf", "1/1 green Elf creatures");
subtype.add(SubType.ELF);
cardType.add(CardType.CREATURE);
power = new MageInt(1);
toughness = new MageInt(1);
color.setGreen(true);
}
public AmbushCommanderToken(final AmbushCommanderToken token) {
super(token);
}
public AmbushCommanderToken copy() {
return new AmbushCommanderToken(this);
}
}

View file

@ -51,15 +51,14 @@ import mage.target.TargetCard;
public class AncestralKnowledge extends CardImpl {
public AncestralKnowledge(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{U}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
// Cumulative upkeep {1}
this.addAbility(new CumulativeUpkeepAbility(new ManaCostsImpl<>("{1}")));
// When Ancestral Knowledge enters the battlefield, look at the top ten cards of your library, then exile any number of them and put the rest back on top of your library in any order.
this.addAbility(new EntersBattlefieldTriggeredAbility(new AncestralKnowledgeEffect()));
// When Ancestral Knowledge leaves the battlefield, shuffle your library.
this.addAbility(new LeavesBattlefieldTriggeredAbility(new ShuffleLibrarySourceEffect(), false));
}
@ -75,53 +74,34 @@ public class AncestralKnowledge extends CardImpl {
}
class AncestralKnowledgeEffect extends OneShotEffect {
AncestralKnowledgeEffect() {
super(Outcome.Benefit);
this.staticText = "look at the top ten cards of your library, then exile any number of them and put the rest back on top of your library in any order";
}
AncestralKnowledgeEffect(final AncestralKnowledgeEffect effect) {
super(effect);
}
@Override
public AncestralKnowledgeEffect copy() {
return new AncestralKnowledgeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
int numCards = Math.min(10, player.getLibrary().size());
if (numCards > 0) {
Cards cards = new CardsImpl();
for (int i = 0; i < numCards; i++) {
cards.add(player.getLibrary().removeFromTop(game));
}
TargetCard target = new TargetCard(0, numCards, Zone.LIBRARY, new FilterCard("cards to exile"));
player.choose(Outcome.Exile, cards, target, game);
for (UUID cardId : target.getTargets()) {
Card card = cards.get(cardId, game);
if (card != null) {
player.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, true);
cards.remove(card);
}
}
while (cards.size() > 1) {
target = new TargetCard(1, Zone.LIBRARY, new FilterCard("card to put on top of library (last put is first drawn)"));
player.choose(Outcome.Benefit, cards, target, game);
Card card = cards.get(target.getFirstTarget(), game);
player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, true, false);
cards.remove(card);
}
if (cards.size() == 1) {
Card card = cards.get(cards.iterator().next(), game);
if (card != null) {
player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, true, false);
}
}
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 10));
if (cards.size() > 0) {
controller.lookAtCards(source, null, cards, game);
TargetCard target = new TargetCard(0, Integer.MAX_VALUE, Zone.LIBRARY, new FilterCard("cards to exile"));
controller.choose(Outcome.Exile, cards, target, game);
Cards toExile = new CardsImpl(target.getTargets());
controller.moveCards(toExile, Zone.EXILED, source, game);
cards.removeAll(toExile);
controller.putCardsOnTopOfLibrary(cards, game, source, true);
}
return true;
}

View file

@ -27,19 +27,21 @@
*/
package mage.cards.a;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.cards.*;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import java.util.UUID;
/**
*
* @author Quercitron
@ -47,11 +49,11 @@ import java.util.UUID;
public class AncestralMemories extends CardImpl {
public AncestralMemories(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{U}{U}{U}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}{U}{U}");
// Look at the top seven cards of your library. Put two of them into your hand and the rest into your graveyard.
this.getSpellAbility().addEffect(new AncestralMemoriesEffect());
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(new StaticValue(7), false, new StaticValue(2),
StaticFilters.FILTER_CARD, Zone.GRAVEYARD, false, false, false, Zone.HAND, false));
}
public AncestralMemories(final AncestralMemories card) {
@ -82,32 +84,18 @@ class AncestralMemoriesEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Cards cards = new CardsImpl();
int cardsCount = Math.min(7, player.getLibrary().size());
for (int i = 0; i < cardsCount; i++) {
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
cards.add(card);
}
}
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 7));
if (!cards.isEmpty()) {
player.lookAtCards("Ancestral Memories", cards, game);
controller.lookAtCards(source, null, cards, game);
TargetCard target = new TargetCard(Math.min(2, cards.size()), Zone.LIBRARY, new FilterCard("two cards to put in your hand"));
if (player.choose(Outcome.Benefit, cards, target, game)) {
for (UUID targetId : target.getTargets()) {
Card card = cards.get(targetId, game);
if (card != null) {
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
cards.remove(card);
}
}
if (controller.choose(Outcome.DrawCard, cards, target, game)) {
Cards toHand = new CardsImpl(target.getTargets());
controller.moveCards(cards, Zone.HAND, source, game);
cards.removeAll(toHand);
}
player.moveCards(cards, Zone.GRAVEYARD, source, game);
controller.moveCards(cards, Zone.GRAVEYARD, source, game);
}
return true;
}

View file

@ -29,7 +29,7 @@ package mage.cards.a;
import java.util.UUID;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.AddManaOfAnyColorEffect;
import mage.abilities.effects.mana.AddManaOfAnyColorEffect;
import mage.abilities.mana.ConditionalAnyColorManaAbility;
import mage.abilities.mana.SimpleManaAbility;
import mage.abilities.mana.conditional.ConditionalSpellManaBuilder;

View file

@ -38,7 +38,6 @@ import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.keyword.FlashbackAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -63,7 +62,7 @@ public class AngelOfJubilation extends CardImpl {
}
public AngelOfJubilation(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{W}{W}{W}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{W}{W}");
this.subtype.add(SubType.ANGEL);
this.power = new MageInt(3);
@ -117,36 +116,36 @@ class AngelOfJubilationEffect extends ContinuousEffectImpl {
class AngelOfJubilationSacrificeFilterEffect extends CostModificationEffectImpl {
public AngelOfJubilationSacrificeFilterEffect() {
public AngelOfJubilationSacrificeFilterEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment, CostModificationType.SET_COST);
staticText = "Players can't pay life or sacrifice creatures to cast spells or activate abilities";
}
}
protected AngelOfJubilationSacrificeFilterEffect(AngelOfJubilationSacrificeFilterEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
for (Cost cost : abilityToModify.getCosts()) {
if(cost instanceof SacrificeTargetCost) {
SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost;
Filter filter = sacrificeCost.getTargets().get(0).getFilter();
filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE)));
}
}
if (cost instanceof SacrificeTargetCost) {
SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost;
Filter filter = sacrificeCost.getTargets().get(0).getFilter();
filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE)));
}
}
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
return abilityToModify.getAbilityType() == AbilityType.ACTIVATED ||
abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility;
return abilityToModify.getAbilityType() == AbilityType.ACTIVATED
|| abilityToModify instanceof SpellAbility;
}
@Override
public AngelOfJubilationSacrificeFilterEffect copy() {
return new AngelOfJubilationSacrificeFilterEffect(this);
}
@Override
public AngelOfJubilationSacrificeFilterEffect copy() {
return new AngelOfJubilationSacrificeFilterEffect(this);
}
}

View file

@ -28,6 +28,7 @@
package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.CreatureEntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
@ -39,18 +40,23 @@ import mage.constants.Duration;
import mage.constants.SubType;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
/**
*
* @author Loki
*/
public class AngelsTomb extends CardImpl {
public AngelsTomb(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
// Whenever a creature enters the battlefield under your control, you may have Angel's Tomb become a 3/3 white Angel artifact creature with flying until end of turn.
this.addAbility(new CreatureEntersBattlefieldTriggeredAbility(new BecomesCreatureSourceEffect(new AngelTombToken(), "", Duration.EndOfTurn), true));
this.addAbility(new CreatureEntersBattlefieldTriggeredAbility(new BecomesCreatureSourceEffect(
new CreatureToken(3, 3, "3/3 white Angel artifact creature with flying")
.withColor("W")
.withSubType(SubType.ANGEL)
.withAbility(FlyingAbility.getInstance()),
"", Duration.EndOfTurn), true));
}
public AngelsTomb(final AngelsTomb card) {
@ -61,26 +67,4 @@ public class AngelsTomb extends CardImpl {
public AngelsTomb copy() {
return new AngelsTomb(this);
}
}
class AngelTombToken extends TokenImpl {
public AngelTombToken() {
super("", "3/3 white Angel artifact creature with flying");
cardType.add(CardType.ARTIFACT);
cardType.add(CardType.CREATURE);
color.setWhite(true);
subtype.add(SubType.ANGEL);
power = new MageInt(3);
toughness = new MageInt(3);
addAbility(FlyingAbility.getInstance());
}
public AngelTombToken(final AngelTombToken token) {
super(token);
}
public AngelTombToken copy() {
return new AngelTombToken(this);
}
}
}

View file

@ -36,9 +36,7 @@ import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.FlashbackAbility;
import mage.abilities.keyword.ProtectionAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
@ -111,15 +109,11 @@ class AnimarCostReductionEffect extends CostModificationEffectImpl {
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility) {
if (abilityToModify instanceof SpellAbility) {
if (abilityToModify.getControllerId().equals(source.getControllerId())) {
Spell spell = (Spell) game.getStack().getStackObject(abilityToModify.getId());
if (spell != null) {
return spell.isCreature();
} else {
// used at least for flashback ability because Flashback ability doesn't use stack or for getPlayables where spell is not cast yet
Card sourceCard = game.getCard(abilityToModify.getSourceId());
return sourceCard != null && sourceCard.isCreature();
}
}
}

View file

@ -36,6 +36,7 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
import mage.target.common.TargetLandPermanent;
/**
@ -48,7 +49,7 @@ public class AnimateLand extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{G}");
// Until end of turn, target land becomes a 3/3 creature that's still a land.
this.getSpellAbility().addEffect(new BecomesCreatureTargetEffect(new AnimatedLand(), false, true, Duration.EndOfTurn));
this.getSpellAbility().addEffect(new BecomesCreatureTargetEffect(new CreatureToken(3, 3), false, true, Duration.EndOfTurn));
this.getSpellAbility().addTarget(new TargetLandPermanent());
}
@ -60,21 +61,4 @@ public class AnimateLand extends CardImpl {
public AnimateLand copy() {
return new AnimateLand(this);
}
}
class AnimatedLand extends TokenImpl {
public AnimatedLand() {
super("", "3/3 creature");
this.cardType.add(CardType.CREATURE);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
}
public AnimatedLand(final AnimatedLand token) {
super(token);
}
public AnimatedLand copy() {
return new AnimatedLand(this);
}
}
}

View file

@ -81,7 +81,7 @@ class AnthemOfRakdosHellbentEffect extends ReplacementEffectImpl {
public AnthemOfRakdosHellbentEffect() {
super(Duration.WhileOnBattlefield, Outcome.Damage);
staticText = "<i>Hellbent</i> - As long as you have no cards in hand, if a source you control would deal damage to a permanent or player, it deals double that damage to that permanent or player instead.";
staticText = "<i>Hellbent</i> &mdash; As long as you have no cards in hand, if a source you control would deal damage to a permanent or player, it deals double that damage to that permanent or player instead.";
}
public AnthemOfRakdosHellbentEffect(final AnthemOfRakdosHellbentEffect effect) {

View file

@ -41,6 +41,7 @@ import mage.constants.SuperType;
import mage.filter.common.FilterControlledLandPermanent;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
import mage.target.common.TargetControlledPermanent;
/**
@ -58,8 +59,8 @@ public class AnthousaSetessanHero extends CardImpl {
this.power = new MageInt(4);
this.toughness = new MageInt(5);
// <i>Heroic</i> - Whenever you cast a spell that targets Anthousa, Setessan Hero, up to three target lands you control each become 2/2 Warrior creatures until end of turn. They're still lands.
Ability ability = new HeroicAbility(new BecomesCreatureTargetEffect(new AnthousaWarriorToken(), false, true, Duration.EndOfTurn));
// <i>Heroic</i> &mdash; Whenever you cast a spell that targets Anthousa, Setessan Hero, up to three target lands you control each become 2/2 Warrior creatures until end of turn. They're still lands.
Ability ability = new HeroicAbility(new BecomesCreatureTargetEffect(new CreatureToken(2, 2, "2/2 Warrior creature", SubType.WARRIOR),false,true, Duration.EndOfTurn));
ability.addTarget(new TargetControlledPermanent(0,3,new FilterControlledLandPermanent("lands"), false));
this.addAbility(ability);
}
@ -72,23 +73,4 @@ public class AnthousaSetessanHero extends CardImpl {
public AnthousaSetessanHero copy() {
return new AnthousaSetessanHero(this);
}
}
class AnthousaWarriorToken extends TokenImpl {
public AnthousaWarriorToken() {
super("", "2/2 Warrior creatures");
cardType.add(CardType.CREATURE);
subtype.add(SubType.WARRIOR);
power = new MageInt(2);
toughness = new MageInt(2);
}
public AnthousaWarriorToken(final AnthousaWarriorToken token) {
super(token);
}
public AnthousaWarriorToken copy() {
return new AnthousaWarriorToken(this);
}
}

View file

@ -0,0 +1,114 @@
/*
* 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.cards.a;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.CantBeTargetedAttachedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterSpell;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author MTGfan & L_J
*/
public class AntiMagicAura extends CardImpl {
public AntiMagicAura(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}");
this.subtype.add(SubType.AURA);
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Enchanted creature can't be the target of spells and can't be enchanted by other Auras.
CantBeTargetedAttachedEffect cantTargetEffect = new CantBeTargetedAttachedEffect(new FilterSpell("spells"), Duration.WhileOnBattlefield, AttachmentType.AURA, TargetController.ANY);
Ability ability2 = new SimpleStaticAbility(Zone.BATTLEFIELD, cantTargetEffect);
ability2.addEffect(new AntiMagicAuraRuleEffect());
this.addAbility(ability2);
}
public AntiMagicAura(final AntiMagicAura card) {
super(card);
}
@Override
public AntiMagicAura copy() {
return new AntiMagicAura(this);
}
}
// 9/25/2006 ruling: If Consecrate Land enters the battlefield attached to a land thats enchanted by other Auras, those Auras are put into their owners graveyards.
class AntiMagicAuraRuleEffect extends ContinuousRuleModifyingEffectImpl {
public AntiMagicAuraRuleEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
staticText = "and can't be enchanted by other Auras";
}
public AntiMagicAuraRuleEffect(final AntiMagicAuraRuleEffect effect) {
super(effect);
}
@Override
public AntiMagicAuraRuleEffect copy() {
return new AntiMagicAuraRuleEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == EventType.ATTACH || event.getType() == EventType.STAY_ATTACHED;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent sourceObject = game.getPermanent(source.getSourceId());
if (sourceObject != null && sourceObject.getAttachedTo() != null) {
if (event.getTargetId().equals(sourceObject.getAttachedTo())) {
return !event.getSourceId().equals(source.getSourceId());
}
}
return false;
}
}

View file

@ -79,29 +79,7 @@ class ApproachOfTheSecondSunEffect extends OneShotEffect {
}
Card spellCard = game.getStack().getSpell(source.getSourceId()).getCard();
if (spellCard != null) {
List<Card> top6 = new ArrayList<>();
// Cut the top 6 cards off into a temporary array
for (int i = 0; i < 6 && controller.getLibrary().hasCards(); ++i) {
top6.add(controller.getLibrary().removeFromTop(game));
}
// Is the library now empty, thus the rise is on the bottom (for the message to the players)?
boolean isOnBottom = controller.getLibrary().size() < 6;
// Put this card (if the ability came from an ApproachOfTheSecondSun spell card) on top
spellCard.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
// put the top 6 we took earlier back on top (going in reverse order this time to get them back
// on top in the proper order)
for (int i = top6.size() - 1; i >= 0; --i) {
controller.getLibrary().putOnTop(top6.get(i), game);
}
// Inform the players
if (isOnBottom) {
game.informPlayers(controller.getLogName() + " puts " + spell.getLogName() + " on the bottom of their library.");
} else {
game.informPlayers(controller.getLogName() + " puts " + spell.getLogName() + " into their library 7th from the top.");
}
controller.putCardOnTopXOfLibrary(spellCard, game, source, 7);
}
}
return true;

View file

@ -85,7 +85,7 @@ public class ArahboRoarOfTheWorld extends CardImpl {
Ability ability = new ConditionalTriggeredAbility(
new BeginningOfCombatTriggeredAbility(Zone.ALL, new BoostTargetEffect(3, 3, Duration.EndOfTurn), TargetController.YOU, false, false),
SourceOnBattlefieldOrCommandZoneCondition.instance,
"<i>Eminence</i> - At the beginning of combat on your turn, if Arahbo, Roar of the World is in the command zone or on the battlefield, another target Cat you control gets +3/+3 until end of turn.");
"<i>Eminence</i> &mdash; At the beginning of combat on your turn, if Arahbo, Roar of the World is in the command zone or on the battlefield, another target Cat you control gets +3/+3 until end of turn.");
ability.addTarget(new TargetCreaturePermanent(filter));
ability.setAbilityWord(AbilityWord.EMINENCE);
this.addAbility(ability);

View file

@ -38,7 +38,7 @@ import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.InspiredAbility;
import mage.cards.*;
import mage.constants.*;
import mage.counters.Counter;
import mage.counters.CounterType;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
@ -62,7 +62,7 @@ public class ArbiterOfTheIdeal extends CardImpl {
// Flying
this.addAbility(FlyingAbility.getInstance());
// <i>Inspired</i> - Whenever Arbiter of the Ideal becomes untapped, reveal the top card of your library. If it's an artifact, creature, or land card, you may put it onto the battlefield with a manifestation counter on it. It's an enchantment in addition to its other types.
// <i>Inspired</i> &mdash; Whenever Arbiter of the Ideal becomes untapped, reveal the top card of your library. If it's an artifact, creature, or land card, you may put it onto the battlefield with a manifestation counter on it. It's an enchantment in addition to its other types.
this.addAbility(new InspiredAbility(new ArbiterOfTheIdealEffect()));
}
@ -116,7 +116,7 @@ class ArbiterOfTheIdealEffect extends OneShotEffect {
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) {
permanent.addCounters(new Counter("Manifestation"), source, game);
permanent.addCounters(CounterType.MANIFESTATION.createInstance(), source, game);
ContinuousEffect effect = new AddCardTypeTargetEffect(Duration.Custom, CardType.ENCHANTMENT);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);

View file

@ -32,7 +32,6 @@ import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -82,7 +81,7 @@ class ArcaneMeleeCostReductionEffect extends CostModificationEffectImpl {
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility) {
if (abilityToModify instanceof SpellAbility) {
Card sourceCard = game.getCard((abilityToModify).getSourceId());
if (sourceCard != null && (sourceCard.isInstant() || sourceCard.isSorcery())) {
return true;

View file

@ -49,7 +49,7 @@ import mage.target.TargetPlayer;
public class ArchitectsOfWill extends CardImpl {
public ArchitectsOfWill(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{2}{U}{B}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}{U}{B}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WIZARD);
@ -95,19 +95,11 @@ class ArchitectsOfWillEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Player targetPlayer = game.getPlayer(source.getFirstTarget());
if (targetPlayer == null
|| controller == null) {
if (targetPlayer == null || controller == null) {
return false;
}
Cards cards = new CardsImpl();
int count = Math.min(targetPlayer.getLibrary().size(), 3);
for (int i = 0; i < count; i++) {
Card card = targetPlayer.getLibrary().removeFromTop(game);
if (card != null) {
cards.add(card);
}
}
controller.lookAtCards("Architects of Will", cards, game);
Cards cards = new CardsImpl(targetPlayer.getLibrary().getTopCards(game, 3));
controller.lookAtCards(source, null, cards, game);
controller.putCardsOnTopOfLibrary(cards, game, source, true);
return true;
}

View file

@ -58,7 +58,7 @@ public class ArtisanOfForms extends CardImpl {
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// <i>Heroic</i> - Whenever you cast a spell that targets Artisan of Forms, you may have Artisan of Forms become a copy of target creature and gain this ability.
// <i>Heroic</i> &mdash; Whenever you cast a spell that targets Artisan of Forms, you may have Artisan of Forms become a copy of target creature and gain this ability.
Effect effect = new CopyPermanentEffect(StaticFilters.FILTER_PERMANENT_CREATURE, new ArtisanOfFormsApplyToPermanent(), true);
effect.setText("have {this} become a copy of target creature and gain this ability");
Ability ability = new HeroicAbility(effect, true);

View file

@ -51,7 +51,7 @@ public class AshioksAdept extends CardImpl {
this.power = new MageInt(1);
this.toughness = new MageInt(3);
// <i>Heroic</i> - Whenever you cast a spell that targets Ashiok's Adept, each opponent discards a card.
// <i>Heroic</i> &mdash; Whenever you cast a spell that targets Ashiok's Adept, each opponent discards a card.
this.addAbility(new HeroicAbility(new DiscardEachPlayerEffect(TargetController.OPPONENT)));
}

View file

@ -30,7 +30,6 @@ package mage.cards.a;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
@ -44,9 +43,7 @@ import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
import mage.target.TargetCard;
import mage.target.TargetPlayer;
@ -57,7 +54,7 @@ import mage.target.TargetPlayer;
public class AshnodsCylix extends CardImpl {
public AshnodsCylix(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
// {3}, {T}: Target player looks at the top three cards of their library, puts one of them back on top of their library, then exiles the rest.
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AshnodsCylixEffect(), new GenericManaCost(3));
@ -77,49 +74,38 @@ public class AshnodsCylix extends CardImpl {
}
class AshnodsCylixEffect extends OneShotEffect {
AshnodsCylixEffect() {
super(Outcome.Benefit);
this.staticText = "Target player looks at the top three cards of their library, puts one of them back on top of their library, then exiles the rest";
}
AshnodsCylixEffect(final AshnodsCylixEffect effect) {
super(effect);
}
@Override
public AshnodsCylixEffect copy() {
return new AshnodsCylixEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
if (player == null) {
return false;
}
Cards cards = new CardsImpl();
int count = Math.min(player.getLibrary().size(), 3);
for (int i = 0; i < count; i++) {
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
cards.add(card);
}
}
//~ player.revealCards(source.getSourceObject(game).getIdName(), cards, game);
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 3));
player.lookAtCards(source, null, cards, game);
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put on top of your library"));
if (player.choose(Outcome.DrawCard, cards, target, game)) {
if (player.choose(Outcome.Benefit, cards, target, game)) {
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
cards.remove(card);
player.getLibrary().putOnTop(card, game);
game.informPlayers(source.getSourceObject(game).getIdName() + ": " + player.getLogName() + " puts a card on top of their library");
game.informPlayers(source.getSourceObject(game).getIdName() + ": " + player.getLogName() + " puts a card back on top of their library");
}
}
for (UUID cardId : cards) {
Card card = game.getCard(cardId);
card.moveToExile(null, "", source.getSourceId(), game);
}
player.moveCards(cards, Zone.EXILED, source, game);
return true;
}
}

View file

@ -27,7 +27,6 @@
*/
package mage.cards.a;
import java.util.List;
import java.util.UUID;
import mage.Mana;
import mage.abilities.Ability;
@ -35,7 +34,7 @@ import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect;
import mage.abilities.effects.common.ManaEffect;
import mage.abilities.mana.ActivatedManaAbilityImpl;
import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.choices.ChoiceColor;
@ -53,13 +52,13 @@ import mage.players.Player;
public class AstralCornucopia extends CardImpl {
public AstralCornucopia(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{X}{X}{X}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{X}{X}{X}");
// Astral Cornucopia enters the battlefield with X charge counters on it.
this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.CHARGE.createInstance())));
// {T}: Choose a color. Add one mana of that color for each charge counter on Astral Cornucopia.
this.addAbility(new AstralCornucopiaManaAbility());
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new AstralCornucopiaManaEffect(), new TapSourceCost()));
}
public AstralCornucopia(final AstralCornucopia card) {
@ -72,35 +71,6 @@ public class AstralCornucopia extends CardImpl {
}
}
class AstralCornucopiaManaAbility extends ActivatedManaAbilityImpl {
public AstralCornucopiaManaAbility() {
super(Zone.BATTLEFIELD, new AstralCornucopiaManaEffect(), new TapSourceCost());
}
public AstralCornucopiaManaAbility(final AstralCornucopiaManaAbility ability) {
super(ability);
}
@Override
public AstralCornucopiaManaAbility copy() {
return new AstralCornucopiaManaAbility(this);
}
@Override
public List<Mana> getNetMana(Game game) {
netMana.clear();
Permanent sourcePermanent = game.getPermanent(getSourceId());
if (sourcePermanent != null) {
int counters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE.getName());
if (counters > 0) {
netMana.add(new Mana(0, 0, 0, 0, 0, 0, counters, 0));
}
}
return netMana;
}
}
class AstralCornucopiaManaEffect extends ManaEffect {
private final Mana computedMana;
@ -125,42 +95,55 @@ class AstralCornucopiaManaEffect extends ManaEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
ChoiceColor choice = new ChoiceColor();
choice.setMessage("Choose a color to add mana of that color");
if (controller.choose(outcome, choice, game)) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (choice.getChoice() != null) {
String color = choice.getChoice();
int counters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE.getName());
switch (color) {
case "Red":
computedMana.setRed(counters);
break;
case "Blue":
computedMana.setBlue(counters);
break;
case "White":
computedMana.setWhite(counters);
break;
case "Black":
computedMana.setBlack(counters);
break;
case "Green":
computedMana.setGreen(counters);
break;
}
}
checkToFirePossibleEvents(computedMana, game, source);
controller.getManaPool().addMana(computedMana, game, source);
return true;
}
checkToFirePossibleEvents(getMana(game, source), game, source);
controller.getManaPool().addMana(getMana(game, source), game, source);
return true;
}
return false;
}
@Override
public Mana getMana(Game game, Ability source) {
return null;
public Mana produceMana(boolean netMana, Game game, Ability source) {
Mana mana = new Mana();
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (sourcePermanent != null) {
int counters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE.getName());
if (counters > 0) {
if (netMana) {
return new Mana(0, 0, 0, 0, 0, 0, counters, 0);
}
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
ChoiceColor choice = new ChoiceColor();
choice.setMessage("Choose a color to add mana of that color");
if (controller.choose(outcome, choice, game)) {
if (choice.getChoice() != null) {
String color = choice.getChoice();
switch (color) {
case "Red":
mana.setRed(counters);
break;
case "Blue":
mana.setBlue(counters);
break;
case "White":
mana.setWhite(counters);
break;
case "Black":
mana.setBlack(counters);
break;
case "Green":
mana.setGreen(counters);
break;
}
}
}
}
}
}
return mana;
}
}

View file

@ -32,7 +32,7 @@ import mage.abilities.common.delayed.AtTheBeginOfNextUpkeepDelayedTriggeredAbili
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.AddManaOfAnyColorEffect;
import mage.abilities.effects.mana.AddManaOfAnyColorEffect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.mana.SimpleManaAbility;

View file

@ -51,7 +51,7 @@ public class AtarkaBeastbreaker extends CardImpl {
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// <i>Formidable</i> - {4}{G}: Atarka Beastbreaker gets +4/+4 until end of turn. Activate this only if creatures you control have total power 8 or greater.
// <i>Formidable</i> &mdash; {4}{G}: Atarka Beastbreaker gets +4/+4 until end of turn. Activate this only if creatures you control have total power 8 or greater.
Ability ability = new ActivateIfConditionActivatedAbility(
Zone.BATTLEFIELD,
new BoostSourceEffect(4,4, Duration.EndOfTurn),

View file

@ -28,6 +28,7 @@
package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -43,23 +44,28 @@ import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
/**
*
* @author fireshoes
*/
public class AtarkaMonument extends CardImpl {
public AtarkaMonument(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
// {T}: Add {R} or {G}.
this.addAbility(new RedManaAbility());
this.addAbility(new GreenManaAbility());
// {4}{R}{G}: Atarka Monument becomes a 4/4 red and green Dragon artifact creature with flying until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect
(new AtarkaMonumentToken(), "", Duration.EndOfTurn), new ManaCostsImpl("{4}{R}{G}")));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(
new CreatureToken(4, 4, "4/4 red and green Dragon artifact creature with flying")
.withColor("RG")
.withSubType(SubType.DRAGON)
.withType(CardType.ARTIFACT)
.withAbility(FlyingAbility.getInstance()),
"", Duration.EndOfTurn), new ManaCostsImpl("{4}{R}{G}")));
}
public AtarkaMonument(final AtarkaMonument card) {
@ -70,25 +76,4 @@ public class AtarkaMonument extends CardImpl {
public AtarkaMonument copy() {
return new AtarkaMonument(this);
}
private static class AtarkaMonumentToken extends TokenImpl {
AtarkaMonumentToken() {
super("", "4/4 red and green Dragon artifact creature with flying");
cardType.add(CardType.ARTIFACT);
cardType.add(CardType.CREATURE);
color.setRed(true);
color.setGreen(true);
this.subtype.add(SubType.DRAGON);
power = new MageInt(4);
toughness = new MageInt(4);
this.addAbility(FlyingAbility.getInstance());
}
public AtarkaMonumentToken(final AtarkaMonumentToken token) {
super(token);
}
public AtarkaMonumentToken copy() {
return new AtarkaMonumentToken(this);
}
}
}
}

View file

@ -60,7 +60,7 @@ public class AtarkaPummeler extends CardImpl {
this.power = new MageInt(4);
this.toughness = new MageInt(5);
// <i>Formidable</i> - {3}{R}{R}: Creatures you control gain menace until end of turn. Activate this ability only if creature you control have total power 8 or greater. (They can't be blocked except by two or more creatures.)
// <i>Formidable</i> &mdash; {3}{R}{R}: Creatures you control gain menace until end of turn. Activate this ability only if creature you control have total power 8 or greater. (They can't be blocked except by two or more creatures.)
Ability ability = new ActivateIfConditionActivatedAbility(
Zone.BATTLEFIELD,
new GainAbilityAllEffect(new MenaceAbility(), Duration.EndOfTurn, filter),

View file

@ -29,7 +29,6 @@ package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
@ -48,7 +47,7 @@ import mage.players.Player;
public class AuguryAdept extends CardImpl {
public AuguryAdept(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{W/U}{W/U}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W/U}{W/U}");
this.subtype.add(SubType.KITHKIN);
this.subtype.add(SubType.WIZARD);
@ -87,22 +86,18 @@ class AuguryAdeptEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
MageObject sourceObject = game.getObject(source.getSourceId());
Player controller = game.getPlayer(source.getControllerId());
if (controller == null || sourceObject == null) {
if (controller == null) {
return false;
}
Cards cards = new CardsImpl();
Card card = controller.getLibrary().removeFromTop(game);
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
card.moveToZone(Zone.HAND, source.getSourceId(), game, true);
int cmc = card.getConvertedManaCost();
if (cmc > 0) {
controller.gainLife(cmc, game, source);
}
cards.add(card);
controller.revealCards(sourceObject.getName(), cards, game);
controller.revealCards(source, new CardsImpl(card), game);
}
return true;
}

View file

@ -42,8 +42,7 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.MulticoloredPredicate;
import mage.filter.StaticFilters;
import mage.target.common.TargetAnyTarget;
/**
@ -52,14 +51,8 @@ import mage.target.common.TargetAnyTarget;
*/
public class AuroraEidolon extends CardImpl {
private static final FilterSpell filter = new FilterSpell("a multicolored spell");
static {
filter.add(new MulticoloredPredicate());
}
public AuroraEidolon(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}");
this.subtype.add(SubType.SPIRIT);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
@ -70,7 +63,7 @@ public class AuroraEidolon extends CardImpl {
ability.addTarget(new TargetAnyTarget());
this.addAbility(ability);
// Whenever you cast a multicolored spell, you may return Aurora Eidolon from your graveyard to your hand.
this.addAbility(new SpellCastControllerTriggeredAbility(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToHandEffect(), filter, true, false));
this.addAbility(new SpellCastControllerTriggeredAbility(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToHandEffect(), StaticFilters.FILTER_SPELL_A_MULTICOLORED, true, false));
}
public AuroraEidolon(final AuroraEidolon card) {

View file

@ -36,7 +36,6 @@ import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.AdjustingSourceCosts;
import mage.abilities.effects.common.combat.CanBlockAdditionalCreatureEffect;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.keyword.FlashbackAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -52,7 +51,7 @@ import mage.util.CardUtil;
public class AvatarOfHope extends CardImpl {
public AvatarOfHope(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{6}{W}{W}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{6}{W}{W}");
this.subtype.add(SubType.AVATAR);
this.power = new MageInt(4);
@ -93,7 +92,7 @@ class AdjustingCostsAbility extends SimpleStaticAbility implements AdjustingSour
@Override
public String getRule() {
return "If you have 3 or less life, Avatar of Hope costs {6} less to cast";
return "If you have 3 or less life, {this} costs {6} less to cast";
}
@Override
@ -101,7 +100,7 @@ class AdjustingCostsAbility extends SimpleStaticAbility implements AdjustingSour
if (ability.getAbilityType() == AbilityType.SPELL) {
Player player = game.getPlayer(ability.getControllerId());
if (player != null && player.getLife() < 4) {
CardUtil.adjustCost((SpellAbility)ability, 6);
CardUtil.adjustCost((SpellAbility) ability, 6);
}
}
}
@ -119,10 +118,10 @@ class AdjustingCostsEffect extends CostModificationEffectImpl {
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
SpellAbility spellAbility = (SpellAbility)abilityToModify;
SpellAbility spellAbility = (SpellAbility) abilityToModify;
Mana mana = spellAbility.getManaCostsToPay().getMana();
Player player = game.getPlayer(source.getControllerId());
if (mana.getGeneric() > 0 && player != null && player.getLife() < 4) {
int newCount = mana.getGeneric() - 6;
if (newCount < 0) {
@ -137,7 +136,7 @@ class AdjustingCostsEffect extends CostModificationEffectImpl {
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if ((abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility)
if ((abilityToModify instanceof SpellAbility)
&& abilityToModify.getSourceId().equals(source.getSourceId())) {
return true;
}

View file

@ -0,0 +1,97 @@
/*
* 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.cards.a;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.condition.common.CardsInControllerGraveCondition;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.effects.common.continuous.GainProtectionFromColorAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.filter.StaticFilters;
import mage.game.Game;
/**
*
* @author TheElk801
*/
public class AvenWarcraft extends CardImpl {
public AvenWarcraft(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{W}");
// Creatures you control get +0/+2 until end of turn.
this.getSpellAbility().addEffect(new BoostControlledEffect(0, 2, Duration.EndOfTurn));
// Threshold - If seven or more cards are in your graveyard, choose a color. Creatures you control also gain protection from the chosen color until end of turn.
this.getSpellAbility().addEffect(new AvenWarcraftEffect());
}
public AvenWarcraft(final AvenWarcraft card) {
super(card);
}
@Override
public AvenWarcraft copy() {
return new AvenWarcraft(this);
}
}
class AvenWarcraftEffect extends OneShotEffect {
AvenWarcraftEffect() {
super(Outcome.Benefit);
this.staticText = "<br><br><i>Threshold</i> &mdash; If seven or more cards are in your graveyard, "
+ "choose a color. Creatures you control also gain protection from the chosen color until end of turn";
}
AvenWarcraftEffect(final AvenWarcraftEffect effect) {
super(effect);
}
@Override
public AvenWarcraftEffect copy() {
return new AvenWarcraftEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
if (new CardsInControllerGraveCondition(7).apply(game, source)) {
game.addEffect(new GainProtectionFromColorAllEffect(
Duration.EndOfTurn,
StaticFilters.FILTER_CONTROLLED_CREATURES
), source);
}
return true;
}
}

View file

@ -65,7 +65,8 @@ public class AwakenTheAncient extends CardImpl {
this.addAbility(ability);
// Enchanted Mountain is a 7/7 red Giant creature with haste. It's still a land.
Ability ability2 = new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect(new GiantToken(), "Enchanted Mountain is a 7/7 red Giant creature with haste. It's still a land", Duration.WhileOnBattlefield));
Ability ability2 = new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect(
new GiantToken(), "Enchanted Mountain is a 7/7 red Giant creature with haste. It's still a land", Duration.WhileOnBattlefield, BecomesCreatureAttachedEffect.LoseType.COLOR));
this.addAbility(ability2);
}

View file

@ -28,6 +28,7 @@
package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -43,6 +44,7 @@ import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
/**
* @author LevelX2
@ -50,14 +52,20 @@ import mage.game.permanent.token.Token;
public class AzoriusKeyrune extends CardImpl {
public AzoriusKeyrune(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
// {T}: Add {W} or {U}.
this.addAbility(new WhiteManaAbility());
this.addAbility(new BlueManaAbility());
// {W}{U}: Azorius Keyrune becomes a 2/2 white and blue Bird artifact creature with flying until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new AzoriusKeyruneToken(), "", Duration.EndOfTurn), new ManaCostsImpl("{W}{U}")));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(
new CreatureToken(2, 2, "2/2 white and blue Bird artifact creature with flying")
.withColor("WU")
.withSubType(SubType.BIRD)
.withType(CardType.ARTIFACT)
.withAbility(FlyingAbility.getInstance()),
"", Duration.EndOfTurn), new ManaCostsImpl("{W}{U}")));
}
public AzoriusKeyrune(final AzoriusKeyrune card) {
@ -68,25 +76,4 @@ public class AzoriusKeyrune extends CardImpl {
public AzoriusKeyrune copy() {
return new AzoriusKeyrune(this);
}
private static class AzoriusKeyruneToken extends TokenImpl {
AzoriusKeyruneToken() {
super("", "2/2 white and blue Bird artifact creature with flying");
cardType.add(CardType.ARTIFACT);
cardType.add(CardType.CREATURE);
color.setWhite(true);
color.setBlue(true);
this.subtype.add(SubType.BIRD);
power = new MageInt(2);
toughness = new MageInt(2);
this.addAbility(FlyingAbility.getInstance());
}
public AzoriusKeyruneToken(final AzoriusKeyruneToken token) {
super(token);
}
public AzoriusKeyruneToken copy() {
return new AzoriusKeyruneToken(this);
}
}
}

View file

@ -37,14 +37,13 @@ import mage.abilities.effects.common.counter.RemoveCounterSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.Counter;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author LevelX2
@ -52,11 +51,10 @@ import mage.players.Player;
public class AzorsElocutors extends CardImpl {
public AzorsElocutors(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W/U}{W/U}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W/U}{W/U}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.ADVISOR);
this.power = new MageInt(3);
this.toughness = new MageInt(5);
@ -65,7 +63,6 @@ public class AzorsElocutors extends CardImpl {
// Whenever a source deals damage to you, remove a filibuster counter from Azor's Elocutors.
this.addAbility(new AzorsElocutorsTriggeredAbility());
}
public AzorsElocutors(final AzorsElocutors card) {
@ -77,10 +74,11 @@ public class AzorsElocutors extends CardImpl {
return new AzorsElocutors(this);
}
}
class AzorsElocutorsTriggeredAbility extends TriggeredAbilityImpl {
public AzorsElocutorsTriggeredAbility() {
super(Zone.BATTLEFIELD, new RemoveCounterSourceEffect(new Counter("filibuster")), false);
super(Zone.BATTLEFIELD, new RemoveCounterSourceEffect(CounterType.FILIBUSTER.createInstance()), false);
}
public AzorsElocutorsTriggeredAbility(final AzorsElocutorsTriggeredAbility ability) {
@ -124,8 +122,8 @@ class AzorsElocutorsEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
permanent.addCounters(new Counter("filibuster"), source, game);
if (permanent.getCounters(game).getCount("filibuster") > 4) {
permanent.addCounters(CounterType.FILIBUSTER.createInstance(), source, game);
if (permanent.getCounters(game).getCount(CounterType.FILIBUSTER) > 4) {
Player player = game.getPlayer(permanent.getControllerId());
if (player != null) {
player.won(game);

View file

@ -39,6 +39,7 @@ import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
import mage.target.TargetPermanent;
import java.util.UUID;
@ -63,7 +64,7 @@ public class BalduvianConjurer extends CardImpl {
this.toughness = new MageInt(2);
// {tap}: Target snow land becomes a 2/2 creature until end of turn. It's still a land.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureTargetEffect(new AnimatedLand(), false, true, Duration.EndOfTurn), new TapSourceCost());
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureTargetEffect(new CreatureToken(2, 2), false, true, Duration.EndOfTurn), new TapSourceCost());
ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability);
}
@ -77,20 +78,3 @@ public class BalduvianConjurer extends CardImpl {
return new BalduvianConjurer(this);
}
}
class AnimatedLand extends TokenImpl {
public AnimatedLand() {
super("", "2/2 creature");
this.cardType.add(CardType.CREATURE);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
}
public AnimatedLand(final AnimatedLand token) {
super(token);
}
public AnimatedLand copy() {
return new AnimatedLand(this);
}
}

View file

@ -29,7 +29,6 @@ package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
@ -53,7 +52,7 @@ import mage.target.TargetPlayer;
public class BalustradeSpy extends CardImpl {
public BalustradeSpy(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{B}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}");
this.subtype.add(SubType.VAMPIRE, SubType.ROGUE);
this.power = new MageInt(2);
@ -97,26 +96,20 @@ class BalustradeSpyEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(getTargetPointer().getFirst(game, source));
MageObject sourceObject = source.getSourceObject(game);
if (controller == null || sourceObject == null) {
if (controller == null) {
return false;
}
CardsImpl cards = new CardsImpl();
boolean landFound = false;
while (controller.getLibrary().hasCards() && !landFound) {
Card card = controller.getLibrary().removeFromTop(game);
CardsImpl toGraveyard = new CardsImpl();
for (Card card : controller.getLibrary().getCards(game)) {
if (card != null) {
cards.add(card);
toGraveyard.add(card);
if (card.isLand()) {
landFound = true;
break;
}
}
}
if (!cards.isEmpty()) {
controller.revealCards(sourceObject.getName(), cards, game);
controller.moveCards(cards, Zone.GRAVEYARD, source, game);
return true;
}
controller.revealCards(source, toGraveyard, game);
controller.moveCards(toGraveyard, Zone.GRAVEYARD, source, game);
return true;
}
}

View file

@ -28,36 +28,41 @@
package mage.cards.b;
import java.util.UUID;
import mage.abilities.TriggeredAbility;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.condition.Condition;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.condition.CompoundCondition;
import mage.abilities.condition.common.CardsInHandCondition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.common.WinGameSourceControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.constants.TargetController;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
/**
* @author fireshoes
*/
public class BarrenGlory extends CardImpl {
private static final FilterControlledPermanent filter = new FilterControlledPermanent();
static {
filter.add(new AnotherPredicate());
}
public BarrenGlory(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{W}{W}");
// At the beginning of your upkeep, if you control no permanents other than Barren Glory and have no cards in hand, you win the game.
Condition condition = new CardsInHandCondition(ComparisonType.EQUAL_TO, 0);
TriggeredAbility ability = new BarrenGloryTriggeredAbility();
this.addAbility(new ConditionalTriggeredAbility(ability,
condition,
this.addAbility(new ConditionalTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(new WinGameSourceControllerEffect(), TargetController.YOU, false),
new CompoundCondition(
new CardsInHandCondition(ComparisonType.EQUAL_TO, 0),
new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.EQUAL_TO, 0)
),
"At the beginning of your upkeep, if you control no permanents other than {this} and have no cards in hand, you win the game"));
}
@ -70,45 +75,3 @@ public class BarrenGlory extends CardImpl {
return new BarrenGlory(this);
}
}
class BarrenGloryTriggeredAbility extends TriggeredAbilityImpl {
private static final FilterPermanent filter = new FilterPermanent();
static {
filter.add(new AnotherPredicate());
}
BarrenGloryTriggeredAbility() {
super(Zone.BATTLEFIELD, new WinGameSourceControllerEffect());
}
BarrenGloryTriggeredAbility(final BarrenGloryTriggeredAbility ability) {
super(ability);
}
@Override
public BarrenGloryTriggeredAbility copy() {
return new BarrenGloryTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.UPKEEP_STEP_PRE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getPlayerId().equals(this.controllerId)) {
if (game.getBattlefield().count(filter, this.getSourceId(), this.getControllerId(), game) == 0) {
return true;
}
}
return false;
}
@Override
public String getRule() {
return "At the beginning of your upkeep, if you control no permanents other than {this} and have no cards in hand, you win the game";
}
}

View file

@ -112,7 +112,7 @@ class BatheInLightEffect extends OneShotEffect {
game.addEffect(effect, source);
ObjectColor color = target.getColor(game);
for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source.getSourceId(), game)) {
if (permanent != target && permanent.getColor(game).shares(color)) {
if (!permanent.getId().equals(target.getId()) && permanent.getColor(game).shares(color)) {
game.getState().setValue(permanent.getId() + "_color", colorChoice.getColor());
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);

View file

@ -30,7 +30,7 @@ package mage.cards.b;
import java.util.UUID;
import mage.Mana;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.DynamicManaEffect;
import mage.abilities.effects.mana.DynamicManaEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;

View file

@ -0,0 +1,92 @@
/*
* 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.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.PreventDamageToTargetEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author TheElk801
*/
public class BattlefieldMedic extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
static {
filter.add(new SubtypePredicate(SubType.CLERIC));
}
public BattlefieldMedic(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.CLERIC);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// {tap}: Prevent the next X damage that would be dealt to target creature this turn, where X is the number of Clerics on the battlefield.
Ability ability = new SimpleActivatedAbility(
new PreventDamageToTargetEffect(
Duration.EndOfTurn,
false,
true,
new PermanentsOnBattlefieldCount(filter)
).setText(
"prevent the next X damage "
+ "that would be dealt to target creature this turn, "
+ "where X is the number of Clerics on the battlefield"
),
new TapSourceCost()
);
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
public BattlefieldMedic(final BattlefieldMedic card) {
super(card);
}
@Override
public BattlefieldMedic copy() {
return new BattlefieldMedic(this);
}
}

View file

@ -37,20 +37,19 @@ import mage.abilities.effects.RedirectionEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.TargetSource;
/**
*
*
* @author L_J
*/
public class BeaconOfDestiny extends CardImpl {
@ -81,7 +80,7 @@ class BeaconOfDestinyEffect extends RedirectionEffect {
private final TargetSource damageSource;
public BeaconOfDestinyEffect() {
super(Duration.EndOfTurn, Integer.MAX_VALUE, true);
super(Duration.EndOfTurn, Integer.MAX_VALUE, UsageType.ONE_USAGE_ABSOLUTE);
staticText = "The next time a source of your choice would deal damage to you this turn, that damage is dealt to {this} instead";
this.damageSource = new TargetSource();
}

View file

@ -58,7 +58,7 @@ public class BellowingSaddlebrute extends CardImpl {
this.addAbility(new ConditionalTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new LoseLifeSourceControllerEffect(4)),
new InvertCondition(RaidCondition.instance),
"<i>Raid</i> - When {this} enters the battlefield, you lose 4 life unless you attacked with a creature this turn"
"<i>Raid</i> &mdash; When {this} enters the battlefield, you lose 4 life unless you attacked with a creature this turn"
), new PlayerAttackedWatcher());
}

View file

@ -70,7 +70,7 @@ class BiteOfTheBlackRoseEffect extends OneShotEffect {
BiteOfTheBlackRoseEffect() {
super(Outcome.Benefit);
this.staticText = "<i>Will of the council</i> - Starting with you, each player votes for sickness or psychosis. If sickness gets more votes, creatures your opponents control get -2/-2 until end of turn. If psychosis gets more votes or the vote is tied, each opponent discards two cards";
this.staticText = "<i>Will of the council</i> &mdash; Starting with you, each player votes for sickness or psychosis. If sickness gets more votes, creatures your opponents control get -2/-2 until end of turn. If psychosis gets more votes or the vote is tied, each opponent discards two cards";
}
BiteOfTheBlackRoseEffect(final BiteOfTheBlackRoseEffect effect) {

View file

@ -28,17 +28,13 @@
package mage.cards.b;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LoseLifeSourceControllerEffect;
import mage.cards.*;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.filter.StaticFilters;
/**
*
@ -47,11 +43,11 @@ import mage.target.TargetCard;
public class BitterRevelation extends CardImpl {
public BitterRevelation(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{B}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{B}");
// Look at the top four cards of your library. Put two of them into your hand and the rest into your graveyard. You lose 2 life.
this.getSpellAbility().addEffect(new BitterRevelationEffect());
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(new StaticValue(4), false, new StaticValue(2),
StaticFilters.FILTER_CARD, Zone.GRAVEYARD, false, false, false, Zone.HAND, false));
this.getSpellAbility().addEffect(new LoseLifeSourceControllerEffect(2));
}
@ -64,53 +60,3 @@ public class BitterRevelation extends CardImpl {
return new BitterRevelation(this);
}
}
class BitterRevelationEffect extends OneShotEffect {
BitterRevelationEffect() {
super(Outcome.Benefit);
this.staticText = "Look at the top four cards of your library. Put two of them into your hand and the rest into your graveyard";
}
BitterRevelationEffect(final BitterRevelationEffect effect) {
super(effect);
}
@Override
public BitterRevelationEffect copy() {
return new BitterRevelationEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Cards cards = new CardsImpl();
int cardsCount = Math.min(4, player.getLibrary().size());
for (int i = 0; i < cardsCount; i++) {
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
cards.add(card);
}
}
if (!cards.isEmpty()) {
Cards cardsToHand = new CardsImpl();
player.lookAtCards("Bitter Revelation", cards, game);
TargetCard target = new TargetCard(Math.min(2, cards.size()), Zone.LIBRARY, new FilterCard("two cards to put in your hand"));
if (player.choose(Outcome.DrawCard, cards, target, game)) {
for (UUID targetId : target.getTargets()) {
Card card = cards.get(targetId, game);
if (card != null) {
cardsToHand.add(card);
cards.remove(card);
}
}
}
player.moveCards(cardsToHand, Zone.HAND, source, game);
player.moveCards(cards, Zone.GRAVEYARD, source, game);
}
return true;
}
return false;
}
}

View file

@ -31,7 +31,7 @@ import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.AddManaOfAnyColorEffect;
import mage.abilities.effects.mana.AddManaOfAnyColorEffect;
import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;

View file

@ -27,11 +27,9 @@
*/
package mage.cards.b;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.keyword.ReboundAbility;
import mage.cards.*;
import mage.constants.CardType;
@ -51,24 +49,22 @@ import mage.target.common.TargetCreaturePermanent;
* @author fireshoes
*/
public class BlessedReincarnation extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature an opponent controls");
static {
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public BlessedReincarnation(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{U}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{U}");
// Exile target creature an opponent controls.
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
this.getSpellAbility().addEffect(new ExileTargetEffect());
// Exile target creature an opponent controls.
// That player reveals cards from the top of their library until a creature card is revealed.
// The player puts that card onto the battlefield, then shuffles the rest into their library.
this.getSpellAbility().addEffect(new BlessedReincarnationEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
// Rebound
this.addAbility(new ReboundAbility());
}
@ -87,7 +83,7 @@ class BlessedReincarnationEffect extends OneShotEffect {
public BlessedReincarnationEffect() {
super(Outcome.PutCreatureInPlay);
this.staticText = "That player reveals cards from the top of their library until a creature card is revealed. The player puts that card onto the battlefield, then shuffles the rest into their library";
this.staticText = "Exile target creature an opponent controls. That player reveals cards from the top of their library until a creature card is revealed. The player puts that card onto the battlefield, then shuffles the rest into their library";
}
public BlessedReincarnationEffect(final BlessedReincarnationEffect effect) {
@ -101,37 +97,31 @@ class BlessedReincarnationEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
permanent = (Permanent) game.getLastKnownInformation(source.getFirstTarget(), Zone.BATTLEFIELD);
}
Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent != null && controller != null) {
controller.moveCards(permanent, Zone.EXILED, source, game);
game.applyEffects();
if (permanent != null) {
Player player = game.getPlayer(permanent.getControllerId());
if (player != null) {
Library library = player.getLibrary();
Player permanentController = game.getPlayer(permanent.getControllerId());
if (permanentController != null) {
Library library = permanentController.getLibrary();
if (library.hasCards()) {
Cards cards = new CardsImpl();
Card card = library.removeFromTop(game);
cards.add(card);
while (!card.isCreature() && library.hasCards()) {
card = library.removeFromTop(game);
cards.add(card);
Cards toReveal = new CardsImpl();
for (Card card : library.getCards(game)) {
toReveal.add(card);
if (card.isCreature()) {
permanentController.moveCards(card, Zone.BATTLEFIELD, source, game);
break;
}
}
if (card.isCreature()) {
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), player.getId());
}
if (!cards.isEmpty()) {
player.revealCards("BlessedReincarnation", cards, game);
Set<Card> cardsToShuffle = cards.getCards(game);
cardsToShuffle.remove(card);
library.addAll(cardsToShuffle, game);
permanentController.revealCards(source, toReveal, game);
if (toReveal.size() > 1) {
library.shuffle();
}
}
return true;
}
return true;
}
return false;
}

View file

@ -29,6 +29,7 @@
package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -48,6 +49,7 @@ import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
import mage.target.TargetPermanent;
/**
@ -62,14 +64,19 @@ public class BlinkmothNexus extends CardImpl {
}
public BlinkmothNexus(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.LAND},null);
super(ownerId, setInfo, new CardType[]{CardType.LAND}, null);
// {T}: Add {C}to your mana pool.
this.addAbility(new ColorlessManaAbility());
// {1}: Blinkmoth Nexus becomes a 1/1 Blinkmoth artifact creature with flying until end of turn. It's still a land.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new BlinkmothNexusToken(), "land", Duration.EndOfTurn), new GenericManaCost(1)));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(
new CreatureToken(1, 1, "1/1 Blinkmoth artifact creature with flying")
.withSubType(SubType.BLINKMOTH)
.withType(CardType.ARTIFACT)
.withAbility(FlyingAbility.getInstance()),
"land", Duration.EndOfTurn), new GenericManaCost(1)));
// {1}, {T}: Target Blinkmoth creature gets +1/+1 until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(1, 1, Duration.EndOfTurn), new GenericManaCost(1));
ability.addCost(new TapSourceCost());
@ -88,22 +95,3 @@ public class BlinkmothNexus extends CardImpl {
}
}
class BlinkmothNexusToken extends TokenImpl {
public BlinkmothNexusToken() {
super("Blinkmoth", "1/1 Blinkmoth artifact creature with flying");
cardType.add(CardType.ARTIFACT);
cardType.add(CardType.CREATURE);
this.subtype.add(SubType.BLINKMOTH);
power = new MageInt(1);
toughness = new MageInt(1);
this.addAbility(FlyingAbility.getInstance());
}
public BlinkmothNexusToken(final BlinkmothNexusToken token) {
super(token);
}
public BlinkmothNexusToken copy() {
return new BlinkmothNexusToken(this);
}
}

View file

@ -42,7 +42,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.counters.Counter;
import mage.counters.CounterType;
/**
*
@ -53,17 +53,16 @@ public class BloodletterQuill extends CardImpl {
public BloodletterQuill(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
Counter bloodCounter = new Counter("blood");
// {2}, {T}, Put a blood counter on Bloodletter Quill: Draw a card, then lose 1 life for each blood counter on Bloodletter Quill.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), new GenericManaCost(2));
ability.addEffect(new LoseLifeSourceControllerEffect(new CountersSourceCount(bloodCounter.getName()))
ability.addEffect(new LoseLifeSourceControllerEffect(new CountersSourceCount(CounterType.BLOOD))
.setText(", then lose 1 life for each blood counter on {this}"));
ability.addCost(new TapSourceCost());
ability.addCost(new PutCountersSourceCost(bloodCounter));
ability.addCost(new PutCountersSourceCost(CounterType.BLOOD.createInstance()));
this.addAbility(ability);
// {U}{B}: Remove a blood counter from Bloodletter Quill.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD,
new RemoveCounterSourceEffect(bloodCounter), new ManaCostsImpl("{U}{B}")));
new RemoveCounterSourceEffect(CounterType.BLOOD.createInstance()), new ManaCostsImpl("{U}{B}")));
}
public BloodletterQuill(final BloodletterQuill card) {

View file

@ -58,7 +58,7 @@ public class BloodsoakedChampion extends CardImpl {
// Bloodstained Brave can't block.
this.addAbility(new CantBlockAbility());
// <i>Raid</i> - {1}{B}: Return Bloodstained Brave from your graveyard to the battlefield. Activate this ability only if you attacked with a creature this turn.
// <i>Raid</i> &mdash; {1}{B}: Return Bloodstained Brave from your graveyard to the battlefield. Activate this ability only if you attacked with a creature this turn.
Ability ability = new ConditionalActivatedAbility(
Zone.GRAVEYARD,
new ReturnSourceFromGraveyardToBattlefieldEffect(),

View file

@ -50,7 +50,7 @@ import mage.players.Player;
public class BloomTender extends CardImpl {
public BloomTender(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.ELF, SubType.DRUID);
this.power = new MageInt(1);
@ -93,38 +93,32 @@ class BloomTenderEffect extends ManaEffect {
if (controller != null) {
Mana mana = getMana(game, source);
checkToFirePossibleEvents(mana, game, source);
controller.getManaPool().addMana(mana, game, source);
controller.getManaPool().addMana(mana, game, source);
return true;
}
return false;
}
@Override
public Mana getMana(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Mana mana = new Mana();
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(controller.getId())) {
if (mana.getBlack() == 0 && permanent.getColor(game).isBlack()) {
mana.increaseBlack();
}
if (mana.getBlue() == 0 && permanent.getColor(game).isBlue()) {
mana.increaseBlue();
}
if (mana.getRed() == 0 && permanent.getColor(game).isRed()) {
mana.increaseRed();
}
if (mana.getGreen() == 0 && permanent.getColor(game).isGreen()) {
mana.increaseGreen();
}
if (mana.getWhite() == 0 && permanent.getColor(game).isWhite()) {
mana.increaseWhite();
}
public Mana produceMana(boolean netMana, Game game, Ability source) {
Mana mana = new Mana();
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) {
if (mana.getBlack() == 0 && permanent.getColor(game).isBlack()) {
mana.increaseBlack();
}
if (mana.getBlue() == 0 && permanent.getColor(game).isBlue()) {
mana.increaseBlue();
}
if (mana.getRed() == 0 && permanent.getColor(game).isRed()) {
mana.increaseRed();
}
if (mana.getGreen() == 0 && permanent.getColor(game).isGreen()) {
mana.increaseGreen();
}
if (mana.getWhite() == 0 && permanent.getColor(game).isWhite()) {
mana.increaseWhite();
}
return mana;
}
return null;
return mana;
}
}

View file

@ -28,6 +28,7 @@
package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -43,22 +44,28 @@ import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
/**
*
* @author LevelX2
*/
public class BorosKeyrune extends CardImpl {
public BorosKeyrune(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
// {T}: Add {R} or {W}.
this.addAbility(new RedManaAbility());
this.addAbility(new WhiteManaAbility());
// {R}{W}: Boros Keyrune becomes a 1/1 red and white Soldier artifact creature with double strike until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new BorosKeyruneToken(), "", Duration.EndOfTurn), new ManaCostsImpl("{R}{W}")));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(
new CreatureToken(1, 1, "1/1 red and white Soldier artifact creature with double strike")
.withColor("RW")
.withSubType(SubType.SOLDIER)
.withType(CardType.ARTIFACT)
.withAbility(DoubleStrikeAbility.getInstance()),
"", Duration.EndOfTurn), new ManaCostsImpl("{R}{W}")));
}
public BorosKeyrune(final BorosKeyrune card) {
@ -69,25 +76,4 @@ public class BorosKeyrune extends CardImpl {
public BorosKeyrune copy() {
return new BorosKeyrune(this);
}
private static class BorosKeyruneToken extends TokenImpl {
BorosKeyruneToken() {
super("Soldier", "1/1 red and white Soldier artifact creature with double strike");
cardType.add(CardType.ARTIFACT);
cardType.add(CardType.CREATURE);
color.setRed(true);
color.setWhite(true);
subtype.add(SubType.SOLDIER);
power = new MageInt(1);
toughness = new MageInt(1);
this.addAbility(DoubleStrikeAbility.getInstance());
}
public BorosKeyruneToken(final BorosKeyruneToken token) {
super(token);
}
public BorosKeyruneToken copy() {
return new BorosKeyruneToken(this);
}
}
}

View file

@ -44,9 +44,7 @@ import mage.constants.Outcome;
import mage.constants.SpellAbilityType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.FilterSpell;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.MulticoloredPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
@ -61,12 +59,6 @@ import mage.target.common.TargetControlledPermanent;
*/
public class BoundDetermined extends SplitCard {
private static final FilterSpell filter = new FilterSpell("multicolored spell");
static {
filter.add(new MulticoloredPredicate());
}
public BoundDetermined(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{B}{G}", "{G}{U}", SpellAbilityType.SPLIT);

View file

@ -44,6 +44,7 @@ import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.Objects;
import java.util.UUID;
/**
@ -122,7 +123,7 @@ class BrandOfIllOmenEffect extends ContinuousRuleModifyingEffectImpl {
Permanent brand = game.getPermanent(source.getSourceId());
if (brand != null && brand.getAttachedTo() != null) {
UUID enchantedController = game.getPermanent(brand.getAttachedTo()).getControllerId();
if(enchantedController == event.getPlayerId() && game.getObject(event.getSourceId()).isCreature()) {
if(Objects.equals(enchantedController, event.getPlayerId()) && game.getObject(event.getSourceId()).isCreature()) {
return true;
}
}

View file

@ -36,7 +36,6 @@ 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.Duration;
import mage.constants.Outcome;
@ -93,25 +92,27 @@ class BreathstealersCryptEffect extends ReplacementEffectImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player player = game.getPlayer(event.getPlayerId());
PayLifeCost cost = new PayLifeCost(3);
if (player != null) {
Card cardDrawn = player.getLibrary().removeFromTop(game);
if (cardDrawn != null) {
player.moveCardToHandWithInfo(cardDrawn, source.getSourceId(), game);
Cards cards = new CardsImpl();
cards.add(cardDrawn);
player.revealCards("The card drawn from " + player.getName() + "'s library", cards, game);
if (cardDrawn.isCreature()) {
game.informPlayers("The card drawn by " + player.getName() + " is a creature card. He/she must pay 3 life or that card gets discarded.");
if (cost.canPay(source, source.getSourceId(), player.getId(), game)
&& player.chooseUse(outcome, "Do you wish to pay 3 life to keep the drawn creature card? If not, you discard it.", source, game)) {
return cost.pay(source, game, source.getSourceId(), player.getId(), true, cost);
} else {
game.informPlayers("The cost of 3 life was not paid by " + player.getName() + ", so the creature card will be discarded.");
return player.discard(cardDrawn, source, game);
Cards oldHand = player.getHand().copy();
if (player.drawCards(1, game, event.getAppliedEffects()) > 0) {
Cards drawnCards = player.getHand().copy();
drawnCards.removeAll(oldHand);
player.revealCards(source, "The card drawn from " + player.getName() + "'s library.", drawnCards, game);
for (Card cardDrawn : drawnCards.getCards(game)) {
if (cardDrawn.isCreature()) {
game.informPlayers("The card drawn by " + player.getName() + " is a creature card. He/she must pay 3 life or that card gets discarded.");
PayLifeCost cost = new PayLifeCost(3);
if (cost.canPay(source, source.getSourceId(), player.getId(), game)
&& player.chooseUse(outcome, "Do you wish to pay 3 life to keep the card " + cardDrawn.getIdName() + "? If not, you discard it.", source, game)) {
cost.pay(source, game, source.getSourceId(), player.getId(), true, cost);
} else {
game.informPlayers("The cost of 3 life was not paid by " + player.getName() + ", so " + cardDrawn.getIdName() + " will be discarded.");
player.discard(cardDrawn, source, game);
}
}
}
}
return true;
}
return false;
}

View file

@ -41,7 +41,7 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.counters.Counter;
import mage.counters.CounterType;
import mage.target.common.TargetCreaturePermanent;
/**
@ -51,15 +51,15 @@ import mage.target.common.TargetCreaturePermanent;
public class BribersPurse extends CardImpl {
public BribersPurse(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{X}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{X}");
// Briber's Purse enters the battlefield with X gem counters on it.
this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(new Counter("gem"))));
this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.GEM.createInstance())));
// {1}, {T}, Remove a gem counter from Briber's Purse: Target creature can't attack or block this turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CantAttackBlockTargetEffect(Duration.EndOfTurn), new GenericManaCost(1));
ability.addCost(new TapSourceCost());
ability.addCost(new RemoveCountersSourceCost(new Counter("gem")));
ability.addCost(new RemoveCountersSourceCost(CounterType.GEM.createInstance()));
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}

View file

@ -30,7 +30,7 @@ package mage.cards.b;
import java.util.UUID;
import mage.Mana;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.DynamicManaEffect;
import mage.abilities.effects.mana.DynamicManaEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;

View file

@ -48,7 +48,7 @@ import mage.target.TargetCard;
public class Browse extends CardImpl {
public Browse(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{U}{U}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}{U}");
// {2}{U}{U}: Look at the top five cards of your library, put one of them into your hand, and exile the rest.
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BrowseEffect(), new ManaCostsImpl("{2}{U}{U}"));
@ -83,33 +83,20 @@ class BrowseEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Cards cards = new CardsImpl();
int cardsCount = Math.min(5, player.getLibrary().size());
for (int i = 0; i < cardsCount; i++) {
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
cards.add(card);
}
}
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 5));
if (!cards.isEmpty()) {
player.lookAtCards("Browse", cards, game);
controller.lookAtCards(source, null, cards, game);
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put in your hand"));
if (player.choose(Outcome.Benefit, cards, target, game)) {
if (controller.choose(Outcome.Benefit, cards, target, game)) {
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
controller.moveCards(card, Zone.HAND, source, game);
cards.remove(card);
}
}
for (Card card : cards.getCards(game)) {
card.moveToExile(null, null, source.getSourceId(), game);
}
controller.moveCards(cards, Zone.EXILED, source, game);
}
return true;
}

View file

@ -30,7 +30,7 @@ package mage.cards.b;
import java.util.UUID;
import mage.Mana;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AddManaToManaPoolTargetControllerEffect;
import mage.abilities.effects.mana.AddManaToManaPoolTargetControllerEffect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.mana.DelayedTriggeredManaAbility;
import mage.cards.CardImpl;

View file

@ -31,7 +31,7 @@ import java.util.UUID;
import mage.MageInt;
import mage.Mana;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.BasicManaEffect;
import mage.abilities.effects.mana.BasicManaEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;

View file

@ -31,7 +31,7 @@ import java.util.UUID;
import mage.Mana;
import mage.abilities.condition.common.CardsInControllerGraveCondition;
import mage.abilities.decorator.ConditionalManaEffect;
import mage.abilities.effects.common.BasicManaEffect;
import mage.abilities.effects.mana.BasicManaEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -52,7 +52,7 @@ public class CabalRitual extends CardImpl {
new BasicManaEffect(Mana.BlackMana(5)),
new BasicManaEffect(Mana.BlackMana(3)),
new CardsInControllerGraveCondition(7),
"Add {B}{B}{B}.<br/><br/><i>Threshold</i> - Add {B}{B}{B}{B}{B} instead if seven or more cards are in your graveyard"));
"Add {B}{B}{B}.<br/><br/><i>Threshold</i> &mdash; Add {B}{B}{B}{B}{B} instead if seven or more cards are in your graveyard"));
}
public CabalRitual(final CabalRitual card) {

View file

@ -55,7 +55,7 @@ public class CacklingFlames extends CardImpl {
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new DamageTargetEffect(5),
HellbentCondition.instance,
"<br/><br/><i>Hellbent</i> - {this} deals 5 damage to that permanent or player instead if you have no cards in hand."));
"<br/><br/><i>Hellbent</i> &mdash; {this} deals 5 damage to that permanent or player instead if you have no cards in hand."));
this.getSpellAbility().addTarget(new TargetAnyTarget());
}

View file

@ -176,7 +176,7 @@ class CagedSunEffect extends ManaEffect {
}
@Override
public Mana getMana(Game game, Ability source) {
public Mana produceMana(boolean netMana, Game game, Ability source) {
ObjectColor color = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color");
if (color != null) {
return new Mana(ColoredManaSymbol.lookup(color.toString().charAt(0)));

View file

@ -34,7 +34,7 @@ import mage.abilities.costs.common.RemoveVariableCountersSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.common.RemovedCountersForCostValue;
import mage.abilities.effects.common.AddManaInAnyCombinationEffect;
import mage.abilities.effects.mana.AddManaInAnyCombinationEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.mana.ColorlessManaAbility;
import mage.abilities.mana.SimpleManaAbility;

View file

@ -28,7 +28,6 @@
package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.KickedCondition;
@ -66,7 +65,7 @@ public class CaligoSkinWitch extends CardImpl {
TargetController.OPPONENT
)),
KickedCondition.instance,
"When {this} enters the battlefield, if it was kicked, each opponent discards two cards"
"When {this} enters the battlefield, if it was kicked, each opponent discards two cards."
));
}

View file

@ -31,7 +31,7 @@ import java.util.UUID;
import mage.Mana;
import mage.abilities.condition.common.TargetHasCounterCondition;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.BasicManaEffect;
import mage.abilities.effects.mana.BasicManaEffect;
import mage.abilities.effects.common.UntapTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.effects.common.continuous.GainControlTargetEffect;

View file

@ -32,7 +32,7 @@ import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AddManaToManaPoolSourceControllerEffect;
import mage.abilities.effects.mana.AddManaToManaPoolSourceControllerEffect;
import mage.abilities.effects.common.LoseLifeSourceControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;

View file

@ -49,22 +49,22 @@ import mage.target.common.TargetCreaturePermanent;
public class Carom extends CardImpl {
public Carom(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{W}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W}");
// The next 1 damage that would be dealt to target creature this turn is dealt to another target creature instead.
// Draw a card.
this.getSpellAbility().addEffect(new CaromEffect(Duration.EndOfTurn, 1));
TargetCreaturePermanent target = new TargetCreaturePermanent();
target.setTargetTag(1);
this.getSpellAbility().addTarget(target);
FilterCreaturePermanent filter = new FilterCreaturePermanent("another creature (damage is redirected to)");
filter.add(new AnotherTargetPredicate(2));
TargetCreaturePermanent target2 = new TargetCreaturePermanent(filter);
target2.setTargetTag(2);
this.getSpellAbility().addTarget(target2);
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1));
}
@ -79,29 +79,29 @@ public class Carom extends CardImpl {
}
class CaromEffect extends RedirectionEffect {
protected MageObjectReference redirectToObject;
public CaromEffect(Duration duration, int amount) {
super(duration, amount, true);
super(duration, amount, UsageType.ONE_USAGE_ABSOLUTE);
staticText = "The next " + amount + " damage that would be dealt to target creature this turn is dealt to another target creature instead";
}
public CaromEffect(final CaromEffect effect) {
super(effect);
}
@Override
public CaromEffect copy() {
return new CaromEffect(this);
}
@Override
public void init(Ability source, Game game) {
super.init(source, game);
redirectToObject = new MageObjectReference(source.getTargets().get(1).getFirstTarget(), game);
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getTargetId().equals(getTargetPointer().getFirst(game, source))) {

View file

@ -124,7 +124,7 @@ class CarpetOfFlowersTriggeredAbility extends TriggeredAbilityImpl {
@Override
public String getRule() {
StringBuilder sb = new StringBuilder("At the beginning of each of your main phases, if you haven't added mana with this ability this turn");
StringBuilder sb = new StringBuilder("At the beginning of each of your main phases, if you haven't added mana with this ability this turn, ");
return sb.append(super.getRule()).toString();
}
@ -150,12 +150,23 @@ class CarpetOfFlowersEffect extends ManaEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
checkToFirePossibleEvents(getMana(game, source), game, source);
controller.getManaPool().addMana(getMana(game, source), game, source);
return true;
}
return false;
}
@Override
public Mana produceMana(boolean netMana, Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
ChoiceColor choice = new ChoiceColor();
if (controller != null && controller.choose(Outcome.Benefit, choice, game)) {
Mana mana = new Mana();
int count = game.getBattlefield().count(filter, source.getSourceId(), source.getTargets().getFirstTarget(), game);
if (count > 0) {
Mana mana = new Mana();
switch (choice.getChoice()) {
case "Black":
mana.setBlack(count);
@ -175,16 +186,9 @@ class CarpetOfFlowersEffect extends ManaEffect {
default:
break;
}
checkToFirePossibleEvents(mana, game, source);
controller.getManaPool().addMana(mana, game, source);
}
return true;
return mana;
}
return false;
}
@Override
public Mana getMana(Game game, Ability source) {
return null;
}

View file

@ -31,7 +31,7 @@ import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.AddManaInAnyCombinationEffect;
import mage.abilities.effects.mana.AddManaInAnyCombinationEffect;
import mage.abilities.keyword.IndestructibleAbility;
import mage.abilities.mana.ColorlessManaAbility;
import mage.abilities.mana.SimpleManaAbility;

View file

@ -31,7 +31,7 @@ import java.util.UUID;
import mage.MageInt;
import mage.Mana;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.effects.common.BasicManaEffect;
import mage.abilities.effects.mana.BasicManaEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;

View file

@ -28,6 +28,7 @@
package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTappedAbility;
import mage.abilities.common.SimpleActivatedAbility;
@ -45,20 +46,31 @@ import mage.constants.Duration;
import mage.constants.Zone;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class CelestialColonnade extends CardImpl {
public CelestialColonnade(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.LAND},null);
super(ownerId, setInfo, new CardType[]{CardType.LAND}, null);
// Celestial Colonnade enters the battlefield tapped.
this.addAbility(new EntersBattlefieldTappedAbility());
// {T}: Add {W} or {U]
this.addAbility(new BlueManaAbility());
this.addAbility(new WhiteManaAbility());
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new CelestialColonnadeToken(), "land", Duration.EndOfTurn), new ManaCostsImpl("{3}{W}{U}")));
// {3}{W}{U}: Until end of turn, Celestial Colonnade becomes a 4/4 white and blue Elemental creature with flying and vigilance. Its still a land.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(
new CreatureToken(4, 4, "4/4 white and blue Elemental creature with flying and vigilance")
.withColor("WU")
.withSubType(SubType.ELEMENTAL)
.withAbility(FlyingAbility.getInstance())
.withAbility(VigilanceAbility.getInstance()),
"land", Duration.EndOfTurn), new ManaCostsImpl("{3}{W}{U}")));
}
public CelestialColonnade(final CelestialColonnade card) {
@ -70,27 +82,4 @@ public class CelestialColonnade extends CardImpl {
return new CelestialColonnade(this);
}
}
class CelestialColonnadeToken extends TokenImpl {
public CelestialColonnadeToken() {
super("", "4/4 white and blue Elemental creature with flying and vigilance");
cardType.add(CardType.CREATURE);
subtype.add(SubType.ELEMENTAL);
color.setBlue(true);
color.setWhite(true);
power = new MageInt(4);
toughness = new MageInt(4);
addAbility(FlyingAbility.getInstance());
addAbility(VigilanceAbility.getInstance());
}
public CelestialColonnadeToken(final CelestialColonnadeToken token) {
super(token);
}
public CelestialColonnadeToken copy() {
return new CelestialColonnadeToken(this);
}
}
}

View file

@ -44,7 +44,7 @@ import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.Counter;
import mage.counters.CounterType;
import mage.game.Game;
import mage.players.Player;
@ -58,12 +58,12 @@ public class CelestialConvergence extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}{W}");
// Celestial Convergence enters the battlefield with seven omen counters on it.
Effect effect = new AddCountersSourceEffect(new Counter("omen", 7));
Effect effect = new AddCountersSourceEffect(CounterType.OMEN.createInstance(7));
this.addAbility(new EntersBattlefieldAbility(effect, "with seven omen counters"));
// At the beginning of your upkeep, remove an omen counter from Celestial Convergence. If there are no omen counters on Celestial Convergence, the player with the highest life total wins the game. If two or more players are tied for highest life total, the game is a draw.
Ability ability = new BeginningOfUpkeepTriggeredAbility(
Zone.BATTLEFIELD, new RemoveCounterSourceEffect(new Counter("omen")), TargetController.YOU, false);
Zone.BATTLEFIELD, new RemoveCounterSourceEffect(CounterType.OMEN.createInstance(1)), TargetController.YOU, false);
ability.addEffect(new CelestialConvergenceEffect());
this.addAbility(ability);
}
@ -100,18 +100,17 @@ class CelestialConvergenceEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (sourceObject != null
&& controller != null
&& sourceObject.getCounters(game).getCount("omen") == 0) {
&& sourceObject.getCounters(game).getCount(CounterType.OMEN) == 0) {
/**
* 801.14. If an effect states that a player wins the game, all of
* that players opponents within their range of influence lose
* the game instead. #
* that players opponents within their range of influence lose the
* game instead. #
*
* 801.15. If the effect of a spell or ability states that the game
* is a draw, the game is a draw for that spell or abilitys
* controller and all players within their range of influence.
* They leave the game. All remaining players continue to play the
* game.
* controller and all players within their range of influence. They
* leave the game. All remaining players continue to play the game.
*
*/
List<UUID> highestLifePlayers = new ArrayList<>();

View file

@ -0,0 +1,153 @@
/*
* 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.cards.c;
import java.awt.*;
import java.util.*;
import java.util.List;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.effects.common.continuous.LoseAbilityTargetEffect;
import mage.abilities.keyword.ProtectionAbility;
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.ColorPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author tcontis
*/
public class CephalidSnitch extends CardImpl {
public CephalidSnitch(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}");
this.subtype.add(SubType.CEPHALID);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Sacrifice Cephalid Snitch: Target creature loses protection from black until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CephalidSnitchEffect(), new SacrificeSourceCost());
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
public CephalidSnitch(final CephalidSnitch card) {
super(card);
}
@Override
public CephalidSnitch copy() {
return new CephalidSnitch(this);
}
}
class CephalidSnitchEffect extends LoseAbilityTargetEffect{
public CephalidSnitchEffect() {
super(ProtectionAbility.from(ObjectColor.BLACK), Duration.EndOfTurn);
staticText = "Target creature loses protection from black until end of turn.";
}
public CephalidSnitchEffect(final CephalidSnitchEffect effect) {
super(effect);
}
@Override
public CephalidSnitchEffect copy() {
return new CephalidSnitchEffect(this);
}
public String filterNameAssembler(List<ObjectColor> unsortedColors) {
//Order colors properly by WUBRG (skipping black of course) and construct string to be displayed for ability.
List<ObjectColor> colors = new ArrayList<>();
if(unsortedColors.contains(ObjectColor.WHITE)){
colors.add(ObjectColor.WHITE);
}
if(unsortedColors.contains(ObjectColor.BLUE)){
colors.add(ObjectColor.BLUE);
}
if(unsortedColors.contains(ObjectColor.RED)){
colors.add(ObjectColor.RED);
}
if(unsortedColors.contains(ObjectColor.GREEN)){
colors.add(ObjectColor.GREEN);
}
if (colors.size() == 1) {
return colors.get(0).getDescription();
} else if (colors.size() == 2) {
return colors.get(0).getDescription() + " and from " + colors.get(1).getDescription();
} else if (colors.size() == 3) {
return colors.get(0).getDescription() + ", from " + colors.get(1).getDescription() + " and from " + colors.get(2).getDescription();
} else if (colors.size() == 4) {
return colors.get(0).getDescription() + ", from " + colors.get(1).getDescription() + ", from " + colors.get(2).getDescription() + " and from " + colors.get(3).getDescription();
}
return "";
}
@Override
public boolean apply(Game game, Ability source) {
Permanent targetCreature = game.getPermanent(targetPointer.getFirst(game, source));
if (targetCreature != null) {
//Go through protection abilities and sort out any containing black, then record the colors other than black
for(ProtectionAbility a: targetCreature.getAbilities().getProtectionAbilities()) {
List<ObjectColor> objectColors = new ArrayList<>();
if(a.getColors().contains(ObjectColor.BLACK))
for (ObjectColor o : a.getColors()) {
if (!objectColors.contains(o) && !o.isBlack())
objectColors.add(o);
}
//Construct a card filter excluding black
if(objectColors.size() > 0) {
FilterCard filter = new FilterCard(filterNameAssembler(objectColors));
if (objectColors.size() == 1)
filter.add(new ColorPredicate(objectColors.get(0)));
else if (objectColors.size() == 2)
filter.add(Predicates.or(new ColorPredicate(objectColors.get(0)), new ColorPredicate(objectColors.get(1))));
else if (objectColors.size() == 3)
filter.add(Predicates.or(new ColorPredicate(objectColors.get(0)), new ColorPredicate(objectColors.get(1)), new ColorPredicate(objectColors.get(2))));
else if (objectColors.size() == 4)
filter.add(Predicates.or(new ColorPredicate(objectColors.get(0)), new ColorPredicate(objectColors.get(1)), new ColorPredicate(objectColors.get(2)), new ColorPredicate(objectColors.get(3))));
a.setFilter(filter);
}
}
return true;
}
return false;
}
}

View file

@ -32,7 +32,7 @@ import mage.MageInt;
import mage.Mana;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.common.ChancellorAbility;
import mage.abilities.effects.common.BasicManaEffect;
import mage.abilities.effects.mana.BasicManaEffect;
import mage.abilities.keyword.ReachAbility;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl;

View file

@ -33,7 +33,7 @@ import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.effects.Effects;
import mage.abilities.effects.common.BasicManaEffect;
import mage.abilities.effects.mana.BasicManaEffect;
import mage.abilities.effects.common.DamageAllControlledTargetEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.constants.SubType;

View file

@ -205,7 +205,7 @@ class ChandraPyromasterEffect2 extends OneShotEffect {
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null && controller.getLibrary().hasCards()) {
Library library = controller.getLibrary();
Card card = library.removeFromTop(game);
Card card = library.getFromTop(game);
if (card != null) {
controller.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getIdName() + " <this card may be played the turn it was exiled>", source.getSourceId(), game, Zone.LIBRARY, true);
game.addEffect(new ChandraPyromasterPlayEffect(new MageObjectReference(card, game)), source);

View file

@ -35,7 +35,7 @@ import mage.abilities.LoyaltyAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.BasicManaEffect;
import mage.abilities.effects.mana.BasicManaEffect;
import mage.abilities.effects.common.DamagePlayersEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.GetEmblemEffect;

View file

@ -34,7 +34,7 @@ import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.SpecialAction;
import mage.abilities.costs.common.PayLifeCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.BasicManaEffect;
import mage.abilities.effects.mana.BasicManaEffect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.effects.common.CreateSpecialActionEffect;
import mage.abilities.effects.common.RemoveSpecialActionEffect;

View file

@ -30,7 +30,7 @@ package mage.cards.c;
import java.util.UUID;
import mage.Mana;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AddManaToManaPoolSourceControllerEffect;
import mage.abilities.effects.mana.AddManaToManaPoolSourceControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;

View file

@ -38,9 +38,9 @@ import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
@ -52,7 +52,7 @@ import mage.players.Player;
public class ChaosHarlequin extends CardImpl {
public ChaosHarlequin(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}{R}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{R}");
this.subtype.add(SubType.HUMAN);
this.power = new MageInt(2);
this.toughness = new MageInt(4);
@ -91,7 +91,7 @@ class ChaosHarlequinEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Card card = player.getLibrary().removeFromTop(game);
Card card = player.getLibrary().getFromTop(game);
if (card != null) {
player.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, true);
if (card.isLand()) {

View file

@ -37,7 +37,7 @@ import mage.abilities.common.TapForManaAllTriggeredManaAbility;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AddManaToManaPoolTargetControllerEffect;
import mage.abilities.effects.mana.AddManaToManaPoolTargetControllerEffect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.effects.common.ManaEffect;
import mage.abilities.effects.common.continuous.BoostAllEffect;

View file

@ -27,6 +27,7 @@
*/
package mage.cards.c;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import mage.Mana;
@ -42,8 +43,8 @@ import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.costs.mana.MonoHybridManaCost;
import mage.abilities.costs.mana.VariableManaCost;
import mage.abilities.effects.common.BasicManaEffect;
import mage.abilities.effects.common.ManaEffect;
import mage.abilities.effects.mana.BasicManaEffect;
import mage.abilities.mana.ActivatedManaAbilityImpl;
import mage.abilities.mana.ManaOptions;
import mage.cards.Card;
@ -84,8 +85,7 @@ class CharmedPendantAbility extends ActivatedManaAbilityImpl {
public CharmedPendantAbility() {
super(Zone.BATTLEFIELD, new CharmedPendantManaEffect(), new TapSourceCost());
this.addCost(new PutTopCardOfYourLibraryToGraveyardCost());
this.netMana.add(new Mana(0, 0, 0, 0, 0, 0, 0, 0));
this.setUndoPossible(false); // Otherwise you could retunrn the card from graveyard
this.setUndoPossible(false); // Otherwise you could return the card from graveyard
}
public CharmedPendantAbility(Zone zone, Mana mana, Cost cost) {
@ -135,6 +135,18 @@ class CharmedPendantManaEffect extends ManaEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
checkToFirePossibleEvents(getMana(game, source), game, source);
controller.getManaPool().addMana(getMana(game, source), game, source);
return true;
}
return false;
}
@Override
public Mana produceMana(boolean netMana, Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Mana mana = new Mana();
@ -178,29 +190,28 @@ class CharmedPendantManaEffect extends ManaEffect {
}
}
checkToFirePossibleEvents(mana, game, source);
controller.getManaPool().addMana(mana, game, source);
return true;
return mana;
}
return false;
return null;
}
@Override
public Mana getMana(Game game, Ability source) {
public List<Mana> getNetMana(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
if (controller.isTopCardRevealed()) {
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
Mana mana = card.getManaCost().getMana().copy();
mana.setColorless(0);
mana.setGeneric(0);
return mana;
List<Mana> netMana = card.getManaCost().getManaOptions();
for (Mana mana : netMana) {
mana.setColorless(0);
mana.setGeneric(0);
}
return netMana;
}
}
}
return null; // You don't know if and which amount or color of mana you get
return null;
}
}

View file

@ -28,6 +28,7 @@
package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SpellCastOpponentTriggeredAbility;
@ -48,11 +49,10 @@ import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
/**
*
* @author Pete Rossi
*/
public class ChimericEgg extends CardImpl {
@ -65,13 +65,17 @@ public class ChimericEgg extends CardImpl {
public ChimericEgg(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
// Whenever an opponent casts a nonartifact spell, put a charge counter on Chimeric Egg.
this.addAbility(new SpellCastOpponentTriggeredAbility(new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), nonArtifactFilter, false));
// Remove three charge counters from Chimeric Egg: Chimeric Egg becomes a 6/6 Construct artifact creature with trample until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect
(new ChimericEggToken(), "", Duration.EndOfTurn), new RemoveCountersSourceCost(new Counter(CounterType.CHARGE.getName(), 3))));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(
new CreatureToken(6, 6, "6/6 Construct artifact creature with trample")
.withSubType(SubType.CONSTRUCT)
.withType(CardType.ARTIFACT)
.withAbility(TrampleAbility.getInstance()),
"", Duration.EndOfTurn), new RemoveCountersSourceCost(new Counter(CounterType.CHARGE.getName(), 3))));
}
public ChimericEgg(final ChimericEgg card) {
@ -82,23 +86,4 @@ public class ChimericEgg extends CardImpl {
public ChimericEgg copy() {
return new ChimericEgg(this);
}
private static class ChimericEggToken extends TokenImpl {
ChimericEggToken() {
super("", "6/6 Construct artifact creature with trample");
cardType.add(CardType.ARTIFACT);
cardType.add(CardType.CREATURE);
this.subtype.add(SubType.CONSTRUCT);
power = new MageInt(6);
toughness = new MageInt(6);
this.addAbility(TrampleAbility.getInstance());
}
public ChimericEggToken(final ChimericEggToken token) {
super(token);
}
public ChimericEggToken copy() {
return new ChimericEggToken(this);
}
}
}

View file

@ -28,6 +28,7 @@
package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -43,19 +44,23 @@ import mage.constants.Zone;
import mage.filter.common.FilterControlledLandPermanent;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
/**
*
* @author LevelX2
*/
public class ChimericIdol extends CardImpl {
public ChimericIdol(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
// {0}: Tap all lands you control. Chimeric Idol becomes a 3/3 Turtle artifact creature until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapAllEffect(new FilterControlledLandPermanent("lands you control")), new ManaCostsImpl("{0}"));
ability.addEffect(new BecomesCreatureSourceEffect(new ChimericIdolToken(), "", Duration.EndOfTurn));
ability.addEffect(new BecomesCreatureSourceEffect(
new CreatureToken(3, 3, "3/3 Turtle artifact creature")
.withSubType(SubType.TURTLE)
.withType(CardType.ARTIFACT),
"", Duration.EndOfTurn));
this.addAbility(ability);
}
@ -68,23 +73,4 @@ public class ChimericIdol extends CardImpl {
public ChimericIdol copy() {
return new ChimericIdol(this);
}
}
class ChimericIdolToken extends TokenImpl {
public ChimericIdolToken() {
super("Turtle", "3/3 Turtle artifact creature token");
cardType.add(CardType.ARTIFACT);
cardType.add(CardType.CREATURE);
subtype.add(SubType.TURTLE);
power = new MageInt(3);
toughness = new MageInt(3);
}
public ChimericIdolToken(final ChimericIdolToken token) {
super(token);
}
public ChimericIdolToken copy() {
return new ChimericIdolToken(this);
}
}
}

View file

@ -28,6 +28,7 @@
package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.SimpleActivatedAbility;
@ -46,6 +47,7 @@ import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
/**
* @author BetaSteward_at_googlemail.com
@ -53,14 +55,19 @@ import mage.game.permanent.token.Token;
public class ChimericMass extends CardImpl {
public ChimericMass(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{X}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{X}");
// Chimeric Mass enters the battlefield with X charge counters on it.
this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.CHARGE.createInstance())));
// {1}: Until end of turn, Chimeric Mass becomes a Construct artifact creature with "This creature's power and toughness are each equal to the number of charge counters on it."
// set to character defining to prevent setting P/T again to 0 becuase already set by CDA of the token
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new ChimericMassToken(), "", Duration.EndOfTurn, false, true), new GenericManaCost(1)));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(
new CreatureToken(0, 0, "Construct artifact creature with \"This creature's power and toughness are each equal to the number of charge counters on it.\"")
.withType(CardType.ARTIFACT)
.withSubType(SubType.CONSTRUCT)
.withAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetPowerToughnessSourceEffect(new CountersSourceCount(CounterType.CHARGE), Duration.WhileOnBattlefield))),
"", Duration.EndOfTurn, false, true), new GenericManaCost(1)));
}
public ChimericMass(final ChimericMass card) {
@ -72,23 +79,4 @@ public class ChimericMass extends CardImpl {
return new ChimericMass(this);
}
}
class ChimericMassToken extends TokenImpl {
public ChimericMassToken() {
super("", "Construct artifact creature with \"This creature's power and toughness are each equal to the number of charge counters on it.\"");
cardType.add(CardType.CREATURE);
subtype.add(SubType.CONSTRUCT);
power = new MageInt(0);
toughness = new MageInt(0);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SetPowerToughnessSourceEffect(new CountersSourceCount(CounterType.CHARGE), Duration.WhileOnBattlefield)));
}
public ChimericMassToken(final ChimericMassToken token) {
super(token);
}
public ChimericMassToken copy() {
return new ChimericMassToken(this);
}
}
}

View file

@ -39,7 +39,6 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
/**
*
@ -51,10 +50,10 @@ public class ChimericSphere extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}");
// {2}: Until end of turn, Chimeric Sphere becomes a 2/1 Construct artifact creature with flying.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new ChimericSphereCreature1(),
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new ChimericSphereFlyingToken(),
"", Duration.EndOfTurn), new ManaCostsImpl("{2}")));
// {2}: Until end of turn, Chimeric Sphere becomes a 3/2 Construct artifact creature without flying.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new ChimericSphereCreature2(),
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new ChimericSphereNotFlyingToken(),
"", Duration.EndOfTurn), new ManaCostsImpl("{2}")));
}
@ -68,9 +67,9 @@ public class ChimericSphere extends CardImpl {
}
}
class ChimericSphereCreature1 extends TokenImpl {
class ChimericSphereFlyingToken extends TokenImpl {
public ChimericSphereCreature1() {
public ChimericSphereFlyingToken() {
super("Chimeric Sphere", "2/1 Construct artifact creature with flying");
cardType.add(CardType.ARTIFACT);
cardType.add(CardType.CREATURE);
@ -79,30 +78,30 @@ class ChimericSphereCreature1 extends TokenImpl {
this.addAbility(FlyingAbility.getInstance());
}
public ChimericSphereCreature1(final ChimericSphereCreature1 token) {
public ChimericSphereFlyingToken(final ChimericSphereFlyingToken token) {
super(token);
}
public ChimericSphereCreature1 copy() {
return new ChimericSphereCreature1(this);
public ChimericSphereFlyingToken copy() {
return new ChimericSphereFlyingToken(this);
}
}
class ChimericSphereCreature2 extends TokenImpl {
class ChimericSphereNotFlyingToken extends TokenImpl {
public ChimericSphereCreature2() {
public ChimericSphereNotFlyingToken() {
super("Chimeric Sphere", "3/2 Construct artifact creature without flying");
cardType.add(CardType.ARTIFACT);
cardType.add(CardType.CREATURE);
power = new MageInt(3);
toughness = new MageInt(2);
}
public ChimericSphereCreature2(final ChimericSphereCreature2 token) {
public ChimericSphereNotFlyingToken(final ChimericSphereNotFlyingToken token) {
super(token);
}
public ChimericSphereCreature2 copy() {
return new ChimericSphereCreature2(this);
public ChimericSphereNotFlyingToken copy() {
return new ChimericSphereNotFlyingToken(this);
}
}

View file

@ -52,7 +52,7 @@ public class ChorusOfTheTides extends CardImpl {
// Flying
this.addAbility(FlyingAbility.getInstance());
// <i>Heroic</i> - Whenever you cast a spell that targets Chorus of the Tides, scry 1.
// <i>Heroic</i> &mdash; Whenever you cast a spell that targets Chorus of the Tides, scry 1.
this.addAbility(new HeroicAbility(new ScryEffect(1)));
}

View file

@ -150,6 +150,18 @@ class ChromeMoxManaEffect extends ManaEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
checkToFirePossibleEvents(getMana(game, source), game, source);
player.getManaPool().addMana(getMana(game, source), game, source);
return true;
}
return false;
}
@Override
public Mana produceMana(boolean netMana, Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
Player player = game.getPlayer(source.getControllerId());
if (permanent != null && player != null) {
@ -176,14 +188,14 @@ class ChromeMoxManaEffect extends ManaEffect {
if (color.isWhite()) {
choice.getChoices().add("White");
}
Mana mana = new Mana();
if (!choice.getChoices().isEmpty()) {
Mana mana = new Mana();
if (choice.getChoices().size() == 1) {
choice.setChoice(choice.getChoices().iterator().next());
} else {
if (!player.choose(outcome, choice, game)) {
return false;
return null;
}
}
switch (choice.getChoice()) {
@ -208,17 +220,12 @@ class ChromeMoxManaEffect extends ManaEffect {
default:
break;
}
checkToFirePossibleEvents(mana, game, source);
player.getManaPool().addMana(mana, game, source);
}
return mana;
}
}
}
return true;
}
@Override
public Mana getMana(Game game, Ability source) {
return null;
}

View file

@ -30,12 +30,10 @@ package mage.cards.c;
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;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -48,8 +46,7 @@ import mage.target.common.TargetCreaturePermanent;
public class Chronostutter extends CardImpl {
public Chronostutter(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{5}{U}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{5}{U}");
// Put target creature into its owner's library second from the top.
this.getSpellAbility().addEffect(new ChronostutterEffect());
@ -85,22 +82,11 @@ class ChronostutterEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
Player owner = game.getPlayer(permanent.getOwnerId());
Player controller = game.getPlayer(permanent.getControllerId());
if (owner == null || controller == null) {
return false;
}
Card card = null;
if (owner.getLibrary().hasCards()) {
card = owner.getLibrary().removeFromTop(game);
}
permanent.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
if (card != null) {
owner.getLibrary().putOnTop(card, game);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent != null) {
controller.putCardOnTopXOfLibrary(permanent, game, source, 2);
}
return true;
}

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