How to code flashback ? (Working)

For all your questions regarding Image Card Coding.
Please read the Image Posting Guideline & Index before posting in this forum.
Forum rules
DO NOT POST BUG REPORT IN THIS FORUM !!

Please read carefully the forum rules related to the card coding section : viewtopic.php?f=21&t=1545

All post will be edited to follow forum rules.
Norrin
Posts: 32
Joined: Thu Apr 15, 2010 5:01 am
Location: Brazil

How to code flashback ? (Working)

Post by Norrin » Fri Apr 16, 2010 4:00 am

Hey people, im new to those forums, id like to say this game is great,ive searched for something like this for a long time ;)
Anyway, ive sucessfuly coded a few cards with flashback,and they work just as they are supposed to, here are they:

[card]
name=Acorn Harvest
auto=token(Squirrel,creature squirrel, 1/1,green)*2
autograveyard={1}{G}:moveTo(exile)(this) && token(Squirrel,creature squirrel, 1/1,green)*2 && life:-3 controller asSorcery
text=Put two 1/1 green Squirrel creature tokens onto the battlefield.
Flashback—1G, Pay 3 life. (You may cast this card from your graveyard for its flashback cost. Then exile it.)
mana={3}{G}
type=Sorcery
[/card]

[card]
name=Deep Analysis
auto=draw:2
autograveyard={1}{U}:moveTo(exile)(this) && draw:2 && life:-3 controller asSorcery
text=Target player draws two cards.
Flashback—1U, Pay 3 life. (You may cast this card from your graveyard for its flashback cost. Then exile it.)
mana={3}{U}
type=Sorcery
[/card]

[card]
name=Folk Medicine
auto=foreach(creature|myBattlefield) life:1
autograveyard={1}{W}:moveTo(exile)(this) && foreach(creature|myBattlefield) life:1
text=You gain 1 life for each creature you control.
Flashback 1W (You may cast this card from your graveyard for its flashback cost. Then exile it.)
mana={2}{G}
type=Instant
[/card]

[card]
name=Chatter of the Squirrel
auto=token(Squirrel,creature squirrel, 1/1,green)
autograveyard={1}{G}:moveTo(exile)(this) && token(Squirrel,creature squirrel, 1/1,green) asSorcery
text=Put a 1/1 green Squirrel creature token onto the battlefield.
Flashback 1G (You may cast this card from your graveyard for its flashback cost. Then exile it.)
mana={G}
type=Instant
[/card]

These are only a few, im sure that all other token creation cards with flashback are doable, i just want to show you its possible, but, when i tried to code this card :

[card]
name=Defy Gravity
target=creature
auto=flying
autograveyard={U}:flying target(creature) && moveTo(exile)(this)
text=Target creature gains flying until end of turn.
Flashback-U (You may cast this card from your graveyard for its flashback cost. Then exile it.)
mana={U}
type=Instant
[/card]

Unfortunely, the target creature got remove instead of the spell itself :|
I guess this wont work with cards that target something :|


[EDIT ABRA: Changed title]

abrasax
Posts: 976
Joined: Wed Oct 15, 2008 7:46 am
Location: Switzerland

Re: Flashback cards

Post by abrasax » Fri Apr 16, 2010 7:29 am

[card]
name=Defy Gravity
target=creature
auto=flying
autograveyard={U}:flying target(creature) && moveTo(exile)(this)
text=Target creature gains flying until end of turn.
Flashback-U (You may cast this card from your graveyard for its flashback cost. Then exile it.)
mana={U}
type=Instant
[/card]

Unfortunely, the target creature got remove instead of the spell itself
I guess this wont work with cards that target something
It is probably related to the way you ared using the "this" keyword.

When you code something like "moveto(zone)"if not target is specified the engine is trying to determinate the best possible target, in the two first example you posted since there is no target, the engine automatically deducted that the target should be the card itself, so I assume your code for the two first cards will also work without adding (this).

Regarding the second one, you want here to specifiy that the moveto(zone) is targeting (this) card only, you cannot do that with the code you added, you could do that eventually by adding the following (but it is just a supposision) :

autograveyard={U}:flying target(creature) && moveTo(exile) all(this)

The use of the all(target) is a workaround widely use in the mtg.txt currently, you can have a look to see its utilisation... But it has never been tested with autograveyard so far, as we implemented this functionality only in the last release, so it might work and you might to give it a try.

Thanks for your great finding by the way, more work for Herr Doktor.... :-D

Grüssi

Abra
We need your Help !!!
New to wagic ? Be sure to check the following :

Bug report: Bug reporting
Help us: Add cards & Compiling.
Customize: Themes FAQ, All images thread, Abra's Mediafire folder

Dr.Solomat
Posts: 975
Joined: Mon Dec 15, 2008 5:12 pm
Location: Germany

