all refactoring ConditionalInterveningIfTriggeredAbility and no play makes the elk a dull boy

This commit is contained in:
theelk801 2025-06-12 17:41:55 -04:00
parent 79a2f80563
commit 59f7126f64
59 changed files with 498 additions and 844 deletions

View file

@ -5,7 +5,6 @@ import mage.abilities.Ability;
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.PlaneswalkEffect;
import mage.abilities.effects.common.continuous.NextSpellCastHasAbilityEffect;
import mage.abilities.hint.ConditionHint;
@ -25,11 +24,12 @@ import java.util.UUID;
* @author Skiwkr
*/
public final class TARDIS extends CardImpl {
private static final FilterControlledPermanent filter = new FilterControlledPermanent(SubType.TIME_LORD);
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(filter);
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(
new FilterControlledPermanent(SubType.TIME_LORD, "you control a Time Lord")
);
private static final Hint hint = new ConditionHint(condition, "You control a Time Lord");
private static final Hint hint = new ConditionHint(condition);
public TARDIS(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
@ -40,19 +40,14 @@ public final class TARDIS extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// Whenever TARDIS attacks, if you control a Time Lord, the next spell you cast this turn has cascade and you may planeswalk.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new AttacksTriggeredAbility(new NextSpellCastHasAbilityEffect(new CascadeAbility()), false),
new PermanentsOnTheBattlefieldCondition(filter),
"Whenever {this} attacks, if you control a Time Lord, the next spell you cast this turn has cascade and you may planeswalk.");
Ability ability = new AttacksTriggeredAbility(
new NextSpellCastHasAbilityEffect(new CascadeAbility())
).withInterveningIf(condition);
ability.addEffect(new PlaneswalkEffect(true).concatBy("and"));
this.addAbility(ability.addHint(hint));
ability.addEffect(new PlaneswalkEffect(true));
ability.addHint(hint);
this.addAbility(ability);
// Crew 2
this.addAbility(new CrewAbility(2));
}
private TARDIS(final TARDIS card) {

View file

@ -2,26 +2,22 @@ package mage.cards.t;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.condition.common.AttackedThisTurnSourceCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CantBeCounteredControlledEffect;
import mage.abilities.keyword.ReboundAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.filter.predicate.Predicates;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.stack.Spell;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import java.util.Optional;
import java.util.UUID;
/**
@ -29,16 +25,14 @@ import java.util.UUID;
*/
public final class TaigamOjutaiMaster extends CardImpl {
private static final String effectText = "Whenever you cast an instant or sorcery spell from your hand, if {this} attacked this turn, that spell gains rebound.";
private static final FilterSpell filter = new FilterSpell("Instant, sorcery, and Dragon spells you control");
private static final FilterSpell filter = new FilterSpell("instant, sorcery, and Dragon spells you control");
static {
filter.add(
(Predicates.or(
filter.add(Predicates.or(
CardType.INSTANT.getPredicate(),
CardType.SORCERY.getPredicate(),
SubType.DRAGON.getPredicate()))
);
SubType.DRAGON.getPredicate()
));
}
public TaigamOjutaiMaster(UUID ownerId, CardSetInfo setInfo) {
@ -54,10 +48,11 @@ public final class TaigamOjutaiMaster extends CardImpl {
this.addAbility(new SimpleStaticAbility(new CantBeCounteredControlledEffect(filter, Duration.WhileOnBattlefield)));
// Whenever you cast an instant or sorcery spell from your hand, if Taigam, Ojutai Master attacked this turn, that spell gains rebound.
Ability ability = new ConditionalInterveningIfTriggeredAbility(new TaigamOjutaiMasterTriggeredAbility(),
AttackedThisTurnSourceCondition.instance,
effectText);
this.addAbility(ability);
this.addAbility(new SpellCastControllerTriggeredAbility(
Zone.BATTLEFIELD, new TaigamOjutaiMasterEffect(),
StaticFilters.FILTER_SPELL_AN_INSTANT_OR_SORCERY,
false, SetTargetPointer.SPELL, Zone.HAND
).withInterveningIf(AttackedThisTurnSourceCondition.instance));
}
private TaigamOjutaiMaster(final TaigamOjutaiMaster card) {
@ -70,84 +65,33 @@ public final class TaigamOjutaiMaster extends CardImpl {
}
}
class TaigamOjutaiMasterTriggeredAbility extends DelayedTriggeredAbility {
class TaigamOjutaiMasterEffect extends ContinuousEffectImpl {
public TaigamOjutaiMasterTriggeredAbility() {
super(new TaigamOjutaiMasterGainReboundEffect(), Duration.EndOfTurn, true);
setTriggerPhrase("Whenever you cast an instant or sorcery spell from your hand, if {this} attacked this turn, ");
}
private TaigamOjutaiMasterTriggeredAbility(final TaigamOjutaiMasterTriggeredAbility ability) {
super(ability);
}
@Override
public TaigamOjutaiMasterTriggeredAbility copy() {
return new TaigamOjutaiMasterTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getPlayerId().equals(this.getControllerId())) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && spell.getFromZone() == Zone.HAND) {
if (spell.getCard() != null
&& spell.getCard().isInstantOrSorcery(game)) {
for (Effect effect : getEffects()) {
effect.setTargetPointer(new FixedTarget(spell.getId()));
}
return true;
}
}
}
return false;
}
}
class TaigamOjutaiMasterGainReboundEffect extends ContinuousEffectImpl {
TaigamOjutaiMasterGainReboundEffect() {
TaigamOjutaiMasterEffect() {
super(Duration.Custom, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
staticText = "that spell gains rebound";
}
private TaigamOjutaiMasterGainReboundEffect(final TaigamOjutaiMasterGainReboundEffect effect) {
private TaigamOjutaiMasterEffect(final TaigamOjutaiMasterEffect effect) {
super(effect);
}
@Override
public TaigamOjutaiMasterGainReboundEffect copy() {
return new TaigamOjutaiMasterGainReboundEffect(this);
public TaigamOjutaiMasterEffect copy() {
return new TaigamOjutaiMasterEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
if (spell != null) {
Card card = spell.getCard();
if (card != null) {
addReboundAbility(card, source, game);
}
} else {
if (spell == null) {
discard();
}
return true;
}
return false;
}
private void addReboundAbility(Card card, Ability source, Game game) {
boolean found = card.getAbilities(game).containsClass(ReboundAbility.class);
if (!found) {
Ability ability = new ReboundAbility();
game.getState().addOtherAbility(card, ability);
}
Optional.of(spell)
.map(Spell::getCard)
.filter(card -> !card.getAbilities(game).containsClass(ReboundAbility.class))
.ifPresent(card -> game.getState().addOtherAbility(card, new ReboundAbility()));
return true;
}
}

View file

@ -7,7 +7,6 @@ import mage.abilities.common.SpellCastControllerTriggeredAbility;
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.CreateTokenEffect;
import mage.abilities.effects.common.combat.CantBeBlockedByAllTargetEffect;
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect;
@ -34,7 +33,7 @@ import java.util.UUID;
*/
public final class TatsunariToadRider extends CardImpl {
private static final FilterPermanent filter = new FilterControlledCreaturePermanent();
private static final FilterPermanent filter = new FilterControlledCreaturePermanent("you don't control a creature named Keimi");
private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent();
private static final FilterPermanent filter3 = new FilterControlledPermanent(SubType.FROG);
@ -56,14 +55,10 @@ public final class TatsunariToadRider extends CardImpl {
this.toughness = new MageInt(3);
// Whenever you cast an enchantment spell, if you don't control a creature named Keimi, create Keimi, a legendary 3/3 black and green Frog creature token with "Whenever you cast an enchantment spell, each opponent loses 1 life and you gain 1 life."
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new SpellCastControllerTriggeredAbility(
this.addAbility(new SpellCastControllerTriggeredAbility(
new CreateTokenEffect(new KeimiToken()),
StaticFilters.FILTER_SPELL_AN_ENCHANTMENT, false
), condition, "Whenever you cast an enchantment spell, if you don't control " +
"a creature named Keimi, create Keimi, a legendary 3/3 black and green Frog creature token with " +
"\"Whenever you cast an enchantment spell, each opponent loses 1 life and you gain 1 life.\""
));
).withInterveningIf(condition));
// {1}{G/U}: Tatsunari, Toad Rider and target Frog you control can't be blocked this turn except by creatures with flying or reach.
Ability ability = new SimpleActivatedAbility(

View file

@ -2,13 +2,13 @@ package mage.cards.t;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.LandfallAbility;
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.continuous.BecomesCreatureTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.hint.common.LandsYouControlHint;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl;
@ -16,6 +16,7 @@ import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.permanent.token.custom.CreatureToken;
import mage.target.TargetPermanent;
@ -34,7 +35,8 @@ public final class TatyovaStewardOfTides extends CardImpl {
}
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(
StaticFilters.FILTER_LAND, ComparisonType.MORE_THAN, 6, true
new FilterControlledLandPermanent("you control seven or more lands"),
ComparisonType.MORE_THAN, 6, true
);
public TatyovaStewardOfTides(UUID ownerId, CardSetInfo setInfo) {
@ -52,17 +54,13 @@ public final class TatyovaStewardOfTides extends CardImpl {
)));
// Whenever a land you control enters, if you control seven or more lands, up to one target land you control becomes a 3/3 Elemental creature with haste. It's still a land.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldControlledTriggeredAbility(new BecomesCreatureTargetEffect(
new CreatureToken(
Ability ability = new LandfallAbility(
new BecomesCreatureTargetEffect(new CreatureToken(
3, 3, "3/3 Elemental creature with haste", SubType.ELEMENTAL
).withAbility(HasteAbility.getInstance()), false, true, Duration.Custom
), StaticFilters.FILTER_LAND_A), condition, "Whenever a land enters the battlefield " +
"under your control, if you control seven or more lands, up to one target land you control " +
"becomes a 3/3 Elemental creature with haste. It's still a land."
);
).withAbility(HasteAbility.getInstance()), false, true, Duration.Custom)
).withInterveningIf(condition);
ability.addTarget(new TargetPermanent(0, 1, StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND));
this.addAbility(ability);
this.addAbility(ability.setAbilityWord(null).addHint(LandsYouControlHint.instance));
}
private TatyovaStewardOfTides(final TatyovaStewardOfTides card) {

View file

@ -4,7 +4,6 @@ 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.combat.MustBeBlockedByAllTargetEffect;
import mage.abilities.keyword.KickerAbility;
import mage.cards.CardImpl;
@ -33,11 +32,7 @@ public final class TauntingArbormage extends CardImpl {
this.addAbility(new KickerAbility("{3}"));
// When Taunting Arbormage enters the battlefield, if it was kicked, all creatures able to block target creature this turn do so.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new MustBeBlockedByAllTargetEffect(Duration.EndOfTurn)),
KickedCondition.ONCE, "When {this} enters, if it was kicked, " +
"all creatures able to block target creature this turn do so."
);
Ability ability = new EntersBattlefieldTriggeredAbility(new MustBeBlockedByAllTargetEffect(Duration.EndOfTurn)).withInterveningIf(KickedCondition.ONCE);
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}

View file

@ -4,15 +4,13 @@ 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.ReturnToHandTargetEffect;
import mage.abilities.keyword.KickerAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.FilterCard;
import mage.filter.common.FilterInstantOrSorceryCard;
import mage.filter.StaticFilters;
import mage.target.common.TargetCardInYourGraveyard;
import java.util.UUID;
@ -22,9 +20,6 @@ import java.util.UUID;
*/
public final class TazeemRoilmage extends CardImpl {
private static final FilterCard filter
= new FilterInstantOrSorceryCard("instant or sorcery card from your graveyard");
public TazeemRoilmage(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}");
@ -37,12 +32,8 @@ public final class TazeemRoilmage extends CardImpl {
this.addAbility(new KickerAbility("{4}"));
// When Tazeem Roilmage enters the battlefield, if it was kicked, return target instant or sorcery card from your graveyard to your hand.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect(), false),
KickedCondition.ONCE, "When {this} enters, if it was kicked, " +
"return target instant or sorcery card from your graveyard to your hand."
);
ability.addTarget(new TargetCardInYourGraveyard(filter));
Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect()).withInterveningIf(KickedCondition.ONCE);
ability.addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_INSTANT_OR_SORCERY_FROM_YOUR_GRAVEYARD));
this.addAbility(ability);
}

