From a5b41ea9205e0dce7bea696f6f4550654490820a Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Mon, 2 Aug 2021 17:40:35 +0400 Subject: [PATCH] * Marshland Bloodcaster - fixed game freeze on usage; * Kentaro, the Smiling Cat - fixed game freeze on usage; --- .../serverside/performance/SerializationTest.java | 15 +++++++++++++++ .../java/mage/abilities/costs/DynamicCost.java | 12 +++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/performance/SerializationTest.java b/Mage.Tests/src/test/java/org/mage/test/serverside/performance/SerializationTest.java index 4234a680ca..ceb21d3a7c 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/performance/SerializationTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/performance/SerializationTest.java @@ -60,6 +60,21 @@ public class SerializationTest extends CardTestPlayerBase { Assert.assertEquals("Must get infected counter", 1, permanent.getCounters(currentGame).getCount(CounterType.M1M1)); } + @Test + public void test_Single_KentaroTheSmilingCat() { + CardInfo cardInfo = CardRepository.instance.findCard("Kentaro, the Smiling Cat"); + Card newCard = cardInfo.getCard(); + Card permCard = CardUtil.getDefaultCardSideForBattlefield(newCard); + PermanentImpl permanent = new PermanentCard(permCard, playerA.getId(), currentGame); + currentGame.addPermanent(permanent, 0); + + // test compress (it uses default java serialization) + Object compressed = CompressUtil.compress(permanent); + Assert.assertTrue("Must be zip", compressed instanceof ZippedObjectImpl); + PermanentImpl uncompressed = (PermanentImpl) CompressUtil.decompress(compressed); + Assert.assertEquals("Must be same", permanent.getName(), uncompressed.getName()); + } + @Test public void test_LondonMulligan() { LondonMulligan mulligan = new LondonMulligan(15); diff --git a/Mage/src/main/java/mage/abilities/costs/DynamicCost.java b/Mage/src/main/java/mage/abilities/costs/DynamicCost.java index efb39245d3..1eee4f2d0a 100644 --- a/Mage/src/main/java/mage/abilities/costs/DynamicCost.java +++ b/Mage/src/main/java/mage/abilities/costs/DynamicCost.java @@ -3,10 +3,12 @@ package mage.abilities.costs; import mage.abilities.Ability; import mage.game.Game; -public interface DynamicCost { - - Cost getCost(Ability ability, Game game); - - String getText(Ability ability, Game game); +import java.io.Serializable; + +public interface DynamicCost extends Serializable { + + Cost getCost(Ability ability, Game game); + + String getText(Ability ability, Game game); }