mirror of
https://github.com/magefree/mage.git
synced 2025-12-30 07:22:03 -08:00
some more refactoring of ConditionalInterveningIfTriggeredAbility
This commit is contained in:
parent
c2daa00b74
commit
a895ac9803
24 changed files with 217 additions and 291 deletions
|
|
@ -5,7 +5,6 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.SourceHasCounterCondition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
|
||||
|
|
@ -40,15 +39,14 @@ public final class AyarasOathsworn extends CardImpl {
|
|||
this.addAbility(new MenaceAbility(false));
|
||||
|
||||
// Whenever Ayara's Oathsworn deals combat damage to a player, if it has fewer than four +1/+1 counters on it, put a +1/+1 counter on it. Then if it has exactly four +1/+1 counters on it, search your library for a card, put it into your hand, then shuffle.
|
||||
Ability ability = new ConditionalInterveningIfTriggeredAbility(
|
||||
new DealsCombatDamageToAPlayerTriggeredAbility(
|
||||
new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false
|
||||
), condition1, "Whenever {this} deals combat damage to a player, if it has fewer than four " +
|
||||
"+1/+1 counters on it, put a +1/+1 counter on it. Then if it has exactly four +1/+1 counters on it, " +
|
||||
"search your library for a card, put it into your hand, then shuffle."
|
||||
);
|
||||
Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(
|
||||
new AddCountersSourceEffect(CounterType.P1P1.createInstance())
|
||||
.setText("put a +1/+1 counter on it"), false
|
||||
).withInterveningIf(condition1);
|
||||
ability.addEffect(new ConditionalOneShotEffect(
|
||||
new SearchLibraryPutInHandEffect(new TargetCardInLibrary(), false), condition2
|
||||
new SearchLibraryPutInHandEffect(new TargetCardInLibrary(), false),
|
||||
condition2, "Then if it has exactly four +1/+1 counters on it, " +
|
||||
"search your library for a card, put it into your hand, then shuffle"
|
||||
));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package mage.cards.b;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.condition.common.FerociousCondition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.hint.common.FerociousHint;
|
||||
import mage.abilities.keyword.PlotAbility;
|
||||
|
|
@ -28,11 +27,8 @@ public final class BeastbondOutcaster extends CardImpl {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
// When Beastbond Outcaster enters the battlefield, if you control a creature with power 4 or greater, draw a card.
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
|
||||
new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1)),
|
||||
FerociousCondition.instance, "When {this} enters, " +
|
||||
"if you control a creature with power 4 or greater, draw a card."
|
||||
).addHint(FerociousHint.instance));
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1))
|
||||
.withInterveningIf(FerociousCondition.instance).addHint(FerociousHint.instance));
|
||||
|
||||
// Plot {1}{G}
|
||||
this.addAbility(new PlotAbility("{1}{G}"));
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.condition.common.CardsInHandCondition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.common.HellbentCondition;
|
||||
import mage.abilities.effects.common.SacrificeSourceEffect;
|
||||
import mage.abilities.effects.common.discard.DiscardHandTargetEffect;
|
||||
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -22,12 +21,10 @@ public final class BrinkOfMadness extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}{B}");
|
||||
|
||||
// At the beginning of your upkeep, if you have no cards in hand, sacrifice Brink of Madness and target opponent discards their hand.
|
||||
TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(new SacrificeSourceEffect());
|
||||
ability.addEffect(new DiscardHandTargetEffect());
|
||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(new SacrificeSourceEffect()).withInterveningIf(HellbentCondition.instance);
|
||||
ability.addEffect(new DiscardHandTargetEffect().concatBy("and"));
|
||||
ability.addTarget(new TargetOpponent());
|
||||
CardsInHandCondition condition = new CardsInHandCondition(ComparisonType.EQUAL_TO, 0);
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, condition, "At the beginning of your upkeep, if you have no cards in hand, sacrifice {this} and target opponent discards their hand."));
|
||||
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private BrinkOfMadness(final BrinkOfMadness card) {
|
||||
|
|
|
|||
|
|
@ -2,17 +2,19 @@ package mage.cards.b;
|
|||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.triggers.BeginningOfCombatTriggeredAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.effects.common.combat.CantBeBlockedSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.abilities.hint.ConditionHint;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.triggers.BeginningOfCombatTriggeredAbility;
|
||||
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.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
|
||||
|
|
@ -23,14 +25,15 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class BrotherhoodSpy extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterControlledPermanent(SubType.ASSASSIN);
|
||||
private static final FilterPermanent filter
|
||||
= new FilterControlledPermanent(SubType.ASSASSIN, "you control a legendary Assassin");
|
||||
|
||||
static {
|
||||
filter.add(SuperType.LEGENDARY.getPredicate());
|
||||
}
|
||||
|
||||
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(filter);
|
||||
private static final Hint hint = new ConditionHint(condition, "You control a legendary Assassin");
|
||||
private static final Hint hint = new ConditionHint(condition);
|
||||
|
||||
public BrotherhoodSpy(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}");
|
||||
|
|
@ -41,13 +44,11 @@ public final class BrotherhoodSpy extends CardImpl {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
// At the beginning of combat on your turn, if you control a legendary Assassin, Brotherhood Spy gets +1/+0 until end of turn and can't be blocked this turn.
|
||||
Ability ability = new ConditionalInterveningIfTriggeredAbility(
|
||||
new BeginningOfCombatTriggeredAbility(
|
||||
new BoostTargetEffect(1, 0)
|
||||
), condition, "At the beginning of combat on your turn, if you control a legendary Assassin, " +
|
||||
"{this} gets +1/+0 until end of turn and can't be blocked this turn."
|
||||
);
|
||||
ability.addEffect(new CantBeBlockedSourceEffect(Duration.EndOfTurn));
|
||||
Ability ability = new BeginningOfCombatTriggeredAbility(
|
||||
new BoostSourceEffect(1, 0, Duration.EndOfTurn)
|
||||
).withInterveningIf(condition);
|
||||
ability.addEffect(new CantBeBlockedSourceEffect(Duration.EndOfTurn)
|
||||
.setText("and can't be blocked this turn"));
|
||||
this.addAbility(ability.addHint(hint));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,33 +1,35 @@
|
|||
|
||||
package mage.cards.b;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
||||
import mage.abilities.keyword.FirstStrikeAbility;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.common.FilterTeamPermanent;
|
||||
import mage.filter.predicate.mageobject.AnotherPredicate;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class BullRushBruiser extends CardImpl {
|
||||
|
||||
private static final FilterTeamPermanent filter = new FilterTeamPermanent(SubType.WARRIOR, "another Warrior");
|
||||
private static final FilterTeamPermanent filter
|
||||
= new FilterTeamPermanent(SubType.WARRIOR, "your team controls another Warrior");
|
||||
|
||||
static {
|
||||
filter.add(AnotherPredicate.instance);
|
||||
}
|
||||
|
||||
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(filter);
|
||||
|
||||
public BullRushBruiser(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}");
|
||||
|
||||
|
|
@ -37,12 +39,9 @@ public final class BullRushBruiser extends CardImpl {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
// Whenever Bull-Rush Bruiser attacks, if your team controls another Warrior, Bull-Rush Bruiser gains first strike until end of turn.
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
|
||||
new AttacksTriggeredAbility(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn), false),
|
||||
new PermanentsOnTheBattlefieldCondition(filter),
|
||||
"Whenever {this} attacks, if your team controls another Warrior, "
|
||||
+ "{this} gains first strike until end of turn."
|
||||
));
|
||||
this.addAbility(new AttacksTriggeredAbility(new GainAbilitySourceEffect(
|
||||
FirstStrikeAbility.getInstance(), Duration.EndOfTurn
|
||||
)).withInterveningIf(condition));
|
||||
}
|
||||
|
||||
private BullRushBruiser(final BullRushBruiser card) {
|
||||
|
|
|
|||
|
|
@ -1,38 +1,36 @@
|
|||
|
||||
package mage.cards.b;
|
||||
|
||||
import java.util.UUID;
|
||||
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.DamageTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class BurningEyeZubera extends CardImpl {
|
||||
|
||||
public BurningEyeZubera(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{R}");
|
||||
this.subtype.add(SubType.ZUBERA, SubType.SPIRIT);
|
||||
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// When Burning-Eye Zubera dies, if 4 or more damage was dealt to it this turn, Burning-Eye Zubera deals 3 damage to any target.
|
||||
Ability ability = new ConditionalInterveningIfTriggeredAbility(new DiesSourceTriggeredAbility(new DamageTargetEffect(3)),new SourceGotFourDamage(),
|
||||
"When {this} dies, if 4 or more damage was dealt to it this turn, Burning-Eye Zubera deals 3 damage to any target");
|
||||
Ability ability = new DiesSourceTriggeredAbility(new DamageTargetEffect(3))
|
||||
.withInterveningIf(BurningEyeZuberaCondition.instance);
|
||||
ability.addTarget(new TargetAnyTarget());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
@ -47,13 +45,19 @@ public final class BurningEyeZubera extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class SourceGotFourDamage implements Condition {
|
||||
enum BurningEyeZuberaCondition implements Condition {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent == null) {
|
||||
permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
|
||||
return Optional
|
||||
.ofNullable(source.getSourcePermanentOrLKI(game))
|
||||
.map(Permanent::getDamage)
|
||||
.orElse(0) >= 4;
|
||||
}
|
||||
return permanent.getDamage() > 3;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "4 or more damage was dealt to it this turn";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.abilities.condition.common.DescendCondition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.effects.common.CastSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.CopySourceSpellEffect;
|
||||
import mage.abilities.effects.common.ExileSpellEffect;
|
||||
|
|
@ -27,11 +26,11 @@ public final class BygoneMarvels extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}{G}");
|
||||
|
||||
// Descend 8 -- When you cast this spell, if there are eight or more permanent cards in your graveyard, copy this spell twice. You may choose new targets for the copies.
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
|
||||
new CastSourceTriggeredAbility(new CopySourceSpellEffect(2)),
|
||||
DescendCondition.EIGHT, "When you cast this spell, if there are eight or more " +
|
||||
"permanent cards in your graveyard, copy this spell twice. You may choose new targets for the copies."
|
||||
).setAbilityWord(AbilityWord.DESCEND_8).addHint(DescendCondition.getHint()));
|
||||
this.addAbility(new CastSourceTriggeredAbility(new CopySourceSpellEffect(2)
|
||||
.setText("copy this spell twice. You may choose new targets for the copies"))
|
||||
.withInterveningIf(DescendCondition.EIGHT)
|
||||
.setAbilityWord(AbilityWord.DESCEND_8)
|
||||
.addHint(DescendCondition.getHint()));
|
||||
|
||||
// Return target permanent card from your graveyard to your hand. Exile Bygone Marvels.
|
||||
this.getSpellAbility().addEffect(new ReturnFromGraveyardToHandTargetEffect());
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import mage.MageInt;
|
|||
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.condition.common.CastFromEverywhereSourceCondition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.effects.common.DestroyAllEffect;
|
||||
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
|
||||
import mage.abilities.keyword.DeathtouchAbility;
|
||||
|
|
@ -37,24 +36,18 @@ public final class CacophonyUnleashed extends CardImpl {
|
|||
public CacophonyUnleashed(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{5}{B}{B}");
|
||||
|
||||
|
||||
// When Cacophony Unleashed enters the battlefield, if you cast it, destroy all nonenchantment creatures.
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
|
||||
new EntersBattlefieldTriggeredAbility(new DestroyAllEffect(filter)),
|
||||
CastFromEverywhereSourceCondition.instance,
|
||||
"When {this} enters, if you cast it, destroy all nonenchantment creatures."
|
||||
));
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new DestroyAllEffect(filter))
|
||||
.withInterveningIf(CastFromEverywhereSourceCondition.instance));
|
||||
|
||||
// Whenever Cacophony Unleashed or another enchantment you control enters, until end of turn, Cacophony Unleashed becomes a legendary 6/6 Nightmare God creature with menace and deathtouch. It's still an enchantment.
|
||||
this.addAbility(
|
||||
new EntersBattlefieldThisOrAnotherTriggeredAbility(
|
||||
this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(
|
||||
new BecomesCreatureSourceEffect(new CacophonyUnleashedToken(), CardType.ENCHANTMENT, Duration.EndOfTurn)
|
||||
.setText("until end of turn, Cacophony Unleashed becomes a legendary 6/6 Nightmare God "
|
||||
+ "creature with menace and deathtouch. It's still an enchantment."),
|
||||
.setText("until end of turn, {this} becomes a legendary 6/6 Nightmare God "
|
||||
+ "creature with menace and deathtouch. It's still an enchantment."),
|
||||
StaticFilters.FILTER_PERMANENT_ENCHANTMENT,
|
||||
false, true
|
||||
)
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
private CacophonyUnleashed(final CacophonyUnleashed card) {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
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.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.common.discard.DiscardEachPlayerEffect;
|
||||
import mage.abilities.keyword.KickerAbility;
|
||||
|
|
@ -15,8 +13,9 @@ import mage.constants.CardType;
|
|||
import mage.constants.SubType;
|
||||
import mage.constants.TargetController;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JRHerlehy
|
||||
*/
|
||||
public final class CaligoSkinWitch extends CardImpl {
|
||||
|
|
@ -32,15 +31,9 @@ public final class CaligoSkinWitch extends CardImpl {
|
|||
this.addAbility(new KickerAbility("{3}{B}"));
|
||||
|
||||
// When Caligo Skin-Witch enters the battlefield, if it was kicked, each opponent discards two cards.
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
|
||||
new EntersBattlefieldTriggeredAbility(new DiscardEachPlayerEffect(
|
||||
StaticValue.get(2),
|
||||
false,
|
||||
TargetController.OPPONENT
|
||||
)),
|
||||
KickedCondition.ONCE,
|
||||
"When {this} enters, if it was kicked, each opponent discards two cards."
|
||||
));
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new DiscardEachPlayerEffect(
|
||||
StaticValue.get(2), false, TargetController.OPPONENT
|
||||
)).withInterveningIf(KickedCondition.ONCE));
|
||||
}
|
||||
|
||||
private CaligoSkinWitch(final CaligoSkinWitch card) {
|
||||
|
|
|
|||
|
|
@ -1,54 +1,49 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.common.TwoOrMoreSpellsWereCastLastTurnCondition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.SacrificeSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author LoneFox
|
||||
*/
|
||||
public final class CallOfTheFullMoon extends CardImpl {
|
||||
|
||||
public CallOfTheFullMoon(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
|
||||
this.subtype.add(SubType.AURA);
|
||||
|
||||
// Enchant creature
|
||||
TargetPermanent auraTarget = new TargetCreaturePermanent();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Benefit));
|
||||
Ability ability = new EnchantAbility(auraTarget);
|
||||
this.addAbility(ability);
|
||||
this.addAbility(new EnchantAbility(auraTarget));
|
||||
|
||||
// Enchanted creature gets +3/+2 and has trample.
|
||||
ability = new SimpleStaticAbility(new BoostEnchantedEffect(3, 2, Duration.WhileOnBattlefield));
|
||||
Effect effect = new GainAbilityAttachedEffect(TrampleAbility.getInstance(), AttachmentType.AURA);
|
||||
effect.setText("and has trample.");
|
||||
ability.addEffect(effect);
|
||||
Ability ability = new SimpleStaticAbility(new BoostEnchantedEffect(3, 2));
|
||||
ability.addEffect(new GainAbilityAttachedEffect(
|
||||
TrampleAbility.getInstance(), AttachmentType.AURA
|
||||
).setText("and has trample"));
|
||||
this.addAbility(ability);
|
||||
|
||||
// At the beginning of each upkeep, if a player cast two or more spells last turn, sacrifice Call of the Full Moon.
|
||||
TriggeredAbility ability2 = new BeginningOfUpkeepTriggeredAbility(TargetController.ANY, new SacrificeSourceEffect(), false);
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability2, TwoOrMoreSpellsWereCastLastTurnCondition.instance,
|
||||
"At the beginning of each upkeep, if a player cast two or more spells last turn, sacrifice {this}."));
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
|
||||
TargetController.ANY, new SacrificeSourceEffect(), false
|
||||
).withInterveningIf(TwoOrMoreSpellsWereCastLastTurnCondition.instance));
|
||||
}
|
||||
|
||||
private CallOfTheFullMoon(final CallOfTheFullMoon card) {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,11 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.OnEventTriggeredAbility;
|
||||
import mage.abilities.condition.common.CreatureCountCondition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
|
||||
import mage.abilities.effects.common.SacrificeEffect;
|
||||
import mage.abilities.effects.common.SacrificeSourceEffect;
|
||||
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
|
|
@ -16,33 +13,36 @@ import mage.constants.SubType;
|
|||
import mage.constants.TargetController;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public final class CallToTheGrave 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 FilterCreaturePermanent filter = new FilterCreaturePermanent("non-Zombie creature");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(SubType.ZOMBIE.getPredicate()));
|
||||
}
|
||||
|
||||
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(
|
||||
new FilterCreaturePermanent("no creatures are on the battlefield"), false
|
||||
);
|
||||
|
||||
public CallToTheGrave(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{4}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{B}");
|
||||
|
||||
// At the beginning of each player's upkeep, that player sacrifices a non-Zombie creature.
|
||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(TargetController.EACH_PLAYER, new SacrificeEffect(filter, 1, "that player"), false);
|
||||
this.addAbility(ability);
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
|
||||
TargetController.EACH_PLAYER, new SacrificeEffect(filter, 1, "that player"), false
|
||||
));
|
||||
|
||||
// At the beginning of the end step, if no creatures are on the battlefield, sacrifice Call to the Grave.
|
||||
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
|
||||
).withInterveningIf(condition));
|
||||
}
|
||||
|
||||
private CallToTheGrave(final CallToTheGrave card) {
|
||||
|
|
|
|||
|
|
@ -1,15 +1,17 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.triggers.BeginningOfCombatTriggeredAbility;
|
||||
import mage.abilities.condition.common.CovenCondition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
||||
import mage.abilities.hint.common.CovenHint;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.triggers.BeginningOfCombatTriggeredAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.constants.AbilityWord;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -27,14 +29,9 @@ public final class CandlegroveWitch extends CardImpl {
|
|||
this.toughness = new MageInt(2);
|
||||
|
||||
// Coven — At the beginning of combat on your turn, if you control three or more creatures with different powers, Candlegrove Witch gains flying until end of turn.
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
|
||||
new BeginningOfCombatTriggeredAbility(
|
||||
new GainAbilitySourceEffect(
|
||||
FlyingAbility.getInstance(), Duration.EndOfTurn
|
||||
)
|
||||
), CovenCondition.instance, "At the beginning of combat on your turn, if you control three " +
|
||||
"or more creatures with different powers, {this} gains flying until end of turn."
|
||||
).addHint(CovenHint.instance).setAbilityWord(AbilityWord.COVEN));
|
||||
this.addAbility(new BeginningOfCombatTriggeredAbility(
|
||||
new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn)
|
||||
).withInterveningIf(CovenCondition.instance).addHint(CovenHint.instance).setAbilityWord(AbilityWord.COVEN));
|
||||
}
|
||||
|
||||
private CandlegroveWitch(final CandlegroveWitch card) {
|
||||
|
|
|
|||
|
|
@ -1,15 +1,17 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.triggers.BeginningOfCombatTriggeredAbility;
|
||||
import mage.abilities.condition.common.CovenCondition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
||||
import mage.abilities.hint.common.CovenHint;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.abilities.triggers.BeginningOfCombatTriggeredAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.constants.AbilityWord;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -27,14 +29,9 @@ public final class CandlelitCavalry extends CardImpl {
|
|||
this.toughness = new MageInt(5);
|
||||
|
||||
// Coven — At the beginning of combat on your turn, if you control three or more creatures with different powers, Candlelit Cavalry gains trample until end of turn.
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
|
||||
new BeginningOfCombatTriggeredAbility(
|
||||
new GainAbilitySourceEffect(
|
||||
TrampleAbility.getInstance(), Duration.EndOfTurn
|
||||
)
|
||||
), CovenCondition.instance, "At the beginning of combat on your turn, if you control " +
|
||||
"three or more creatures with different powers, {this} gains trample until end of turn."
|
||||
).addHint(CovenHint.instance).setAbilityWord(AbilityWord.COVEN));
|
||||
this.addAbility(new BeginningOfCombatTriggeredAbility(new GainAbilitySourceEffect(
|
||||
TrampleAbility.getInstance(), Duration.EndOfTurn
|
||||
)).withInterveningIf(CovenCondition.instance).addHint(CovenHint.instance).setAbilityWord(AbilityWord.COVEN));
|
||||
}
|
||||
|
||||
private CandlelitCavalry(final CandlelitCavalry card) {
|
||||
|
|
|
|||
|
|
@ -1,26 +1,43 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.triggers.BeginningOfCombatTriggeredAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.effects.common.TransformSourceEffect;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.hint.ValueHint;
|
||||
import mage.abilities.keyword.TransformAbility;
|
||||
import mage.constants.SubType;
|
||||
import mage.abilities.triggers.BeginningOfCombatTriggeredAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.ToughnessGreaterThanPowerPredicate;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author weirddan455
|
||||
*/
|
||||
public final class CatapultFodder extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterControlledCreaturePermanent(
|
||||
"you control three or more creatures that each have toughness greater than their power"
|
||||
);
|
||||
|
||||
static {
|
||||
filter.add(ToughnessGreaterThanPowerPredicate.instance);
|
||||
}
|
||||
|
||||
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.MORE_THAN, 2);
|
||||
private static final Hint hint = new ValueHint(
|
||||
"Creatures you control with toughness greater than their power", new PermanentsOnBattlefieldCount(filter)
|
||||
);
|
||||
|
||||
public CatapultFodder(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
|
||||
|
||||
|
|
@ -31,11 +48,7 @@ public final class CatapultFodder extends CardImpl {
|
|||
|
||||
// At the beginning of combat on your turn, if you control three or more creatures that each have toughness greater than their power, transform Catapult Fodder.
|
||||
this.addAbility(new TransformAbility());
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
|
||||
new BeginningOfCombatTriggeredAbility(new TransformSourceEffect()),
|
||||
CatapultFodderCondition.instance,
|
||||
"At the beginning of combat on your turn, if you control three or more creatures that each have toughness greater than their power, transform {this}"
|
||||
));
|
||||
this.addAbility(new BeginningOfCombatTriggeredAbility(new TransformSourceEffect()).withInterveningIf(condition));
|
||||
}
|
||||
|
||||
private CatapultFodder(final CatapultFodder card) {
|
||||
|
|
@ -47,26 +60,3 @@ public final class CatapultFodder extends CardImpl {
|
|||
return new CatapultFodder(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum CatapultFodderCondition implements Condition {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int creatures = 0;
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) {
|
||||
if (permanent.isCreature(game) && permanent.getToughness().getValue() > permanent.getPower().getValue()) {
|
||||
creatures++;
|
||||
if (creatures >= 3) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "you control three or more creatures that each have toughness greater than their power";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,15 +2,14 @@ package mage.cards.c;
|
|||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.DiesCreatureTriggeredAbility;
|
||||
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.GainLifeEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
|
||||
import mage.abilities.keyword.DeathtouchAbility;
|
||||
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
|
|
@ -27,7 +26,7 @@ import java.util.UUID;
|
|||
public final class ChevillBaneOfMonsters extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter
|
||||
= new FilterPermanent();
|
||||
= new FilterPermanent("your opponents control no permanents with bounty counters on them");
|
||||
private static final FilterPermanent filter2
|
||||
= new FilterCreatureOrPlaneswalkerPermanent("creature or planeswalker an opponent controls");
|
||||
private static final FilterPermanent filter3
|
||||
|
|
@ -59,13 +58,9 @@ public final class ChevillBaneOfMonsters extends CardImpl {
|
|||
this.addAbility(DeathtouchAbility.getInstance());
|
||||
|
||||
// At the beginning of your upkeep, if your opponents control no permanents with bounty counters on them, put a bounty counter on target creature or planeswalker an opponent controls.
|
||||
Ability ability = new ConditionalInterveningIfTriggeredAbility(
|
||||
new BeginningOfUpkeepTriggeredAbility(
|
||||
new AddCountersTargetEffect(CounterType.BOUNTY.createInstance()), false
|
||||
), condition, "At the beginning of your upkeep, " +
|
||||
"if your opponents control no permanents with bounty counters on them, " +
|
||||
"put a bounty counter on target creature or planeswalker an opponent controls."
|
||||
);
|
||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(
|
||||
new AddCountersTargetEffect(CounterType.BOUNTY.createInstance())
|
||||
).withInterveningIf(condition);
|
||||
ability.addTarget(new TargetPermanent(filter2));
|
||||
this.addAbility(ability);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import mage.MageObject;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
|
@ -37,12 +36,7 @@ public final class ChromeReplicator extends CardImpl {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
// When Chrome Replicator enters the battlefield, if you control two or more nonland, nontoken permanents with the same name as one another, create a 4/4 colorless Construct artifact creature token.
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
|
||||
new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new Construct4Token())),
|
||||
ChromeReplicatorCondition.instance, "When {this} enters, " +
|
||||
"if you control two or more nonland, nontoken permanents with the same name as one another, " +
|
||||
"create a 4/4 colorless Construct artifact creature token."
|
||||
));
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new Construct4Token())).withInterveningIf(ChromeReplicatorCondition.instance));
|
||||
}
|
||||
|
||||
private ChromeReplicator(final ChromeReplicator card) {
|
||||
|
|
@ -78,4 +72,9 @@ enum ChromeReplicatorCondition implements Condition {
|
|||
.filter(s -> !s.isEmpty())
|
||||
.anyMatch(s -> nameMap.compute(s, CardUtil::setOrIncrementValue) >= 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "you control two or more nonland, nontoken permanents with the same name as one another";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.DiesSourceTriggeredAbility;
|
||||
import mage.abilities.condition.common.LastTimeCounterRemovedCondition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.effects.CreateTokenCopySourceEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.keyword.VanishingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
|
@ -34,11 +31,10 @@ public final class Chronozoa extends CardImpl {
|
|||
this.addAbility(new VanishingAbility(3));
|
||||
|
||||
// When Chronozoa dies, if it had no time counters on it, create two tokens that are copies of it.
|
||||
Effect effect = new CreateTokenCopySourceEffect(2);
|
||||
effect.setText("create two tokens that are copies of it");
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(new DiesSourceTriggeredAbility(effect, false),
|
||||
LastTimeCounterRemovedCondition.instance,
|
||||
"When {this} dies, if it had no time counters on it, create two tokens that are copies of it."));
|
||||
this.addAbility(new DiesSourceTriggeredAbility(
|
||||
new CreateTokenCopySourceEffect(2)
|
||||
.setText("create two tokens that are copies of it"), false
|
||||
).withInterveningIf(LastTimeCounterRemovedCondition.instance));
|
||||
}
|
||||
|
||||
private Chronozoa(final Chronozoa card) {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
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.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.keyword.KickerAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
|
@ -13,8 +10,9 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class CitanulWoodreaders extends CardImpl {
|
||||
|
|
@ -31,11 +29,8 @@ public final class CitanulWoodreaders extends CardImpl {
|
|||
this.addAbility(new KickerAbility("{2}{G}"));
|
||||
|
||||
// When Citanul Woodreaders enters the battlefield, if it was kicked, draw two cards.
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
|
||||
new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(2)),
|
||||
KickedCondition.ONCE,
|
||||
"When {this} enters, if it was kicked, draw two cards."
|
||||
));
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(2))
|
||||
.withInterveningIf(KickedCondition.ONCE));
|
||||
}
|
||||
|
||||
private CitanulWoodreaders(final CitanulWoodreaders card) {
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ package mage.cards.c;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.OpponentControlsMoreCondition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
|
||||
import mage.abilities.keyword.VigilanceAbility;
|
||||
|
|
@ -29,6 +29,8 @@ public final class ClaimJumper extends CardImpl {
|
|||
filter.add(SubType.PLAINS.getPredicate());
|
||||
}
|
||||
|
||||
private static final Condition condition = new OpponentControlsMoreCondition(StaticFilters.FILTER_LANDS);
|
||||
|
||||
public ClaimJumper(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}");
|
||||
|
||||
|
|
@ -41,27 +43,13 @@ public final class ClaimJumper extends CardImpl {
|
|||
this.addAbility(VigilanceAbility.getInstance());
|
||||
|
||||
// When Claim Jumper enters the battlefield, if an opponent controls more lands than you, you may search your library for a Plains card and put it onto the battlefield tapped. Then if an opponent controls more lands than you, repeat this process once. If you search your library this way, shuffle.
|
||||
Ability ability = new ConditionalInterveningIfTriggeredAbility(
|
||||
new EntersBattlefieldTriggeredAbility(
|
||||
new SearchLibraryPutInPlayEffect(
|
||||
new TargetCardInLibrary(0, 1, filter), true
|
||||
),
|
||||
true
|
||||
),
|
||||
new OpponentControlsMoreCondition(StaticFilters.FILTER_LANDS),
|
||||
"When {this} enters, if an opponent controls more lands than you, "
|
||||
+ "you may search your library for a Plains card and put it onto the battlefield tapped. "
|
||||
+ "Then if an opponent controls more lands than you, repeat this process once. "
|
||||
+ "If you search your library this way, shuffle."
|
||||
);
|
||||
ability.addEffect(
|
||||
new ConditionalOneShotEffect(
|
||||
new SearchLibraryPutInPlayEffect(
|
||||
new TargetCardInLibrary(0, 1, filter), true, false, true
|
||||
),
|
||||
new OpponentControlsMoreCondition(StaticFilters.FILTER_LANDS)
|
||||
)
|
||||
);
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(
|
||||
new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), true), true
|
||||
).withInterveningIf(condition);
|
||||
ability.addEffect(new ConditionalOneShotEffect(
|
||||
new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), true, false, true),
|
||||
condition, "Then if an opponent controls more lands than you, repeat this process once. If you search your library this way, shuffle"
|
||||
));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +1,30 @@
|
|||
package mage.cards.c;
|
||||
|
||||
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.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.AttackingCreatureCount;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.constants.SubType;
|
||||
import mage.abilities.keyword.FlashAbility;
|
||||
import mage.abilities.keyword.KickerAbility;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.keyword.KickerAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author weirddan455
|
||||
*/
|
||||
public final class CleavingSkyrider extends CardImpl {
|
||||
|
||||
private static final DynamicValue xValue = new AttackingCreatureCount("the number of attacking creatures");
|
||||
|
||||
public CleavingSkyrider(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}");
|
||||
|
||||
|
|
@ -41,11 +43,9 @@ public final class CleavingSkyrider extends CardImpl {
|
|||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// When Cleaving Skyrider enters the battlefield, if it was kicked, it deals X damage to any target, where X is the number of attacking creatures.
|
||||
Ability ability = new ConditionalInterveningIfTriggeredAbility(
|
||||
new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(new AttackingCreatureCount())),
|
||||
KickedCondition.ONCE,
|
||||
"When {this} enters, if it was kicked, it deals X damage to any target, where X is the number of attacking creatures."
|
||||
);
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(
|
||||
new DamageTargetEffect(xValue, "it")
|
||||
).withInterveningIf(KickedCondition.ONCE);
|
||||
ability.addTarget(new TargetAnyTarget());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import mage.abilities.condition.common.IsStepCondition;
|
|||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.decorator.ConditionalActivatedAbility;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.effects.common.counter.RemoveCounterSourceEffect;
|
||||
|
|
@ -47,12 +46,9 @@ public final class ClockworkAvian extends CardImpl {
|
|||
));
|
||||
|
||||
// At end of combat, if Clockwork Avian attacked or blocked this combat, remove a +1/+0 counter from it.
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
|
||||
new EndOfCombatTriggeredAbility(
|
||||
new RemoveCounterSourceEffect(CounterType.P1P0.createInstance()), false
|
||||
), AttackedOrBlockedThisCombatSourceCondition.instance, "At end of combat, " +
|
||||
"if {this} attacked or blocked this combat, remove a +1/+0 counter from it."
|
||||
), new AttackedOrBlockedThisCombatWatcher());
|
||||
this.addAbility(new EndOfCombatTriggeredAbility(
|
||||
new RemoveCounterSourceEffect(CounterType.P1P0.createInstance()).setText("remove a +1/+0 counter from it"), false
|
||||
).withInterveningIf(AttackedOrBlockedThisCombatSourceCondition.instance), new AttackedOrBlockedThisCombatWatcher());
|
||||
|
||||
// {X}, {tap}: Put up to X +1/+0 counters on Clockwork Avian. This ability can't cause the total number of +1/+0 counters on Clockwork Avian to be greater than four. Activate this ability only during your upkeep.
|
||||
Ability ability = new ConditionalActivatedAbility(
|
||||
|
|
|
|||
|
|
@ -33,6 +33,6 @@ public enum CovenCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "if you control three or more creatures with different powers";
|
||||
return "you control three or more creatures with different powers";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,29 +2,29 @@ package mage.abilities.condition.common;
|
|||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Created by glerman on 20/6/15.
|
||||
*/
|
||||
public enum LastTimeCounterRemovedCondition implements Condition{
|
||||
public enum LastTimeCounterRemovedCondition implements Condition {
|
||||
|
||||
instance;
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent == null) {
|
||||
permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return Optional
|
||||
.ofNullable(source.getSourcePermanentOrLKI(game))
|
||||
.map(permanent -> permanent.getCounters(game).getCount(CounterType.TIME))
|
||||
.map(x -> x == 0)
|
||||
.isPresent();
|
||||
}
|
||||
if (permanent != null) {
|
||||
final int timeCounters = permanent.getCounters(game).getCount(CounterType.TIME);
|
||||
return timeCounters == 0;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "it had no time counters on it";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.condition.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -10,22 +9,21 @@ import mage.watchers.common.CastSpellLastTurnWatcher;
|
|||
* @author nantuko
|
||||
*/
|
||||
public enum TwoOrMoreSpellsWereCastLastTurnCondition implements Condition {
|
||||
|
||||
instance;
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class);
|
||||
if(watcher == null){
|
||||
return false;
|
||||
}
|
||||
// if any player cast more than two spells, return true
|
||||
for (Integer count : watcher.getAmountOfSpellsCastOnPrevTurn().values()) {
|
||||
if (count >= 2) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// no one cast two or more spells last turn
|
||||
return false;
|
||||
return game
|
||||
.getState()
|
||||
.getWatcher(CastSpellLastTurnWatcher.class)
|
||||
.getAmountOfSpellsCastOnPrevTurn()
|
||||
.values()
|
||||
.stream()
|
||||
.anyMatch(x -> x >= 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "a player cast two or more spells last turn";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue