From 3337cd37377427e68082e063d48ed37f8c0fe532 Mon Sep 17 00:00:00 2001 From: Chris H Date: Tue, 13 Aug 2024 12:08:22 -0400 Subject: [PATCH] Fix bad references for snapshots --- forge-game/src/main/java/forge/game/GameSnapshot.java | 8 ++++---- .../src/main/java/forge/game/card/CardCopyService.java | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/forge-game/src/main/java/forge/game/GameSnapshot.java b/forge-game/src/main/java/forge/game/GameSnapshot.java index 2a0d0505e51..55a06681cf1 100644 --- a/forge-game/src/main/java/forge/game/GameSnapshot.java +++ b/forge-game/src/main/java/forge/game/GameSnapshot.java @@ -362,16 +362,16 @@ public void copyGameState(Game fromGame, Game toGame) { if (fromCard.getCloneOrigin() != null) { newCard.setCloneOrigin(toGame.findById(fromCard.getCloneOrigin().getId())); } - if (newCard.getHaunting() != null) { + if (fromCard.getHaunting() != null) { newCard.setHaunting(toGame.findById(fromCard.getHaunting().getId())); } - if (newCard.getEffectSource() != null) { + if (fromCard.getEffectSource() != null) { newCard.setEffectSource(toGame.findById(fromCard.getEffectSource().getId())); } - if (newCard.isPaired()) { + if (fromCard.isPaired()) { newCard.setPairedWith(toGame.findById(fromCard.getPairedWith().getId())); } - if (newCard.getCopiedPermanent() != null) { + if (fromCard.getCopiedPermanent() != null) { newCard.setCopiedPermanent(toGame.findById(fromCard.getCopiedPermanent().getId())); } // TODO: Verify that the above relationships are preserved bi-directionally or not. 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 d9967e61a45..ad3a7e787db 100644 --- a/forge-game/src/main/java/forge/game/card/CardCopyService.java +++ b/forge-game/src/main/java/forge/game/card/CardCopyService.java @@ -47,6 +47,7 @@ public final Card copyCard(boolean assignNewId, Player owner) { // need to copy this values for the tokens out.setTokenSpawningAbility(copyFrom.getTokenSpawningAbility()); + out.setCopiedPermanent(copyFrom.getCopiedPermanent()); } else { out = assignNewId ? getCard(copyFrom.getPaperCard(), owner, toGame) : getCard(copyFrom.getPaperCard(), owner, copyFrom.getId(), toGame);