Merge branch 'master' into JaceArchitectOfThoughtFix

This commit is contained in:
LevelX2 2018-11-26 17:29:31 +01:00 committed by GitHub
commit c4cd4b8b6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
320 changed files with 14921 additions and 4691 deletions

View file

@ -1,10 +1,9 @@
package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.effects.common.LoseLifeOpponentsEffect;
import mage.abilities.effects.common.LoseLifeAllPlayersEffect;
import mage.abilities.keyword.MenaceAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -18,7 +17,7 @@ import mage.constants.SubType;
public final class AdroitHateflayer extends CardImpl {
public AdroitHateflayer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{U}{B}{R}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}{B}{R}");
this.subtype.add(SubType.NAUTOLAN);
this.subtype.add(SubType.SITH);
this.power = new MageInt(3);
@ -26,9 +25,9 @@ public final class AdroitHateflayer extends CardImpl {
// Menace
this.addAbility(new MenaceAbility());
// Whenever Adroit Hateflayer attacks, each opponent loses 2 life.
this.addAbility(new AttacksTriggeredAbility(new LoseLifeOpponentsEffect(2), false));
// Whenever Adroit Hateflayer attacks, each player loses 2 life.
this.addAbility(new AttacksTriggeredAbility(new LoseLifeAllPlayersEffect(2), false));
}
public AdroitHateflayer(final AdroitHateflayer card) {

View file

@ -0,0 +1,47 @@
package mage.cards.a;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.BandsWithOtherAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.filter.predicate.mageobject.SupertypePredicate;
/**
*
* @author L_J
*/
public final class AdventurersGuildhouse extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Green legendary creatures");
static {
filter.add(new ColorPredicate(ObjectColor.GREEN));
filter.add(new SupertypePredicate(SuperType.LEGENDARY));
}
public AdventurersGuildhouse(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
// Green legendary creatures you control have "bands with other legendary creatures."
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(new BandsWithOtherAbility(SuperType.LEGENDARY), Duration.WhileOnBattlefield, filter)));
}
public AdventurersGuildhouse(final AdventurersGuildhouse card) {
super(card);
}
@Override
public AdventurersGuildhouse copy() {
return new AdventurersGuildhouse(this);
}
}

View file

@ -44,7 +44,7 @@ public class AminatouTheFateShifter extends CardImpl {
}
public AminatouTheFateShifter(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{W}{U}{B}");
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{W}{U}{B}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.AMINATOU);
@ -56,7 +56,7 @@ public class AminatouTheFateShifter extends CardImpl {
// -1: Exile another target permanent you own, then return it to the battlefield under your control.
ability = new LoyaltyAbility(new ExileTargetForSourceEffect(), -1);
ability.addEffect(new ReturnToBattlefieldUnderYourControlTargetEffect());
ability.addEffect(new ReturnToBattlefieldUnderYourControlTargetEffect(true));
ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability);
@ -68,6 +68,7 @@ public class AminatouTheFateShifter extends CardImpl {
// Aminatou, the Fateshifter can be your commander.
this.addAbility(CanBeYourCommanderAbility.getInstance());
}
public AminatouTheFateShifter(final AminatouTheFateShifter card) {
super(card);
}
@ -79,6 +80,7 @@ public class AminatouTheFateShifter extends CardImpl {
}
class AminatouPlusEffect extends OneShotEffect {
public AminatouPlusEffect() {
super(Outcome.DrawCard);
staticText = "draw a card, then put a card from your hand on top of your library";
@ -118,10 +120,11 @@ class AminatouPlusEffect extends OneShotEffect {
}
class AminatouUltimateEffect extends OneShotEffect {
public AminatouUltimateEffect (){
public AminatouUltimateEffect() {
super(Outcome.Benefit);
staticText = "Choose left or right. Each player gains control of all nonland permanents other than Aminatou," +
" the Fateshifter controlled by the next player in the chosen direction.";
staticText = "Choose left or right. Each player gains control of all nonland permanents other than Aminatou,"
+ " the Fateshifter controlled by the next player in the chosen direction.";
}
public AminatouUltimateEffect(final AminatouUltimateEffect effect) {
@ -129,7 +132,9 @@ class AminatouUltimateEffect extends OneShotEffect {
}
@Override
public AminatouUltimateEffect copy(){return new AminatouUltimateEffect(this);}
public AminatouUltimateEffect copy() {
return new AminatouUltimateEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
@ -154,7 +159,7 @@ class AminatouUltimateEffect extends OneShotEffect {
return false;
}
// skip players out of range
if (!game.getState().getPlayersInRange(controller.getId(), game).contains(nextPlayer)){
if (!game.getState().getPlayersInRange(controller.getId(), game).contains(nextPlayer)) {
continue;
}
// save first next player to check for iteration stop
@ -164,7 +169,7 @@ class AminatouUltimateEffect extends OneShotEffect {
FilterNonlandPermanent nextPlayerNonlandPermanentsFilter = new FilterNonlandPermanent();
nextPlayerNonlandPermanentsFilter.add(new ControllerIdPredicate(nextPlayer));
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(nextPlayerNonlandPermanentsFilter, game)) {
if (permanent.getId().equals(source.getSourceId())){
if (permanent.getId().equals(source.getSourceId())) {
continue;
}
ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfGame, currentPlayer);
@ -188,4 +193,3 @@ class AminatouUltimateEffect extends OneShotEffect {
return nextPlayerId;
}
}

View file

@ -0,0 +1,48 @@
package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.common.BlocksOrBecomesBlockedByOneOrMoreTriggeredAbility;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate;
/**
*
* @author L_J
*/
public final class AmphibiousKavu extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("blue and/or black creatures");
static {
filter.add(Predicates.or(new ColorPredicate(ObjectColor.BLUE), new ColorPredicate(ObjectColor.BLACK)));
}
public AmphibiousKavu(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}");
this.subtype.add(SubType.KAVU);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Whenever Amphibious Kavu blocks or becomes blocked by one or more blue and/or black creatures, Amphibious Kavu gets +3/+3 until end of turn.
this.addAbility(new BlocksOrBecomesBlockedByOneOrMoreTriggeredAbility(new BoostSourceEffect(3, 3, Duration.EndOfTurn), filter, false));
}
public AmphibiousKavu(final AmphibiousKavu card) {
super(card);
}
@Override
public AmphibiousKavu copy() {
return new AmphibiousKavu(this);
}
}

View file

@ -1,43 +1,34 @@
package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
import mage.abilities.common.ZoneChangeTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileTargetForSourceEffect;
import mage.abilities.effects.common.ReturnFromExileForSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardIdPredicate;
import mage.target.Target;
import mage.target.common.TargetCardInGraveyard;
import mage.target.common.TargetCreaturePermanent;
import mage.util.CardUtil;
import mage.target.common.TargetCardInGraveyardOrBattlefield;
/**
*
* @author LevelX2
*/
public final class AngelOfSerenity extends CardImpl {
private static final String rule = "you may exile up to three other target creatures from the battlefield and/or creature cards from graveyards.";
public AngelOfSerenity(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{W}{W}{W}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}{W}{W}");
this.subtype.add(SubType.ANGEL);
this.power = new MageInt(5);
@ -47,7 +38,12 @@ public final class AngelOfSerenity extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// When Angel of Serenity enters the battlefield, you may exile up to three other target creatures from the battlefield and/or creature cards from graveyards.
this.addAbility(new AngelOfSerenityTriggeredAbility());
FilterCreatureCard filter = new FilterCreatureCard("creatures from the battlefield and/or a graveyard");
filter.add(Predicates.not(new CardIdPredicate(this.getId())));
Ability ability = new EntersBattlefieldTriggeredAbility(new ExileTargetForSourceEffect().setText(rule), true);
Target target = new TargetCardInGraveyardOrBattlefield(0, 3, filter);
ability.addTarget(target);
this.addAbility(ability);
// When Angel of Serenity leaves the battlefield, return the exiled cards to their owners' hands.
this.addAbility(new LeavesBattlefieldTriggeredAbility(new ReturnFromExileForSourceEffect(Zone.HAND, false, true), false));
@ -62,92 +58,3 @@ public final class AngelOfSerenity extends CardImpl {
return new AngelOfSerenity(this);
}
}
class AngelOfSerenityTriggeredAbility extends ZoneChangeTriggeredAbility {
public AngelOfSerenityTriggeredAbility() {
super(Zone.BATTLEFIELD, new AngelOfSerenityEnterEffect(), "When {this} enters the battlefield, ", true);
}
public AngelOfSerenityTriggeredAbility(AngelOfSerenityTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (super.checkTrigger(event, game)) {
getTargets().clear();
FilterCreaturePermanent filter = new FilterCreaturePermanent("up to three other target creatures");
filter.add(new AnotherPredicate());
TargetCreaturePermanent target1 = new TargetCreaturePermanent(0, 3, filter, false);
game.getPlayer(getControllerId()).chooseTarget(Outcome.Exile, target1, this, game);
if (!target1.getTargets().isEmpty()) {
getTargets().add(target1);
}
int leftTargets = 3 - target1.getTargets().size();
if (leftTargets > 0) {
FilterCard filter2 = new FilterCreatureCard("up to " + leftTargets + " target creature card" + (leftTargets > 1 ? "s" : "") + " from graveyards");
TargetCardInGraveyard target2 = new TargetCardInGraveyard(0, leftTargets, filter2);
game.getPlayer(getControllerId()).chooseTarget(Outcome.Exile, target2, this, game);
if (!target2.getTargets().isEmpty()) {
getTargets().add(target2);
}
}
return true;
}
return false;
}
@Override
public AngelOfSerenityTriggeredAbility copy() {
return new AngelOfSerenityTriggeredAbility(this);
}
}
class AngelOfSerenityEnterEffect extends OneShotEffect {
public AngelOfSerenityEnterEffect() {
super(Outcome.ReturnToHand);
this.staticText = "you may exile up to three other target creatures from the battlefield and/or creature cards from graveyards";
}
public AngelOfSerenityEnterEffect(final AngelOfSerenityEnterEffect effect) {
super(effect);
}
@Override
public AngelOfSerenityEnterEffect copy() {
return new AngelOfSerenityEnterEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
boolean result = true;
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null && !source.getTargets().isEmpty()) {
UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
for (Target target : source.getTargets()) {
if (target instanceof TargetCreaturePermanent) {
for (UUID permanentId : target.getTargets()) {
Permanent permanent = game.getPermanent(permanentId);
if (permanent != null) {
result |= controller.moveCardToExileWithInfo(permanent, exileZoneId, sourceObject.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true);
}
}
} else if (target instanceof TargetCardInGraveyard) {
for (UUID cardId : target.getTargets()) {
Card card = game.getCard(cardId);
if (card != null) {
result |= controller.moveCardToExileWithInfo(card, exileZoneId, sourceObject.getIdName(), source.getSourceId(), game, Zone.GRAVEYARD, true);
}
}
}
}
}
return result;
}
}

View file

@ -0,0 +1,53 @@
package mage.cards.a;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTappedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.TotemArmorAbility;
import mage.abilities.mana.AnyColorManaAbility;
import mage.abilities.mana.WhiteManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
* @author JayDi85
*/
public final class AngelicReward extends CardImpl {
public AngelicReward(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}{W}");
this.subtype.add(SubType.AURA);
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Enchanted creature gets +3/+3 and has flying.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(3, 3, Duration.WhileOnBattlefield)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(FlyingAbility.getInstance(), AttachmentType.AURA)));
}
public AngelicReward(final AngelicReward card) {
super(card);
}
@Override
public AngelicReward copy() {
return new AngelicReward(this);
}
}

View file

@ -1,10 +1,8 @@
package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.CreatureEntersBattlefieldTriggeredAbility;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
@ -12,10 +10,12 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.permanent.token.custom.CreatureToken;
import java.util.UUID;
/**
* @author Loki
*/
@ -25,12 +25,18 @@ public final class AngelsTomb extends CardImpl {
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 CreatureToken(3, 3, "3/3 white Angel artifact creature with flying")
.withColor("W")
.withSubType(SubType.ANGEL)
.withAbility(FlyingAbility.getInstance()),
"", Duration.EndOfTurn), true));
Effect effect = new BecomesCreatureSourceEffect(new CreatureToken(3, 3, "3/3 white Angel artifact creature with flying")
.withColor("W")
.withSubType(SubType.ANGEL)
.withAbility(FlyingAbility.getInstance()),
"", Duration.EndOfTurn)
.setText("have {this} become a 3/3 white Angel artifact creature with flying until end of turn");
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(
Zone.BATTLEFIELD,
effect,
StaticFilters.FILTER_PERMANENT_CREATURE_A,
true)
);
}
public AngelsTomb(final AngelsTomb card) {

View file

@ -0,0 +1,64 @@
package mage.cards.a;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.TargetController;
import mage.game.Game;
import mage.watchers.common.BloodthirstWatcher;
/**
*
* @author jeffwadsworth
*/
public final class Antagonism extends CardImpl {
private static final String rule = "{this} deals 2 damage to that player unless one of his or her opponents was dealt damage this turn";
public Antagonism(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{R}");
// At the beginning of each player's end step, Antagonism deals 2 damage to that player unless one of his or her opponents was dealt damage this turn.
this.addAbility(new BeginningOfEndStepTriggeredAbility(new ConditionalOneShotEffect(new DamageTargetEffect(2),
new OpponentWasNotDealtDamageCondition(), rule), TargetController.ANY, false));
}
public Antagonism(final Antagonism card) {
super(card);
}
@Override
public Antagonism copy() {
return new Antagonism(this);
}
}
class OpponentWasNotDealtDamageCondition implements Condition {
public OpponentWasNotDealtDamageCondition() {
}
@Override
public boolean apply(Game game, Ability source) {
UUID activePlayer = game.getState().getActivePlayerId();
if (activePlayer != null) {
BloodthirstWatcher watcher = (BloodthirstWatcher) game.getState().getWatchers().get(BloodthirstWatcher.class.getSimpleName(), activePlayer);
if (watcher != null) {
return !watcher.conditionMet();
}
}
return false;
}
@Override
public String toString() {
return "if an opponent was dealt damage this turn";
}
}

View file

@ -0,0 +1,67 @@
package mage.cards.a;
import java.util.UUID;
import mage.constants.SubType;
import mage.target.common.TargetCreaturePermanent;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.dynamicvalue.common.CountersSourceCount;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.constants.Outcome;
import mage.target.TargetPermanent;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.target.common.TargetAttackingOrBlockingCreature;
/**
*
* @author jeffwadsworth
*/
public final class ArcheryTraining extends CardImpl {
private static final String rule = "This creature deals X damage to target attacking or blocking creature, where X is the number of arrow counters on {this}.";
public ArcheryTraining(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{W}");
this.subtype.add(SubType.AURA);
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// At the beginning of your upkeep, you may put an arrow counter on Archery Training.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD,
new AddCountersSourceEffect(CounterType.ARROW.createInstance(), true), TargetController.YOU, true));
// Enchanted creature has "{tap}: This creature deals X damage to target attacking or blocking creature, where X is the number of arrow counters on Archery Training."
Ability gainedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(new CountersSourceCount(CounterType.ARROW)).setText(rule), new TapSourceCost());
gainedAbility.addTarget(new TargetAttackingOrBlockingCreature());
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(gainedAbility, AttachmentType.AURA)));
}
public ArcheryTraining(final ArcheryTraining card) {
super(card);
}
@Override
public ArcheryTraining copy() {
return new ArcheryTraining(this);
}
}

View file

@ -28,7 +28,6 @@ import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.FilterSpell;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -38,8 +37,6 @@ import mage.game.permanent.Permanent;
*/
public final class ArixmethesSlumberingIsle extends CardImpl {
private static final FilterSpell filter = new FilterSpell("a spell");
public ArixmethesSlumberingIsle(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{U}");

View file

@ -0,0 +1,93 @@
package mage.cards.a;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.cost.SpellCostReductionSourceForOpponentsEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
import java.util.UUID;
/**
* @author JayDi85
*/
public final class AvatarOfGrowth extends CardImpl {
public AvatarOfGrowth(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{G}");
this.subtype.add(SubType.ELEMENTAL);
this.subtype.add(SubType.AVATAR);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// This spell costs {1} less to cast for each opponent you have.
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SpellCostReductionSourceForOpponentsEffect("This spell costs {1} less to cast for each opponent you have")));
// Trample
this.addAbility(TrampleAbility.getInstance());
// When Avatar of Growth enters the battlefield, each player searches their library for up to two basic land cards, puts them onto the battlefield, then shuffles their library.
this.addAbility(new EntersBattlefieldTriggeredAbility(new AvatarOfGrowthSearchEffect()));
}
public AvatarOfGrowth(final AvatarOfGrowth card) {
super(card);
}
@Override
public AvatarOfGrowth copy() {
return new AvatarOfGrowth(this);
}
}
class AvatarOfGrowthSearchEffect extends OneShotEffect {
public AvatarOfGrowthSearchEffect() {
super(Outcome.Detriment);
this.staticText = "each player searches their library for up to two basic land cards, puts them onto the battlefield, then shuffles their libarary";
}
public AvatarOfGrowthSearchEffect(final AvatarOfGrowthSearchEffect effect) {
super(effect);
}
@Override
public AvatarOfGrowthSearchEffect copy() {
return new AvatarOfGrowthSearchEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
TargetCardInLibrary target = new TargetCardInLibrary(0, 2, StaticFilters.FILTER_CARD_BASIC_LAND);
if (player.searchLibrary(target, game)) {
if (!target.getTargets().isEmpty()) {
player.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, source, game);
}
}
player.shuffleLibrary(source, game);
}
}
return true;
}
return false;
}
}

