* Fixed a problem that abilities of cards could not be cast /played / activated if they had no mana costs (e.g. Cabal Therapy and Crucible of Worlds).

This commit is contained in:
LevelX2 2014-03-27 01:11:33 +01:00
parent 0009797a68
commit 16bc70576a
3 changed files with 10 additions and 9 deletions

View file

@ -61,7 +61,7 @@ public class CabalTherapy extends CardImpl<CabalTherapy> {
this.color.setBlack(true);
// Name a nonland card. Target player reveals his or her hand and discards all cards with that name.
this.getSpellAbility().addTarget(new TargetPlayer());
this.getSpellAbility().addTarget(new TargetPlayer(true));
this.getSpellAbility().addEffect(new CabalTherapyEffect());
// Flashback-Sacrifice a creature.
this.addAbility(new FlashbackAbility(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1,1,new FilterControlledCreaturePermanent("a creature"), true)), TimingRule.SORCERY));
@ -80,7 +80,7 @@ public class CabalTherapy extends CardImpl<CabalTherapy> {
class CabalTherapyEffect extends OneShotEffect<CabalTherapyEffect> {
public CabalTherapyEffect() {
super(Outcome.Exile);
super(Outcome.Discard);
staticText = "Name a nonland card. Search target player's hand for all cards with that name and discard them";
}
@ -107,7 +107,7 @@ class CabalTherapyEffect extends OneShotEffect<CabalTherapyEffect> {
game.informPlayers("Cabal Therapy, named card: [" + cardName + "]");
for (Card card : player.getHand().getCards(game)) {
if (card.getName().equals(cardName)) {
card.moveToZone(Zone.GRAVEYARD, source.getId(), game, false);
player.discard(card, source, game);
}
}

View file

@ -93,9 +93,10 @@ public class SpellAbility extends ActivatedAbilityImpl<SpellAbility> {
if (!controllerId.equals(playerId)) {
return false;
}
if (this.getManaCosts().isEmpty()) {
return false;
}
// Why is this check made? It prevents Flashback with non mana costs (Cabal Therapy)
// if (this.getManaCosts().isEmpty()) {
// return false;
// }
if (costs.canPay(sourceId, controllerId, game)) {
if (getSpellAbilityType().equals(SpellAbilityType.SPLIT_FUSED)) {
SplitCard splitCard = (SplitCard) game.getCard(getSourceId());

View file

@ -158,7 +158,7 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
@Override
public Set<Card> getCards(FilterCard filter, Game game) {
Set<Card> cards = new LinkedHashSet<Card>();
Set<Card> cards = new LinkedHashSet<>();
for (UUID card: this) {
boolean match = filter.match(game.getCard(card), game);
if (match) {
@ -170,7 +170,7 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
@Override
public Set<Card> getCards(Game game) {
Set<Card> cards = new LinkedHashSet<Card>();
Set<Card> cards = new LinkedHashSet<>();
for (UUID card: this) {
cards.add(game.getCard(card));
}
@ -186,7 +186,7 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
@Override
public Collection<Card> getUniqueCards(Game game) {
Map<String, Card> cards = new HashMap<String, Card>();
Map<String, Card> cards = new HashMap<>();
for(UUID cardId: this) {
Card card = game.getCard(cardId);
if (!cards.containsKey(card.getName())) {