Implemented Thirst for Meaning

This commit is contained in:
Evan Kranzler 2019-12-30 16:42:19 -05:00
parent 4aff46b2f8
commit 11147ba7b4
3 changed files with 54 additions and 54 deletions

View file

@ -1,38 +1,36 @@
package mage.cards.t; package mage.cards.t;
import java.util.UUID; import mage.abilities.costs.common.DiscardCardCost;
import mage.abilities.Ability; import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.DiscardTargetCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.discard.DiscardControllerEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.common.FilterArtifactCard;
import mage.game.Game;
import mage.players.Player; import java.util.UUID;
import mage.target.common.TargetCardInHand;
/** /**
*
* @author jeffwadsworth * @author jeffwadsworth
*/ */
public final class ThirstForKnowledge extends CardImpl { public final class ThirstForKnowledge extends CardImpl {
private static final FilterCard filter = new FilterArtifactCard();
public ThirstForKnowledge(UUID ownerId, CardSetInfo setInfo) { public ThirstForKnowledge(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}");
// Draw three cards. Then discard two cards unless you discard an artifact card. // Draw three cards. Then discard two cards unless you discard an artifact card.
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(3)); this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(3));
this.getSpellAbility().addEffect(new ThirstforKnowledgeEffect()); this.getSpellAbility().addEffect(new DoIfCostPaid(
null, new DiscardControllerEffect(2), new DiscardCardCost(filter)
).setText("Then discard two cards unless you discard an artifact card"));
} }
public ThirstForKnowledge(final ThirstForKnowledge card) { private ThirstForKnowledge(final ThirstForKnowledge card) {
super(card); super(card);
} }
@ -41,42 +39,3 @@ public final class ThirstForKnowledge extends CardImpl {
return new ThirstForKnowledge(this); return new ThirstForKnowledge(this);
} }
} }
class ThirstforKnowledgeEffect extends OneShotEffect {
public ThirstforKnowledgeEffect() {
super(Outcome.Damage);
staticText = "Then discard two cards unless you discard an artifact card";
}
public ThirstforKnowledgeEffect(final ThirstforKnowledgeEffect effect) {
super(effect);
}
@Override
public ThirstforKnowledgeEffect copy() {
return new ThirstforKnowledgeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player you = game.getPlayer(source.getControllerId());
FilterCard filter = new FilterCard("artifact to discard");
filter.add(new CardTypePredicate(CardType.ARTIFACT));
if (you != null
&& you.getHand().count(filter, game) > 0
&& you.chooseUse(Outcome.Discard, "Do you want to discard an artifact? If you don't, you must discard 2 cards", source, game)) {
Cost cost = new DiscardTargetCost(new TargetCardInHand(filter));
if (cost.canPay(source, source.getSourceId(), you.getId(), game)) {
if (cost.pay(source, game, source.getSourceId(), you.getId(), false, null)) {
return true;
}
}
}
if (you != null) {
you.discard(2, false, source, game);
return true;
}
return false;
}
}

View file

@ -0,0 +1,40 @@
package mage.cards.t;
import mage.abilities.costs.common.DiscardCardCost;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.discard.DiscardControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterCard;
import mage.filter.common.FilterEnchantmentCard;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ThirstForMeaning extends CardImpl {
private static final FilterCard filter = new FilterEnchantmentCard();
public ThirstForMeaning(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}");
// Draw three cards. Then discard two cards unless you discard an enchantment card.
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(3));
this.getSpellAbility().addEffect(new DoIfCostPaid(
null, new DiscardControllerEffect(2), new DiscardCardCost(filter)
).setText("Then discard two cards unless you discard an enchantment card"));
}
private ThirstForMeaning(final ThirstForMeaning card) {
super(card);
}
@Override
public ThirstForMeaning copy() {
return new ThirstForMeaning(this);
}
}

View file

@ -70,6 +70,7 @@ public final class TherosBeyondDeath extends ExpansionSet {
cards.add(new SetCardInfo("Terror of Mount Velus", 295, Rarity.RARE, mage.cards.t.TerrorOfMountVelus.class)); cards.add(new SetCardInfo("Terror of Mount Velus", 295, Rarity.RARE, mage.cards.t.TerrorOfMountVelus.class));
cards.add(new SetCardInfo("The Akroan War", 124, Rarity.RARE, mage.cards.t.TheAkroanWar.class)); cards.add(new SetCardInfo("The Akroan War", 124, Rarity.RARE, mage.cards.t.TheAkroanWar.class));
cards.add(new SetCardInfo("The Binding of the Titans", 166, Rarity.UNCOMMON, mage.cards.t.TheBindingOfTheTitans.class)); cards.add(new SetCardInfo("The Binding of the Titans", 166, Rarity.UNCOMMON, mage.cards.t.TheBindingOfTheTitans.class));
cards.add(new SetCardInfo("Thirst for Meaning", 74, Rarity.COMMON, mage.cards.t.ThirstForMeaning.class));
cards.add(new SetCardInfo("Treeshaker Chimera", 297, Rarity.RARE, mage.cards.t.TreeshakerChimera.class)); cards.add(new SetCardInfo("Treeshaker Chimera", 297, Rarity.RARE, mage.cards.t.TreeshakerChimera.class));
cards.add(new SetCardInfo("Tymaret Calls the Dead", 118, Rarity.RARE, mage.cards.t.TymaretCallsTheDead.class)); cards.add(new SetCardInfo("Tymaret Calls the Dead", 118, Rarity.RARE, mage.cards.t.TymaretCallsTheDead.class));
cards.add(new SetCardInfo("Underworld Rage-Hound", 163, Rarity.COMMON, mage.cards.u.UnderworldRageHound.class)); cards.add(new SetCardInfo("Underworld Rage-Hound", 163, Rarity.COMMON, mage.cards.u.UnderworldRageHound.class));