and when the elk saw the breadth of his domain, he wept, for there was no more ConditionalInterveningIfTriggeredAbility to refactor

This commit is contained in:
theelk801 2025-06-12 19:58:54 -04:00
parent 59f7126f64
commit dbd07b9031
61 changed files with 466 additions and 632 deletions

View file

@ -4,7 +4,6 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.TreasureSpentToCastCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateTokenEffect;

View file

@ -8,7 +8,6 @@ import mage.abilities.Mode;
import mage.abilities.common.DiscardedByOpponentTriggeredAbility;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
import mage.abilities.keyword.ChangelingAbility;
@ -54,7 +53,7 @@ public final class OrvarTheAllForm extends CardImpl {
this.addAbility(new ChangelingAbility());
// Whenever you cast an instant or sorcery spell, if it targets one or more other permanents you control, create a token that's a copy of one of those permanents.
this.addAbility( new SpellCastControllerTriggeredAbility(
this.addAbility(new SpellCastControllerTriggeredAbility(
new OrvarTheAllFormEffect(),
StaticFilters.FILTER_SPELL_INSTANT_OR_SORCERY,
false, SetTargetPointer.SPELL
@ -113,7 +112,8 @@ enum OrvarTheAllFormCondition implements Condition {
class OrvarTheAllFormEffect extends OneShotEffect {
OrvarTheAllFormEffect() {
super(Outcome.Benefit);staticText="create a token that's a copy of one of those permanents.";
super(Outcome.Benefit);
staticText = "create a token that's a copy of one of those permanents.";
}
private OrvarTheAllFormEffect(final OrvarTheAllFormEffect effect) {

View file

@ -1,12 +1,10 @@
package mage.cards.r;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.CastFromEverywhereSourceCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.LearnEffect;
import mage.abilities.hint.common.OpenSideboardHint;
@ -42,7 +40,7 @@ public final class RetrieverPhoenix extends CardImpl {
// When Retriever Phoenix enters the battlefield, if you cast it, learn.
this.addAbility(new EntersBattlefieldTriggeredAbility(new LearnEffect())
.withInterveningIf( CastFromEverywhereSourceCondition.instance).addHint(OpenSideboardHint.instance));
.withInterveningIf(CastFromEverywhereSourceCondition.instance).addHint(OpenSideboardHint.instance));
// As long as Retriever Phoenix is in your graveyard, if you would learn, you may instead return Retriever Phoenix to the battlefield.
this.addAbility(new SimpleStaticAbility(Zone.GRAVEYARD, new RetrieverPhoenixEffect()));

View file

@ -1,11 +1,8 @@
package mage.cards.t;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.TributeNotPaidCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.TrampleAbility;
@ -13,17 +10,18 @@ import mage.abilities.keyword.TributeAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.SubType;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class ThunderBrute extends CardImpl {
public ThunderBrute(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{R}{R}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}{R}");
this.subtype.add(SubType.CYCLOPS);
this.power = new MageInt(5);
@ -36,7 +34,7 @@ public final class ThunderBrute extends CardImpl {
this.addAbility(new TributeAbility(3));
// When Thunder Brute enters the battlefield, if tribute wasn't paid, it gains haste until end of turn.
this.addAbility( new EntersBattlefieldTriggeredAbility(new GainAbilitySourceEffect(
this.addAbility(new EntersBattlefieldTriggeredAbility(new GainAbilitySourceEffect(
HasteAbility.getInstance(), Duration.EndOfTurn
).setText("it gains haste until end of turn")).withInterveningIf(TributeNotPaidCondition.instance));
}

View file

@ -1,17 +1,19 @@
package mage.cards.v;
import mage.abilities.Ability;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.LandfallAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.ExileZone;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -34,13 +36,8 @@ public final class ValakutExploration extends CardImpl {
this.addAbility(new LandfallAbility(new ValakutExplorationExileEffect()));
// At the beginning of your end step, if there are cards exiled with Valakut Exploration, put them into their owner's graveyard, then Valakut Exploration deals that much damage to each opponent.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new BeginningOfEndStepTriggeredAbility(
new ValakutExplorationDamageEffect()
), ValakutExplorationCondition.instance, "At the beginning of your end step, " +
"if there are cards exiled with {this}, put them into their owner's graveyard, " +
"then {this} deals that much damage to each opponent."
));
this.addAbility(new BeginningOfEndStepTriggeredAbility(new ValakutExplorationDamageEffect())
.withInterveningIf(ValakutExplorationCondition.instance));
}
private ValakutExploration(final ValakutExploration card) {
@ -63,6 +60,11 @@ enum ValakutExplorationCondition implements Condition {
));
return exileZone != null && !exileZone.isEmpty();
}
@Override
public String toString() {
return "there are cards exiled with {this}";
}
}
class ValakutExplorationExileEffect extends OneShotEffect {
@ -109,6 +111,7 @@ class ValakutExplorationDamageEffect extends OneShotEffect {
ValakutExplorationDamageEffect() {
super(Outcome.Benefit);
staticText = "put them into their owner's graveyard, then {this} deals that much damage to each opponent";
}
private ValakutExplorationDamageEffect(final ValakutExplorationDamageEffect effect) {

View file

@ -1,14 +1,13 @@
package mage.cards.v;
import mage.MageInt;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.YouGainedLifeCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.dynamicvalue.common.ControllerGainedLifeCount;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.LifelinkAbility;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -42,12 +41,8 @@ public final class ValkyrieHarbinger extends CardImpl {
this.addAbility(LifelinkAbility.getInstance());
// At the beginning of each end step, if you gained 4 or more life this turn, create a 4/4 white Angel creature token with flying and vigilance.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new BeginningOfEndStepTriggeredAbility(
TargetController.ANY, new CreateTokenEffect(new AngelVigilanceToken()),
false
), condition, "At the beginning of each end step, if you gained 4 or more life this turn, " +
"create a 4/4 white Angel creature token with flying and vigilance."
this.addAbility(new BeginningOfEndStepTriggeredAbility(
TargetController.ANY, new CreateTokenEffect(new AngelVigilanceToken()), false, condition
).addHint(ControllerGainedLifeCount.getHint()), new PlayerGainedLifeWatcher());
}

View file

@ -4,7 +4,6 @@ import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.OpponentsLostLifeCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.decorator.ConditionalReplacementEffect;
import mage.abilities.effects.common.EntersWithCountersControlledEffect;
import mage.abilities.effects.common.counter.AddCountersAllEffect;
@ -43,11 +42,9 @@ public final class VampireSocialite extends CardImpl {
this.addAbility(new MenaceAbility());
// When Vampire Socialite enters the battlefield, if an opponent lost life this turn, put a +1/+1 counter on each other Vampire you control.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new AddCountersAllEffect(CounterType.P1P1.createInstance(), filter)),
OpponentsLostLifeCondition.instance,
"When {this} enters, if an opponent lost life this turn, put a +1/+1 counter on each other Vampire you control."
));
this.addAbility(new EntersBattlefieldTriggeredAbility(
new AddCountersAllEffect(CounterType.P1P1.createInstance(), filter)
).withInterveningIf(OpponentsLostLifeCondition.instance));
// As long as an opponent lost life this turn, each other Vampire you control enters the battlefield with an additional +1/+1 counter on it.
this.addAbility(new SimpleStaticAbility(new ConditionalReplacementEffect(

View file

@ -4,7 +4,8 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.SourceMatchesFilterCondition;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
@ -19,10 +20,9 @@ import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.PowerPredicate;
import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentToken;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
@ -32,11 +32,15 @@ import java.util.UUID;
public final class VaultbornTyrant extends CardImpl {
private static final FilterPermanent filter = new FilterControlledCreaturePermanent("creature you control with power 4 or greater");
private static final FilterPermanent filter2 = new FilterPermanent("it's not a token");
static {
filter.add(new PowerPredicate(ComparisonType.OR_GREATER, 4));
filter2.add(TokenPredicate.FALSE);
}
private static final Condition condition = new SourceMatchesFilterCondition(filter2)
public VaultbornTyrant(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{G}{G}");
@ -55,15 +59,7 @@ public final class VaultbornTyrant extends CardImpl {
this.addAbility(ability);
// When Vaultborn Tyrant dies, if it's not a token, create a token that's a copy of it, except it's an artifact in addition to its other types.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new DiesSourceTriggeredAbility(
new VaultbornTyrantCreateCopyEffect(),
false
),
VaultbornTyrant::checkSource,
"When {this} dies, if it's not a token, create a token that's a copy of it, "
+ "except it's an artifact in addition to its other types."
));
this.addAbility(new DiesSourceTriggeredAbility(new VaultbornTyrantCreateCopyEffect()).withInterveningIf(condition));
}
private VaultbornTyrant(final VaultbornTyrant card) {
@ -74,16 +70,13 @@ public final class VaultbornTyrant extends CardImpl {
public VaultbornTyrant copy() {
return new VaultbornTyrant(this);
}
static boolean checkSource(Game game, Ability source) {
return !(source.getSourcePermanentOrLKI(game) instanceof PermanentToken);
}
}
class VaultbornTyrantCreateCopyEffect extends OneShotEffect {
VaultbornTyrantCreateCopyEffect() {
super(Outcome.PutCreatureInPlay);
staticText = "create a token that's a copy of it, except it's an artifact in addition to its other types";
}
private VaultbornTyrantCreateCopyEffect(final VaultbornTyrantCreateCopyEffect effect) {
@ -97,14 +90,9 @@ class VaultbornTyrantCreateCopyEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (permanent == null) {
return false;
}
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(
Permanent permanent = source.getSourcePermanentOrLKI(game);
return permanent != null && new CreateTokenCopyTargetEffect(
source.getControllerId(), CardType.ARTIFACT, false
);
effect.setTargetPointer(new FixedTarget(source.getSourceId(), game));
return effect.apply(game, source);
).setSavedPermanent(permanent).apply(game, source);
}
}

View file

@ -1,10 +1,9 @@
package mage.cards.v;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.condition.common.MetalcraftCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.continuous.LoseAllAbilitiesAllEffect;
import mage.abilities.effects.common.continuous.SetBasePowerToughnessAllEffect;
import mage.abilities.hint.common.MetalcraftHint;
@ -32,25 +31,14 @@ public final class VedalkenHumiliator extends CardImpl {
this.toughness = new MageInt(4);
// Metalcraft Whenever Vedalken Humiliator attacks, if you control three or more artifacts, creatures your opponents control lose all abilities and have base power and toughness 1/1 until end of turn.
TriggeredAbility ability = new AttacksTriggeredAbility(
new SetBasePowerToughnessAllEffect(
1, 1, Duration.EndOfTurn,
StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE
), false
);
ability.addEffect(new LoseAllAbilitiesAllEffect(
StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE,
Duration.EndOfTurn
));
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
ability, MetalcraftCondition.instance,
"Whenever {this} attacks, "
+ "if you control three or more artifacts, "
+ "creatures your opponents control lose all abilities "
+ "and have base power and toughness 1/1 until end of turn.")
.setAbilityWord(AbilityWord.METALCRAFT)
.addHint(MetalcraftHint.instance)
);
Ability ability = new AttacksTriggeredAbility(new LoseAllAbilitiesAllEffect(
StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURES, Duration.EndOfTurn
).setText("creatures your opponents control lose all abilities")).withInterveningIf(MetalcraftCondition.instance);
ability.addEffect(new SetBasePowerToughnessAllEffect(
1, 1, Duration.EndOfTurn,
StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE
).setText("and have base power and toughness 1/1 until end of turn"));
this.addAbility(ability.setAbilityWord(AbilityWord.METALCRAFT).addHint(MetalcraftHint.instance));
}
private VedalkenHumiliator(final VedalkenHumiliator card) {

View file

@ -1,11 +1,9 @@
package mage.cards.v;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.SpellCastOpponentTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.SourceMatchesFilterCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
@ -13,26 +11,26 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.filter.common.FilterEnchantmentPermanent;
import mage.game.permanent.token.TokenImpl;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public final class VeilOfBirds extends CardImpl {
private static final FilterSpell filter = new FilterSpell();
private static final Condition condition = new SourceMatchesFilterCondition(new FilterEnchantmentPermanent("{this} is an enchantment"));
public VeilOfBirds(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{U}");
// When an opponent casts a spell, if Veil of Birds is an enchantment, Veil of Birds becomes a 1/1 Bird creature with flying.
TriggeredAbility ability = new SpellCastOpponentTriggeredAbility(new BecomesCreatureSourceEffect(new VeilOfBirdsToken(), null, Duration.WhileOnBattlefield),
filter, false);
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, new SourceMatchesFilterCondition(StaticFilters.FILTER_PERMANENT_ENCHANTMENT),
"When an opponent casts a spell, if {this} is an enchantment, {this} becomes a 1/1 Bird creature with flying."));
this.addAbility(new SpellCastOpponentTriggeredAbility(new BecomesCreatureSourceEffect(
new VeilOfBirdsToken(), null, Duration.WhileOnBattlefield
), StaticFilters.FILTER_SPELL_A, false).withInterveningIf(condition));
}
private VeilOfBirds(final VeilOfBirds card) {

View file

@ -1,11 +1,10 @@
package mage.cards.v;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.SpellCastOpponentTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.SourceMatchesFilterCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.SacrificeSourceUnlessPaysEffect;
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
import mage.abilities.keyword.FlyingAbility;
@ -15,29 +14,26 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.filter.common.FilterEnchantmentPermanent;
import mage.game.permanent.token.TokenImpl;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public final class VeiledApparition extends CardImpl {
private static final FilterSpell filter = new FilterSpell();
private static final Condition condition = new SourceMatchesFilterCondition(new FilterEnchantmentPermanent("{this} is an enchantment"));
public VeiledApparition(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
// When an opponent casts a spell, if Veiled Apparition is an enchantment, Veiled Apparition becomes a 3/3 Illusion creature with flying and "At the beginning of your upkeep, sacrifice Veiled Apparition unless you pay {1}{U}."
TriggeredAbility ability = new SpellCastOpponentTriggeredAbility(new BecomesCreatureSourceEffect(new VeiledApparitionToken(), null, Duration.WhileOnBattlefield),
filter, false);
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, new SourceMatchesFilterCondition(StaticFilters.FILTER_PERMANENT_ENCHANTMENT),
"When an opponent casts a spell, if {this} is an enchantment, {this} becomes a 3/3 Illusion creature with flying and \"At the beginning of your upkeep, sacrifice Veiled Apparition unless you pay {1}{U}.\""));
this.addAbility(new SpellCastOpponentTriggeredAbility(new BecomesCreatureSourceEffect(
new VeiledApparitionToken(), null, Duration.WhileOnBattlefield
), StaticFilters.FILTER_SPELL_A, false).withInterveningIf(condition));
}
private VeiledApparition(final VeiledApparition card) {
@ -53,7 +49,7 @@ public final class VeiledApparition extends CardImpl {
class VeiledApparitionToken extends TokenImpl {
VeiledApparitionToken() {
super("Illusion", "3/3 Illusion creature with flying and \"At the beginning of your upkeep, sacrifice Veiled Apparition unless you pay {1}{U}.");
super("Illusion", "3/3 Illusion creature with flying and \"At the beginning of your upkeep, sacrifice {this} unless you pay {1}{U}.");
cardType.add(CardType.CREATURE);
subtype.add(SubType.ILLUSION);
power = new MageInt(3);

View file

@ -4,12 +4,11 @@ import mage.abilities.Ability;
import mage.abilities.common.SpellCastOpponentTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.SourceMatchesFilterCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.filter.common.FilterEnchantmentPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
@ -21,17 +20,13 @@ import java.util.UUID;
*/
public final class VeiledSentry extends CardImpl {
private static final Condition condition = new SourceMatchesFilterCondition(StaticFilters.FILTER_PERMANENT_ENCHANTMENT);
private static final Condition condition = new SourceMatchesFilterCondition(new FilterEnchantmentPermanent("{this} is an enchantment"));
public VeiledSentry(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{U}");
// When an opponent casts a spell, if Veiled Sentry is an enchantment, Veiled Sentry becomes an Illusion creature with power and toughness each equal to that spell's converted mana cost.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new SpellCastOpponentTriggeredAbility(new VeiledSentryEffect(), false),
condition, "When an opponent casts a spell, if {this} is an enchantment, " +
"{this} becomes an Illusion creature with power and toughness each equal to that spell's mana value."
));
this.addAbility(new SpellCastOpponentTriggeredAbility(new VeiledSentryEffect(), false).withInterveningIf(condition));
}
private VeiledSentry(final VeiledSentry card) {

View file

@ -1,13 +1,11 @@
package mage.cards.v;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SpellCastOpponentTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.SourceMatchesFilterCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.combat.CantAttackUnlessDefenderControllsPermanent;
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
import mage.abilities.keyword.CyclingAbility;
@ -16,30 +14,30 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.filter.common.FilterEnchantmentPermanent;
import mage.filter.common.FilterLandPermanent;
import mage.game.permanent.token.TokenImpl;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public final class VeiledSerpent extends CardImpl {
private static final Condition condition = new SourceMatchesFilterCondition(new FilterEnchantmentPermanent("{this} is an enchantment"));
public VeiledSerpent(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}");
// When an opponent casts a spell, if Veiled Serpent is an enchantment, Veiled Serpent becomes a 4/4 Serpent creature that can't attack unless defending player controls an Island.
TriggeredAbility ability = new SpellCastOpponentTriggeredAbility(new BecomesCreatureSourceEffect(new VeiledSerpentToken(), null, Duration.WhileOnBattlefield),
new FilterSpell(), false);
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, new SourceMatchesFilterCondition(StaticFilters.FILTER_PERMANENT_ENCHANTMENT),
"When an opponent casts a spell, if {this} is an enchantment, {this} becomes a 4/4 Serpent creature that can't attack unless defending player controls an Island."));
this.addAbility(new SpellCastOpponentTriggeredAbility(new BecomesCreatureSourceEffect(
new VeiledSerpentToken(), null, Duration.WhileOnBattlefield
), StaticFilters.FILTER_SPELL_A, false).withInterveningIf(condition));
// Cycling {2}
this.addAbility(new CyclingAbility(new ManaCostsImpl<>("{2}")));
}
private VeiledSerpent(final VeiledSerpent card) {

View file

@ -5,7 +5,6 @@ import mage.MageObject;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.KickedCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.dynamicvalue.common.GetXValue;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.continuous.BoostAllEffect;
@ -54,10 +53,9 @@ public final class VerdelothTheAncient extends CardImpl {
)));
// When Verdeloth the Ancient enters the battlefield, if it was kicked, create X 1/1 green Saproling creature tokens.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(new EntersBattlefieldTriggeredAbility(
new CreateTokenEffect(new SaprolingToken(), GetXValue.instance), false
), KickedCondition.ONCE, "When {this} enters, " +
"if it was kicked, create X 1/1 green Saproling creature tokens."));
this.addAbility(new EntersBattlefieldTriggeredAbility(
new CreateTokenEffect(new SaprolingToken(), GetXValue.instance)
).withInterveningIf(KickedCondition.ONCE));
}
private VerdelothTheAncient(final VerdelothTheAncient card) {

View file

@ -1,12 +1,9 @@
package mage.cards.v;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.KickedCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.keyword.KickerAbility;
import mage.cards.CardImpl;
@ -15,14 +12,15 @@ import mage.constants.CardType;
import mage.constants.SubType;
import mage.target.common.TargetArtifactPermanent;
import java.util.UUID;
/**
*
* @author FenrisulfrX
*/
public final class VerduranEmissary extends CardImpl {
public VerduranEmissary(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{G}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(2);
@ -32,10 +30,9 @@ public final class VerduranEmissary extends CardImpl {
this.addAbility(new KickerAbility("{1}{R}"));
// When {this} enters, if it was kicked, destroy target artifact. It can't be regenerated.
TriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect(true));
Ability ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect(true)).withInterveningIf(KickedCondition.ONCE);
ability.addTarget(new TargetArtifactPermanent());
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, KickedCondition.ONCE,
"When {this} enters, if it was kicked, destroy target artifact. It can't be regenerated."));
this.addAbility(ability);
}
private VerduranEmissary(final VerduranEmissary card) {

View file

@ -1,11 +1,8 @@
package mage.cards.v;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.KickedCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.KickerAbility;
@ -16,9 +13,11 @@ import mage.constants.SubType;
import mage.constants.SuperType;
import mage.game.permanent.token.KaroxBladewingDragonToken;
import java.util.UUID;
/**
* @author JRHerlehy
* Created on 4/5/18.
* Created on 4/5/18.
*/
public final class VerixBladewing extends CardImpl {
@ -38,12 +37,7 @@ public final class VerixBladewing extends CardImpl {
// When Verix Bladewing enters the battlefield, if it was kicked, create Karox Bladewing,
// a legendary 4/4 red Dragon creature token with flying.
EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(
new CreateTokenEffect(new KaroxBladewingDragonToken()));
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, KickedCondition.ONCE,
"When {this} enters, if it was kicked, create Karox Bladewing, " +
"a legendary 4/4 red Dragon creature token with flying."));
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new KaroxBladewingDragonToken())).withInterveningIf(KickedCondition.ONCE));
}
private VerixBladewing(final VerixBladewing card) {

View file

@ -5,7 +5,7 @@ import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.common.DealsDamageSourceTriggeredAbility;
import mage.abilities.common.DealsDamageToAPlayerTriggeredAbility;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.effects.common.LoseGameTargetPlayerEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.TrampleAbility;
@ -49,12 +49,9 @@ public final class VesselOfTheAllConsuming extends CardImpl {
this.addAbility(new DealsDamageSourceTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance())));
// Whenever Vessel of the All-Consuming deals damage to a player, if it has dealt 10 or more damage to that player this turn, they lose the game.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new DealsDamageToAPlayerTriggeredAbility(
new LoseGameTargetPlayerEffect(), false, true
), VesselOfTheAllConsumingWatcher::checkPermanent, "Whenever {this} deals damage to a player, " +
"if it has dealt 10 or more damage to that player this turn, they lose the game."
));
this.addAbility(new DealsDamageToAPlayerTriggeredAbility(
new LoseGameTargetPlayerEffect(), false, true
).withInterveningIf(VesselOfTheAllConsumingCondition.instance));
}
private VesselOfTheAllConsuming(final VesselOfTheAllConsuming card) {
@ -71,6 +68,20 @@ public final class VesselOfTheAllConsuming extends CardImpl {
}
}
enum VesselOfTheAllConsumingCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
return VesselOfTheAllConsumingWatcher.checkPermanent(game, source);
}
@Override
public String toString() {
return "it has dealt 10 or more damage to that player this turn";
}
}
class VesselOfTheAllConsumingWatcher extends Watcher {
private final Map<Entry<MageObjectReference, UUID>, Integer> morMap = new HashMap<>();

View file

@ -1,18 +1,20 @@
package mage.cards.v;
import mage.MageInt;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.ChooseABackgroundAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.CardsInControllerGraveyardCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount;
import mage.abilities.effects.common.ReturnFromGraveyardAtRandomEffect;
import mage.abilities.hint.Hint;
import mage.abilities.hint.ValueHint;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import java.util.UUID;
@ -39,12 +41,9 @@ public final class ViconiaDrowApostate extends CardImpl {
this.toughness = new MageInt(3);
// At the beginning of your upkeep, if there are four or more creature cards in your graveyard, return a creature card at random from your graveyard to your hand.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(
new ReturnFromGraveyardAtRandomEffect(StaticFilters.FILTER_CARD_CREATURE, Zone.HAND), false
), condition, "At the beginning of your upkeep, if there are four or more creature cards " +
"in your graveyard, return a creature card at random from your graveyard to your hand."
).addHint(hint));
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
new ReturnFromGraveyardAtRandomEffect(StaticFilters.FILTER_CARD_CREATURE, Zone.HAND)
).withInterveningIf(condition).addHint(hint));
// Choose a Background
this.addAbility(ChooseABackgroundAbility.getInstance());

View file

@ -3,7 +3,6 @@ package mage.cards.v;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.KickedCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.keyword.KickerAbility;
import mage.cards.CardImpl;
@ -30,14 +29,9 @@ public final class VineshaperProdigy extends CardImpl {
this.addAbility(new KickerAbility("{1}{U}"));
// When Vineshaper Prodigy enters the battlefield, if it was kicked, look at the top three cards of your library. Put one of them into your hand and the rest on the bottom of your library in any order.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(
new LookLibraryAndPickControllerEffect(
3, 1, PutCards.HAND, PutCards.BOTTOM_ANY
)), KickedCondition.ONCE, "When {this} enters, " +
"if it was kicked, look at the top three cards of your library. " +
"Put one of them into your hand and the rest on the bottom of your library in any order."
));
this.addAbility(new EntersBattlefieldTriggeredAbility(new LookLibraryAndPickControllerEffect(
3, 1, PutCards.HAND, PutCards.BOTTOM_ANY
)).withInterveningIf(KickedCondition.ONCE));
}
private VineshaperProdigy(final VineshaperProdigy card) {

View file

@ -4,7 +4,6 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.CollectedEvidenceCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.abilities.keyword.CollectEvidenceAbility;
@ -38,12 +37,10 @@ public final class VituGhaziInspector extends CardImpl {
this.addAbility(ReachAbility.getInstance());
// When Vitu-Ghazi Inspector enters the battlefield, if evidence was collected, put a +1/+1 counter on target creature and you gain 2 life.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new AddCountersTargetEffect(CounterType.P1P1.createInstance())),
CollectedEvidenceCondition.instance, "When {this} enters, if evidence was " +
"collected, put a +1/+1 counter on target creature and you gain 2 life."
);
ability.addEffect(new GainLifeEffect(2));
Ability ability = new EntersBattlefieldTriggeredAbility(
new AddCountersTargetEffect(CounterType.P1P1.createInstance())
).withInterveningIf(CollectedEvidenceCondition.instance);
ability.addEffect(new GainLifeEffect(2).concatBy("and"));
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}