View file

@ -1,11 +1,9 @@
package mage.cards.t;
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.TapTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.KickerAbility;
@ -13,17 +11,18 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.target.TargetPermanent;
import java.util.UUID;
/**
*
* @author Rafbill
*/
public final class TempestOwl extends CardImpl {
public TempestOwl(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}");
this.subtype.add(SubType.BIRD);
this.power = new MageInt(1);
@ -36,9 +35,9 @@ public final class TempestOwl extends CardImpl {
this.addAbility(new KickerAbility("{4}{U}"));
// When Tempest Owl enters the battlefield, if it was kicked, tap up to three target permanents.
EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new TapTargetEffect(), false);
ability.addTarget(new TargetPermanent(0, 3, new FilterPermanent(), false));
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, KickedCondition.ONCE, "When {this} enters, if it was kicked, tap up to three target permanents."));
Ability ability = new EntersBattlefieldTriggeredAbility(new TapTargetEffect(), false).withInterveningIf(KickedCondition.ONCE);
ability.addTarget(new TargetPermanent(0, 3, StaticFilters.FILTER_PERMANENTS));
this.addAbility(ability);
}
private TempestOwl(final TempestOwl card) {

View file

@ -4,7 +4,6 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.BargainedCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
import mage.abilities.hint.common.BargainCostWasPaidHint;
import mage.abilities.keyword.BargainAbility;
@ -34,11 +33,7 @@ public final class TenaciousTomeseeker extends CardImpl {
this.addAbility(new BargainAbility());
// When Tenacious Tomeseeker enters the battlefield, if it was bargained, return target instant or sorcery card from your graveyard to your hand.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new ReturnFromGraveyardToHandTargetEffect()),
BargainedCondition.instance, "When {this} enters, if it was bargained, " +
"return target instant or sorcery card from your graveyard to your hand."
);
Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnFromGraveyardToHandTargetEffect()).withInterveningIf(BargainedCondition.instance);
ability.addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_INSTANT_OR_SORCERY_FROM_YOUR_GRAVEYARD));
this.addAbility(ability.addHint(BargainCostWasPaidHint.instance));
}

View file

@ -1,24 +1,21 @@
package mage.cards.t;
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.FightTargetSourceEffect;
import mage.abilities.keyword.KickerAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.target.common.TargetCreaturePermanent;
import mage.filter.StaticFilters;
import mage.target.TargetPermanent;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class TerritorialAllosaurus extends CardImpl {
@ -34,14 +31,9 @@ public final class TerritorialAllosaurus extends CardImpl {
this.addAbility(new KickerAbility("{2}{G}"));
// When Territorial Allosaurus enters the battlefield, if it was kicked, it fights another target creature.
EntersBattlefieldTriggeredAbility ability
= new EntersBattlefieldTriggeredAbility(new FightTargetSourceEffect());
Ability conditionalAbility = new ConditionalInterveningIfTriggeredAbility(ability, KickedCondition.ONCE,
"When {this} enters, if it was kicked, it fights another target creature.");
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(AnotherPredicate.instance);
conditionalAbility.addTarget(new TargetCreaturePermanent(filter));
this.addAbility(conditionalAbility);
Ability ability = new EntersBattlefieldTriggeredAbility(new FightTargetSourceEffect()).withInterveningIf(KickedCondition.ONCE);
ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE));
this.addAbility(ability);
}
private TerritorialAllosaurus(final TerritorialAllosaurus card) {

View file

@ -1,24 +1,22 @@
package mage.cards.t;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.triggers.BeginningOfCombatTriggeredAbility;
import mage.abilities.Ability;
import mage.abilities.condition.common.FerociousCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.combat.CanAttackAsThoughItDidntHaveDefenderSourceEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.hint.common.FerociousHint;
import mage.abilities.keyword.DefenderAbility;
import mage.abilities.triggers.BeginningOfCombatTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import java.util.UUID;
/**
*
* @author Xanderhall
*/
public final class TerritorialWitchstalker extends CardImpl {
@ -34,16 +32,11 @@ public final class TerritorialWitchstalker extends CardImpl {
this.addAbility(DefenderAbility.getInstance());
// At the beginning of combat on your turn, if you control a creature with power 4 or greater, Territorial Witchstalker gets +1/+0 until end of turn and can attack this turn as though it didn't have defender.
TriggeredAbility ability = new BeginningOfCombatTriggeredAbility(new BoostSourceEffect(1, 0, Duration.EndOfTurn));
ability.addEffect(new CanAttackAsThoughItDidntHaveDefenderSourceEffect(Duration.EndOfTurn));
ability.addHint(FerociousHint.instance);
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
ability,
FerociousCondition.instance,
"At the beginning of combat on your turn, if you control a creature with power 4 or greater, "
+ "{this} gets +1/+0 until end of turn and can attack this turn as though it didn't have defender"
));
Ability ability = new BeginningOfCombatTriggeredAbility(
new BoostSourceEffect(1, 0, Duration.EndOfTurn)
).withInterveningIf(FerociousCondition.instance);
ability.addEffect(new CanAttackAsThoughItDidntHaveDefenderSourceEffect(Duration.EndOfTurn, "and"));
this.addAbility(ability.addHint(FerociousHint.instance));
}
private TerritorialWitchstalker(final TerritorialWitchstalker card) {

View file

@ -5,7 +5,6 @@ import mage.abilities.ActivatedAbility;
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.ContinuousEffectImpl;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.cards.Card;
@ -37,11 +36,8 @@ public final class TerritoryForge extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}{R}");
// When Territory Forge enters the battlefield, if you cast it, exile target artifact or land.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new ExileTargetEffect().setToSourceExileZone(true)),
CastFromEverywhereSourceCondition.instance,
"When {this} enters, if you cast it, exile target artifact or land."
);
Ability ability = new EntersBattlefieldTriggeredAbility(new ExileTargetEffect().setToSourceExileZone(true))
.withInterveningIf(CastFromEverywhereSourceCondition.instance);
ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability);
@ -89,7 +85,7 @@ class TerritoryForgeStaticEffect extends ContinuousEffectImpl {
}
for (Card card : exileZone.getCards(game)) {
for (Ability ability : card.getAbilities(game)) {
if (ability.isActivatedAbility()){
if (ability.isActivatedAbility()) {
ActivatedAbility copyAbility = (ActivatedAbility) ability.copy();
permanent.addAbility(copyAbility, source.getSourceId(), game, true);
}

View file

@ -1,30 +1,29 @@
package mage.cards.t;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbility;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.condition.common.LifeCompareCondition;
import mage.abilities.effects.common.WinGameSourceControllerEffect;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.game.Game;
import mage.constants.ComparisonType;
import mage.constants.TargetController;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public final class TestOfEndurance extends CardImpl {
private static final Condition condition = new LifeCompareCondition(TargetController.YOU, ComparisonType.OR_GREATER, 50);
public TestOfEndurance(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{W}{W}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}{W}");
// At the beginning of your upkeep, if you have 50 or more life, you win the game.
TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(new WinGameSourceControllerEffect());
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, new FiftyOrMoreLifeCondition(), "At the beginning of your upkeep, if you have 50 or more life, you win the game."));
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new WinGameSourceControllerEffect()).withInterveningIf(condition));
}
private TestOfEndurance(final TestOfEndurance card) {
@ -36,12 +35,3 @@ public final class TestOfEndurance extends CardImpl {
return new TestOfEndurance(this);
}
}
class FiftyOrMoreLifeCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
return game.getPlayer(source.getControllerId()).getLife() >= 50;
}
}

View file

