diff --git a/Mage.Sets/src/mage/cards/c/ClayChampion.java b/Mage.Sets/src/mage/cards/c/ClayChampion.java new file mode 100644 index 0000000000..9f8ef3313c --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/ClayChampion.java @@ -0,0 +1,64 @@ +package mage.cards.c; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.MultipliedValue; +import mage.abilities.dynamicvalue.common.EachTwoManaSpentToCastValue; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.counters.CounterType; +import mage.filter.StaticFilters; +import mage.target.TargetPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ClayChampion extends CardImpl { + + private static final DynamicValue xValue = new MultipliedValue(EachTwoManaSpentToCastValue.GREEN, 3); + + public ClayChampion(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{X}{4}"); + + this.subtype.add(SubType.CONSTRUCT); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Clay Champion enters the battlefield with three +1/+1 counters on it for each {G}{G} spent to cast it. + this.addAbility(new EntersBattlefieldAbility( + new AddCountersSourceEffect(CounterType.P1P1.createInstance(), xValue, true), + null, null, "with three +1/+1 counters on it for each {G}{G} spent to cast it" + )); + + // When Clay Champion enters the battlefield, choose up to two other creatures you control. For each {W}{W} spent to cast Clay Champion, put a +1/+1 counter on each of them. + Ability ability = new EntersBattlefieldTriggeredAbility( + new AddCountersTargetEffect( + CounterType.P1P1.createInstance(0), + EachTwoManaSpentToCastValue.WHITE + ).setText("choose up to two other creatures you control. " + + "For each {W}{W} spent to cast {this}, put a +1/+1 counter on each of them") + ); + ability.addTarget(new TargetPermanent( + 0, 2, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE + )); + this.addAbility(ability); + } + + private ClayChampion(final ClayChampion card) { + super(card); + } + + @Override + public ClayChampion copy() { + return new ClayChampion(this); + } +} diff --git a/Mage.Sets/src/mage/sets/TheBrothersWar.java b/Mage.Sets/src/mage/sets/TheBrothersWar.java index 934819f6e6..959ab42a71 100644 --- a/Mage.Sets/src/mage/sets/TheBrothersWar.java +++ b/Mage.Sets/src/mage/sets/TheBrothersWar.java @@ -40,6 +40,7 @@ public final class TheBrothersWar extends ExpansionSet { cards.add(new SetCardInfo("Blast Zone", 258, Rarity.RARE, mage.cards.b.BlastZone.class)); cards.add(new SetCardInfo("Brotherhood's End", 128, Rarity.RARE, mage.cards.b.BrotherhoodsEnd.class)); cards.add(new SetCardInfo("Brushland", 259, Rarity.RARE, mage.cards.b.Brushland.class)); + cards.add(new SetCardInfo("Clay Champion", 230, Rarity.MYTHIC, mage.cards.c.ClayChampion.class)); cards.add(new SetCardInfo("Clay Revenant", 118, Rarity.COMMON, mage.cards.c.ClayRevenant.class)); cards.add(new SetCardInfo("Combat Thresher", 35, Rarity.UNCOMMON, mage.cards.c.CombatThresher.class)); cards.add(new SetCardInfo("Corrupt", 88, Rarity.UNCOMMON, mage.cards.c.Corrupt.class)); diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/EachTwoManaSpentToCastValue.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/EachTwoManaSpentToCastValue.java new file mode 100644 index 0000000000..4620fbb979 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/EachTwoManaSpentToCastValue.java @@ -0,0 +1,51 @@ +package mage.abilities.dynamicvalue.common; + +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.constants.AbilityType; +import mage.constants.ColoredManaSymbol; +import mage.game.Game; +import mage.watchers.common.ManaSpentToCastWatcher; + +/** + * @author TheElk801 + */ +public enum EachTwoManaSpentToCastValue implements DynamicValue { + WHITE(ColoredManaSymbol.W), + BLUE(ColoredManaSymbol.U), + BLACK(ColoredManaSymbol.B), + RED(ColoredManaSymbol.R), + GREEN(ColoredManaSymbol.G); + private final ColoredManaSymbol coloredManaSymbol; + + EachTwoManaSpentToCastValue(ColoredManaSymbol manaSymbol) { + this.coloredManaSymbol = manaSymbol; + } + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + if (sourceAbility.getAbilityType() == AbilityType.SPELL) { + return sourceAbility.getManaCostsToPay().getUsedManaToPay().getColor(coloredManaSymbol) / 2; + } + Mana payment = game + .getState() + .getWatcher(ManaSpentToCastWatcher.class) + .getLastManaPayment(sourceAbility.getSourceId()); + if (payment == null) { + return 0; + } + return payment.getColor(coloredManaSymbol) / 2; + } + + @Override + public EachTwoManaSpentToCastValue copy() { + return this; + } + + @Override + public String getMessage() { + return "for each {" + this.coloredManaSymbol + "}{" + this.coloredManaSymbol + "} spent to cast it"; + } +}