View file

@ -1,19 +1,19 @@
package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.OneShotEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
@ -23,8 +23,9 @@ import mage.target.Target;
import mage.target.TargetPermanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
*
* @author TheElk801
*/
public final class BeamsplitterMage extends CardImpl {
@ -156,7 +157,7 @@ class BeamsplitterMageEffect extends OneShotEffect {
if (usedTarget == null) {
return false;
}
FilterPermanent filter = new BeamsplitterMageFilter(usedTarget, source.getSourceId());
FilterPermanent filter = new BeamsplitterMageFilter(usedTarget, source.getSourceId(), source.getControllerId());
Target target1 = new TargetPermanent(filter);
target1.setNotTarget(true);
if (controller.choose(outcome, target1, source.getSourceId(), game)) {
@ -199,10 +200,11 @@ class BeamsplitterMageFilter extends FilterControlledPermanent {
private final Target target;
private final UUID notId;
public BeamsplitterMageFilter(Target target, UUID notId) {
public BeamsplitterMageFilter(Target target, UUID notId, UUID controllerId) {
super("creature this spell could target");
this.target = target;
this.notId = notId;
this.add(new ControllerIdPredicate(controllerId));
}
public BeamsplitterMageFilter(final BeamsplitterMageFilter filter) {

View file

@ -1,7 +1,6 @@
package mage.cards.b;
import java.util.UUID;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.cards.CardImpl;
@ -10,6 +9,8 @@ import mage.constants.CardType;
import mage.game.permanent.token.BeckonApparitionToken;
import mage.target.common.TargetCardInGraveyard;
import java.util.UUID;
/**
* @author Loki
*/
@ -18,6 +19,7 @@ public final class BeckonApparition extends CardImpl {
public BeckonApparition(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{W/B}");
// Exile target card from a graveyard. Create a 1/1 white and black Spirit creature token with flying.
this.getSpellAbility().addEffect(new ExileTargetEffect());
this.getSpellAbility().addTarget(new TargetCardInGraveyard());
this.getSpellAbility().addEffect(new CreateTokenEffect(new BeckonApparitionToken(), 1));

View file

@ -0,0 +1,199 @@
package mage.cards.b;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.FilterPlayer;
import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.other.PlayerIdPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.players.PlayerList;
import mage.target.Target;
import mage.target.TargetPermanent;
import mage.target.TargetPlayer;
import mage.target.common.TargetControlledPermanent;
/**
*
* @author LevelX2 & L_J
*/
public final class BendOrBreak extends CardImpl {
public BendOrBreak(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{R}");
// Each player separates all nontoken lands they control into two piles. For each player, one of their piles is chosen by one of their opponents of their choice. Destroy all lands in the chosen piles. Tap all lands in the other piles.
this.getSpellAbility().addEffect(new BendOrBreakEffect());
}
public BendOrBreak(final BendOrBreak card) {
super(card);
}
@Override
public BendOrBreak copy() {
return new BendOrBreak(this);
}
}
class BendOrBreakEffect extends OneShotEffect {
public BendOrBreakEffect() {
super(Outcome.DestroyPermanent);
this.staticText = "Each player separates all nontoken lands they control into two piles. For each player, one of their piles is chosen by one of their opponents of their choice. Destroy all lands in the chosen piles. Tap all lands in the other piles";
}
public BendOrBreakEffect(final BendOrBreakEffect effect) {
super(effect);
}
@Override
public BendOrBreakEffect copy() {
return new BendOrBreakEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
// Map of players and their piles
Map<UUID, List<List<Permanent>>> playerPermanents = new LinkedHashMap<>();
PlayerList playerList = game.getState().getPlayerList().copy();
while (!playerList.get().equals(source.getControllerId()) && controller.canRespond()) {
playerList.getNext();
}
Player currentPlayer = game.getPlayer(playerList.get());
Player nextPlayer;
UUID firstNextPlayer = null;
while (!getNextPlayerInDirection(true, playerList, game).equals(firstNextPlayer) && controller.canRespond()) {
nextPlayer = game.getPlayer(playerList.get());
if (nextPlayer == null) {
return false;
}
if (firstNextPlayer == null) {
firstNextPlayer = nextPlayer.getId();
}
if (!nextPlayer.canRespond()) {
continue;
}
// Each player separates all nontoken lands they control into two piles
if (currentPlayer != null && game.getState().getPlayersInRange(controller.getId(), game).contains(currentPlayer.getId())) {
List<Permanent> firstPile = new ArrayList<>();
List<Permanent> secondPile = new ArrayList<>();
FilterControlledLandPermanent filter = new FilterControlledLandPermanent("lands you control to assign to the first pile (lands not chosen will be assigned to the second pile)");
TargetPermanent target = new TargetControlledPermanent(0, Integer.MAX_VALUE, filter, true);
if (target.canChoose(source.getSourceId(), currentPlayer.getId(), game)) {
if (currentPlayer.chooseTarget(Outcome.Neutral, target, source, game)) {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, currentPlayer.getId(), game)) {
if (target.getTargets().contains(permanent.getId())) {
firstPile.add(permanent);
} else {
secondPile.add(permanent);
}
}
}
StringBuilder sb = new StringBuilder("First pile of ").append(currentPlayer.getLogName()).append(": ");
sb.append(firstPile.stream().map(Permanent::getLogName).collect(Collectors.joining(", ")));
game.informPlayers(sb.toString());
sb = new StringBuilder("Second pile of ").append(currentPlayer.getLogName()).append(": ");
sb.append(secondPile.stream().map(Permanent::getLogName).collect(Collectors.joining(", ")));
game.informPlayers(sb.toString());
}
List<List<Permanent>> playerPiles = new ArrayList<>();
playerPiles.add(firstPile);
playerPiles.add(secondPile);
playerPermanents.put(currentPlayer.getId(), playerPiles);
}
currentPlayer = nextPlayer;
}
// For each player, one of their piles is chosen by one of their opponents of their choice
for (Map.Entry<UUID, List<List<Permanent>>> playerPiles : playerPermanents.entrySet()) {
Player player = game.getPlayer(playerPiles.getKey());
if (player != null) {
FilterPlayer filter = new FilterPlayer("opponent");
List<PlayerIdPredicate> opponentPredicates = new ArrayList<>();
for (UUID opponentId : game.getOpponents(player.getId())) {
opponentPredicates.add(new PlayerIdPredicate(opponentId));
}
filter.add(Predicates.or(opponentPredicates));
Target target = new TargetPlayer(1, 1, true, filter);
target.setTargetController(player.getId());
target.setAbilityController(source.getControllerId());
if (player.chooseTarget(outcome, target, source, game)) {
Player chosenOpponent = game.getPlayer(target.getFirstTarget());
if (chosenOpponent != null) {
List<Permanent> firstPile = playerPiles.getValue().get(0);
List<Permanent> secondPile = playerPiles.getValue().get(1);
game.informPlayers(player.getLogName() + " chose " + chosenOpponent.getLogName() + " to choose his pile");
if (chosenOpponent.choosePile(outcome, "Piles of " + player.getName(), firstPile, secondPile, game)) {
List<List<Permanent>> lists = playerPiles.getValue();
lists.clear();
lists.add(firstPile);
lists.add(secondPile);
game.informPlayers(player.getLogName() + " will have their first pile destroyed");
} else {
List<List<Permanent>> lists = playerPiles.getValue();
lists.clear();
lists.add(secondPile);
lists.add(firstPile);
game.informPlayers(player.getLogName() + " will have their second pile destroyed");
}
}
}
}
}
// Destroy all lands in the chosen piles. Tap all lands in the other piles
for (Map.Entry<UUID, List<List<Permanent>>> playerPiles : playerPermanents.entrySet()) {
Player player = game.getPlayer(playerPiles.getKey());
if (player != null) {
List<Permanent> pileToSac = playerPiles.getValue().get(0);
List<Permanent> pileToTap = playerPiles.getValue().get(1);
for (Permanent permanent : pileToSac) {
if (permanent != null) {
permanent.destroy(source.getSourceId(), game, false);
}
}
for (Permanent permanent : pileToTap) {
if (permanent != null) {
permanent.tap(game);
}
}
}
}
return true;
}
return false;
}
private UUID getNextPlayerInDirection(boolean left, PlayerList playerList, Game game) {
UUID nextPlayerId;
if (left) {
nextPlayerId = playerList.getNext();
} else {
nextPlayerId = playerList.getPrevious();
}
return nextPlayerId;
}
}

View file

@ -0,0 +1,71 @@
package mage.cards.b;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeAttachedCost;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.target.TargetPermanent;
import mage.target.common.TargetControlledPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class BetrothedOfFire extends CardImpl {
private static final FilterControlledPermanent filter = new FilterControlledCreaturePermanent("an untapped creature");
static {
filter.add(Predicates.not(new TappedPredicate()));
}
public BetrothedOfFire(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
this.subtype.add(SubType.AURA);
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Sacrifice an untapped creature: Enchanted creature gets +2/+0 until end of turn.
this.addAbility(new SimpleActivatedAbility(
new BoostEnchantedEffect(2, 0, Duration.EndOfTurn),
new SacrificeTargetCost(new TargetControlledPermanent(filter))
));
// Sacrifice enchanted creature: Creatures you control get +2/+0 until end of turn.
this.addAbility(new SimpleActivatedAbility(
new BoostControlledEffect(2, 0, Duration.EndOfTurn),
new SacrificeAttachedCost()
));
}
public BetrothedOfFire(final BetrothedOfFire card) {
super(card);
}
@Override
public BetrothedOfFire copy() {
return new BetrothedOfFire(this);
}
}

View file

@ -1,14 +1,14 @@
package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.effects.common.SkipNextCombatEffect;
import mage.abilities.effects.common.SkipCombatStepEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
/**
@ -16,26 +16,28 @@ import mage.constants.SubType;
* @author Plopman
*/
public final class BlindingAngel extends CardImpl {
public BlindingAngel(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W}{W}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}{W}");
this.subtype.add(SubType.ANGEL);
this.power = new MageInt(2);
this.toughness = new MageInt(4);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever Blinding Angel deals combat damage to a player, that player skips their next combat phase.
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new SkipNextCombatEffect(), false, true));
}
// Whenever Blinding Angel deals combat damage to a player, that player skips their next combat phase.
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new SkipCombatStepEffect(Duration.OneUse).setText("that player skips their next combat phase."), false, true));
}
public BlindingAngel(final BlindingAngel card) {
super(card);
}
@Override
public BlindingAngel copy() {
return new BlindingAngel(this);
}
}
}

View file

@ -0,0 +1,40 @@
package mage.cards.b;
import mage.abilities.effects.common.TapAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterOpponentsCreaturePermanent;
import mage.filter.predicate.mageobject.ToughnessPredicate;
import java.util.UUID;
/**
* @author JayDi85
*/
public final class BlindingRadiance extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterOpponentsCreaturePermanent("creatures your opponents control with toughness 2 or less");
static {
filter.add(new ToughnessPredicate(ComparisonType.FEWER_THAN, 3));
}
public BlindingRadiance(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{W}");
// Tap all creatures your opponents control with toughness 2 or less.
TapAllEffect effect = new TapAllEffect(filter);
this.getSpellAbility().addEffect(effect);
}
public BlindingRadiance(final BlindingRadiance card) {
super(card);
}
@Override
public BlindingRadiance copy() {
return new BlindingRadiance(this);
}
}

View file

@ -31,8 +31,11 @@ public final class BoarUmbra extends CardImpl {
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Enchanted creature gets +3/+3.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(3, 3, Duration.WhileOnBattlefield)));
// Totem armor
this.addAbility(new TotemArmorAbility());
}

View file

@ -1,4 +1,3 @@
package mage.cards.b;
import java.util.ArrayList;
@ -111,6 +110,7 @@ class BrilliantUltimatumEffect extends OneShotEffect {
TargetCard targetExiledCard = new TargetCard(Zone.EXILED, new FilterCard());
if (controller.chooseTarget(Outcome.PlayForFree, selectedPile, targetExiledCard, source, game)) {
Card card = selectedPile.get(targetExiledCard.getFirstTarget(), game);
controller.canPlayLand();
if (controller.playCard(card, game, true, true, new MageObjectReference(source.getSourceObject(game), game))) {
selectedPileCards.remove(card);
selectedPile.remove(card);

View file

@ -0,0 +1,91 @@
package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalReplacementEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.PreventAllDamageToSourceEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.stack.Spell;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.target.Target;
/**
*
* @author L_J
*/
public final class BronzeHorse extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
static {
filter.add(new AnotherPredicate());
}
public BronzeHorse(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT, CardType.CREATURE},"{7}");
this.subtype.add(SubType.HORSE);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// Trample
this.addAbility(TrampleAbility.getInstance());
// As long as you control another creature, prevent all damage that would be dealt to Bronze Horse by spells that target it.
Effect effect = new ConditionalReplacementEffect(new PreventDamageToSourceBySpellsThatTargetIt(), new PermanentsOnTheBattlefieldCondition(filter));
effect.setText("As long as you control another creature, prevent all damage that would be dealt to {this} by spells that target it.");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}
public BronzeHorse(final BronzeHorse card) {
super(card);
}
@Override
public BronzeHorse copy() {
return new BronzeHorse(this);
}
}
class PreventDamageToSourceBySpellsThatTargetIt extends PreventAllDamageToSourceEffect {
public PreventDamageToSourceBySpellsThatTargetIt() {
super(Duration.WhileOnBattlefield);
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (super.applies(event, source, game)) {
if (event.getTargetId().equals(source.getSourceId())) {
Spell spell = game.getStack().getSpell(event.getSourceId());
if (spell != null) {
for (UUID modeId : spell.getStackAbility().getModes().getSelectedModes()) {
Mode mode = spell.getStackAbility().getModes().get(modeId);
for (Target target : mode.getTargets()) {
for (UUID targetId : target.getTargets()) {
if (targetId.equals(source.getSourceId())) {
return true;
}
}
}
}
}
}
}
return false;
}
}

View file

@ -0,0 +1,52 @@
package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.InfoEffect;
import mage.abilities.effects.common.PutOnLibraryTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.target.common.TargetCardInYourGraveyard;
/**
*
* @author L_J
*/
public final class CanalDredger extends CardImpl {
public CanalDredger(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{4}");
this.subtype.add(SubType.CONSTRUCT);
this.power = new MageInt(1);
this.toughness = new MageInt(5);
// TODO: Draft specific abilities not implemented
// Draft Canal Dredger face up.
this.addAbility(new SimpleStaticAbility(Zone.ALL, new InfoEffect("Draft Canal Dredger face up.")));
// Each player passes the last card from each booster pack to a player who drafted a card named Canal Dredger.
this.addAbility(new SimpleStaticAbility(Zone.ALL, new InfoEffect("Each player passes the last card from each booster pack to a player who drafted a card named Canal Dredger.")));
// {T}: Put target card from your graveyard on the bottom of your library.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutOnLibraryTargetEffect(false), new TapSourceCost());
ability.addTarget(new TargetCardInYourGraveyard());
this.addAbility(ability);
}
public CanalDredger(final CanalDredger card) {
super(card);
}
@Override
public CanalDredger copy() {
return new CanalDredger(this);
}
}

View file

@ -1,27 +1,34 @@
package mage.cards.c;
import java.util.UUID;
import mage.abilities.common.CreatureEntersBattlefieldTriggeredAbility;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.effects.common.counter.AddCountersAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledCreaturePermanent;
import java.util.UUID;
/**
*
* @author Loki
*/
public final class CatharsCrusade extends CardImpl {
public CatharsCrusade(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{W}{W}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}{W}");
// Whenever a creature enters the battlefield under your control, put a +1/+1 counter on each creature you control.
this.addAbility(new CreatureEntersBattlefieldTriggeredAbility(new AddCountersAllEffect(CounterType.P1P1.createInstance(), new FilterControlledCreaturePermanent())));
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(
Zone.BATTLEFIELD,
new AddCountersAllEffect(CounterType.P1P1.createInstance(), new FilterControlledCreaturePermanent()),
StaticFilters.FILTER_PERMANENT_CREATURE_A,
false)
);
}
public CatharsCrusade(final CatharsCrusade card) {

View file

@ -0,0 +1,47 @@
package mage.cards.c;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.BandsWithOtherAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.filter.predicate.mageobject.SupertypePredicate;
/**
*
* @author L_J
*/
public final class CathedralOfSerra extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("White legendary creatures");
static {
filter.add(new ColorPredicate(ObjectColor.WHITE));
filter.add(new SupertypePredicate(SuperType.LEGENDARY));
}
public CathedralOfSerra(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
// White legendary creatures you control have "bands with other legendary creatures."
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(new BandsWithOtherAbility(SuperType.LEGENDARY), Duration.WhileOnBattlefield, filter)));
}
public CathedralOfSerra(final CathedralOfSerra card) {
super(card);
}
@Override
public CathedralOfSerra copy() {
return new CathedralOfSerra(this);
}
}

View file

