It is currently 15 Sep 2025, 20:03
   
Text Size

Card Contributions

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Re: Card Contributions

Postby Sloth » 29 May 2011, 20:10

jeffwadsworth wrote:Here is working script for Valakut the Molten Pinnacle.

Code: Select all
Name:Valakut, the Molten Pinnacle
ManaCost:no cost
Types:Land
Text:no text
K:CARDNAME enters the battlefield tapped.
T:Mode$ ChangesZone | ValidCard$ Mountain.YouCtrl | Origin$ Any | Destination$ Battlefield | Optional$ True | Execute$ TrigDamage | IsPresent$ Mountain.YouCtrl | PresentCompare$ GE6 | TriggerZones$ Battlefield | TriggerDescription$ Whenever a Mountain enters the battlefield under your control, if you control at least five other Mountains, you may have CARDNAME deal 3 damage to target creature or player.
SVar:TrigDamage:AB$DealDamage | Cost$ 0 | Tgt$ TgtCP | TgtPrompt$ Select target creature or player | NumDmg$ 3
A:AB$ Mana | Cost$ T | Produced$ R | SpellDescription$ Add R to your mana pool.
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/valakut_the_molten_pinnacle.jpg
SetInfo:ZEN|Rare|http://magiccards.info/scans/en/zen/228.jpg
End
I removed the relevant code from my base...but the removal process was akin to butchery in my opinion. If someone with a more expert grasp of java can weed through it I would feel better about the addition. Thanks.
I will do it and test your version (I was unsure if GE6 or GE5 would be correct).

EDIT: Does trigger just fine. Good work Jeff.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Card Contributions

Postby Starcrash » 01 Jun 2011, 17:28

I wanted to playtest some of my standard decks, but got frustrated when I couldn't find the cards I needed already on Forge. So I've been trying to learn python.

A totally, completely working and tested Dispatch
Name:Dispatch
ManaCost:W
Types:Instant
Text:no text
A:SP$ Tap | Cost$ W | ValidTgts$ Creature | TgtPrompt$ Select target creature | IsPresent$ Artifact.YouCtrl | PresentCompare$ LT3 | SpellDescription$ Tap target creature.
A:SP$ ChangeZone | Cost$ W | ValidTgts$ Creature | TgtPrompt$ Select target creature | IsPresent$ Artifact.YouCtrl | PresentCompare$ GE3 | CostDesc$ Metalcraft - | Origin$ Battlefield | Destination$ Exile | SpellDescription$ If you control three or more artifacts, exile that creature.
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/dispatch.jpg
SetInfo:NPH|Uncommon|http://magiccards.info/scans/en/nph/7.jpg
End
A less-than-working Glint Hawk... you have to bounce an untapped artifact, but if you don't have an artifact to bounce, it shrugs its shoulders and lets you keep the Glint Hawk anyway.
Name:Glint Hawk
ManaCost:W
Types:Creature Bird
PT:2/2
K:Flying
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigBounce | TriggerDescription$ When CARDNAME enters the battlefield, sacrifice it unless you return an untapped artifact you control to its owner's hand.
SVar:TrigBounce:AB$ ChangeZone | Cost$ 0 | ValidTgts$ Artifact.YouCtrl+untapped | ChangeNum$ 1 | Origin$ Battlefield | Destination$ Hand | Mandatory$ True | TgtPrompt$ Select target artifact
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/glint_hawk.jpg
SetInfo:SOM|Common|http://magiccards.info/scans/en/vi/10.jpg
End
I also manufactured a Gideon Jura that works very nicely except the first ability, which doesn't seem to work at all. Without a "provoke" model to look at, I have no idea how to do it.
Name:Gideon Jura
ManaCost:3 W W
Types:Planeswalker Gideon
Text:no text
Loyalty:6
A:AB$ PumpAll | Cost$ AddCounter<2/LOYALTY> | ValidCards$ Creature.YouDontCtrl | KW$ HIDDEN CARDNAME attacks each turn if able. | Planeswalker$ True | SpellDescription$ During target opponent's next turn, creatures that player controls attack Gideon Jura if able.
A:AB$ Destroy | Cost$ SubCounter<2/LOYALTY> | ValidTgts$ Creature.tapped | TgtPrompt$ Select target tapped creature | Planeswalker$ True | SpellDescription$ Destroy target tapped creature.
A:AB$ Animate | Cost$ AddCounter<0/LOYALTY> | Defined$ Self | Power$ 6 | Toughness$ 6 | Types$ Soldier,Human,Creature | Planeswalker$ True | SpellDescription$ Until end of turn, Gideon Jura becomes a 6/6 Human Soldier creature that's still a planeswalker. Prevent all damage that would be dealt to him this turn.
# Unable to configure him to prevent all damage to himself, or make the first ability work
SVar:Rarity:Mythic
SVar:Picture:http://www.wizards.com/global/images/magic/general/gideon_jura.jpg
SetInfo:ROE|Mythic|http://magiccards.info/scans/en/roe/21.jpg
End
If any of the programmers can point me to a list of Forge's modified Python code, I'd appreciate it. I've coded with Visual Basic and C/C++ before, so I think I could be a help with just a little more knowledge and experience with the programming language here.
Starcrash
 