View file

@ -4,7 +4,6 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.CorruptedCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl;
@ -43,12 +42,8 @@ public final class VivisectionEvangelist extends CardImpl {
this.addAbility(VigilanceAbility.getInstance());
// Corrupted -- When Vivisection Evangelist enters the battlefield, if an opponent has three or more poison counters, destroy target creature or planeswalker an opponent controls.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect(), false),
CorruptedCondition.instance, "When {this} enters, " +
"if an opponent has three or more poison counters, " +
"destroy target creature or planeswalker an opponent controls."
);
Ability ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect())
.withInterveningIf(CorruptedCondition.instance);
ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability.setAbilityWord(AbilityWord.CORRUPTED).addHint(CorruptedCondition.getHint()));
}

View file

@ -4,7 +4,6 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.OpponentsLostLifeCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.DamageTargetEffect;
@ -25,8 +24,9 @@ import java.util.UUID;
*/
public final class VoldarenAmbusher extends CardImpl {
private static final DynamicValue xValue
= new PermanentsOnBattlefieldCount(new FilterControlledPermanent(SubType.VAMPIRE));
private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(
new FilterControlledPermanent(SubType.VAMPIRE, "Vampires you control")
);
private static final Hint hint = new ValueHint("Vampires you control", xValue);
public VoldarenAmbusher(UUID ownerId, CardSetInfo setInfo) {
@ -38,12 +38,8 @@ public final class VoldarenAmbusher extends CardImpl {
this.toughness = new MageInt(2);
// When Voldaren Ambusher enters the battlefield, if an opponent lost life this turn, it deals X damage to up to one target creature or planeswalker, where X is the number of Vampires you control.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(xValue)),
OpponentsLostLifeCondition.instance, "When {this} enters, " +
"if an opponent lost life this turn, it deals X damage to up to one target " +
"creature or planeswalker, where X is the number of Vampires you control."
);
Ability ability = new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(xValue, "it"))
.withInterveningIf(OpponentsLostLifeCondition.instance);
ability.addTarget(new TargetCreatureOrPlaneswalker(0, 1));
this.addAbility(ability.addHint(OpponentsLostLifeHint.instance).addHint(hint));
}

View file

@ -1,20 +1,20 @@
package mage.cards.v;
import mage.abilities.Ability;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.condition.common.SourceTappedCondition;
import mage.abilities.costs.CostAdjuster;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.CountersSourceCount;
import mage.abilities.effects.common.DamageControllerEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.DestroySourceEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -30,6 +30,8 @@ import java.util.UUID;
*/
public final class VoodooDoll extends CardImpl {
private static final DynamicValue xValue = new CountersSourceCount(CounterType.PIN);
public VoodooDoll(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{6}");
@ -39,13 +41,10 @@ public final class VoodooDoll extends CardImpl {
));
// At the beginning of your end step, if Voodoo Doll is untapped, destroy Voodoo Doll and it deals damage to you equal to the number of pin counters on it.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new BeginningOfEndStepTriggeredAbility(
new DestroySourceEffect()
), SourceTappedCondition.UNTAPPED, "At the beginning of your end step, " +
"if {this} is untapped, destroy {this} and it deals damage to you equal to the number of pin counters on it."
);
ability.addEffect(new DamageControllerEffect(new CountersSourceCount(CounterType.PIN)));
Ability ability = new BeginningOfEndStepTriggeredAbility(new DestroySourceEffect())
.withInterveningIf(SourceTappedCondition.UNTAPPED);
ability.addEffect(new DamageControllerEffect(xValue)
.setText("and it deals damage to you equal to the number of pin counters on it"));
this.addAbility(ability);
// {X}{X}, {T}: Voodoo Doll deals damage equal to the number of pin counters on it to any target. X is the number of pin counters on Voodoo Doll.

View file