@ -135,7 +135,7 @@ class CelestialDawnToWhiteEffect extends ContinuousEffectImpl {
// Command
for (CommandObject commandObject : game.getState().getCommand()) {
if (commandObject instanceof Commander) {
if (commandObject.getControllerId().equals(controller.getId())) {
if (commandObject.isControlledBy(controller.getId())) {
setColor(commandObject.getColor(game), game);
}
}

View file

@ -1,16 +1,17 @@
package mage.cards.c;
import java.util.UUID;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.abilities.effects.common.turn.AddExtraTurnControllerEffect;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.filter.StaticFilters;
import java.util.UUID;
/**
*
* @author TheElk801
*/
public final class ChanceForGlory extends CardImpl {
@ -19,9 +20,10 @@ public final class ChanceForGlory extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{R}{W}");
// Creatures you control gain indestructible. Take an extra turn after this one. At the beginning of that turn's end step, you lose the game.
this.getSpellAbility().addEffect(new GainAbilityControlledEffect(
IndestructibleAbility.getInstance(), Duration.EndOfGame
).setText("Creatures you control gain indestructible"));
this.getSpellAbility().addEffect(new GainAbilityAllEffect(
IndestructibleAbility.getInstance(), Duration.EndOfGame,
StaticFilters.FILTER_CONTROLLED_CREATURES
).setText("Creatures you control gain indestructible."));
this.getSpellAbility().addEffect(new AddExtraTurnControllerEffect(true));
}

View file

@ -0,0 +1,92 @@
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.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Library;
import mage.players.Player;
/**
*
* @author davidmfritz
*/
public final class ClearTheLand extends CardImpl {
public ClearTheLand(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}");
// Each player reveals the top five cards of his or her library, puts all land cards revealed this way onto the battlefield tapped, and exiles the rest.
getSpellAbility().addEffect(new ClearTheLandEffect());
}
public ClearTheLand(final ClearTheLand card) {
super(card);
}
@Override
public ClearTheLand copy() {
return new ClearTheLand(this);
}
}
class ClearTheLandEffect extends OneShotEffect {
public ClearTheLandEffect() {
super(Outcome.Benefit);
this.staticText = "Each player reveals the top five cards of his or her library, puts all land cards revealed this way onto the battlefield tapped, and exiles the rest.";
}
public ClearTheLandEffect(final ClearTheLandEffect effect) {
super(effect);
}
@Override
public ClearTheLandEffect copy() {
return new ClearTheLandEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
boolean tapped = true;
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
Library library = player.getLibrary();
Cards cardsToReveal = new CardsImpl();
cardsToReveal.addAll(library.getTopCards(game, 5));
if (!cardsToReveal.isEmpty()) {
player.revealCards(source, "Revealed cards for " + player.getName(), cardsToReveal, game);
Cards cardsToPutOnBattlefield = new CardsImpl();
Cards cardsToExile = new CardsImpl();
for (Card card : cardsToReveal.getCards(game)) {
if (card.isLand()) {
cardsToPutOnBattlefield.add(card);
} else {
cardsToExile.add(card);
}
}
player.moveCards(cardsToPutOnBattlefield.getCards(game), Zone.BATTLEFIELD, source, game, tapped, false, true, null);
player.moveCards(cardsToExile.getCards(game), Zone.EXILED, source, game);
}
}
}
return true;
}
return false;
}
}

View file

@ -1,7 +1,6 @@
package mage.cards.c;
import java.util.UUID;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.keyword.FlashbackAbility;
@ -11,21 +10,21 @@ import mage.constants.CardType;
import mage.constants.TimingRule;
import mage.target.common.TargetCardInGraveyard;
import java.util.UUID;
/**
*
* @author cbt33, jonubuu (Withered Wretch)
*/
public final class CoffinPurge extends CardImpl {
public CoffinPurge(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{B}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{B}");
// Exile target card from a graveyard.
this.getSpellAbility().addEffect(new ExileTargetEffect());
this.getSpellAbility().addTarget(new TargetCardInGraveyard());
// Flashback {B}
this.addAbility(new FlashbackAbility(new ManaCostsImpl("{B}"), TimingRule.INSTANT));
}

View file

@ -0,0 +1,45 @@
package mage.cards.c;
import mage.abilities.Ability;
import mage.abilities.common.CastOnlyDuringPhaseStepSourceAbility;
import mage.abilities.condition.common.AttackedThisStepCondition;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.PhaseStep;
import mage.constants.TurnPhase;
import mage.game.permanent.token.SpiritWhiteToken;
import mage.watchers.common.PlayerAttackedStepWatcher;
import java.util.UUID;
/**
* @author JayDi85
*/
public final class ConfrontTheAssault extends CardImpl {
public ConfrontTheAssault(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{4}{W}");
// Cast this spell only if a creature is attacking you.
Ability ability = new CastOnlyDuringPhaseStepSourceAbility(
TurnPhase.COMBAT, PhaseStep.DECLARE_ATTACKERS, AttackedThisStepCondition.instance,
"Cast this spell only if a creature is attacking you."
);
ability.addWatcher(new PlayerAttackedStepWatcher());
this.addAbility(ability);
// Create three 1/1 white Spirit creature tokens with flying.
this.getSpellAbility().addEffect(new CreateTokenEffect(new SpiritWhiteToken("ANA"), 3));
}
public ConfrontTheAssault(final ConfrontTheAssault card) {
super(card);
}
@Override
public ConfrontTheAssault copy() {
return new ConfrontTheAssault(this);
}
}

View file

@ -88,7 +88,7 @@ class CoverOfWinterEffect extends PreventionEffectImpl {
if (event.getType() == GameEvent.EventType.DAMAGE_CREATURE) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getControllerId().equals(source.getControllerId())) {
if (permanent != null && permanent.isControlledBy(source.getControllerId())) {
return super.applies(event, source, game);
}
}

View file

@ -2,6 +2,7 @@
package mage.cards.c;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -19,13 +20,12 @@ import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author Loki
*/
public final class CrabUmbra extends CardImpl {
public CrabUmbra(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{U}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{U}");
this.subtype.add(SubType.AURA);
@ -35,8 +35,11 @@ public final class CrabUmbra extends CardImpl {
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// {2}{U}: Untap enchanted creature.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new UntapEnchantedEffect(), new ManaCostsImpl("{2}{U}")));
// Totem armor
this.addAbility(new TotemArmorAbility());
}

View file

@ -1,7 +1,6 @@
package mage.cards.c;
import java.util.UUID;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.cards.CardImpl;
@ -9,17 +8,21 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.target.common.TargetCardInGraveyard;
import java.util.UUID;
/**
*
* @author Loki
*/
public final class Cremate extends CardImpl {
public Cremate(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{B}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{B}");
// Exile target card from a graveyard.
this.getSpellAbility().addEffect(new ExileTargetEffect());
this.getSpellAbility().addTarget(new TargetCardInGraveyard());
// Draw a card.
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1));
}

View file

@ -0,0 +1,42 @@
package mage.cards.c;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.PowerPredicate;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
* @author JayDi85
*/
public final class CruelCut extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power 2 or less");
static {
filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, 3));
}
public CruelCut(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{B}");
// Destroy target creature with power 2 or less.
this.getSpellAbility().addEffect(new DestroyTargetEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
}
public CruelCut(final CruelCut card) {
super(card);
}
@Override
public CruelCut copy() {
return new CruelCut(this);
}
}

View file

@ -1,6 +1,9 @@
package mage.cards.c;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
@ -31,11 +34,6 @@ import mage.target.common.TargetLandPermanent;
import mage.target.targetpointer.FixedTarget;
import mage.watchers.Watcher;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
/**
*
* @author MTGfan
@ -123,7 +121,6 @@ class CyclopeanTombCreateTriggeredEffect extends OneShotEffect {
if (controller != null) {
Permanent tomb = game.getPermanentOrLKIBattlefield(source.getSourceId()); // we need to set the correct source object
DelayedTriggeredAbility ability = new AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(new CyclopeanTombEffect(), Duration.EndOfGame, false);
ability.setSourceObject(tomb, game);
ability.setControllerId(source.getControllerId());
ability.setSourceId(source.getSourceId());
game.addDelayedTriggeredAbility(ability);

View file

@ -0,0 +1,50 @@
package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.DrawDiscardControllerEffect;
import mage.abilities.effects.common.InfoEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
/**
*
* @author L_J
*/
public final class DealBroker extends CardImpl {
public DealBroker(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT, CardType.CREATURE},"{3}");
this.subtype.add(SubType.CONSTRUCT);
this.power = new MageInt(2);
this.toughness = new MageInt(3);
// TODO: Draft specific abilities not implemented
// Draft Deal Broker face up.
this.addAbility(new SimpleStaticAbility(Zone.ALL, new InfoEffect("Draft Deal Broker face up.")));
// Immediately after the draft, you may reveal a card in your card pool. Each other player may offer you one card in their card pool in exchange. You may accept any one offer.
this.addAbility(new SimpleStaticAbility(Zone.ALL, new InfoEffect("Immediately after the draft, you may reveal a card in your card pool. "
+ "Each other player may offer you one card in their card pool in exchange. You may accept any one offer.")));
// {T}: Draw a card, then discard a card.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawDiscardControllerEffect(), new TapSourceCost()));
}
public DealBroker(final DealBroker card) {
super(card);
}
@Override
public DealBroker copy() {
return new DealBroker(this);
}
}

View file

@ -0,0 +1,129 @@
package mage.cards.d;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.Target;
import mage.target.TargetCard;
import mage.target.common.TargetOpponent;
/**
*
* @author L_J
*/
public final class DeathOrGlory extends CardImpl {
public DeathOrGlory(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{W}");
// Separate all creature cards in your graveyard into two piles. Exile the pile of an opponents choice and return the other to the battlefield.
this.getSpellAbility().addEffect(new DeathOrGloryEffect());
}
public DeathOrGlory(final DeathOrGlory card) {
super(card);
}
@Override
public DeathOrGlory copy() {
return new DeathOrGlory(this);
}
}
class DeathOrGloryEffect extends OneShotEffect {
DeathOrGloryEffect() {
super(Outcome.Benefit);
this.staticText = "Separate all creature cards in your graveyard into two piles. Exile the pile of an opponents choice and return the other to the battlefield";
}
DeathOrGloryEffect(final DeathOrGloryEffect effect) {
super(effect);
}
@Override
public DeathOrGloryEffect copy() {
return new DeathOrGloryEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Cards cards = new CardsImpl();
cards.addAll(controller.getGraveyard().getCards(new FilterCreatureCard(), game));
if (!cards.isEmpty()) {
TargetCard targetCards = new TargetCard(0, cards.size(), Zone.EXILED, new FilterCard("cards to put in the first pile"));
List<Card> pile1 = new ArrayList<>();
if (controller.choose(Outcome.Neutral, cards, targetCards, game)) {
List<UUID> targets = targetCards.getTargets();
for (UUID targetId : targets) {
Card card = cards.get(targetId, game);
if (card != null) {
pile1.add(card);
cards.remove(card);
}
}
}
List<Card> pile2 = new ArrayList<>();
pile2.addAll(cards.getCards(game));
StringBuilder sb = new StringBuilder("First pile of ").append(controller.getLogName()).append(": ");
sb.append(pile1.stream().map(Card::getLogName).collect(Collectors.joining(", ")));
game.informPlayers(sb.toString());
sb = new StringBuilder("Second pile of ").append(controller.getLogName()).append(": ");
sb.append(pile2.stream().map(Card::getLogName).collect(Collectors.joining(", ")));
game.informPlayers(sb.toString());
Set<UUID> opponents = game.getOpponents(source.getControllerId());
if (!opponents.isEmpty()) {
Player opponent = game.getPlayer(opponents.iterator().next());
if (opponents.size() > 1) {
Target targetOpponent = new TargetOpponent(true);
if (controller.chooseTarget(Outcome.Neutral, targetOpponent, source, game)) {
opponent = game.getPlayer(targetOpponent.getFirstTarget());
game.informPlayers(controller.getLogName() + " chose " + opponent.getLogName() + " to choose his pile");
}
}
if (opponent != null) {
boolean choice = opponent.choosePile(outcome, "Choose a pile to put onto the battlefield.", pile1, pile2, game);
Zone pile1Zone = Zone.EXILED;
Zone pile2Zone = Zone.BATTLEFIELD;
if (choice) {
pile1Zone = Zone.BATTLEFIELD;
pile2Zone = Zone.EXILED;
}
Set<Card> pile1Set = new HashSet<>();
Set<Card> pile2Set = new HashSet<>();
pile1Set.addAll(pile1);
pile2Set.addAll(pile2);
controller.moveCards(pile1Set, pile1Zone, source, game, false, false, false, null);
controller.moveCards(pile2Set, pile2Zone, source, game, false, false, false, null);
}
}
}
return true;
}
return false;
}
}

View file

@ -1,9 +1,8 @@
package mage.cards.d;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.CreatureEntersBattlefieldTriggeredAbility;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
@ -13,19 +12,26 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/**
*
* @author emerald000
*/
public final class DecoctionModule extends CardImpl {
public DecoctionModule(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
// Whenever a creature enters the battlefield under your control, you get {E}.
this.addAbility(new CreatureEntersBattlefieldTriggeredAbility(new GetEnergyCountersControllerEffect(1)));
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(
Zone.BATTLEFIELD,
new GetEnergyCountersControllerEffect(1),
StaticFilters.FILTER_PERMANENT_CREATURE_A,
false)
);
// {4}, {T}: Return target creature you control to its owner's hand.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(), new GenericManaCost(4));

View file

@ -0,0 +1,87 @@
package mage.cards.d;
import java.util.UUID;
import mage.constants.SubType;
import mage.target.common.TargetCreaturePermanent;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.constants.Outcome;
import mage.target.TargetPermanent;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author jeffwadsworth
*/
public final class Disappear extends CardImpl {
public Disappear(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}{U}");
this.subtype.add(SubType.AURA);
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// {U}: Return enchanted creature and Disappear to their owners' hands.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new DisappearEffect(), new ManaCostsImpl("{U}")));
}
public Disappear(final Disappear card) {
super(card);
}
@Override
public Disappear copy() {
return new Disappear(this);
}
}
class DisappearEffect extends OneShotEffect {
public DisappearEffect() {
super(Outcome.ReturnToHand);
staticText = "Return enchanted creature and {this} to their owners' hands";
}
public DisappearEffect(final DisappearEffect effect) {
super(effect);
}
@Override
public DisappearEffect copy() {
return new DisappearEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent aura = (Permanent) game.getPermanentOrLKIBattlefield(source.getSourceId());
Player controller = game.getPlayer(source.getControllerId());
if (controller != null
&& aura != null
&& aura.getAttachedTo() != null) {
Permanent enchantedCreature = game.getPermanent(aura.getAttachedTo());
controller.moveCards(aura, Zone.HAND, source, game);
if (enchantedCreature != null) {
controller.moveCards(enchantedCreature, Zone.HAND, source, game);
}
return true;
}
return false;
}
}

View file

@ -0,0 +1,99 @@
package mage.cards.d;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetOpponent;
/**
*
* @author jeffwadsworth
*/
public final class DiscordantDirge extends CardImpl {
private static final String rule = "Look at target opponent's hand and choose up to X cards from it, where X is the number of verse counters on {this}. That player discards those cards..";
public DiscordantDirge(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{B}{B}");
// At the beginning of your upkeep, you may put a verse counter on Discordant Dirge.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD,
new AddCountersSourceEffect(CounterType.VERSE.createInstance(), true), TargetController.YOU, true));
// {B}, Sacrifice Discordant Dirge: Look at target opponent's hand and choose up to X cards from it, where X is the number of verse counters on Discordant Dirge. That player discards those cards.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new DiscordantDirgeEffect(),
new ManaCostsImpl("{B}"));
ability.addCost(new SacrificeSourceCost());
ability.addTarget(new TargetOpponent());
this.addAbility(ability);
}
public DiscordantDirge(final DiscordantDirge card) {
super(card);
}
@Override
public DiscordantDirge copy() {
return new DiscordantDirge(this);
}
}
class DiscordantDirgeEffect extends OneShotEffect {
public DiscordantDirgeEffect() {
super(Outcome.Benefit);
staticText = "Look at target opponent's hand and choose up to X cards from it, where X is the number of verse counters on {this}. That player discards those card.";
}
public DiscordantDirgeEffect(final DiscordantDirgeEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent discordantDirge = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (discordantDirge != null) {
int verseCounters = discordantDirge.getCounters(game).getCount(CounterType.VERSE);
Player targetOpponent = game.getPlayer(source.getFirstTarget());
Player controller = game.getPlayer(source.getControllerId());
if (targetOpponent != null
&& controller != null) {
controller.lookAtCards(targetOpponent.getName() + " hand", targetOpponent.getHand(), game);
TargetCard target = new TargetCard(0, verseCounters, Zone.HAND, new FilterCard());
target.setNotTarget(true);
if (controller.choose(Outcome.Benefit, targetOpponent.getHand(), target, game)) {
target.getTargets().stream().map((targetCardId) -> game.getCard(targetCardId)).filter((card) -> (card != null
&& targetOpponent.getHand().contains(card.getId()))).forEachOrdered((card) -> {
targetOpponent.discard(card, source, game);
});
return true;
}
}
}
return false;
}
@Override
public DiscordantDirgeEffect copy() {
return new DiscordantDirgeEffect(this);
}
}

View file

