From 34a21d309b8cd77e65e3c756d364d8431d3796f5 Mon Sep 17 00:00:00 2001 From: Northmoc Date: Mon, 16 Nov 2020 14:44:18 -0500 Subject: [PATCH] add keyword "Protection from CommanderColorID" and "Protection from NotCommanderColorID" support to StaticAbilityContinuous.java --- .../StaticAbilityContinuous.java | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/forge-game/src/main/java/forge/game/staticability/StaticAbilityContinuous.java b/forge-game/src/main/java/forge/game/staticability/StaticAbilityContinuous.java index e2e5be9066f..13e6bf0e81f 100644 --- a/forge-game/src/main/java/forge/game/staticability/StaticAbilityContinuous.java +++ b/forge-game/src/main/java/forge/game/staticability/StaticAbilityContinuous.java @@ -632,12 +632,29 @@ public final class StaticAbilityContinuous { } } // replace one Keyword with list of keywords - if (input.startsWith("Protection") && input.contains("CardColors")) { - for (Byte color : affectedCard.determineColor()) { - extraKeywords.add(input.replace("CardColors", MagicColor.toLongString(color))); + if (input.startsWith("Protection")) { + if (input.contains("CardColors")) { + for (Byte color : affectedCard.determineColor()) { + extraKeywords.add(input.replace("CardColors", MagicColor.toLongString(color))); + } + return true; + } + if (input.contains("CommanderColorID")) { + if (!affectedCard.getController().getCommanders().isEmpty()) { + if (input.contains("NotCommanderColorID")) { + for (Byte color : affectedCard.getController().getNotCommanderColorID()) { + extraKeywords.add(input.replace("NotCommanderColorID", MagicColor.toLongString(color))); + } + return true; + } else for (Byte color : affectedCard.getController().getCommanderColorID()) { + extraKeywords.add(input.replace("CommanderColorID", MagicColor.toLongString(color))); + } + return true; + } + return true; } - return true; } + return false; } });