* Author of Shadows - added window with exiled and castable cards;

This commit is contained in:
Oleg Agafonov 2021-08-18 11:02:30 +04:00
parent 1d60c2039b
commit 3da525520c
2 changed files with 35 additions and 6 deletions

View file

@ -16,7 +16,7 @@ public class Exile implements Serializable, Copyable<Exile> {
private static final UUID PERMANENT = UUID.randomUUID();
private Map<UUID, ExileZone> exileZones = new HashMap<>();
private final Map<UUID, ExileZone> exileZones = new HashMap<>();
public Exile() {
createZone(PERMANENT, "Permanent");
@ -88,6 +88,25 @@ public class Exile implements Serializable, Copyable<Exile> {
return false;
}
/**
* Move card from one exile zone to another. Use case example: create special zone for exiled and castable card.
*
* @param card
* @param game
* @param toZoneId
*/
public void moveToAnotherZone(Card card, Game game, ExileZone exileZone) {
if (getCard(card.getId(), game) == null) {
throw new IllegalArgumentException("Card must be in exile zone: " + card.getIdName());
}
if (exileZone == null) {
throw new IllegalArgumentException("Exile zone must exists: " + card.getIdName());
}
removeCard(card, game);
exileZone.add(card);
}
@Override
public Exile copy() {
return new Exile(this);