@ -0,0 +1,63 @@
package mage.cards.d;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.ProtectionAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.filter.StaticFilters;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
* @author L_J
*/
public final class DominariasJudgment extends CardImpl {
private static final FilterLandPermanent filterPlains = new FilterLandPermanent("Plains");
private static final FilterLandPermanent filterIsland = new FilterLandPermanent("Island");
private static final FilterLandPermanent filterSwamp = new FilterLandPermanent("Swamp");
private static final FilterLandPermanent filterMountain = new FilterLandPermanent("Mountain");
private static final FilterLandPermanent filterForest = new FilterLandPermanent("Forest");
static {
filterPlains.add(new SubtypePredicate(SubType.PLAINS));
filterIsland.add(new SubtypePredicate(SubType.ISLAND));
filterSwamp.add(new SubtypePredicate(SubType.SWAMP));
filterMountain.add(new SubtypePredicate(SubType.MOUNTAIN));
filterForest.add(new SubtypePredicate(SubType.FOREST));
}
public DominariasJudgment(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{W}");
// Until end of turn, creatures you control gain protection from white if you control a Plains, from blue if you control an Island, from black if you control a Swamp, from red if you control a Mountain, and from green if you control a Forest.
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(new GainAbilityControlledEffect(ProtectionAbility.from(ObjectColor.WHITE), Duration.EndOfTurn,
StaticFilters.FILTER_PERMANENT_CREATURE, false), new PermanentsOnTheBattlefieldCondition(filterPlains),"Until end of turn, creatures you control gain protection from white if you control a Plains,"));
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(new GainAbilityControlledEffect(ProtectionAbility.from(ObjectColor.BLUE), Duration.EndOfTurn,
StaticFilters.FILTER_PERMANENT_CREATURE, false), new PermanentsOnTheBattlefieldCondition(filterIsland)," from blue if you control an Island,"));
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(new GainAbilityControlledEffect(ProtectionAbility.from(ObjectColor.BLACK), Duration.EndOfTurn,
StaticFilters.FILTER_PERMANENT_CREATURE, false), new PermanentsOnTheBattlefieldCondition(filterSwamp)," from black if you control a Swamp,"));
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(new GainAbilityControlledEffect(ProtectionAbility.from(ObjectColor.RED), Duration.EndOfTurn,
StaticFilters.FILTER_PERMANENT_CREATURE, false), new PermanentsOnTheBattlefieldCondition(filterMountain)," from red if you control a Mountain,"));
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(new GainAbilityControlledEffect(ProtectionAbility.from(ObjectColor.GREEN), Duration.EndOfTurn,
StaticFilters.FILTER_PERMANENT_CREATURE, false), new PermanentsOnTheBattlefieldCondition(filterForest)," and from green if you control a Forest"));
}
public DominariasJudgment(final DominariasJudgment card) {
super(card);
}
@Override
public DominariasJudgment copy() {
return new DominariasJudgment(this);
}
}

View file

@ -2,6 +2,7 @@
package mage.cards.d;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.AttachEffect;
@ -17,13 +18,12 @@ import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author Loki
*/
public final class DrakeUmbra extends CardImpl {
public DrakeUmbra(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{4}{U}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{U}");
this.subtype.add(SubType.AURA);
@ -33,9 +33,12 @@ public final class DrakeUmbra extends CardImpl {
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Enchanted creature gets +3/+3 and has flying.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(3, 3, Duration.WhileOnBattlefield)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(FlyingAbility.getInstance(), AttachmentType.AURA)));
// Totem armor
this.addAbility(new TotemArmorAbility());
}

View file

@ -0,0 +1,200 @@
package mage.cards.d;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.BeginningOfYourEndStepTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.discard.DiscardControllerEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
import mage.util.CardUtil;
/**
*
* @author jeffwadsworth
*/
public final class Duplicity extends CardImpl {
public Duplicity(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}");
// When Duplicity enters the battlefield, exile the top five cards of your library face down.
this.addAbility(new EntersBattlefieldTriggeredAbility(new DuplicityEffect(), false));
// At the beginning of your upkeep, you may exile all cards from your hand face down. If you do, put all other cards you own exiled with Duplicity into your hand.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new DuplicityExileHandEffect(), TargetController.YOU, true));
// At the beginning of your end step, discard a card.
this.addAbility(new BeginningOfYourEndStepTriggeredAbility(new DiscardControllerEffect(1), false));
// When you lose control of Duplicity, put all cards exiled with Duplicity into their owner's graveyard.
this.addAbility(new LoseControlDuplicity());
}
public Duplicity(final Duplicity card) {
super(card);
}
@Override
public Duplicity copy() {
return new Duplicity(this);
}
}
class DuplicityEffect extends OneShotEffect {
public DuplicityEffect() {
super(Outcome.Exile);
staticText = "exile the top five cards of your library face down";
}
public DuplicityEffect(final DuplicityEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null
&& sourceObject != null) {
if (controller.getLibrary().hasCards()) {
UUID exileId = CardUtil.getCardExileZoneId(game, source);
Set<Card> cardsToExile = controller.getLibrary().getTopCards(game, 5);
for (Card card : cardsToExile) {
controller.moveCardsToExile(card, source, game, true, exileId, sourceObject.getName());
card.setFaceDown(true, game);
}
}
return true;
}
return false;
}
@Override
public DuplicityEffect copy() {
return new DuplicityEffect(this);
}
}
class DuplicityExileHandEffect extends OneShotEffect {
public DuplicityExileHandEffect() {
super(Outcome.Exile);
staticText = "you may exile all cards from your hand face down. If you do, put all other cards you own exiled with {this} into your hand";
}
public DuplicityExileHandEffect(final DuplicityExileHandEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null
&& sourceObject != null) {
if (!controller.getHand().isEmpty()) {
UUID exileId = CardUtil.getCardExileZoneId(game, source);
Set<Card> cardsFromHandToExile = controller.getHand().getCards(game);
for (Card card : cardsFromHandToExile) {
controller.moveCardsToExile(card, source, game, true, exileId, sourceObject.getName());
card.setFaceDown(true, game);
}
Set<Card> cardsInExile = game.getExile().getExileZone(exileId).getCards(game);
Set<Card> cardsToReturnToHandFromExile = new HashSet<>();
for (Card card : cardsInExile) {
if (!cardsFromHandToExile.contains(card)) {
cardsToReturnToHandFromExile.add(card);
}
}
controller.moveCards(cardsToReturnToHandFromExile, Zone.HAND, source, game);
}
return true;
}
return false;
}
@Override
public DuplicityExileHandEffect copy() {
return new DuplicityExileHandEffect(this);
}
}
class LoseControlDuplicity extends DelayedTriggeredAbility {
public LoseControlDuplicity() {
super(new PutExiledCardsInOwnersGraveyard(), Duration.EndOfGame, false);
}
public LoseControlDuplicity(final LoseControlDuplicity ability) {
super(ability);
}
@Override
public LoseControlDuplicity copy() {
return new LoseControlDuplicity(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.LOST_CONTROL;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return event.getPlayerId().equals(controllerId);
}
@Override
public String getRule() {
return "When you lose control of {this}, put all cards exiled with {this} into their owner's graveyard.";
}
}
class PutExiledCardsInOwnersGraveyard extends OneShotEffect {
public PutExiledCardsInOwnersGraveyard() {
super(Outcome.Neutral);
staticText = " put all cards exiled with {this} into their owner's graveyard.";
}
public PutExiledCardsInOwnersGraveyard(final PutExiledCardsInOwnersGraveyard effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null
&& sourceObject != null) {
UUID exileId = CardUtil.getCardExileZoneId(game, source);
Set<Card> cardsInExile = game.getExile().getExileZone(exileId).getCards(game);
controller.moveCardsToGraveyardWithInfo(cardsInExile, source, game, Zone.EXILED);
return true;
}
return false;
}
@Override
public PutExiledCardsInOwnersGraveyard copy() {
return new PutExiledCardsInOwnersGraveyard(this);
}
}

View file

@ -4,7 +4,7 @@ package mage.cards.e;
import java.util.UUID;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -29,7 +29,7 @@ public final class EarthSurge extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{G}");
//Each land gets +2/+2 as long as it's a creature.
Effect effect = new BoostControlledEffect(2, 2, Duration.WhileOnBattlefield, filter, true);
Effect effect = new BoostAllEffect(2, 2, Duration.WhileOnBattlefield, filter, true);
effect.setText("Each land gets +2/+2 as long as it\'s a creature");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}

View file

@ -2,6 +2,7 @@
package mage.cards.e;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.AttachEffect;
@ -20,25 +21,28 @@ import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author Loki
*/
public final class EelUmbra extends CardImpl {
public EelUmbra(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{U}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
this.subtype.add(SubType.AURA);
// Flash
this.addAbility(FlashAbility.getInstance());
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Enchanted creature gets +1/+1.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(1, 1, Duration.WhileOnBattlefield)));
// Totem armor
this.addAbility(new TotemArmorAbility());
}

View file

@ -2,6 +2,7 @@
package mage.cards.e;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.AttachEffect;
@ -19,24 +20,25 @@ import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author Loki
*/
public final class ElandUmbra extends CardImpl {
public ElandUmbra(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{W}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
this.subtype.add(SubType.AURA);
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Enchanted creature gets +0/+4.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(0, 4, Duration.WhileOnBattlefield)));
// Totem armor
this.addAbility(new TotemArmorAbility());
}

View file

@ -0,0 +1,102 @@
package mage.cards.e;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleEvasionAbility;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect;
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.TargetController;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetControlledPermanent;
/**
*
* @author L_J
*/
public final class ElderSpawn extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("red creatures");
static {
filter.add(new ColorPredicate(ObjectColor.RED));
}
public ElderSpawn(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{U}{U}{U}");
this.subtype.add(SubType.SPAWN);
this.power = new MageInt(6);
this.toughness = new MageInt(6);
// At the beginning of your upkeep, unless you sacrifice an Island, sacrifice Elder Spawn and it deals 6 damage to you.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new ElderSpawnEffect(), TargetController.YOU, false));
// Elder Spawn can't be blocked by red creatures.
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
}
public ElderSpawn(final ElderSpawn card) {
super(card);
}
@Override
public ElderSpawn copy() {
return new ElderSpawn(this);
}
}
class ElderSpawnEffect extends OneShotEffect {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("an Island");
static {
filter.add(new SubtypePredicate(SubType.ISLAND));
}
public ElderSpawnEffect() {
super(Outcome.Sacrifice);
staticText = "unless you sacrifice an Island, sacrifice {this} and it deals 6 damage to you";
}
public ElderSpawnEffect(final ElderSpawnEffect effect) {
super(effect);
}
@Override
public ElderSpawnEffect copy() {
return new ElderSpawnEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && sourcePermanent != null) {
TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, true);
SacrificeTargetCost cost = new SacrificeTargetCost(target);
if (!controller.chooseUse(Outcome.AIDontUseIt, "Do you wish to sacrifice an Island?", source, game)
|| !cost.canPay(source, source.getSourceId(), source.getControllerId(), game)
|| !cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) {
sourcePermanent.sacrifice(source.getSourceId(), game);
controller.damage(6, sourcePermanent.getId(), game, false, true);
}
return true;
}
return false;
}
}

View file

@ -94,11 +94,11 @@ class EmissaryOfGrudgesEffect extends OneShotEffect {
Mode mode = stackObject.getStackAbility().getModes().get(modeId);
for (Target target : mode.getTargets()) {
for (UUID targetId : target.getTargets()) {
if (source.getControllerId().equals(targetId)) {
if (source.isControlledBy(targetId)) {
targetsYouOrAPermanentYouControl = true;
}
Permanent permanent = game.getPermanent(targetId);
if (permanent != null && source.getControllerId().equals(permanent.getControllerId())) {
if (permanent != null && source.isControlledBy(permanent.getControllerId())) {
targetsYouOrAPermanentYouControl = true;
}
}

View file

@ -1,11 +1,11 @@
package mage.cards.e;
import java.util.UUID;
import mage.abilities.effects.common.SkipNextCombatEffect;
import mage.abilities.effects.common.SkipCombatStepEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.target.common.TargetOpponent;
/**
@ -15,10 +15,10 @@ import mage.target.common.TargetOpponent;
public final class EmptyCityRuse extends CardImpl {
public EmptyCityRuse(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{W}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{W}");
// Target opponent skips all combat phases of their next turn.
this.getSpellAbility().addEffect(new SkipNextCombatEffect());
this.getSpellAbility().addEffect(new SkipCombatStepEffect(Duration.UntilYourNextTurn).setText("Target opponent skips all combat phases of their next turn."));
this.getSpellAbility().addTarget(new TargetOpponent());
}
@ -30,4 +30,4 @@ public final class EmptyCityRuse extends CardImpl {
public EmptyCityRuse copy() {
return new EmptyCityRuse(this);
}
}
}

View file

@ -0,0 +1,79 @@
package mage.cards.e;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.PreventAllDamageToSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
/**
*
* @author L_J
*/
public final class EnchantedBeing extends CardImpl {
public EnchantedBeing(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{W}");
this.subtype.add(SubType.HUMAN);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Prevent all damage that would be dealt to Enchanted Being by enchanted creatures.
Effect effect = new PreventDamageToSourceByEnchantedCreatures();
effect.setText("Prevent all damage that would be dealt to {this} by enchanted creatures.");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}
public EnchantedBeing(final EnchantedBeing card) {
super(card);
}
@Override
public EnchantedBeing copy() {
return new EnchantedBeing(this);
}
}
class PreventDamageToSourceByEnchantedCreatures extends PreventAllDamageToSourceEffect {
public PreventDamageToSourceByEnchantedCreatures() {
super(Duration.WhileOnBattlefield);
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (super.applies(event, source, game)) {
if (isEnchantedCreature(game.getObject(event.getSourceId()), game)) {
if (event.getTargetId().equals(source.getSourceId())) {
return true;
}
}
}
return false;
}
public boolean isEnchantedCreature(MageObject input, Game game) {
if (input == null || input.isCreature()) {
return false;
}
for (UUID attachmentId : ((Permanent) input).getAttachments()) {
Permanent attachment = game.getPermanent(attachmentId);
if (attachment != null && attachment.isEnchantment()) {
return true;
}
}
return false;
}
}

View file

@ -0,0 +1,145 @@
package mage.cards.e;
import java.util.UUID;
import mage.MageItem;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AttachmentAttachedToCardTypePredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.stack.StackObject;
import mage.players.Player;
import mage.target.Target;
import mage.target.TargetPermanent;
/**
*
* @author jeffwadsworth
*/
public final class EnchantmentAlteration extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("aura attached to a creature or land");
private static final FilterPermanent filter2 = new FilterPermanent("another target permanent that shares that type of creature or land");
static {
filter.add(new SubtypePredicate(SubType.AURA));
filter.add(Predicates.or(new AttachmentAttachedToCardTypePredicate(CardType.CREATURE),
new AttachmentAttachedToCardTypePredicate(CardType.LAND)));
filter2.add(new SharesEnchantedCardTypePredicate());
// another target permanent is handled in this predicate
}
public EnchantmentAlteration(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}");
// Attach target Aura attached to a creature or land to another permanent of that type.
this.getSpellAbility().addEffect(new EnchantmentAlterationEffect());
TargetPermanent targetAura = new TargetPermanent(filter);
this.getSpellAbility().addTarget(targetAura);
TargetPermanent targetCreatureOrLandThatSharesTheEnchantedCardType = new TargetPermanent(filter2);
this.getSpellAbility().addTarget(targetCreatureOrLandThatSharesTheEnchantedCardType);
}
public EnchantmentAlteration(final EnchantmentAlteration card) {
super(card);
}
@Override
public EnchantmentAlteration copy() {
return new EnchantmentAlteration(this);
}
}
class SharesEnchantedCardTypePredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<MageItem>> {
@Override
public boolean apply(ObjectSourcePlayer<MageItem> input, Game game) {
StackObject source = game.getStack().getStackObject(input.getSourceId());
Permanent auraIsAttachedToThisPermanent = null;
Permanent newPermanentToAttachAuraTo;
if (source != null) {
if (source.getStackAbility().getTargets().isEmpty()
|| source.getStackAbility().getTargets().get(0).getTargets().isEmpty()) {
return true;
}
Permanent auraPermanent = game.getPermanent(
source.getStackAbility().getTargets().get(0).getTargets().get(0)); // targeted aura enchanting land or creature
if (auraPermanent != null) {
auraIsAttachedToThisPermanent = game.getPermanent(auraPermanent.getAttachedTo());
}
if (auraIsAttachedToThisPermanent == null) { // the original permanent the aura is attached to
return false;
}
newPermanentToAttachAuraTo = game.getPermanent(input.getObject().getId()); // the new target creature or land to enchant
if (newPermanentToAttachAuraTo == auraIsAttachedToThisPermanent) {
return false; // must be another permanent
}
if (auraIsAttachedToThisPermanent.isCreature()
&& newPermanentToAttachAuraTo.isCreature()) {
return true;
}
if (auraIsAttachedToThisPermanent.isLand()
&& newPermanentToAttachAuraTo.isLand()) {
return true;
}
return false;
}
return true;
}
}
class EnchantmentAlterationEffect extends OneShotEffect {
public EnchantmentAlterationEffect() {
super(Outcome.BoostCreature);
this.staticText = "Attach target Aura attached to a creature or land to another permanent of that type";
}
public EnchantmentAlterationEffect(final EnchantmentAlterationEffect effect) {
super(effect);
}
@Override
public EnchantmentAlterationEffect copy() {
return new EnchantmentAlterationEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Permanent aura = game.getPermanent(source.getFirstTarget());
Permanent permanentToBeAttachedTo = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (aura != null
&& permanentToBeAttachedTo != null) {
Permanent oldPermanent = game.getPermanent(aura.getAttachedTo());
if (oldPermanent != null
&& !oldPermanent.equals(permanentToBeAttachedTo)) {
Target auraTarget = aura.getSpellAbility().getTargets().get(0);
if (!auraTarget.canTarget(permanentToBeAttachedTo.getId(), game)) {
game.informPlayers(aura.getLogName() + " was not attched to " + permanentToBeAttachedTo.getLogName() + " because it's no legal target for the aura");
} else if (oldPermanent.removeAttachment(aura.getId(), game)) {
game.informPlayers(aura.getLogName() + " was unattached from " + oldPermanent.getLogName() + " and attached to " + permanentToBeAttachedTo.getLogName());
permanentToBeAttachedTo.addAttachment(aura.getId(), game);
}
}
}
return true;
}
return false;
}
}

View file

@ -144,14 +144,18 @@ class EtrataTheSilencerEffect extends OneShotEffect {
card.addCounters(CounterType.HIT.createInstance(), source, game);
}
int cardsFound = 0;
for (Card exiledCard : game.getExile().getAllCards(game)) {
if (exiledCard.getCounters(game).getCount(CounterType.HIT) >= 1 && exiledCard.getOwnerId().equals(player.getId())) {
cardsFound++;
}
}
cardsFound = game.getExile().getAllCards(game).stream().filter((exiledCard) -> (exiledCard.getCounters(game).getCount(CounterType.HIT) >= 1
&& exiledCard.getOwnerId().equals(player.getId()))).map((_item) -> 1).reduce(cardsFound, Integer::sum);
if (cardsFound > 2) {
player.lost(game);
}
return new ShuffleIntoLibrarySourceEffect().apply(game, source);
Permanent etrataTheSilencer = game.getPermanent(source.getSourceId());
if (etrataTheSilencer != null) {
if (etrataTheSilencer.isPhasedIn()) {
return new ShuffleIntoLibrarySourceEffect().apply(game, source);
}
}
controller.shuffleLibrary(source, game);
return true;
}
}