Posts: 96
Joined: 30 May 2011, 18:39
Has thanked: 2 times
Been thanked: 1 time

Re: Card Contributions

Postby Chris H. » 01 Jun 2011, 17:55

Starcrash wrote:I wanted to playtest some of my standard decks, but got frustrated when I couldn't find the cards I needed already on Forge. So I've been trying to learn python.
If any of the programmers can point me to a list of Forge's modified Python code, I'd appreciate it. I've coded with Visual Basic and C/C++ before, so I think I could be a help with just a little more knowledge and experience with the programming language here.
`
Forge uses java rather than python. The java code reads in the text files found within the "cardsfolder" directory. The code parses the script found in these text files and uses this to build the actual card objects.

Scripting cards is fun and is a good way to get started in the project.

The source code can be found on the SVN. Most of the devs use Eclipse as a development system. There are several topics in this forum that contain enough info to get people started.

How to get started?

There is also a wiki page for forge and it contains some info.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Card Contributions

Postby friarsol » 01 Jun 2011, 18:30

Hey Starcrash,
Forge's scripting "language" isn't Python. We have lots of (but by no means complete) Documentation regarding it on the Wiki (http://www.slightlymagic.net/wiki/Forge_API).

Your Dispatch isn't 100% right since Dispatch cares about Metalcraft on resolution, not casting. It's not a major change, the Exile part of the spell needs to be a Drawback (of the Tap part) with a Condition.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Contributions

Postby Starcrash » 03 Jun 2011, 13:22

Your Dispatch isn't 100% right since Dispatch cares about Metalcraft on resolution, not casting. It's not a major change, the Exile part of the spell needs to be a Drawback (of the Tap part) with a Condition
Thank you for the feedback, guys. I hope these cards work a little better. They seem to work in my personal playtesting.

Name:Brass Herald
ManaCost:6
Types:Artifact Creature Golem
Text:As CARDNAME enters the battlefield, choose a creature type.
PT:2/2
T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Any | Destination$ Battlefield | Execute$ ChooseCT | TriggerDescription$ When CARDNAME enters the battlefield, reveal the top four cards of your library. Put all creature cards of the chosen type revealed this way into your hand and the rest on the bottom of your library in any order.
SVar:ChooseCT:AB$ ChooseType | Cost$ 0 | Defined$ You | Type$ Creature | SubAbility$ SVar=TrigDig
SVar:TrigDig:DB$ Dig | Cost$ 0 | DigNum$ 4 | Reveal$ True | ChangeNum$ All | ChangeValid$ Creature.ChosenType
K:stPumpAll:Creature.ChosenType:+1/+1:No Condition:Creatures of the chosen type get +1/+1.
SVar:RemRandomDeck:True
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/brass_herald.jpg
SetInfo:APC|Uncommon|http://magiccards.info/scans/en/ap/133.jpg
SetInfo:8ED|Rare|http://magiccards.info/scans/en/8e/293.jpg
End
Name:Urza's Incubator
ManaCost:3
Types:Artifact
Text:As CARDNAME enters the battlefield, choose a creature type.
T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Any | Destination$ Battlefield | Execute$ ChooseCT | TriggerDescription$ Creature spells of the chosen type cost 2 less to play.
SVar:ChooseCT:AB$ ChooseType | Cost$ 0 | Defined$ You | Type$ Creature
K:CostChange:All:Less:2:Spell:All:Creature:ChosenType
SVar:RemRandomDeck:True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/urzas_incubator.jpg
SetInfo:UDS|Rare|http://magiccards.info/scans/en/ud/142.jpg
End
Starcrash
 
Posts: 96
Joined: 30 May 2011, 18:39
Has thanked: 2 times
Been thanked: 1 time

Re: Card Contributions

Postby Starcrash » 03 Jun 2011, 17:15

It would be best if I knew how to program a Rebound effect into the game's code itself, but I don't... short of that I programmed a couple with a "Rebound-like" effect.

Name:Staggershock
ManaCost:2 R
Types:Instant
Text:no text
A:SP$ DealDamage | Cost$ 2 R | Tgt$ TgtCP | NumDmg$ 2 | SubAbility$ SVar=DBExile | SpellDescription$ CARDNAME deals 2 damage to target creature or player.
SVar:DBExile:DB$ ChangeZone | Origin$ Stack | Destination$ Exile
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | PresentZone$ Exile | IsPresent$ Card.Self | OptionalDecider$ You | Execute$ TrigRebound | TriggerDescription$ Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)
SVar:TrigRebound:SP$ DealDamage | Cost$ 0 | Tgt$ TgtCP | NumDmg$ 2 | SubAvility$ SVar = DBRebounded
SVar:DBRebounded:DB$ ChangeZone | Origin$ Stack | Destination$ Graveyard
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/staggershock.jpg
SetInfo:ROE|Common|http://magiccards.info/scans/en/roe/166.jpg
End
Name:Prey's Vengeance
ManaCost:G
Types:Instant
Text:no text
A:SP$ Pump | Cost$ G | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ +2 | NumDef$ +2 | SubAbility$ SVar=DBExile | SpellDescription$ Target creature gets +2/+2 until end of turn.
SVar:DBExile:DB$ ChangeZone | Origin$ Stack | Destination$ Exile
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | PresentZone$ Exile | IsPresent$ Card.Self | OptionalDecider$ You | Execute$ TrigRebound | TriggerDescription$ Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)
SVar:TrigRebound:SP$ Pump | Cost$ 0 | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ +2 | NumDef$ +2 | SubAbility$ SVar=DBRebounded
SVar:DBRebounded:DB$ ChangeZone | Origin$ Stack | Destination$ Graveyard
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/preys_Vengeance.jpg
SetInfo:ROE|Common|http://magiccards.info/scans/en/roe/205.jpg
End
One thing you may notice is that these rebound triggers don't just check the next upkeep... if you don't use them, it'll check every single one of your upkeeps to find out if you want to use it. Is there a Phase$ Upkeep.YourNext or something similar? I couldn't find one on the wiki or on other programmed cards. Short of that, they work like they should.
Starcrash
 
Posts: 96
Joined: 30 May 2011, 18:39
Has thanked: 2 times
Been thanked: 1 time

Re: Card Contributions

Postby Sloth » 03 Jun 2011, 17:48

@Starcrash: I've added your Brass Herald. Thanks a lot!

Urza's Incubator currently reduces all creatures costs (ChosenType does not work here).

The Rebound cards will trigger even if they are exiled by Castigate or something.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Card Contributions

Postby Starcrash » 04 Jun 2011, 14:34

A new one and an edited one...

Name:Diligent Farmhand
ManaCost:G
Types:Creature Druid
Text:If Diligent Farmhand is in the graveyard, Muscle Burst's effect counts it as a Muscle Burst.
PT:1/1
A:AB$ ChangeZone | Cost$ 1 G Sac<1/CARDNAME> | Origin$ Library | Destination$ Battlefield | Tapped$ True | ChangeType$ Land.Basic | ChangeNum$ 1 | SpellDescription$ Search your library for a basic land card and put it onto the battlefield tapped. Then shuffle your library.
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/diligent_farmhand.jpg
SetInfo:ODY|Common|http://magiccards.info/scans/en/od/237.jpg
End
Name:Muscle Burst
ManaCost:1 G
Types:Instant
Text:no text
A:SP$ Pump | Cost$ 1 G | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ +X | NumDef$ +X | SubAbility$ SVar=DBIncludeFarmhand | SpellDescription$ Target creature gets +X/+X until end of turn, where X is 3 plus the number of cards named Muscle Burst in all graveyards.
SVar:X:Count$NamedInAllYards.Muscle Burst/Plus.3
SVar:DBIncludeFarmhand:DB$ Pump | Cost$ 0 | Defined$ Targeted | NumAtt$ +Y | NumDef$ +Y
SVar:Y:Count$NamedInAllYards.Diligent Farmhand
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/muscle_burst.jpg
SetInfo:ODY|Common|http://magiccards.info/scans/en/od/252.jpg
End
Obviously, Diligent Farmhand was easy but held off due to Muscle Burst. While this isn't as elegant as it could be with more code available (If you have 1 Muscle Burst and 1 Diligent Farmhand, for instance, "target creature gets +4/+4" and "target creature gets +1/+1" in the same spell description) it is functional (the creature does get pumped +5/+5 all at once).
Starcrash
 
Posts: 96
Joined: 30 May 2011, 18:39
Has thanked: 2 times
Been thanked: 1 time

Re: Card Contributions

Postby Sloth » 04 Jun 2011, 14:55

Starcrash wrote:A new one and an edited one...

Obviously, Diligent Farmhand was easy but held off due to Muscle Burst. While this isn't as elegant as it could be with more code available (If you have 1 Muscle Burst and 1 Diligent Farmhand, for instance, "target creature gets +4/+4" and "target creature gets +1/+1" in the same spell description) it is functional (the creature does get pumped +5/+5 all at once).
The idea is quite good and works 100% accurate. To get a better stack description try using: SVar:X:Count$NamedInAllYards.Muscle Burst/Plus.Y
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Card Contributions

Postby friarsol » 04 Jun 2011, 15:17

I think Sloth means:

SVar:X:Count$NamedInAllYards.Muscle Burst/Plus.Y
SVar:Y:Count$NamedInAllYards.Diligent Farmhand/Plus.3
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Contributions

Postby Starcrash » 04 Jun 2011, 18:40

The obligatory (and better done) clones

Name:Pardic Firecat
ManaCost:3 R
Types:Creature Elemental Cat
Text:If Pardic Firecat is in a graveyard, effects from spells named Flame Burst count it as a card named Flame Burst.
PT:2/3
K:Haste
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/pardic_firecat.jpg
SetInfo:ODY|Common|http://magiccards.info/scans/en/od/211.jpg
End
Name:Flame Burst
ManaCost:1 R
Types:Instant
Text:no text
A:SP$ DealDamage | Cost$ 1 R | Tgt$ TgtCP | NumDmg$ X | SpellDescription$ CARDNAME deals X damage to target creature or player, where X is 2 plus the number of cards named CARDNAME in all graveyards.
SVar:X:Count$NamedInAllYards.Flame Burst/Plus.Y
SVar:Y:Count$NamedInAllYards.Pardic Firecat/Plus.2
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/flame_burst.jpg
SetInfo:ODY|Common|http://magiccards.info/scans/en/od/194.jpg
End
Appreciate the fix, guys. That looks as nice as it works.
Starcrash
 
Posts: 96
Joined: 30 May 2011, 18:39
Has thanked: 2 times
Been thanked: 1 time

Re: Card Contributions

Postby Sloth » 04 Jun 2011, 20:13

Starcrash wrote:Appreciate the fix, guys. That looks as nice as it works.
Added your contributions. Thanks Starcrash.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Card Contributions

Postby Starcrash » 05 Jun 2011, 15:24

Name:Pyroblast
ManaCost:R
Types:Instant
Text:Choose one -
A:SP$ Counter | Cost$ R | TargetType$ Spell | TgtPrompt$ Select target blue instant spell | ValidTgts$ Spell.Blue | SpellDescription$ Counter target spell if it's blue,
A:SP$ Destroy | Cost$ R | TargetType$ Permanent | TgtPrompt$ Select target blue permanent | ValidTgts$ Permanent.Blue | SpellDescription$ or destroy target permanent if it's blue.
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/pyroblast.jpg
SetInfo:5ED|Uncommon|http://magiccards.info/scans/en/5e/262.jpg
SetInfo:ICE|Common|http://magiccards.info/scans/en/ia/213.jpg
End
Starcrash
 
Posts: 96
Joined: 30 May 2011, 18:39
Has thanked: 2 times
Been thanked: 1 time

Re: Card Contributions

Postby friarsol » 05 Jun 2011, 15:50

Hey Starcrash, Pyroblast needs to be using the new Conditional AF coding because it is allowed to target any Spell/Permanent, but it only Counters/Destroys if it is Blue on Resolution. Feel free to check out how Dispatch got added for an example.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Contributions

Postby Sloth » 05 Jun 2011, 16:28

friarsol wrote:Hey Starcrash, Pyroblast needs to be using the new Conditional AF coding because it is allowed to target any Spell/Permanent, but it only Counters/Destroys if it is Blue on Resolution. Feel free to check out how Dispatch got added for an example.
Don't forget that conditions based on target won't work with AF Counter! Pyroblast is not possible at the moment.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 40 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 40 users online :: 0 registered, 0 hidden and 40 guests (based on users active over the past 10 minutes)
Most users ever online was 7967 on 09 Sep 2025, 23:08

Users browsing this forum: No registered users and 40 guests

Login Form