Fix bug that prevented being able to play a card that had been returned to your hand or put on top of your library

This commit is contained in:
drdev
2014-10-15 17:30:14 +00:00
parent cfeb022c91
commit 058f66c22f
3 changed files with 7 additions and 4 deletions

View File

@@ -33,7 +33,7 @@ public class DamageDealEffect extends SpellAbilityEffect {
return ""; return "";
final List<Card> definedSources = AbilityUtils.getDefinedCards(sa.getHostCard(), sa.getParam("DamageSource"), sa); final List<Card> definedSources = AbilityUtils.getDefinedCards(sa.getHostCard(), sa.getParam("DamageSource"), sa);
Card source = definedSources.isEmpty() ? new Card(0) : definedSources.get(0); Card source = definedSources.isEmpty() ? new Card(-1) : definedSources.get(0);
if (source != sa.getHostCard()) { if (source != sa.getHostCard()) {
sb.append(source.toString()).append(" deals"); sb.append(source.toString()).append(" deals");

View File

@@ -261,7 +261,7 @@ public class Card extends GameEntity implements Comparable<Card>, IIdentifiable
* @param id the unique id of the new card. * @param id the unique id of the new card.
*/ */
public Card(final int id0) { public Card(final int id0) {
this(id0, null); this(id0, null, true);
} }
/** /**
@@ -273,9 +273,12 @@ public class Card extends GameEntity implements Comparable<Card>, IIdentifiable
* @see IPaperCard * @see IPaperCard
*/ */
public Card(final int id0, final IPaperCard paperCard0) { public Card(final int id0, final IPaperCard paperCard0) {
this(id0, paperCard0, true);
}
public Card(final int id0, final IPaperCard paperCard0, final boolean allowCache) {
super(id0); super(id0);
if (id0 >= 0) { if (id0 >= 0 && allowCache) {
cardCache.put(id0, this); cardCache.put(id0, this);
} }
paperCard = paperCard0; paperCard = paperCard0;

View File

@@ -213,7 +213,7 @@ public final class CardUtil {
* @return a copy of C with LastKnownInfo stuff retained. * @return a copy of C with LastKnownInfo stuff retained.
*/ */
public static Card getLKICopy(final Card in) { public static Card getLKICopy(final Card in) {
final Card newCopy = new Card(in.getId(), in.getPaperCard()); final Card newCopy = new Card(in.getId(), in.getPaperCard(), false);
newCopy.setSetCode(in.getSetCode()); newCopy.setSetCode(in.getSetCode());
newCopy.setOwner(in.getOwner()); newCopy.setOwner(in.getOwner());
newCopy.setController(in.getController(), 0); newCopy.setController(in.getController(), 0);