diff --git a/forge-ai/src/main/java/forge/ai/simulation/GameCopier.java b/forge-ai/src/main/java/forge/ai/simulation/GameCopier.java index 2629cf44d0b..7d288c8013e 100644 --- a/forge-ai/src/main/java/forge/ai/simulation/GameCopier.java +++ b/forge-ai/src/main/java/forge/ai/simulation/GameCopier.java @@ -358,13 +358,7 @@ private void addCard(Game newGame, ZoneType zone, Card c, Player aiPlayer) { newCard.setDamage(c.getDamage()); newCard.setDamageReceivedThisTurn(c.getDamageReceivedThisTurn()); - newCard.setChangedCardColors(c.getChangedCardColorsTable()); - newCard.setChangedCardColorsCharacterDefining(c.getChangedCardColorsCharacterDefiningTable()); - - newCard.setChangedCardTypes(c.getChangedCardTypesTable()); - newCard.setChangedCardTypesCharacterDefining(c.getChangedCardTypesCharacterDefiningTable()); - newCard.setChangedCardKeywords(c.getChangedCardKeywords()); - newCard.setChangedCardNames(c.getChangedCardNames()); + newCard.copyFrom(c); for (Table.Cell> kw : c.getHiddenExtrinsicKeywordsTable().cellSet()) { newCard.addHiddenExtrinsicKeywords(kw.getRowKey(), kw.getColumnKey(), kw.getValue()); diff --git a/forge-game/src/main/java/forge/game/card/Card.java b/forge-game/src/main/java/forge/game/card/Card.java index 32c47f60c4d..3b4bafcebc2 100644 --- a/forge-game/src/main/java/forge/game/card/Card.java +++ b/forge-game/src/main/java/forge/game/card/Card.java @@ -988,15 +988,6 @@ public void updateNameforView() { currentState.getView().updateName(currentState); } - public Table getChangedCardNames() { - return changedCardNames; - } - - public void setChangedCardNames(Table changedCardNames) { - this.changedCardNames.clear(); - this.changedCardNames.putAll(changedCardNames); - } - public void setGamePieceType(GamePieceType gamePieceType) { this.gamePieceType = gamePieceType; this.view.updateGamePieceType(this); @@ -4163,13 +4154,6 @@ public Iterable getChangedCardTypes() { )); } - public Table getChangedCardTypesTable() { - return Tables.unmodifiableTable(changedCardTypes); - } - public Table getChangedCardTypesCharacterDefiningTable() { - return Tables.unmodifiableTable(changedCardTypesCharacterDefining); - } - public boolean clearChangedCardTypes() { boolean changed = false; @@ -4227,12 +4211,6 @@ public Table getChangedCardKeywords() { return changedCardKeywords; } - public Table getChangedCardColorsTable() { - return changedCardColors; - } - public Table getChangedCardColorsCharacterDefiningTable() { - return changedCardColorsCharacterDefining; - } public Iterable getChangedCardColors() { return Iterables.concat(changedCardColorsByText.values(), changedCardColorsCharacterDefining.values(), changedCardColors.values()); } @@ -7754,15 +7732,6 @@ public List getKeywords() { } } - public void setChangedCardTypes(Table changedCardTypes) { - this.changedCardTypes.clear(); - this.changedCardTypes.putAll(changedCardTypes); - } - public void setChangedCardTypesCharacterDefining(Table changedCardTypes) { - this.changedCardTypesCharacterDefining.clear(); - this.changedCardTypesCharacterDefining.putAll(changedCardTypes); - } - public void setChangedCardKeywords(Table changedCardKeywords) { this.changedCardKeywords.clear(); for (Table.Cell entry : changedCardKeywords.cellSet()) { @@ -7770,15 +7739,6 @@ public void setChangedCardKeywords(Table changedCard } } - public void setChangedCardColors(Table changedCardColors) { - this.changedCardColors.clear(); - this.changedCardColors.putAll(changedCardColors); - } - public void setChangedCardColorsCharacterDefining(Table changedCardColors) { - this.changedCardColorsCharacterDefining.clear(); - this.changedCardColorsCharacterDefining.putAll(changedCardColors); - } - public void cleanupCopiedChangesFrom(Card c) { for (StaticAbility stAb : c.getStaticAbilities()) { this.removeChangedCardTypes(c.getLayerTimestamp(), stAb.getId(), false); @@ -8253,4 +8213,19 @@ public SpellAbility getUnlockAbility(CardStateName state) { } return unlockAbilities.get(state); } + + public void copyFrom(Card in) { + // clean is not needed? + this.changedCardColors.putAll(in.changedCardColors); + this.changedCardColorsCharacterDefining.putAll(in.changedCardColorsCharacterDefining); + + setChangedCardKeywords(in.getChangedCardKeywords()); + + this.changedCardTypes.putAll(in.changedCardTypes); + this.changedCardTypesCharacterDefining.putAll(in.changedCardTypesCharacterDefining); + + this.changedCardNames.putAll(in.changedCardNames); + setChangedCardTraits(in.getChangedCardTraits()); + + } } diff --git a/forge-game/src/main/java/forge/game/card/CardCopyService.java b/forge-game/src/main/java/forge/game/card/CardCopyService.java index 579da3ff7b6..15e085cc2ba 100644 --- a/forge-game/src/main/java/forge/game/card/CardCopyService.java +++ b/forge-game/src/main/java/forge/game/card/CardCopyService.java @@ -356,13 +356,7 @@ public Card getLKICopy(Map cachedMap) { newCopy.setUnearthed(copyFrom.isUnearthed()); - newCopy.setChangedCardColors(copyFrom.getChangedCardColorsTable()); - newCopy.setChangedCardColorsCharacterDefining(copyFrom.getChangedCardColorsCharacterDefiningTable()); - newCopy.setChangedCardKeywords(copyFrom.getChangedCardKeywords()); - newCopy.setChangedCardTypes(copyFrom.getChangedCardTypesTable()); - newCopy.setChangedCardTypesCharacterDefining(copyFrom.getChangedCardTypesCharacterDefiningTable()); - newCopy.setChangedCardNames(copyFrom.getChangedCardNames()); - newCopy.setChangedCardTraits(copyFrom.getChangedCardTraits()); + newCopy.copyFrom(copyFrom); // for getReplacementList (run after setChangedCardKeywords for caching) newCopy.setStoredKeywords(copyFrom.getStoredKeywords(), true);