@ -1,19 +1,19 @@
package mage.cards.v;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.Ability;
import mage.abilities.common.AttacksOrBlocksTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.abilities.hint.ConditionHint;
import mage.abilities.hint.Hint;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.common.FilterControlledPlaneswalkerPermanent;
import mage.target.common.TargetOpponent;
import java.util.UUID;
@ -23,12 +23,10 @@ import java.util.UUID;
*/
public final class VraskasConquistador extends CardImpl {
private static final FilterControlledPermanent filter = new FilterControlledPermanent();
static {
filter.add(CardType.PLANESWALKER.getPredicate());
filter.add(SubType.VRASKA.getPredicate());
}
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(
new FilterControlledPlaneswalkerPermanent(SubType.VRASKA, "you control a Vraska planeswalker")
);
private static final Hint hint = new ConditionHint(condition);
public VraskasConquistador(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}");
@ -39,14 +37,12 @@ public final class VraskasConquistador extends CardImpl {
this.toughness = new MageInt(1);
// Whenever Vraska's Conquistador attacks or blocks, if you control a Vraska planeswalker, target opponent loses 2 life and you gain 2 life.
Condition condition = new PermanentsOnTheBattlefieldCondition(filter);
TriggeredAbility ability = new AttacksOrBlocksTriggeredAbility(new LoseLifeTargetEffect(2), false);
Ability ability = new AttacksOrBlocksTriggeredAbility(
new LoseLifeTargetEffect(2), false
).withInterveningIf(condition);
ability.addEffect(new GainLifeEffect(2).concatBy("and"));
ability.addTarget(new TargetOpponent());
ability.addHint(new ConditionHint(condition, "You control a Vraska planeswalker"));
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
ability, condition,
"Whenever {this} attacks or blocks, if you control a Vraska planeswalker, target opponent loses 2 life and you gain 2 life."));
this.addAbility(ability.addHint(hint));
}
private VraskasConquistador(final VraskasConquistador card) {

View file

@ -1,12 +1,8 @@
package mage.cards.w;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.MorbidCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.hint.common.MorbidHint;
import mage.cards.CardImpl;
@ -15,16 +11,15 @@ import mage.constants.CardType;
import mage.constants.SubType;
import mage.game.permanent.token.ZombieToken;
import java.util.UUID;
/**
*
* @author Loki
*/
public final class Wakedancer extends CardImpl {
private static final String staticText = "<i>Morbid</i> &mdash; When {this} enters, if a creature died this turn, create a 2/2 black Zombie creature token.";
public Wakedancer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.SHAMAN);
@ -33,8 +28,8 @@ public final class Wakedancer extends CardImpl {
this.toughness = new MageInt(2);
// <i>Morbid</i> &mdash; When Wakedancer enters the battlefield, if a creature died this turn, create a 2/2 black Zombie creature token.
TriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new ZombieToken()));
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, MorbidCondition.instance, staticText).addHint(MorbidHint.instance));
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new ZombieToken()))
.withInterveningIf(MorbidCondition.instance).addHint(MorbidHint.instance));
}
private Wakedancer(final Wakedancer card) {

View file

@ -1,11 +1,8 @@
package mage.cards.w;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.CastFromHandSourcePermanentCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.DestroyAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -15,8 +12,9 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.watchers.common.CastFromHandWatcher;
import java.util.UUID;
/**
*
* @author TheElk801
*/
public final class WakeningSunsAvatar extends CardImpl {
@ -36,11 +34,8 @@ public final class WakeningSunsAvatar extends CardImpl {
this.toughness = new MageInt(7);
// When Wakening Sun's Avatar enters the battlefield, if you cast it from you hand, destroy all non-Dinosaur creatures.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new DestroyAllEffect(filter), false),
CastFromHandSourcePermanentCondition.instance,
"When {this} enters, if you cast it from your hand, destroy all non-Dinosaur creatures."),
new CastFromHandWatcher());
this.addAbility(new EntersBattlefieldTriggeredAbility(new DestroyAllEffect(filter))
.withInterveningIf(CastFromHandSourcePermanentCondition.instance), new CastFromHandWatcher());
}
private WakeningSunsAvatar(final WakeningSunsAvatar card) {

View file

@ -2,12 +2,11 @@ package mage.cards.w;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.DefenderAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -38,12 +37,9 @@ public final class WallOfResistance extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// At the beginning of each end step, if Wall of Resistance was dealt damage this turn, put a +0/+1 counter on it.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new BeginningOfEndStepTriggeredAbility(
TargetController.ANY, new AddCountersSourceEffect(CounterType.P0P1.createInstance()),
false
), WallOfResistanceCondition.instance, "At the beginning of each end step, " +
"if {this} was dealt damage this turn, put a +0/+1 counter on it."
this.addAbility(new BeginningOfEndStepTriggeredAbility(
TargetController.ANY, new AddCountersSourceEffect(CounterType.P0P1.createInstance()),
false, WallOfResistanceCondition.instance
));
}
@ -65,4 +61,9 @@ enum WallOfResistanceCondition implements Condition {
Permanent permanent = source.getSourcePermanentOrLKI(game);
return permanent != null && !permanent.getDealtDamageByThisTurn().isEmpty();
}
@Override
public String toString() {
return "{this} was dealt damage this turn";
}
}

View file

@ -2,17 +2,17 @@ package mage.cards.w;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.costs.common.DiscardCardCost;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
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.SubType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate;
@ -24,12 +24,17 @@ import java.util.UUID;
*/
public final class WanderingChampion extends CardImpl {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("green permanent");
private static final FilterPermanent filter = new FilterControlledPermanent("you control a blue or red permanent");
static {
filter.add(Predicates.or(new ColorPredicate(ObjectColor.BLUE), new ColorPredicate(ObjectColor.RED)));
filter.add(Predicates.or(
new ColorPredicate(ObjectColor.BLUE),
new ColorPredicate(ObjectColor.RED)
));
}
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(filter);
public WanderingChampion(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}");
this.subtype.add(SubType.HUMAN);
@ -38,10 +43,9 @@ public final class WanderingChampion extends CardImpl {
this.toughness = new MageInt(1);
// Whenever Wandering Champion deals combat damage to a player, if you control a blue or red permanent, you may discard a card. If you do, draw a card.
TriggeredAbility ability = new DealsCombatDamageToAPlayerTriggeredAbility(new DoIfCostPaid(new DrawCardSourceControllerEffect(1), new DiscardCardCost()), false);
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, new PermanentsOnTheBattlefieldCondition(filter),
"Whenever {this} deals combat damage to a player, if you control a blue or red permanent, you may discard a card. If you do, draw a card."));
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(
new DoIfCostPaid(new DrawCardSourceControllerEffect(1), new DiscardCardCost())
).withInterveningIf(condition));
}
private WanderingChampion(final WanderingChampion card) {

View file

@ -1,20 +1,19 @@
package mage.cards.w;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.abilities.condition.common.LandfallCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.keyword.VentureIntoTheDungeonEffect;
import mage.abilities.hint.common.CurrentDungeonHint;
import mage.constants.SubType;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.watchers.common.LandfallWatcher;
import java.util.UUID;
/**
*
* @author weirddan455
*/
public final class WanderingTroubadour extends CardImpl {
@ -28,11 +27,8 @@ public final class WanderingTroubadour extends CardImpl {
this.toughness = new MageInt(2);
// At the beginning of your end step, if you had a land enter the battlefield under your control this turn, venture into the dungeon.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new BeginningOfEndStepTriggeredAbility(new VentureIntoTheDungeonEffect()),
LandfallCondition.instance,
"At the beginning of your end step, if you had a land enter the battlefield under your control this turn, venture into the dungeon."
).addHint(CurrentDungeonHint.instance), new LandfallWatcher());
this.addAbility(new BeginningOfEndStepTriggeredAbility(new VentureIntoTheDungeonEffect())
.withInterveningIf(LandfallCondition.instance).addHint(CurrentDungeonHint.instance), new LandfallWatcher());
}
private WanderingTroubadour(final WanderingTroubadour card) {

View file

@ -1,20 +1,18 @@
package mage.cards.w;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BecomesTappedSourceTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.condition.OrCondition;
import mage.abilities.condition.common.EnchantedSourceCondition;
import mage.abilities.condition.common.EquippedSourceCondition;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.DwarfBerserkerToken;
import java.util.Objects;
import java.util.UUID;
/**
@ -22,6 +20,12 @@ import java.util.UUID;
*/
public final class WarchanterSkald extends CardImpl {
private static final Condition condition = new OrCondition(
"it's enchanted or equipped",
new EnchantedSourceCondition(),
EquippedSourceCondition.instance
);
public WarchanterSkald(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}");
@ -31,11 +35,7 @@ public final class WarchanterSkald extends CardImpl {
this.toughness = new MageInt(3);
// Whenever Warchanter Skald becomes tapped, if it's enchanted or equipped, create a 2/1 red Dwarf Berserker creature token.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new BecomesTappedSourceTriggeredAbility(new CreateTokenEffect(new DwarfBerserkerToken())),
WarchanterSkaldCondition.instance, "Whenever {this} becomes tapped, " +
"if it's enchanted or equipped, create a 2/1 red Dwarf Berserker creature token."
));
this.addAbility(new BecomesTappedSourceTriggeredAbility(new CreateTokenEffect(new DwarfBerserkerToken())).withInterveningIf(condition));
}
private WarchanterSkald(final WarchanterSkald card) {
@ -47,18 +47,3 @@ public final class WarchanterSkald extends CardImpl {
return new WarchanterSkald(this);
}
}
enum WarchanterSkaldCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = source.getSourcePermanentOrLKI(game);
return permanent != null && permanent
.getAttachments()
.stream()
.map(game::getPermanent)
.filter(Objects::nonNull)
.anyMatch(p -> p.hasSubtype(SubType.AURA, game) || p.hasSubtype(SubType.EQUIPMENT, game));
}
}

View file

@ -1,9 +1,9 @@
package mage.cards.w;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.KickedCostCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.CastSourceTriggeredAbility;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
@ -14,10 +14,9 @@ import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.target.common.TargetOpponentsCreaturePermanent;
import java.util.UUID;
@ -33,6 +32,9 @@ public final class WastescapeBattlemage extends CardImpl {
filter.add(TargetController.OPPONENT.getControllerPredicate());
}
private static final Condition condition = new KickedCostCondition("{G}");
private static final Condition condition2 = new KickedCostCondition("{1}{U}");
public WastescapeBattlemage(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{C}");
@ -47,16 +49,14 @@ public final class WastescapeBattlemage extends CardImpl {
this.addAbility(kickerAbility);
// When you cast this spell, if it was kicked with its {G} kicker, exile target artifact or enchantment an opponent controls.
TriggeredAbility ability = new CastSourceTriggeredAbility(new ExileTargetEffect());
Ability ability = new CastSourceTriggeredAbility(new ExileTargetEffect()).withInterveningIf(condition);
ability.addTarget(new TargetPermanent(filter));
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, new KickedCostCondition("{G}"),
"When you cast this spell, if it was kicked with its {G} kicker, exile target artifact or enchantment an opponent controls."));
this.addAbility(ability);
// When you cast this spell, if it was kicked with its {1}{U} kicker, return target creature an opponent controls to its owner's hand.
TriggeredAbility ability2 = new CastSourceTriggeredAbility(new ReturnToHandTargetEffect());
ability2.addTarget(new TargetCreaturePermanent(StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE));
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability2, new KickedCostCondition("{1}{U}"),
"When you cast this spell, if it was kicked with its {1}{U} kicker, return target creature an opponent controls to its owner's hand."));
ability = new CastSourceTriggeredAbility(new ReturnToHandTargetEffect()).withInterveningIf(condition2);
ability.addTarget(new TargetOpponentsCreaturePermanent());
this.addAbility(ability);
}
private WastescapeBattlemage(final WastescapeBattlemage card) {

View file

@ -1,11 +1,9 @@
package mage.cards.w;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.KickedCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.ReturnToHandFromBattlefieldAllEffect;
import mage.abilities.effects.common.turn.SkipNextTurnSourceEffect;
import mage.abilities.keyword.FlyingAbility;
@ -17,8 +15,9 @@ import mage.constants.SubType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AnotherPredicate;
import java.util.UUID;
/**
*
* @author LoneFox
*/
public final class WaterspoutElemental extends CardImpl {
@ -30,20 +29,21 @@ public final class WaterspoutElemental extends CardImpl {
}
public WaterspoutElemental(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{U}{U}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{U}");
this.subtype.add(SubType.ELEMENTAL);
this.power = new MageInt(3);
this.toughness = new MageInt(4);
// Kicker {U}
this.addAbility(new KickerAbility("{U}"));
// Flying
this.addAbility(FlyingAbility.getInstance());
// When Waterspout Elemental enters the battlefield, if it was kicked, return all other creatures to their owners' hands and you skip your next turn.
EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandFromBattlefieldAllEffect(filter));
ability.addEffect(new SkipNextTurnSourceEffect());
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, KickedCondition.ONCE,
"When {this} enters, if it was kicked, return all other creatures to their owners' hands and you skip your next turn."));
Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandFromBattlefieldAllEffect(filter)).withInterveningIf(KickedCondition.ONCE);
ability.addEffect(new SkipNextTurnSourceEffect().concatBy("and"));
this.addAbility(ability);
}
private WaterspoutElemental(final WaterspoutElemental card) {

View file

@ -5,7 +5,6 @@ import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
@ -35,12 +34,9 @@ public final class WaterspoutWarden extends CardImpl {
this.toughness = new MageInt(2);
// Whenever Waterspout Warden attacks, if another creature entered the battlefield under your control this turn, Waterspout Warden gains flying until end of turn.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new AttacksTriggeredAbility(new GainAbilitySourceEffect(
FlyingAbility.getInstance(), Duration.EndOfTurn
)), WaterspoutWardenCondition.instance, "Whenever {this} attacks, if another creature entered " +
"the battlefield under your control this turn, {this} gains flying until end of turn."
), new WaterspoutWardenWatcher());
this.addAbility(new AttacksTriggeredAbility(new GainAbilitySourceEffect(
FlyingAbility.getInstance(), Duration.EndOfTurn
)).withInterveningIf(WaterspoutWardenCondition.instance), new WaterspoutWardenWatcher());
}
private WaterspoutWarden(final WaterspoutWarden card) {
@ -60,6 +56,11 @@ enum WaterspoutWardenCondition implements Condition {
public boolean apply(Game game, Ability source) {
return WaterspoutWardenWatcher.checkPermanent(game, source);
}
@Override
public String toString() {
return "another creature entered the battlefield under your control this turn";
}
}
class WaterspoutWardenWatcher extends Watcher {

View file

@ -4,7 +4,6 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlSourceEffect;
import mage.abilities.keyword.BlitzAbility;
import mage.abilities.keyword.TrampleAbility;
@ -34,12 +33,8 @@ public class WaveOfRats extends CardImpl {
this.addAbility(TrampleAbility.getInstance());
// When Wave of Rats dies, if it dealt combat damage to a player this turn, return it to the battlefield under its owners control.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new DiesSourceTriggeredAbility(new ReturnToBattlefieldUnderOwnerControlSourceEffect()),
WaveOfRatsDealtDamageToPlayerCondition.instance,
"When Wave of Rats dies, if it dealt combat damage to a player this turn, return it to the battlefield under its owner's control."),
new DamageDoneWatcher()
);
this.addAbility(new DiesSourceTriggeredAbility(new ReturnToBattlefieldUnderOwnerControlSourceEffect())
.withInterveningIf(WaveOfRatsDealtDamageToPlayerCondition.instance), new DamageDoneWatcher());
// Blitz {4}{B} (If you cast this spell for its blitz cost, it gains haste and When this creature dies, draw a card. Sacrifice it at the beginning of the next end step.)
this.addAbility(new BlitzAbility(this, "{4}{B}"));
@ -70,4 +65,9 @@ enum WaveOfRatsDealtDamageToPlayerCondition implements Condition {
}
return watcher.damagedAPlayer(waveOfRats.getId(), waveOfRats.getZoneChangeCounter(game), game);
}
@Override
public String toString() {
return "it dealt combat damage to a player this turn";
}
}

