From 46efa00f36b218db6387b5b65d5be2697b20421c Mon Sep 17 00:00:00 2001 From: Northmoc Date: Fri, 30 Jul 2021 11:10:42 -0400 Subject: [PATCH] add Count$TriggeredManaCostDevotion. --- .../java/forge/game/ability/AbilityUtils.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/forge-game/src/main/java/forge/game/ability/AbilityUtils.java b/forge-game/src/main/java/forge/game/ability/AbilityUtils.java index f4e757c137e..25e59f9c404 100644 --- a/forge-game/src/main/java/forge/game/ability/AbilityUtils.java +++ b/forge-game/src/main/java/forge/game/ability/AbilityUtils.java @@ -1806,6 +1806,19 @@ public class AbilityUtils { } return count; } + // Count$TriggeredManaCostDevotion. + if (sq[0].startsWith("TriggeredManaCostDevotion")) { + final SpellAbility root = sa.getRootAbility(); + Card triggeringObject = (Card) root.getTriggeringObject(AbilityKey.Card); + int count = 0; + byte colorCode = ManaAtom.fromName(sq[1]); + for (ManaCostShard sh : triggeringObject.getManaCost()) { + if (sh.isColor(colorCode)) { + count++; + } + } + return count; + } // Count$TriggeredPayingMana.. if (sq[0].startsWith("TriggeredPayingMana")) { final SpellAbility root = sa.getRootAbility(); @@ -1927,7 +1940,7 @@ public class AbilityUtils { // Count$DevotionDual.. // Count$Devotion. if (sq[0].contains("Devotion")) { - int colorOcurrencices = 0; + int colorOccurrences = 0; String colorName = sq[1]; if (colorName.contains("Chosen")) { colorName = MagicColor.toShortString(c.getChosenColor()); @@ -1939,12 +1952,12 @@ public class AbilityUtils { for (Card c0 : player.getCardsIn(ZoneType.Battlefield)) { for (ManaCostShard sh : c0.getManaCost()) { if (sh.isColor(colorCode)) { - colorOcurrencices++; + colorOccurrences++; } } - colorOcurrencices += c0.getAmountOfKeyword("Your devotion to each color and each combination of colors is increased by one."); + colorOccurrences += c0.getAmountOfKeyword("Your devotion to each color and each combination of colors is increased by one."); } - return doXMath(colorOcurrencices, expr, c, ctb); + return doXMath(colorOccurrences, expr, c, ctb); } } // end ctb != null