Card Development Questions
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: Card Development Questions
by friarsol » 18 Jul 2011, 01:58
For everyone writing scripts, I think it'd be better if you didn't try filling in the SetInfo script by hand (we have scripts that automate that). This way we don't have an issue where a card is incorrectly assigned to the wrong set, or worse a card that has some of it's sets but not all of them. The Scripts aren't smart enough to "recheck" Cards that only have partial SetInfo script. At some point I'll take some time to rewrite them using the mtgdata.txt file that we use in PerSetTracking, but until then it's probably best to just leave that completely off, and then when Chris (or anyone else) runs the script it will pick them up.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Card Development Questions
by beholder » 18 Jul 2011, 08:29
Thanks, but Mana Flare has too many problems imho. It uses the stack while it shouldn't (as it's a triggered mana ability) and the computer never uses the extra mana in its pool (does it even get into it's pool?).jeffwadsworth wrote:Beholder, I can add your card if you wish.
If debugging is the process of removing bugs, then programming must be the process of putting them in.
-
beholder - Programmer
- Posts: 123
- Joined: 17 Jul 2011, 17:56
- Location: Netherlands
- Has thanked: 16 times
- Been thanked: 25 times
Re: Card Development Questions
by jeffwadsworth » 18 Jul 2011, 22:24
Converted Isleback Spawn:
Code for Xcount in CardFactoryUtil.java
I know the int returned is correct, yet the static ability is not given. Any ideas?
- | Open
- Name:Isleback Spawn
ManaCost:5 U U
Types:Creature Kraken
Text:no text
PT:4/8
K:Shroud
S:Mode$ Continuous | Affected$ Card.Self | AddPower$ 4 | AddToughness$ 8 | CheckSVar$ X | SVarCompare$ LEY | Description$ CARDNAME gets +4/+8 as long as a library has twenty or fewer cards in it.
SVar:Y:Number$20
SVar:X:Count$LowestLibrary
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/isleback_spawn.jpg
SetInfo:SHM|Rare|http://magiccards.info/scans/en/shm/40.jpg
End
Code for Xcount in CardFactoryUtil.java
- | Open
- // Count$LowestLibrary
if (sq[0].contains("LowestLibrary")) {
return Math.min(AllZone.getHumanLibrary().size(),AllZone.getComputerLibrary().size());
}
I know the int returned is correct, yet the static ability is not given. Any ideas?
- jeffwadsworth
- Super Tester Elite
- Posts: 1172
- Joined: 20 Oct 2010, 04:47
- Location: USA
- Has thanked: 287 times
- Been thanked: 70 times
Re: Card Development Questions
by Sloth » 19 Jul 2011, 05:32
Fixed! Please try again Jeff.jeffwadsworth wrote:Converted Isleback Spawn:
- | Open
- Name:Isleback Spawn
ManaCost:5 U U
Types:Creature Kraken
Text:no text
PT:4/8
K:Shroud
S:Mode$ Continuous | Affected$ Card.Self | AddPower$ 4 | AddToughness$ 8 | CheckSVar$ X | SVarCompare$ LEY | Description$ CARDNAME gets +4/+8 as long as a library has twenty or fewer cards in it.
SVar:Y:Number$20
SVar:X:Count$LowestLibrary
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/isleback_spawn.jpg
SetInfo:SHM|Rare|http://magiccards.info/scans/en/shm/40.jpg
End
Code for Xcount in CardFactoryUtil.java
- | Open
- // Count$LowestLibrary
if (sq[0].contains("LowestLibrary")) {
return Math.min(AllZone.getHumanLibrary().size(),AllZone.getComputerLibrary().size());
}
I know the int returned is correct, yet the static ability is not given. Any ideas?
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Card Development Questions
by jeffwadsworth » 19 Jul 2011, 18:56
Thanks. It still doesn't work for me.Sloth wrote:Fixed! Please try again Jeff.jeffwadsworth wrote:Converted Isleback Spawn:
- | Open
- Name:Isleback Spawn
ManaCost:5 U U
Types:Creature Kraken
Text:no text
PT:4/8
K:Shroud
S:Mode$ Continuous | Affected$ Card.Self | AddPower$ 4 | AddToughness$ 8 | CheckSVar$ X | SVarCompare$ LEY | Description$ CARDNAME gets +4/+8 as long as a library has twenty or fewer cards in it.
SVar:Y:Number$20
SVar:X:Count$LowestLibrary
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/isleback_spawn.jpg
SetInfo:SHM|Rare|http://magiccards.info/scans/en/shm/40.jpg
End
Code for Xcount in CardFactoryUtil.java
- | Open
- // Count$LowestLibrary
if (sq[0].contains("LowestLibrary")) {
return Math.min(AllZone.getHumanLibrary().size(),AllZone.getComputerLibrary().size());
}
I know the int returned is correct, yet the static ability is not given. Any ideas?
- jeffwadsworth
- Super Tester Elite
- Posts: 1172
- Joined: 20 Oct 2010, 04:47
- Location: USA
- Has thanked: 287 times
- Been thanked: 70 times
Re: Card Development Questions
by jeffwadsworth » 19 Jul 2011, 22:08
Works perfectly.Sloth wrote:Arg. Submitted my next try. Sorry Jeff.jeffwadsworth wrote:Thanks. It still doesn't work for me.

- jeffwadsworth
- Super Tester Elite
- Posts: 1172
- Joined: 20 Oct 2010, 04:47
- Location: USA
- Has thanked: 287 times
- Been thanked: 70 times
Re: Card Development Questions
by jeffwadsworth » 20 Jul 2011, 22:09
Tidal Visionary:
On the battlefield:
Bad Moon
Crusade
2 Memnite
One of the Memnite's is targeted and made white. The Crusade gives both Memnite's +1/+1. Same with turning one black; both get the +1/+1 from the Bad Moon. Tested with a Serra Angel with same result.
- | Open
- Name:Tidal Visionary
ManaCost:U
Types:Creature Merfolk Wizard
Text:no text
PT:1/1
A:AB$ ChooseColor | Cost$ T | Defined$ You | SubAbility$ DBAnimate | SpellDescription$ Target creature becomes the color of your choice until end of turn.
SVar:DBAnimate:DB$Animate | ValidTgts$ Creature | TgtPrompt$ Select target creature | Colors$ ChosenColor | OverwriteColors$ True
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/tidal_visionary.jpg
End
On the battlefield:
Bad Moon
Crusade
2 Memnite
One of the Memnite's is targeted and made white. The Crusade gives both Memnite's +1/+1. Same with turning one black; both get the +1/+1 from the Bad Moon. Tested with a Serra Angel with same result.
- jeffwadsworth
- Super Tester Elite
- Posts: 1172
- Joined: 20 Oct 2010, 04:47
- Location: USA
- Has thanked: 287 times
- Been thanked: 70 times
Re: Card Development Questions
by iamed2 » 21 Jul 2011, 06:38
For my first card I decided to pick a doozy: Clone Shell. It actually requires a minor addition to the code in order to work (in AbilityFactory_Reveal.digResolve(...),
I have it located in somewhere (the wrong place as far as organization goes) right now, and it adds the imprinted card properly so it shows up as Imprinted when you hover over the creature. However, when I destroy it, the list of imprinted cards is now suddenly empty.
Here is my code for the card:
Thanks!
- Code: Select all
if (params.containsKey("Imprint"))
host.addImprinted(chosen);
I have it located in somewhere (the wrong place as far as organization goes) right now, and it adds the imprinted card properly so it shows up as Imprinted when you hover over the creature. However, when I destroy it, the list of imprinted cards is now suddenly empty.
Here is my code for the card:
- | Open
- Name:Clone Shell
ManaCost:5
Types:Artifact Creature Shapeshifter
Text:no text
PT:2/2
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigDig | TriggerDescription$ Imprint - When CARDNAME enters the battlefield, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library in any order.
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self | Execute$ TrigReturn | TriggerDescription$ When CARDNAME dies, turn the exiled card face up. If it's a creature card, put it onto the battlefield under your control.
SVar:TrigDig:DB$Dig | DigNum$ 4 | DestinationZone$ Exile | Imprint$ True | DestinationZone2$ Library
SVar:TrigReturn:DB$ChangeZone | Defined$ Imprinted | Origin$ Exile | Destination$ Battlefield
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/clone_shell.jpg
End
Thanks!
- iamed2
- Posts: 2
- Joined: 10 Jan 2011, 03:07
- Has thanked: 0 time
- Been thanked: 0 time
Re: Card Development Questions
by Sloth » 21 Jul 2011, 10:09
I've just tested Disciple of Kangee with 2 x Memnite and they both turn blue, but only the targeted gets flying.jeffwadsworth wrote:Tidal Visionary:
- | Open
- Name:Tidal Visionary
ManaCost:U
Types:Creature Merfolk Wizard
Text:no text
PT:1/1
A:AB$ ChooseColor | Cost$ T | Defined$ You | SubAbility$ DBAnimate | SpellDescription$ Target creature becomes the color of your choice until end of turn.
SVar:DBAnimate:DB$Animate | ValidTgts$ Creature | TgtPrompt$ Select target creature | Colors$ ChosenColor | OverwriteColors$ True
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/tidal_visionary.jpg
End
On the battlefield:
Bad Moon
Crusade
2 Memnite
One of the Memnite's is targeted and made white. The Crusade gives both Memnite's +1/+1. Same with turning one black; both get the +1/+1 from the Bad Moon. Tested with a Serra Angel with same result.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Card Development Questions
by jeffwadsworth » 21 Jul 2011, 14:35
I can tell you right off the bat that you can not exile cards face-down in script yet.iamed2 wrote:For my first card I decided to pick a doozy: Clone Shell. It actually requires a minor addition to the code in order to work (in AbilityFactory_Reveal.digResolve(...),needs to be added somewhere.
- Code: Select all
if (params.containsKey("Imprint"))
host.addImprinted(chosen);
I have it located in somewhere (the wrong place as far as organization goes) right now, and it adds the imprinted card properly so it shows up as Imprinted when you hover over the creature. However, when I destroy it, the list of imprinted cards is now suddenly empty.
Here is my code for the card:Can anyone provide some help? I would love to get this card completed, it is complicated but I believe it can be a good example of the versatility of the card scripting.
- | Open
- Name:Clone Shell
ManaCost:5
Types:Artifact Creature Shapeshifter
Text:no text
PT:2/2
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigDig | TriggerDescription$ Imprint - When CARDNAME enters the battlefield, look at the top four cards of your library, exile one face down, then put the rest on the bottom of your library in any order.
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self | Execute$ TrigReturn | TriggerDescription$ When CARDNAME dies, turn the exiled card face up. If it's a creature card, put it onto the battlefield under your control.
SVar:TrigDig:DB$Dig | DigNum$ 4 | DestinationZone$ Exile | Imprint$ True | DestinationZone2$ Library
SVar:TrigReturn:DB$ChangeZone | Defined$ Imprinted | Origin$ Exile | Destination$ Battlefield
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/clone_shell.jpg
End
Thanks!
- jeffwadsworth
- Super Tester Elite
- Posts: 1172
- Joined: 20 Oct 2010, 04:47
- Location: USA
- Has thanked: 287 times
- Been thanked: 70 times
Re: Card Development Questions
by iamed2 » 21 Jul 2011, 14:55
I am aware, but I figured it, like Necropotence, could be at least partially implemented.jeffwadsworth wrote:I can tell you right off the bat that you can not exile cards face-down in script yet.
Also, you say "yet". In the event that this is added, it would undoubtedly be a simple change.
- iamed2
- Posts: 2
- Joined: 10 Jan 2011, 03:07
- Has thanked: 0 time
- Been thanked: 0 time
Re: Card Development Questions
by jeffwadsworth » 21 Jul 2011, 16:51
Well, something like: ChangeZone | Cost$ 0 | Origin$ Library | Destination$ Exile | FaceDown$ Trueiamed2 wrote:I am aware, but I figured it, like Necropotence, could be at least partially implemented.jeffwadsworth wrote:I can tell you right off the bat that you can not exile cards face-down in script yet.
Also, you say "yet". In the event that this is added, it would undoubtedly be a simple change.
would be likely, but the Exile window would have to be updated to display "facedown card" or something.
- jeffwadsworth
- Super Tester Elite
- Posts: 1172
- Joined: 20 Oct 2010, 04:47
- Location: USA
- Has thanked: 287 times
- Been thanked: 70 times
Re: Card Development Questions
by slowe » 25 Jul 2011, 06:40
Pyromancer Ascension can be scripted
It feels a little too close to hard-coding, as it's pretty unlikely the condition will ever be used by another card ... is this frowned upon?
Regardless, testing it turned up a couple interesting bugs. If a game ends with a spell along with one or more copies of that spell on the stack, the original card will be dead in future games. This is a form of the bug where a card is unplayable and can't be discarded, etc. until Forge is restarted. Initially, I thought it was because there was an issue with cards incorrectly sharing card IDs, but I was just confused because copies don't have their stack description updated to include the right ID.
- Code: Select all
Name:Pyromancer Ascension
ManaCost:1 R
Types:Enchantment
Text:no text
T:Mode$ SpellCast | ValidControllingPlayer$ You | ValidCard$ Instant.inYourYard,Sorcery.inYourYard | TriggerZones$ Battlefield | OptionalDecider$ You | Execute$ TrigPutCounter | TriggerDescription$ Whenever you cast an instant or sorcery spell that has the same name as a card in your graveyard, you may put a quest counter on CARDNAME.
T:Mode$ SpellCast | ValidControllingPlayer$ You | ValidCard$ Instant,Sorcery | IsPresent$ Card.Self+countersGE2QUEST | OptionalDecider$ You | Execute$ TrigCopySpell | TriggerDescription$ Whenever you cast an instant or sorcery spell while CARDNAME has two or more quest counters on it, you may copy that spell. You may choose new targets for the copy.
SVar:TrigPutCounter:AB$PutCounter | Cost$ 0 | Defined$ Self | CounterType$ QUEST | CounterNum$ 1
SVar:TrigCopySpell:AB$CopySpell | Defined$ TriggeredSpellAbility | Cost$ 0 | OptionalDecider$ You
End
- Code: Select all
else if (Property.startsWith("inYourYard")) {
if (CardFactoryUtil.xCount(this, "NamedInYourYard.CARDNAME") < 1) return false;
}
It feels a little too close to hard-coding, as it's pretty unlikely the condition will ever be used by another card ... is this frowned upon?
Regardless, testing it turned up a couple interesting bugs. If a game ends with a spell along with one or more copies of that spell on the stack, the original card will be dead in future games. This is a form of the bug where a card is unplayable and can't be discarded, etc. until Forge is restarted. Initially, I thought it was because there was an issue with cards incorrectly sharing card IDs, but I was just confused because copies don't have their stack description updated to include the right ID.
Re: Card Development Questions
by slapshot5 » 26 Jul 2011, 01:42
Hi all,
I'm trying to add Crown of Empires, Throne of Empires and Scepter of Empires. I've got the counting down with additions to xCount and conditions with this stuff in SpellAbility_Conditions:
Does anyone have insight into this problem?
Thanks,
slapshot5
I'm trying to add Crown of Empires, Throne of Empires and Scepter of Empires. I've got the counting down with additions to xCount and conditions with this stuff in SpellAbility_Conditions:
- Code: Select all
if(allM12Empires) {
Player p = sa.getSourceCard().getController();
boolean has = AllZoneUtil.isCardInPlay("Crown of Empires", p);
has &= AllZoneUtil.isCardInPlay("Scepter of Empires", p);
has &= AllZoneUtil.isCardInPlay("Throne of Empires", p);
if(!has) return false;
}
if(notAllM12Empires) {
Player p = sa.getSourceCard().getController();
boolean has = AllZoneUtil.isCardInPlay("Crown of Empires", p);
has &= AllZoneUtil.isCardInPlay("Scepter of Empires", p);
has &= AllZoneUtil.isCardInPlay("Throne of Empires", p);
if(has) return false;
}
- Code: Select all
if(params.containsKey("ConditionAllM12Empires"))
setAllM12Empires(true);
if(params.containsKey("ConditionNotAllM12Empires"))
setNotAllM12Empires(true);
- Code: Select all
Name:Crown of Empires
ManaCost:2
Types:Artifact
Text:no text
A:AB$ Tap | Cost$ 3 T | ValidTgts$ Creature | TgtPrompt$ Select target creature | ConditionNotAllM12Empires$ True | SubAbility$ DBControl | SpellDescription$ Tap target creature. Gain control of that creature instead if you control artifacts named Scepter of Empires and Throne of Empires.
SVar:DBControl:DB$ GainControl | Defined$ Targeted | ConditionAllM12Empires$ True
SVar:RemAIDeck:True
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/crown_of_empires.jpg
End
Does anyone have insight into this problem?
Thanks,
slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Who is online
Users browsing this forum: Google Adsense [Bot] and 41 guests