make the condition in cards an enum

This commit is contained in:
igoudt 2017-04-28 15:30:37 +02:00
parent 3e5ff8ccb2
commit 20a881a374
48 changed files with 196 additions and 417 deletions

View file

@ -58,7 +58,7 @@ public class ArchiveTrap extends CardImpl {
this.subtype.add("Trap");
// If an opponent searched his or her library this turn, you may pay {0} rather than pay Archive Trap's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new GenericManaCost(0), OpponentSearchesLibCondition.getInstance()), new ArchiveTrapWatcher());
this.addAbility(new AlternativeCostSourceAbility(new GenericManaCost(0), OpponentSearchesLibCondition.instance), new ArchiveTrapWatcher());
// Target opponent puts the top thirteen cards of his or her library into his or her graveyard.
this.getSpellAbility().addTarget(new TargetOpponent());
@ -112,13 +112,9 @@ class ArchiveTrapWatcher extends Watcher {
}
}
class OpponentSearchesLibCondition implements Condition {
enum OpponentSearchesLibCondition implements Condition {
private static final OpponentSearchesLibCondition instance = new OpponentSearchesLibCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -47,11 +47,11 @@ import java.util.UUID;
public class ArrowVolleyTrap extends CardImpl {
public ArrowVolleyTrap(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{W}{W}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{W}{W}");
this.subtype.add("Trap");
// If four or more creatures are attacking, you may pay {1}{W} rather than pay Arrow Volley Trap's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{1}{W}"), ArrowVolleyTrapCondition.getInstance()));
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{1}{W}"), ArrowVolleyTrapCondition.instance));
// Arrow Volley Trap deals 5 damage divided as you choose among any number of target attacking creatures.
this.getSpellAbility().addEffect(new DamageMultiEffect(5));
@ -69,13 +69,9 @@ public class ArrowVolleyTrap extends CardImpl {
}
}
class ArrowVolleyTrapCondition implements Condition {
enum ArrowVolleyTrapCondition implements Condition {
private static final ArrowVolleyTrapCondition instance = new ArrowVolleyTrapCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -44,17 +44,16 @@ import java.util.List;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public class BalothCageTrap extends CardImpl {
public BalothCageTrap(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{G}{G}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{G}{G}");
this.subtype.add("Trap");
// If an opponent had an artifact enter the battlefield under his or her control this turn, you may pay {1}{G} rather than pay Baloth Cage Trap's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{1}{G}"), BalothCageTrapCondition.getInstance()), new PermanentsEnteredBattlefieldWatcher());
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{1}{G}"), BalothCageTrapCondition.instance), new PermanentsEnteredBattlefieldWatcher());
// Create a 4/4 green Beast creature token.
this.getSpellAbility().addEffect(new CreateTokenEffect(new BeastToken2()));
@ -70,13 +69,9 @@ public class BalothCageTrap extends CardImpl {
}
}
class BalothCageTrapCondition implements Condition {
enum BalothCageTrapCondition implements Condition {
private static final BalothCageTrapCondition instance = new BalothCageTrapCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -50,7 +50,6 @@ import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public class BloodLust extends CardImpl {
@ -62,12 +61,12 @@ public class BloodLust extends CardImpl {
}
public BloodLust(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{R}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{R}");
// If target creature has toughness 5 or greater, it gets +4/-4 until end of turn. Otherwise, it gets +4/-X until end of turn, where X is its toughness minus 1.
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(
new BoostTargetEffect(4, -4, Duration.EndOfTurn),
new BoostTargetEffect(new StaticValue(4), new SignInversionDynamicValue(new TargetPermanentToughnessMinus1Value()), Duration.WhileOnBattlefield),
new BoostTargetEffect(new StaticValue(4), new SignInversionDynamicValue(TargetPermanentToughnessMinus1Value.instance), Duration.WhileOnBattlefield),
new TargetMatchesFilterCondition(filter),
"If target creature has toughness 5 or greater, it gets +4/-4 until end of turn. Otherwise, it gets +4/-X until end of turn, where X is its toughness minus 1"));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
@ -104,13 +103,9 @@ class TargetMatchesFilterCondition implements Condition {
}
}
class TargetPermanentToughnessMinus1Value implements DynamicValue {
enum TargetPermanentToughnessMinus1Value implements DynamicValue {
private static final TargetPermanentToughnessMinus1Value instance = new TargetPermanentToughnessMinus1Value();
public static TargetPermanentToughnessMinus1Value getInstance() {
return instance;
}
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
@ -123,7 +118,7 @@ class TargetPermanentToughnessMinus1Value implements DynamicValue {
@Override
public TargetPermanentToughnessMinus1Value copy() {
return new TargetPermanentToughnessMinus1Value();
return instance;
}
@Override

View file

@ -48,13 +48,12 @@ import java.util.List;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class BriarbridgePatrol extends CardImpl {
public BriarbridgePatrol(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{G}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}");
this.subtype.add("Human");
this.subtype.add("Warrior");
this.power = new MageInt(3);
@ -64,7 +63,7 @@ public class BriarbridgePatrol extends CardImpl {
this.addAbility(new DealsDamageToOneOrMoreCreaturesTriggeredAbility(new InvestigateEffect(), false, false, false));
// At the beginning of each end step, if you sacrificed three or more Clues this turn, you may put a creature card from your hand onto the battlefield.
this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new PutPermanentOnBattlefieldEffect(new FilterCreatureCard("a creature card")), TargetController.ANY,
BriarbridgePatrolCondition.getInstance(), true), new PermanentsSacrificedWatcher());
BriarbridgePatrolCondition.instance, true), new PermanentsSacrificedWatcher());
}
@ -78,13 +77,9 @@ public class BriarbridgePatrol extends CardImpl {
}
}
class BriarbridgePatrolCondition implements Condition {
enum BriarbridgePatrolCondition implements Condition {
private static final BriarbridgePatrolCondition instance = new BriarbridgePatrolCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {
@ -109,4 +104,4 @@ class BriarbridgePatrolCondition implements Condition {
return "if you sacrificed three or more Clues this turn";
}
}
}

View file

@ -49,17 +49,16 @@ import java.util.Set;
import java.util.UUID;
/**
*
* @author Rafbill
*/
public class CobraTrap extends CardImpl {
public CobraTrap(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{4}{G}{G}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{4}{G}{G}");
this.subtype.add("Trap");
// If a noncreature permanent under your control was destroyed this turn by a spell or ability an opponent controlled, you may pay {G} rather than pay Cobra Trap's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{G}"), CobraTrapCondition.getInstance()), new CobraTrapWatcher());
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{G}"), CobraTrapCondition.instance), new CobraTrapWatcher());
// Create four 1/1 green Snake creature tokens.
this.getSpellAbility().addEffect(new CreateTokenEffect(new SnakeToken(), 4));
@ -75,13 +74,9 @@ public class CobraTrap extends CardImpl {
}
}
class CobraTrapCondition implements Condition {
enum CobraTrapCondition implements Condition {
private static final CobraTrapCondition instance = new CobraTrapCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -68,7 +68,7 @@ public class DeathSpark extends CardImpl {
new DoIfCostPaid(new ReturnSourceFromGraveyardToHandEffect(), new GenericManaCost(1)),
TargetController.YOU,
false),
new DeathSparkCondition(),
DeathSparkCondition.instance,
"At the beginning of your upkeep, if {this} is in your graveyard with a creature card directly above it, you may pay {1}. If you do, return {this} to your hand."));
}
@ -82,13 +82,9 @@ public class DeathSpark extends CardImpl {
}
}
class DeathSparkCondition implements Condition {
enum DeathSparkCondition implements Condition {
private static final DeathSparkCondition instance = new DeathSparkCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -49,7 +49,6 @@ import java.util.Set;
import java.util.UUID;
/**
*
* @author spjspj
*/
public class FairgroundsTrumpeter extends CardImpl {
@ -62,9 +61,9 @@ public class FairgroundsTrumpeter extends CardImpl {
// At the beginning of each end step, if a +1/+1 counter was placed on a permanent under your control this turn, put a +1/+1 counter on Fairgrounds Trumpeter.
this.addAbility(new ConditionalTriggeredAbility(new BeginningOfEndStepTriggeredAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance()),
TargetController.ANY, false), FairgroundsTrumpeterCondition.getInstance(),
"At the beginning of each end step, if a +1/+1 counter was placed on a permanent under your control this turn, put a +1/+1 counter on {this}."),
new AddCountersSourceEffect(CounterType.P1P1.createInstance()),
TargetController.ANY, false), FairgroundsTrumpeterCondition.instance,
"At the beginning of each end step, if a +1/+1 counter was placed on a permanent under your control this turn, put a +1/+1 counter on {this}."),
new FairgroundsTrumpeterWatcher());
}
@ -78,13 +77,9 @@ public class FairgroundsTrumpeter extends CardImpl {
}
}
class FairgroundsTrumpeterCondition implements Condition {
enum FairgroundsTrumpeterCondition implements Condition {
private static final FairgroundsTrumpeterCondition instance = new FairgroundsTrumpeterCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -59,7 +59,7 @@ public class FeastOnTheFallen extends CardImpl {
new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD,
new AddCountersTargetEffect(CounterType.P1P1.createInstance()),
TargetController.ANY, false),
FeastOnTheFallenCondition.getInstance(),
FeastOnTheFallenCondition.instance,
"At the beginning of each upkeep, if an opponent lost life last turn, put a +1/+1 counter on target creature you control.");
ability.addTarget(new TargetControlledCreaturePermanent());
this.addAbility(ability);
@ -75,13 +75,9 @@ public class FeastOnTheFallen extends CardImpl {
}
}
class FeastOnTheFallenCondition implements Condition {
enum FeastOnTheFallenCondition implements Condition {
private static final FeastOnTheFallenCondition instance = new FeastOnTheFallenCondition();
public static FeastOnTheFallenCondition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -69,7 +69,7 @@ public class FiremaneAngel extends CardImpl {
// At the beginning of your upkeep, if Firemane Angel is in your graveyard or on the battlefield, you may gain 1 life.
Ability ability = new ConditionalTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(Zone.ALL, new GainLifeEffect(1), TargetController.YOU, true),
SourceOnBattelfieldOrGraveyardCondition.getInstance(),
SourceOnBattlefieldOrGraveyardCondition.instance,
"At the beginning of your upkeep, if {this} is in your graveyard or on the battlefield, you may gain 1 life");
this.addAbility(ability);
// {6}{R}{R}{W}{W}: Return Firemane Angel from your graveyard to the battlefield. Activate this ability only during your upkeep.
@ -87,13 +87,9 @@ public class FiremaneAngel extends CardImpl {
}
}
class SourceOnBattelfieldOrGraveyardCondition implements Condition {
enum SourceOnBattlefieldOrGraveyardCondition implements Condition {
private static final SourceOnBattelfieldOrGraveyardCondition instance = new SourceOnBattelfieldOrGraveyardCondition();
public static SourceOnBattelfieldOrGraveyardCondition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -59,7 +59,7 @@ public class InfernoTrap extends CardImpl {
this.subtype.add("Trap");
// If you've been dealt damage by two or more creatures this turn, you may pay {R} rather than pay Inferno Trap's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{R}"), InfernoTrapCondition.getInstance()), new InfernoTrapWatcher());
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{R}"), InfernoTrapCondition.instance), new InfernoTrapWatcher());
// Inferno Trap deals 4 damage to target creature.
this.getSpellAbility().addEffect(new DamageTargetEffect(4));
@ -76,13 +76,9 @@ public class InfernoTrap extends CardImpl {
}
}
class InfernoTrapCondition implements Condition {
enum InfernoTrapCondition implements Condition {
private static final InfernoTrapCondition instance = new InfernoTrapCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -28,6 +28,7 @@
package mage.cards.j;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.abilities.costs.common.TapSourceCost;
@ -50,18 +51,17 @@ import mage.players.Player;
import mage.watchers.Watcher;
/**
*
* @author MarcoMarin
*/
public class JandorsRing extends CardImpl {
public JandorsRing(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{6}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{6}");
Watcher watcher = new JandorsRingWatcher();
// {2}, {tap}, Discard the last card you drew this turn: Draw a card.
Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new DiscardAndDrawEffect(), new ManaCostsImpl("{2}"), new WatchedCardInHandCondition(), "Last drawn card still in hand?");
ability.addCost(new TapSourceCost());
Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new DiscardAndDrawEffect(), new ManaCostsImpl("{2}"), WatchedCardInHandCondition.instance, "Last drawn card still in hand?");
ability.addCost(new TapSourceCost());
this.addAbility(ability, watcher);
}
@ -75,31 +75,31 @@ public class JandorsRing extends CardImpl {
}
}
class DiscardAndDrawEffect extends OneShotEffect{
class DiscardAndDrawEffect extends OneShotEffect {
public DiscardAndDrawEffect() {
super(Outcome.Discard);
}
public DiscardAndDrawEffect(final DiscardAndDrawEffect effect) {
super(effect);
}
@Override
public DiscardAndDrawEffect copy() {
return new DiscardAndDrawEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
JandorsRingWatcher watcher = (JandorsRingWatcher) game.getState().getWatchers().get("JandorsRingWatcher");
JandorsRingWatcher watcher = (JandorsRingWatcher) game.getState().getWatchers().get("JandorsRingWatcher");
FilterCard filter = new FilterCard(game.getCard(watcher.lastDrawnCard).getName());
filter.add(new CardIdPredicate(watcher.lastDrawnCard));
DiscardCardYouChooseTargetEffect effect = new DiscardCardYouChooseTargetEffect(filter, TargetController.YOU);
if (effect.apply(game, source)){//Conditional was already checked, card should be in hand, but if for some weird reason it fails, the card won't be drawn, although the cost will already be paid
if (effect.apply(game, source)) {//Conditional was already checked, card should be in hand, but if for some weird reason it fails, the card won't be drawn, although the cost will already be paid
Player controller = game.getPlayer(source.getControllerId());
controller.drawCards(1, game);
return true;
@ -119,16 +119,16 @@ class JandorsRingWatcher extends Watcher {
}
public JandorsRingWatcher(final JandorsRingWatcher watcher) {
super(watcher);
super(watcher);
this.lastDrawnCard = watcher.lastDrawnCard;
}
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DREW_CARD) {
if (event.getType() == GameEvent.EventType.DREW_CARD) {
lastDrawnCard = event.getTargetId();
}
if (event.getType() == GameEvent.EventType.CLEANUP_STEP_POST) {
if (event.getType() == GameEvent.EventType.CLEANUP_STEP_POST) {
lastDrawnCard = null;
}
}
@ -145,19 +145,15 @@ class JandorsRingWatcher extends Watcher {
}
}
class WatchedCardInHandCondition implements Condition {
enum WatchedCardInHandCondition implements Condition {
private static final WatchedCardInHandCondition instance = new WatchedCardInHandCondition();
instance;
public static WatchedCardInHandCondition getInstance() {
return instance;
}
@Override
public boolean apply(Game game, Ability source) {
JandorsRingWatcher watcher = (JandorsRingWatcher) game.getState().getWatchers().get("JandorsRingWatcher");
return watcher.lastDrawnCard!=null && game.getPlayer(source.getControllerId()).getHand().contains(watcher.lastDrawnCard);
JandorsRingWatcher watcher = (JandorsRingWatcher) game.getState().getWatchers().get("JandorsRingWatcher");
return watcher.lastDrawnCard != null && game.getPlayer(source.getControllerId()).getHand().contains(watcher.lastDrawnCard);
}
@Override
@ -165,5 +161,5 @@ class WatchedCardInHandCondition implements Condition {
return "if last drawn card is still in hand";
}
}

View file

@ -56,7 +56,7 @@ public class LavaballTrap extends CardImpl {
this.subtype.add("Trap");
// If an opponent had two or more lands enter the battlefield under his or her control this turn, you may pay {3}{R}{R} rather than pay Lavaball Trap's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{3}{R}{R}"), LavaballTrapCondition.getInstance()), new PermanentsEnteredBattlefieldWatcher());
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{3}{R}{R}"), LavaballTrapCondition.instance), new PermanentsEnteredBattlefieldWatcher());
// Destroy two target lands. Lavaball Trap deals 4 damage to each creature.
this.getSpellAbility().addEffect(new DestroyTargetEffect());
@ -75,13 +75,9 @@ public class LavaballTrap extends CardImpl {
}
}
class LavaballTrapCondition implements Condition {
enum LavaballTrapCondition implements Condition {
private static final LavaballTrapCondition instance = new LavaballTrapCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -58,7 +58,7 @@ public class LethargyTrap extends CardImpl {
this.subtype.add("Trap");
// If three or more creatures are attacking, you may pay {U} rather than pay Lethargy Trap's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{U}"), LethargyTrapCondition.getInstance()));
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{U}"), LethargyTrapCondition.instance));
// Attacking creatures get -3/-0 until end of turn.
this.getSpellAbility().addEffect(new BoostAllEffect(-3, 0, Duration.EndOfTurn, filter, false));
@ -75,13 +75,9 @@ public class LethargyTrap extends CardImpl {
}
}
class LethargyTrapCondition implements Condition {
enum LethargyTrapCondition implements Condition {
private static final LethargyTrapCondition instance = new LethargyTrapCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -61,7 +61,7 @@ public class LuminarchAscension extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{W}");
// At the beginning of each opponent's end step, if you didn't lose life this turn, you may put a quest counter on Luminarch Ascension.
this.addAbility(new ConditionalTriggeredAbility(new LuminarchAscensionTriggeredAbility(), YouLostNoLifeThisTurnCondition.getInstance(), rule));
this.addAbility(new ConditionalTriggeredAbility(new LuminarchAscensionTriggeredAbility(), YouLostNoLifeThisTurnCondition.instance, rule));
// {1}{W}: Create a 4/4 white Angel creature token with flying. Activate this ability only if Luminarch Ascension has four or more quest counters on it.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new AngelToken()), new ManaCostsImpl("{1}{W}"));
@ -139,13 +139,10 @@ class SourceHasCountersCost extends CostImpl {
}
}
class YouLostNoLifeThisTurnCondition implements Condition {
enum YouLostNoLifeThisTurnCondition implements Condition {
private static final YouLostNoLifeThisTurnCondition instance = new YouLostNoLifeThisTurnCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -87,7 +87,7 @@ public class ManorGargoyle extends CardImpl {
// Manor Gargoyle has indestructible as long as it has defender.
GainAbilitySourceEffect gainEffect = new GainAbilitySourceEffect(IndestructibleAbility.getInstance());
gainEffect.setDependedToType(DependencyType.LooseDefenderEffect);
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(gainEffect, HasDefenderCondition.getInstance(), rule);
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(gainEffect, HasDefenderCondition.instance, rule);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
@ -112,19 +112,9 @@ public class ManorGargoyle extends CardImpl {
}
}
class HasDefenderCondition implements Condition {
enum HasDefenderCondition implements Condition {
private static HasDefenderCondition INSTANCE;
private HasDefenderCondition() {
}
public static HasDefenderCondition getInstance() {
if (INSTANCE == null) {
INSTANCE = new HasDefenderCondition();
}
return INSTANCE;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -66,7 +66,7 @@ public class MedomaiTheAgeless extends CardImpl {
// Whenever Medomai the Ageless deals combat damage to a player, take an extra turn after this one.
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new AddExtraTurnControllerEffect(), false));
// Medomai the Ageless can't attack during extra turns.
Effect effect = new ConditionalRestrictionEffect(new CantAttackAnyPlayerSourceEffect(Duration.WhileOnBattlefield), ExtraTurnCondition.getInstance());
Effect effect = new ConditionalRestrictionEffect(new CantAttackAnyPlayerSourceEffect(Duration.WhileOnBattlefield), ExtraTurnCondition.instance);
effect.setText("{this} can't attack during extra turns");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}
@ -81,18 +81,9 @@ public class MedomaiTheAgeless extends CardImpl {
}
}
class ExtraTurnCondition implements Condition {
enum ExtraTurnCondition implements Condition {
private static ExtraTurnCondition instance = null;
private ExtraTurnCondition() {}
public static Condition getInstance() {
if (instance == null) {
instance = new ExtraTurnCondition();
}
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -29,6 +29,7 @@ package mage.cards.m;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.BeginningOfCombatTriggeredAbility;
@ -50,22 +51,21 @@ import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author Quercitron
*/
public class MightMakesRight extends CardImpl {
private static final String ruleText = "At the beginning of combat on your turn, if you control each creature on the battlefield with the greatest power, "
+ "gain control of target creature an opponent controls until end of turn. Untap that creature. It gains haste until end of turn.";
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature an opponent controls");
static {
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public MightMakesRight(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{5}{R}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{5}{R}");
// At the beginning of combat on your turn, if you control each creature on the battlefield with the greatest power, gain control
@ -74,7 +74,7 @@ public class MightMakesRight extends CardImpl {
gainControlAbility.addEffect(new UntapTargetEffect());
gainControlAbility.addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn));
gainControlAbility.addTarget(new TargetCreaturePermanent(filter));
Ability conditionalAbility = new ConditionalTriggeredAbility(gainControlAbility, ControlsEachCreatureWithGreatestPowerCondition.getInstance(), ruleText);
Ability conditionalAbility = new ConditionalTriggeredAbility(gainControlAbility, ControlsEachCreatureWithGreatestPowerCondition.instance, ruleText);
this.addAbility(conditionalAbility);
}
@ -88,16 +88,12 @@ public class MightMakesRight extends CardImpl {
}
}
class ControlsEachCreatureWithGreatestPowerCondition implements Condition {
enum ControlsEachCreatureWithGreatestPowerCondition implements Condition {
instance;
private static final ControlsEachCreatureWithGreatestPowerCondition instance = new ControlsEachCreatureWithGreatestPowerCondition();
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
public static Condition getInstance() {
return instance;
}
@Override
public boolean apply(Game game, Ability source) {
Integer maxPower = null;
@ -118,5 +114,5 @@ class ControlsEachCreatureWithGreatestPowerCondition implements Condition {
}
return result;
}
}

View file

@ -51,7 +51,7 @@ public class MightOfTheNephilim extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{G}");
// Target creature gets +2/+2 until end of turn for each of its colors.
DynamicValue boostValue = MightOfTheNephilimValue.getInstance();
DynamicValue boostValue = MightOfTheNephilimValue.instance;
Effect effect = new BoostTargetEffect(boostValue, boostValue, Duration.EndOfTurn, true);
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
@ -67,15 +67,9 @@ public class MightOfTheNephilim extends CardImpl {
}
}
class MightOfTheNephilimValue implements DynamicValue {
enum MightOfTheNephilimValue implements DynamicValue {
private static final MightOfTheNephilimValue instance = new MightOfTheNephilimValue();
public static MightOfTheNephilimValue getInstance() {
return instance;
}
private MightOfTheNephilimValue() {}
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {

View file

@ -28,6 +28,7 @@
package mage.cards.m;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.abilities.costs.AlternativeCostSourceAbility;
@ -42,7 +43,6 @@ import mage.target.TargetSpell;
import mage.watchers.common.CastSpellLastTurnWatcher;
/**
*
* @author Rafbill
*/
public class MindbreakTrap extends CardImpl {
@ -50,11 +50,11 @@ public class MindbreakTrap extends CardImpl {
private static final FilterSpell filter = new FilterSpell("spell to exile");
public MindbreakTrap(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{U}{U}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}{U}");
this.subtype.add("Trap");
// If an opponent cast three or more spells this turn, you may pay {0} rather than pay Mindbreak Trap's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new GenericManaCost(0), MindbreakTrapCondition.getInstance()));
this.addAbility(new AlternativeCostSourceAbility(new GenericManaCost(0), MindbreakTrapCondition.instance));
// Exile any number of target spells.
this.getSpellAbility().addTarget(new TargetSpell(0, Integer.MAX_VALUE, filter));
@ -71,13 +71,9 @@ public class MindbreakTrap extends CardImpl {
}
}
class MindbreakTrapCondition implements Condition {
enum MindbreakTrapCondition implements Condition {
private static final MindbreakTrapCondition instance = new MindbreakTrapCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -61,7 +61,7 @@ public class MosswortBridge extends CardImpl {
// {G}, {T}: You may play the exiled card without paying its mana cost if creatures you control have total power 10 or greater.
Ability ability = new ActivateIfConditionActivatedAbility(
Zone.BATTLEFIELD, new HideawayPlayEffect(), new ManaCostsImpl("{G}"), MosswortBridgeTotalPowerCondition.getInstance());
Zone.BATTLEFIELD, new HideawayPlayEffect(), new ManaCostsImpl("{G}"), MosswortBridgeTotalPowerCondition.instance);
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}
@ -81,9 +81,6 @@ enum MosswortBridgeTotalPowerCondition implements Condition {
instance;
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
public static Condition getInstance() {
return instance;
}
@Override
public boolean apply(Game game, Ability source) {

View file

@ -28,6 +28,7 @@
package mage.cards.n;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.abilities.costs.AlternativeCostSourceAbility;
@ -42,7 +43,6 @@ import mage.target.TargetPlayer;
import mage.watchers.common.PlayerGainedLifeWatcher;
/**
*
* @author LevelX2
*/
public class NeedlebiteTrap extends CardImpl {
@ -52,7 +52,7 @@ public class NeedlebiteTrap extends CardImpl {
this.subtype.add("Trap");
// If an opponent gained life this turn, you may pay {B} rather than pay Needlebite Trap's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{B}"), NeedlebiteTrapCondition.getInstance()), new PlayerGainedLifeWatcher());
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{B}"), NeedlebiteTrapCondition.instance), new PlayerGainedLifeWatcher());
// Target player loses 5 life and you gain 5 life.
this.getSpellAbility().addEffect(new LoseLifeTargetEffect(5));
@ -70,13 +70,9 @@ public class NeedlebiteTrap extends CardImpl {
}
}
class NeedlebiteTrapCondition implements Condition {
enum NeedlebiteTrapCondition implements Condition {
private static final NeedlebiteTrapCondition instance = new NeedlebiteTrapCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -69,7 +69,7 @@ public class NotOfThisWorld extends CardImpl {
new TargetStackObjectTargetingControlledPermanent());
this.getSpellAbility().addEffect(new CounterTargetEffect());
// Not of This World costs {7} less to cast if it targets a spell or ability that targets a creature you control with power 7 or greater.
this.addAbility(new SimpleStaticAbility(Zone.STACK, new SpellCostReductionSourceEffect(7, NotOfThisWorldCondition.getInstance())));
this.addAbility(new SimpleStaticAbility(Zone.STACK, new SpellCostReductionSourceEffect(7, NotOfThisWorldCondition.instance)));
}
public NotOfThisWorld(final NotOfThisWorld card) {
@ -165,8 +165,8 @@ class TargetStackObjectTargetingControlledPermanent extends TargetObject {
}
class NotOfThisWorldCondition implements Condition {
enum NotOfThisWorldCondition implements Condition {
instance;
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature you control with power 7 or greater");
static {
@ -174,11 +174,7 @@ class NotOfThisWorldCondition implements Condition {
filter.add(new ControllerPredicate(TargetController.YOU));
}
private static final NotOfThisWorldCondition instance = new NotOfThisWorldCondition();
public static Condition getInstance() {
return instance;
}
@Override
public boolean apply(Game game, Ability source) {

View file

@ -49,13 +49,12 @@ import java.util.Set;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public class OathOfLiliana extends CardImpl {
public OathOfLiliana(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{B}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}");
addSuperType(SuperType.LEGENDARY);
// When Oath of Liliana enters the battlefield, each opponent sacrifices a creature.
@ -64,7 +63,7 @@ public class OathOfLiliana extends CardImpl {
// At the beginning of each end step, if a planeswalker entered the battlefield under your control this turn, create a 2/2 black Zombie creature token.
this.addAbility(new ConditionalTriggeredAbility(new BeginningOfEndStepTriggeredAbility(
new CreateTokenEffect(new ZombieToken()),
TargetController.ANY, false), OathOfLilianaCondition.getInstance(),
TargetController.ANY, false), OathOfLilianaCondition.instance,
"At the beginning of each end step, if a planeswalker entered the battlefield under your control this turn, "
+ "create a 2/2 black Zombie creature token."), new OathOfLilianaWatcher());
}
@ -79,13 +78,9 @@ public class OathOfLiliana extends CardImpl {
}
}
class OathOfLilianaCondition implements Condition {
enum OathOfLilianaCondition implements Condition {
private static final OathOfLilianaCondition instance = new OathOfLilianaCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -28,6 +28,7 @@
package mage.cards.p;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.AttacksWithCreaturesTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
@ -48,7 +49,6 @@ import mage.game.Game;
import mage.players.Player;
/**
*
* @author jeffwadsworth
*/
public class PathOfBravery extends CardImpl {
@ -58,13 +58,14 @@ public class PathOfBravery extends CardImpl {
static {
filter.add(new ControllerPredicate(TargetController.YOU));
}
static final String rule = "As long as your life total is greater than or equal to your starting life total, creatures you control get +1/+1";
public PathOfBravery(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{W}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}");
// As long as your life total is greater than or equal to your starting life total, creatures you control get +1/+1.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter, true), new LifeCondition(), rule)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter, true), LifeCondition.instance, rule)));
// Whenever one or more creatures you control attack, you gain life equal to the number of attacking creatures.
this.addAbility(new AttacksWithCreaturesTriggeredAbility(new PathOfBraveryEffect(), 1));
@ -81,13 +82,9 @@ public class PathOfBravery extends CardImpl {
}
}
class LifeCondition implements Condition {
enum LifeCondition implements Condition {
private static LifeCondition instance = new LifeCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -54,7 +54,7 @@ public class PermafrostTrap extends CardImpl {
this.subtype.add("Trap");
// If an opponent had a green creature enter the battlefield under his or her control this turn, you may pay {U} rather than pay Permafrost Trap's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{U}"), PermafrostTrapCondition.getInstance()), new PermanentsEnteredBattlefieldWatcher());
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{U}"), PermafrostTrapCondition.instance), new PermanentsEnteredBattlefieldWatcher());
// Tap up to two target creatures. Those creatures don't untap during their controller's next untap step.
this.getSpellAbility().addEffect(new TapTargetEffect());
@ -72,13 +72,9 @@ public class PermafrostTrap extends CardImpl {
}
}
class PermafrostTrapCondition implements Condition {
enum PermafrostTrapCondition implements Condition {
private static final PermafrostTrapCondition instance = new PermafrostTrapCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -60,7 +60,7 @@ public class PitfallTrap extends CardImpl {
this.subtype.add("Trap");
// If exactly one creature is attacking, you may pay {W} rather than pay Pitfall Trap's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{W}"), PitfallTrapCondition.getInstance()));
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{W}"), PitfallTrapCondition.instance));
// Destroy target attacking creature without flying.
this.getSpellAbility().addEffect(new DestroyTargetEffect());
@ -77,13 +77,9 @@ public class PitfallTrap extends CardImpl {
}
}
class PitfallTrapCondition implements Condition {
enum PitfallTrapCondition implements Condition {
private static final PitfallTrapCondition instance = new PitfallTrapCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -72,7 +72,7 @@ public class QueenMarchesa extends CardImpl {
// At the beginning of your upkeep, if an opponent is the monarch, create a 1/1 black Assassin creature token with deathtouch and haste.
this.addAbility(new ConditionalTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(new CreateTokenEffect(new QueenMarchesaAssassinToken()), TargetController.YOU, false),
OpponentIsMonarchCondition.getInstance(),
OpponentIsMonarchCondition.instance,
"At the beginning of your upkeep, if an opponent is the monarch, create a 1/1 black Assassin creature token with deathtouch and haste."));
}
@ -86,13 +86,9 @@ public class QueenMarchesa extends CardImpl {
}
}
class OpponentIsMonarchCondition implements Condition {
enum OpponentIsMonarchCondition implements Condition {
private final static OpponentIsMonarchCondition instance = new OpponentIsMonarchCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -57,7 +57,6 @@ import java.util.Set;
import java.util.UUID;
/**
*
* @author emerald000
*/
public class RasputinDreamweaver extends CardImpl {
@ -83,9 +82,9 @@ public class RasputinDreamweaver extends CardImpl {
// At the beginning of your upkeep, if Rasputin started the turn untapped, put a dream counter on it.
this.addAbility(
new ConditionalTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(new AddCountersSourceEffect(CounterType.DREAM.createInstance()), TargetController.YOU, false),
new RasputinDreamweaverStartedUntappedCondition(),
"At the beginning of your upkeep, if {this} started the turn untapped, put a dream counter on it."),
new BeginningOfUpkeepTriggeredAbility(new AddCountersSourceEffect(CounterType.DREAM.createInstance()), TargetController.YOU, false),
RasputinDreamweaverStartedUntappedCondition.instance,
"At the beginning of your upkeep, if {this} started the turn untapped, put a dream counter on it."),
new RasputinDreamweaverStartedUntappedWatcher());
// Rasputin can't have more than seven dream counters on it.
@ -102,13 +101,9 @@ public class RasputinDreamweaver extends CardImpl {
}
}
class RasputinDreamweaverStartedUntappedCondition implements Condition {
enum RasputinDreamweaverStartedUntappedCondition implements Condition {
private static final RasputinDreamweaverStartedUntappedCondition instance = new RasputinDreamweaverStartedUntappedCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {
@ -128,6 +123,7 @@ class RasputinDreamweaverStartedUntappedCondition implements Condition {
class RasputinDreamweaverStartedUntappedWatcher extends Watcher {
private static final FilterPermanent filter = new FilterPermanent("Untapped permanents");
static {
filter.add(Predicates.not(new TappedPredicate()));
}

View file

@ -51,7 +51,7 @@ public class RavenousTrap extends CardImpl {
this.subtype.add("Trap");
// If an opponent had three or more cards put into his or her graveyard from anywhere this turn, you may pay {0} rather than pay Ravenous Trap's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{0}"), RavenousTrapCondition.getInstance()), new CardsPutIntoGraveyardWatcher());
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{0}"), RavenousTrapCondition.instance), new CardsPutIntoGraveyardWatcher());
// Exile all cards from target player's graveyard.
this.getSpellAbility().addEffect(new ExileGraveyardAllTargetPlayerEffect());
@ -68,13 +68,9 @@ public class RavenousTrap extends CardImpl {
}
}
class RavenousTrapCondition implements Condition {
enum RavenousTrapCondition implements Condition {
private static final RavenousTrapCondition instance = new RavenousTrapCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -29,6 +29,7 @@ package mage.cards.r;
import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
@ -52,17 +53,16 @@ import mage.target.common.TargetCreatureOrPlayer;
import mage.watchers.common.SpellsCastWatcher;
/**
*
* @author jeffwadsworth
*/
public class RefractionTrap extends CardImpl {
public RefractionTrap(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{W}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{W}");
this.subtype.add("Trap");
// If an opponent cast a red instant or sorcery spell this turn, you may pay {W} rather than pay Refraction Trap's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{W}"), RefractionTrapCondition.getInstance()), new SpellsCastWatcher());
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{W}"), RefractionTrapCondition.instance), new SpellsCastWatcher());
// Prevent the next 3 damage that a source of your choice would deal to you and/or permanents you control this turn. If damage is prevented this way, Refraction Trap deals that much damage to target creature or player.
this.getSpellAbility().addEffect(new RefractionTrapPreventDamageEffect(Duration.EndOfTurn, 3));
@ -79,13 +79,8 @@ public class RefractionTrap extends CardImpl {
}
}
class RefractionTrapCondition implements Condition {
private static final RefractionTrapCondition instance = new RefractionTrapCondition();
public static Condition getInstance() {
return instance;
}
enum RefractionTrapCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -58,7 +58,7 @@ public class ResoluteArchangel extends CardImpl {
// Flying
this.addAbility(FlyingAbility.getInstance());
// When Resolute Angel enters the battlefield, if your life total is lower than your starting life total, it becomes equal to your starting life total.
this.addAbility(new EntersBattlefieldTriggeredAbility(new ConditionalOneShotEffect(new ResoluteArchangelEffect(), ControllerLifeLowerThanStrtingLife.getInstance(),
this.addAbility(new EntersBattlefieldTriggeredAbility(new ConditionalOneShotEffect(new ResoluteArchangelEffect(), ControllerLifeLowerThanStrtingLife.instance,
"if your life total is lower than your starting life total, it becomes equal to your starting life total")));
}
@ -99,13 +99,9 @@ class ResoluteArchangelEffect extends OneShotEffect {
}
}
class ControllerLifeLowerThanStrtingLife implements Condition {
enum ControllerLifeLowerThanStrtingLife implements Condition {
private static final ControllerLifeLowerThanStrtingLife instance = new ControllerLifeLowerThanStrtingLife();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -59,7 +59,7 @@ public class Revenge extends CardImpl {
// Target creature you control gets +4/+0 until end of turn before it fights if you lost life this turn.
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new RevengeEffect(),
LostLifeCondition.getInstance(),
LostLifeCondition.instance,
"Target creature you control gets +4/+0 until end of turn before it fights if you lost life this turn"));
// Target creature you control fights target creature an opponent controls.
@ -85,9 +85,6 @@ enum LostLifeCondition implements Condition {
instance;
public static Condition getInstance() {
return instance;
}
@Override
public boolean apply(Game game, Ability source) {

View file

@ -29,6 +29,7 @@ package mage.cards.r;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.abilities.costs.AlternativeCostSourceAbility;
@ -45,7 +46,6 @@ import mage.target.TargetSpell;
import mage.watchers.common.SpellsCastWatcher;
/**
*
* @author jeffwadsworth
*/
public class RicochetTrap extends CardImpl {
@ -57,11 +57,11 @@ public class RicochetTrap extends CardImpl {
}
public RicochetTrap(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{R}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{R}");
this.subtype.add("Trap");
// If an opponent cast a blue spell this turn, you may pay {R} rather than pay Ricochet Trap's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{R}"), RicochetTrapCondition.getInstance()));
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{R}"), RicochetTrapCondition.instance));
// Change the target of target spell with a single target.
this.getSpellAbility().addEffect(new ChooseNewTargetsTargetEffect(true, true));
@ -80,13 +80,9 @@ public class RicochetTrap extends CardImpl {
}
}
class RicochetTrapCondition implements Condition {
enum RicochetTrapCondition implements Condition {
private static final RicochetTrapCondition instance = new RicochetTrapCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -54,7 +54,7 @@ public class RuneflareTrap extends CardImpl {
this.subtype.add("Trap");
// If an opponent drew three or more cards this turn, you may pay {R} rather than pay Runeflare Trap's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{R}"), RuneflareTrapCondition.getInstance()), new CardsAmountDrawnThisTurnWatcher());
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{R}"), RuneflareTrapCondition.instance), new CardsAmountDrawnThisTurnWatcher());
// Runeflare Trap deals damage to target player equal to the number of cards in that player's hand.
this.getSpellAbility().addEffect(new DamageTargetEffect(new TargetPlayerCardsInHandCount()));
@ -100,13 +100,9 @@ class TargetPlayerCardsInHandCount implements DynamicValue {
}
}
class RuneflareTrapCondition implements Condition {
enum RuneflareTrapCondition implements Condition {
private static final RuneflareTrapCondition instance = new RuneflareTrapCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -72,7 +72,7 @@ public class ScaleguardSentinels extends CardImpl {
// Scaleguard Sentinels enters the battlefield with a +1/+1 counter on it if you revealed a Dragon card or controlled a Dragon as you cast Scaleguard Sentinels.
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(), true),
ScaleguardSentinelsCondition.getInstance(),
ScaleguardSentinelsCondition.instance,
"{this} enters the battlefield with a +1/+1 counter on it if you revealed a Dragon card or controlled a Dragon as you cast {this}", ""),
new DragonOnTheBattlefieldWhileSpellWasCastWatcher());
@ -100,13 +100,9 @@ public class ScaleguardSentinels extends CardImpl {
}
}
class ScaleguardSentinelsCondition implements Condition {
enum ScaleguardSentinelsCondition implements Condition {
private static final ScaleguardSentinelsCondition instance = new ScaleguardSentinelsCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -28,6 +28,7 @@
package mage.cards.s;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.abilities.costs.AlternativeCostSourceAbility;
@ -44,7 +45,6 @@ import mage.game.permanent.Permanent;
import mage.target.common.TargetAttackingCreature;
/**
*
* @author jeffwadsworth
*/
public class SlingbowTrap extends CardImpl {
@ -56,11 +56,11 @@ public class SlingbowTrap extends CardImpl {
}
public SlingbowTrap(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{G}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{G}");
this.subtype.add("Trap");
// If a black creature with flying is attacking, you may pay {G} rather than pay Slingbow Trap's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{G}"), SlingbowTrapCondition.getInstance()));
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{G}"), SlingbowTrapCondition.instance));
// Destroy target attacking creature with flying.
this.getSpellAbility().addEffect(new DestroyTargetEffect());
@ -77,13 +77,9 @@ public class SlingbowTrap extends CardImpl {
}
}
class SlingbowTrapCondition implements Condition {
enum SlingbowTrapCondition implements Condition {
private static final SlingbowTrapCondition instance = new SlingbowTrapCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -69,7 +69,7 @@ public class SokenzanRenegade extends CardImpl {
// At the beginning of your upkeep, if a player has more cards in hand than each other player, the player who has the most cards in hand gains control of Sokenzan Renegade.
this.addAbility(new ConditionalTriggeredAbility(
new BeginningOfUntapTriggeredAbility(Zone.BATTLEFIELD, new SokenzanRenegadeEffect(), TargetController.YOU, false),
OnePlayerHasTheMostCards.getInstance(),
OnePlayerHasTheMostCards.instance,
"At the beginning of your upkeep, if a player has more cards in hand than each other player, the player who has the most cards in hand gains control of {this}"
));
@ -135,10 +135,6 @@ enum OnePlayerHasTheMostCards implements Condition {
instance;
public static Condition getInstance() {
return instance;
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());

View file

@ -47,18 +47,17 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author Quercitron
*/
public class SpiritOfResistance extends CardImpl {
public SpiritOfResistance(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{W}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}");
// As long as you control a permanent of each color, prevent all damage that would be dealt to you.
Effect effect = new ConditionalReplacementEffect(
new PreventDamageToControllerEffect(Duration.WhileOnBattlefield),
SpiritOfResistanceCondition.getInstance());
SpiritOfResistanceCondition.instance);
effect.setText("As long as you control a permanent of each color, prevent all damage that would be dealt to you.");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}
@ -73,15 +72,9 @@ public class SpiritOfResistance extends CardImpl {
}
}
class SpiritOfResistanceCondition implements Condition {
enum SpiritOfResistanceCondition implements Condition {
private static final SpiritOfResistanceCondition instance = new SpiritOfResistanceCondition();
public static SpiritOfResistanceCondition getInstance() {
return instance;
}
private SpiritOfResistanceCondition() {}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -65,7 +65,7 @@ public class SummoningTrap extends CardImpl {
this.subtype.add("Trap");
// If a creature spell you cast this turn was countered by a spell or ability an opponent controlled, you may pay {0} rather than pay Summoning Trap's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{0}"), SummoningTrapCondition.getInstance()), new SummoningTrapWatcher());
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{0}"), SummoningTrapCondition.instance), new SummoningTrapWatcher());
// Look at the top seven cards of your library. You may put a creature card from among them onto the battlefield. Put the rest on the bottom of your library in any order.
this.getSpellAbility().addEffect(new SummoningTrapEffect());
@ -81,13 +81,9 @@ public class SummoningTrap extends CardImpl {
}
}
class SummoningTrapCondition implements Condition {
enum SummoningTrapCondition implements Condition {
private static final SummoningTrapCondition instance = new SummoningTrapCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -28,6 +28,7 @@
package mage.cards.s;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AsEntersBattlefieldAbility;
@ -61,7 +62,7 @@ public class SuturedGhoul extends CardImpl {
private static final String staticText2 = "Sutured Ghoul's power is equal to the total power of the exiled cards and its toughness is equal to their total toughness";
public SuturedGhoul(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{B}{B}{B}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{B}{B}");
this.subtype.add("Zombie");
this.power = new MageInt(0);
@ -73,7 +74,7 @@ public class SuturedGhoul extends CardImpl {
this.addAbility(new AsEntersBattlefieldAbility(new SuturedGhoulEffect(), staticText));
// Sutured Ghoul's power is equal to the total power of the exiled cards and its toughness is equal to their total toughness.
BoostSourceEffect effect = new BoostSourceEffect(new SuturedGhoulPowerCount(), new SuturedGhoulToughnessCount(), Duration.WhileOnBattlefield);
BoostSourceEffect effect = new BoostSourceEffect(SuturedGhoulPowerCount.instance, SuturedGhoulToughnessCount.instance, Duration.WhileOnBattlefield);
effect.setText(staticText2);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}
@ -137,16 +138,9 @@ class SuturedGhoulEffect extends OneShotEffect {
}
}
class SuturedGhoulPowerCount implements DynamicValue {
enum SuturedGhoulPowerCount implements DynamicValue {
private static SuturedGhoulPowerCount instance;
public static SuturedGhoulPowerCount getInstance() {
if (instance == null) {
instance = new SuturedGhoulPowerCount();
}
return instance;
}
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
@ -165,7 +159,7 @@ class SuturedGhoulPowerCount implements DynamicValue {
@Override
public DynamicValue copy() {
return getInstance();
return instance;
}
@Override
@ -179,16 +173,9 @@ class SuturedGhoulPowerCount implements DynamicValue {
}
}
class SuturedGhoulToughnessCount implements DynamicValue {
enum SuturedGhoulToughnessCount implements DynamicValue {
private static SuturedGhoulToughnessCount instance;
public static SuturedGhoulToughnessCount getInstance() {
if (instance == null) {
instance = new SuturedGhoulToughnessCount();
}
return instance;
}
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
@ -207,7 +194,7 @@ class SuturedGhoulToughnessCount implements DynamicValue {
@Override
public DynamicValue copy() {
return getInstance();
return instance;
}
@Override

View file

@ -61,7 +61,7 @@ public class TapestryOfTheAges extends CardImpl {
Zone.BATTLEFIELD,
new DrawCardSourceControllerEffect(1),
new ManaCostsImpl<>("{2}"),
PlayerCastNonCreatureSpellCondition.getInstance());
PlayerCastNonCreatureSpellCondition.instance);
ability.addCost(new TapSourceCost());
this.addAbility(ability, new PlayerCastNonCreatureSpellWatcher());
@ -80,10 +80,6 @@ public class TapestryOfTheAges extends CardImpl {
enum PlayerCastNonCreatureSpellCondition implements Condition {
instance;
public static Condition getInstance() {
return instance;
}
@Override
public boolean apply(Game game, Ability source) {
PlayerCastNonCreatureSpellWatcher watcher = (PlayerCastNonCreatureSpellWatcher) game.getState().getWatchers().get("PlayerCastNonCreatureSpell");

View file

@ -64,7 +64,7 @@ public class VengefulFirebrand extends CardImpl {
// Vengeful Firebrand has haste as long as a Warrior card is in your graveyard.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(
new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.WhileOnBattlefield),
VengefulFirebrandCondition.getInstance(),
VengefulFirebrandCondition.instance,
"{this} has haste as long as a Warrior card is in your graveyard")));
// {R}: Vengeful Firebrand gets +1/+0 until end of turn.
@ -90,10 +90,6 @@ enum VengefulFirebrandCondition implements Condition {
filter.add(new SubtypePredicate("Warrior"));
}
public static Condition getInstance() {
return instance;
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());

View file

@ -46,7 +46,6 @@ import mage.game.Game;
import mage.players.Player;
/**
*
* @author North
*/
public class ViridianBetrayers extends CardImpl {
@ -54,7 +53,7 @@ public class ViridianBetrayers extends CardImpl {
private static final String rule = "{this} has infect as long as an opponent is poisoned.";
public ViridianBetrayers(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{G}{G}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{G}");
this.subtype.add("Elf");
this.subtype.add("Warrior");
@ -63,7 +62,7 @@ public class ViridianBetrayers extends CardImpl {
this.toughness = new MageInt(1);
// Viridian Betrayers has infect as long as an opponent is poisoned.
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(new GainAbilitySourceEffect(InfectAbility.getInstance()), PoisonedCondition.getInstance(), rule);
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(new GainAbilitySourceEffect(InfectAbility.getInstance()), PoisonedCondition.instance, rule);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}
@ -77,13 +76,9 @@ public class ViridianBetrayers extends CardImpl {
}
}
class PoisonedCondition implements Condition {
enum PoisonedCondition implements Condition {
private static PoisonedCondition instance = new PoisonedCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -62,7 +62,7 @@ public class WardenOfTheBeyond extends CardImpl {
this.addAbility(VigilanceAbility.getInstance());
// Warden of the Beyond gets +2/+2 as long as an opponent owns a card in exile.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new ConditionalContinuousEffect(new BoostSourceEffect(2,2,Duration.WhileOnBattlefield), OpponentOwnsCardInExileCondition.getInstance(),
new ConditionalContinuousEffect(new BoostSourceEffect(2,2,Duration.WhileOnBattlefield), OpponentOwnsCardInExileCondition.instance,
"{this} gets +2/+2 as long as an opponent owns a card in exile")));
}
@ -76,13 +76,9 @@ public class WardenOfTheBeyond extends CardImpl {
}
}
class OpponentOwnsCardInExileCondition implements Condition {
enum OpponentOwnsCardInExileCondition implements Condition {
private static final OpponentOwnsCardInExileCondition instance = new OpponentOwnsCardInExileCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -29,6 +29,7 @@ package mage.cards.w;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.abilities.costs.AlternativeCostSourceAbility;
@ -43,17 +44,16 @@ import mage.target.common.TargetCreaturePermanent;
import mage.watchers.common.PermanentsEnteredBattlefieldWatcher;
/**
*
* @author jeffwadsworth
*/
public class WhiplashTrap extends CardImpl {
public WhiplashTrap(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{U}{U}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{U}{U}");
this.subtype.add("Trap");
// If an opponent had two or more creatures enter the battlefield under his or her control this turn, you may pay {U} rather than pay Whiplash Trap's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{U}"), WhiplashTrapCondition.getInstance()), new PermanentsEnteredBattlefieldWatcher());
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{U}"), WhiplashTrapCondition.instance), new PermanentsEnteredBattlefieldWatcher());
// Return two target creatures to their owners' hands.
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect());
@ -71,13 +71,9 @@ public class WhiplashTrap extends CardImpl {
}
}
class WhiplashTrapCondition implements Condition {
enum WhiplashTrapCondition implements Condition {
private static final WhiplashTrapCondition instance = new WhiplashTrapCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -58,7 +58,7 @@ public class WindbriskHeights extends CardImpl {
this.addAbility(new WhiteManaAbility());
// {W}, {tap}: You may play the exiled card without paying its mana cost if you attacked with three or more creatures this turn.
Ability ability = new ActivateIfConditionActivatedAbility(
Zone.BATTLEFIELD, new HideawayPlayEffect(), new ManaCostsImpl("{W}"), WindbriskHeightsAttackersCondition.getInstance());
Zone.BATTLEFIELD, new HideawayPlayEffect(), new ManaCostsImpl("{W}"), WindbriskHeightsAttackersCondition.instance);
ability.addCost(new TapSourceCost());
this.addAbility(ability, new PlayerAttackedWatcher());
@ -74,13 +74,9 @@ public class WindbriskHeights extends CardImpl {
}
}
class WindbriskHeightsAttackersCondition implements Condition {
enum WindbriskHeightsAttackersCondition implements Condition {
private static final WindbriskHeightsAttackersCondition instance = new WindbriskHeightsAttackersCondition();
public static Condition getInstance() {
return instance;
}
instance;
@Override
public boolean apply(Game game, Ability source) {

View file

@ -65,7 +65,7 @@ public class WindwrightMage extends CardImpl {
// Windwright Mage has flying as long as an artifact card is in your graveyard.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(
new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield),
WindwrightMageCondition.getInstance(),
WindwrightMageCondition.instance,
"{this} has flying as long as an artifact card is in your graveyard")));
}
@ -79,18 +79,14 @@ public class WindwrightMage extends CardImpl {
}
}
class WindwrightMageCondition implements Condition {
private static WindwrightMageCondition instance = new WindwrightMageCondition();
enum WindwrightMageCondition implements Condition {
instance;
private static final FilterCard filter = new FilterCard("artifact");
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
}
public static Condition getInstance() {
return instance;
}
@Override
public boolean apply(Game game, Ability source) {