Re: Adding new cards with Groovy
want to try to script "aetherplasm", having trouble with the "comes into play blocking..." part. any idea? 
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
Not possible right now, the closest we have is MagicDeclareBlockerAction, i.e.hong yie wrote:want to try to script "aetherplasm", having trouble with the "comes into play blocking..." part. any idea?
// assuming attacker and blocker are defined earlier
game.doAction(new MagicDeclareBlockerAction(attacker, blocker));

name=Solemn Simulacrum
url=http://magiccards.info/m12/en/217.html
image=http://magiccards.info/scans/en/m12/217.jpg
value=3.524
rarity=R
type=Artifact,Creature
subtype=Golem
cost={4}
pt=2/2
ability=die may draw card
timing=main
requires_groovy_code=Farhaven Elf

name=Ingot Chewer
url=http://magiccards.info/lw/en/180.html
image=http://magiccards.info/scans/en/lw/180.jpg
value=3.524
rarity=C
type=Creature
subtype=Elemental
cost={4}{R}
pt=3/3
ability=enters destroy target artifact.;evoke {R}
timing=main

name=Chromatic Lantern
url=http://magiccards.info/rtr/en/226.html
image=http://magiccards.info/scans/en/rtr/226.jpg
value=2.428
rarity=R
type=Artifact
cost={3}
ability=lord lands you control have tap add mana any;\
tap add mana any
timing=main

name=Flusterstorm
url=http://magiccards.info/cmd/en/46.html
image=http://magiccards.info/scans/en/cmd/46.jpg
value=4.644
rarity=R
type=Instant
cost={U}
ability=storm
timing=counter
requires_groovy_code
[
new MagicSpellCardEvent() {
@Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
return new MagicEvent(
cardOnStack,
MagicTargetChoice.NEG_TARGET_INSTANT_OR_SORCERY_SPELL,
this,
"Counter target instant or sorcery spell\$ unless its controller pays {1}."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
event.processTargetCardOnStack(game,new MagicCardOnStackAction() {
public void doAction(final MagicCardOnStack targetSpell) {
game.addEvent(new MagicCounterUnlessEvent(event.getSource(),targetSpell,MagicManaCost.create("{1}")));
}
});
}
}
]

name=Relic of Progenitus
url=http://magiccards.info/mma/en/213.html
image=http://magiccards.info/scans/en/mma/213.jpg
value=2.428
rarity=C
type=Artifact
cost={1}
timing=main
requires_groovy_code
def action = {
final MagicGame game, final MagicEvent event ->
event.processTargetCard(game,new MagicCardAction() {
public void doAction(final MagicCard card) {
game.doAction(new MagicRemoveCardAction(card,MagicLocationType.Graveyard));
game.doAction(new MagicMoveCardAction(card,MagicLocationType.Graveyard,MagicLocationType.Exile));
}
});
} as MagicEventAction
[
new MagicPermanentActivation(
new MagicActivationHints(MagicTiming.Main),
"Exile one"
) {
@Override
public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
return [new MagicTapEvent(source)];
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
return new MagicEvent(
source,
MagicTargetChoice.TARGET_PLAYER,
this,
"Target player\$ exiles a card from his or her graveyard."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
event.processTargetPlayer(game, {
final MagicPlayer targetPlayer ->
game.addEvent(new MagicEvent(
event.getSource(),
targetPlayer,
new MagicTargetChoice("a card from your graveyard"),
MagicGraveyardTargetPicker.ExileOwn,
action,
"PN exiles a card\$ from his or her graveyard."
));
} as MagicPlayerAction);
}
},
new MagicPermanentActivation(
new MagicActivationHints(MagicTiming.Main),
"Exile all"
) {
@Override
public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
return [
new MagicPayManaCostEvent(source, "{1}"),
new MagicExileEvent(source)
];
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
return new MagicEvent(
source,
this,
"Exile all cards from all graveyards. Draw a card."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
for (final MagicPlayer player : game.getPlayers()) {
for (final MagicCard card : new MagicCardList(player.getGraveyard())) {
game.doAction(new MagicRemoveCardAction(card, MagicLocationType.Graveyard));
game.doAction(new MagicMoveCardAction(card, MagicLocationType.Graveyard, MagicLocationType.Exile));
}
}
game.doAction(new MagicDrawAction(event.getPlayer()));
}
}
]

