diff --git a/Mage.Sets/src/mage/cards/c/ClockworkServant.java b/Mage.Sets/src/mage/cards/c/ClockworkServant.java index 7e9d9496308..26041666028 100644 --- a/Mage.Sets/src/mage/cards/c/ClockworkServant.java +++ b/Mage.Sets/src/mage/cards/c/ClockworkServant.java @@ -1,9 +1,7 @@ package mage.cards.c; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.condition.Condition; import mage.abilities.condition.common.AdamantCondition; import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; import mage.abilities.effects.common.DrawCardSourceControllerEffect; @@ -11,10 +9,8 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.game.Game; import mage.watchers.common.ManaSpentToCastWatcher; -import java.util.Arrays; import java.util.UUID; /** @@ -32,7 +28,7 @@ public final class ClockworkServant extends CardImpl { // Adamant - When Clockwork Servant enters the battlefield, if at least three mana of the same color was spent to cast it, draw a card. this.addAbility(new ConditionalInterveningIfTriggeredAbility( new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1)), - ClockworkServantCondition.instance, "
Adamant — When {this} enters the battlefield, " + + AdamantCondition.ALL, "
Adamant — When {this} enters the battlefield, " + "if at least three mana of the same color was spent to cast it, draw a card." ), new ManaSpentToCastWatcher()); } @@ -46,14 +42,3 @@ public final class ClockworkServant extends CardImpl { return new ClockworkServant(this); } } - -enum ClockworkServantCondition implements Condition { - instance; - - @Override - public boolean apply(Game game, Ability source) { - return Arrays - .stream(AdamantCondition.values()) - .anyMatch(adamantCondition -> adamantCondition.apply(game, source)); - } -} \ No newline at end of file diff --git a/Mage/src/main/java/mage/abilities/condition/common/AdamantCondition.java b/Mage/src/main/java/mage/abilities/condition/common/AdamantCondition.java index ae6fb8f11f4..7e1b5ab383a 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/AdamantCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/AdamantCondition.java @@ -8,6 +8,8 @@ import mage.constants.ColoredManaSymbol; import mage.game.Game; import mage.watchers.common.ManaSpentToCastWatcher; +import java.util.Arrays; + /** * @author TheElk801 */ @@ -16,7 +18,8 @@ public enum AdamantCondition implements Condition { BLUE(ColoredManaSymbol.U), BLACK(ColoredManaSymbol.B), RED(ColoredManaSymbol.R), - GREEN(ColoredManaSymbol.G); + GREEN(ColoredManaSymbol.G), + ALL(null); private final ColoredManaSymbol coloredManaSymbol; @@ -27,6 +30,12 @@ public enum AdamantCondition implements Condition { @Override public boolean apply(Game game, Ability source) { if (source.getAbilityType() == AbilityType.SPELL) { + if (coloredManaSymbol == null) { + return Arrays + .stream(ColoredManaSymbol.values()) + .map(source.getManaCostsToPay().getPayment()::getColor) + .anyMatch(i -> i > 2); + } return source.getManaCostsToPay().getPayment().getColor(coloredManaSymbol) > 2; } ManaSpentToCastWatcher watcher = game.getState().getWatcher(ManaSpentToCastWatcher.class, source.getSourceId()); @@ -37,6 +46,12 @@ public enum AdamantCondition implements Condition { if (payment == null) { return false; } + if (coloredManaSymbol == null) { + return Arrays + .stream(ColoredManaSymbol.values()) + .map(payment::getColor) + .anyMatch(i -> i > 2); + } return payment.getColor(coloredManaSymbol) > 2; } }