@ -5,11 +5,9 @@ import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.condition.common.EquippedSourceCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.dynamicvalue.common.GreatestAmongPermanentsValue;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.cost.CastFromHandForFreeEffect;
import mage.abilities.hint.Hint;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -40,7 +38,6 @@ public final class TetsuoImperialChampion extends CardImpl {
}
static final GreatestAmongPermanentsValue xValue = new GreatestAmongPermanentsValue(GreatestAmongPermanentsValue.Quality.ManaValue, filterEquipment);
private static final Hint hint = xValue.getHint();
private static final FilterCard filter = new FilterInstantOrSorceryCard(
"an instant or sorcery spell from your hand with mana value " +
"less than or equal to the highest mana value among Equipment attached to {this}"
@ -61,19 +58,16 @@ public final class TetsuoImperialChampion extends CardImpl {
// Whenever Tetsuo, Imperial Champion attacks, if it's equipped, choose one --
// * Tetsuo deals damage equal to the greatest mana value among Equipment attached to it to any target.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new AttacksTriggeredAbility(new DamageTargetEffect(
xValue, "it"
).setText("{this} deals damage equal to the greatest mana value " +
Ability ability = new AttacksTriggeredAbility(
new DamageTargetEffect(xValue, "it")
.setText("{this} deals damage equal to the greatest mana value " +
"among Equipment attached to it to any target")
).setTriggerPhrase("Whenever {this} attacks, if it's equipped, "),
EquippedSourceCondition.instance, null
);
).setTriggerPhrase("Whenever {this} attacks, if it's equipped, ").withInterveningIf(EquippedSourceCondition.instance);
ability.addTarget(new TargetAnyTarget());
// * You may cast an instant or sorcery spell from your hand with mana value less than or equal to the greatest mana value among Equipment attached to Tetsuo without paying its mana cost.
ability.addMode(new Mode(new CastFromHandForFreeEffect(filter)));
this.addAbility(ability);
this.addAbility(ability.addHint(xValue.getHint()));
}
private TetsuoImperialChampion(final TetsuoImperialChampion card) {

View file

@ -1,33 +1,36 @@
package mage.cards.t;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbility;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.TransformSourceEffect;
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
import mage.abilities.hint.common.LandsYouControlHint;
import mage.abilities.keyword.TransformAbility;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.filter.common.FilterLandPermanent;
import mage.target.common.TargetCardInLibrary;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ThaumaticCompass extends CardImpl {
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(
new FilterLandPermanent("you control seven or more lands"),
ComparisonType.MORE_THAN, 6, true
);
public ThaumaticCompass(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
this.secondSideCardClazz = mage.cards.s.SpiresOfOrazca.class;
@ -41,11 +44,8 @@ public final class ThaumaticCompass extends CardImpl {
// At the beginning of your end step, if you control seven or more lands, transform Thaumatic Compass.
this.addAbility(new TransformAbility());
TriggeredAbility ability2 = new BeginningOfEndStepTriggeredAbility(new TransformSourceEffect());
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
ability2,
new PermanentsOnTheBattlefieldCondition(new FilterLandPermanent(), ComparisonType.MORE_THAN, 6, true),
"At the beginning of your end step, if you control seven or more lands, transform {this}."));
this.addAbility(new BeginningOfEndStepTriggeredAbility(new TransformSourceEffect())
.withInterveningIf(condition).addHint(LandsYouControlHint.instance));
}
private ThaumaticCompass(final ThaumaticCompass card) {

View file

@ -8,7 +8,6 @@ import mage.abilities.condition.common.YouGainedLifeCondition;
import mage.abilities.costs.common.ExileSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.continuous.CantLoseGameSourceControllerEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
@ -33,7 +32,7 @@ import java.util.UUID;
public final class TheBookOfExaltedDeeds extends CardImpl {
private static final Condition condition = new YouGainedLifeCondition(ComparisonType.MORE_THAN, 2);
private static final Hint hint = new ConditionHint(condition, "You gained 3 or more life this turn");
private static final Hint hint = new ConditionHint(condition);
private static final FilterPermanent filter = new FilterPermanent(SubType.ANGEL, "Angel");
public TheBookOfExaltedDeeds(UUID ownerId, CardSetInfo setInfo) {
@ -42,12 +41,8 @@ public final class TheBookOfExaltedDeeds extends CardImpl {
this.supertype.add(SuperType.LEGENDARY);
// At the beginning of your end step, if you gained 3 or more life this turn, create a 3/3 white Angel creature token with flying.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new BeginningOfEndStepTriggeredAbility(
new CreateTokenEffect(new Angel33Token())
), condition, "At the beginning of your end step, "
+ "if you gained 3 or more life this turn, create a 3/3 white Angel creature token with flying."
).addHint(hint), new PlayerGainedLifeWatcher());
this.addAbility(new BeginningOfEndStepTriggeredAbility(new CreateTokenEffect(new Angel33Token()))
.withInterveningIf(condition).addHint(hint), new PlayerGainedLifeWatcher());
// {W}{W}{W}, {T}, Exile The Book of Exalted Deeds: Put an enlightened counter on target Angel. It gains "You can't lose the game and your opponents can't win the game." Activate only as a sorcery.
Ability ability = new ActivateAsSorceryActivatedAbility(

View file

@ -1,14 +1,13 @@
package mage.cards.t;
import mage.abilities.Ability;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.DescendCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.MillCardsControllerEffect;
import mage.abilities.effects.common.TransformSourceEffect;
import mage.abilities.keyword.TransformAbility;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AbilityWord;
@ -18,7 +17,6 @@ import mage.constants.SuperType;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public class TheEverflowingWell extends CardImpl {
@ -37,11 +35,8 @@ public class TheEverflowingWell extends CardImpl {
// Descend 8 -- At the beginning of your upkeep, if there are eight or more permanent cards in your graveyard, transform The Everflowing Well.
this.addAbility(new TransformAbility());
Ability ability = new ConditionalInterveningIfTriggeredAbility(new BeginningOfUpkeepTriggeredAbility(
new TransformSourceEffect()),
DescendCondition.EIGHT, "At the beginning of your upkeep, if there are eight or more permanent cards in your graveyard, transform {this}.");
ability.setAbilityWord(AbilityWord.DESCEND_8).addHint(DescendCondition.getHint());
this.addAbility(ability);
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new TransformSourceEffect())
.withInterveningIf(DescendCondition.EIGHT).setAbilityWord(AbilityWord.DESCEND_8).addHint(DescendCondition.getHint()));
}
private TheEverflowingWell(final TheEverflowingWell card) {

View file

@ -1,12 +1,10 @@
package mage.cards.t;
import mage.abilities.Ability;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.condition.common.CastFromEverywhereSourceCondition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.CountersSourceCount;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
@ -15,6 +13,7 @@ import mage.abilities.effects.common.continuous.GainAbilityControllerEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.IndestructibleAbility;
import mage.abilities.keyword.ProtectionFromEverythingAbility;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -40,17 +39,12 @@ public final class TheOneRing extends CardImpl {
this.addAbility(IndestructibleAbility.getInstance());
// When The One Ring enters the battlefield, if you cast it, you gain protection from everything until your next turn.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new GainAbilityControllerEffect(
new ProtectionFromEverythingAbility(), Duration.UntilYourNextTurn
)), CastFromEverywhereSourceCondition.instance, "When {this} enters, " +
"if you cast it, you gain protection from everything until your next turn."
));
this.addAbility(new EntersBattlefieldTriggeredAbility(
new GainAbilityControllerEffect(new ProtectionFromEverythingAbility(), Duration.UntilYourNextTurn)
).withInterveningIf(CastFromEverywhereSourceCondition.instance));
// At the beginning of your upkeep, you lose 1 life for each burden counter on The One Ring.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
new LoseLifeSourceControllerEffect(xValue)
));
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new LoseLifeSourceControllerEffect(xValue)));
// {T}: Put a burden counter on The One Ring, then draw a card for each burden counter on The One Ring.
Ability ability = new SimpleActivatedAbility(

View file

@ -1,11 +1,10 @@
package mage.cards.t;
import mage.abilities.Ability;
import mage.abilities.triggers.BeginningOfCombatTriggeredAbility;
import mage.abilities.common.LeavesBattlefieldAllTriggeredAbility;
import mage.abilities.condition.common.SourceHasCountersCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.triggers.BeginningOfCombatTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -36,12 +35,9 @@ public final class TheOzolith extends CardImpl {
this.addAbility(new TheOzolithTriggeredAbility());
// At the beginning of combat on your turn, if The Ozolith has counters on it, you may move all counters from The Ozolith onto target creature.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new BeginningOfCombatTriggeredAbility(
Ability ability = new BeginningOfCombatTriggeredAbility(
new TheOzolithMoveCountersEffect(), true
), SourceHasCountersCondition.instance, "At the beginning of combat on your turn, " +
"if {this} has counters on it, you may move all counters from {this} onto target creature."
);
).withInterveningIf(SourceHasCountersCondition.instance);
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
@ -126,6 +122,7 @@ class TheOzolithMoveCountersEffect extends OneShotEffect {
TheOzolithMoveCountersEffect() {
super(Outcome.Benefit);
staticText = "you may move all counters from {this} onto target creature";
}
private TheOzolithMoveCountersEffect(final TheOzolithMoveCountersEffect effect) {

View file

@ -3,7 +3,6 @@ package mage.cards.t;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.KickedCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.RevealCardsFromLibraryUntilEffect;
import mage.abilities.keyword.KickerAbility;
import mage.cards.CardImpl;
@ -30,13 +29,11 @@ public final class ThicketElemental extends CardImpl {
this.addAbility(new KickerAbility("{1}{G}"));
// When Thicket Elemental enters the battlefield, if it was kicked, you may reveal cards from the top of your library until you reveal a creature card. If you do, put that card onto the battlefield and shuffle all other cards revealed this way into your library.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new RevealCardsFromLibraryUntilEffect(
this.addAbility(new EntersBattlefieldTriggeredAbility(new RevealCardsFromLibraryUntilEffect(
StaticFilters.FILTER_CARD_CREATURE, PutCards.BATTLEFIELD, PutCards.SHUFFLE
)), KickedCondition.ONCE, "When {this} enters, if it was kicked, " +
"you may reveal cards from the top of your library until you reveal a creature card. If you do, " +
"put that card onto the battlefield and shuffle all other cards revealed this way into your library."
));
).setText("reveal cards from the top of your library until you reveal a creature card. If you do, " +
"put that card onto the battlefield and shuffle all other cards revealed this way into your library"), true
).withInterveningIf(KickedCondition.ONCE));
}
private ThicketElemental(final ThicketElemental card) {

View file

@ -4,7 +4,6 @@ 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.OneShotEffect;
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
import mage.abilities.keyword.FlyingAbility;
@ -44,12 +43,8 @@ public final class ThievingSkydiver extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// When Thieving Skydiver enters the battlefield, if it was kicked, gain control of target artifact with converted mana cost X or less. If that artifact is an Equipment, attach it to Thieving Skydiver.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new GainControlTargetEffect(Duration.Custom), false),
KickedCondition.ONCE, "When {this} enters, if it was kicked, " +
"gain control of target artifact with mana value X or less. " +
"If that artifact is an Equipment, attach it to {this}."
);
Ability ability = new EntersBattlefieldTriggeredAbility(new GainControlTargetEffect(Duration.Custom)
.setText("gain control of target artifact with mana value X or less")).withInterveningIf(KickedCondition.ONCE);
ability.addEffect(new ThievingSkydiverEffect());
ability.addTarget(new TargetArtifactPermanent());
ability.setTargetAdjuster(new XManaValueTargetAdjuster(ComparisonType.OR_LESS));
@ -70,6 +65,7 @@ class ThievingSkydiverEffect extends OneShotEffect {
ThievingSkydiverEffect() {
super(Outcome.Benefit);
staticText = "If that artifact is an Equipment, attach it to {this}";
}
private ThievingSkydiverEffect(final ThievingSkydiverEffect effect) {
@ -84,11 +80,8 @@ class ThievingSkydiverEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
Permanent artifact = game.getPermanent(source.getFirstTarget());
if (permanent == null
|| artifact == null
|| !artifact.isArtifact(game)
|| !artifact.hasSubtype(SubType.EQUIPMENT, game)) {
Permanent artifact = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent == null || artifact == null || !artifact.hasSubtype(SubType.EQUIPMENT, game)) {
return false;
}
game.processAction();

View file

@ -1,23 +1,18 @@
package mage.cards.t;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbility;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.CompoundCondition;
import mage.abilities.condition.Condition;
import mage.abilities.condition.InvertCondition;
import mage.abilities.condition.common.AttachedCondition;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.SacrificeEquippedEffect;
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
import mage.abilities.keyword.EquipAbility;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.WatcherScope;
import mage.game.Game;
import mage.game.events.DamagedEvent;
import mage.game.events.GameEvent;
@ -25,10 +20,9 @@ import mage.game.permanent.Permanent;
import mage.watchers.Watcher;
import java.util.HashSet;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import mage.target.common.TargetControlledCreaturePermanent;
/**
* @author Quercitron
@ -43,17 +37,12 @@ public final class ThirstingAxe extends CardImpl {
this.addAbility(new SimpleStaticAbility(new BoostEquippedEffect(4, 0)));
// At the beginning of your end step, if equipped creature didn't deal combat damage to a creature this turn, sacrifice it.
TriggeredAbility ability = new BeginningOfEndStepTriggeredAbility(new SacrificeEquippedEffect());
Condition condition = new CompoundCondition(
AttachedCondition.instance,
new InvertCondition(new EquippedDealtCombatDamageToCreatureCondition()));
String triggeredAbilityText = "At the beginning of your end step, if equipped creature " +
"didn't deal combat damage to a creature this turn, sacrifice it.";
ConditionalInterveningIfTriggeredAbility sacrificeTriggeredAbility = new ConditionalInterveningIfTriggeredAbility(ability, condition, triggeredAbilityText);
this.addAbility(sacrificeTriggeredAbility, new CombatDamageToCreatureWatcher());
this.addAbility(new BeginningOfEndStepTriggeredAbility(
new SacrificeEquippedEffect().setText("sacrifice it")
).withInterveningIf(ThirstingAxeCondition.instance), new ThirstingAxeWatcher());
// Equip {2}
this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(2), new TargetControlledCreaturePermanent(), false));
this.addAbility(new EquipAbility(2));
}
private ThirstingAxe(final ThirstingAxe card) {
@ -66,43 +55,42 @@ public final class ThirstingAxe extends CardImpl {
}
}
class EquippedDealtCombatDamageToCreatureCondition implements Condition {
enum ThirstingAxeCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
Permanent equipment = game.getPermanent(source.getSourceId());
if (equipment != null && equipment.getAttachedTo() != null) {
CombatDamageToCreatureWatcher watcher =
game.getState().getWatcher(CombatDamageToCreatureWatcher.class);
return watcher != null && watcher.dealtDamage(equipment.getAttachedTo(), equipment.getAttachedToZoneChangeCounter(), game);
}
return false;
return Optional
.ofNullable(source.getSourcePermanentOrLKI(game))
.map(Permanent::getAttachedTo)
.filter(uuid -> ThirstingAxeWatcher.checkCreature(uuid, game))
.isPresent();
}
@Override
public String toString() {
return "equipped creature didn't deal combat damage to a creature this turn";
}
}
class CombatDamageToCreatureWatcher extends Watcher {
class ThirstingAxeWatcher extends Watcher {
// which objects dealt combat damage to creature during the turn
private final Set<MageObjectReference> dealtCombatDamageToCreature;
private final Set<MageObjectReference> dealtCombatDamageToCreature = new HashSet<>();
public CombatDamageToCreatureWatcher() {
public ThirstingAxeWatcher() {
super(WatcherScope.GAME);
dealtCombatDamageToCreature = new HashSet<>();
}
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() != GameEvent.EventType.DAMAGED_PERMANENT
|| !((DamagedEvent) event).isCombatDamage()) {
if (event.getType() != GameEvent.EventType.DAMAGED_PERMANENT || !((DamagedEvent) event).isCombatDamage()) {
return;
}
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent == null || !permanent.isCreature(game)) {
return;
if (permanent != null && permanent.isCreature(game)) {
dealtCombatDamageToCreature.add(new MageObjectReference(event.getSourceId(), game));
}
MageObjectReference damageSource = new MageObjectReference(event.getSourceId(), game);
dealtCombatDamageToCreature.add(damageSource);
}
@Override
@ -111,9 +99,12 @@ class CombatDamageToCreatureWatcher extends Watcher {
dealtCombatDamageToCreature.clear();
}
public boolean dealtDamage(UUID objectId, int zoneChangeCounter, Game game) {
MageObjectReference reference = new MageObjectReference(objectId, zoneChangeCounter, game);
return dealtCombatDamageToCreature.contains(reference);
static boolean checkCreature(UUID permanentId, Game game) {
return game
.getState()
.getWatcher(ThirstingAxeWatcher.class)
.dealtCombatDamageToCreature
.stream()
.anyMatch(mor -> mor.refersTo(permanentId, game));
}
}

View file

@ -2,13 +2,12 @@ package mage.cards.t;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.ReturnToHandSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -25,7 +24,7 @@ import java.util.UUID;
*/
public final class ThopterAssembly extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent(SubType.THOPTER, "");
private static final FilterPermanent filter = new FilterPermanent(SubType.THOPTER, "you control no Thopters other than {this}");
static {
filter.add(AnotherPredicate.instance);
@ -44,15 +43,8 @@ public final class ThopterAssembly extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// At the beginning of your upkeep, if you control no Thopters other than Thopter Assembly, return Thopter Assembly to its owner's hand and create five 1/1 colorless Thopter artifact creature tokens with flying.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(
new ReturnToHandSourceEffect(true), false
), condition, "At the beginning of your upkeep, " +
"if you control no Thopters other than {this}, " +
"return {this} to its owner's hand and create five 1/1 colorless " +
"Thopter artifact creature tokens with flying."
);
ability.addEffect(new CreateTokenEffect(new ThopterColorlessToken(), 5));
Ability ability = new BeginningOfUpkeepTriggeredAbility(new ReturnToHandSourceEffect(true)).withInterveningIf(condition);
ability.addEffect(new CreateTokenEffect(new ThopterColorlessToken(), 5).concatBy("and"));
this.addAbility(ability);
}

