connected cards

This commit is contained in:
magenoxx 2011-08-01 00:45:51 +04:00
parent 053c3a76e6
commit fe4ba3c590
2 changed files with 39 additions and 0 deletions

View file

@ -136,6 +136,26 @@ public interface Permanent extends Card {
*/
public List<UUID> 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<UUID> getConnectedCards();
/**
* Clear all connected cards.
*/
public void clearConnectedCards();
@Override
public Permanent copy();

View file

@ -72,6 +72,7 @@ public abstract class PermanentImpl<T extends PermanentImpl<T>> extends CardImpl
protected Counters counters;
protected List<UUID> attachments = new ArrayList<UUID>();
protected List<UUID> imprinted = new ArrayList<UUID>();
protected List<UUID> connectedCards = new ArrayList<UUID>();
protected UUID attachedTo;
public PermanentImpl(UUID ownerId, UUID controllerId, String name) {
@ -111,6 +112,9 @@ public abstract class PermanentImpl<T extends PermanentImpl<T>> 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<T extends PermanentImpl<T>> extends CardImpl
return attachedTo;
}
@Override
public void addConnectedCard(UUID connectedCard) {
this.connectedCards.add(connectedCard);
}
@Override
public List<UUID> getConnectedCards() {
return this.connectedCards;
}
@Override
public void clearConnectedCards() {
this.connectedCards.clear();
}
@Override
public void attachTo(UUID permanentId, Game game) {
if (this.attachedTo != null) {