[SNC] Implemented Cut of the Profits

This commit is contained in:
Evan Kranzler 2022-04-07 19:42:45 -04:00
parent fea3fd4cc2
commit 6d5e2d9297
4 changed files with 125 additions and 0 deletions

View file

@ -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);
}
}

View file

@ -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));

View file

@ -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 + " <i>(As you cast this spell, " +
"you may sacrifice a creature with power " + number +
" or greater. When you do, copy this spell.)</i>"
));
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;
}
}

View file

@ -10,6 +10,7 @@ Bloodthirst|number|
Bushido|number|
Buyback|manaString|
Cascade|new|
Casualty|card, number|
Changeling|new|
Cleave|card, manaString|
Compleated|instance|