From fe4ba3c590f1769571f5186a11672932028c21d3 Mon Sep 17 00:00:00 2001 From: magenoxx Date: Mon, 1 Aug 2011 00:45:51 +0400 Subject: [PATCH] connected cards --- Mage/src/mage/game/permanent/Permanent.java | 20 +++++++++++++++++++ .../mage/game/permanent/PermanentImpl.java | 19 ++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/Mage/src/mage/game/permanent/Permanent.java b/Mage/src/mage/game/permanent/Permanent.java index 5a77015607..3884da8906 100644 --- a/Mage/src/mage/game/permanent/Permanent.java +++ b/Mage/src/mage/game/permanent/Permanent.java @@ -136,6 +136,26 @@ public interface Permanent extends Card { */ public List getImprinted(); + /** + * Allows to connect any card to permanent. + * Very similar to Imprint except that it is for internal use only. + * + * @param connectedCard + */ + public void addConnectedCard(UUID connectedCard); + + /** + * Returns connected cards. + * Very similar to Imprint except that it is for internal use only. + * @return + */ + public List getConnectedCards(); + + /** + * Clear all connected cards. + */ + public void clearConnectedCards(); + @Override public Permanent copy(); diff --git a/Mage/src/mage/game/permanent/PermanentImpl.java b/Mage/src/mage/game/permanent/PermanentImpl.java index 183c024c94..77a7182965 100644 --- a/Mage/src/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/mage/game/permanent/PermanentImpl.java @@ -72,6 +72,7 @@ public abstract class PermanentImpl> extends CardImpl protected Counters counters; protected List attachments = new ArrayList(); protected List imprinted = new ArrayList(); + protected List connectedCards = new ArrayList(); protected UUID attachedTo; public PermanentImpl(UUID ownerId, UUID controllerId, String name) { @@ -111,6 +112,9 @@ public abstract class PermanentImpl> extends CardImpl for (UUID imprintedId : permanent.imprinted) { this.imprinted.add(imprintedId); } + for (UUID connectedCardId : permanent.connectedCards) { + this.connectedCards.add(connectedCardId); + } this.attachedTo = permanent.attachedTo; } @@ -432,6 +436,21 @@ public abstract class PermanentImpl> extends CardImpl return attachedTo; } + @Override + public void addConnectedCard(UUID connectedCard) { + this.connectedCards.add(connectedCard); + } + + @Override + public List getConnectedCards() { + return this.connectedCards; + } + + @Override + public void clearConnectedCards() { + this.connectedCards.clear(); + } + @Override public void attachTo(UUID permanentId, Game game) { if (this.attachedTo != null) {