name=Shard Volley
url=http://magiccards.info/mt/en/103.html
image=http://magiccards.info/scans/en/mt/103.jpg
value=4.644
removal=3
rarity=C
type=Instant
cost={R}
timing=removal
requires_groovy_code
[
new MagicAdditionalCost() {
@Override
public MagicEvent getEvent(final MagicSource source) {
return new MagicSacrificePermanentEvent(source, MagicTargetChoice.SACRIFICE_LAND);
}
},
new MagicSpellCardEvent() {
@Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
return new MagicEvent(
cardOnStack,
MagicTargetChoice.NEG_TARGET_CREATURE_OR_PLAYER,
new MagicDamageTargetPicker(3),
this,
"SN deals 3 damage to target creature or player\$."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
event.processTarget(game,new MagicTargetAction() {
public void doAction(final MagicTarget target) {
final MagicDamage damage=new MagicDamage(event.getSource(),target,3);
game.doAction(new MagicDealDamageAction(damage));
}
});
}
}
]
I do something very similar when implementing cards. I open up a text file containing the rules text for existing cards and use it to search for similar cards. Thanks for the nice workmike wrote:As a little helper for finding a similar card as a starting point I added search functionality the Project Firemind that lets you search in the cards abilities (original text) and shows you the Magarena scripts for it. Hope this is useful to someone.
http://www.firemind.ch/cards/search
Not possible at the moment but doable. Any specific card you are looking at?hong yie wrote:do we have someway to apply "tap an untapped ... creature" to pay a cost of ability before? i see many interesting cards use this "tap" to pay a cost of its ability.
chagne Name - nohong yie wrote:is there a way to change the property of a card while its on the battlefield? beside changing power toughness, including name, casting cost, color, type, or add new ability into it / remove all abilities from it?
Not possible at the moment but doable. Any specific card you are looking at?hong yie wrote:how to script "discard a creature card:..." as a cost of an ability? filter?
Added for next releasehong yie wrote:need MagicTargetChoice.SACRIFICE_NON_VAMPIRE() please...
No such property: SACRIFICE_NON_VAMPIRE for class: java.lang.Class <magic.model.choice.MagicTargetChoice>

name=Xathrid Necromancer
url=http://magiccards.info/m14/en/123.html
image=http://magiccards.info/scans/en/m14/123.jpg
value=3.721
rarity=R
type=Creature
subtype=Human,Wizard
cost={2}{B}
pt=2/2
timing=main
requires_groovy_code
[
new MagicWhenOtherDiesTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game, final MagicPermanent permanent, final MagicPermanent diedPermanent) {
return (permanent == diedPermanent ||
(diedPermanent.hasSubType(MagicSubType.Human) &&
diedPermanent.isCreature() &&
permanent.isFriend(diedPermanent))) ?
new MagicEvent(
permanent,
this,
"PN puts a 2/2 black Zombie creature token onto the battlefield tapped."
):
MagicEvent.NONE;
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
game.doAction(new MagicPlayCardAction(
MagicCard.createTokenCard(
TokenCardDefinitions.get("Zombie"),
event.getPlayer()
),
[MagicPlayMod.TAPPED]
));
}
}
]

name=Foundry Street Denizen
url=http://magiccards.info/gtc/en/92.html
image=http://magiccards.info/scans/en/gtc/92.jpg
value=3.721
rarity=C
type=Creature
subtype=Goblin,Warrior
cost={R}
pt=1/1
timing=main
requires_groovy_code
[
new MagicWhenOtherComesIntoPlayTrigger() {
@Override
public boolean accept(final MagicPermanent source, final MagicPermanent other) {
return other != source &&
other.hasColor(MagicColor.Red) &&
other.isCreature() &&
other.isFriend(source);
}
@Override
public MagicEvent executeTrigger(final MagicGame game, final MagicPermanent source, final MagicPermanent other) {
return new MagicEvent(
source,
this,
"SN gets +1/+0 until end of turn."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
game.doAction(new MagicChangeTurnPTAction(event.getPermanent(),1,0));
}
}
]