View file

@ -1,12 +1,10 @@
package mage.cards.t;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.KickedCostCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.keyword.KickerAbility;
@ -14,17 +12,21 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.target.common.TargetArtifactPermanent;
import mage.target.common.TargetAnyTarget;
import mage.target.common.TargetArtifactPermanent;
import java.util.UUID;
/**
*
* @author FenrisulfrX
*/
public final class ThornscapeBattlemage extends CardImpl {
private static final Condition condition = new KickedCostCondition("{R}");
private static final Condition condition2 = new KickedCostCondition("{W}");
public ThornscapeBattlemage(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.ELF);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(2);
@ -36,16 +38,16 @@ public final class ThornscapeBattlemage extends CardImpl {
this.addAbility(kickerAbility);
// When {this} enters, if it was kicked with its {R} kicker, it deals 2 damage to any target.
TriggeredAbility ability1 = new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(2, "it"));
ability1.addTarget(new TargetAnyTarget());
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability1, new KickedCostCondition("{R}"),
"When {this} enters, if it was kicked with its {R} kicker, it deals 2 damage to any target."));
Ability ability = new EntersBattlefieldTriggeredAbility(
new DamageTargetEffect(2, "it")
).withInterveningIf(condition);
ability.addTarget(new TargetAnyTarget());
this.addAbility(ability);
// When {this} enters, if it was kicked with its {W} kicker, destroy target artifact.
TriggeredAbility ability2 = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect());
ability2.addTarget(new TargetArtifactPermanent());
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability2, new KickedCostCondition("{W}"),
"When {this} enters, if it was kicked with its {W} kicker, destroy target artifact."));
ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect()).withInterveningIf(condition2);
ability.addTarget(new TargetArtifactPermanent());
this.addAbility(ability);
}
private ThornscapeBattlemage(final ThornscapeBattlemage card) {

View file

@ -1,26 +1,28 @@
package mage.cards.t;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
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.continuous.GainControlTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
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.SubType;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
*
* @author awjackson
*/
public final class ThoughtboundPrimoc extends CardImpl {
@ -37,12 +39,8 @@ public final class ThoughtboundPrimoc extends CardImpl {
// At the beginning of your upkeep, if a player controls more Wizards than each other player,
// the player who controls the most Wizards gains control of Thoughtbound Primoc.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(new ThoughtboundPrimocEffect()),
OnePlayerHasTheMostWizards.instance,
"At the beginning of your upkeep, if a player controls more Wizards than each other player, the player who controls the most Wizards gains control of {this}"
));
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new ThoughtboundPrimocEffect())
.withInterveningIf(OnePlayerHasTheMostWizards.instance));
}
private ThoughtboundPrimoc(final ThoughtboundPrimoc card) {

View file

@ -1,36 +1,38 @@
package mage.cards.t;
import java.util.UUID;
import mage.abilities.TriggeredAbility;
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.SacrificeSourceEffect;
import mage.abilities.mana.AnyColorManaAbility;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.TargetController;
import mage.game.events.GameEvent;
import mage.filter.common.FilterControlledCreaturePermanent;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class ThranQuarry extends CardImpl {
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(
new FilterControlledCreaturePermanent("you control no creatures"), ComparisonType.EQUAL_TO, 0
);
public ThranQuarry(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.LAND},"");
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
// At the beginning of the end step, if you control no creatures, sacrifice Thran Quarry.
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.YOU),
"At the beginning of the end step, if you control no creatures, sacrifice {this}."));
this.addAbility(new BeginningOfEndStepTriggeredAbility(
TargetController.NEXT, new SacrificeSourceEffect(), false, condition
));
// {tap}: Add one mana of any color.
this.addAbility(new AnyColorManaAbility());
}
private ThranQuarry(final ThranQuarry card) {

View file

@ -1,37 +1,32 @@
package mage.cards.t;
import java.util.UUID;
import mage.abilities.TriggeredAbility;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.CardsInHandCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.target.common.TargetOpponentOrPlaneswalker;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public final class Thumbscrews extends CardImpl {
private static final Condition condition = new CardsInHandCondition(ComparisonType.MORE_THAN, 4);
public Thumbscrews(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
// At the beginning of your upkeep, if you have five or more cards in hand, Thumbscrews deals 1 damage to target opponent.
TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(
new DamageTargetEffect(1));
TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(new DamageTargetEffect(1)).withInterveningIf(condition);
ability.addTarget(new TargetOpponentOrPlaneswalker());
CardsInHandCondition condition = new CardsInHandCondition(ComparisonType.MORE_THAN, 4);
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
ability, condition,
"At the beginning of your upkeep, if you have five or more cards in hand, "
+ "{this} deals 1 damage to target opponent or planeswalker."
));
this.addAbility(ability);
}
private Thumbscrews(final Thumbscrews card) {

View file

@ -1,4 +1,3 @@
package mage.cards.t;
import java.util.UUID;
@ -32,12 +31,14 @@ public final class ThunderBrute extends CardImpl {
// Trample
this.addAbility(TrampleAbility.getInstance());
// Tribute 3</i>
// Tribute 3
this.addAbility(new TributeAbility(3));
// When Thunder Brute enters the battlefield, if tribute wasn't paid, it gains haste until end of turn.
TriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.EndOfTurn), false);
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, TributeNotPaidCondition.instance,
"When {this} enters, if tribute wasn't paid, it gains haste until end of turn."));
this.addAbility( new EntersBattlefieldTriggeredAbility(new GainAbilitySourceEffect(
HasteAbility.getInstance(), Duration.EndOfTurn
).setText("it gains haste until end of turn")).withInterveningIf(TributeNotPaidCondition.instance));
}
private ThunderBrute(final ThunderBrute card) {

View file

@ -1,12 +1,10 @@
package mage.cards.t;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.KickedCostCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.discard.DiscardTargetEffect;
import mage.abilities.keyword.KickerAbility;
@ -17,14 +15,18 @@ import mage.constants.SubType;
import mage.target.TargetPlayer;
import mage.target.common.TargetEnchantmentPermanent;
import java.util.UUID;
/**
*
* @author FenrisulfrX
*/
public final class ThunderscapeBattlemage extends CardImpl {
private static final Condition condition = new KickedCostCondition("{1}{B}");
private static final Condition condition2 = new KickedCostCondition("{G}");
public ThunderscapeBattlemage(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(2);
@ -36,16 +38,14 @@ public final class ThunderscapeBattlemage extends CardImpl {
this.addAbility(kickerAbility);
// When {this} enters, if it was kicked with its {1}{B} kicker, target player discards two cards.
TriggeredAbility ability1 = new EntersBattlefieldTriggeredAbility(new DiscardTargetEffect(2));
ability1.addTarget(new TargetPlayer());
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability1, new KickedCostCondition("{1}{B}"),
"When {this} enters, if it was kicked with its {1}{B} kicker, target player discards two cards."));
Ability ability = new EntersBattlefieldTriggeredAbility(new DiscardTargetEffect(2)).withInterveningIf(condition);
ability.addTarget(new TargetPlayer());
this.addAbility(ability);
// When {this} enters, if it was kicked with its {G} kicker, destroy target enchantment.
TriggeredAbility ability2 = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect());
ability2.addTarget(new TargetEnchantmentPermanent());
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability2, new KickedCostCondition("{G}"),
"When {this} enters, if it was kicked with its {G} kicker, destroy target enchantment."));
ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect()).withInterveningIf(condition2);
ability.addTarget(new TargetEnchantmentPermanent());
this.addAbility(ability);
}
private ThunderscapeBattlemage(final ThunderscapeBattlemage card) {

View file

@ -3,7 +3,6 @@ package mage.cards.t;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.CastFromEverywhereSourceCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
@ -45,13 +44,9 @@ public final class Tiamat extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// When Tiamat enters the battlefield, if you cast it, search your library for up to five Dragon cards named Tiama that each have different names, reveal them, put them into your hand, then shuffle.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(new EntersBattlefieldTriggeredAbility(
new SearchLibraryPutInHandEffect(
this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInHandEffect(
new TargetCardWithDifferentNameInLibrary(0, 5, filter), true
)), CastFromEverywhereSourceCondition.instance, "When {this} enters, " +
"if you cast it, search your library for up to five Dragon cards not named Tiamat " +
"that each have different names, reveal them, put them into your hand, then shuffle."
));
)).withInterveningIf(CastFromEverywhereSourceCondition.instance));
}
private Tiamat(final Tiamat card) {

View file

@ -8,7 +8,6 @@ import mage.abilities.condition.Condition;
import mage.abilities.condition.common.KickedCondition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.continuous.BecomesBasicLandTargetEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.hint.ConditionHint;
@ -16,7 +15,10 @@ import mage.abilities.hint.Hint;
import mage.abilities.keyword.KickerAbility;
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.TargetController;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.target.common.TargetLandPermanent;
@ -50,11 +52,7 @@ public final class TideShaper extends CardImpl {
this.addAbility(new KickerAbility("{1}"));
// When Tide Shaper enters the battlefield, if it was kicked, target land becomes an Island for as long as Tide Shaper remains on the battlefield.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new TideShaperEffect()),
KickedCondition.ONCE, "When {this} enters, if it was kicked, " +
"target land becomes an Island for as long as {this} remains on the battlefield."
);
Ability ability = new EntersBattlefieldTriggeredAbility(new TideShaperEffect()).withInterveningIf(KickedCondition.ONCE);
ability.addTarget(new TargetLandPermanent());
this.addAbility(ability);
@ -79,6 +77,7 @@ class TideShaperEffect extends BecomesBasicLandTargetEffect {
TideShaperEffect() {
super(Duration.Custom, false, true, SubType.ISLAND);
staticText = "target land becomes an Island for as long as {this} remains on the battlefield";
}
private TideShaperEffect(final TideShaperEffect effect) {

View file

@ -4,7 +4,6 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.ThresholdCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.abilities.keyword.MenaceAbility;
import mage.cards.CardImpl;
@ -33,11 +32,7 @@ public final class TidecallerMentor extends CardImpl {
this.addAbility(new MenaceAbility(false));
// Threshold -- When Tidecaller Mentor enters, if seven or more cards are in your graveyard, return up to one target nonland permanent to its owner's hand.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect()),
ThresholdCondition.instance, "When {this} enters, if seven or more cards " +
"are in your graveyard, return up to one target nonland permanent to its owner's hand."
);
Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect()).withInterveningIf(ThresholdCondition.instance);
ability.addTarget(new TargetNonlandPermanent(0, 1));
this.addAbility(ability.setAbilityWord(AbilityWord.THRESHOLD));
}

View file

@ -1,31 +1,27 @@
package mage.cards.t;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
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.BoostSourceEffect;
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.FilterControlledPermanent;
import java.util.UUID;
/**
*
* @author TheElk801
*/
public final class TilonallisKnight extends CardImpl {
private static final FilterControlledPermanent filter = new FilterControlledPermanent();
static {
filter.add(SubType.DINOSAUR.getPredicate());
}
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(
new FilterControlledPermanent(SubType.DINOSAUR, "you control a Dinosaur")
);
public TilonallisKnight(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
@ -36,12 +32,7 @@ public final class TilonallisKnight extends CardImpl {
this.toughness = new MageInt(2);
// Whenever Tilonalli's Knight attacks, if you control a Dinosaur, Tilonalli's Knight gets +1/+1 until end of turn.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new AttacksTriggeredAbility(new BoostSourceEffect(1, 1, Duration.EndOfTurn), false),
new PermanentsOnTheBattlefieldCondition(filter),
"Whenever {this} attacks, if you control a Dinosaur, {this} gets +1/+1 until end of turn."
);
this.addAbility(ability);
this.addAbility(new AttacksTriggeredAbility(new BoostSourceEffect(1, 1, Duration.EndOfTurn)).withInterveningIf(condition));
}
private TilonallisKnight(final TilonallisKnight card) {

View file

@ -4,7 +4,6 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.RaidCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
import mage.abilities.hint.common.RaidHint;
import mage.cards.CardImpl;
@ -40,13 +39,9 @@ public final class TimelyHordemate extends CardImpl {
this.toughness = new MageInt(2);
// <i>Raid</i> &mdash; When Timely Hordemate enters the battlefield, if you attacked this turn, return target creature card with converted mana cost 2 or less from your graveyard to the battlefield.
Ability ability = new ConditionalInterveningIfTriggeredAbility(new EntersBattlefieldTriggeredAbility(new ReturnFromGraveyardToBattlefieldTargetEffect()), RaidCondition.instance,
"When {this} enters, if you attacked this turn, return target creature card with mana value 2 or less from your graveyard to the battlefield.");
Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnFromGraveyardToBattlefieldTargetEffect()).withInterveningIf(RaidCondition.instance);
ability.addTarget(new TargetCardInYourGraveyard(filter));
ability.setAbilityWord(AbilityWord.RAID);
ability.addHint(RaidHint.instance);
this.addAbility(ability, new PlayerAttackedWatcher());
this.addAbility(ability.setAbilityWord(AbilityWord.RAID).addHint(RaidHint.instance), new PlayerAttackedWatcher());
}
private TimelyHordemate(final TimelyHordemate card) {

View file

@ -1,28 +1,25 @@
package mage.cards.t;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.ManaWasSpentCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.ColoredManaSymbol;
import mage.target.common.TargetArtifactPermanent;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class TinStreetHooligan extends CardImpl {
public TinStreetHooligan(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{R}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.subtype.add(SubType.GOBLIN);
this.subtype.add(SubType.ROGUE);
@ -30,10 +27,7 @@ public final class TinStreetHooligan extends CardImpl {
this.toughness = new MageInt(1);
// When Tin Street Hooligan enters the battlefield, if {G} was spent to cast Tin Street Hooligan, destroy target artifact.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect()),
ManaWasSpentCondition.GREEN,
"When {this} enters, if {G} was spent to cast it, destroy target artifact.");
Ability ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect()).withInterveningIf(ManaWasSpentCondition.GREEN);
ability.addTarget(new TargetArtifactPermanent());
this.addAbility(ability);
}

View file

@ -2,14 +2,13 @@ package mage.cards.t;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
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.OneShotEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.LoseLifeSourceControllerEffect;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
@ -37,14 +36,11 @@ public final class TinybonesTrinketThief extends CardImpl {
this.toughness = new MageInt(2);
// At the beginning of each end step, if an opponent discarded a card this turn, you draw a card and you lose 1 life.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new BeginningOfEndStepTriggeredAbility(
TargetController.EACH_PLAYER, new DrawCardSourceControllerEffect(1),
false
), TinybonesTrinketThiefCondition.instance, "At the beginning of each end step, " +
"if an opponent discarded a card this turn, you draw a card and you lose 1 life."
Ability ability = new BeginningOfEndStepTriggeredAbility(
TargetController.EACH_PLAYER, new DrawCardSourceControllerEffect(1, true),
false, TinybonesTrinketThiefCondition.instance
);
ability.addEffect(new LoseLifeSourceControllerEffect(1));
ability.addEffect(new LoseLifeSourceControllerEffect(1).concatBy("and"));
this.addAbility(ability, new TinybonesTrinketThiefWatcher());
// {4}{B}{B}: Each opponent with no cards in hand loses 10 life.
@ -69,6 +65,11 @@ enum TinybonesTrinketThiefCondition implements Condition {
TinybonesTrinketThiefWatcher watcher = game.getState().getWatcher(TinybonesTrinketThiefWatcher.class);
return watcher != null && watcher.checkPlayer(source.getControllerId());
}
@Override
public String toString() {
return "an opponent discarded a card this turn";
}
}
class TinybonesTrinketThiefWatcher extends Watcher {

View file

@ -2,25 +2,22 @@ package mage.cards.t;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.InvertCondition;
import mage.abilities.condition.common.MorbidCondition;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.hint.common.MorbidHint;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.filter.StaticFilters;
import mage.game.Game;
import java.util.UUID;
@ -29,7 +26,7 @@ import java.util.UUID;
*/
public final class TitanHunter extends CardImpl {
private static final Condition condition = new InvertCondition(MorbidCondition.instance);
private static final Condition condition = new InvertCondition(MorbidCondition.instance, "no creatures died this turn");
public TitanHunter(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}");
@ -40,11 +37,10 @@ public final class TitanHunter extends CardImpl {
this.toughness = new MageInt(5);
// At the beginning of each player's end step, if no creatures died this turn, Titan Hunter deals 4 damage to that player.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new BeginningOfEndStepTriggeredAbility(
TargetController.EACH_PLAYER, new TitanHunterEffect(), false
), condition, "At the beginning of each player's end step, " +
"if no creatures died this turn, {this} deals 4 damage to that player."
this.addAbility(new BeginningOfEndStepTriggeredAbility(
TargetController.EACH_PLAYER,
new DamageTargetEffect(4, true, "that player"),
false, condition
).addHint(MorbidHint.instance));
// {1}{B}, Sacrifice a creature: You gain 4 life.
@ -62,27 +58,3 @@ public final class TitanHunter extends CardImpl {
return new TitanHunter(this);
}
}
class TitanHunterEffect extends OneShotEffect {
TitanHunterEffect() {
super(Outcome.Benefit);
}
private TitanHunterEffect(final TitanHunterEffect effect) {
super(effect);
}
@Override
public TitanHunterEffect copy() {
return new TitanHunterEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return game.damagePlayerOrPermanent(
game.getActivePlayerId(), 4, source.getSourceId(),
source, game, false, true
) > 0;
}
}

View file

@ -2,19 +2,21 @@ package mage.cards.t;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.condition.CompoundCondition;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.CardsInControllerGraveyardCondition;
import mage.abilities.condition.common.MeldCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.MeldEffect;
import mage.abilities.keyword.ReachAbility;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.Card;
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 mage.game.Game;
import mage.game.events.GameEvent;
@ -28,6 +30,8 @@ import java.util.UUID;
public final class TitaniaVoiceOfGaea extends CardImpl {
private static final Condition condition = new CompoundCondition(
"there are four or more land cards in your graveyard and you " +
"both own and control {this} and a land named Argoth, Sanctum of Nature",
new CardsInControllerGraveyardCondition(4, StaticFilters.FILTER_CARD_LAND),
new MeldCondition("Argoth, Sanctum of Nature", CardType.LAND)
);
@ -50,13 +54,9 @@ public final class TitaniaVoiceOfGaea extends CardImpl {
this.addAbility(new TitaniaVoiceOfGaeaTriggeredAbility());
// At the beginning of your upkeep, if there are four or more land cards in your graveyard and you both own and control Titania, Voice of Gaea and a land named Argoth, Sanctum of Nature, exile them, then meld them into Titania, Gaea Incarnate.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(new MeldEffect(
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new MeldEffect(
"Argoth, Sanctum of Nature", "Titania, Gaea Incarnate"
)), condition, "At the beginning of your upkeep, " +
"if there are four or more land cards in your graveyard and you both own and control {this} " +
"and a land named Argoth, Sanctum of Nature, exile them, then meld them into Titania, Gaea Incarnate."
));
)).withInterveningIf(condition));
}
private TitaniaVoiceOfGaea(final TitaniaVoiceOfGaea card) {

View file

@ -1,12 +1,9 @@
package mage.cards.t;
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.FlyingAbility;
import mage.abilities.keyword.KickerAbility;
@ -16,15 +13,15 @@ import mage.constants.CardType;
import mage.constants.SubType;
import mage.target.common.TargetEnchantmentPermanent;
/**
*
* @author LoneFox
import java.util.UUID;
/**
* @author LoneFox
*/
public final class TolarianEmissary extends CardImpl {
public TolarianEmissary(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(1);
@ -32,13 +29,14 @@ public final class TolarianEmissary extends CardImpl {
// Kicker {1}{W}
this.addAbility(new KickerAbility("{1}{W}"));
// Flying
this.addAbility(FlyingAbility.getInstance());
// When Tolarian Emissary enters the battlefield, if it was kicked, destroy target enchantment.
TriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect());
Ability ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect()).withInterveningIf(KickedCondition.ONCE);
ability.addTarget(new TargetEnchantmentPermanent());
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, KickedCondition.ONCE,
"When {this} enters, if it was kicked, destroy target enchantment."));
this.addAbility(ability);
}
private TolarianEmissary(final TolarianEmissary card) {

View file

@ -1,24 +1,17 @@
package mage.cards.t;
import java.util.UUID;
import mage.MageInt;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.common.AttacksAllTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.RequirementEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.constants.Duration;
import mage.constants.SetTargetPointer;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.abilities.keyword.LifelinkAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.TargetController;
import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -26,8 +19,9 @@ import mage.game.permanent.token.TolsimirMidnightsLightToken;
import mage.target.common.TargetOpponentsCreaturePermanent;
import mage.watchers.common.AttackedOrBlockedThisCombatWatcher;
import java.util.UUID;
/**
*
* @author DominionSpy
*/
public final class TolsimirMidnightsLight extends CardImpl {
@ -54,10 +48,10 @@ public final class TolsimirMidnightsLight extends CardImpl {
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new TolsimirMidnightsLightToken())));
// Whenever a Wolf you control attacks, if Tolsimir attacked this combat, target creature an opponent controls blocks that Wolf this combat if able.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new AttacksAllTriggeredAbility(new TolsimirMidnightsLightEffect(), false, filter, SetTargetPointer.PERMANENT, false),
TolsimirMidnightsLightCondition.instance,
"Whenever a Wolf you control attacks, if {this} attacked this combat, target creature an opponent controls blocks that Wolf this combat if able.");
Ability ability = new AttacksAllTriggeredAbility(
new TolsimirMidnightsLightEffect(), false, filter,
SetTargetPointer.PERMANENT, false
).withInterveningIf(TolsimirMidnightsLightCondition.instance);
ability.addTarget(new TargetOpponentsCreaturePermanent());
this.addAbility(ability, new AttackedOrBlockedThisCombatWatcher());
}
@ -92,12 +86,18 @@ enum TolsimirMidnightsLightCondition implements Condition {
}
return false;
}
@Override
public String toString() {
return "{this} attacked this combat";
}
}
class TolsimirMidnightsLightEffect extends RequirementEffect {
TolsimirMidnightsLightEffect() {
super(Duration.EndOfCombat);
staticText = "target creature an opponent controls blocks that Wolf this combat if able";
}
private TolsimirMidnightsLightEffect(final TolsimirMidnightsLightEffect effect) {

View file

@ -1,34 +1,41 @@
package mage.cards.t;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.triggers.BeginningOfCombatTriggeredAbility;
import mage.abilities.condition.LockedInCondition;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.AddContinuousEffectToGame;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.hint.common.ArtifactYouControlHint;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.abilities.triggers.BeginningOfCombatTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.ComparisonType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledArtifactPermanent;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public final class ToolcraftExemplar extends CardImpl {
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(
new FilterControlledArtifactPermanent("you control an artifact")
);
private static final Condition condition2 = new PermanentsOnTheBattlefieldCondition(
StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT, ComparisonType.MORE_THAN, 2
);
public ToolcraftExemplar(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{W}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}");
this.subtype.add(SubType.DWARF);
this.subtype.add(SubType.ARTIFICER);
this.power = new MageInt(1);
@ -36,16 +43,13 @@ public final class ToolcraftExemplar extends CardImpl {
// At the beginning of combat on your turn, if you control an artifact, Toolcraft Exemplar gets +2/+1 until end of turn.
// If you control at least 3 artifacts, it also gains first strike until end of turn.
Effect effect = new ConditionalContinuousEffect(
new GainAbilitySourceEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn),
new LockedInCondition(new PermanentsOnTheBattlefieldCondition(new FilterControlledArtifactPermanent(), ComparisonType.MORE_THAN, 2)), null);
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new BeginningOfCombatTriggeredAbility(new BoostSourceEffect(2, 1, Duration.EndOfTurn)),
new PermanentsOnTheBattlefieldCondition(new FilterControlledArtifactPermanent()),
"At the beginning of combat on your turn, if you control an artifact, {this} gets +2/+1 until end of turn."
+ " If you control at least 3 artifacts, it also gains first strike until end of turn.");
ability.addEffect(effect);
this.addAbility(ability);
Ability ability = new BeginningOfCombatTriggeredAbility(new BoostSourceEffect(
2, 1, Duration.EndOfTurn
)).withInterveningIf(condition);
ability.addEffect(new ConditionalOneShotEffect(new AddContinuousEffectToGame(
new GainAbilitySourceEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn)
), condition2, "If you control at least 3 artifacts, it also gains first strike until end of turn"));
this.addAbility(ability.addHint(ArtifactYouControlHint.instance));
}
private ToolcraftExemplar(final ToolcraftExemplar card) {

View file

@ -1,34 +1,34 @@
package mage.cards.t;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.DeliriumCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.dynamicvalue.common.CardTypesInGraveyardCount;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
* @author fireshoes
*/
public final class ToothCollector extends CardImpl {
private static final FilterPermanent filter = new FilterCreaturePermanent("creature that player controls");
static {
filter.add(TargetController.ACTIVE.getControllerPredicate());
}
public ToothCollector(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
this.subtype.add(SubType.HUMAN);
@ -43,13 +43,11 @@ public final class ToothCollector extends CardImpl {
// {<i>Delirium</i> &mdash; At the beginning of each opponent's upkeep, if there are four or more card types among cards in your graveyard,
// target creature that player controls gets -1/-1 until end of turn.
ability = new ConditionalInterveningIfTriggeredAbility(
new ToothCollectorAbility(),
DeliriumCondition.instance,
"<i>Delirium</i> &mdash; At the beginning of each opponent's upkeep, if there are four or more card types among cards in your graveyard, "
+ "target creature that player controls gets -1/-1 until end of turn.");
ability.addHint(CardTypesInGraveyardCount.YOU.getHint());
this.addAbility(ability);
ability = new BeginningOfUpkeepTriggeredAbility(
TargetController.OPPONENT, new BoostTargetEffect(-1, -1), false
).withInterveningIf(DeliriumCondition.instance);
ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability.setAbilityWord(AbilityWord.DELIRIUM).addHint(CardTypesInGraveyardCount.YOU.getHint()));
}
private ToothCollector(final ToothCollector card) {
@ -61,45 +59,3 @@ public final class ToothCollector extends CardImpl {
return new ToothCollector(this);
}
}
class ToothCollectorAbility extends TriggeredAbilityImpl {
public ToothCollectorAbility() {
super(Zone.BATTLEFIELD, new BoostTargetEffect(-1, -1, Duration.EndOfTurn));
}
private ToothCollectorAbility(final ToothCollectorAbility ability) {
super(ability);
}
@Override
public ToothCollectorAbility copy() {
return new ToothCollectorAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getOpponents(controllerId).contains(event.getPlayerId())) {
Player opponent = game.getPlayer(event.getPlayerId());
if (opponent != null) {
FilterCreaturePermanent FILTER = new FilterCreaturePermanent("creature " + opponent.getLogName() + " controls");
FILTER.add(new ControllerIdPredicate(opponent.getId()));
this.getTargets().clear();
this.addTarget(new TargetCreaturePermanent(FILTER));
return true;
}
}
return false;
}
@Override
public String getRule() {
return "<i>Delirium</i> &mdash; At the beginning of each opponent's upkeep, if there are four or more card types among cards in your graveyard, "
+ "target creature that player controls gets -1/-1 until end of turn.";
}
}

View file

@ -1,34 +1,38 @@
package mage.cards.t;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.DeliriumCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.dynamicvalue.common.CardTypesInGraveyardCount;
import mage.abilities.effects.common.TapTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AbilityWord;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
* @author fireshoes
*/
public final class Topplegeist extends CardImpl {
private static final FilterPermanent filter = new FilterCreaturePermanent("creature that player controls");
static {
filter.add(TargetController.ACTIVE.getControllerPredicate());
}
public Topplegeist(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}");
this.subtype.add(SubType.SPIRIT);
@ -45,13 +49,10 @@ public final class Topplegeist extends CardImpl {
// <i>Delirium</i> &mdash; At the beginning of each opponent's upkeep, if there are four or more card types among cards in your graveyard,
// tap target creature that player controls.
ability = new ConditionalInterveningIfTriggeredAbility(
new TopplegeistAbility(),
DeliriumCondition.instance,
"<i>Delirium</i> &mdash; At the beginning of each opponent's upkeep, if there are four or more card types among cards in your graveyard, "
+ "tap target creature that player controls.");
ability.addHint(CardTypesInGraveyardCount.YOU.getHint());
this.addAbility(ability);
ability = new BeginningOfUpkeepTriggeredAbility(TargetController.OPPONENT, new TapTargetEffect(), false)
.withInterveningIf(DeliriumCondition.instance);
ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability.setAbilityWord(AbilityWord.DELIRIUM).addHint(CardTypesInGraveyardCount.YOU.getHint()));
}
private Topplegeist(final Topplegeist card) {
@ -63,44 +64,3 @@ public final class Topplegeist extends CardImpl {
return new Topplegeist(this);
}
}
class TopplegeistAbility extends TriggeredAbilityImpl {
public TopplegeistAbility() {
super(Zone.BATTLEFIELD, new TapTargetEffect());
}
private TopplegeistAbility(final TopplegeistAbility ability) {
super(ability);
}
@Override
public TopplegeistAbility copy() {
return new TopplegeistAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getOpponents(controllerId).contains(event.getPlayerId())) {
Player opponent = game.getPlayer(event.getPlayerId());
if (opponent != null) {
FilterCreaturePermanent FILTER = new FilterCreaturePermanent("creature " + opponent.getLogName() + " controls");
FILTER.add(new ControllerIdPredicate(opponent.getId()));
this.getTargets().clear();
this.addTarget(new TargetCreaturePermanent(FILTER));
return true;
}
}
return false;
}
@Override
public String getRule() {
return "At the beginning of each opponent's upkeep, if there are four or more card types among cards in your graveyard, tap target creature that player controls.";
}
}