View file

@ -1,11 +1,11 @@
package mage.cards.f;
import java.util.UUID;
import mage.abilities.effects.common.SkipNextCombatEffect;
import mage.abilities.effects.common.SkipCombatStepEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.target.TargetPlayer;
/**
@ -13,19 +13,19 @@ import mage.target.TargetPlayer;
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/
public final class FalsePeace extends CardImpl {
public FalsePeace(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{W}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{W}");
// Target player skips all combat phases of their next turn.
this.getSpellAbility().addEffect(new SkipNextCombatEffect());
this.getSpellAbility().addEffect(new SkipCombatStepEffect(Duration.UntilYourNextTurn).setText("Target player skips all combat phases of their next turn."));
this.getSpellAbility().addTarget(new TargetPlayer());
}
public FalsePeace(final FalsePeace card) {
super(card);
}
@Override
public FalsePeace copy() {
return new FalsePeace(this);

View file

@ -0,0 +1,36 @@
package mage.cards.f;
import java.util.UUID;
import mage.abilities.effects.common.SkipNextDrawStepTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.target.TargetPlayer;
/**
*
* @author jeffwadsworth
*/
public final class Fatigue extends CardImpl {
private static final String rule = "Target player skips his or her next draw step.";
public Fatigue(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{U}");
// Target player skips his or her next draw step.
this.getSpellAbility().addEffect(new SkipNextDrawStepTargetEffect().setText(rule));
this.getSpellAbility().addTarget(new TargetPlayer());
}
public Fatigue(final Fatigue card) {
super(card);
}
@Override
public Fatigue copy() {
return new Fatigue(this);
}
}

View file

@ -0,0 +1,41 @@
package mage.cards.f;
import java.util.UUID;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.PreventDamageByTargetEffect;
import mage.abilities.keyword.CyclingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author jeffwadsworth
*/
public final class FendOff extends CardImpl {
private static final String rule = "Prevent all combat damage that would be dealt by target creature this turn.";
public FendOff(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W}");
// Prevent all combat damage that would be dealt by target creature this turn.
this.getSpellAbility().addEffect(new PreventDamageByTargetEffect(Duration.EndOfTurn, true).setText(rule));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
// Cycling {2}
this.addAbility(new CyclingAbility(new ManaCostsImpl("{2}")));
}
public FendOff(final FendOff card) {
super(card);
}
@Override
public FendOff copy() {
return new FendOff(this);
}
}

View file

@ -0,0 +1,33 @@
package mage.cards.f;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
* @author JayDi85
*/
public final class FeralRoar extends CardImpl {
public FeralRoar(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{G}");
// Target creature gets +4/+4 until end of turn.
this.getSpellAbility().addEffect(new BoostTargetEffect(4, 4, Duration.EndOfTurn));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
public FeralRoar(final FeralRoar card) {
super(card);
}
@Override
public FeralRoar copy() {
return new FeralRoar(this);
}
}

View file

@ -0,0 +1,109 @@
package mage.cards.f;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfCombatTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.RestrictionEffect;
import mage.abilities.effects.common.combat.CantAttackTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author LevelX2 & L_J
*/
public final class FightOrFlight extends CardImpl {
public FightOrFlight(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{W}");
// At the beginning of combat on each opponents turn, separate all creatures that player controls into two piles. Only creatures in the pile of their choice can attack this turn.
this.addAbility(new BeginningOfCombatTriggeredAbility(new FightOrFlightEffect(), TargetController.OPPONENT, false));
}
public FightOrFlight(final FightOrFlight card) {
super(card);
}
@Override
public FightOrFlight copy() {
return new FightOrFlight(this);
}
}
class FightOrFlightEffect extends OneShotEffect {
public FightOrFlightEffect() {
super(Outcome.Detriment);
this.staticText = "separate all creatures that player controls into two piles. Only creatures in the pile of their choice can attack this turn";
}
public FightOrFlightEffect(final FightOrFlightEffect effect) {
super(effect);
}
@Override
public FightOrFlightEffect copy() {
return new FightOrFlightEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Player targetPlayer = game.getPlayer(game.getCombat().getAttackingPlayerId());
if (player != null && targetPlayer != null) {
int count = game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_CREATURES, targetPlayer.getId(), game);
TargetCreaturePermanent creatures = new TargetCreaturePermanent(0, count, new FilterCreaturePermanent("creatures to put in the first pile"), true);
List<Permanent> pile1 = new ArrayList<>();
creatures.setRequired(false);
if (player.choose(Outcome.Neutral, creatures, source.getSourceId(), game)) {
List<UUID> targets = creatures.getTargets();
for (UUID targetId : targets) {
Permanent p = game.getPermanent(targetId);
if (p != null) {
pile1.add(p);
}
}
}
List<Permanent> pile2 = new ArrayList<>();
for (Permanent p : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, targetPlayer.getId(), game)) {
if (!pile1.contains(p)) {
pile2.add(p);
}
}
boolean choice = targetPlayer.choosePile(outcome, "Choose which pile can attack this turn.", pile1, pile2, game);
List<Permanent> chosenPile = choice ? pile2 : pile1;
List<Permanent> otherPile = choice ? pile1 : pile2;
for (Permanent permanent : chosenPile) {
if (permanent != null) {
RestrictionEffect effect = new CantAttackTargetEffect(Duration.EndOfTurn);
effect.setText("");
effect.setTargetPointer(new FixedTarget(permanent.getId()));
game.addEffect(effect, source);
}
}
StringBuilder sb = new StringBuilder("Creatures that can attack this turn: ");
sb.append(otherPile.stream().map(Permanent::getLogName).collect(Collectors.joining(", ")));
game.informPlayers(sb.toString());
return true;
}
return false;
}
}

View file

@ -156,39 +156,44 @@ class FlickerformReturnEffect extends OneShotEffect {
}
ExileZone exileZone = game.getExile().getExileZone(exileZoneId);
Card enchantedCard = exileZone.get(enchantedCardId, game);
//skip if exiled card is missing
if (enchantedCard != null) {
controller.moveCards(enchantedCard, Zone.BATTLEFIELD, source, game);
Permanent newPermanent = game.getPermanent(enchantedCardId);
if (newPermanent != null) {
Set<Card> toBattlefieldAttached = new HashSet<Card>();
for (Card enchantment : exileZone.getCards(game)) {
if (filterAura.match(enchantment, game)) {
boolean canTarget = false;
for (Target target : enchantment.getSpellAbility().getTargets()) {
Filter filter = target.getFilter();
if (filter.match(newPermanent, game)) {
canTarget = true;
break;
Player owner = game.getPlayer(enchantedCard.getOwnerId());
//skip if card's owner is missing
if (owner != null) {
owner.moveCards(enchantedCard, Zone.BATTLEFIELD, source, game);
Permanent newPermanent = game.getPermanent(enchantedCardId);
if (newPermanent != null) {
Set<Card> toBattlefieldAttached = new HashSet<Card>();
for (Card enchantment : exileZone.getCards(game)) {
if (filterAura.match(enchantment, game)) {
boolean canTarget = false;
for (Target target : enchantment.getSpellAbility().getTargets()) {
Filter filter = target.getFilter();
if (filter.match(newPermanent, game)) {
canTarget = true;
break;
}
}
if (!canTarget) {
// Aura stays exiled
continue;
}
game.getState().setValue("attachTo:" + enchantment.getId(), newPermanent);
}
toBattlefieldAttached.add(enchantment);
}
if (!toBattlefieldAttached.isEmpty()) {
controller.moveCards(toBattlefieldAttached, Zone.BATTLEFIELD, source, game);
for (Card card : toBattlefieldAttached) {
if (game.getState().getZone(card.getId()) == Zone.BATTLEFIELD) {
newPermanent.addAttachment(card.getId(), game);
}
}
if (!canTarget) {
// Aura stays exiled
continue;
}
game.getState().setValue("attachTo:" + enchantment.getId(), newPermanent);
}
toBattlefieldAttached.add(enchantment);
}
if (!toBattlefieldAttached.isEmpty()) {
controller.moveCards(toBattlefieldAttached, Zone.BATTLEFIELD, source, game);
for (Card card : toBattlefieldAttached) {
if (game.getState().getZone(card.getId()) == Zone.BATTLEFIELD) {
newPermanent.addAttachment(card.getId(), game);
}
}
}
return true;
}
return true;
}
return false;
}

View file

@ -1,23 +1,26 @@
package mage.cards.f;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.CreatureEntersBattlefieldTriggeredAbility;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.DamageAllEffect;
import mage.abilities.effects.common.search.SearchLibraryPutOnLibraryEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterBySubtypeCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.common.TargetCardInLibrary;
import java.util.UUID;
/**
*
* @author JayDi85
*/
public final class ForerunnerOfTheEmpire extends CardImpl {
@ -49,12 +52,11 @@ public final class ForerunnerOfTheEmpire extends CardImpl {
);
// Whenever a Dinosaur enters the battlefield under your control, you may have Forerunner of the Empire deal 1 damage to each creature.
Ability ability = new CreatureEntersBattlefieldTriggeredAbility(
Ability ability = new EntersBattlefieldControlledTriggeredAbility(
Zone.BATTLEFIELD,
new DamageAllEffect(1, new FilterCreaturePermanent()).setText("have {this} deal 1 damage to each creature"),
filterAnyDinosaur,
true,
false);
true);
this.addAbility(ability);
}

View file

@ -0,0 +1,91 @@
package mage.cards.f;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.SacrificeSourceUnlessPaysEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent;
/**
*
* @author L_J
*/
public final class ForethoughtAmulet extends CardImpl {
public ForethoughtAmulet(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{5}");
// At the beginning of your upkeep, sacrifice Forethought Amulet unless you pay {3}.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new GenericManaCost(3)), TargetController.YOU, false));
// If an instant or sorcery source would deal 3 or more damage to you, it deals 2 damage to you instead.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ForethoughtAmuletEffect()));
}
public ForethoughtAmulet(final ForethoughtAmulet card) {
super(card);
}
@Override
public ForethoughtAmulet copy() {
return new ForethoughtAmulet(this);
}
}
class ForethoughtAmuletEffect extends ReplacementEffectImpl {
public ForethoughtAmuletEffect() {
super(Duration.WhileOnBattlefield, Outcome.Neutral);
staticText = "If an instant or sorcery source would deal 3 or more damage to you, it deals 2 damage to you instead";
}
public ForethoughtAmuletEffect(final ForethoughtAmuletEffect effect) {
super(effect);
}
@Override
public ForethoughtAmuletEffect copy() {
return new ForethoughtAmuletEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getAmount() >= 3) {
MageObject object = game.getObject(event.getSourceId());
return object != null && (object.isInstant() || object.isSorcery());
}
return false;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
if (event.getTargetId().equals(source.getControllerId())) {
event.setAmount(2);
}
return false;
}
}

View file

@ -1,4 +1,3 @@
package mage.cards.g;
import java.util.UUID;
@ -16,7 +15,6 @@ import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.filter.common.FilterBasicLandCard;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -30,7 +28,7 @@ import mage.target.common.TargetLandPermanent;
public final class GhostQuarter extends CardImpl {
public GhostQuarter(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.LAND},"");
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
// {T}: Add {C}.
this.addAbility(new ColorlessManaAbility());

View file

@ -1,5 +1,6 @@
package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
@ -27,8 +28,6 @@ import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
*
* @author noahg
@ -43,7 +42,7 @@ public final class GiantOyster extends CardImpl {
public GiantOyster(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{U}");
this.subtype.add(SubType.OYSTER);
this.power = new MageInt(0);
this.toughness = new MageInt(3);
@ -111,7 +110,6 @@ class GiantOysterCreateDelayedTriggerEffects extends OneShotEffect {
Effect addCountersEffect = new AddCountersTargetEffect(CounterType.M1M1.createInstance(1));
addCountersEffect.setTargetPointer(getTargetPointer().getFixedTarget(game, source));
DelayedTriggeredAbility drawStepAbility = new AtTheBeginOfYourNextDrawStepDelayedTriggeredAbility(addCountersEffect, Duration.Custom, false);
drawStepAbility.setSourceObject(oyster, game);
drawStepAbility.setControllerId(source.getControllerId());
UUID drawStepAbilityUUID = game.addDelayedTriggeredAbility(drawStepAbility, source);
@ -161,4 +159,4 @@ class GiantOysterLeaveUntapDelayedTriggeredAbility extends DelayedTriggeredAbili
public String getRule() {
return "When {this} leaves the battlefield or becomes untapped, remove all -1/-1 counters from the creature.";
}
}
}

View file

@ -0,0 +1,33 @@
package mage.cards.g;
import mage.MageInt;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import java.util.UUID;
/**
* @author JayDi85
*/
public final class GoblinBruiser extends CardImpl {
public GoblinBruiser(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}{R}");
this.subtype.add(SubType.GOBLIN);
this.subtype.add(SubType.WARRIOR);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
}
public GoblinBruiser(final GoblinBruiser card) {
super(card);
}
@Override
public GoblinBruiser copy() {
return new GoblinBruiser(this);
}
}

View file

@ -0,0 +1,39 @@
package mage.cards.g;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.game.permanent.token.GoblinToken;
import java.util.UUID;
/**
*
* @author JayDi85
*/
public final class GoblinGangLeader extends CardImpl {
public GoblinGangLeader(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}{R}");
this.subtype.add(SubType.GOBLIN, SubType.WARRIOR);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// When Goblin Gang Leader enters the battlefield, create two 1/1 red Goblin creature tokens.
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new GoblinToken("ANA"), 2)));
}
public GoblinGangLeader(final GoblinGangLeader card) {
super(card);
}
@Override
public GoblinGangLeader copy() {
return new GoblinGangLeader(this);
}
}

View file

@ -0,0 +1,105 @@
package mage.cards.g;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.OpponentsCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.token.GoblinToken;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author JayDi85
*/
public final class GoblinGoliath extends CardImpl {
public GoblinGoliath(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}{R}");
this.subtype.add(SubType.GOBLIN);
this.subtype.add(SubType.MUTANT);
this.power = new MageInt(5);
this.toughness = new MageInt(4);
// When Goblin Goliath enters the battlefield, create a number of 1/1 red Goblin creature tokens equal to the number of opponents you have.
Effect effect = new CreateTokenEffect(new GoblinToken(), new OpponentsCount());
effect.setText("create a number of 1/1 red Goblin creature tokens equal to the number of opponents you have");
this.addAbility(new EntersBattlefieldTriggeredAbility(effect));
// {3}{R}, {T}: If a source you control would deal damage to an opponent this turn, it deals double that damage to that player instead.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GoblinGoliathDamageEffect(), new ManaCostsImpl("{3}{R}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}
public GoblinGoliath(final GoblinGoliath card) {
super(card);
}
@Override
public GoblinGoliath copy() {
return new GoblinGoliath(this);
}
}
class GoblinGoliathDamageEffect extends ReplacementEffectImpl {
public GoblinGoliathDamageEffect() {
super(Duration.EndOfTurn, Outcome.Damage);
staticText = "If a source you control would deal damage to an opponent this turn, it deals double that damage to that player instead.";
}
public GoblinGoliathDamageEffect(final GoblinGoliathDamageEffect effect) {
super(effect);
}
@Override
public GoblinGoliathDamageEffect copy() {
return new GoblinGoliathDamageEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
UUID sourceControllerID = source.getControllerId();
UUID damageControllerID = game.getControllerId(event.getSourceId());
UUID damageTargetID = event.getTargetId();
if (sourceControllerID != null && damageControllerID != null && damageTargetID != null) {
// our damage
if (damageControllerID.equals(sourceControllerID)) {
// to opponent only
if (game.getOpponents(sourceControllerID).contains(damageTargetID)) {
return true;
}
}
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
event.setAmount(CardUtil.addWithOverflowCheck(event.getAmount(), event.getAmount()));
return false;
}
}

View file

@ -77,9 +77,9 @@ class GoblinMachinistEffect extends OneShotEffect {
break;
}
}
controller.revealCards(source, cards, game);
controller.putCardsOnBottomOfLibrary(cards, game, source, true);
}
controller.revealCards(source, cards, game);
controller.putCardsOnBottomOfLibrary(cards, game, source, true);
return true;
}
return false;

View file

@ -126,7 +126,10 @@ class GripOfChaosEffect extends OneShotEffect {
Mode mode = stackObject.getStackAbility().getModes().get(modeId);
for (Target target : mode.getTargets()) {
UUID oldTargetId = target.getFirstTarget();
Set<UUID> possibleTargets = target.possibleTargets(stackObject.getSourceId(), stackObject.getControllerId(), game);
Set<UUID> possibleTargets = target.possibleTargets(stackObject.getId(), stackObject.getControllerId(), game);
if (possibleTargets.contains(stackObject.getId())) { // The stackObject can't target itself
possibleTargets.remove(stackObject.getId());
}
if (!possibleTargets.isEmpty()) {
int i = 0;
int rnd = RandomUtil.nextInt(possibleTargets.size());

View file

@ -0,0 +1,100 @@
package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.PreventionEffectImpl;
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.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
import mage.target.common.TargetControlledPermanent;
/**
*
* @author L_J
*/
public final class GuardDogs extends CardImpl {
public GuardDogs(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W}");
this.subtype.add(SubType.HOUND);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// {2}{W}, {T}: Choose a permanent you control. Prevent all combat damage target creature would deal this turn if it shares a color with that permanent.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GuardDogsEffect(), new ManaCostsImpl("{2}{W}"));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
public GuardDogs(final GuardDogs card) {
super(card);
}
@Override
public GuardDogs copy() {
return new GuardDogs(this);
}
}
class GuardDogsEffect extends PreventionEffectImpl {
private TargetControlledPermanent controlledTarget;
public GuardDogsEffect() {
super(Duration.EndOfTurn, Integer.MAX_VALUE, true);
this.staticText = "Choose a permanent you control. Prevent all combat damage target creature would deal this turn if it shares a color with that permanent";
}
public GuardDogsEffect(final GuardDogsEffect effect) {
super(effect);
}
@Override
public void init(Ability source, Game game) {
this.controlledTarget = new TargetControlledPermanent();
this.controlledTarget.setNotTarget(true);
this.controlledTarget.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), game);
super.init(source, game);
}
@Override
public GuardDogsEffect copy() {
return new GuardDogsEffect(this);
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (!this.used && super.applies(event, source, game)) {
MageObject mageObject = game.getObject(event.getSourceId());
if (mageObject != null
&& controlledTarget.getFirstTarget() != null) {
Permanent permanent = game.getPermanentOrLKIBattlefield(controlledTarget.getFirstTarget());
Permanent targetPermanent = game.getPermanentOrLKIBattlefield(this.getTargetPointer().getFirst(game, source));
if (permanent != null
&& targetPermanent != null
&& this.getTargetPointer().getTargets(game, source).contains(event.getSourceId())
&& permanent.getColor(game).shares(targetPermanent.getColor(game))) {
return true;
}
}
}
return false;
}
}

View file

@ -0,0 +1,134 @@
package mage.cards.h;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.StateTriggeredAbility;
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.PowerPredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.token.TokenImpl;
/**
*
* @author jeffwadsworth
*/
public final class HiddenPredators extends CardImpl {
public HiddenPredators(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{G}");
// When an opponent controls a creature with power 4 or greater, if Hidden Predators is an enchantment, Hidden Predators becomes a 4/4 Beast creature.
this.addAbility(new HiddenPredatorsStateTriggeredAbility());
}
public HiddenPredators(final HiddenPredators card) {
super(card);
}
@Override
public HiddenPredators copy() {
return new HiddenPredators(this);
}
}
class HiddenPredatorsStateTriggeredAbility extends StateTriggeredAbility {
private final static FilterCreaturePermanent filter = new FilterCreaturePermanent();
static {
filter.add(new ControllerPredicate(TargetController.OPPONENT));
filter.add(new PowerPredicate(ComparisonType.MORE_THAN, 3));
}
public HiddenPredatorsStateTriggeredAbility() {
super(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new HiddenPredatorsToken(), "", Duration.Custom, true, false));
}
public HiddenPredatorsStateTriggeredAbility(final HiddenPredatorsStateTriggeredAbility ability) {
super(ability);
}
@Override
public HiddenPredatorsStateTriggeredAbility copy() {
return new HiddenPredatorsStateTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return !game.getBattlefield().getAllActivePermanents(filter, game).isEmpty();
}
@Override
public boolean checkInterveningIfClause(Game game) {
if (getSourcePermanentIfItStillExists(game) != null) {
return getSourcePermanentIfItStillExists(game).isEnchantment();
}
return false;
}
@Override
public boolean canTrigger(Game game) {
//20100716 - 603.8
Boolean triggered = (Boolean) game.getState().getValue(getSourceId().toString() + "triggered");
if (triggered == null) {
triggered = Boolean.FALSE;
}
return !triggered;
}
@Override
public void trigger(Game game, UUID controllerId) {
//20100716 - 603.8
game.getState().setValue(this.getSourceId().toString() + "triggered", Boolean.TRUE);
super.trigger(game, controllerId);
}
@Override
public boolean resolve(Game game) {
//20100716 - 603.8
boolean result = super.resolve(game);
game.getState().setValue(this.getSourceId().toString() + "triggered", Boolean.FALSE);
return result;
}
@Override
public void counter(Game game) {
game.getState().setValue(this.getSourceId().toString() + "triggered", Boolean.FALSE);
}
@Override
public String getRule() {
return new StringBuilder("When an opponent controls a creature with 4 or greater power, if {this} is an enchantment, ").append(super.getRule()).toString();
}
}
class HiddenPredatorsToken extends TokenImpl {
public HiddenPredatorsToken() {
super("Beast", "4/4 Beast creature");
cardType.add(CardType.CREATURE);
subtype.add(SubType.BEAST);
power = new MageInt(4);
toughness = new MageInt(4);
}
public HiddenPredatorsToken(final HiddenPredatorsToken token) {
super(token);
}
public HiddenPredatorsToken copy() {
return new HiddenPredatorsToken(this);
}
}

View file

@ -0,0 +1,73 @@
package mage.cards.h;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.ControllerPlaysLandTriggeredAbility;
import mage.abilities.common.OpponentPlaysLandTriggeredAbility;
import mage.abilities.condition.common.SourceMatchesFilterCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
import mage.abilities.effects.common.continuous.BecomesEnchantmentSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.permanent.token.TokenImpl;
/**
*
* @author jeffwadsworth
*/
public final class HiddenStag extends CardImpl {
public HiddenStag(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}");
// Whenever an opponent plays a land, if Hidden Stag is an enchantment, Hidden Stag becomes a 3/2 Elk Beast creature.
Effect effect = new BecomesCreatureSourceEffect(new ElkBeastToken(), "", Duration.WhileOnBattlefield, true, false);
TriggeredAbility ability = new OpponentPlaysLandTriggeredAbility(Zone.BATTLEFIELD, effect, false);
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, new SourceMatchesFilterCondition(StaticFilters.FILTER_ENCHANTMENT_PERMANENT),
"Whenever an opponent plays a land, if Hidden Stag is an enchantment, Hidden Stag becomes a 3/2 Elk Beast creature."));
// Whenever you play a land, if Hidden Stag is a creature, Hidden Stag becomes an enchantment.
Effect effect2 = new BecomesEnchantmentSourceEffect();
TriggeredAbility ability2 = new ControllerPlaysLandTriggeredAbility(Zone.BATTLEFIELD, effect2, false);
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability2, new SourceMatchesFilterCondition(StaticFilters.FILTER_PERMANENT_CREATURE),
"Whenever you play a land, if Hidden Stag is a creature, Hidden Stag becomes an enchantment."));
}
public HiddenStag(final HiddenStag card) {
super(card);
}
@Override
public HiddenStag copy() {
return new HiddenStag(this);
}
}
class ElkBeastToken extends TokenImpl {
public ElkBeastToken() {
super("Elk Beast", "3/2 Elk Beast creature");
cardType.add(CardType.CREATURE);
subtype.add(SubType.ELK);
subtype.add(SubType.BEAST);
power = new MageInt(3);
toughness = new MageInt(2);
}
public ElkBeastToken(final ElkBeastToken token) {
super(token);
}
public ElkBeastToken copy() {
return new ElkBeastToken(this);
}
}

View file

@ -59,14 +59,16 @@ class IcequakeEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent != null && controller != null) {
permanent.destroy(source.getSourceId(), game, false);
if (permanent.isSnow()) {
controller.damage(1, source.getSourceId(), game, false, true);
if (permanent != null) {
Player controller = game.getPlayer(permanent.getControllerId());
if(controller != null) {
permanent.destroy(source.getSourceId(), game, false);
if (permanent.isSnow()) {
controller.damage(1, source.getSourceId(), game, false, true);
}
return true;
}
return true;
}
return false;
}

View file

@ -0,0 +1,65 @@
package mage.cards.i;
import java.util.UUID;
import mage.constants.SubType;
import mage.target.common.TargetCreaturePermanent;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.DiesAttachedTriggeredAbility;
import mage.abilities.dynamicvalue.common.CountersSourceCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.constants.Outcome;
import mage.target.TargetPermanent;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.target.common.TargetCreatureOrPlayer;
/**
*
* @author jeffwadsworth
*/
public final class Incendiary extends CardImpl {
private static final String rule = "{this} deals X damage to any target, where X is the number of fuse counters on {this}.";
public Incendiary(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{R}");
this.subtype.add(SubType.AURA);
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// At the beginning of your upkeep, you may put a fuse counter on Incendiary.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD,
new AddCountersSourceEffect(CounterType.FUSE.createInstance(), true), TargetController.YOU, true));
// When enchanted creature dies, Incendiary deals X damage to any target, where X is the number of fuse counters on Incendiary.
Effect effect = new DamageTargetEffect(new CountersSourceCount(CounterType.FUSE)).setText(rule);
Ability ability2 = new DiesAttachedTriggeredAbility(effect, "enchanted creature");
ability.addTarget(new TargetCreatureOrPlayer());
this.addAbility(ability2);
}
public Incendiary(final Incendiary card) {
super(card);
}
@Override
public Incendiary copy() {
return new Incendiary(this);
}
}

View file

@ -0,0 +1,51 @@
package mage.cards.i;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.OpponentsCount;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.permanent.token.ThopterColorlessToken;
import java.util.UUID;
/**
* @author JayDi85
*/
public final class InspiredSphinx extends CardImpl {
public InspiredSphinx(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{U}{U}");
this.subtype.add(SubType.SPHINX);
this.power = new MageInt(5);
this.toughness = new MageInt(5);
// Flying
this.addAbility(FlyingAbility.getInstance());
// When Inspired Sphinx enters the battlefield, draw cards equal to the number of opponents you have.
this.addAbility(new EntersBattlefieldTriggeredAbility(
new DrawCardSourceControllerEffect(new OpponentsCount()).setText("draw cards equal to the number of opponents you have")
));
// {3}{U}: Create a colorless 1/1 Thopter artifact creature token with flying.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new ThopterColorlessToken()), new ManaCostsImpl<>("{3}{U}")));
}
public InspiredSphinx(final InspiredSphinx card) {
super(card);
}
@Override
public InspiredSphinx copy() {
return new InspiredSphinx(this);
}
}

View file

@ -0,0 +1,59 @@
package mage.cards.i;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.PowerPredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
import java.util.UUID;
/**
* @author JayDi85
*/
public final class InspiringCommander extends CardImpl {
private static final FilterPermanent filter = new FilterControlledCreaturePermanent("another creature with power 2 or less");
static {
filter.add(new AnotherPredicate());
filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, 3));
}
public InspiringCommander(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}{W}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.SOLDIER);
this.power = new MageInt(1);
this.toughness = new MageInt(4);
// Whenever another creature with power 2 or less enters the battlefield under your control, you gain 1 life and draw a card.
Effect effect1 = new GainLifeEffect(1);
Effect effect2 = new DrawCardSourceControllerEffect(1);
Ability ability = new EntersBattlefieldControlledTriggeredAbility(
Zone.BATTLEFIELD, effect1, filter, false);
ability.addEffect(effect2.setText("and draw a card"));
this.addAbility(ability);
}
public InspiringCommander(final InspiringCommander card) {
super(card);
}
@Override
public InspiringCommander copy() {
return new InspiringCommander(this);
}
}

View file