View file

@ -5,7 +5,6 @@ import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.TapTargetEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.abilities.hint.ConditionHint;
@ -16,6 +15,7 @@ import mage.constants.CardType;
import mage.constants.SubType;
import mage.counters.CounterType;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledArtifactPermanent;
import mage.target.TargetPermanent;
import java.util.UUID;
@ -25,8 +25,10 @@ import java.util.UUID;
*/
public final class WaylayingPirates extends CardImpl {
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT);
private static final Hint hint = new ConditionHint(condition, "You control an artifact");
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(
new FilterControlledArtifactPermanent("you control an artifact")
);
private static final Hint hint = new ConditionHint(condition);
public WaylayingPirates(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}");
@ -37,12 +39,8 @@ public final class WaylayingPirates extends CardImpl {
this.toughness = new MageInt(3);
// When Waylaying Pirates enters the battlefield, if you control an artifact, tap target artifact or creature an opponent controls and put a stun counter on it.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new TapTargetEffect()),
condition, "When {this} enters, if you control an artifact, " +
"tap target artifact or creature an opponent controls and put a stun counter on it."
);
ability.addEffect(new AddCountersTargetEffect(CounterType.STUN.createInstance()));
Ability ability = new EntersBattlefieldTriggeredAbility(new TapTargetEffect()).withInterveningIf(condition);
ability.addEffect(new AddCountersTargetEffect(CounterType.STUN.createInstance()).setText("and put a stun counter on it"));
ability.addTarget(new TargetPermanent(StaticFilters.FILTER_OPPONENTS_PERMANENT_ARTIFACT_OR_CREATURE));
this.addAbility(ability.addHint(hint));
}

View file

@ -5,7 +5,6 @@ import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.condition.Condition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.ReturnSourceFromGraveyardToHandEffect;
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
import mage.abilities.keyword.TrampleAbility;
@ -43,11 +42,9 @@ public final class WeatherseedTotem extends CardImpl {
), new ManaCostsImpl<>("{2}{G}{G}{G}")));
// When Weatherseed Totem is put into a graveyard from the battlefield, if it was a creature, return this card to its owner's hand.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new ReturnSourceFromGraveyardToHandEffect()),
WeatherseedTotemCondition.instance, "When {this} is put into a graveyard from the battlefield, "
+ "if it was a creature, return this card to its owner's hand"
));
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(
new ReturnSourceFromGraveyardToHandEffect().setText("return this card to its owner's hand")
).withInterveningIf(WeatherseedTotemCondition.instance));
}
private WeatherseedTotem(final WeatherseedTotem card) {
@ -69,4 +66,9 @@ enum WeatherseedTotemCondition implements Condition {
.getEffectValueFromAbility(source, "permanentWasCreature", Boolean.class)
.orElse(false);
}
@Override
public String toString() {
return "it was a creature";
}
}

View file