View file

@ -1,11 +1,9 @@
package mage.cards.t;
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.DamageTargetEffect;
import mage.abilities.keyword.KickerAbility;
import mage.cards.CardImpl;
@ -14,14 +12,15 @@ import mage.constants.CardType;
import mage.constants.SubType;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author North
*/
public final class TorchSlinger extends CardImpl {
public TorchSlinger(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}");
this.subtype.add(SubType.GOBLIN);
this.subtype.add(SubType.SHAMAN);
@ -31,11 +30,10 @@ public final class TorchSlinger extends CardImpl {
// Kicker {1}{R} (You may pay an additional {1}{R} as you cast this spell.)
this.addAbility(new KickerAbility("{1}{R}"));
// When Torch Slinger enters the battlefield, if it was kicked, it deals 2 damage to target creature.
EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(2), false);
Ability ability = new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(2, "it")).withInterveningIf(KickedCondition.ONCE);
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, KickedCondition.ONCE, "When {this} enters, if it was kicked, it deals 2 damage to target creature."));
this.addAbility(ability);
}
private TorchSlinger(final TorchSlinger card) {

View file

@ -6,7 +6,6 @@ import mage.abilities.Ability;
import mage.abilities.common.DiscardsACardOpponentTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.KickedCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.effects.common.discard.DiscardTargetEffect;
import mage.abilities.keyword.KickerAbility;
@ -47,11 +46,7 @@ public final class TourachDreadCantor extends CardImpl {
));
// When Tourach enters the battelfield, if it was kicked, target opponent discards two cards at random.
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new DiscardTargetEffect(2, true)),
KickedCondition.ONCE, "When {this} enters, if it was kicked, " +
"target opponent discards two cards at random."
);
Ability ability = new EntersBattlefieldTriggeredAbility(new DiscardTargetEffect(2, true)).withInterveningIf(KickedCondition.ONCE);
ability.addTarget(new TargetOpponent());
this.addAbility(ability);
}

