Re: Adding new cards with Groovy
I've submitted a test scenario - though I was only half-joking
TestReaperKing
High Quality Resources for Collectible Card Games and Home of the CCGHQ Team
https://www.slightlymagic.net/forum/
https://www.slightlymagic.net/forum/viewtopic.php?f=82&t=10323
Thanks. Interesting, it even wipes out the player info!ShawnieBoy wrote:I've submitted a test scenario - though I was only half-jokingTestReaperKing

name=Snapcaster Mage
url=http://magiccards.info/isd/en/78.html
image=http://mtgimage.com/card/snapcaster%20mage.jpg
value=3.723
rarity=R
type=Creature
subtype=Human,Wizard
cost={1}{U}
pt=2/1
ability=flash
timing=main
requires_groovy_code
def A_PAYABLE_INSTANT_OR_SORCERY_CARD_FROM_YOUR_GRAVEYARD = new MagicTargetChoice(
MagicTargetFilter.PAYABLE_INSTANT_OR_SORCERY_FROM_GRAVEYARD,
"a instant or sorcery card from your graveyard"
);
[
new MagicWhenComesIntoPlayTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game, final MagicPermanent permanent, final MagicPayedCost payedCost) {
return new MagicEvent(
permanent,
new MagicMayChoice(
A_PAYABLE_INSTANT_OR_SORCERY_CARD_FROM_YOUR_GRAVEYARD
),
MagicGraveyardTargetPicker.PutOntoBattlefield,
this,
"PN may\$ cast target instant or sorcery card\$ from his or her graveyard, then exile it."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
if (event.isYes()) {
event.processTargetCard(game, {
final MagicCard card ->
game.addEvent(new MagicPayManaCostEvent(card,card.getCost()));
game.addEvent(new MagicEvent(
card,
{
final MagicGame G, final MagicEvent E ->
G.doAction(new MagicRemoveCardAction(E.getCard(),MagicLocationType.Graveyard));
final MagicCardOnStack cardOnStack=new MagicCardOnStack(card,event.getPlayer(),game.getPayedCost());
cardOnStack.setMoveLocation(MagicLocationType.Exile);
game.doAction(new MagicPutItemOnStackAction(cardOnStack));
},
"Cast SN."
));
});
}
}
}
]
How about something like...?ShawnieBoy wrote:The total mana cost for Reaper King can vary from 5 -> 10. It's the same problem we had with Phyrexian Mana, unable to give an extra prompt to pay mana or life for each step, but this time 2 colorless mana or 1 colored.

name=Birthing Pod
url=http://magiccards.info/query?q=%21birthing%20pod
image=http://mtgimage.com/card/birthing%20pod.jpg
value=4.588
rarity=R
type=Artifact
cost={3}{P/G}
ability=alt cost {3}, Pay 2 life named Pay 2 life
timing=artifact
requires_groovy_code
def action = {
final MagicGame game, final MagicEvent event ->
final int cmc = event.getRefInt();
final MagicTargetFilter filter = new MagicTargetFilter.MagicCMCCardFilter(
MagicTargetFilter.Factory.card(MagicTargetType.Library, MagicType.Creature),
MagicTargetFilter.Operator.EQUAL,
cmc
);
final MagicTargetChoice choice = new MagicTargetChoice(
filter,
"a creature card with converted mana cost ${cmc} from your library"
);
game.addEvent(new MagicSearchOntoBattlefieldEvent(
event,
choice
));
}
def event = {
final MagicPermanent source, final MagicPayedCost payedCost ->
// canPlay check uses NO_COST
if (payedCost == MagicPayedCost.NO_COST) {
return MagicEvent.NONE;
}
final int cmc = ((MagicPermanent)payedCost.getTarget()).getConvertedCost() + 1;
return new MagicEvent(
source,
cmc,
action,
"PN searches PN's library for a creature card with converted mana cost RN, put that card onto the battlefield, then shuffle your library."
);
}
[
new MagicPermanentActivation(
[MagicCondition.SORCERY_CONDITION],
new MagicActivationHints(MagicTiming.Main),
"Search"
) {
@Override
public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
return [
new MagicPayManaCostEvent(source, "{1}{P/G}"),
new MagicTapEvent(source),
new MagicSacrificePermanentEvent(source, MagicTargetChoice.SACRIFICE_CREATURE),
];
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source, final MagicPayedCost payedCost) {
return event(source, payedCost);
}
},
new MagicPermanentActivation(
[MagicCondition.SORCERY_CONDITION],
new MagicActivationHints(MagicTiming.Main),
"Pay 2 life"
) {
@Override
public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
return [
new MagicPayManaCostEvent(source, "{1}"),
new MagicPayLifeEvent(source, 2),
new MagicTapEvent(source),
new MagicSacrificePermanentEvent(source, MagicTargetChoice.SACRIFICE_CREATURE),
];
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source, final MagicPayedCost payedCost) {
return event(source, payedCost);
}
}
]

name=Detention Sphere
url=http://magiccards.info/query?q=%21detention%20sphere
image=http://mtgimage.com/card/detention%20sphere.jpg
value=4.000
rarity=R
type=Enchantment
cost={1}{W}{U}
ability=leaves return exile
timing=enchantment
requires_groovy_code
def filter = new MagicPermanentFilterImpl() {
public boolean accept(final MagicGame game,final MagicPlayer player,final MagicPermanent target) {
return target.isLand() == false && target.getName().equals("Detention Sphere") == false;
}
};
def choice = new MagicTargetChoice(filter, "target nonland permanent not named Detention Sphere");
[
new MagicWhenComesIntoPlayTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent, final MagicPayedCost payedCost) {
return new MagicEvent(
permanent,
choice,
MagicExileTargetPicker.create(),
this,
"Exile target nonland permanent\$ not named Detention Sphere and all other permanents with the same name as that permanent."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
event.processTargetPermanent(game, {
final MagicPermanent permanent ->
final Collection<MagicPermanent> targets = game.filterPermanents(
event.getPlayer(),
new MagicTargetFilter.NameTargetFilter(permanent.getName())
);
for (final MagicPermanent target : targets) {
game.doAction(new MagicExileUntilThisLeavesPlayAction(
event.getPermanent(),
target
));
}
});
}
}
]

name=Spellskite
url=http://magiccards.info/query?q=%21spellskite
image=http://mtgimage.com/card/spellskite.jpg
value=3.723
rarity=R
type=Artifact,Creature
subtype=Horror
cost={2}
pt=0/4
timing=main
requires_groovy_code
def action = {
final MagicGame game, final MagicEvent event ->
event.processTargetItemOnStack(game, {
final MagicItemOnStack item ->
game.doAction(new MagicChangeTargetAction(item, event.getPermanent()));
});
}
def event = {
final MagicPermanent source ->
return new MagicEvent(
source,
new MagicTargetChoice(MagicTargetFilter.SPELL_OR_ABILITY_WITH_TARGET, MagicTargetHint.Negative, "target spell or ability"),
action,
"Change the target of target spell or ability\$ to SN."
);
}
[
new MagicPermanentActivation(
new MagicActivationHints(MagicTiming.Spell),
"Retarget"
) {
@Override
public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
return [new MagicPayManaCostEvent(source, "{U}")];
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
return event(source);
}
},
new MagicPermanentActivation(
new MagicActivationHints(MagicTiming.Spell),
"Pay 2 life"
) {
@Override
public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
return [new MagicPayLifeEvent(source, 2)];
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
return event(source);
}
}
]