Prevent having the same cards revealed multiple times

This commit is contained in:
drdev
2014-10-03 10:34:35 +00:00
parent 9391b0b486
commit c591031f48

View File

@@ -7,10 +7,11 @@ import forge.game.zone.ZoneType;
//Stores information to reveal cards after a delay unless those cards can be revealed in the same dialog as cards being selected //Stores information to reveal cards after a delay unless those cards can be revealed in the same dialog as cards being selected
public class DelayedReveal { public class DelayedReveal {
public final Collection<Card> cards; private final Collection<Card> cards;
public final ZoneType zone; private final ZoneType zone;
public final Player owner; private final Player owner;
public final String messagePrefix; private final String messagePrefix;
private boolean revealed;
public DelayedReveal(Collection<Card> cards0, ZoneType zone0, Player owner0) { public DelayedReveal(Collection<Card> cards0, ZoneType zone0, Player owner0) {
this(cards0, zone0, owner0, null); this(cards0, zone0, owner0, null);
@@ -23,6 +24,8 @@ public class DelayedReveal {
} }
public void reveal(PlayerController controller) { public void reveal(PlayerController controller) {
if (revealed) { return; } //avoid revealing more than once
revealed = true;
controller.reveal(cards, zone, owner, messagePrefix); controller.reveal(cards, zone, owner, messagePrefix);
} }
} }