View file

@ -2,17 +2,16 @@ package mage.cards.t;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.DealsDamageToAPlayerAllTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.hint.Hint;
import mage.abilities.hint.ValueHint;
import mage.abilities.keyword.DayboundAbility;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
@ -31,7 +30,7 @@ import java.util.UUID;
*/
public final class TovolarDireOverlord extends CardImpl {
private static final FilterPermanent filter = new FilterControlledPermanent("a Wolf or Werewolf you control");
private static final FilterPermanent filter = new FilterControlledPermanent("you control three or more Wolves and/or Werewolves");
static {
filter.add(Predicates.or(
@ -57,15 +56,10 @@ public final class TovolarDireOverlord extends CardImpl {
this.addAbility(new DealsDamageToAPlayerAllTriggeredAbility(
new DrawCardSourceControllerEffect(1), filter,
false, SetTargetPointer.NONE, true
));
).setTriggerPhrase("Whenever a Wolf or Werewolf you control deals combat damage to a player, "));
// At the beginning of your upkeep, if you control three or more Wolves and/or Werewolves, it becomes night. Then transform any number of Human Werewolves you control.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(
new TovolarDireOverlordEffect(), false
), condition, "At the beginning of your upkeep, if you control three or more Wolves " +
"and/or Werewolves, it becomes night. Then transform any number of Human Werewolves you control."
));
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new TovolarDireOverlordEffect()).withInterveningIf(condition).addHint(hint));
// Daybound
this.addAbility(new DayboundAbility());
@ -92,6 +86,7 @@ class TovolarDireOverlordEffect extends OneShotEffect {
TovolarDireOverlordEffect() {
super(Outcome.Benefit);
staticText = "it becomes night. Then transform any number of Human Werewolves you control";
}
private TovolarDireOverlordEffect(final TovolarDireOverlordEffect effect) {

View file

@ -1,19 +1,21 @@
package mage.cards.t;
import mage.MageInt;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.CardsInHandCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.WinGameSourceControllerEffect;
import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.Duration;
import mage.constants.SubType;
import java.util.UUID;
@ -39,12 +41,7 @@ public final class Triskaidekaphile extends CardImpl {
)));
// At the beginning of your upkeep, if you have exactly thirteen cards in your hand, you win the game.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(
new WinGameSourceControllerEffect(), false
), condition, "At the beginning of your upkeep, " +
"if you have exactly thirteen cards in your hand, you win the game."
));
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new WinGameSourceControllerEffect()).withInterveningIf(condition));
// {3}{U}: Draw a card.
this.addAbility(new SimpleActivatedAbility(

View file

@ -1,10 +1,9 @@
package mage.cards.t;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.BargainedCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.keyword.BargainAbility;
import mage.cards.CardImpl;
@ -44,13 +43,10 @@ public final class TroublemakerOuphe extends CardImpl {
this.addAbility(new BargainAbility());
// When Troublemaker Ouphe enters the battlefield, if it was bargained, exile target artifact or enchantment an opponent controls.
TriggeredAbility trigger = new EntersBattlefieldTriggeredAbility(new ExileTargetEffect());
trigger.addTarget(new TargetPermanent(filter));
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
trigger,
BargainedCondition.instance,
"When {this} enters, if it was bargained, exile target artifact or enchantment an opponent controls."
));
Ability ability = new EntersBattlefieldTriggeredAbility(new ExileTargetEffect())
.withInterveningIf(BargainedCondition.instance);
ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability);
}
private TroublemakerOuphe(final TroublemakerOuphe card) {

View file

@ -4,7 +4,6 @@ import mage.MageInt;
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.DamagePlayersEffect;
import mage.abilities.keyword.ReachAbility;
import mage.cards.CardImpl;
@ -15,8 +14,8 @@ import mage.constants.SubType;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.PowerPredicate;
import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.filter.predicate.mageobject.PowerPredicate;
import java.util.UUID;
@ -25,7 +24,7 @@ import java.util.UUID;
*/
public final class TurretOgre extends CardImpl {
private static final FilterPermanent filter = new FilterControlledCreaturePermanent();
private static final FilterPermanent filter = new FilterControlledCreaturePermanent("you control another creature with power 4 or greater");
static {
filter.add(AnotherPredicate.instance);
@ -46,13 +45,7 @@ public final class TurretOgre extends CardImpl {
this.addAbility(ReachAbility.getInstance());
// When Turret Ogre enters the battlefield, if you control another creature with power 4 or greater, Turret Ogre deals 2 damage to each opponent.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(
new DamagePlayersEffect(2, TargetController.OPPONENT)
), condition, "When {this} enters, " +
"if you control another creature with power 4 or greater, " +
"{this} deals 2 damage to each opponent."
));
this.addAbility(new EntersBattlefieldTriggeredAbility(new DamagePlayersEffect(2, TargetController.OPPONENT)).withInterveningIf(condition));
}
private TurretOgre(final TurretOgre card) {

View file

@ -3,19 +3,21 @@ package mage.cards.t;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.condition.common.CitysBlessingCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.LoseLifeOpponentsEffect;
import mage.abilities.hint.common.CitysBlessingHint;
import mage.abilities.keyword.AscendAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.*;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
@ -42,12 +44,8 @@ public final class TwilightProphet extends CardImpl {
// At the beginning of your upkeep, if you have the city's blessing, reveal the top card of your library and put it into your hand.
// Each opponent loses X life and you gain X life, where X is that card's converted mana cost.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(new BeginningOfUpkeepTriggeredAbility(
new TwilightProphetEffect()), CitysBlessingCondition.instance,
"At the beginning of your upkeep, if you have the city's blessing, reveal the top card of your library and put it into your hand. "
+ "Each opponent loses X life and you gain X life, where X is that card's mana value.")
.addHint(CitysBlessingHint.instance));
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new TwilightProphetEffect())
.withInterveningIf(CitysBlessingCondition.instance).addHint(CitysBlessingHint.instance));
}
private TwilightProphet(final TwilightProphet card) {
@ -64,7 +62,7 @@ class TwilightProphetEffect extends OneShotEffect {
TwilightProphetEffect() {
super(Outcome.Benefit);
this.staticText = "if you have the city's blessing, reveal the top card of your library and put it into your hand. "
this.staticText = "reveal the top card of your library and put it into your hand. "
+ "Each opponent loses X life and you gain X life, where X is that card's mana value.";
}

View file

@ -4,8 +4,8 @@ import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
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.ReplacementEffectImpl;
import mage.abilities.effects.common.TransformSourceEffect;
import mage.abilities.effects.keyword.ExploreTargetEffect;
@ -17,6 +17,7 @@ import mage.constants.ComparisonType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledLandPermanent;
import mage.game.Game;
import mage.game.events.ExploreEvent;
import mage.game.events.GameEvent;
@ -29,6 +30,11 @@ import java.util.UUID;
*/
public final class TwistsAndTurns extends CardImpl {
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(
new FilterControlledLandPermanent("you control seven or more lands"),
ComparisonType.MORE_THAN, 6, true
);
public TwistsAndTurns(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{G}");
this.secondSideCardClazz = mage.cards.m.MycoidMaze.class;
@ -43,12 +49,9 @@ public final class TwistsAndTurns extends CardImpl {
// When a land you control enters, if you control seven or more lands, transform Twists and Turns.
this.addAbility(new TransformAbility());
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldControlledTriggeredAbility(new TransformSourceEffect(), StaticFilters.FILTER_LAND),
new PermanentsOnTheBattlefieldCondition(StaticFilters.FILTER_LANDS, ComparisonType.MORE_THAN, 6, true),
"When a land you control enters, if you control seven or more lands, transform {this}."
));
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(
new TransformSourceEffect(), StaticFilters.FILTER_LAND
).withInterveningIf(condition));
}
private TwistsAndTurns(final TwistsAndTurns card) {
@ -89,7 +92,7 @@ class TwistsAndTurnsReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
ExploreEvent exploreEvent = (ExploreEvent)event;
ExploreEvent exploreEvent = (ExploreEvent) event;
exploreEvent.addScry();
return false;
}

View file

@ -1,11 +1,9 @@
package mage.cards.t;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.SurgedCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.SurgeAbility;
@ -15,14 +13,15 @@ import mage.constants.CardType;
import mage.constants.SubType;
import mage.target.common.TargetAnyTarget;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public final class TyrantOfValakut extends CardImpl {
public TyrantOfValakut(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{R}{R}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{R}{R}");
this.subtype.add(SubType.DRAGON);
this.power = new MageInt(5);
this.toughness = new MageInt(4);
@ -34,10 +33,10 @@ public final class TyrantOfValakut extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// When Tyrant of Valakut enters the battlefield, if its surge cost was paid, it deals 3 damage to any target.
EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(3), false);
Ability ability = new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(3))
.withInterveningIf(SurgedCondition.instance);
ability.addTarget(new TargetAnyTarget());
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, SurgedCondition.instance,
"When {this} enters, if its surge cost was paid, it deals 3 damage to any target."));
this.addAbility(ability);
}
private TyrantOfValakut(final TyrantOfValakut card) {

View file

@ -1,12 +1,9 @@
package mage.cards.u;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.MorbidCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.abilities.hint.common.MorbidHint;
import mage.cards.CardImpl;
@ -14,26 +11,27 @@ import mage.cards.CardSetInfo;
import mage.constants.AbilityWord;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.counters.CounterType;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author Loki
*/
public final class UlvenwaldBear extends CardImpl {
public UlvenwaldBear(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.BEAR);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// <i>Morbid</i> &mdash; When Ulvenwald Bear enters the battlefield, if a creature died this turn, put two +1/+1 counters on target creature.
Ability ability = new ConditionalInterveningIfTriggeredAbility(new EntersBattlefieldTriggeredAbility(new AddCountersTargetEffect(CounterType.P1P1.createInstance(2), Outcome.BoostCreature)),
MorbidCondition.instance, "When {this} enters, if a creature died this turn, put two +1/+1 counters on target creature.");
Ability ability = new EntersBattlefieldTriggeredAbility(
new AddCountersTargetEffect(CounterType.P1P1.createInstance(2))
).withInterveningIf(MorbidCondition.instance);
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability.addHint(MorbidHint.instance).setAbilityWord(AbilityWord.MORBID));
}

