Merge pull request #1 from magefree/master

Update for part of Guilds
This commit is contained in:
jmharmon 2018-09-19 13:59:16 -07:00 committed by GitHub
commit 958752d8e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
238 changed files with 8788 additions and 376 deletions

View file

@ -538,7 +538,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
// Always hide not hidden popup window or enlarged card view if a frame is set to active
try {
ActionCallback callback = Plugins.instance.getActionCallback();
if (callback != null && callback instanceof MageActionCallback) {
if (callback instanceof MageActionCallback) {
((MageActionCallback) callback).hideEnlargedCard();
}
Component container = MageFrame.getUI().getComponent(MageComponents.POPUP_CONTAINER);

View file

@ -319,7 +319,7 @@ public class DialogManager extends JComponent implements MouseListener,
if (e.getButton() == MouseEvent.BUTTON1) {
j = (JComponent) getComponentAt(e.getX(), e.getY());
if (j != null && j instanceof DialogContainer) {
if (j instanceof DialogContainer) {
rec = j.getBounds();
bDragged = true;
mx = e.getX();

View file

@ -530,7 +530,7 @@ public class MageBook extends JComponent {
Class<?> c = Class.forName(className);
Constructor<?> cons = c.getConstructor();
Object newToken = cons.newInstance();
if (newToken != null && newToken instanceof mage.game.permanent.token.Token) {
if (newToken instanceof Token) {
((Token) newToken).setExpansionSetCodeForImage(set);
((Token) newToken).setOriginalExpansionSetCode(set);
((Token) newToken).setTokenType(token.getType());
@ -580,7 +580,7 @@ public class MageBook extends JComponent {
Class<?> c = Class.forName(className);
Constructor<?> cons = c.getConstructor();
Object newEmblem = cons.newInstance();
if (newEmblem != null && newEmblem instanceof mage.game.command.Emblem) {
if (newEmblem instanceof Emblem) {
((Emblem) newEmblem).setExpansionSetCodeForImage(set);
emblems.add((Emblem) newEmblem);
@ -637,7 +637,7 @@ public class MageBook extends JComponent {
Class<?> c = Class.forName(className);
Constructor<?> cons = c.getConstructor();
Object newPlane = cons.newInstance();
if (newPlane != null && newPlane instanceof mage.game.command.Plane) {
if (newPlane instanceof Plane) {
((Plane) newPlane).setExpansionSetCodeForImage(set);
planes.add((Plane) newPlane);

View file

@ -369,7 +369,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
if (!card.getId().equals(bigCard.getCardId())) {
if (!MageFrame.isLite()) {
Image image = Plugins.instance.getOriginalImage(card);
if (image != null && image instanceof BufferedImage) {
if (image instanceof BufferedImage) {
// XXX: scaled to fit width
bigCard.setCard(card.getId(), EnlargeMode.NORMAL, image, new ArrayList<>(), false);
} else {

View file

@ -617,7 +617,7 @@ public class MageActionCallback implements ActionCallback {
}
private void displayCardInfo(MageCard mageCard, Image image, BigCard bigCard) {
if (image != null && image instanceof BufferedImage) {
if (image instanceof BufferedImage) {
// XXX: scaled to fit width
bigCard.setCard(mageCard.getOriginal().getId(), enlargeMode, image, mageCard.getOriginal().getRules(), mageCard.getOriginal().isToRotate());
// if it's an ability, show only the ability text as overlay

View file

@ -47,7 +47,7 @@ public class CountryItemEditor extends BasicComboBoxEditor {
@Override
public void setItem(Object item) {
if (item == null || !(item instanceof String[])) {
if (!(item instanceof String[])) {
return;
}

View file

@ -800,7 +800,7 @@ public abstract class CardPanel extends MagePermanent implements MouseListener,
// this update removes the isChoosable mark from targetCardsInLibrary
// so only done for permanents because it's needed to redraw counters in different size, if window size was changed
// no perfect solution yet (maybe also other not wanted effects for PermanentView objects)
if (updateCard != null && (updateCard instanceof PermanentView)) {
if ((updateCard instanceof PermanentView)) {
update(updateCard);
}
}

View file

@ -231,8 +231,9 @@ public enum MythicspoilerComSource implements CardImageSource {
supportedSets.add("DOM");
supportedSets.add("BBD");
supportedSets.add("M19");
// supportedSets.add("C18");
// supportedSets.add("CM2");
supportedSets.add("C18");
supportedSets.add("CM2");
supportedSets.add("GRN");
sets = new LinkedHashMap<>();
setsAliases = new HashMap<>();

View file

@ -230,6 +230,7 @@ public enum ScryfallImageSource implements CardImageSource {
supportedSets.add("CM2");
supportedSets.add("M19");
supportedSets.add("GS1");
supportedSets.add("GRN");
}
@Override

View file

@ -225,7 +225,7 @@ public class Connection {
for (InterfaceAddress addr : iface.getInterfaceAddresses()) {
if (addr != null) {
InetAddress iaddr = addr.getAddress();
if (iaddr != null && iaddr instanceof Inet4Address) {
if (iaddr instanceof Inet4Address) {
return iaddr;
}
}

View file

@ -39,7 +39,7 @@ public final class CompressUtil {
* @return Decompressed object
*/
public static Object decompress(Object data) {
if (data == null || !(data instanceof ZippedObject)) {
if (!(data instanceof ZippedObject)) {
return data;
}
return ((ZippedObject) data).unzip();

View file

@ -27,7 +27,7 @@ public class LevelUpOptimizer extends BaseTreeOptimizer {
for (Ability ability : actions) {
if (ability instanceof LevelUpAbility) {
Permanent permanent = game.getPermanent(ability.getSourceId());
if (permanent != null && permanent instanceof PermanentCard) {
if (permanent instanceof PermanentCard) {
PermanentCard leveler = (PermanentCard) permanent;
// check already existing Level counters and compare to maximum that make sense
if (permanent.getCounters(game).getCount(CounterType.LEVEL) >= leveler.getMaxLevelCounters()) {

View file

@ -408,7 +408,7 @@ public final class SystemUtil {
Class<?> c = Class.forName("mage.game.permanent.token." + command.cardName);
Constructor<?> cons = c.getConstructor();
Object token = cons.newInstance();
if (token != null && token instanceof mage.game.permanent.token.Token) {
if (token instanceof mage.game.permanent.token.Token) {
((mage.game.permanent.token.Token) token).putOntoBattlefield(command.Amount, game, null, player.getId(), false, false);
continue;
}
@ -417,7 +417,7 @@ public final class SystemUtil {
Class<?> c = Class.forName("mage.game.command.emblems." + command.cardName);
Constructor<?> cons = c.getConstructor();
Object emblem = cons.newInstance();
if (emblem != null && emblem instanceof mage.game.command.Emblem) {
if (emblem instanceof mage.game.command.Emblem) {
((mage.game.command.Emblem) emblem).setControllerId(player.getId());
game.addEmblem((mage.game.command.Emblem) emblem, null, player.getId());
continue;
@ -427,7 +427,7 @@ public final class SystemUtil {
Class<?> c = Class.forName("mage.game.command.planes." + command.cardName);
Constructor<?> cons = c.getConstructor();
Object plane = cons.newInstance();
if (plane != null && plane instanceof mage.game.command.Plane) {
if (plane instanceof mage.game.command.Plane) {
((mage.game.command.Plane) plane).setControllerId(player.getId());
game.addPlane((mage.game.command.Plane) plane, null, player.getId());
continue;

View file

@ -0,0 +1,56 @@
package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.FightTargetSourceEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.TargetController;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author TheElk801
*/
public final class AffectionateIndrik extends CardImpl {
private static final FilterCreaturePermanent filter
= new FilterCreaturePermanent("creature you don't control");
static {
filter.add(new ControllerPredicate(TargetController.NOT_YOU));
}
public AffectionateIndrik(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{G}");
this.subtype.add(SubType.BEAST);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// When Affectionate Indrik enters the battlefield, you may have it fight target creature you don't control.
Ability ability = new EntersBattlefieldTriggeredAbility(
new FightTargetSourceEffect()
.setText("you may have it fight "
+ "target creature you don't control"),
true
);
ability.addTarget(new TargetCreaturePermanent(filter));
this.addAbility(ability);
}
public AffectionateIndrik(final AffectionateIndrik card) {
super(card);
}
@Override
public AffectionateIndrik copy() {
return new AffectionateIndrik(this);
}
}

View file

@ -0,0 +1,121 @@
package mage.cards.a;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfCombatTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect;
import mage.constants.SubType;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.TargetController;
import mage.constants.WatcherScope;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.stack.Spell;
import mage.watchers.Watcher;
/**
*
* @author TheElk801
*/
public final class ArclightPhoenix extends CardImpl {
public ArclightPhoenix(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}");
this.subtype.add(SubType.PHOENIX);
this.power = new MageInt(3);
this.toughness = new MageInt(2);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Haste
this.addAbility(HasteAbility.getInstance());
// At the beginning of combat on your turn, if you cast 3 or more instants and/or sorceries this turn, you may return Arclight Phoenix from your graveyard to the battlefield.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new BeginningOfCombatTriggeredAbility(
new ReturnSourceFromGraveyardToBattlefieldEffect(),
TargetController.YOU, true
), ArclightPhoenixCondition.instance,
"At the beginning of combat on your turn, "
+ "if you've cast three or more instant "
+ "and sorcery spells this turn, you may return {this} "
+ "from your graveyard to the battlefield."
), new ArclightPhoenixWatcher());
}
public ArclightPhoenix(final ArclightPhoenix card) {
super(card);
}
@Override
public ArclightPhoenix copy() {
return new ArclightPhoenix(this);
}
}
enum ArclightPhoenixCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
ArclightPhoenixWatcher watcher
= (ArclightPhoenixWatcher) game.getState().getWatchers().get(
ArclightPhoenixWatcher.class.getSimpleName()
);
return watcher != null && watcher.getInstantSorceryCount(source.getControllerId()) > 2;
}
}
class ArclightPhoenixWatcher extends Watcher {
private Map<UUID, Integer> instantSorceryCount = new HashMap();
public ArclightPhoenixWatcher() {
super(ArclightPhoenixWatcher.class.getSimpleName(), WatcherScope.GAME);
}
public ArclightPhoenixWatcher(final ArclightPhoenixWatcher watcher) {
super(watcher);
this.instantSorceryCount.putAll(watcher.instantSorceryCount);
}
@Override
public ArclightPhoenixWatcher copy() {
return new ArclightPhoenixWatcher(this);
}
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell == null || !spell.isInstantOrSorcery()) {
return;
}
this.instantSorceryCount.putIfAbsent(spell.getControllerId(), 0);
this.instantSorceryCount.compute(
spell.getControllerId(), (k, a) -> a + 1
);
}
}
@Override
public void reset() {
super.reset();
this.instantSorceryCount.clear();
}
public int getInstantSorceryCount(UUID playerId) {
return this.instantSorceryCount.getOrDefault(playerId, 0);
}
}

View file

@ -0,0 +1,56 @@
package mage.cards.a;
import java.util.UUID;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardSetInfo;
import mage.cards.SplitCard;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SpellAbilityType;
import mage.counters.CounterType;
import mage.game.permanent.token.ElfKnightToken;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author TheElk801
*/
public final class AssureAssemble extends SplitCard {
public AssureAssemble(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{G/W}{G/W}", "{4}{G}{W}", SpellAbilityType.SPLIT);
// Assure
// Put a +1/+1 counter on target creature. It gains indestructible until end of turn.
this.getLeftHalfCard().getSpellAbility().addEffect(
new AddCountersTargetEffect(CounterType.P1P1.createInstance())
);
this.getLeftHalfCard().getSpellAbility().addEffect(
new GainAbilityTargetEffect(
IndestructibleAbility.getInstance(),
Duration.EndOfTurn
).setText("It gains indestructible until end of turn.")
);
this.getLeftHalfCard().getSpellAbility().addTarget(
new TargetCreaturePermanent()
);
// Assemble
// Create three 2/2 green and white Elf Knight creature tokens with vigilance.
this.getRightHalfCard().getSpellAbility().addEffect(
new CreateTokenEffect(new ElfKnightToken(), 3)
);
}
public AssureAssemble(final AssureAssemble card) {
super(card);
}
@Override
public AssureAssemble copy() {
return new AssureAssemble(this);
}
}

View file

@ -0,0 +1,103 @@
package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfCombatTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.MentorAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.abilities.keyword.VigilanceAbility;
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.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledCreaturePermanent;
/**
*
* @author TheElk801
*/
public final class AureliaExemplarOfJustice extends CardImpl {
public AureliaExemplarOfJustice(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{W}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.ANGEL);
this.power = new MageInt(2);
this.toughness = new MageInt(5);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Mentor
this.addAbility(new MentorAbility());
// At the beginning of combat on your turn, choose up to one target creature you control. Until end of turn, that creature gets +2/+0, gains trample if it's red, and gains vigilance if it's white.
Ability ability = new BeginningOfCombatTriggeredAbility(
new AureliaExemplarOfJusticeEffect(),
TargetController.YOU, false
);
ability.addTarget(new TargetControlledCreaturePermanent(0, 1));
this.addAbility(ability);
}
public AureliaExemplarOfJustice(final AureliaExemplarOfJustice card) {
super(card);
}
@Override
public AureliaExemplarOfJustice copy() {
return new AureliaExemplarOfJustice(this);
}
}
class AureliaExemplarOfJusticeEffect extends OneShotEffect {
public AureliaExemplarOfJusticeEffect() {
super(Outcome.Benefit);
this.staticText = "choose up to one target creature you control. "
+ "Until end of turn, that creature gets +2/+0, "
+ "gains trample if it's red, "
+ "and gains vigilance if it's white.";
}
public AureliaExemplarOfJusticeEffect(final AureliaExemplarOfJusticeEffect effect) {
super(effect);
}
@Override
public AureliaExemplarOfJusticeEffect copy() {
return new AureliaExemplarOfJusticeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent creature = game.getPermanent(source.getFirstTarget());
if (creature == null) {
return false;
}
game.addEffect(new BoostTargetEffect(2, 0, Duration.EndOfTurn), source);
if (creature.getColor(game).isRed()) {
game.addEffect(new GainAbilityTargetEffect(
TrampleAbility.getInstance(), Duration.EndOfTurn
), source);
}
if (creature.getColor(game).isWhite()) {
game.addEffect(new GainAbilityTargetEffect(
VigilanceAbility.getInstance(), Duration.EndOfTurn
), source);
}
return true;
}
}

View file

@ -0,0 +1,44 @@
package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.keyword.SurveilEffect;
import mage.constants.SubType;
import mage.abilities.keyword.DefenderAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
/**
*
* @author TheElk801
*/
public final class BarrierOfBones extends CardImpl {
public BarrierOfBones(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}");
this.subtype.add(SubType.SKELETON);
this.subtype.add(SubType.WALL);
this.power = new MageInt(0);
this.toughness = new MageInt(3);
// Defender
this.addAbility(DefenderAbility.getInstance());
// When Barrier of Bones enters the battlefield, surveil 1.
this.addAbility(new EntersBattlefieldTriggeredAbility(
new SurveilEffect(1), false
));
}
public BarrierOfBones(final BarrierOfBones card) {
super(card);
}
@Override
public BarrierOfBones copy() {
return new BarrierOfBones(this);
}
}

View file

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

View file

@ -0,0 +1,39 @@
package mage.cards.b;
import java.util.UUID;
import mage.abilities.dynamicvalue.common.InstantSorceryExileGraveyardCount;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.JumpStartAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
/**
*
* @author TheElk801
*/
public final class BeaconBolt extends CardImpl {
public BeaconBolt(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{U}{R}");
// Beacon Bolt deals damage to target creature equal to the total number of instant and sorcery cards you own in exile and in your graveyard.
this.getSpellAbility().addEffect(new DamageTargetEffect(
InstantSorceryExileGraveyardCount.instance
).setText("{this} deals damage to target creature equal to "
+ "the total number of instant and sorcery cards "
+ "you own in exile and in your graveyard"));
// Jump-start
this.addAbility(new JumpStartAbility(this));
}
public BeaconBolt(final BeaconBolt card) {
super(card);
}
@Override
public BeaconBolt copy() {
return new BeaconBolt(this);
}
}

View file

@ -171,7 +171,7 @@ class BerserkDelayedDestroyEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
if (permanent != null) {
Watcher watcher = game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getSimpleName());
if (watcher != null && watcher instanceof AttackedThisTurnWatcher) {
if (watcher instanceof AttackedThisTurnWatcher) {
if (((AttackedThisTurnWatcher) watcher).getAttackedThisTurnCreatures().contains(new MageObjectReference(permanent, game))) {
return permanent.destroy(source.getSourceId(), game, false);
}

View file

@ -0,0 +1,97 @@
package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.costs.common.PayLifeCost;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.effects.common.ReturnSourceFromGraveyardToHandEffect;
import mage.abilities.keyword.LifelinkAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
import mage.target.common.TargetCardInGraveyard;
/**
*
* @author LevelX2
*/
public final class BloodOperative extends CardImpl {
public BloodOperative(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}{B}");
this.subtype.add(SubType.VAMPIRE);
this.subtype.add(SubType.ASSASSIN);
this.power = new MageInt(3);
this.toughness = new MageInt(1);
// Lifelink
this.addAbility(LifelinkAbility.getInstance());
// When Blood Operative enters the battlefield, you may exile target card from a graveyard.
Ability ability = new EntersBattlefieldTriggeredAbility(new ExileTargetEffect(), true);
ability.addTarget(new TargetCardInGraveyard());
this.addAbility(ability);
// Whenever you surveil, if Blood Operative is in your graveyard, you may pay 3 life. If you do, return Blood Operative to your hand.
this.addAbility(new BloodOperativeTriggeredAbility());
}
public BloodOperative(final BloodOperative card) {
super(card);
}
@Override
public BloodOperative copy() {
return new BloodOperative(this);
}
}
class BloodOperativeTriggeredAbility extends TriggeredAbilityImpl {
public BloodOperativeTriggeredAbility() {
super(Zone.BATTLEFIELD, new DoIfCostPaid(new ReturnSourceFromGraveyardToHandEffect(), new PayLifeCost(3)), false);
}
public BloodOperativeTriggeredAbility(final BloodOperativeTriggeredAbility ability) {
super(ability);
}
@Override
public BloodOperativeTriggeredAbility copy() {
return new BloodOperativeTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.SURVEILED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return event.getPlayerId().equals(getControllerId());
}
@Override
public boolean checkInterveningIfClause(Game game) {
Player controller = game.getPlayer(getControllerId());
if (controller != null && controller.getGraveyard().contains(getSourceId())) {
return super.checkInterveningIfClause(game);
}
return false;
}
@Override
public String getRule() {
return "Whenever you surveil, if {this} is in your graveyard, you may pay 3 life. If you do, return {this} to your hand.";
}
}

View file

@ -0,0 +1,45 @@
package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.effects.common.discard.DiscardHandDrawSameNumberSourceEffect;
import mage.constants.SubType;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
/**
*
* @author TheElk801
*/
public final class BookDevourer extends CardImpl {
public BookDevourer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{R}");
this.subtype.add(SubType.BEAST);
this.power = new MageInt(4);
this.toughness = new MageInt(5);
// Trample
this.addAbility(TrampleAbility.getInstance());
// Whenever Book Devourer deals combat damage to a player, you may discard all the cards in your hand. If you do, draw that many cards.
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(
new DiscardHandDrawSameNumberSourceEffect()
.setText("discard all the cards in your hand. "
+ "If you do, draw that many cards"), true
));
}
public BookDevourer(final BookDevourer card) {
super(card);
}
@Override
public BookDevourer copy() {
return new BookDevourer(this);
}
}

View file

@ -55,7 +55,7 @@ class BroodingSaurianControlEffect extends ContinuousEffectImpl {
public BroodingSaurianControlEffect() {
super(Duration.EndOfGame, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
this.staticText = "each player gains control of all nontoken permanents he or she owns";
this.staticText = "each player gains control of all nontoken permanents they own";
}
public BroodingSaurianControlEffect(final BroodingSaurianControlEffect effect) {

View file

@ -0,0 +1,44 @@
package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.discard.DiscardEachPlayerEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.TargetController;
/**
*
* @author TheElk801
*/
public final class BurglarRat extends CardImpl {
public BurglarRat(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}");
this.subtype.add(SubType.RAT);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// When Burglar Rat enters the battlefield, each opponent discards a card.
this.addAbility(new EntersBattlefieldTriggeredAbility(
new DiscardEachPlayerEffect(
new StaticValue(1), false,
TargetController.OPPONENT
)
));
}
public BurglarRat(final BurglarRat card) {
super(card);
}
@Override
public BurglarRat copy() {
return new BurglarRat(this);
}
}

View file

@ -136,7 +136,7 @@ class WhackCondition extends IntCompareCondition {
@Override
protected int getInputValue(Game game, Ability source) {
Object object = game.getState().getValue("whack" + source.getSourceId());
if (object != null && object instanceof Boolean && (Boolean) object) {
if (object instanceof Boolean && (Boolean) object) {
return 1;
}
return 0;
@ -157,7 +157,7 @@ class DoodleCondition extends IntCompareCondition {
@Override
protected int getInputValue(Game game, Ability source) {
Object object = game.getState().getValue("doodle" + source.getSourceId());
if (object != null && object instanceof Boolean && (Boolean) object) {
if (object instanceof Boolean && (Boolean) object) {
return 1;
}
return 0;
@ -178,7 +178,7 @@ class BuzzCondition extends IntCompareCondition {
@Override
protected int getInputValue(Game game, Ability source) {
Object object = game.getState().getValue("buzz" + source.getSourceId());
if (object != null && object instanceof Boolean && (Boolean) object) {
if (object instanceof Boolean && (Boolean) object) {
return 1;
}
return 0;

View file

@ -0,0 +1,72 @@
package mage.cards.c;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author TheElk801
*/
public final class Camaraderie extends CardImpl {
public Camaraderie(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{G}{W}");
// You gain X life and draw X cards, where X is the number of creatures you control. Creatures you control get +1/+1 until end of turn.
this.getSpellAbility().addEffect(new CamaraderieEffect());
}
public Camaraderie(final Camaraderie card) {
super(card);
}
@Override
public Camaraderie copy() {
return new Camaraderie(this);
}
}
class CamaraderieEffect extends OneShotEffect {
public CamaraderieEffect() {
super(Outcome.Benefit);
this.staticText = "You gain X life and draw X cards, "
+ "where X is the number of creatures you control. "
+ "Creatures you control get +1/+1 until end of turn.";
}
public CamaraderieEffect(final CamaraderieEffect effect) {
super(effect);
}
@Override
public CamaraderieEffect copy() {
return new CamaraderieEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getSourceId());
if (player == null) {
return false;
}
int xValue = game.getBattlefield().count(
StaticFilters.FILTER_CONTROLLED_CREATURE,
source.getSourceId(), source.getControllerId(), game
);
player.gainLife(xValue, game, source);
player.drawCards(xValue, game);
game.addEffect(new BoostControlledEffect(1, 1, Duration.EndOfTurn), source);
return true;
}
}

View file

@ -0,0 +1,73 @@
package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
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.game.Game;
/**
*
* @author TheElk801
*/
public final class CentaurPeacemaker extends CardImpl {
public CentaurPeacemaker(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{W}");
this.subtype.add(SubType.CENTAUR);
this.subtype.add(SubType.CLERIC);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// When Centaur Mediator enters the battlefield, each player gains 4 life.
this.addAbility(new EntersBattlefieldTriggeredAbility(
new CentaurMediatorEffect()
));
}
public CentaurPeacemaker(final CentaurPeacemaker card) {
super(card);
}
@Override
public CentaurPeacemaker copy() {
return new CentaurPeacemaker(this);
}
}
class CentaurMediatorEffect extends OneShotEffect {
public CentaurMediatorEffect() {
super(Outcome.GainLife);
staticText = "each player gains 4 life.";
}
public CentaurMediatorEffect(final CentaurMediatorEffect effect) {
super(effect);
}
@Override
public CentaurMediatorEffect copy() {
return new CentaurMediatorEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
game.getState().getPlayersInRange(
source.getControllerId(), game
).stream().map((playerId) -> game.getPlayer(playerId)).filter(
(player) -> (player != null)
).forEachOrdered((player) -> {
player.gainLife(4, game, source);
});
return true;
}
}

View file

@ -81,7 +81,7 @@ class ChainOfSilenceEffect extends OneShotEffect {
Spell spell = game.getStack().getSpell(source.getSourceId());
if (spell != null) {
StackObject newStackObject = spell.createCopyOnStack(game, source, player.getId(), true);
if (newStackObject != null && newStackObject instanceof Spell) {
if (newStackObject instanceof Spell) {
String activateMessage = ((Spell) newStackObject).getActivatedMessage(game);
if (activateMessage.startsWith(" casts ")) {
activateMessage = activateMessage.substring(6);

View file

@ -78,7 +78,7 @@ class ChainOfVaporEffect extends OneShotEffect {
Spell spell = game.getStack().getSpell(source.getSourceId());
if (spell != null) {
StackObject newStackObject = spell.createCopyOnStack(game, source, player.getId(), true);
if (newStackObject != null && newStackObject instanceof Spell) {
if (newStackObject instanceof Spell) {
String activateMessage = ((Spell) newStackObject).getActivatedMessage(game);
if (activateMessage.startsWith(" casts ")) {
activateMessage = activateMessage.substring(6);

View file

@ -80,7 +80,7 @@ class ChainStasisEffect extends OneShotEffect {
Spell spell = game.getStack().getSpell(source.getSourceId());
if (spell != null) {
StackObject newStackObject = spell.createCopyOnStack(game, source, player.getId(), true);
if (newStackObject != null && newStackObject instanceof Spell) {
if (newStackObject instanceof Spell) {
String activateMessage = ((Spell) newStackObject).getActivatedMessage(game);
if (activateMessage.startsWith(" casts ")) {
activateMessage = activateMessage.substring(6);

View file

@ -0,0 +1,36 @@
package mage.cards.c;
import java.util.UUID;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
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;
/**
*
* @author TheElk801
*/
public final class ChanceForGlory extends CardImpl {
public ChanceForGlory(UUID ownerId, CardSetInfo setInfo) {
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 AddExtraTurnControllerEffect(true));
}
public ChanceForGlory(final ChanceForGlory card) {
super(card);
}
@Override
public ChanceForGlory copy() {
return new ChanceForGlory(this);
}
}

View file

@ -0,0 +1,76 @@
package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.DiscardTargetCost;
import mage.abilities.costs.common.ExileFromGraveCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.constants.SubType;
import mage.abilities.keyword.TrampleAbility;
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.filter.StaticFilters;
import mage.target.common.TargetCardInHand;
import mage.target.common.TargetCardInYourGraveyard;
/**
*
* @author TheElk801
*/
public final class CharnelTroll extends CardImpl {
public CharnelTroll(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}{G}");
this.subtype.add(SubType.TROLL);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// Trample
this.addAbility(TrampleAbility.getInstance());
// At the beginning of your upkeep, exile a creature card from your graveyard. If you do, put a +1/+1 counter on Morgue Troll. Otherwise sacrifice it.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
new DoIfCostPaid(
new AddCountersSourceEffect(CounterType.P1P1.createInstance()),
new SacrificeSourceEffect(),
new ExileFromGraveCost(new TargetCardInYourGraveyard(
StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD
)), false
).setText("exile a creature card from your graveyard. "
+ "If you do, put a +1/+1 counter on {this}."
+ " Otherwise sacrifice it."),
TargetController.YOU, false
));
// {B}{G}, Discard a creature card: Put a +1/+1 counter on Morgue Troll.
Ability ability = new SimpleActivatedAbility(
Zone.BATTLEFIELD,
new AddCountersSourceEffect(CounterType.P1P1.createInstance()),
new ManaCostsImpl("{B}{G}")
);
ability.addCost(new DiscardTargetCost(
new TargetCardInHand(StaticFilters.FILTER_CARD_CREATURE_A)
));
this.addAbility(ability);
}
public CharnelTroll(final CharnelTroll card) {
super(card);
}
@Override
public CharnelTroll copy() {
return new CharnelTroll(this);
}
}

View file

@ -1,4 +1,3 @@
package mage.cards.c;
import java.util.UUID;
@ -46,6 +45,7 @@ public final class ChimeOfNight extends CardImpl {
// When Chime of Night is put into a graveyard from the battlefield, destroy target nonblack creature.
ability = new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new DestroyTargetEffect(), false);
ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability);
}
public ChimeOfNight(final ChimeOfNight card) {

View file

@ -98,7 +98,7 @@ class ChorusOfTheConclaveReplacementEffect extends ReplacementEffectImpl {
// save the x value to be available for ETB replacement effect
Object object = game.getState().getValue("spellX" + source.getSourceId());
Map<String, Integer> spellX;
if (object != null && object instanceof Map) {
if (object instanceof Map) {
spellX = (Map<String, Integer>) object;
} else {
spellX = new HashMap<>();

View file

@ -0,0 +1,52 @@
package mage.cards.c;
import java.util.UUID;
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
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.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.target.common.TargetCardInLibrary;
/**
*
* @author TheElk801
*/
public final class CircuitousRoute extends CardImpl {
private static final FilterCard filter
= new FilterCard("basic land cards and/or Gate cards");
static {
filter.add(Predicates.or(
Predicates.and(
new CardTypePredicate(CardType.LAND),
new SupertypePredicate(SuperType.BASIC)
), new SubtypePredicate(SubType.GATE)
));
}
public CircuitousRoute(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{G}");
// Search your library for up to two basic lands and/or Gates and put them onto the battlefield tapped.
this.getSpellAbility().addEffect(new SearchLibraryPutInPlayEffect(
new TargetCardInLibrary(0, 2, filter), true
));
}
public CircuitousRoute(final CircuitousRoute card) {
super(card);
}
@Override
public CircuitousRoute copy() {
return new CircuitousRoute(this);
}
}

View file

@ -0,0 +1,41 @@
package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.effects.keyword.SurveilEffect;
import mage.constants.SubType;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
/**
*
* @author TheElk801
*/
public final class CitywatchSphinx extends CardImpl {
public CitywatchSphinx(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{U}");
this.subtype.add(SubType.SPHINX);
this.power = new MageInt(5);
this.toughness = new MageInt(4);
// Flying
this.addAbility(FlyingAbility.getInstance());
// When Citywatch Sphinx dies, surveil 2.
this.addAbility(new DiesTriggeredAbility(new SurveilEffect(2)));
}
public CitywatchSphinx(final CitywatchSphinx card) {
super(card);
}
@Override
public CitywatchSphinx copy() {
return new CitywatchSphinx(this);
}
}

View file

@ -0,0 +1,40 @@
package mage.cards.c;
import java.util.UUID;
import mage.abilities.effects.common.DestroyAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.ToughnessPredicate;
/**
*
* @author TheElk801
*/
public final class CitywideBust extends CardImpl {
private static final FilterPermanent filter = new FilterCreaturePermanent("creatures with toughness 4 or greater");
static {
filter.add(new ToughnessPredicate(ComparisonType.MORE_THAN, 3));
}
public CitywideBust(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{W}{W}");
// Destroy all creatures with toughness 4 or greater.
this.getSpellAbility().addEffect(new DestroyAllEffect(filter));
}
public CitywideBust(final CitywideBust card) {
super(card);
}
@Override
public CitywideBust copy() {
return new CitywideBust(this);
}
}

View file

@ -0,0 +1,32 @@
package mage.cards.c;
import java.util.UUID;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author TheElk801
*/
public final class CommandTheStorm extends CardImpl {
public CommandTheStorm(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{4}{R}");
// Govern the Storm deals 5 damage to target creature.
this.getSpellAbility().addEffect(new DamageTargetEffect(5));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
public CommandTheStorm(final CommandTheStorm card) {
super(card);
}
@Override
public CommandTheStorm copy() {
return new CommandTheStorm(this);
}
}

View file

@ -0,0 +1,45 @@
package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.constants.SubType;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.game.permanent.token.ElfKnightToken;
/**
*
* @author TheElk801
*/
public final class ConclaveCavalier extends CardImpl {
public ConclaveCavalier(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}{G}{W}{W}");
this.subtype.add(SubType.CENTAUR);
this.subtype.add(SubType.KNIGHT);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// Vigilance
this.addAbility(VigilanceAbility.getInstance());
// When Conclave Cavalier dies, create two green and white 2/2 Elf Knight creature tokens with vigilance.
this.addAbility(new DiesTriggeredAbility(
new CreateTokenEffect(new ElfKnightToken(), 2)
));
}
public ConclaveCavalier(final ConclaveCavalier card) {
super(card);
}
@Override
public ConclaveCavalier copy() {
return new ConclaveCavalier(this);
}
}

View file

@ -0,0 +1,62 @@
package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.filter.StaticFilters;
import mage.game.permanent.token.ElfKnightToken;
/**
*
* @author TheElk801
*/
public final class ConclaveGuildmage extends CardImpl {
public ConclaveGuildmage(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}{W}");
this.subtype.add(SubType.ELF);
this.subtype.add(SubType.CLERIC);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// {G}, {T}: Creatures you control gain trample until end of turn.
Ability ability = new SimpleActivatedAbility(
new GainAbilityControlledEffect(
TrampleAbility.getInstance(),
Duration.EndOfTurn,
StaticFilters.FILTER_CONTROLLED_CREATURES
), new ManaCostsImpl("{G}")
);
ability.addCost(new TapSourceCost());
this.addAbility(ability);
// {5}{W}, {T}: Create a 2/2 green and white Elf Knight creature token with vigilance.
ability = new SimpleActivatedAbility(
new CreateTokenEffect(new ElfKnightToken()),
new ManaCostsImpl("{5}{W}")
);
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}
public ConclaveGuildmage(final ConclaveGuildmage card) {
super(card);
}
@Override
public ConclaveGuildmage copy() {
return new ConclaveGuildmage(this);
}
}

View file

@ -0,0 +1,103 @@
package mage.cards.c;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
import mage.cards.CardSetInfo;
import mage.cards.SplitCard;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SpellAbilityType;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.PowerPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetCardInYourGraveyard;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author TheElk801
*/
public final class ConniveConcoct extends SplitCard {
private static final FilterCreaturePermanent filter
= new FilterCreaturePermanent("creature with power 2 or less");
static {
filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, 3));
}
public ConniveConcoct(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U/B}{U/B}", "{3}{U}{B}", SpellAbilityType.SPLIT);
// Connive
// Gain control of target creature with power 2 or less.
this.getLeftHalfCard().getSpellAbility().addEffect(
new GainControlTargetEffect(Duration.Custom)
);
this.getLeftHalfCard().getSpellAbility().addTarget(
new TargetCreaturePermanent(filter)
);
// Concoct
// Surveil 3, then return a creature card from your graveyard to the battlefield.
this.getRightHalfCard().getSpellAbility().addEffect(new ConcoctEffect());
}
public ConniveConcoct(final ConniveConcoct card) {
super(card);
}
@Override
public ConniveConcoct copy() {
return new ConniveConcoct(this);
}
}
class ConcoctEffect extends OneShotEffect {
private static final FilterCard filter
= new FilterCreatureCard("creature card in your graveyard");
public ConcoctEffect() {
super(Outcome.Benefit);
this.staticText = "Surveil 3, then return a creature card "
+ "from your graveyard to the battlefield.";
}
public ConcoctEffect(final ConcoctEffect effect) {
super(effect);
}
@Override
public ConcoctEffect copy() {
return new ConcoctEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
player.surveil(3, source, game);
Target target = new TargetCardInYourGraveyard(filter);
target.setNotTarget(true);
if (player.choose(outcome, target, source.getSourceId(), game)) {
Effect effect = new ReturnFromGraveyardToBattlefieldTargetEffect();
effect.setTargetPointer(new FixedTarget(target.getFirstTarget(), game));
effect.apply(game, source);
}
return true;
}
}

View file

@ -0,0 +1,90 @@
package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.InstantSorceryExileGraveyardCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.continuous.SetPowerSourceEffect;
import mage.constants.SubType;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author TheElk801
*/
public final class CracklingDrake extends CardImpl {
public CracklingDrake(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}{U}{R}{R}");
this.subtype.add(SubType.DRAKE);
this.power = new MageInt(0);
this.toughness = new MageInt(4);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Crackling Drake's power is equal to the total number of instant and sorcery cards you own in exile and in your graveyard.
this.addAbility(new SimpleStaticAbility(
Zone.ALL,
new SetPowerSourceEffect(
InstantSorceryExileGraveyardCount.instance, Duration.EndOfGame
).setText("{this}'s power is equal to the total number "
+ "of instant and sorcery cards you own "
+ "in exile and in your graveyard.")
));
// When Crackling Drake enters the battlefield, draw a card.
this.addAbility(new EntersBattlefieldTriggeredAbility(
new DrawCardSourceControllerEffect(1)
));
}
public CracklingDrake(final CracklingDrake card) {
super(card);
}
@Override
public CracklingDrake copy() {
return new CracklingDrake(this);
}
}
class CracklingDrakeCount implements DynamicValue {
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Player player = game.getPlayer(sourceAbility.getControllerId());
if (player != null) {
return player.getGraveyard().count(
StaticFilters.FILTER_CARD_INSTANT_OR_SORCERY, game
) + game.getExile().getExileZone(player.getId()).count(
StaticFilters.FILTER_CARD_INSTANT_OR_SORCERY, game
);
}
return 0;
}
@Override
public CracklingDrakeCount copy() {
return new CracklingDrakeCount();
}
@Override
public String getMessage() {
return "";
}
}

View file

@ -0,0 +1,74 @@
package mage.cards.c;
import java.util.UUID;
import mage.abilities.common.ZoneChangeTriggeredAbility;
import mage.abilities.costs.common.ExileSourceFromGraveCost;
import mage.abilities.effects.common.DamagePlayersEffect;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.TargetController;
import mage.constants.Zone;
/**
*
* @author TheElk801
*/
public final class CreepingChill extends CardImpl {
public CreepingChill(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{B}");
// Creeping Chill deals 3 damage to each opponent and you gain 3 life.
this.getSpellAbility().addEffect(
new DamagePlayersEffect(3, TargetController.OPPONENT)
);
this.getSpellAbility().addEffect(
new GainLifeEffect(3).setText("and you gain 3 life")
);
// When Creeping Chill is put into your graveyard from your library, you may exile it. If you do, Creeping Chill deals 3 damage to each opponent and you gain 3 life.
this.addAbility(new CreepingChillAbility());
}
public CreepingChill(final CreepingChill card) {
super(card);
}
@Override
public CreepingChill copy() {
return new CreepingChill(this);
}
}
class CreepingChillAbility extends ZoneChangeTriggeredAbility {
public CreepingChillAbility() {
super(
Zone.LIBRARY, Zone.GRAVEYARD,
new DoIfCostPaid(
new DamagePlayersEffect(3, TargetController.OPPONENT),
new ExileSourceFromGraveCost()
).addEffect(new GainLifeEffect(3)),
"", true
);
}
public CreepingChillAbility(final CreepingChillAbility ability) {
super(ability);
}
@Override
public CreepingChillAbility copy() {
return new CreepingChillAbility(this);
}
@Override
public String getRule() {
return "When {this} is put into your graveyard from your library, "
+ "you may exile it. If you do, {this} deals 3 damage "
+ "to each opponent and you gain 3 life.";
}
}

View file

@ -0,0 +1,123 @@
package mage.cards.d;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.keyword.DeathtouchAbility;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.WatcherScope;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.watchers.Watcher;
import mage.watchers.common.SpellsCastWatcher;
/**
*
* @author TheElk801
*/
public final class DarkbladeAgent extends CardImpl {
public DarkbladeAgent(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{B}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.ASSASSIN);
this.power = new MageInt(2);
this.toughness = new MageInt(3);
// As long as you've surveilled this turn, Darkblade Agent has deathtouch and "Whenever this creature deals combat damage to a player, draw a card."
Ability ability = new SimpleStaticAbility(
Zone.BATTLEFIELD,
new ConditionalContinuousEffect(
new GainAbilitySourceEffect(
DeathtouchAbility.getInstance(),
Duration.WhileOnBattlefield
), DarkbladeAgentCondition.instance,
"As long as you've surveilled this turn, "
+ "{this} has deathtouch"
)
);
ability.addEffect(new ConditionalContinuousEffect(
new GainAbilitySourceEffect(
new DealsCombatDamageToAPlayerTriggeredAbility(
new DrawCardSourceControllerEffect(1), false
), Duration.WhileOnBattlefield
), DarkbladeAgentCondition.instance,
"and \"Whenever this creature deals "
+ "combat damage to a player, draw a card.\""
));
this.addAbility(ability, new SpellsCastWatcher());
}
public DarkbladeAgent(final DarkbladeAgent card) {
super(card);
}
@Override
public DarkbladeAgent copy() {
return new DarkbladeAgent(this);
}
}
enum DarkbladeAgentCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
DarkbladeAgentWatcher watcher
= (DarkbladeAgentWatcher) game.getState().getWatchers().get(
DarkbladeAgentWatcher.class.getSimpleName()
);
return watcher != null
&& watcher.getSurveiledThisTurn(source.getControllerId());
}
}
class DarkbladeAgentWatcher extends Watcher {
private final Set<UUID> surveiledThisTurn = new HashSet();
public DarkbladeAgentWatcher() {
super(DarkbladeAgentWatcher.class.getSimpleName(), WatcherScope.GAME);
}
public DarkbladeAgentWatcher(final DarkbladeAgentWatcher watcher) {
super(watcher);
this.surveiledThisTurn.addAll(watcher.surveiledThisTurn);
}
@Override
public DarkbladeAgentWatcher copy() {
return new DarkbladeAgentWatcher(this);
}
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SURVEILED) {
this.surveiledThisTurn.add(event.getPlayerId());
}
}
@Override
public void reset() {
super.reset();
this.surveiledThisTurn.clear();
}
public boolean getSurveiledThisTurn(UUID playerId) {
return this.surveiledThisTurn.contains(playerId);
}
}

View file

@ -0,0 +1,49 @@
package mage.cards.d;
import java.util.UUID;
import mage.abilities.common.GainLifeControllerTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.game.permanent.token.SoldierLifelinkToken;
/**
*
* @author TheElk801
*/
public final class DawnOfHope extends CardImpl {
public DawnOfHope(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
// Whenever you gain life, you may pay {2}. If you do, draw a card.
this.addAbility(new GainLifeControllerTriggeredAbility(
new DoIfCostPaid(
new DrawCardSourceControllerEffect(1),
new GenericManaCost(2)), false
));
// {3}{W}: Create a 1/1 white Soldier creature token with lifelink.
this.addAbility(new SimpleActivatedAbility(
Zone.BATTLEFIELD,
new CreateTokenEffect(new SoldierLifelinkToken()),
new ManaCostsImpl("{3}{W}")
));
}
public DawnOfHope(final DawnOfHope card) {
super(card);
}
@Override
public DawnOfHope copy() {
return new DawnOfHope(this);
}
}

View file

@ -0,0 +1,37 @@
package mage.cards.d;
import java.util.UUID;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.effects.keyword.SurveilEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author TheElk801
*/
public final class DazzlingLights extends CardImpl {
public DazzlingLights(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}");
// Target creature gets -3/-0 until end of turn.
this.getSpellAbility().addEffect(new BoostTargetEffect(-3, 0, Duration.EndOfTurn));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
// Surveil 2.
this.getSpellAbility().addEffect(new SurveilEffect(2));
}
public DazzlingLights(final DazzlingLights card) {
super(card);
}
@Override
public DazzlingLights copy() {
return new DazzlingLights(this);
}
}

View file

@ -0,0 +1,45 @@
package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
/**
*
* @author TheElk801
*/
public final class DevkarinDissident extends CardImpl {
public DevkarinDissident(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}");
this.subtype.add(SubType.ELF);
this.subtype.add(SubType.WARRIOR);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// {4}{G}: Devkarin Dissident gets +2/+2 until end of turn.
this.addAbility(new SimpleActivatedAbility(
Zone.BATTLEFIELD,
new BoostSourceEffect(2, 2, Duration.EndOfTurn),
new ManaCostsImpl("{4}{G}")
));
}
public DevkarinDissident(final DevkarinDissident card) {
super(card);
}
@Override
public DevkarinDissident copy() {
return new DevkarinDissident(this);
}
}

View file

@ -0,0 +1,82 @@
package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.constants.SubType;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.MenaceAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
* @author TheElk801
*/
public final class DimirSpybug extends CardImpl {
public DimirSpybug(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}{B}");
this.subtype.add(SubType.INSECT);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Menace
this.addAbility(new MenaceAbility());
// Whenever you surveil, put a +1/+1 counter on Dimir Spybug.
this.addAbility(new DimirSpybugTriggeredAbility());
}
public DimirSpybug(final DimirSpybug card) {
super(card);
}
@Override
public DimirSpybug copy() {
return new DimirSpybug(this);
}
}
class DimirSpybugTriggeredAbility extends TriggeredAbilityImpl {
public DimirSpybugTriggeredAbility() {
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(
CounterType.P1P1.createInstance()
), false);
}
public DimirSpybugTriggeredAbility(final DimirSpybugTriggeredAbility ability) {
super(ability);
}
@Override
public DimirSpybugTriggeredAbility copy() {
return new DimirSpybugTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.SURVEIL;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return event.getPlayerId().equals(this.getControllerId());
}
@Override
public String getRule() {
return "Whenever you surveil, put a +1/+1 counter on {this}.";
}
}

View file

@ -0,0 +1,126 @@
package mage.cards.d;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.ReturnToHandFromBattlefieldAllEffect;
import mage.abilities.effects.common.discard.DiscardEachPlayerEffect;
import mage.abilities.effects.keyword.SurveilEffect;
import mage.cards.CardSetInfo;
import mage.cards.SplitCard;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.Outcome;
import mage.constants.SpellAbilityType;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterNonlandPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.filter.predicate.permanent.PermanentIdPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
import mage.target.TargetPermanent;
/**
*
* @author TheElk801
*/
public final class DiscoveryDispersal extends SplitCard {
public DiscoveryDispersal(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, new CardType[]{CardType.INSTANT}, "{1}{U/B}", "{3}{U}{B}", SpellAbilityType.SPLIT);
// Discovery
// Surveil 2, then draw a card.
this.getLeftHalfCard().getSpellAbility().addEffect(
new SurveilEffect(2).setText("Surveil 2,")
);
this.getLeftHalfCard().getSpellAbility().addEffect(
new DrawCardSourceControllerEffect(1
).setText("then draw a card. <i>(To surveil 2, "
+ "look at the top two cards of your library, "
+ "then put any number of them into your graveyard "
+ "and the rest on top of your library "
+ "in any order.)</i>")
);
// Dispersal
// Each opponent returns a nonland permanent they control with the highest converted mana cost among permanents they control to its owners hand, then discards a card.
this.getLeftHalfCard().getSpellAbility().addEffect(new DispersalEffect());
}
public DiscoveryDispersal(final DiscoveryDispersal card) {
super(card);
}
@Override
public DiscoveryDispersal copy() {
return new DiscoveryDispersal(this);
}
}
class DispersalEffect extends OneShotEffect {
public DispersalEffect() {
super(Outcome.Benefit);
this.staticText = "Each opponent returns a nonland permanent "
+ "they control with the highest converted mana cost "
+ "among permanents they control to its owners hand, "
+ "then discards a card.";
}
public DispersalEffect(final DispersalEffect effect) {
super(effect);
}
@Override
public DispersalEffect copy() {
return new DispersalEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Set<PermanentIdPredicate> permsToReturn = new HashSet();
for (UUID opponentId : game.getOpponents(player.getId())) {
Player opponent = game.getPlayer(opponentId);
if (opponent == null) {
continue;
}
int highestCMC = 0;
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(opponentId)) {
if (permanent != null && !permanent.isLand()) {
highestCMC = Math.max(highestCMC, permanent.getConvertedManaCost());
}
}
FilterPermanent filter = new FilterNonlandPermanent("permanent you control with converted mana cost " + highestCMC);
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, highestCMC));
filter.add(new ControllerIdPredicate(opponentId));
Target target = new TargetPermanent(1, 1, filter, true);
if (opponent.choose(outcome, target, source.getSourceId(), game)) {
if (target.getFirstTarget() == null) {
continue;
}
permsToReturn.add(new PermanentIdPredicate(target.getFirstTarget()));
}
}
FilterPermanent filter = new FilterPermanent();
filter.add(Predicates.or(permsToReturn));
new ReturnToHandFromBattlefieldAllEffect(filter).apply(game, source);
new DiscardEachPlayerEffect(
new StaticValue(1), false, TargetController.OPPONENT
).apply(game, source);
return true;
}
}

View file

@ -0,0 +1,80 @@
package mage.cards.d;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.ReturnToHandSourceEffect;
import mage.abilities.effects.common.discard.DiscardEachPlayerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
* @author TheElk801
*/
public final class DisinformationCampaign extends CardImpl {
public DisinformationCampaign(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}{B}");
// When Disinformation Campaign enters the battlefield, you draw a card and each opponent discards a card.
Ability ability = new EntersBattlefieldTriggeredAbility(
new DrawCardSourceControllerEffect(1).setText("you draw a card")
);
ability.addEffect(new DiscardEachPlayerEffect(
new StaticValue(1), false, TargetController.OPPONENT
).setText("and each opponent discards a card"));
this.addAbility(ability);
// Whenever you surveil, return Disinformation Campaign to its owner's hand.
this.addAbility(new DisinformationCampaignTriggeredAbility());
}
public DisinformationCampaign(final DisinformationCampaign card) {
super(card);
}
@Override
public DisinformationCampaign copy() {
return new DisinformationCampaign(this);
}
}
class DisinformationCampaignTriggeredAbility extends TriggeredAbilityImpl {
public DisinformationCampaignTriggeredAbility() {
super(Zone.BATTLEFIELD, new ReturnToHandSourceEffect(true), false);
}
public DisinformationCampaignTriggeredAbility(final DisinformationCampaignTriggeredAbility ability) {
super(ability);
}
@Override
public DisinformationCampaignTriggeredAbility copy() {
return new DisinformationCampaignTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.SURVEILED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return event.getPlayerId().equals(this.getControllerId());
}
@Override
public String getRule() {
return "Whenever you surveil, return {this} to its owner's hand.";
}
}

View file

@ -0,0 +1,85 @@
package mage.cards.d;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.CopyEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentToken;
import mage.game.permanent.token.AngelVigilanceToken;
/**
*
* @author TheElk801
*/
public final class DivineVisitation extends CardImpl {
public DivineVisitation(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}{W}");
// TODO: This implementation is not entirely correct, see https://twitter.com/EliShffrn/status/1042145606582591490
// If one or more creature tokens would be created under your control, that many 4/4 white Angel creature tokens with flying and vigilance are created instead.
this.addAbility(new SimpleStaticAbility(
Zone.BATTLEFIELD, new DivineVisitationEffect()
));
}
public DivineVisitation(final DivineVisitation card) {
super(card);
}
@Override
public DivineVisitation copy() {
return new DivineVisitation(this);
}
}
class DivineVisitationEffect extends ReplacementEffectImpl {
public DivineVisitationEffect() {
super(Duration.WhileOnBattlefield, Outcome.Copy, false);
staticText = "If one or more creature tokens would be created "
+ "under your control, that many 4/4 white Angel creature "
+ "tokens with flying and vigilance are created instead.";
}
public DivineVisitationEffect(DivineVisitationEffect effect) {
super(effect);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent perm = ((EntersTheBattlefieldEvent) event).getTarget();
return perm != null
&& perm.isCreature()
&& perm instanceof PermanentToken
&& perm.isControlledBy(source.getControllerId());
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
game.addEffect(new CopyEffect(Duration.Custom, new AngelVigilanceToken(), event.getTargetId()), source);
return false;
}
@Override
public DivineVisitationEffect copy() {
return new DivineVisitationEffect(this);
}
}

View file

@ -0,0 +1,49 @@
package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.PayLifeCost;
import mage.abilities.effects.keyword.SurveilEffect;
import mage.constants.SubType;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
/**
*
* @author TheElk801
*/
public final class DoomWhisperer extends CardImpl {
public DoomWhisperer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{B}");
this.subtype.add(SubType.NIGHTMARE);
this.subtype.add(SubType.DEMON);
this.power = new MageInt(6);
this.toughness = new MageInt(6);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Trample
this.addAbility(TrampleAbility.getInstance());
// Pay 2 life: Surveil 2.
this.addAbility(new SimpleActivatedAbility(
new SurveilEffect(2), new PayLifeCost(2)
));
}
public DoomWhisperer(final DoomWhisperer card) {
super(card);
}
@Override
public DoomWhisperer copy() {
return new DoomWhisperer(this);
}
}

View file

@ -0,0 +1,32 @@
package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
/**
*
* @author TheElk801
*/
public final class DouserOfLights extends CardImpl {
public DouserOfLights(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}");
this.subtype.add(SubType.HORROR);
this.power = new MageInt(4);
this.toughness = new MageInt(5);
}
public DouserOfLights(final DouserOfLights card) {
super(card);
}
@Override
public DouserOfLights copy() {
return new DouserOfLights(this);
}
}

View file

@ -0,0 +1,46 @@
package mage.cards.d;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.target.TargetPlayer;
/**
*
* @author TheElk801
*/
public final class DrownedSecrets extends CardImpl {
private static final FilterSpell filter = new FilterSpell("a blue spell");
static {
filter.add(new ColorPredicate(ObjectColor.BLUE));
}
public DrownedSecrets(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
// Whenever you cast a blue spell, target player puts the top two cards if their library into their graveyard.
Ability ability = new SpellCastControllerTriggeredAbility(
new PutLibraryIntoGraveTargetEffect(2), filter, false
);
ability.addTarget(new TargetPlayer());
this.addAbility(ability);
}
public DrownedSecrets(final DrownedSecrets card) {
super(card);
}
@Override
public DrownedSecrets copy() {
return new DrownedSecrets(this);
}
}

View file

@ -0,0 +1,46 @@
package mage.cards.e;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.common.DamagePlayersEffect;
import mage.constants.SubType;
import mage.abilities.keyword.DefenderAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.TargetController;
import mage.filter.StaticFilters;
/**
*
* @author TheElk801
*/
public final class ElectrostaticField extends CardImpl {
public ElectrostaticField(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.subtype.add(SubType.WALL);
this.power = new MageInt(0);
this.toughness = new MageInt(4);
// Defender
this.addAbility(DefenderAbility.getInstance());
// When you cast an instant or sorcery spell, Electrostatic Field deals 1 damage to each opponent.
this.addAbility(new SpellCastControllerTriggeredAbility(
new DamagePlayersEffect(1, TargetController.OPPONENT),
StaticFilters.FILTER_SPELL_AN_INSTANT_OR_SORCERY, false
));
}
public ElectrostaticField(final ElectrostaticField card) {
super(card);
}
@Override
public ElectrostaticField copy() {
return new ElectrostaticField(this);
}
}

View file

@ -70,7 +70,7 @@ class EngineeredExplosivesEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
MageObject engineeredExplosives = game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if(engineeredExplosives != null && engineeredExplosives instanceof Permanent){
if(engineeredExplosives instanceof Permanent){
int count = ((Permanent)engineeredExplosives).getCounters(game).getCount(CounterType.CHARGE);
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
if(permanent.getConvertedManaCost() == count){

View file

@ -0,0 +1,113 @@
package mage.cards.e;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.ExileSourceCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.ReplacementEffectImpl;
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.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
/**
*
* @author TheElk801
*/
public final class EnhancedSurveillance extends CardImpl {
public EnhancedSurveillance(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
// You may look at an additional two cards each time you surveil.
this.addAbility(new SimpleStaticAbility(
Zone.BATTLEFIELD, new EnhancedSurveillanceReplacementEffect()
));
// Exile Enhanced Surveillance: Shuffle your graveyard into your library.
this.addAbility(new SimpleActivatedAbility(
new EnhancedSurveillanceShuffleEffect(), new ExileSourceCost()
));
}
public EnhancedSurveillance(final EnhancedSurveillance card) {
super(card);
}
@Override
public EnhancedSurveillance copy() {
return new EnhancedSurveillance(this);
}
}
class EnhancedSurveillanceReplacementEffect extends ReplacementEffectImpl {
public EnhancedSurveillanceReplacementEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "You may look at an additional "
+ "two cards each time you surveil.";
}
public EnhancedSurveillanceReplacementEffect(final EnhancedSurveillanceReplacementEffect effect) {
super(effect);
}
@Override
public EnhancedSurveillanceReplacementEffect copy() {
return new EnhancedSurveillanceReplacementEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.SURVEIL;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
event.setAmount(event.getAmount() + 2);
return false;
}
}
class EnhancedSurveillanceShuffleEffect extends OneShotEffect {
public EnhancedSurveillanceShuffleEffect() {
super(Outcome.Neutral);
this.staticText = "Shuffle your graveyard into your library";
}
public EnhancedSurveillanceShuffleEffect(final EnhancedSurveillanceShuffleEffect effect) {
super(effect);
}
@Override
public EnhancedSurveillanceShuffleEffect copy() {
return new EnhancedSurveillanceShuffleEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
for (Card card : controller.getGraveyard().getCards(game)) {
controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD, true, true);
}
controller.shuffleLibrary(source, game);
return true;
}
return false;
}
}

View file

@ -0,0 +1,89 @@
package mage.cards.e;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.constants.SubType;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.stack.Spell;
/**
*
* @author TheElk801
*/
public final class ErraticCyclops extends CardImpl {
public ErraticCyclops(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}");
this.subtype.add(SubType.CYCLOPS);
this.subtype.add(SubType.SHAMAN);
this.power = new MageInt(0);
this.toughness = new MageInt(8);
// Trample
this.addAbility(TrampleAbility.getInstance());
// Whenever you cast an instant or sorcery spell, Erratic Cyclops gets +X/+0 until end of turn, where X is that spell's converted mana cost.
this.addAbility(new ErraticCyclopsTriggeredAbility());
}
public ErraticCyclops(final ErraticCyclops card) {
super(card);
}
@Override
public ErraticCyclops copy() {
return new ErraticCyclops(this);
}
}
class ErraticCyclopsTriggeredAbility extends TriggeredAbilityImpl {
public ErraticCyclopsTriggeredAbility() {
super(Zone.BATTLEFIELD, null, false);
}
public ErraticCyclopsTriggeredAbility(final ErraticCyclopsTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && spell.isControlledBy(controllerId)
&& spell.isInstantOrSorcery()) {
this.getEffects().clear();
this.addEffect(new BoostSourceEffect(
spell.getConvertedManaCost(), 0, Duration.EndOfTurn
));
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever you cast an instant or sorcery spell, "
+ "{this} gets +X/+X until end of turn, "
+ "where X is that spell's converted mana cost";
}
@Override
public ErraticCyclopsTriggeredAbility copy() {
return new ErraticCyclopsTriggeredAbility(this);
}
}

View file

@ -0,0 +1,58 @@
package mage.cards.e;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.common.DiscardTargetCost;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.target.common.TargetCardInHand;
/**
*
* @author TheElk801
*/
public final class ErstwhileTrooper extends CardImpl {
public ErstwhileTrooper(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}{G}");
this.subtype.add(SubType.ZOMBIE);
this.subtype.add(SubType.SOLDIER);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Discard a creature card: Erstwhile Trooper gets +2/+2 and gains trample until end of turn. Activate this ability only once each turn.
Ability ability = new LimitedTimesPerTurnActivatedAbility(
Zone.BATTLEFIELD,
new BoostSourceEffect(
2, 2, Duration.EndOfTurn
).setText("{this} gets +2/+2"),
new DiscardTargetCost(new TargetCardInHand(
StaticFilters.FILTER_CARD_CREATURE_A
))
);
ability.addEffect(new GainAbilitySourceEffect(
TrampleAbility.getInstance(), Duration.EndOfTurn
).setText("and gains trample until end of turn"));
this.addAbility(ability);
}
public ErstwhileTrooper(final ErstwhileTrooper card) {
super(card);
}
@Override
public ErstwhileTrooper copy() {
return new ErstwhileTrooper(this);
}
}

View file

@ -77,7 +77,7 @@ class EssenceFluxEffect extends OneShotEffect {
cardsToBattlefield.add(targetId);
} else {
Card card = game.getCard(targetId);
if (card != null && card instanceof MeldCard) {
if (card instanceof MeldCard) {
MeldCard meldCard = (MeldCard) card;
Card topCard = meldCard.getTopHalfCard();
Card bottomCard = meldCard.getBottomHalfCard();

View file

@ -0,0 +1,151 @@
package mage.cards.e;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ShuffleIntoLibrarySourceEffect;
import mage.abilities.keyword.CantBeBlockedSourceAbility;
import mage.cards.Card;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.filter.predicate.permanent.CounterPredicate;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author TheElk801
*/
public final class EtrataTheSilencer extends CardImpl {
public EtrataTheSilencer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{B}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.VAMPIRE);
this.subtype.add(SubType.ASSASSIN);
this.power = new MageInt(3);
this.toughness = new MageInt(5);
// Etrata, the Silencer can't be blocked.
this.addAbility(new CantBeBlockedSourceAbility());
// Whenever Etrata deals combat damage to a player, exile target creature that player controls and put a hit counter on that card. That player loses the game if they own three or more exiled card with hit counters on them. Etrata's owner shuffles Etrata into their library.
this.addAbility(new EtrataTheSilencerTriggeredAbility());
}
public EtrataTheSilencer(final EtrataTheSilencer card) {
super(card);
}
@Override
public EtrataTheSilencer copy() {
return new EtrataTheSilencer(this);
}
}
class EtrataTheSilencerTriggeredAbility extends TriggeredAbilityImpl {
public EtrataTheSilencerTriggeredAbility() {
super(Zone.BATTLEFIELD, new EtrataTheSilencerEffect());
}
public EtrataTheSilencerTriggeredAbility(final EtrataTheSilencerTriggeredAbility ability) {
super(ability);
}
@Override
public EtrataTheSilencerTriggeredAbility copy() {
return new EtrataTheSilencerTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) {
Player opponent = game.getPlayer(event.getPlayerId());
if (opponent != null) {
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature " + opponent.getLogName() + " controls");
filter.add(new ControllerIdPredicate(opponent.getId()));
this.getTargets().clear();
this.addTarget(new TargetCreaturePermanent(filter));
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever {this} deals combat damage to a player, "
+ "exile target creature that player controls "
+ "and put a hit counter on that card. "
+ "That player loses the game if they own three or more "
+ "exiled cards with hit counters on them. "
+ "{this}'s owner shuffles {this} into their library.";
}
}
class EtrataTheSilencerEffect extends OneShotEffect {
private static final FilterCard filter = new FilterCard();
static {
filter.add(new CounterPredicate(CounterType.HIT));
}
public EtrataTheSilencerEffect() {
super(Outcome.Benefit);
}
public EtrataTheSilencerEffect(final EtrataTheSilencerEffect effect) {
super(effect);
}
@Override
public EtrataTheSilencerEffect copy() {
return new EtrataTheSilencerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent creature = game.getPermanent(source.getFirstTarget());
if (creature == null) {
return false;
}
Player controller = game.getPlayer(source.getControllerId());
Player player = game.getPlayer(creature.getControllerId());
if (controller == null || player == null) {
return false;
}
controller.moveCards(creature, Zone.EXILED, source, game);
Card card = game.getCard(source.getFirstTarget());
if (card != null) {
card.addCounters(CounterType.HIT.createInstance(), source, game);
}
if (game.getExile().getExileZone(player.getId()).count(filter, game) > 2) {
player.lost(game);
}
return new ShuffleIntoLibrarySourceEffect().apply(game, source);
}
}

View file

@ -71,6 +71,7 @@ class ExplosiveRevelationEffect extends OneShotEffect {
toReveal.add(card);
if (!card.isLand()) {
nonLandCard = card;
break;
}
}
// reveal cards

View file

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

View file

@ -45,7 +45,7 @@ class FeldonsCaneEffect extends OneShotEffect {
FeldonsCaneEffect() {
super(Outcome.Neutral);
this.staticText = "Shuffles your graveyard into your library";
this.staticText = "Shuffle your graveyard into your library";
}
FeldonsCaneEffect(final FeldonsCaneEffect effect) {

View file

@ -0,0 +1,46 @@
package mage.cards.f;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.constants.SubType;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.filter.StaticFilters;
/**
*
* @author TheElk801
*/
public final class FireUrchin extends CardImpl {
public FireUrchin(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.subtype.add(SubType.ELEMENTAL);
this.power = new MageInt(1);
this.toughness = new MageInt(3);
// Trample
this.addAbility(TrampleAbility.getInstance());
// Whenever you cast an instant or sorcery spell, Fire Urchin gets +1/+0 until end of turn.
this.addAbility(new SpellCastControllerTriggeredAbility(
new BoostSourceEffect(1, 0, Duration.EndOfTurn),
StaticFilters.FILTER_SPELL_AN_INSTANT_OR_SORCERY, false
));
}
public FireUrchin(final FireUrchin card) {
super(card);
}
@Override
public FireUrchin copy() {
return new FireUrchin(this);
}
}

View file

@ -87,7 +87,7 @@ class FiresongAndSunspeakerTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
MageObject object = game.getObject(event.getSourceId());
if (object != null && object instanceof Spell) {
if (object instanceof Spell) {
if (event.getTargetId().equals(this.getControllerId())
&& object.getColor(game).contains(ObjectColor.WHITE)
&& (object.isInstant()

View file

@ -0,0 +1,41 @@
package mage.cards.f;
import java.util.UUID;
import mage.MageInt;
import mage.constants.SubType;
import mage.abilities.keyword.ConvokeAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
/**
*
* @author TheElk801
*/
public final class FlightOfEquenauts extends CardImpl {
public FlightOfEquenauts(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{7}{W}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.KNIGHT);
this.power = new MageInt(4);
this.toughness = new MageInt(5);
// Convoke
this.addAbility(new ConvokeAbility());
// Flying
this.addAbility(FlyingAbility.getInstance());
}
public FlightOfEquenauts(final FlightOfEquenauts card) {
super(card);
}
@Override
public FlightOfEquenauts copy() {
return new FlightOfEquenauts(this);
}
}

View file

@ -0,0 +1,62 @@
package mage.cards.f;
import java.util.UUID;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
import mage.cards.CardSetInfo;
import mage.cards.SplitCard;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SpellAbilityType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.target.common.TargetCardInLibrary;
/**
*
* @author TheElk801
*/
public final class FlowerFlourish extends SplitCard {
private static final FilterCard filter
= new FilterCard("basic Forest or Plains card");
static {
filter.add(new SupertypePredicate(SuperType.BASIC));
filter.add(Predicates.or(
new SubtypePredicate(SubType.FOREST),
new SubtypePredicate(SubType.PLAINS)
));
}
public FlowerFlourish(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G/W}", "{4}{G}{W}", SpellAbilityType.SPLIT);
// Flower
// Search your library for a basic Forest or Plains card, reveal it, put it into your hand, then shuffle your library.
this.getLeftHalfCard().getSpellAbility().addEffect(
new SearchLibraryPutInHandEffect(
new TargetCardInLibrary(filter), true, true
)
);
// Flourish
// Creatures you control get +2/+2 until end of turn.
this.getRightHalfCard().getSpellAbility().addEffect(
new BoostControlledEffect(2, 2, Duration.EndOfTurn)
);
}
public FlowerFlourish(final FlowerFlourish card) {
super(card);
}
@Override
public FlowerFlourish copy() {
return new FlowerFlourish(this);
}
}

View file

@ -151,7 +151,7 @@ class ForbiddenCryptPutIntoYourGraveyardReplacementEffect extends ReplacementEff
Card card = game.getCard(event.getTargetId());
if (card != null && card.isOwnedBy(source.getControllerId())) {
Permanent permanent = ((ZoneChangeEvent) event).getTarget();
if (permanent == null || !(permanent instanceof PermanentToken)) {
if (!(permanent instanceof PermanentToken)) {
return true;
}
}

View file

@ -73,7 +73,7 @@ class ForsakenWastesTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
MageObject eventSourceObject = game.getObject(event.getSourceId());
if (eventSourceObject != null && event.getTargetId().equals(this.getSourceId())&& eventSourceObject instanceof Spell ) {
if (event.getTargetId().equals(this.getSourceId()) && eventSourceObject instanceof Spell) {
getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId()));
return true;
}

View file

@ -150,7 +150,7 @@ class GoToJailUpkeepEffect extends OneShotEffect {
Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game);
if (sourceObject != null && sourceObject instanceof Permanent && permanent != null) {
if (sourceObject instanceof Permanent && permanent != null) {
UUID opponentId = (UUID) game.getState().getValue(sourceObject.getId().toString() + ChooseOpponentEffect.VALUE_KEY);
Player opponent = game.getPlayer(opponentId);

View file

@ -0,0 +1,61 @@
package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.keyword.DoubleStrikeAbility;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
* @author TheElk801
*/
public final class GarrisonSergeant extends CardImpl {
private static final FilterPermanent filter = new FilterControlledPermanent();
static {
filter.add(new SubtypePredicate(SubType.GATE));
}
public GarrisonSergeant(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}{W}");
this.subtype.add(SubType.VIASHINO);
this.subtype.add(SubType.SOLDIER);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Garrison Sergeant has double strike as long as you control a Gate.
this.addAbility(new SimpleStaticAbility(
Zone.BATTLEFIELD,
new ConditionalContinuousEffect(
new GainAbilitySourceEffect(
DoubleStrikeAbility.getInstance(),
Duration.WhileOnBattlefield
), new PermanentsOnTheBattlefieldCondition(filter),
"{this} has double strike as long as you control a Gate."
)
));
}
public GarrisonSergeant(final GarrisonSergeant card) {
super(card);
}
@Override
public GarrisonSergeant copy() {
return new GarrisonSergeant(this);
}
}

View file

@ -0,0 +1,57 @@
package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.constants.SubType;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
* @author TheElk801
*/
public final class GatekeeperGargoyle extends CardImpl {
private static final FilterPermanent filter = new FilterControlledPermanent();
static {
filter.add(new SubtypePredicate(SubType.GATE));
}
public GatekeeperGargoyle(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{6}");
this.subtype.add(SubType.GARGOYLE);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Gargoyle Guardian enters the battlefield with a +1/+1 counter on it for each Gate you control.
this.addAbility(new EntersBattlefieldAbility(
new AddCountersSourceEffect(
CounterType.P1P1.createInstance(),
new PermanentsOnBattlefieldCount(filter), true
), "with a +1/+1 counter on it for each Gate you control"
));
}
public GatekeeperGargoyle(final GatekeeperGargoyle card) {
super(card);
}
@Override
public GatekeeperGargoyle copy() {
return new GatekeeperGargoyle(this);
}
}

View file

@ -0,0 +1,39 @@
package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
/**
*
* @author TheElk801
*/
public final class GenerousStray extends CardImpl {
public GenerousStray(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}");
this.subtype.add(SubType.CAT);
this.power = new MageInt(1);
this.toughness = new MageInt(2);
// When Generous Stray enters the battlefield, draw a card.
this.addAbility(new EntersBattlefieldTriggeredAbility(
new DrawCardSourceControllerEffect(1)
));
}
public GenerousStray(final GenerousStray card) {
super(card);
}
@Override
public GenerousStray copy() {
return new GenerousStray(this);
}
}

View file

@ -71,7 +71,7 @@ class GenesisHydraPutOntoBattlefieldEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Object obj = getValue(CastSourceTriggeredAbility.SOURCE_CAST_SPELL_ABILITY);
if (controller != null && obj != null && obj instanceof SpellAbility) {
if (controller != null && obj instanceof SpellAbility) {
int count = ((SpellAbility) obj).getManaCostsToPay().getX();
if (count > 0) {
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, count));

View file

@ -1,4 +1,3 @@
package mage.cards.g;
import java.util.UUID;
@ -16,13 +15,15 @@ import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.SuperType;
import mage.constants.TargetAdjustment;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.other.OwnerPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInOpponentsGraveyard;
import mage.target.common.TargetCardInGraveyard;
/**
* @author nantuko
@ -32,6 +33,7 @@ public final class GethLordOfTheVault extends CardImpl {
private static final FilterCard filter = new FilterCard("artifact or creature card with converted mana cost X from an opponent's graveyard");
static {
filter.add(new OwnerPredicate(TargetController.OPPONENT));
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.CREATURE)));
@ -51,7 +53,7 @@ public final class GethLordOfTheVault extends CardImpl {
// Then that player puts the top X cards of their library into their graveyard.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GethLordOfTheVaultEffect(), new ManaCostsImpl("{X}{B}"));
ability.setTargetAdjustment(TargetAdjustment.X_CMC_EQUAL_GY_CARD);
ability.addTarget(new TargetCardInOpponentsGraveyard(filter));
ability.addTarget(new TargetCardInGraveyard(filter));
this.addAbility(ability);
}

View file

@ -1,4 +1,3 @@
package mage.cards.g;
import java.util.UUID;
@ -10,7 +9,7 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.filter.StaticFilters;
/**
*
@ -27,7 +26,7 @@ public final class Ghoultree extends CardImpl {
this.toughness = new MageInt(10);
// Ghoultree costs {1} less to cast for each creature card in your graveyard.
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SourceCostReductionForEachCardInGraveyardEffect(new FilterCreatureCard())));
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SourceCostReductionForEachCardInGraveyardEffect(StaticFilters.FILTER_CARD_CREATURE)));
}
public Ghoultree(final Ghoultree card) {

View file

@ -0,0 +1,35 @@
package mage.cards.g;
import java.util.UUID;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.counters.CounterType;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author TheElk801
*/
public final class GirdForBattle extends CardImpl {
public GirdForBattle(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{W}");
// Put a +1/+1 counter on each of up to two target creatures.
this.getSpellAbility().addEffect(new AddCountersTargetEffect(
CounterType.P1P1.createInstance()
).setText("Put a +1/+1 counter on each of up to two target creatures"));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 2));
}
public GirdForBattle(final GirdForBattle card) {
super(card);
}
@Override
public GirdForBattle copy() {
return new GirdForBattle(this);
}
}

View file

@ -0,0 +1,68 @@
package mage.cards.g;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.keyword.EquipAbility;
import mage.abilities.keyword.MenaceAbility;
import mage.abilities.keyword.VigilanceAbility;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
* @author TheElk801
*/
public final class GlaiveOfTheGuildpact extends CardImpl {
private static final FilterPermanent filter
= new FilterControlledPermanent("Gate you control");
static {
filter.add(new SubtypePredicate(SubType.GATE));
}
public GlaiveOfTheGuildpact(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
this.subtype.add(SubType.EQUIPMENT);
// Equipped creature gets +1/+0 for each Gate you control and has vigilance and menace.
Ability ability = new SimpleStaticAbility(
Zone.BATTLEFIELD,
new BoostEquippedEffect(
new PermanentsOnBattlefieldCount(filter),
new StaticValue(0)
)
);
ability.addEffect(new GainAbilityAttachedEffect(
VigilanceAbility.getInstance(), AttachmentType.EQUIPMENT
).setText("and has vigilance"));
ability.addEffect(new GainAbilityAttachedEffect(
new MenaceAbility(), AttachmentType.EQUIPMENT
).setText("and menace"));
// Equip {3}
this.addAbility(new EquipAbility(3));
}
public GlaiveOfTheGuildpact(final GlaiveOfTheGuildpact card) {
super(card);
}
@Override
public GlaiveOfTheGuildpact copy() {
return new GlaiveOfTheGuildpact(this);
}
}

View file

@ -0,0 +1,88 @@
package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.PutOnLibraryTargetEffect;
import mage.abilities.effects.common.PutTopCardOfLibraryIntoGraveControllerEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.common.FilterLandCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetCardInYourGraveyard;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author TheElk801
*/
public final class GlowsporeShaman extends CardImpl {
public GlowsporeShaman(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}{G}");
this.subtype.add(SubType.ELF);
this.subtype.add(SubType.SHAMAN);
this.power = new MageInt(3);
this.toughness = new MageInt(1);
// When Glowspore Shaman enters the battlefield, put the top three cards of your library into your graveyard. You may put a land card from your graveyard on top of your library.
this.addAbility(new EntersBattlefieldTriggeredAbility(
new PutTopCardOfLibraryIntoGraveControllerEffect(3), false
));
}
public GlowsporeShaman(final GlowsporeShaman card) {
super(card);
}
@Override
public GlowsporeShaman copy() {
return new GlowsporeShaman(this);
}
}
class GlowsporeShamanEffect extends OneShotEffect {
public static final FilterLandCard filter
= new FilterLandCard("a land card from your graveyard");
public GlowsporeShamanEffect() {
super(Outcome.Benefit);
this.staticText = "You may put a land card from your graveyard "
+ "on top of your library.";
}
public GlowsporeShamanEffect(final GlowsporeShamanEffect effect) {
super(effect);
}
@Override
public GlowsporeShamanEffect copy() {
return new GlowsporeShamanEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Target target = new TargetCardInYourGraveyard(0, 1, filter, true);
if (player.chooseUse(outcome, "Put a land card on top of your library?", source, game)
&& player.choose(outcome, target, source.getSourceId(), game)) {
Effect effect = new PutOnLibraryTargetEffect(true);
effect.setTargetPointer(new FixedTarget(target.getFirstTarget(), game));
effect.apply(game, source);
}
return true;
}
}

View file

@ -0,0 +1,49 @@
package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.constants.SubType;
import mage.abilities.keyword.MentorAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
/**
*
* @author TheElk801
*/
public final class GoblinBanneret extends CardImpl {
public GoblinBanneret(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}");
this.subtype.add(SubType.GOBLIN);
this.subtype.add(SubType.SOLDIER);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Mentor
this.addAbility(new MentorAbility());
// {1}{R}: Goblin Banneret gets +2/+0 until end of turn.
this.addAbility(new SimpleActivatedAbility(
Zone.BATTLEFIELD,
new BoostSourceEffect(2, 0, Duration.EndOfTurn),
new ManaCostsImpl("{1}{R}")
));
}
public GoblinBanneret(final GoblinBanneret card) {
super(card);
}
@Override
public GoblinBanneret copy() {
return new GoblinBanneret(this);
}
}

View file

@ -0,0 +1,51 @@
package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.effects.common.combat.CantBlockAllEffect;
import mage.abilities.keyword.DefenderAbility;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
/**
*
* @author TheElk801
*/
public final class GoblinLocksmith extends CardImpl {
private static final FilterCreaturePermanent filter
= new FilterCreaturePermanent("creatures with defender");
static {
filter.add(new AbilityPredicate(DefenderAbility.class));
}
public GoblinLocksmith(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.subtype.add(SubType.GOBLIN);
this.subtype.add(SubType.ROGUE);
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// Whenever Goblin Locksmith attacks, creatures with defender can't block this turn.
this.addAbility(new AttacksTriggeredAbility(
new CantBlockAllEffect(filter, Duration.EndOfTurn), false
));
}
public GoblinLocksmith(final GoblinLocksmith card) {
super(card);
}
@Override
public GoblinLocksmith copy() {
return new GoblinLocksmith(this);
}
}

View file

@ -0,0 +1,49 @@
package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterCard;
import mage.filter.common.FilterPermanentCard;
import mage.target.common.TargetCardInYourGraveyard;
/**
*
* @author TheElk801
*/
public final class GolgariFindbroker extends CardImpl {
private static final FilterCard filter
= new FilterPermanentCard("permanent card from your graveyard");
public GolgariFindbroker(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}{B}{G}{G}");
this.subtype.add(SubType.ELF);
this.subtype.add(SubType.SHAMAN);
this.power = new MageInt(3);
this.toughness = new MageInt(4);
// When Golgari Findbroker enters the battlefield, return target permanent card from your graveyard to your hand.
Ability ability = new EntersBattlefieldTriggeredAbility(
new ReturnFromGraveyardToHandTargetEffect(), false
);
ability.addTarget(new TargetCardInYourGraveyard(filter));
this.addAbility(ability);
}
public GolgariFindbroker(final GolgariFindbroker card) {
super(card);
}
@Override
public GolgariFindbroker copy() {
return new GolgariFindbroker(this);
}
}

View file

@ -0,0 +1,57 @@
package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.constants.SubType;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AbilityWord;
import mage.constants.CardType;
import mage.counters.CounterType;
import mage.filter.StaticFilters;
/**
*
* @author TheElk801
*/
public final class GolgariRaiders extends CardImpl {
public GolgariRaiders(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}");
this.subtype.add(SubType.ELF);
this.subtype.add(SubType.WARRIOR);
this.power = new MageInt(0);
this.toughness = new MageInt(0);
// Haste
this.addAbility(HasteAbility.getInstance());
// Undergrowth Golgari Raiders enters the battlefield with a +1/+1 counter on it for each creature card in your graveyard.
Ability ability = new EntersBattlefieldAbility(
new AddCountersSourceEffect(
CounterType.P1P1.createInstance(0),
new CardsInControllerGraveyardCount(
StaticFilters.FILTER_CARD_CREATURE
), true
), "with a +1/+1 counter on it "
+ "for each creature card in your graveyard"
);
ability.setAbilityWord(AbilityWord.UNDERGROWTH);
this.addAbility(ability);
}
public GolgariRaiders(final GolgariRaiders card) {
super(card);
}
@Override
public GolgariRaiders copy() {
return new GolgariRaiders(this);
}
}

View file

@ -0,0 +1,55 @@
package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.constants.SubType;
import mage.abilities.keyword.DefenderAbility;
import mage.abilities.keyword.IndestructibleAbility;
import mage.abilities.keyword.ReachAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
/**
*
* @author TheElk801
*/
public final class GrapplingSundew extends CardImpl {
public GrapplingSundew(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}");
this.subtype.add(SubType.PLANT);
this.power = new MageInt(0);
this.toughness = new MageInt(4);
// Defender
this.addAbility(DefenderAbility.getInstance());
// Reach
this.addAbility(ReachAbility.getInstance());
// {4}{G}: Grappling Sundew gains indestructible until end of turn.
this.addAbility(new SimpleActivatedAbility(
Zone.BATTLEFIELD,
new GainAbilitySourceEffect(
IndestructibleAbility.getInstance(),
Duration.EndOfTurn
), new ManaCostsImpl("{4}{G}")
));
}
public GrapplingSundew(final GrapplingSundew card) {
super(card);
}
@Override
public GrapplingSundew copy() {
return new GrapplingSundew(this);
}
}

View file

@ -0,0 +1,109 @@
package mage.cards.g;
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.ComparisonType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetCardInYourGraveyard;
/**
*
* @author TheElk801
*/
public final class GruesomeMenagerie extends CardImpl {
public GruesomeMenagerie(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{B}{B}");
// Choose a creature card with converted mana cost 1 in your graveyard, then do the same for creature cards with converted mana costs 2 and 3. Return those cards to the battlefield.
this.getSpellAbility().addEffect(new GruesomeMenagerieEffect());
}
public GruesomeMenagerie(final GruesomeMenagerie card) {
super(card);
}
@Override
public GruesomeMenagerie copy() {
return new GruesomeMenagerie(this);
}
}
class GruesomeMenagerieEffect extends OneShotEffect {
private static final FilterCard filter1
= new FilterCreatureCard("creature card with converted mana cost 1");
private static final FilterCard filter2
= new FilterCreatureCard("creature card with converted mana cost 2");
private static final FilterCard filter3
= new FilterCreatureCard("creature card with converted mana cost 3");
static {
filter1.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, 1));
filter2.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, 2));
filter3.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, 3));
}
public GruesomeMenagerieEffect() {
super(Outcome.Benefit);
this.staticText = "Choose a creature card with converted mana cost 1 "
+ "in your graveyard, then do the same for creature cards "
+ "with converted mana costs 2 and 3. "
+ "Return those cards to the battlefield.";
}
public GruesomeMenagerieEffect(final GruesomeMenagerieEffect effect) {
super(effect);
}
@Override
public GruesomeMenagerieEffect copy() {
return new GruesomeMenagerieEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Cards cards = new CardsImpl();
Target target;
target = new TargetCardInYourGraveyard(filter1);
if (player.choose(outcome, target, source.getSourceId(), game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
cards.add(card);
}
}
target = new TargetCardInYourGraveyard(filter2);
if (player.choose(outcome, target, source.getSourceId(), game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
cards.add(card);
}
}
target = new TargetCardInYourGraveyard(filter3);
if (player.choose(outcome, target, source.getSourceId(), game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
cards.add(card);
}
}
return player.moveCards(cards, Zone.BATTLEFIELD, source, game);
}
}

View file

@ -0,0 +1,75 @@
package mage.cards.h;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.token.SoldierLifelinkToken;
/**
*
* @author TheElk801
*/
public final class HaazdaMarshal extends CardImpl {
public HaazdaMarshal(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.SOLDIER);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Whenever Haazda Marshal and at least two other creatures attack, create a 1/1 white Solider creature token with lifelink.
this.addAbility(new HaazdaMarshalTriggeredAbility());
}
public HaazdaMarshal(final HaazdaMarshal card) {
super(card);
}
@Override
public HaazdaMarshal copy() {
return new HaazdaMarshal(this);
}
}
class HaazdaMarshalTriggeredAbility extends TriggeredAbilityImpl {
public HaazdaMarshalTriggeredAbility() {
super(Zone.BATTLEFIELD, new CreateTokenEffect(new SoldierLifelinkToken()));
}
public HaazdaMarshalTriggeredAbility(final HaazdaMarshalTriggeredAbility ability) {
super(ability);
}
@Override
public HaazdaMarshalTriggeredAbility copy() {
return new HaazdaMarshalTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return game.getCombat().getAttackers().size() >= 3
&& game.getCombat().getAttackers().contains(this.sourceId);
}
@Override
public String getRule() {
return "Whenever {this} and at least two other creatures attack, "
+ "create a 1/1 white Solider creature token with lifelink.";
}
}

View file

@ -0,0 +1,121 @@
package mage.cards.h;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CastSourceTriggeredAbility;
import mage.constants.SubType;
import mage.abilities.keyword.ReachAbility;
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.ComparisonType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.StaticFilters;
import mage.filter.common.FilterPermanentCard;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetCardInLibrary;
/**
*
* @author TheElk801
*/
public final class HatcherySpider extends CardImpl {
public HatcherySpider(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{G}{G}");
this.subtype.add(SubType.SPIDER);
this.power = new MageInt(5);
this.toughness = new MageInt(7);
// Reach
this.addAbility(ReachAbility.getInstance());
// Undergrowth When you cast this spell, reveal the top X cards of your library, where X is the number of creature cards in your graveyard. You may put a green permanent card with converted mana cost X or less from among them onto the battlefield. Put the rest on the bottom of your library in a random order.
this.addAbility(new CastSourceTriggeredAbility(
new HatcherySpiderEffect(), false,
"<i>Undergrowth</i> &mdash; "
));
}
public HatcherySpider(final HatcherySpider card) {
super(card);
}
@Override
public HatcherySpider copy() {
return new HatcherySpider(this);
}
}
class HatcherySpiderEffect extends OneShotEffect {
public HatcherySpiderEffect() {
super(Outcome.Benefit);
this.staticText = "reveal the top X cards of your library, "
+ "where X is the number of creature cards in your graveyard. "
+ "You may put a green permanent card with converted mana cost "
+ "X or less from among them onto the battlefield. "
+ "Put the rest on the bottom of your library "
+ "in a random order.";
}
public HatcherySpiderEffect(final HatcherySpiderEffect effect) {
super(effect);
}
@Override
public HatcherySpiderEffect copy() {
return new HatcherySpiderEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
if (player == null) {
return false;
}
int xValue = new CardsInControllerGraveyardCount(
StaticFilters.FILTER_CARD_CREATURE
).calculate(game, source, this);
FilterCard filter = new FilterPermanentCard(
"green permanent card with converted mana cost "
+ xValue + " or less"
);
filter.add(new ColorPredicate(ObjectColor.GREEN));
filter.add(new ConvertedManaCostPredicate(
ComparisonType.FEWER_THAN, xValue + 1
));
TargetCard target = new TargetCardInLibrary(filter);
Cards cards = new CardsImpl(
player.getLibrary().getTopCards(game, xValue)
);
if (player.chooseUse(outcome, "Put a card onto the battlefield?", source, game)
&& player.choose(outcome, cards, target, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null
&& player.moveCards(card, Zone.BATTLEFIELD, source, game)) {
cards.remove(card);
}
}
while (!cards.isEmpty()) {
Card card = cards.getRandom(game);
player.getLibrary().putOnBottom(card, game);
cards.remove(card);
}
return true;
}
}

View file

@ -0,0 +1,57 @@
package mage.cards.h;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.constants.SubType;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.DefendingPlayerControlsPredicate;
import mage.target.TargetPermanent;
/**
*
* @author TheElk801
*/
public final class HellkiteWhelp extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("creature defending player controls");
static {
filter.add(new CardTypePredicate(CardType.CREATURE));
filter.add(new DefendingPlayerControlsPredicate());
}
public HellkiteWhelp(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}");
this.subtype.add(SubType.DRAGON);
this.power = new MageInt(3);
this.toughness = new MageInt(34);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever Hellkite Whelp attacks, it deals 1 damage to target creature defending player controls.
Ability ability = new AttacksTriggeredAbility(
new DamageTargetEffect(1, "it"), false
);
ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability);
}
public HellkiteWhelp(final HellkiteWhelp card) {
super(card);
}
@Override
public HellkiteWhelp copy() {
return new HellkiteWhelp(this);
}
}

View file

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

View file

@ -184,7 +184,7 @@ class HopeOfGhirapurCombatDamageWatcher extends Watcher {
public boolean playerGotCombatDamage(UUID objectId, UUID playerId, Game game) {
StackObject stackObject = game.getState().getStack().getStackObject(objectId);
MageObjectReference mor;
if (stackObject != null && stackObject instanceof StackAbility) {
if (stackObject instanceof StackAbility) {
// This is neccessary because the source object was sacrificed as cost and the correct zone change counter for target calid check can only be get from stack
mor = new MageObjectReference(objectId, ((StackAbility) stackObject).getSourceObjectZoneChangeCounter(), game);
} else {

View file

@ -0,0 +1,57 @@
package mage.cards.h;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect;
import mage.abilities.effects.keyword.SurveilEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author TheElk801
*/
public final class HouseGuildmage extends CardImpl {
public HouseGuildmage(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}{B}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// {1}{U}, {T}: Target creature doesn't untap during its controller's next untap step.
Ability ability = new SimpleActivatedAbility(
new DontUntapInControllersNextUntapStepTargetEffect(),
new ManaCostsImpl("{1}{U}")
);
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
// {2}{B}, {T}: Surveil 2.
ability = new SimpleActivatedAbility(
new SurveilEffect(2),
new ManaCostsImpl("{2}{B}")
);
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}
public HouseGuildmage(final HouseGuildmage card) {
super(card);
}
@Override
public HouseGuildmage copy() {
return new HouseGuildmage(this);
}
}

View file

@ -0,0 +1,40 @@
package mage.cards.h;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.game.permanent.token.SoldierLifelinkToken;
/**
*
* @author TheElk801
*/
public final class HuntedWitness extends CardImpl {
public HuntedWitness(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}");
this.subtype.add(SubType.HUMAN);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// When Hunted Witness dies, create a 1/1 white Soldier creature token with lifelink.
this.addAbility(new DiesTriggeredAbility(
new CreateTokenEffect(new SoldierLifelinkToken())
));
}
public HuntedWitness(final HuntedWitness card) {
super(card);
}
@Override
public HuntedWitness copy() {
return new HuntedWitness(this);
}
}

View file

@ -265,7 +265,7 @@ class IceCauldronManaCondition implements Condition {
public boolean apply(Game game, Ability source) {
if (source instanceof SpellAbility) {
Card card = game.getCard(source.getSourceId());
if (card != null && exiledCard != null && card.equals(exiledCard)) {
if (card != null && card.equals(exiledCard)) {
return true;
}
}

View file

@ -0,0 +1,36 @@
package mage.cards.i;
import java.util.UUID;
import mage.abilities.common.CantBeCounteredAbility;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.target.common.TargetAnyTarget;
/**
*
* @author TheElk801
*/
public final class InescapableBlaze extends CardImpl {
public InescapableBlaze(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{4}{R}{R}");
// This spell can't be countered.
this.addAbility(new CantBeCounteredAbility());
// Inescapable Flame deals 6 damage to any target.
this.getSpellAbility().addEffect(new DamageTargetEffect(6));
this.getSpellAbility().addTarget(new TargetAnyTarget());
}
public InescapableBlaze(final InescapableBlaze card) {
super(card);
}
@Override
public InescapableBlaze copy() {
return new InescapableBlaze(this);
}
}

View file

@ -0,0 +1,40 @@
package mage.cards.i;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
/**
*
* @author TheElk801
*/
public final class InspiringUnicorn extends CardImpl {
public InspiringUnicorn(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{W}");
this.subtype.add(SubType.UNICORN);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Whenever Inspiring Unicorn attacks, creatures you control get +1/+1 until end of turn.
this.addAbility(new AttacksTriggeredAbility(
new BoostControlledEffect(1, 1, Duration.EndOfTurn), false
));
}
public InspiringUnicorn(final InspiringUnicorn card) {
super(card);
}
@Override
public InspiringUnicorn copy() {
return new InspiringUnicorn(this);
}
}

View file

@ -0,0 +1,54 @@
package mage.cards.i;
import java.util.UUID;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.CardSetInfo;
import mage.cards.SplitCard;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SpellAbilityType;
import mage.target.common.TargetAnyTarget;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author TheElk801
*/
public final class IntegrityIntervention extends SplitCard {
public IntegrityIntervention(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{R/W}", "{2}{R}{W}", SpellAbilityType.SPLIT);
// Integrity
// Target creature gets +2/+2 until end of turn.
this.getLeftHalfCard().getSpellAbility().addEffect(
new BoostTargetEffect(2, 2, Duration.EndOfTurn)
);
this.getLeftHalfCard().getSpellAbility().addTarget(
new TargetCreaturePermanent()
);
// Intervention
// Intervention deals 3 damage to any target and you gain 3 life.
this.getRightHalfCard().getSpellAbility().addEffect(
new DamageTargetEffect(3)
);
this.getRightHalfCard().getSpellAbility().addEffect(
new GainLifeEffect(3).setText("and you gain 3 life")
);
this.getRightHalfCard().getSpellAbility().addTarget(
new TargetAnyTarget()
);
}
public IntegrityIntervention(final IntegrityIntervention card) {
super(card);
}
@Override
public IntegrityIntervention copy() {
return new IntegrityIntervention(this);
}
}

View file

@ -0,0 +1,135 @@
package mage.cards.i;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.SwitchPowerToughnessTargetEffect;
import mage.cards.Card;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.cards.SplitCard;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SpellAbilityType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author TheElk801
*/
public final class InvertInvent extends SplitCard {
public InvertInvent(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U/R}", "{4}{U}{R}", SpellAbilityType.SPLIT);
// Invert
// Switch the power and toughness of each of up to two target creatures until end of turn.
this.getLeftHalfCard().getSpellAbility().addEffect(new InvertEffect());
this.getLeftHalfCard().getSpellAbility().addTarget(new TargetCreaturePermanent(0, 2));
// Invent
// Search your library for an instant card and/or a sorcery card, reveal them, put them into your hand, then shuffle your library.
this.getRightHalfCard().getSpellAbility().addEffect(new InventEffect());
}
public InvertInvent(final InvertInvent card) {
super(card);
}
@Override
public InvertInvent copy() {
return new InvertInvent(this);
}
}
class InvertEffect extends OneShotEffect {
public InvertEffect() {
super(Outcome.Benefit);
this.staticText = "Switch the power and toughness of "
+ "each of up to two target creatures until end of turn.";
}
public InvertEffect(final InvertEffect effect) {
super(effect);
}
@Override
public InvertEffect copy() {
return new InvertEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
for (UUID targetId : source.getTargets().get(0).getTargets()) {
ContinuousEffect effect = new SwitchPowerToughnessTargetEffect(Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(targetId, game));
game.addEffect(effect, source);
}
return true;
}
}
class InventEffect extends OneShotEffect {
private static final FilterCard filter1 = new FilterCard("instant card");
private static final FilterCard filter2 = new FilterCard("sorcery card");
static {
filter1.add(new CardTypePredicate(CardType.INSTANT));
filter2.add(new CardTypePredicate(CardType.SORCERY));
}
public InventEffect() {
super(Outcome.Benefit);
this.staticText = "Search your library for an instant card "
+ "and/or a sorcery card, reveal them, "
+ "put them into your hand, then shuffle your library.";
}
public InventEffect(final InventEffect effect) {
super(effect);
}
@Override
public InventEffect copy() {
return new InventEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Cards cards = new CardsImpl();
TargetCardInLibrary target = new TargetCardInLibrary(filter1);
if (player.searchLibrary(target, game, false)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
cards.add(card);
}
}
target = new TargetCardInLibrary(filter2);
if (player.searchLibrary(target, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
cards.add(card);
}
}
player.revealCards(source, cards, game);
player.moveCards(cards, Zone.HAND, source, game);
player.shuffleLibrary(source, game);
return true;
}
}

View file

@ -0,0 +1,45 @@
package mage.cards.j;
import java.util.UUID;
import mage.abilities.effects.common.UntapAllEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.HexproofAbility;
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;
/**
*
* @author TheElk801
*/
public final class JoinShields extends CardImpl {
public JoinShields(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{G}{W}");
// Untap all creatures you control. They gain hexproof and indestructible until end of turn.
this.getSpellAbility().addEffect(new UntapAllEffect(
StaticFilters.FILTER_CONTROLLED_CREATURES
));
this.getSpellAbility().addEffect(new GainAbilityControlledEffect(
HexproofAbility.getInstance(), Duration.EndOfTurn,
StaticFilters.FILTER_CONTROLLED_CREATURES
).setText("They gain hexproof"));
this.getSpellAbility().addEffect(new GainAbilityControlledEffect(
IndestructibleAbility.getInstance(), Duration.EndOfTurn,
StaticFilters.FILTER_CONTROLLED_CREATURES
).setText("and indestructible until end of turn"));
}
public JoinShields(final JoinShields card) {
super(card);
}
@Override
public JoinShields copy() {
return new JoinShields(this);
}
}

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