From a1bdd1fc47036cb61cd630f929a1b9bf08060e2b Mon Sep 17 00:00:00 2001 From: tool4EvEr Date: Sat, 10 Apr 2021 12:35:47 +0200 Subject: [PATCH 1/2] Fix Thieving Skydiver 0 kicker --- forge-game/src/main/java/forge/game/cost/Cost.java | 4 ++-- forge-game/src/main/java/forge/game/cost/CostPartMana.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/forge-game/src/main/java/forge/game/cost/Cost.java b/forge-game/src/main/java/forge/game/cost/Cost.java index 0c5e4d28e61..cfc8739f192 100644 --- a/forge-game/src/main/java/forge/game/cost/Cost.java +++ b/forge-game/src/main/java/forge/game/cost/Cost.java @@ -866,11 +866,11 @@ public class Cost implements Serializable { String r1 = mPart.getRestiction(); String r = r1 == null ? r2 : ( r2 == null ? r1 : r1 + "." + r2); costParts.remove(costPart2); - if (r == null && (mPart.isExiledCreatureCost() || mPart.isEnchantedCreatureCost())) { + if (r == null && (mPart.isExiledCreatureCost() || mPart.isEnchantedCreatureCost() || !mPart.canXbe0())) { // FIXME: something was amiss when trying to add the cost since the mana cost is either \EnchantedCost or \Exiled but the // restriction no longer marks it as such. Therefore, we need to explicitly copy the ExiledCreatureCost/EnchantedCreatureCost // to make cards like Merseine or Back from the Brink work. - costParts.add(0, new CostPartMana(oldManaCost.toManaCost(), r, mPart.isExiledCreatureCost(), mPart.isEnchantedCreatureCost())); + costParts.add(0, new CostPartMana(oldManaCost.toManaCost(), r, mPart.isExiledCreatureCost(), mPart.isEnchantedCreatureCost(), !mPart.canXbe0())); } else { costParts.add(0, new CostPartMana(oldManaCost.toManaCost(), r)); } diff --git a/forge-game/src/main/java/forge/game/cost/CostPartMana.java b/forge-game/src/main/java/forge/game/cost/CostPartMana.java index a4b28f34dee..cdc958d7962 100644 --- a/forge-game/src/main/java/forge/game/cost/CostPartMana.java +++ b/forge-game/src/main/java/forge/game/cost/CostPartMana.java @@ -57,9 +57,9 @@ public class CostPartMana extends CostPart { } // This version of the constructor allows to explicitly set exiledCreatureCost/enchantedCreatureCost, used only when copying costs - public CostPartMana(final ManaCost cost, String restriction, boolean exiledCreatureCost, boolean enchantedCreatureCost) { + public CostPartMana(final ManaCost cost, String restriction, boolean exiledCreatureCost, boolean enchantedCreatureCost, boolean XCantBe0) { this.cost = cost; - this.xCantBe0 = "XCantBe0".equals(restriction); + this.xCantBe0 = XCantBe0; this.isExiledCreatureCost = exiledCreatureCost; this.isEnchantedCreatureCost = enchantedCreatureCost; this.restriction = xCantBe0 || isExiledCreatureCost || isEnchantedCreatureCost? null : restriction; From ece32cbe70d62ba220729c5bf90ce799dcd7cbd8 Mon Sep 17 00:00:00 2001 From: tool4EvEr Date: Sat, 10 Apr 2021 13:51:16 +0200 Subject: [PATCH 2/2] Join XCantBe0 restrictions from both parts when combining costs --- forge-game/src/main/java/forge/game/cost/Cost.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/forge-game/src/main/java/forge/game/cost/Cost.java b/forge-game/src/main/java/forge/game/cost/Cost.java index cfc8739f192..28f81ab44bf 100644 --- a/forge-game/src/main/java/forge/game/cost/Cost.java +++ b/forge-game/src/main/java/forge/game/cost/Cost.java @@ -866,11 +866,12 @@ public class Cost implements Serializable { String r1 = mPart.getRestiction(); String r = r1 == null ? r2 : ( r2 == null ? r1 : r1 + "." + r2); costParts.remove(costPart2); - if (r == null && (mPart.isExiledCreatureCost() || mPart.isEnchantedCreatureCost() || !mPart.canXbe0())) { + boolean XCantBe0 = !mPart.canXbe0() || !costPart2.canXbe0(); + if (r == null && (mPart.isExiledCreatureCost() || mPart.isEnchantedCreatureCost() || XCantBe0)) { // FIXME: something was amiss when trying to add the cost since the mana cost is either \EnchantedCost or \Exiled but the // restriction no longer marks it as such. Therefore, we need to explicitly copy the ExiledCreatureCost/EnchantedCreatureCost // to make cards like Merseine or Back from the Brink work. - costParts.add(0, new CostPartMana(oldManaCost.toManaCost(), r, mPart.isExiledCreatureCost(), mPart.isEnchantedCreatureCost(), !mPart.canXbe0())); + costParts.add(0, new CostPartMana(oldManaCost.toManaCost(), r, mPart.isExiledCreatureCost(), mPart.isEnchantedCreatureCost(), XCantBe0)); } else { costParts.add(0, new CostPartMana(oldManaCost.toManaCost(), r)); }