View file

@ -4,7 +4,6 @@ import mage.abilities.Ability;
import mage.abilities.common.AttacksWithCreaturesTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.TakeTheInitiativeEffect;
import mage.abilities.hint.common.InitiativeHint;
@ -25,15 +24,14 @@ public final class UndercellarSweep extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{W}");
// When Undercellar Sweep enters the battlefield, you take the initiative.
this.addAbility(new EntersBattlefieldTriggeredAbility(new TakeTheInitiativeEffect()).addHint(InitiativeHint.instance));
this.addAbility(new EntersBattlefieldTriggeredAbility(new TakeTheInitiativeEffect())
.addHint(InitiativeHint.instance));
// Whenever you attack, if you or a player you're attacking has the initiative, you create two 1/1 white Soldier creature token that are tapped and attacking.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new AttacksWithCreaturesTriggeredAbility(
new CreateTokenEffect(new SoldierToken(), 2, true, true), 1
), UndercellarSweepCondition.instance, "Whenever you attack, if you or a player you're attacking " +
"has the initiative, you create two 1/1 white Soldier creature tokens that are tapped and attacking."
));
this.addAbility(new AttacksWithCreaturesTriggeredAbility(
new CreateTokenEffect(new SoldierToken(), 2, true, true)
.setText("you create two 1/1 white Soldier creature tokens that are tapped and attacking"), 1
).withInterveningIf(UndercellarSweepCondition.instance));
}
private UndercellarSweep(final UndercellarSweep card) {
@ -63,4 +61,9 @@ enum UndercellarSweepCondition implements Condition {
.map(game.getCombat()::getDefenderId)
.anyMatch(game.getInitiativeId()::equals);
}
@Override
public String toString() {
return "you or a player you're attacking has the initiative";
}
}