@ -4,7 +4,6 @@ import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.CardsInControllerGraveyardCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.keyword.ChangelingAbility;
import mage.abilities.keyword.ReachAbility;
@ -22,7 +21,7 @@ import java.util.UUID;
public final class WebweaverChangeling extends CardImpl {
private static final Condition condition
= new CardsInControllerGraveyardCondition(3, StaticFilters.FILTER_CARD_CREATURE);
= new CardsInControllerGraveyardCondition(3, StaticFilters.FILTER_CARD_CREATURES);
public WebweaverChangeling(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{G}");
@ -38,11 +37,7 @@ public final class WebweaverChangeling extends CardImpl {
this.addAbility(ReachAbility.getInstance());
// When Webweaver Changeling enters the battlefield, if there are three or more creature cards in your graveyard, you gain 5 life.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new GainLifeEffect(5)), condition,
"When {this} enters, if there are three or more " +
"creature cards in your graveyard, you gain 5 life."
));
this.addAbility(new EntersBattlefieldTriggeredAbility(new GainLifeEffect(5)).withInterveningIf(condition));
}
private WebweaverChangeling(final WebweaverChangeling card) {

View file

@ -4,7 +4,6 @@ import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.CastFromEverywhereSourceCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
@ -35,11 +34,8 @@ public final class WeddingRing extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}{W}{W}");
// When Wedding Ring enters the battlefield, if it was cast, target opponent creates a token that's a copy of it.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new WeddingRingEffect()),
CastFromEverywhereSourceCondition.instance, "When {this} enters, " +
"if it was cast, target opponent creates a token that's a copy of it."
);
Ability ability = new EntersBattlefieldTriggeredAbility(new WeddingRingEffect())
.withInterveningIf(CastFromEverywhereSourceCondition.instance);
ability.addTarget(new TargetOpponent());
this.addAbility(ability);
@ -64,6 +60,7 @@ class WeddingRingEffect extends OneShotEffect {
WeddingRingEffect() {
super(Outcome.Benefit);
staticText = "target opponent creates a token that's a copy of it";
}
private WeddingRingEffect(final WeddingRingEffect effect) {

View file

@ -1,38 +1,37 @@
package mage.cards.w;
import java.util.UUID;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.abilities.condition.InvertCondition;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.predicate.permanent.TappedPredicate;
import java.util.UUID;
/**
*
* @author LoneFox
*/
public final class WellOfDiscovery extends CardImpl {
private static final FilterControlledLandPermanent filter = new FilterControlledLandPermanent();
private static final FilterPermanent filter = new FilterControlledLandPermanent("you control no untapped lands");
static {
filter.add(TappedPredicate.UNTAPPED);
}
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.EQUAL_TO, 0);
public WellOfDiscovery(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{6}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{6}");
// At the beginning of your end step, if you control no untapped lands, draw a card.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(new BeginningOfEndStepTriggeredAbility(
new DrawCardSourceControllerEffect(1)),
new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter)),
"At the beginning of your end step, if you control no untapped lands, draw a card."));
this.addAbility(new BeginningOfEndStepTriggeredAbility(new DrawCardSourceControllerEffect(1)).withInterveningIf(condition));
}
private WellOfDiscovery(final WellOfDiscovery card) {

View file

@ -1,37 +1,38 @@
package mage.cards.w;
import java.util.UUID;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.abilities.condition.InvertCondition;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.predicate.permanent.TappedPredicate;
import java.util.UUID;
/**
*
* @author LoneFox
*/
public final class WellOfLife extends CardImpl {
private static final FilterControlledLandPermanent filter = new FilterControlledLandPermanent();
private static final FilterPermanent filter = new FilterControlledLandPermanent("you control no untapped lands");
static {
filter.add(TappedPredicate.UNTAPPED);
}
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.EQUAL_TO, 0);
public WellOfLife(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{4}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
// At the beginning of your end step, if you control no untapped lands, you gain 2 life.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(new BeginningOfEndStepTriggeredAbility(
new GainLifeEffect(2)), new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter)),
"At the beginning of your end step, if you control no untapped lands, you gain 2 life."));
this.addAbility(new BeginningOfEndStepTriggeredAbility(new GainLifeEffect(2)).withInterveningIf(condition));
}
private WellOfLife(final WellOfLife card) {

View file

@ -1,32 +1,27 @@
package mage.cards.w;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.condition.common.DealtDamageToAnOpponent;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.ProtectionAbility;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.counters.CounterType;
import mage.game.events.GameEvent;
import java.util.UUID;
/**
*
* @author LevelX
*/
public final class WhirlingDervish extends CardImpl {
private static final String ruleText = "At the beginning of each end step, if {this} dealt damage to an opponent this turn, put a +1/+1 counter on it.";
public WhirlingDervish(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}{G}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}{G}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.MONK);
@ -36,9 +31,14 @@ public final class WhirlingDervish extends CardImpl {
// Protection from black
this.addAbility(ProtectionAbility.from(ObjectColor.BLACK));
// At the beginning of each end step, if Whirling Dervish dealt damage to an opponent this turn, put a +1/+1 counter on it.
TriggeredAbility triggered = new OnEventTriggeredAbility(GameEvent.EventType.END_TURN_STEP_PRE, "beginning of each end step", true, new AddCountersSourceEffect(CounterType.P1P1.createInstance()));
this.addAbility(new ConditionalInterveningIfTriggeredAbility(triggered, DealtDamageToAnOpponent.instance, ruleText));
this.addAbility(new BeginningOfEndStepTriggeredAbility(
TargetController.ANY,
new AddCountersSourceEffect(CounterType.P1P1.createInstance())
.setText("put a +1/+1 counter on it"),
false, DealtDamageToAnOpponent.instance
));
}
private WhirlingDervish(final WhirlingDervish card) {

View file

@ -3,13 +3,12 @@ package mage.cards.w;
import mage.MageInt;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.hint.ConditionHint;
import mage.abilities.hint.Hint;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -42,11 +41,8 @@ public final class WhiteGloveGourmand extends CardImpl {
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new HumanSoldierToken(), 2)));
// At the beginning of your end step, if another Human died under your control this turn, create a Food token.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new BeginningOfEndStepTriggeredAbility(new CreateTokenEffect(new FoodToken())),
WhiteGloveGourmandCondition.instance,
"At the beginning of your end step, if another Human died under your control this turn, create a Food token."
).addHint(WhiteGloveGourmandCondition.hint), new WhiteGloveGourmandWatcher());
this.addAbility(new BeginningOfEndStepTriggeredAbility(new CreateTokenEffect(new FoodToken()))
.withInterveningIf(WhiteGloveGourmandCondition.instance).addHint(WhiteGloveGourmandCondition.hint), new WhiteGloveGourmandWatcher());
}
private WhiteGloveGourmand(final WhiteGloveGourmand card) {

View file

@ -4,7 +4,6 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.condition.common.DeliriumCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.dynamicvalue.common.CardTypesInGraveyardCount;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
@ -29,12 +28,10 @@ public final class WickerfolkThresher extends CardImpl {
this.toughness = new MageInt(4);
// Delirium -- Whenever Wickerfolk Thresher attacks, if there are four or more card types among cards in your graveyard, look at the top card of your library. If it's a land card, you may put it onto the battlefield. If you don't put the card onto the battlefield, put it into your hand.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new AttacksTriggeredAbility(new WickerfolkThresherEffect()),
DeliriumCondition.instance, "Whenever {this} attacks, if there are four or more card types " +
"among cards in your graveyard, look at the top card of your library. If it's a land card, you may " +
"put it onto the battlefield. If you don't put the card onto the battlefield, put it into your hand."
).setAbilityWord(AbilityWord.DELIRIUM).addHint(CardTypesInGraveyardCount.YOU.getHint()));
this.addAbility(new AttacksTriggeredAbility(new WickerfolkThresherEffect())
.withInterveningIf(DeliriumCondition.instance)
.setAbilityWord(AbilityWord.DELIRIUM)
.addHint(CardTypesInGraveyardCount.YOU.getHint()));
}
private WickerfolkThresher(final WickerfolkThresher card) {
@ -51,6 +48,8 @@ class WickerfolkThresherEffect extends OneShotEffect {
WickerfolkThresherEffect() {
super(Outcome.Benefit);
staticText = "look at the top card of your library. If it's a land card, you may put it onto the battlefield. " +
"If you don't put the card onto the battlefield, put it into your hand";
}
private WickerfolkThresherEffect(final WickerfolkThresherEffect effect) {

View file

@ -4,7 +4,6 @@ import mage.MageInt;
import mage.abilities.common.AttacksOrBlocksTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -23,7 +22,7 @@ import java.util.UUID;
*/
public final class WildwoodTracker extends CardImpl {
private static final FilterPermanent filter = new FilterControlledCreaturePermanent();
private static final FilterPermanent filter = new FilterControlledCreaturePermanent("you control another non-Human creature");
static {
filter.add(AnotherPredicate.instance);
@ -41,12 +40,9 @@ public final class WildwoodTracker extends CardImpl {
this.toughness = new MageInt(1);
// Whenever Wildwood Tracker attacks or blocks, if you control another non-Human creature, Wildwood Tracker gets +1/+1 until end of turn.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new AttacksOrBlocksTriggeredAbility(
new BoostSourceEffect(1, 1, Duration.EndOfTurn), false
), condition, "Whenever {this} attacks or blocks, if you control another non-Human creature, " +
"{this} gets +1/+1 until end of turn."
));
this.addAbility(new AttacksOrBlocksTriggeredAbility(
new BoostSourceEffect(1, 1, Duration.EndOfTurn), false
).withInterveningIf(condition));
}
private WildwoodTracker(final WildwoodTracker card) {

View file

@ -4,9 +4,8 @@ import mage.MageInt;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.RaidCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.AttackingCreatureCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.hint.common.RaidHint;
@ -26,6 +25,8 @@ import java.util.UUID;
*/
public final class WingmateRoc extends CardImpl {
private static final DynamicValue xValue = new AttackingCreatureCount();
public WingmateRoc(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}{W}");
this.subtype.add(SubType.BIRD);
@ -37,16 +38,11 @@ public final class WingmateRoc extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// <i>Raid</i> &mdash; When Wingmate Roc enters the battlefield, if you attacked this turn, create a 3/4 white Bird creature token with flying.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new WingmateRocToken())), RaidCondition.instance,
"When {this} enters, if you attacked this turn, create a 3/4 white Bird creature token with flying.")
.setAbilityWord(AbilityWord.RAID)
.addHint(RaidHint.instance),
new PlayerAttackedWatcher());
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new WingmateRocToken()))
.withInterveningIf(RaidCondition.instance).setAbilityWord(AbilityWord.RAID).addHint(RaidHint.instance), new PlayerAttackedWatcher());
// Whenever Wingmate Roc attacks, you gain 1 life for each attacking creature.
Effect effect = new GainLifeEffect(new AttackingCreatureCount());
effect.setText("you gain 1 life for each attacking creature");
this.addAbility(new AttacksTriggeredAbility(effect, false));
this.addAbility(new AttacksTriggeredAbility(new GainLifeEffect(xValue).setText("you gain 1 life for each attacking creature")));
}
private WingmateRoc(final WingmateRoc card) {

View file

@ -2,14 +2,13 @@ package mage.cards.w;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.YouGainedLifeCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.dynamicvalue.common.ControllerGainedLifeCount;
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
import mage.abilities.effects.common.SacrificeOpponentsEffect;
import mage.abilities.keyword.DeathtouchAbility;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -40,15 +39,10 @@ public final class WitchOfTheMoors extends CardImpl {
// At the beginning of your end step, if you gained life this turn, each opponent sacrifices a
// creature and you return up to one target creature card from your graveyard to your hand.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new BeginningOfEndStepTriggeredAbility(new SacrificeOpponentsEffect(
StaticFilters.FILTER_PERMANENT_A_CREATURE
)),
condition, "At the beginning of your end step, if you gained life this turn, "
+ "each opponent sacrifices a creature and you return up to one target creature card "
+ "from your graveyard to your hand."
);
ability.addEffect(new ReturnFromGraveyardToHandTargetEffect());
Ability ability = new BeginningOfEndStepTriggeredAbility(
new SacrificeOpponentsEffect(StaticFilters.FILTER_PERMANENT_A_CREATURE)
).withInterveningIf(condition);
ability.addEffect(new ReturnFromGraveyardToHandTargetEffect().concatBy("and you"));
ability.addTarget(new TargetCardInYourGraveyard(
0, 1, StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD
));

View file