Re: Flashback cards

Post by Dr.Solomat » Fri Apr 16, 2010 7:58 am

I had this idea, too, but I did not add cards with flashback because if you code them like this and then cast them from the graveyard, the opponent cannot counter them. This is normally a heavy drawback, though I know that the AI cannot deal with counter spells in its deck.


What do the others think!? I am a little skeptical.
Sets Coded/Released: Legends, Visions, Weatherlight, Tempest, Stronghold, Portal I & III, Urza's Saga BLOCK, Mercadian Masques, Invasion BLOCK, Mirrodin, Ravnica, Guildpact, Conflux, Alara Reborn

Onitenshi
Posts: 122
Joined: Sun Apr 12, 2009 12:56 pm
Location: Austria

Re: Flashback cards

Post by Onitenshi » Fri Apr 16, 2010 1:24 pm

I haven't tested this, but couldn't there be a possibility to get a workaround with the copy-keyword for all flashback-cards without a "target="-line? I'm not sure, but I think when I was coding the "Feint"-ability for my custom set, the copied spells where added to the stack while the original card stays in its zone
ImageImageImageImageImage

Norrin
Posts: 32
Joined: Thu Apr 15, 2010 5:01 am
Location: Brazil

Re: Flashback cards

Post by Norrin » Fri Apr 16, 2010 3:03 pm

abrasax wrote: It is probably related to the way you ared using the "this" keyword.

When you code something like "moveto(zone)"if not target is specified the engine is trying to determinate the best possible target, in the two first example you posted since there is no target, the engine automatically deducted that the target should be the card itself, so I assume your code for the two first cards will also work without adding (this).
Yeah, i tested all cards without adding (this) and they worked, except for defy gravity wich still removed the target creature.
abrasax wrote:Regarding the second one, you want here to specifiy that the moveto(zone) is targeting (this) card only, you cannot do that with the code you added, you could do that eventually by adding the following (but it is just a supposision) :
autograveyard={U}:flying target(creature) && moveTo(exile) all(this)
My first try on coding these was using all(this) but then the card doesnt get removed from the game, i guess it doesnt work with autograveyard.
Dr.Solomat wrote:I had this idea, too, but I did not add cards with flashback because if you code them like this and then cast them from the graveyard, the opponent cannot counter them. This is normally a heavy drawback, though I know that the AI cannot deal with counter spells in its deck.


What do the others think!? I am a little skeptical.
The spell isnt actualy played like its supposed to, this is a workarround,but, i had this idea when i saw how the cards with retrace were coded, the spell isnt played in the way retrace is coded aswell.

Norrin
Posts: 32
Joined: Thu Apr 15, 2010 5:01 am
Location: Brazil

Re: Flashback cards

Post by Norrin » Sat Apr 17, 2010 2:15 am

Onitenshi wrote:I haven't tested this, but couldn't there be a possibility to get a workaround with the copy-keyword for all flashback-cards without a "target="-line? I'm not sure, but I think when I was coding the "Feint"-ability for my custom set, the copied spells where added to the stack while the original card stays in its zone
Youre right, all cards can be coded using copy, like that:

[card]
name=Acorn Harvest
auto=token(Squirrel,creature squirrel, 1/1,green)*2
autograveyard={1}{G}:moveTo(exile)(this) && copy(this) && life:-3
controller asSorcery
text=Put two 1/1 green Squirrel creature tokens onto the battlefield.
Flashback—1G, Pay 3 life. (You may cast this card from your graveyard
for its flashback cost. Then exile it.)
mana={3}{G}
type=Sorcery
[/card]

[card]
name=Deep Analysis
auto=draw:2
autograveyard={1}{U}:copy(this) && draw:2 && life:-3 controller
asSorcery
text=Target player draws two cards.
Flashback—1U, Pay 3 life. (You may cast this card from your graveyard
for its flashback cost. Then exile it.)
mana={3}{U}
type=Sorcery
[/card]

[card]
name=Folk Medicine
auto=foreach(creature|myBattlefield) life:1
autograveyard={1}{W}:copy(this) && moveTo(exile)
text=You gain 1 life for each creature you control.
Flashback 1W (You may cast this card from your graveyard for its
flashback cost. Then exile it.)
mana={2}{G}
type=Instant
[/card]

[card]
name=Chatter of the Squirrel
auto=token(Squirrel,creature squirrel, 1/1,green)
autograveyard={1}{G}:copy(this) && moveTo(exile) asSorcery
text=Put a 1/1 green Squirrel creature token onto the battlefield.
Flashback 1G (You may cast this card from your graveyard for its
flashback cost. Then exile it.)
mana={G}
type=Instant
[/card]

additionaly, defy gravity works now, ive also made firebolt to make sure all cards that target something could be done now :

