Implemented Clockwork Servant

This commit is contained in:
Evan Kranzler 2019-09-14 12:32:05 -04:00
parent 3f270d9c2e
commit 3867937b38
3 changed files with 62 additions and 4 deletions

View file

@ -0,0 +1,59 @@
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;
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;
/**
* @author TheElk801
*/
public final class ClockworkServant extends CardImpl {
public ClockworkServant(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}");
this.subtype.add(SubType.GNOME);
this.power = new MageInt(2);
this.toughness = new MageInt(3);
// 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, "<br><i>Adamant</i> &mdash; When {this} enters the battlefield, " +
"if at least three mana of the same color was spent to cast it, draw a card."
), new ManaSpentToCastWatcher());
}
private ClockworkServant(final ClockworkServant card) {
super(card);
}
@Override
public ClockworkServant copy() {
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));
}
}

View file

@ -52,6 +52,7 @@ public final class ThroneOfEldraine extends ExpansionSet {
cards.add(new SetCardInfo("Chulane, Teller of Tales", 326, Rarity.MYTHIC, mage.cards.c.ChulaneTellerOfTales.class));
cards.add(new SetCardInfo("Clackbridge Troll", 84, Rarity.RARE, mage.cards.c.ClackbridgeTroll.class));
cards.add(new SetCardInfo("Claim the Firstborn", 118, Rarity.UNCOMMON, mage.cards.c.ClaimTheFirstborn.class));
cards.add(new SetCardInfo("Clockwork Servant", 216, Rarity.UNCOMMON, mage.cards.c.ClockworkServant.class));
cards.add(new SetCardInfo("Command Tower", 333, Rarity.COMMON, mage.cards.c.CommandTower.class));
cards.add(new SetCardInfo("Corridor Monitor", 41, Rarity.COMMON, mage.cards.c.CorridorMonitor.class));
cards.add(new SetCardInfo("Crystal Slipper", 119, Rarity.COMMON, mage.cards.c.CrystalSlipper.class));

View file

@ -11,8 +11,6 @@ import mage.watchers.common.ManaSpentToCastWatcher;
/**
* @author TheElk801
*/
public enum AdamantCondition implements Condition {
WHITE(ColoredManaSymbol.W),
BLUE(ColoredManaSymbol.U),
@ -20,7 +18,7 @@ public enum AdamantCondition implements Condition {
RED(ColoredManaSymbol.R),
GREEN(ColoredManaSymbol.G);
protected ColoredManaSymbol coloredManaSymbol;
private final ColoredManaSymbol coloredManaSymbol;
private AdamantCondition(ColoredManaSymbol coloredManaSymbol) {
this.coloredManaSymbol = coloredManaSymbol;
@ -29,7 +27,7 @@ public enum AdamantCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
if (source.getAbilityType() == AbilityType.SPELL) {
return (source.getManaCostsToPay().getPayment().getColor(coloredManaSymbol) > 0);
return source.getManaCostsToPay().getPayment().getColor(coloredManaSymbol) > 2;
}
ManaSpentToCastWatcher watcher = game.getState().getWatcher(ManaSpentToCastWatcher.class, source.getSourceId());
if (watcher == null) {