* Thirst for Meaning - fixed that it doesn't allow to discard artifact card as pay;

* Thirst for Knowledge - fixed that it doesn't allow to discard enchantment card as pay;
This commit is contained in:
Oleg Agafonov 2020-01-13 15:03:01 +04:00
parent c229654304
commit 4d2790be3f
3 changed files with 25 additions and 17 deletions

View file

@ -1,4 +1,3 @@
package mage.cards.t; package mage.cards.t;
import mage.abilities.costs.common.DiscardCardCost; import mage.abilities.costs.common.DiscardCardCost;
@ -24,9 +23,13 @@ public final class ThirstForKnowledge extends CardImpl {
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.
DiscardCardCost cost = new DiscardCardCost(filter);
cost.setText("discard one artifact card instead two cards");
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(3)); this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(3));
this.getSpellAbility().addEffect(new DoIfCostPaid( this.getSpellAbility().addEffect(new DoIfCostPaid(
null, new DiscardControllerEffect(2), new DiscardCardCost(filter) null,
new DiscardControllerEffect(2),
cost
).setText("Then discard two cards unless you discard an artifact card")); ).setText("Then discard two cards unless you discard an artifact card"));
} }

View file

@ -23,9 +23,13 @@ public final class ThirstForMeaning extends CardImpl {
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 enchantment card. // Draw three cards. Then discard two cards unless you discard an enchantment card.
DiscardCardCost cost = new DiscardCardCost(filter);
cost.setText("discard one enchantment card instead two cards");
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(3)); this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(3));
this.getSpellAbility().addEffect(new DoIfCostPaid( this.getSpellAbility().addEffect(new DoIfCostPaid(
null, new DiscardControllerEffect(2), new DiscardCardCost(filter) null,
new DiscardControllerEffect(2),
cost
).setText("Then discard two cards unless you discard an enchantment card")); ).setText("Then discard two cards unless you discard an enchantment card"));
} }

View file

@ -23,27 +23,27 @@ public class DoIfCostPaid extends OneShotEffect {
private String chooseUseText; private String chooseUseText;
private boolean optional; private boolean optional;
public DoIfCostPaid(Effect effect, Cost cost) { public DoIfCostPaid(Effect effectOnPaid, Cost cost) {
this(effect, cost, null); this(effectOnPaid, cost, null);
} }
public DoIfCostPaid(Effect effect, Effect effect2, Cost cost) { public DoIfCostPaid(Effect effectOnPaid, Effect effectOnNotPaid, Cost cost) {
this(effect, effect2, cost, true); this(effectOnPaid, effectOnNotPaid, cost, true);
} }
public DoIfCostPaid(Effect effect, Effect effect2, Cost cost, boolean optional) { public DoIfCostPaid(Effect effectOnPaid, Effect effectOnNotPaid, Cost cost, boolean optional) {
this(effect, cost, null, optional); this(effectOnPaid, cost, null, optional);
this.otherwiseEffects.add(effect2); this.otherwiseEffects.add(effectOnNotPaid);
} }
public DoIfCostPaid(Effect effect, Cost cost, String chooseUseText) { public DoIfCostPaid(Effect effectOnPaid, Cost cost, String chooseUseText) {
this(effect, cost, chooseUseText, true); this(effectOnPaid, cost, chooseUseText, true);
} }
public DoIfCostPaid(Effect effect, Cost cost, String chooseUseText, boolean optional) { public DoIfCostPaid(Effect effectOnPaid, Cost cost, String chooseUseText, boolean optional) {
super(Outcome.Benefit); super(Outcome.Benefit);
if (effect != null) { if (effectOnPaid != null) {
this.executingEffects.add(effect); this.executingEffects.add(effectOnPaid);
} }
this.cost = cost; this.cost = cost;
this.chooseUseText = chooseUseText; this.chooseUseText = chooseUseText;
@ -83,7 +83,7 @@ public class DoIfCostPaid extends OneShotEffect {
if (!effectText.isEmpty() && effectText.charAt(effectText.length() - 1) == '.') { if (!effectText.isEmpty() && effectText.charAt(effectText.length() - 1) == '.') {
effectText = effectText.substring(0, effectText.length() - 1); effectText = effectText.substring(0, effectText.length() - 1);
} }
message = getCostText() + " and " + effectText + '?'; message = getCostText() + (effectText.isEmpty() ? "" : " and " + effectText) + "?";
message = Character.toUpperCase(message.charAt(0)) + message.substring(1); message = Character.toUpperCase(message.charAt(0)) + message.substring(1);
CardUtil.replaceSourceName(message, mageObject.getName()); CardUtil.replaceSourceName(message, mageObject.getName());
} else { } else {
@ -91,8 +91,9 @@ public class DoIfCostPaid extends OneShotEffect {
} }
message = CardUtil.replaceSourceName(message, mageObject.getLogName()); message = CardUtil.replaceSourceName(message, mageObject.getLogName());
boolean result = true; boolean result = true;
Outcome payOutcome = executingEffects.size() > 0 ? executingEffects.get(0).getOutcome() : this.outcome;
if (cost.canPay(source, source.getSourceId(), player.getId(), game) if (cost.canPay(source, source.getSourceId(), player.getId(), game)
&& executingEffects.size() > 0 && (!optional || player.chooseUse(executingEffects.get(0).getOutcome(), message, source, game))) { && (!optional || player.chooseUse(payOutcome, message, source, game))) {
cost.clearPaid(); cost.clearPaid();
int bookmark = game.bookmarkState(); int bookmark = game.bookmarkState();
if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) { if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) {