- Moved CardsAddedThisTurn registration from Zone.add to changeZone.

This commit is contained in:
Sloth
2013-07-12 09:32:38 +00:00
parent 34a5375a21
commit bf8be3096d
2 changed files with 11 additions and 9 deletions

View File

@@ -227,7 +227,8 @@ public class GameAction {
}
zoneFrom.remove(c);
}
ZoneType fromZoneType = zoneFrom == null ? null : zoneFrom.getZoneType();
zoneTo.getCardsAddedThisTurn().add(fromZoneType, c);
// "enter the battlefield as a copy" - apply code here
// but how to query for input here and continue later while the callers assume synchronous result?
zoneTo.add(copied, position);

View File

@@ -78,14 +78,6 @@ public class Zone implements IZone, java.io.Serializable, Iterable<Card> {
@Override
public void add(final Card c, final Integer index) {
// Immutable cards are usually emblems,effects and the mana pool and we
// don't want to log those.
if (!c.isImmutable()) {
final Zone oldZone = game.getZoneOf(c);
// if any tokens come to battlefield, consider they are from stack. Plain "null" cannot be a key of EnumMap
final ZoneType zt = oldZone == null ? ZoneType.Stack : oldZone.getZoneType();
cardsAddedThisTurn.add(zt, c);
}
c.setTurnInZone(game.getPhaseHandler().getTurn());
if (zoneType != ZoneType.Battlefield) {
@@ -174,6 +166,15 @@ public class Zone implements IZone, java.io.Serializable, Iterable<Card> {
return this.cardList.isEmpty();
}
/**
* <p>
* Getter for the field <code>cardsAddedThisTurn</code>.
* </p>
*/
public final MapOfLists<ZoneType, Card> getCardsAddedThisTurn() {
return cardsAddedThisTurn;
}
/**
* <p>
* Getter for the field <code>cardsAddedThisTurn</code>.