@ -2,6 +2,8 @@
package mage.cards.j;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import mage.MageObjectReference;
@ -24,7 +26,10 @@ import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.FilterPlayer;
import mage.filter.common.FilterNonlandCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.other.PlayerIdPredicate;
import mage.game.ExileZone;
import mage.game.Game;
import mage.game.events.GameEvent;
@ -32,6 +37,7 @@ import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.TargetPlayer;
import mage.target.common.TargetCardInExile;
import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetOpponent;
@ -239,28 +245,61 @@ class JaceArchitectOfThoughtEffect3 extends OneShotEffect {
if (controller == null || sourcePermanent == null) {
return false;
}
if(controller.chooseUse(Outcome.Benefit, "Look at all players' libraries before card select?", null, game)) {
if (controller.chooseUse(Outcome.Benefit, "Look at all players' libraries before card select?", null, game)) {
game.informPlayers(controller.getLogName() + " is looking at all players' libraries.");
controller.lookAtAllLibraries(source, game);
}
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
String playerName = new StringBuilder(player.getLogName()).append("'s").toString();
if (source.isControlledBy(player.getId())) {
playerName = "your";
List<UUID> playerList = new ArrayList<>();
playerList.addAll(game.getState().getPlayersInRange(controller.getId(), game));
Set<UUID> checkList = new HashSet<>();
while (!playerList.isEmpty()) {
FilterPlayer filter = new FilterPlayer();
List<PlayerIdPredicate> playerPredicates = new ArrayList<>();
for (UUID playerId : playerList) {
playerPredicates.add(new PlayerIdPredicate(playerId));
}
TargetCardInLibrary target = new TargetCardInLibrary(new FilterNonlandCard(new StringBuilder("nonland card from ").append(playerName).append(" library").toString()));
if (controller.searchLibrary(target, game, playerId)) {
UUID targetId = target.getFirstTarget();
Card card = player.getLibrary().remove(targetId, game);
if (card != null) {
controller.moveCardToExileWithInfo(card, CardUtil.getCardExileZoneId(game, source), sourcePermanent.getIdName(), source.getSourceId(), game, Zone.LIBRARY, true);
filter.add(Predicates.or(playerPredicates));
TargetPlayer targetPlayer = new TargetPlayer(1, 1, true, filter);
targetPlayer.setRequired(!checkList.containsAll(playerList));
if (controller.chooseTarget(outcome, targetPlayer, source, game)) {
UUID playerId = targetPlayer.getFirstTarget();
Player player = game.getPlayer(playerId);
if (player != null) {
String playerName = new StringBuilder(player.getLogName()).append("'s").toString();
if (source.isControlledBy(player.getId())) {
playerName = "your";
}
TargetCardInLibrary target = new TargetCardInLibrary(new FilterNonlandCard(new StringBuilder("nonland card from ").append(playerName).append(" library").toString()));
if (controller.searchLibrary(target, game, playerId, !checkList.contains(playerId))) {
checkList.add(playerId);
UUID targetId = target.getFirstTarget();
Card card = player.getLibrary().remove(targetId, game);
if (card != null) {
controller.moveCardToExileWithInfo(card, CardUtil.getCardExileZoneId(game, source), sourcePermanent.getIdName(), source.getSourceId(), game, Zone.LIBRARY, true);
playerList.remove(playerId);
}
} else {
playerList.remove(playerId);
}
} else {
playerList.remove(playerId);
}
} else {
break;
}
for (UUID playerId : playerList) {
Player player = game.getPlayer(playerId);
if (player == null || !player.canRespond()) {
playerList.remove(player);
}
}
player.shuffleLibrary(source, game);
}
for (UUID playerId : checkList) {
Player player = game.getPlayer(playerId);
if (player != null) {
player.shuffleLibrary(source, game);
}
}
ExileZone jaceExileZone = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source));
if (jaceExileZone == null) {
return true;

View file

@ -38,7 +38,7 @@ public final class JusticeStrike extends CardImpl {
class JusticeStrikeEffect extends OneShotEffect {
public JusticeStrikeEffect() {
super(Outcome.Benefit);
super(Outcome.Damage);
this.staticText = "Target creature deals damage to itself equal to its power.";
}

View file

@ -25,7 +25,7 @@ import mage.target.common.TargetCardInLibrary;
*/
public final class KarametraGodOfHarvests extends CardImpl {
private static final FilterCard filter = new FilterCard("a Forest or Plains card");
private static final FilterCard filter = new FilterCard("Forest or Plains card");
static {
filter.add(Predicates.or(

View file

@ -0,0 +1,49 @@
package mage.cards.k;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.dynamicvalue.common.TargetConvertedManaCost;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.PreventDamageByTargetEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.target.common.TargetControlledCreaturePermanent;
/**
*
* @author L_J
*/
public final class KryShield extends CardImpl {
public KryShield(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
// {2}, {T}: Prevent all damage that would be dealt this turn by target creature you control. That creature gets +0/+X until end of turn, where X is its converted mana cost.
Effect effect = new PreventDamageByTargetEffect(Duration.EndOfTurn);
effect.setText("Prevent all damage that would be dealt this turn by target creature you control");
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new GenericManaCost(2));
ability.addEffect(new BoostTargetEffect(new StaticValue(0), new TargetConvertedManaCost(), Duration.EndOfTurn, true)
.setText("That creature gets +0/+X until end of turn, where X is its converted mana cost"));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetControlledCreaturePermanent());
this.addAbility(ability);
}
public KryShield(final KryShield card) {
super(card);
}
@Override
public KryShield copy() {
return new KryShield(this);
}
}

View file

@ -1,8 +1,7 @@
package mage.cards.l;
import java.util.UUID;
import mage.abilities.common.CreatureEntersBattlefieldTriggeredAbility;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
@ -14,8 +13,9 @@ import mage.constants.Duration;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public final class LeylineOfVitality extends CardImpl {
@ -23,10 +23,19 @@ public final class LeylineOfVitality extends CardImpl {
public LeylineOfVitality(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}{G}");
// If Leyline of Vitality is in your opening hand, you may begin the game with it on the battlefield.
this.addAbility(LeylineAbility.getInstance());
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(0, 1, Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE, false)));
this.addAbility(new CreatureEntersBattlefieldTriggeredAbility(new GainLifeEffect(1), true));
// Creatures you control get +0/+1.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(0, 1, Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURES, false)));
// Whenever a creature enters the battlefield under your control, you may gain 1 life.
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(
Zone.BATTLEFIELD,
new GainLifeEffect(1),
StaticFilters.FILTER_PERMANENT_CREATURE_A,
true)
);
}
public LeylineOfVitality(final LeylineOfVitality card) {

View file

@ -0,0 +1,130 @@
package mage.cards.l;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.StateTriggeredAbility;
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.token.TokenImpl;
/**
*
* @author jeffwadsworth
*/
public final class LurkingJackals extends CardImpl {
public LurkingJackals(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{B}");
// When an opponent has 10 or less life, if Lurking Jackals is an enchantment, it becomes a 3/2 Hound creature.
this.addAbility(new LurkingJackalsStateTriggeredAbility());
}
public LurkingJackals(final LurkingJackals card) {
super(card);
}
@Override
public LurkingJackals copy() {
return new LurkingJackals(this);
}
}
class LurkingJackalsStateTriggeredAbility extends StateTriggeredAbility {
public LurkingJackalsStateTriggeredAbility() {
super(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new LurkingJackalsToken(), "", Duration.Custom, true, false));
}
public LurkingJackalsStateTriggeredAbility(final LurkingJackalsStateTriggeredAbility ability) {
super(ability);
}
@Override
public LurkingJackalsStateTriggeredAbility copy() {
return new LurkingJackalsStateTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getOpponents(getControllerId()) != null) {
for (UUID opponentId : game.getOpponents(getControllerId())) {
if (game.getPlayer(opponentId).getLife() <= 10) {
return true;
}
}
}
return false;
}
@Override
public boolean checkInterveningIfClause(Game game) {
if (getSourcePermanentIfItStillExists(game) != null) {
return getSourcePermanentIfItStillExists(game).isEnchantment();
}
return false;
}
@Override
public boolean canTrigger(Game game) {
//20100716 - 603.8
Boolean triggered = (Boolean) game.getState().getValue(getSourceId().toString() + "triggered");
if (triggered == null) {
triggered = Boolean.FALSE;
}
return !triggered;
}
@Override
public void trigger(Game game, UUID controllerId) {
//20100716 - 603.8
game.getState().setValue(this.getSourceId().toString() + "triggered", Boolean.TRUE);
super.trigger(game, controllerId);
}
@Override
public boolean resolve(Game game) {
//20100716 - 603.8
boolean result = super.resolve(game);
game.getState().setValue(this.getSourceId().toString() + "triggered", Boolean.FALSE);
return result;
}
@Override
public void counter(Game game) {
game.getState().setValue(this.getSourceId().toString() + "triggered", Boolean.FALSE);
}
@Override
public String getRule() {
return new StringBuilder("When an opponent has 10 or less life, if {this} is an enchantment, ").append(super.getRule()).toString();
}
}
class LurkingJackalsToken extends TokenImpl {
public LurkingJackalsToken() {
super("Hound", "3/2 Hound creature");
cardType.add(CardType.CREATURE);
subtype.add(SubType.HOUND);
power = new MageInt(3);
toughness = new MageInt(2);
}
public LurkingJackalsToken(final LurkingJackalsToken token) {
super(token);
}
@Override
public LurkingJackalsToken copy() {
return new LurkingJackalsToken(this);
}
}

View file

@ -0,0 +1,71 @@
package mage.cards.l;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.PutIntoGraveFromBattlefieldAllTriggeredAbility;
import mage.abilities.condition.common.SourceMatchesFilterCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.other.OwnerPredicate;
import mage.game.permanent.token.TokenImpl;
/**
*
* @author jeffwadsworth
*/
public final class LurkingSkirge extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
static {
filter.add(new OwnerPredicate(TargetController.OPPONENT));
}
public LurkingSkirge(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}");
// When a creature is put into an opponent's graveyard from the battlefield, if Lurking Skirge is an enchantment, Lurking Skirge becomes a 3/2 Imp creature with flying.
TriggeredAbility ability = new PutIntoGraveFromBattlefieldAllTriggeredAbility(new BecomesCreatureSourceEffect(new LurkingSkirgeToken(), "", Duration.WhileOnBattlefield, true, false), false, filter, false);
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, new SourceMatchesFilterCondition(StaticFilters.FILTER_ENCHANTMENT_PERMANENT),
"When a creature is put into an opponent's graveyard from the battlefield, if {this} is an enchantment, {this} becomes a 3/2 Imp creature with flying."));
}
public LurkingSkirge(final LurkingSkirge card) {
super(card);
}
@Override
public LurkingSkirge copy() {
return new LurkingSkirge(this);
}
}
class LurkingSkirgeToken extends TokenImpl {
public LurkingSkirgeToken() {
super("Imp", "3/2 Imp with flying.");
cardType.add(CardType.CREATURE);
subtype.add(SubType.IMP);
power = new MageInt(3);
toughness = new MageInt(2);
this.addAbility(FlyingAbility.getInstance());
}
public LurkingSkirgeToken(final LurkingSkirgeToken token) {
super(token);
}
public LurkingSkirgeToken copy() {
return new LurkingSkirgeToken(this);
}
}

View file

@ -30,7 +30,9 @@ public final class Machinate extends CardImpl {
// Look at the top X cards of your library, where X is the number of artifacts you control. Put one of those cards into your hand and the rest on the bottom of your library in any order.
DynamicValue artifactsOnControl = new PermanentsOnBattlefieldCount(filter);
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(artifactsOnControl, false, new StaticValue(1), new FilterCard(), Zone.LIBRARY, false, false));
LookLibraryAndPickControllerEffect effect = new LookLibraryAndPickControllerEffect(artifactsOnControl, false, new StaticValue(1), new FilterCard(), Zone.LIBRARY, false, false);
effect.setText("Look at the top X cards of your library, where X is the number of artifacts you control. Put one of those cards into your hand and the rest on the bottom of your library in any order.");
this.getSpellAbility().addEffect(effect);
}
public Machinate(final Machinate card) {

View file

@ -2,6 +2,7 @@
package mage.cards.m;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.AttachEffect;
@ -17,13 +18,12 @@ import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author Loki
*/
public final class MammothUmbra extends CardImpl {
public MammothUmbra(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{4}{W}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{W}");
this.subtype.add(SubType.AURA);
@ -33,9 +33,12 @@ public final class MammothUmbra extends CardImpl {
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Enchanted creature gets +3/+3 and has vigilance.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(3, 3, Duration.WhileOnBattlefield)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(VigilanceAbility.getInstance(), AttachmentType.AURA)));
// Totem armor
this.addAbility(new TotemArmorAbility());
}

View file

@ -0,0 +1,40 @@
package mage.cards.m;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.permanent.token.WolvesOfTheHuntToken;
/**
* @author L_J
*/
public final class MasterOfTheHunt extends CardImpl {
public MasterOfTheHunt(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{G}{G}");
this.subtype.add(SubType.HUMAN);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Create a 1/1 green Wolf creature token named Wolves of the Hunt. It has bands with other creatures named Wolves of the Hunt.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new WolvesOfTheHuntToken()), new ManaCostsImpl("{2}{G}{G}")));
}
public MasterOfTheHunt(final MasterOfTheHunt card) {
super(card);
}
@Override
public MasterOfTheHunt copy() {
return new MasterOfTheHunt(this);
}
}

View file

@ -0,0 +1,47 @@
package mage.cards.m;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.EnchantedSourceCondition;
import mage.abilities.decorator.ConditionalRestrictionEffect;
import mage.abilities.effects.common.combat.CantBeBlockedSourceEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
/**
*
* @author jeffwadsworth
*/
public final class MetathranElite extends CardImpl {
private static final String rule = "{this} is unblockable as long as it's enchanted.";
public MetathranElite(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{U}");
this.subtype.add(SubType.METATHRAN);
this.subtype.add(SubType.SOLDIER);
this.power = new MageInt(2);
this.toughness = new MageInt(3);
// Metathran Elite is unblockable as long as it's enchanted.
ConditionalRestrictionEffect effect = new ConditionalRestrictionEffect(
new CantBeBlockedSourceEffect(), new EnchantedSourceCondition());
effect.setText(rule);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}
public MetathranElite(final MetathranElite card) {
super(card);
}
@Override
public MetathranElite copy() {
return new MetathranElite(this);
}
}

View file

@ -0,0 +1,49 @@
package mage.cards.m;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.dynamicvalue.common.AttackedThisTurnOpponentsCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.LifelinkAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.game.permanent.token.KnightToken;
import java.util.UUID;
/**
* @author JayDi85
*/
public final class MilitantAngel extends CardImpl {
public MilitantAngel(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}{W}");
this.subtype.add(SubType.ANGEL);
this.power = new MageInt(3);
this.toughness = new MageInt(4);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Lifelink
this.addAbility(LifelinkAbility.getInstance());
// When Militant Angel enters the battlefield, create a number of 2/2 white Knight creature tokens with vigilance equal to the number of opponents you attacked this turn.
Effect effect = new CreateTokenEffect(new KnightToken(), new AttackedThisTurnOpponentsCount());
effect.setText("create a number of 2/2 white Knight creature tokens with vigilance equal to the number of opponents you attacked this turn");
this.addAbility(new EntersBattlefieldTriggeredAbility(effect));
}
public MilitantAngel(final MilitantAngel card) {
super(card);
}
@Override
public MilitantAngel copy() {
return new MilitantAngel(this);
}
}

View file

@ -1,17 +1,10 @@
package mage.cards.m;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.cards.*;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.FilterCard;
@ -20,8 +13,11 @@ import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetDiscard;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
*
* @author TheElk801
*/
public final class MindBomb extends CardImpl {
@ -67,6 +63,7 @@ class MindBombEffect extends OneShotEffect {
if (controller != null && sourceObject != null) {
Map<UUID, Cards> cardsToDiscard = new HashMap<>();
// choose
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
@ -77,6 +74,8 @@ class MindBombEffect extends OneShotEffect {
cardsToDiscard.put(playerId, cards);
}
}
// discard
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
@ -91,31 +90,17 @@ class MindBombEffect extends OneShotEffect {
}
}
}
// damage
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
Cards cardsPlayer = cardsToDiscard.get(playerId);
if (cardsPlayer != null && !cardsPlayer.isEmpty()) {
if (cardsPlayer != null) {
player.damage(3 - cardsPlayer.size(), source.getId(), game, false, true);
}
}
}
// reveal the searched lands, put in hands, and shuffle
// for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
// Player player = game.getPlayer(playerId);
// if (player != null) {
// Cards cardsPlayer = cardsToReveal.get(playerId);
// if (cardsPlayer != null) {
// for (UUID cardId : cardsPlayer) {
// Cards cards = new CardsImpl(game.getCard(cardId));
// Card card = game.getCard(cardId);
// player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ')', cards, game);
// player.moveCards(card, Zone.HAND, source, game);
// player.shuffleLibrary(source, game);
// }
// }
// }
// }
return true;
}
return false;

View file