@ -1,40 +1,37 @@
package mage.cards.w;
import java.util.UUID;
import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.condition.common.CreatureCountCondition;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.DamageEverythingEffect;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import java.util.UUID;
/**
*
* @author L_J
*/
public final class WitheringWisps extends CardImpl {
private static final String ruleText = "At the beginning of the end step, if no creatures are on the battlefield, sacrifice {this}.";
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(
new FilterCreaturePermanent("no creatures are on the battlefield"),
ComparisonType.EQUAL_TO, 0, false
);
public WitheringWisps(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}{B}");
// At the beginning of the end step, if no creatures are on the battlefield, sacrifice Withering Wisps.
TriggeredAbility triggered = new OnEventTriggeredAbility(GameEvent.EventType.END_TURN_STEP_PRE, "beginning of the end step", true, new SacrificeSourceEffect());
this.addAbility(new ConditionalInterveningIfTriggeredAbility(triggered, new CreatureCountCondition(0, TargetController.ANY), ruleText));
this.addAbility(new BeginningOfEndStepTriggeredAbility(TargetController.NEXT, new SacrificeSourceEffect(), false, condition));
// {B}: Withering Wisps deals 1 damage to each creature and each player. Activate this ability no more times each turn than the number of snow Swamps you control.
this.addAbility(new WitheringWispsActivatedAbility());
@ -52,17 +49,15 @@ public final class WitheringWisps extends CardImpl {
class WitheringWispsActivatedAbility extends ActivatedAbilityImpl {
private static final FilterPermanent filter = new FilterPermanent("snow Swamps you control");
private static final FilterPermanent filter = new FilterControlledPermanent(SubType.SWAMP, "snow Swamps you control");
static {
filter.add(SuperType.SNOW.getPredicate());
filter.add(SubType.SWAMP.getPredicate());
filter.add(TargetController.YOU.getControllerPredicate());
}
@Override
public int getMaxActivationsPerTurn(Game game) {
return game.getBattlefield().getAllActivePermanents(filter, game).size();
return game.getBattlefield().getActivePermanents(filter, getControllerId(), this, game).size();
}
public WitheringWispsActivatedAbility() {

View file

@ -1,14 +1,15 @@
package mage.cards.w;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.CastFromEverywhereSourceCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.dynamicvalue.common.SourcePermanentPowerValue;
import mage.abilities.dynamicvalue.common.SourcePermanentToughnessValue;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.UntapTargetEffect;
import mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect;
import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.PrototypeAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -18,12 +19,9 @@ import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.custom.CreatureToken;
import mage.target.TargetPermanent;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
/**
@ -42,12 +40,8 @@ public final class WoodcallerAutomaton extends CardImpl {
this.addAbility(new PrototypeAbility(this, "{2}{G}{G}", 3, 3));
// When Woodcaller Automaton enters the battlefield, if you cast it, untap target land you control. It becomes a Treefolk creature with haste and base power and toughness equal to Woodcaller Automaton's power and toughness. It's still a land.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new UntapTargetEffect()),
CastFromEverywhereSourceCondition.instance, "When {this} enters, " +
"if you cast it, untap target land you control. It becomes a Treefolk creature with haste " +
"and base power and toughness equal to {this}'s power and toughness. It's still a land."
);
Ability ability = new EntersBattlefieldTriggeredAbility(new UntapTargetEffect())
.withInterveningIf(CastFromEverywhereSourceCondition.instance);
ability.addEffect(new WoodcallerAutomatonEffect());
ability.addTarget(new TargetPermanent(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND));
this.addAbility(ability);
@ -67,6 +61,7 @@ class WoodcallerAutomatonEffect extends OneShotEffect {
WoodcallerAutomatonEffect() {
super(Outcome.Benefit);
staticText = "It becomes a Treefolk creature with haste and base power and toughness equal to {this}'s power and toughness. It's still a land";
}
private WoodcallerAutomatonEffect(final WoodcallerAutomatonEffect effect) {
@ -80,19 +75,10 @@ class WoodcallerAutomatonEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Optional<Permanent> optionalPermanent = Optional
.ofNullable(source.getSourcePermanentOrLKI(game))
.filter(Objects::nonNull);
int power = optionalPermanent
.map(MageObject::getPower)
.map(MageInt::getValue)
.orElse(0);
int toughness = optionalPermanent
.map(MageObject::getToughness)
.map(MageInt::getValue)
.orElse(0);
int power = SourcePermanentPowerValue.ALLOW_NEGATIVE.calculate(game, source, this);
int toughness = SourcePermanentToughnessValue.instance.calculate(game, source, this);
game.addEffect(new BecomesCreatureTargetEffect(
new CreatureToken(power, toughness, "", SubType.TREEFOLK),
new CreatureToken(power, toughness, "", SubType.TREEFOLK).withAbility(HasteAbility.getInstance()),
false, true, Duration.Custom
), source);
return true;

View file

@ -1,14 +1,13 @@
package mage.cards.w;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.MorbidCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.ReturnFromGraveyardAtRandomEffect;
import mage.abilities.hint.common.MorbidHint;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AbilityWord;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
@ -17,13 +16,10 @@ import mage.filter.StaticFilters;
import java.util.UUID;
/**
*
* @author North
*/
public final class WoodlandSleuth extends CardImpl {
private static final String staticText = "<i>Morbid</i> &mdash; When {this} enters, if a creature died this turn, return a creature card at random from your graveyard to your hand.";
public WoodlandSleuth(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}");
this.subtype.add(SubType.HUMAN);
@ -34,9 +30,9 @@ public final class WoodlandSleuth extends CardImpl {
this.toughness = new MageInt(3);
// <i>Morbid</i> &mdash; When Woodland Sleuth enters the battlefield, if a creature died this turn, return a creature card at random from your graveyard to your hand.
TriggeredAbility ability = new EntersBattlefieldTriggeredAbility(
new ReturnFromGraveyardAtRandomEffect(StaticFilters.FILTER_CARD_CREATURE, Zone.HAND));
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, MorbidCondition.instance, staticText).addHint(MorbidHint.instance));
this.addAbility(new EntersBattlefieldTriggeredAbility(
new ReturnFromGraveyardAtRandomEffect(StaticFilters.FILTER_CARD_CREATURE, Zone.HAND)
).withInterveningIf(MorbidCondition.instance).setAbilityWord(AbilityWord.MORBID).addHint(MorbidHint.instance));
}
private WoodlandSleuth(final WoodlandSleuth card) {

View file

@ -5,13 +5,10 @@ import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.condition.CompoundCondition;
import mage.abilities.condition.Condition;
import mage.abilities.condition.IntCompareCondition;
import mage.abilities.condition.common.CitysBlessingCondition;
import mage.abilities.condition.common.HaveInitiativeCondition;
import mage.abilities.condition.common.MonarchIsSourceControllerCondition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.dynamicvalue.common.CountersControllerCount;
import mage.abilities.effects.common.WinGameSourceControllerEffect;
import mage.abilities.hint.ConditionHint;
import mage.abilities.hint.Hint;
@ -21,13 +18,14 @@ import mage.abilities.hint.common.MonarchHint;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.counters.CounterType;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Controllable;
import mage.game.Game;
import java.util.Optional;
import java.util.UUID;
/**
@ -35,7 +33,7 @@ import java.util.UUID;
*/
public class WowzerTheAspirational extends CardImpl {
private static final Condition energyCondition = new WowzerTheAspirationalCondition();
private static final Condition energyCondition = WowzerTheAspirationalCondition.instance;
private static final Condition bloodCondition
= new PermanentsOnTheBattlefieldCondition(new FilterControlledPermanent(SubType.BLOOD));
private static final Condition clueCondition
@ -50,6 +48,8 @@ public class WowzerTheAspirational extends CardImpl {
= new PermanentsOnTheBattlefieldCondition(new FilterControlledPermanent(SubType.TREASURE));
private static final Condition winCondition = new CompoundCondition(
"you have an {E}, control a Blood, a Clue, a Food, a Map, a Powerstone, and a Treasure, " +
"are the monarch, and have the city's blessing and the initiative",
energyCondition,
bloodCondition,
clueCondition,
@ -59,7 +59,8 @@ public class WowzerTheAspirational extends CardImpl {
treasureCondition,
MonarchIsSourceControllerCondition.instance,
CitysBlessingCondition.instance,
HaveInitiativeCondition.instance);
HaveInitiativeCondition.instance
);
private static final Hint energyHint = new ConditionHint(energyCondition, "You have an {E}");
private static final Hint bloodHint = new ConditionHint(bloodCondition, "You control a Blood");
@ -83,13 +84,9 @@ public class WowzerTheAspirational extends CardImpl {
// Whenever Wowzer, the Aspirational attacks,
// if you have an {E}, control a Blood, a Clue, a Food, a Map, a Powerstone, and a Treasure,
// are the monarch, and have the city's blessing and the initiative, you win the game.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new AttacksTriggeredAbility(new WinGameSourceControllerEffect()),
winCondition,
"Whenever {this} attacks, " +
"if you have an {E}, control a Blood, a Clue, a Food, a Map, a Powerstone, and a Treasure, " +
"are the monarch, and have the city's blessing and the initiative, you win the game."
).addHint(energyHint)
this.addAbility(new AttacksTriggeredAbility(new WinGameSourceControllerEffect())
.withInterveningIf(winCondition)
.addHint(energyHint)
.addHint(bloodHint)
.addHint(clueHint)
.addHint(foodHint)
@ -111,14 +108,16 @@ public class WowzerTheAspirational extends CardImpl {
}
}
class WowzerTheAspirationalCondition extends IntCompareCondition {
WowzerTheAspirationalCondition() {
super(ComparisonType.MORE_THAN, 0);
}
enum WowzerTheAspirationalCondition implements Condition {
instance;
@Override
protected int getInputValue(Game game, Ability source) {
return new CountersControllerCount(CounterType.ENERGY).calculate(game, source, null);
public boolean apply(Game game, Ability source) {
return Optional
.of(source)
.map(Controllable::getControllerId)
.map(game::getPlayer)
.filter(player -> player.getCountersCount(CounterType.ENERGY) > 0)
.isPresent();
}
}

View file

@ -4,7 +4,6 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.condition.common.DesertControlledOrGraveyardCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.discard.DiscardTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -28,11 +27,7 @@ public final class WretchedCamel extends CardImpl {
this.toughness = new MageInt(1);
// When Wretched Camel dies, if you control a Desert or there is a Desert card in your graveyard, target player discards a card.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new DiesSourceTriggeredAbility(new DiscardTargetEffect(1)),
DesertControlledOrGraveyardCondition.instance, "When {this} dies, " +
"if you control a Desert or there is a Desert card in your graveyard, target player discards a card."
);
Ability ability = new DiesSourceTriggeredAbility(new DiscardTargetEffect(1)).withInterveningIf(DesertControlledOrGraveyardCondition.instance);
ability.addTarget(new TargetPlayer());
this.addAbility(ability.addHint(DesertControlledOrGraveyardCondition.getHint()));
}

View file

@ -2,10 +2,9 @@ package mage.cards.w;
import mage.abilities.Ability;
import mage.abilities.common.AttacksAttachedTriggeredAbility;
import mage.abilities.condition.common.AttachedToMatchesFilterCondition;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.SourceMatchesFilterCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.RestrictionEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.combat.CantBeBlockedTargetEffect;
import mage.abilities.keyword.EnchantAbility;
@ -16,8 +15,6 @@ import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.PowerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
@ -28,6 +25,16 @@ import java.util.UUID;
*/
public final class WritOfPassage extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("its power is 2 or less");
private static final FilterPermanent filter2 = new FilterCreaturePermanent("creature with power 2 or less");
static {
filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, 3));
filter2.add(new PowerPredicate(ComparisonType.FEWER_THAN, 3));
}
private static final Condition condition = new SourceMatchesFilterCondition(filter);
public WritOfPassage(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{U}");
@ -37,22 +44,18 @@ public final class WritOfPassage extends CardImpl {
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget);
this.addAbility(ability);
this.addAbility(new EnchantAbility(auraTarget));
// Whenever enchanted creature attacks, if its power is 2 or less, it's unblockable this turn.
FilterPermanent filter = new FilterPermanent("if enchanted creature's power is 2 or less");
filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, 3));
ability = new ConditionalInterveningIfTriggeredAbility(new AttacksAttachedTriggeredAbility(
new WritOfPassageAttachedEffect(AttachmentType.AURA), AttachmentType.AURA, false),
new AttachedToMatchesFilterCondition(filter), "Whenever enchanted creature attacks, if its power is 2 or less, it can't be blocked this turn.");
this.addAbility(ability);
this.addAbility(new AttacksAttachedTriggeredAbility(
new CantBeBlockedTargetEffect().setText("it can't be blocked this turn"),
AttachmentType.AURA, false, SetTargetPointer.PERMANENT
).withInterveningIf(condition));
// Forecast - {1}{U}, Reveal Writ of Passage from your hand: Target creature with power 2 or less is unblockable this turn.
ForecastAbility ability2 = new ForecastAbility(new CantBeBlockedTargetEffect(), new ManaCostsImpl<>("{1}{U}"));
FilterCreaturePermanent filter2 = new FilterCreaturePermanent("creature with power 2 or less");
filter2.add(new PowerPredicate(ComparisonType.FEWER_THAN, 3));
ability2.addTarget(new TargetCreaturePermanent(filter2));
this.addAbility(ability2);
Ability ability = new ForecastAbility(new CantBeBlockedTargetEffect(), new ManaCostsImpl<>("{1}{U}"));
ability.addTarget(new TargetPermanent(filter2));
this.addAbility(ability);
}
private WritOfPassage(final WritOfPassage card) {
@ -64,31 +67,3 @@ public final class WritOfPassage extends CardImpl {
return new WritOfPassage(this);
}
}
class WritOfPassageAttachedEffect extends RestrictionEffect {
WritOfPassageAttachedEffect(AttachmentType attachmentType) {
super(Duration.EndOfTurn);
this.staticText = attachmentType.verb() + " creature can't be blocked";
}
private WritOfPassageAttachedEffect(final WritOfPassageAttachedEffect effect) {
super(effect);
}
@Override
public WritOfPassageAttachedEffect copy() {
return new WritOfPassageAttachedEffect(this);
}
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) {
return false;
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
Permanent attachment = game.getPermanent(source.getSourceId());
return attachment != null && attachment.isAttachedTo(permanent.getId());
}
}

View file

@ -1,28 +1,30 @@
package mage.cards.w;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.abilities.condition.InvertCondition;
import mage.abilities.condition.common.ManaWasSpentCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.CastSourceTriggeredAbility;
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
import mage.constants.SubType;
import mage.abilities.keyword.DevoidAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.StaticFilters;
import mage.target.common.TargetOpponent;
import java.util.UUID;
/**
*
* @author DominionSpy
*/
public final class WumpusAberration extends CardImpl {
private static final Condition condition = new InvertCondition(ManaWasSpentCondition.COLORLESS, "{C} wasn't spent to cast it");
public WumpusAberration(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}");
@ -35,13 +37,9 @@ public final class WumpusAberration extends CardImpl {
this.addAbility(new DevoidAbility(this.color));
// When you cast this spell, if {C} wasn't spent to cast it, target opponent may put a creature card from their hand onto the battlefield.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new CastSourceTriggeredAbility(
new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_CARD_CREATURE, true)),
new InvertCondition(ManaWasSpentCondition.COLORLESS),
"When you cast this spell, if {C} wasn't spent to cast it, " +
"target opponent may put a creature card from their hand onto the battlefield."
);
Ability ability = new CastSourceTriggeredAbility(new PutCardFromHandOntoBattlefieldEffect(
StaticFilters.FILTER_CARD_CREATURE, true
).setText("target opponent may put a creature card from their hand onto the battlefield")).withInterveningIf(condition);
ability.addTarget(new TargetOpponent());
this.addAbility(ability);

View file

@ -1,10 +1,9 @@
package mage.cards.y;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.KickedCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.keyword.HasteAbility;
@ -37,10 +36,13 @@ public final class YavimayaIconoclast extends CardImpl {
this.addAbility(TrampleAbility.getInstance());
// When Yavimaya Iconoclast enters the battlefield, if it was kicked, it gets +1/+1 and gains haste until end of turn.
TriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new BoostSourceEffect(1, 1, Duration.EndOfTurn));
ability.addEffect(new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.EndOfTurn));
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, KickedCondition.ONCE,
"When {this} enters, if it was kicked, it gets +1/+1 and gains haste until end of turn."));
Ability ability = new EntersBattlefieldTriggeredAbility(new BoostSourceEffect(
1, 1, Duration.EndOfTurn
).setText("it gets +1/+1")).withInterveningIf(KickedCondition.ONCE);
ability.addEffect(new GainAbilitySourceEffect(
HasteAbility.getInstance(), Duration.EndOfTurn
).setText("and gains haste until end of turn"));
this.addAbility(ability);
}
private YavimayaIconoclast(final YavimayaIconoclast card) {

View file

@ -1,28 +1,28 @@
package mage.cards.y;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.DamagePlayersEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.hint.ConditionHint;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.constants.*;
import mage.abilities.hint.Hint;
import mage.abilities.keyword.VigilanceAbility;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ManaValuePredicate;
import mage.game.Game;
import mage.watchers.common.PlayerLostLifeWatcher;
import java.util.UUID;
/**
*
* @author inuenc
*/
public final class YshtolaNightsBlessed extends CardImpl {
@ -47,22 +47,16 @@ public final class YshtolaNightsBlessed extends CardImpl {
this.addAbility(VigilanceAbility.getInstance());
// At the beginning of each end step, if a player lost 4 or more life this turn, you draw a card.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new BeginningOfEndStepTriggeredAbility(
TargetController.ANY,
new DrawCardSourceControllerEffect(1),
false
), YshtolaNightsBlessedCondition.instance, "At the beginning of each end step, " +
"if a player lost 4 or more life this turn, you draw a card."
).addHint(new ConditionHint(YshtolaNightsBlessedCondition.instance, "A player lost 4 or more life this turn")));
this.addAbility(new BeginningOfEndStepTriggeredAbility(
TargetController.ANY, new DrawCardSourceControllerEffect(1),
false, YshtolaNightsBlessedCondition.instance
).addHint(YshtolaNightsBlessedCondition.getHint()));
// Whenever you cast a noncreature spell with mana value 3 or greater, Y'shtola deals 2 damage to each opponent and you gain 2 life.
Ability ability = new SpellCastControllerTriggeredAbility(
new DamagePlayersEffect(
2, TargetController.OPPONENT, "Y'shtola"),
filter, false
new DamagePlayersEffect(2, TargetController.OPPONENT), filter, false
);
ability.addEffect(new GainLifeEffect(2).setText("and you gain 2 life"));
ability.addEffect(new GainLifeEffect(2).concatBy("and"));
this.addAbility(ability);
}
@ -78,6 +72,11 @@ public final class YshtolaNightsBlessed extends CardImpl {
enum YshtolaNightsBlessedCondition implements Condition {
instance;
private static final Hint hint = new ConditionHint(instance);
public static Hint getHint() {
return hint;
}
@Override
public boolean apply(Game game, Ability source) {
@ -85,10 +84,16 @@ enum YshtolaNightsBlessedCondition implements Condition {
if (watcher == null) {
return false;
}
return game
return watcher != null
&& game
.getState()
.getPlayersInRange(source.getControllerId(), game)
.stream()
.anyMatch(uuid -> watcher.getLifeLost(uuid) > 3);
.anyMatch(uuid -> watcher.getLifeLost(uuid) >= 4);
}
@Override
public String toString() {
return "a player lost 4 or more life this turn";
}
}

View file

@ -1,14 +1,11 @@
package mage.cards.z;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.condition.common.CastFromEverywhereSourceCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.GainLifeEffect;
@ -21,13 +18,13 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class ZacamaPrimalCalamity extends CardImpl {
@ -51,10 +48,8 @@ public final class ZacamaPrimalCalamity extends CardImpl {
this.addAbility(TrampleAbility.getInstance());
// When Zacama, Primal Calamity enters the battlefield, if you cast it, untap all lands you control.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new UntapAllLandsControllerEffect(), false),
CastFromEverywhereSourceCondition.instance,
"When {this} enters, if you cast it, untap all lands you control."));
this.addAbility(new EntersBattlefieldTriggeredAbility(new UntapAllLandsControllerEffect())
.withInterveningIf(CastFromEverywhereSourceCondition.instance));
// {2}{R}: Zacama deals 3 damage to target creature.
Ability ability = new SimpleActivatedAbility(new DamageTargetEffect(3), new ManaCostsImpl<>("{2}{R}"));

View file

@ -1,35 +1,38 @@
package mage.cards.z;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.condition.InvertCondition;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.GainLifeEffect;
import mage.constants.SubType;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate;
import java.util.UUID;
/**
*
* @author TheElk801
*/
public final class ZealotsEnDal extends CardImpl {
private static final FilterControlledPermanent filter = new FilterControlledPermanent();
private static final FilterPermanent filter = new FilterControlledPermanent("all nonland permanents you control are white");
static {
filter.add(Predicates.not(new ColorPredicate(ObjectColor.WHITE)));
filter.add(Predicates.not(CardType.LAND.getPredicate()));
}
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.EQUAL_TO, 0);
public ZealotsEnDal(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}");
@ -39,11 +42,7 @@ public final class ZealotsEnDal extends CardImpl {
this.toughness = new MageInt(4);
// At the beginning of your upkeep, if all nonland permanents you control are white, you gain 1 life.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(new GainLifeEffect(1)),
new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter)),
"At the beginning of your upkeep, if all nonland permanents you control are white, you gain 1 life."
));
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new GainLifeEffect(1)).withInterveningIf(condition));
}
private ZealotsEnDal(final ZealotsEnDal card) {

View file

@ -3,16 +3,23 @@ package mage.cards.z;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.abilities.keyword.AdaptAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.AnotherPredicate;
import java.util.UUID;
@ -21,6 +28,15 @@ import java.util.UUID;
*/
public final class ZeganaUtopianSpeaker extends CardImpl {
private static final FilterPermanent filter = new FilterControlledCreaturePermanent("you control another creature with a +1/+1 counter on it");
static {
filter.add(AnotherPredicate.instance);
filter.add(CounterType.P1P1.getPredicate());
}
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(filter);
public ZeganaUtopianSpeaker(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{U}");
@ -31,26 +47,16 @@ public final class ZeganaUtopianSpeaker extends CardImpl {
this.toughness = new MageInt(4);
// When Zegana, Utopian Speaker enters the battlefield, if you control another creature with a +1/+1 counter on it, draw a card.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(
new DrawCardSourceControllerEffect(1), false
), new PermanentsOnTheBattlefieldCondition(StaticFilters.FILTER_OTHER_CONTROLLED_CREATURE_P1P1),
"When {this} enters, " +
"if you control another creature " +
"with a +1/+1 counter on it, draw a card."
)
);
this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1)).withInterveningIf(condition));
// {4}{G}{U}: Adapt 4.
this.addAbility(new AdaptAbility(4, "{4}{G}{U}"));
// Each creature you control with a +1/+1 counter on it has trample.
this.addAbility(new SimpleStaticAbility(
new GainAbilityAllEffect(
TrampleAbility.getInstance(), Duration.WhileOnBattlefield,
StaticFilters.FILTER_EACH_CONTROLLED_CREATURE_P1P1)
)
);
this.addAbility(new SimpleStaticAbility(new GainAbilityAllEffect(
TrampleAbility.getInstance(), Duration.WhileOnBattlefield,
StaticFilters.FILTER_EACH_CONTROLLED_CREATURE_P1P1
)));
}
private ZeganaUtopianSpeaker(final ZeganaUtopianSpeaker card) {

View file

@ -21,7 +21,6 @@ public enum CollectedEvidenceCondition implements Condition {
@Override
public String toString() {
// must use "used" instead "collected" because it can be visible as card hint on stack before real collect
return "Evidence was used";
return "evidence was collected";
}
}

View file

@ -16,4 +16,9 @@ public enum LandfallCondition implements Condition {
LandfallWatcher watcher = game.getState().getWatcher(LandfallWatcher.class);
return watcher != null && watcher.landPlayed(source.getControllerId());
}
@Override
public String toString() {
return "you had a land enter the battlefield under your control this turn";
}
}

View file

@ -14,7 +14,7 @@ public class EvidenceHint extends ConditionHint {
private final int needAmount;
public EvidenceHint(int needAmount) {
super(CollectedEvidenceCondition.instance);
super(CollectedEvidenceCondition.instance, "Evidence was used");
this.needAmount = needAmount;
}