View file

@ -4,7 +4,6 @@ package mage.cards.u;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.DesertControlledOrGraveyardCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.DontUntapInControllersUntapStepEnchantedEffect;
import mage.abilities.effects.common.TapEnchantedEffect;
@ -36,11 +35,8 @@ public final class UnquenchableThirst extends CardImpl {
this.addAbility(new EnchantAbility(auraTarget));
// When Unquenchable Thirst enters the battlefield, if you control a Desert or there is a Desert card in your graveyard, tap enchanted creature.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(new TapEnchantedEffect()),
DesertControlledOrGraveyardCondition.instance, "When {this} enters, " +
"if you control a Desert or there is a Desert card in your graveyard, tap enchanted creature."
).addHint(DesertControlledOrGraveyardCondition.getHint()));
this.addAbility(new EntersBattlefieldTriggeredAbility(new TapEnchantedEffect())
.withInterveningIf(DesertControlledOrGraveyardCondition.instance).addHint(DesertControlledOrGraveyardCondition.getHint()));
// Enchanted creature doesn't untap during its controller's untap step.
this.addAbility(new SimpleStaticAbility(new DontUntapInControllersUntapStepEnchantedEffect()));

View file

@ -3,7 +3,6 @@ package mage.cards.u;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.CastFromEverywhereSourceCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.CraftAbility;
import mage.cards.CardImpl;
@ -25,7 +24,6 @@ import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author notgreat
*/
public final class UnstableGlyphbridge extends CardImpl {
@ -35,12 +33,8 @@ public final class UnstableGlyphbridge extends CardImpl {
this.secondSideCardClazz = mage.cards.s.SandswirlWanderglyph.class;
// When Unstable Glyphbridge enters the battlefield, if you cast it, for each player, choose a creature with power 2 or less that player controls. Then destroy all creatures except creatures chosen this way.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(new EntersBattlefieldTriggeredAbility(
new UnstableGlyphbridgeEffect()), CastFromEverywhereSourceCondition.instance,
"When {this} enters, if you cast it, " +
"for each player, choose a creature with power 2 or less that player controls. " +
"Then destroy all creatures except creatures chosen this way."
));
this.addAbility(new EntersBattlefieldTriggeredAbility(new UnstableGlyphbridgeEffect())
.withInterveningIf(CastFromEverywhereSourceCondition.instance));
// Craft with artifact {3}{W}{W}
this.addAbility(new CraftAbility("{3}{W}{W}"));
@ -86,7 +80,7 @@ class UnstableGlyphbridgeEffect extends OneShotEffect {
continue;
}
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power 2 or less");
filter.add(new PowerPredicate(ComparisonType.OR_LESS,2));
filter.add(new PowerPredicate(ComparisonType.OR_LESS, 2));
filter.add(new ControllerIdPredicate(playerId));
TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
target.withNotTarget(true);

View file

@ -5,7 +5,6 @@ import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.LoseHalfLifeTargetEffect;
import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldWithCounterEffect;
import mage.abilities.keyword.DeathtouchAbility;
@ -39,9 +38,12 @@ public final class UnstoppableSlasher extends CardImpl {
.setText("they lose half their life, rounded up"), false, true));
// When Unstoppable Slasher dies, if it had no counters on it, return it to the battlefield tapped under its owner's control with two stun counters on it.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(new DiesSourceTriggeredAbility(new ReturnSourceFromGraveyardToBattlefieldWithCounterEffect(
CounterType.STUN.createInstance(2), true, true, false, false
), false), UnstoppableSlasherCondition.instance, "When {this} dies, if it had no counters on it, return it to the battlefield tapped under its owner's control with two stun counters on it"));
this.addAbility(new DiesSourceTriggeredAbility(
new ReturnSourceFromGraveyardToBattlefieldWithCounterEffect(
CounterType.STUN.createInstance(2),
true, true, false, false
), false
).withInterveningIf(UnstoppableSlasherCondition.instance));
}
private UnstoppableSlasher(final UnstoppableSlasher card) {
@ -60,14 +62,17 @@ enum UnstoppableSlasherCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = source.getSourcePermanentOrLKI(game);
if (permanent == null) {
return false;
}
return permanent
return permanent != null
&& permanent
.getCounters(game)
.values()
.stream()
.mapToInt(Counter::getCount)
.sum() == 0;
}
@Override
public String toString() {
return "it had no counters on it";
}
}

View file

@ -1,12 +1,9 @@
package mage.cards.u;
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.ReturnToHandTargetEffect;
import mage.abilities.keyword.KickerAbility;
import mage.cards.CardImpl;
@ -15,15 +12,15 @@ import mage.constants.CardType;
import mage.constants.SubType;
import mage.target.TargetPermanent;
/**
*
* @author LoneFox
import java.util.UUID;
/**
* @author LoneFox
*/
public final class UrborgEmissary extends CardImpl {
public UrborgEmissary(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.WIZARD);
this.power = new MageInt(3);
@ -31,11 +28,12 @@ public final class UrborgEmissary extends CardImpl {
// Kicker {1}{U}
this.addAbility(new KickerAbility("{1}{U}"));
// When Urborg Emissary enters the battlefield, if it was kicked, return target permanent to its owner's hand.
TriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect());
Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect())
.withInterveningIf(KickedCondition.ONCE);
ability.addTarget(new TargetPermanent());
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, KickedCondition.ONCE,
"When {this} enters, if it was kicked, return target permanent to its owner's hand."));
this.addAbility(ability);
}
private UrborgEmissary(final UrborgEmissary card) {

View file

@ -1,36 +1,37 @@
package mage.cards.u;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.constants.SubType;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterNonlandPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate;
import java.util.UUID;
/**
*
* @author TheElk801
*/
public final class UrborgStalker extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent();
private static final FilterPermanent filter = new FilterNonlandPermanent("that player controls a nonblack, nonland permanent");
static {
filter.add(TargetController.ACTIVE.getControllerPredicate());
filter.add(Predicates.not(new ColorPredicate(ObjectColor.BLACK)));
filter.add(Predicates.not(CardType.LAND.getPredicate()));
}
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(filter);
public UrborgStalker(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}");
@ -39,13 +40,9 @@ public final class UrborgStalker extends CardImpl {
this.toughness = new MageInt(4);
// At the beginning of each player's upkeep, if that player controls a nonblack, nonland permanent, Urborg Stalker deals 1 damage to that player.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(TargetController.ANY, new DamageTargetEffect(1), false),
new PermanentsOnTheBattlefieldCondition(filter),
"At the beginning of each player's upkeep, "
+ "if that player controls a nonblack, nonland permanent, "
+ "{this} deals 1 damage to that player."
));
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
TargetController.ANY, new DamageTargetEffect(1, true, "that player"), false
).withInterveningIf(condition));
}
private UrborgStalker(final UrborgStalker card) {

View file

@ -5,16 +5,15 @@ import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.effects.common.counter.RemoveCounterSourceEffect;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.*;
import mage.constants.*;
import mage.counters.CounterType;
@ -58,9 +57,7 @@ public final class UvildaDeanOfPerfection extends ModalDoubleFacedCard {
this.getRightHalfCard().setPT(4, 4);
// At the beginning of your upkeep, exile the top card of each opponent's library. Until end of turn, you may cast spells from among those exiled cards, and you many spend mana as though it were mana of any color to cast those spells.
this.getRightHalfCard().addAbility(new BeginningOfUpkeepTriggeredAbility(
new NassariDeanOfExpressionEffect()
));
this.getRightHalfCard().addAbility(new BeginningOfUpkeepTriggeredAbility(new NassariDeanOfExpressionEffect()));
// Whenever you cast a spell from exile, put a +1/+1 counter on Nassari, Dean of Expression.
this.getRightHalfCard().addAbility(SpellCastControllerTriggeredAbility.createWithFromZone(
@ -150,13 +147,11 @@ class UvildaDeanOfPerfectionGainAbilityEffect extends ContinuousEffectImpl {
discard();
return true;
}
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(
Zone.EXILED, TargetController.YOU, new RemoveCounterSourceEffect(CounterType.HONE.createInstance()),
false
), UvildaDeanOfPerfectionCondition.instance, "At the beginning of your upkeep, " +
"if this card is exiled, remove a hone counter from it."
);
Ability ability = new BeginningOfUpkeepTriggeredAbility(
Zone.EXILED, TargetController.YOU,
new RemoveCounterSourceEffect(CounterType.HONE.createInstance())
.setText("remove a hone counter from it"), false
).withInterveningIf(UvildaDeanOfPerfectionCondition.instance);
ability.setSourceId(card.getId());
ability.setControllerId(source.getControllerId());
game.getState().addOtherAbility(card, ability);
@ -175,6 +170,11 @@ enum UvildaDeanOfPerfectionCondition implements Condition {
public boolean apply(Game game, Ability source) {
return game.getState().getZone(source.getSourceId()) == Zone.EXILED;
}
@Override
public String toString() {
return "this card is exiled";
}
}
class UvildaDeanOfPerfectionTriggeredAbility extends TriggeredAbilityImpl {