[card]
name=Firebolt
auto=damage:2 target(creature,player)
autograveyard={4}{R}:copy(this) && moveTo(exile) asSorcery
text=Firebolt deals 2 damage to target creature or player.
Flashback 4R (You may cast this card from your graveyard for its flashback cost. Then exile it.)
mana={R}
type=Sorcery
[/card]

[card]
name=Defy Gravity
auto=flying target(creature)
autograveyard={U}:copy(this) && moveTo(exile)
text=Target creature gains flying until end of turn.
Flashback-U (You may cast this card from your graveyard for its
flashback cost. Then exile it.)
mana={U}
type=Instant
[/card]

Question: is there a way to find out how much damage is done to a creature (for something like, Sprouting Phytohydra)

Dr.Solomat
Posts: 975
Joined: Mon Dec 15, 2008 5:12 pm
Location: Germany

Re: Flashback cards

Post by Dr.Solomat » Sat Apr 17, 2010 7:20 am

Norrin wrote: The spell isnt actualy played like its supposed to, this is a workarround,but, i had this idea when i saw how the cards with retrace were coded, the spell isnt played in the way retrace is coded aswell.
Well, that's true! :D
Sets Coded/Released: Legends, Visions, Weatherlight, Tempest, Stronghold, Portal I & III, Urza's Saga BLOCK, Mercadian Masques, Invasion BLOCK, Mirrodin, Ravnica, Guildpact, Conflux, Alara Reborn

Dr.Solomat
Posts: 975
Joined: Mon Dec 15, 2008 5:12 pm
Location: Germany

Re: Flashback cards

Post by Dr.Solomat » Sat Apr 17, 2010 7:23 am

Onitenshi wrote:I haven't tested this, but couldn't there be a possibility to get a workaround with the copy-keyword for all flashback-cards without a "target="-line? I'm not sure, but I think when I was coding the "Feint"-ability for my custom set, the copied spells where added to the stack while the original card stays in its zone

WOW! I did not know about the possibility of copying noncreature spells....great find, man! This is awesome!
Sets Coded/Released: Legends, Visions, Weatherlight, Tempest, Stronghold, Portal I & III, Urza's Saga BLOCK, Mercadian Masques, Invasion BLOCK, Mirrodin, Ravnica, Guildpact, Conflux, Alara Reborn

baldersmashed
Posts: 156
Joined: Sat Apr 25, 2009 12:00 am

Re: Flashback cards

Post by baldersmashed » Sat Apr 17, 2010 8:04 pm

Does copying the spell still trigger 'When a player casts a spell...' type triggers? If so, maybe this could be a path to a few alternate cost cards using autohand and moveto to move the original to the graveyard.

Gatherer search puts a good example right at the top.

Code: Select all

Abolish 1WW
Instant
You may discard a Plains card rather than pay Abolish's mana cost.
Destroy target artifact or enchantment.
could be

Code: Select all

autohand={S(plains|myhand)}:copy(this) && moveto(ownergraveyard)
Any way this could be a problem?
Dr.Solomat wrote:"Vegeta! What does the scouter say about Wagics power level?"

"It's over ten thooooouuuuuusaaaaaaaaand!"

"What 10.000? There's no way that can be right!"

Norrin
Posts: 32
Joined: Thu Apr 15, 2010 5:01 am
Location: Brazil

Re: Flashback cards

Post by Norrin » Sat Apr 17, 2010 9:10 pm

baldersmashed wrote:Does copying the spell still trigger 'When a player casts a spell...' type triggers? If so, maybe this could be a path to a few alternate cost cards using autohand and moveto to move the original to the graveyard.

Gatherer search puts a good example right at the top.

Code: Select all

Abolish 1WW
Instant
You may discard a Plains card rather than pay Abolish's mana cost.
Destroy target artifact or enchantment.
could be

Code: Select all

autohand={S(plains|myhand)}:copy(this) && moveto(ownergraveyard)
Any way this could be a problem?
Yeah i was actualy thinking of this too, the thing is..it works! I tested on these two cards:

Code: Select all

[card]
name=Crash
auto=destroy target(artifact)
autohand={S(mountain|myBattlefield)}:copy(this) && 

moveto(ownergraveyard)
text=You may sacrifice a Mountain rather than pay Crash's mana cost.
Destroy target artifact.
mana={2}{R}
type=Instant
[/card]

Code: Select all

[card]
name=Bringer of the Blue Dawn
abilities=trample
auto=@each my draw: may draw:2
autohand={W}{U}{B}{R}{G}:copy(this) && moveto(mybattlefield)
text= You may pay WUBRG rather than pay Bringer of the Blue Dawn's mana 
cost.
Trample
At the beginning of your upkeep, you may draw two cards.
mana={7}{U}{U}
type=Creature
subtype=Bringer
power=7
toughness=7
[/card]

Post Reply