diff --git a/Mage.Sets/src/mage/cards/c/CutOfTheProfits.java b/Mage.Sets/src/mage/cards/c/CutOfTheProfits.java new file mode 100644 index 0000000000..7d8eba2b48 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CutOfTheProfits.java @@ -0,0 +1,37 @@ +package mage.cards.c; + +import mage.abilities.dynamicvalue.common.ManacostVariableValue; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.LoseLifeSourceControllerEffect; +import mage.abilities.keyword.CasualtyAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class CutOfTheProfits extends CardImpl { + + public CutOfTheProfits(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{B}{B}"); + + // Casualty 3 + this.addAbility(new CasualtyAbility(this, 3)); + + // You draw X cards and you lose X life. + this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(ManacostVariableValue.REGULAR, "you")); + this.getSpellAbility().addEffect(new LoseLifeSourceControllerEffect(ManacostVariableValue.REGULAR).concatBy("and")); + } + + private CutOfTheProfits(final CutOfTheProfits card) { + super(card); + } + + @Override + public CutOfTheProfits copy() { + return new CutOfTheProfits(this); + } +} diff --git a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java index ef0b20fabb..f54bf910d6 100644 --- a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java +++ b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java @@ -24,6 +24,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet { cards.add(new SetCardInfo("Brokers Ascendancy", 170, Rarity.RARE, mage.cards.b.BrokersAscendancy.class)); cards.add(new SetCardInfo("Brokers Charm", 171, Rarity.UNCOMMON, mage.cards.b.BrokersCharm.class)); cards.add(new SetCardInfo("Cabaretti Charm", 173, Rarity.UNCOMMON, mage.cards.c.CabarettiCharm.class)); + cards.add(new SetCardInfo("Cut of the Profits", 72, Rarity.RARE, mage.cards.c.CutOfTheProfits.class)); cards.add(new SetCardInfo("Forest", 270, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Island", 264, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Jetmir's Garden", 250, Rarity.RARE, mage.cards.j.JetmirsGarden.class)); diff --git a/Mage/src/main/java/mage/abilities/keyword/CasualtyAbility.java b/Mage/src/main/java/mage/abilities/keyword/CasualtyAbility.java new file mode 100644 index 0000000000..9132893f7d --- /dev/null +++ b/Mage/src/main/java/mage/abilities/keyword/CasualtyAbility.java @@ -0,0 +1,86 @@ +package mage.abilities.keyword; + +import mage.abilities.Ability; +import mage.abilities.StaticAbility; +import mage.abilities.common.delayed.ReflexiveTriggeredAbility; +import mage.abilities.costs.Cost; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.effects.common.CopySourceSpellEffect; +import mage.abilities.effects.common.InfoEffect; +import mage.cards.Card; +import mage.constants.ComparisonType; +import mage.constants.Zone; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.mageobject.PowerPredicate; +import mage.game.Game; +import mage.target.common.TargetControlledPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public class CasualtyAbility extends StaticAbility { + + public CasualtyAbility(Card card, int number) { + super(Zone.ALL, new InfoEffect( + "Casualty " + number + " (As you cast this spell, " + + "you may sacrifice a creature with power " + number + + " or greater. When you do, copy this spell.)" + )); + card.getSpellAbility().addCost(new CasualtyCost(number)); + } + + private CasualtyAbility(final CasualtyAbility ability) { + super(ability); + } + + @Override + public CasualtyAbility copy() { + return new CasualtyAbility(this); + } +} + +class CasualtyCost extends SacrificeTargetCost { + + CasualtyCost(int number) { + super(new TargetControlledPermanent(0, 1, makeFilter(number), true)); + this.text = ""; + } + + private CasualtyCost(final CasualtyCost cost) { + super(cost); + } + + @Override + public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { + if (!super.pay(ability, game, source, controllerId, noMana, costToPay)) { + return false; + } + if (!getPermanents().isEmpty()) { + game.fireReflexiveTriggeredAbility(new ReflexiveTriggeredAbility( + new CopySourceSpellEffect(), false, "when you do, copy this spell" + ), source); + } + return true; + } + + @Override + public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { + return true; + } + + @Override + public CasualtyCost copy() { + return new CasualtyCost(this); + } + + private static FilterControlledPermanent makeFilter(int number) { + FilterControlledPermanent filter = new FilterControlledCreaturePermanent( + "creature with power " + number + " or greater" + ); + filter.add(new PowerPredicate(ComparisonType.MORE_THAN, number - 1)); + return filter; + } +} diff --git a/Utils/keywords.txt b/Utils/keywords.txt index e752919eeb..2e4e79b1d8 100644 --- a/Utils/keywords.txt +++ b/Utils/keywords.txt @@ -10,6 +10,7 @@ Bloodthirst|number| Bushido|number| Buyback|manaString| Cascade|new| +Casualty|card, number| Changeling|new| Cleave|card, manaString| Compleated|instance|