@ -0,0 +1,95 @@
package mage.cards.m;
import java.util.UUID;
import mage.MageInt;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
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.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.common.TargetAnyTarget;
/**
*
* @author LevelX2 & L_J
*/
public final class MirrorwoodTreefolk extends CardImpl {
public MirrorwoodTreefolk(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}");
this.subtype.add(SubType.TREEFOLK);
this.power = new MageInt(2);
this.toughness = new MageInt(4);
// {2}{R}{W}: The next time damage would be dealt to Mirrorwood Treefolk this turn, that damage is dealt to any target instead.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MirrorwoodTreefolkEffect(), new ManaCostsImpl("{2}{R}{W}"));
ability.addTarget(new TargetAnyTarget());
this.addAbility(ability);
}
public MirrorwoodTreefolk(final MirrorwoodTreefolk card) {
super(card);
}
@Override
public MirrorwoodTreefolk copy() {
return new MirrorwoodTreefolk(this);
}
}
class MirrorwoodTreefolkEffect extends RedirectionEffect {
protected MageObjectReference redirectToObject;
public MirrorwoodTreefolkEffect() {
super(Duration.EndOfTurn, Integer.MAX_VALUE, UsageType.ONE_USAGE_ABSOLUTE);
staticText = "The next time damage would be dealt to {this} this turn, that damage is dealt to any target instead";
}
public MirrorwoodTreefolkEffect(final MirrorwoodTreefolkEffect effect) {
super(effect);
this.redirectToObject = effect.redirectToObject;
}
@Override
public MirrorwoodTreefolkEffect copy() {
return new MirrorwoodTreefolkEffect(this);
}
@Override
public void init(Ability source, Game game) {
super.init(source, game);
redirectToObject = new MageObjectReference(source.getTargets().get(0).getFirstTarget(), game);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getTargetId().equals(source.getSourceId())) {
if (redirectToObject.equals(new MageObjectReference(source.getTargets().get(0).getFirstTarget(), game))) {
redirectTarget = source.getTargets().get(0);
return true;
}
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
}

View file

@ -13,7 +13,6 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterInstantOrSorceryCard;
import mage.game.Game;
import mage.game.events.GameEvent;
@ -48,14 +47,12 @@ public final class MissionBriefing extends CardImpl {
class MissionBriefingEffect extends OneShotEffect {
public static final FilterCard filter = new FilterInstantOrSorceryCard("instant or sorcery card from your graveyard");
public MissionBriefingEffect() {
super(Outcome.Benefit);
this.staticText = "Surveil 2, then choose an instant or sorcery card "
+ "in your graveyard. You may cast that card this turn. "
+ "If that card would be put into your graveyard this turn, "
+ "exile it instead.";
+ "exile it instead";
}
public MissionBriefingEffect(final MissionBriefingEffect effect) {
@ -74,9 +71,10 @@ class MissionBriefingEffect extends OneShotEffect {
return false;
}
player.surveil(2, source, game);
Target target = new TargetCardInYourGraveyard(filter);
Target target = new TargetCardInYourGraveyard(
new FilterInstantOrSorceryCard("instant or sorcery card from your graveyard"));
if (!player.choose(outcome, target, source.getSourceId(), game)) {
return false;
return true;
}
Card card = game.getCard(target.getFirstTarget());
if (card != null) {

View file

@ -0,0 +1,83 @@
package mage.cards.m;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CounterTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.FilterSpell;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import mage.target.Target;
import mage.target.TargetSpell;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class Mistfolk extends CardImpl {
private static final FilterSpell filter = new FilterSpell("spell that this creature");
static {
filter.add(MistfolkPredicate.instance);
}
public Mistfolk(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}{U}");
this.subtype.add(SubType.ILLUSION);
this.power = new MageInt(1);
this.toughness = new MageInt(2);
// {U}: Counter target spell that targets Mistfolk.
Ability ability = new SimpleActivatedAbility(
new CounterTargetEffect()
.setText("counter target spell that targets {this}"),
new ManaCostsImpl("{U}")
);
ability.addTarget(new TargetSpell(filter));
this.addAbility(ability);
}
public Mistfolk(final Mistfolk card) {
super(card);
}
@Override
public Mistfolk copy() {
return new Mistfolk(this);
}
}
enum MistfolkPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Spell>> {
instance;
@Override
public boolean apply(ObjectSourcePlayer<Spell> input, Game game) {
Permanent sourceObject = game.getPermanent(input.getSourceId());
if (sourceObject == null || input.getObject() == null) {
return false;
}
for (SpellAbility spellAbility : input.getObject().getSpellAbilities()) {
for (Mode mode : spellAbility.getModes().values()) {
for (Target target : spellAbility.getTargets()) {
if (target.getTargets().contains(input.getSourceId())) {
return true;
}
}
}
}
return false;
}
}

View file

@ -1,6 +1,6 @@
package mage.cards.m;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
@ -20,8 +20,6 @@ import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInYourGraveyard;
import java.util.UUID;
/**
* @author LevelX2
*/
@ -86,8 +84,8 @@ class MistveilPlainsGraveyardToLibraryEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Card card = game.getCard(source.getFirstTarget());
Player player = game.getPlayer(source.getControllerId());
if (card == null || player == null ||
game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
if (card == null || player == null
|| game.getState().getZone(card.getId()) != Zone.GRAVEYARD) {
return false;
}
return player.putCardsOnBottomOfLibrary(card, game, source, false);

View file

@ -10,10 +10,11 @@ import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import mage.abilities.effects.AsThoughManaEffect;
import mage.players.ManaPoolItem;
/**
* @author TheElk801
@ -69,17 +70,18 @@ class MnemonicBetrayalExileEffect extends OneShotEffect {
}
Cards cards = new CardsImpl();
Map<UUID, Integer> cardMap = new HashMap();
for (UUID playerId : game.getOpponents(source.getControllerId())) {
Player player = game.getPlayer(playerId);
if (player != null) {
cards.addAll(player.getGraveyard());
}
}
for (Card card : cards.getCards(game)) {
game.getOpponents(source.getControllerId()).stream().map((playerId) -> game.getPlayer(playerId)).filter((player) -> (player != null)).forEachOrdered((player) -> {
cards.addAll(player.getGraveyard());
});
cards.getCards(game).stream().map((card) -> {
cardMap.put(card.getId(), card.getZoneChangeCounter(game));
return card;
}).map((card) -> {
game.addEffect(new MnemonicBetrayalCastFromExileEffect(card, game), source);
return card;
}).forEachOrdered((card) -> {
game.addEffect(new MnemonicBetrayalAnyColorEffect(card, game), source);
}
});
controller.moveCardsToExile(cards.getCards(game), source, game, true, source.getSourceId(), source.getSourceObjectIfItStillExists(game).getName());
game.addDelayedTriggeredAbility(new MnemonicBetrayalDelayedTriggeredAbility(cards, cardMap), source);
return true;
@ -125,7 +127,7 @@ class MnemonicBetrayalCastFromExileEffect extends AsThoughEffectImpl {
}
}
class MnemonicBetrayalAnyColorEffect extends AsThoughEffectImpl {
class MnemonicBetrayalAnyColorEffect extends AsThoughEffectImpl implements AsThoughManaEffect {
private final Card card;
private final int zoneCounter;
@ -154,13 +156,21 @@ class MnemonicBetrayalAnyColorEffect extends AsThoughEffectImpl {
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
if (card.getZoneChangeCounter(game) != zoneCounter) {
this.discard();
return false;
if (objectId.equals(card.getId())
&& card.getZoneChangeCounter(game) <= zoneCounter + 1
&& affectedControllerId.equals(source.getControllerId())) {
return true;
} else {
if (objectId.equals(card.getId())) {
this.discard();
}
}
return objectId.equals(card.getId())
&& card.getZoneChangeCounter(game) == zoneCounter
&& affectedControllerId.equals(source.getControllerId());
return false;
}
@Override
public ManaType getAsThoughManaType(ManaType manaType, ManaPoolItem mana, UUID affectedControllerId, Ability source, Game game) {
return mana.getFirstAvailable();
}
}
@ -240,12 +250,10 @@ class MnemonicBetrayalReturnEffect extends OneShotEffect {
return false;
}
Cards cardsToReturn = new CardsImpl();
for (Card card : cards.getCards(game)) {
if (game.getState().getZone(card.getId()) == Zone.EXILED
&& card.getZoneChangeCounter(game) == cardMap.getOrDefault(card.getId(), -5) + 1) {
cardsToReturn.add(card);
}
}
cards.getCards(game).stream().filter((card) -> (game.getState().getZone(card.getId()) == Zone.EXILED
&& card.getZoneChangeCounter(game) == cardMap.getOrDefault(card.getId(), -5) + 1)).forEachOrdered((card) -> {
cardsToReturn.add(card);
});
return player.moveCards(cardsToReturn, Zone.GRAVEYARD, source, game);
}
}

View file

@ -0,0 +1,111 @@
package mage.cards.m;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.common.AttackingCreatureCount;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class MobMentality extends CardImpl {
public MobMentality(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{R}");
this.subtype.add(SubType.AURA);
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Enchanted creature has trample.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(TrampleAbility.getInstance(), AttachmentType.AURA)));
// Whenever all non-Wall creatures you control attack, enchanted creature gets +X/+0 until end of turn, where X is the number of attacking creatures.
this.addAbility(new MobMentalityTriggeredAbility());
}
public MobMentality(final MobMentality card) {
super(card);
}
@Override
public MobMentality copy() {
return new MobMentality(this);
}
}
class MobMentalityTriggeredAbility extends TriggeredAbilityImpl {
MobMentalityTriggeredAbility() {
super(Zone.BATTLEFIELD, new BoostTargetEffect(new AttackingCreatureCount(), new StaticValue(0), Duration.EndOfTurn, true));
}
private MobMentalityTriggeredAbility(final MobMentalityTriggeredAbility ability) {
super(ability);
}
@Override
public MobMentalityTriggeredAbility copy() {
return new MobMentalityTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!game.getCombat().getAttackingPlayerId().equals(getControllerId())) {
return false;
}
Permanent aura = game.getPermanent(getSourceId());
if (aura == null) {
return false;
}
Permanent creature = game.getPermanent(aura.getAttachedTo());
if (creature == null) {
return false;
}
for (Effect effect : getEffects()) {
effect.setTargetPointer(new FixedTarget(creature, game));
}
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(getControllerId())) {
if (permanent.isCreature()
&& !permanent.hasSubtype(SubType.WALL, game)
&& !permanent.isAttacking()) {
return false;
}
}
return true;
}
@Override
public String getRule() {
return "Whenever all non-Wall creatures you control attack, " +
"enchanted creature gets +X/+0 until end of turn, " +
"where X is the number of attacking creatures.";
}
}

View file

@ -1,11 +1,11 @@
package mage.cards.m;
import java.util.UUID;
import mage.abilities.effects.common.SkipNextCombatEffect;
import mage.abilities.effects.common.SkipCombatStepEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.target.TargetPlayer;
/**
@ -13,19 +13,19 @@ import mage.target.TargetPlayer;
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/
public final class MomentOfSilence extends CardImpl {
public MomentOfSilence(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{W}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{W}");
// Target player skips their next combat phase this turn.
this.getSpellAbility().addEffect(new SkipNextCombatEffect());
this.getSpellAbility().addEffect(new SkipCombatStepEffect(Duration.EndOfTurn).setText("Target player skips their next combat this turn"));
this.getSpellAbility().addTarget(new TargetPlayer());
}
public MomentOfSilence(final MomentOfSilence card) {
super(card);
}
@Override
public MomentOfSilence copy() {
return new MomentOfSilence(this);

View file

@ -0,0 +1,47 @@
package mage.cards.m;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.BandsWithOtherAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.filter.predicate.mageobject.SupertypePredicate;
/**
*
* @author L_J
*/
public final class MountainStronghold extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Red legendary creatures");
static {
filter.add(new ColorPredicate(ObjectColor.RED));
filter.add(new SupertypePredicate(SuperType.LEGENDARY));
}
public MountainStronghold(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
// Red legendary creatures you control have "bands with other legendary creatures."
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(new BandsWithOtherAbility(SuperType.LEGENDARY), Duration.WhileOnBattlefield, filter)));
}
public MountainStronghold(final MountainStronghold card) {
super(card);
}
@Override
public MountainStronghold copy() {
return new MountainStronghold(this);
}
}

View file

@ -0,0 +1,36 @@
package mage.cards.n;
import mage.MageInt;
import mage.abilities.keyword.FlashAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import java.util.UUID;
/**
* @author JayDi85
*/
public final class NimblePilferer extends CardImpl {
public NimblePilferer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.ROGUE);
this.power = new MageInt(2);
this.toughness = new MageInt(1);
this.addAbility(FlashAbility.getInstance());
}
public NimblePilferer(final NimblePilferer card) {
super(card);
}
@Override
public NimblePilferer copy() {
return new NimblePilferer(this);
}
}

View file

@ -2,27 +2,28 @@
package mage.cards.n;
import java.util.UUID;
import mage.abilities.effects.common.PutOnLibraryTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.target.common.TargetCardInGraveyard;
import java.util.UUID;
/**
*
* @author Loki
*/
public final class NoxiousRevival extends CardImpl {
public NoxiousRevival (UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{G/P}");
public NoxiousRevival(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{G/P}");
// Put target card from a graveyard on top of its owners library.
this.getSpellAbility().addEffect(new PutOnLibraryTargetEffect(true));
this.getSpellAbility().addTarget(new TargetCardInGraveyard());
}
public NoxiousRevival (final NoxiousRevival card) {
public NoxiousRevival(final NoxiousRevival card) {
super(card);
}

View file

@ -0,0 +1,109 @@
package mage.cards.n;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.ObjectColor;
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.filter.FilterCard;
import mage.filter.common.FilterNonlandCard;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
/**
*
* @author L_J
*/
public final class NoxiousVapors extends CardImpl {
public NoxiousVapors(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}{B}");
// Each player reveals their hand, chooses one card of each color from it, then discards all other nonland cards.
this.getSpellAbility().addEffect(new NoxiousVaporsEffect());
}
public NoxiousVapors(final NoxiousVapors card) {
super(card);
}
@Override
public NoxiousVapors copy() {
return new NoxiousVapors(this);
}
}
class NoxiousVaporsEffect extends OneShotEffect {
private static final FilterNonlandCard filter = new FilterNonlandCard();
public NoxiousVaporsEffect() {
super(Outcome.Benefit);
this.staticText = "Each player reveals their hand, chooses one card of each color from it, then discards all other nonland cards";
}
public NoxiousVaporsEffect(final NoxiousVaporsEffect effect) {
super(effect);
}
@Override
public NoxiousVaporsEffect copy() {
return new NoxiousVaporsEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
player.revealCards(player.getName() + "'s hand", player.getHand(), game);
}
}
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
Set<Card> chosenCards = new HashSet<>();
chooseCardForColor(ObjectColor.WHITE, chosenCards, player, game, source);
chooseCardForColor(ObjectColor.BLUE, chosenCards, player, game, source);
chooseCardForColor(ObjectColor.BLACK, chosenCards, player, game, source);
chooseCardForColor(ObjectColor.RED, chosenCards, player, game, source);
chooseCardForColor(ObjectColor.GREEN, chosenCards, player, game, source);
Set<Card> cards = player.getHand().getCards(game);
for (Card card : cards) {
if (card != null && !chosenCards.contains(card) && filter.match(card, game)) {
player.discard(card, source, game);
}
}
}
}
return true;
}
return false;
}
private void chooseCardForColor(ObjectColor color, Set<Card> chosenCards, Player player, Game game, Ability source) {
FilterCard filter = new FilterCard();
filter.add(new ColorPredicate(color));
TargetCardInHand target = new TargetCardInHand(filter);
if (player.choose(Outcome.Benefit, target, source.getSourceId(), game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
chosenCards.add(card);
}
}
}
}

View file

@ -0,0 +1,38 @@
package mage.cards.o;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.DamagePlayersEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.TargetController;
import java.util.UUID;
/**
* @author JayDi85
*/
public final class OgrePainbringer extends CardImpl {
public OgrePainbringer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}{R}");
this.subtype.add(SubType.OGRE);
this.power = new MageInt(7);
this.toughness = new MageInt(3);
// When Ogre Painbringer enters the battlefield, it deals 3 damage to each player.
this.addAbility(new EntersBattlefieldTriggeredAbility(new DamagePlayersEffect(3, TargetController.ANY, "it")));
}
public OgrePainbringer(final OgrePainbringer card) {
super(card);
}
@Override
public OgrePainbringer copy() {
return new OgrePainbringer(this);
}
}

View file

@ -0,0 +1,75 @@
package mage.cards.o;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.keyword.BandsWithOtherAbility;
import mage.abilities.keyword.CumulativeUpkeepAbility;
import mage.abilities.keyword.EchoAbility;
import mage.abilities.keyword.FadingAbility;
import mage.abilities.keyword.FlankingAbility;
import mage.abilities.keyword.LandwalkAbility;
import mage.abilities.keyword.PhasingAbility;
import mage.abilities.keyword.ProtectionAbility;
import mage.abilities.keyword.RampageAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterCard;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.mageobject.SupertypePredicate;
/**
*
* @author L_J
*/
public final class OldFogey extends CardImpl {
private static final FilterCard filter = new FilterCard("Homarids");
private static final FilterLandPermanent filter2 = new FilterLandPermanent("snow-covered plains");
static {
filter.add(new SubtypePredicate(SubType.HOMARID));
filter2.add(new SupertypePredicate(SuperType.SNOW));
filter2.add(new SubtypePredicate(SubType.PLAINS));
}
public OldFogey(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}{G}");
this.subtype.add(SubType.DINOSAUR);
this.power = new MageInt(7);
this.toughness = new MageInt(7);
// Phasing
this.addAbility(PhasingAbility.getInstance());
// Cumulative upkeep {1}
this.addAbility(new CumulativeUpkeepAbility(new ManaCostsImpl("{1}")));
// Echo {G}{G}
this.addAbility(new EchoAbility("{G}{G}"));
// Fading 3
this.addAbility(new FadingAbility(3, this));
// Bands with other Dinosaurs
this.addAbility(new BandsWithOtherAbility(SubType.DINOSAUR));
// Protection from Homarids
this.addAbility(new ProtectionAbility(filter));
// Snow-covered plainswalk
this.addAbility(new LandwalkAbility(filter2));
// Flanking
this.addAbility(new FlankingAbility());
// Rampage 2
this.addAbility(new RampageAbility(2));
}
public OldFogey(final OldFogey card) {
super(card);
}
@Override
public OldFogey copy() {
return new OldFogey(this);
}
}

View file

@ -0,0 +1,77 @@
package mage.cards.o;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SpellCastOpponentTriggeredAbility;
import mage.abilities.condition.common.SourceMatchesFilterCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
import mage.abilities.effects.common.continuous.BecomesEnchantmentSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.permanent.token.TokenImpl;
/**
*
* @author jeffwadsworth
*/
public final class OpalAcrolith extends CardImpl {
private static final FilterSpell filter = new FilterSpell("creature spell");
static {
filter.add(new CardTypePredicate(CardType.CREATURE));
}
public OpalAcrolith(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}");
// Whenever an opponent casts a creature spell, if Opal Acrolith is an enchantment, Opal Acrolith becomes a 2/4 Soldier creature.
TriggeredAbility ability = new SpellCastOpponentTriggeredAbility(new BecomesCreatureSourceEffect(new OpalAcrolithToken(), "", Duration.WhileOnBattlefield, true, false),
filter, false);
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, new SourceMatchesFilterCondition(StaticFilters.FILTER_ENCHANTMENT_PERMANENT),
"Whenever an opponent casts a creature spell, if Opal Acrolith is an enchantment, Opal Acrolith becomes a 2/4 Soldier creature."));
// {0}: Opal Acrolith becomes an enchantment.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesEnchantmentSourceEffect(), new ManaCostsImpl("{0}")));
}
public OpalAcrolith(final OpalAcrolith card) {
super(card);
}
@Override
public OpalAcrolith copy() {
return new OpalAcrolith(this);
}
}
class OpalAcrolithToken extends TokenImpl {
public OpalAcrolithToken() {
super("Soldier", "2/4 Soldier creature");
cardType.add(CardType.CREATURE);
subtype.add(SubType.SOLDIER);
power = new MageInt(2);
toughness = new MageInt(4);
}
public OpalAcrolithToken(final OpalAcrolithToken token) {
super(token);
}
public OpalAcrolithToken copy() {
return new OpalAcrolithToken(this);
}
}

View file

@ -0,0 +1,126 @@
package mage.cards.o;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.StateTriggeredAbility;
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.token.TokenImpl;
/**
*
* @author jeffwadsworth
*/
public final class OpalAvenger extends CardImpl {
public OpalAvenger(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}");
// When you have 10 or less life, if Opal Avenger is an enchantment, Opal Avenger becomes a 3/5 Soldier creature.
this.addAbility(new OpalAvengerStateTriggeredAbility());
}
public OpalAvenger(final OpalAvenger card) {
super(card);
}
@Override
public OpalAvenger copy() {
return new OpalAvenger(this);
}
}
class OpalAvengerStateTriggeredAbility extends StateTriggeredAbility {
public OpalAvengerStateTriggeredAbility() {
super(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new OpalAvengerToken(), "", Duration.Custom, true, false));
}
public OpalAvengerStateTriggeredAbility(final OpalAvengerStateTriggeredAbility ability) {
super(ability);
}
@Override
public OpalAvengerStateTriggeredAbility copy() {
return new OpalAvengerStateTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getState().getPlayer(getControllerId()) != null) {
return game.getState().getPlayer(getControllerId()).getLife() <= 10;
}
return false;
}
@Override
public boolean checkInterveningIfClause(Game game) {
if (getSourcePermanentIfItStillExists(game) != null) {
return getSourcePermanentIfItStillExists(game).isEnchantment();
}
return false;
}
@Override
public boolean canTrigger(Game game) {
//20100716 - 603.8
Boolean triggered = (Boolean) game.getState().getValue(getSourceId().toString() + "triggered");
if (triggered == null) {
triggered = Boolean.FALSE;
}
return !triggered;
}
@Override
public void trigger(Game game, UUID controllerId) {
//20100716 - 603.8
game.getState().setValue(this.getSourceId().toString() + "triggered", Boolean.TRUE);
super.trigger(game, controllerId);
}
@Override
public boolean resolve(Game game) {
//20100716 - 603.8
boolean result = super.resolve(game);
game.getState().setValue(this.getSourceId().toString() + "triggered", Boolean.FALSE);
return result;
}
@Override
public void counter(Game game) {
game.getState().setValue(this.getSourceId().toString() + "triggered", Boolean.FALSE);
}
@Override
public String getRule() {
return new StringBuilder("When you have 10 or less life, if {this} is an enchantment, ").append(super.getRule()).toString();
}
}
class OpalAvengerToken extends TokenImpl {
public OpalAvengerToken() {
super("Soldier", "3/5 Soldier creature");
cardType.add(CardType.CREATURE);
subtype.add(SubType.SOLDIER);
power = new MageInt(3);
toughness = new MageInt(5);
}
public OpalAvengerToken(final OpalAvengerToken token) {
super(token);
}
@Override
public OpalAvengerToken copy() {
return new OpalAvengerToken(this);
}
}

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