Card Development Questions
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: Card Development Questions
by jeffwadsworth » 31 Oct 2011, 21:45
Here is my attempted java code for getting the total number of colored creatures on the controllers battlefield. My java knowledge is next to NULL.
EDIT: The colors are lower-case...wow, that was a waste of time.
- | Open
- if (sq[0].contains("ColoredCreatures")) {
someCards.addAll(cardController.getCardsIn(Zone.Battlefield));
someCards = someCards.filter(CardListFilter.CREATURES);
final String[] colors = { "GREEN", "WHITE", "RED", "BLUE", "BLACK" };
for (int i = 0; i < colors.length; i++) {
if (!someCards.getColor(colors[i]).isEmpty()) {
n++;
}
}
return CardFactoryUtil.doXMath(n, m, c);
}
EDIT: The colors are lower-case...wow, that was a waste of time.
Last edited by jeffwadsworth on 01 Nov 2011, 04:44, edited 1 time in total.
- 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 slapshot5 » 31 Oct 2011, 22:29
Try this:
- Code: Select all
if (sq[0].contains("ColoredCreatures")) {
CardList list = cardController.getCardsIn(Zone.Battlefield);
list = list.filter(CardListFilter.CREATURES);
list = list.getColored();
return CardFactoryUtil.doXMath(list(), m, c);
}
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: Card Development Questions
by jeffwadsworth » 31 Oct 2011, 22:50
The code is supposed to work like the Domain code for land. This counts the creatures of the same color more than once. I will fool around with it. Thanks.slapshot5 wrote:Try this:-slapshot5
- Code: Select all
if (sq[0].contains("ColoredCreatures")) {
CardList list = cardController.getCardsIn(Zone.Battlefield);
list = list.filter(CardListFilter.CREATURES);
list = list.getColored();
return CardFactoryUtil.doXMath(list(), m, c);
}
- 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 » 01 Nov 2011, 04:17
Cheers.
Last edited by jeffwadsworth on 01 Nov 2011, 19:39, edited 1 time in total.
- 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 slapshot5 » 01 Nov 2011, 04:35
Oh. Have a look at Constant.Color.ONLY_COLORS and check capitalization when comparing colors. It is inconsistent at best, and it makes a difference.jeffwadsworth wrote:The code is supposed to work like the Domain code for land. This counts the creatures of the same color more than once. I will fool around with it. Thanks.slapshot5 wrote:Try this:-slapshot5
- Code: Select all
if (sq[0].contains("ColoredCreatures")) {
CardList list = cardController.getCardsIn(Zone.Battlefield);
list = list.filter(CardListFilter.CREATURES);
list = list.getColored();
return CardFactoryUtil.doXMath(list(), m, c);
}
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: Card Development Questions
by jeffwadsworth » 01 Nov 2011, 04:45
Yeah, it is lowercase for the colors. For some reason, I thought it was uppercase.slapshot5 wrote:Oh. Have a look at Constant.Color.ONLY_COLORS and check capitalization when comparing colors. It is inconsistent at best, and it makes a difference.jeffwadsworth wrote:The code is supposed to work like the Domain code for land. This counts the creatures of the same color more than once. I will fool around with it. Thanks.slapshot5 wrote:Try this:-slapshot5
- Code: Select all
if (sq[0].contains("ColoredCreatures")) {
CardList list = cardController.getCardsIn(Zone.Battlefield);
list = list.filter(CardListFilter.CREATURES);
list = list.getColored();
return CardFactoryUtil.doXMath(list(), m, c);
}
-slapshot5
- 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 » 01 Nov 2011, 05:09
- 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 Hellfish » 01 Nov 2011, 06:38
SVar for xCounting isn't used like that. Try this:
- Code: Select all
SVar:X:SVar$Y/Plus.Z
So now you're
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
-
Hellfish - Programmer
- Posts: 1297
- Joined: 07 Jun 2009, 10:41
- Location: South of the Pumphouse
- Has thanked: 110 times
- Been thanked: 169 times
Re: Card Development Questions
by moomarc » 01 Nov 2011, 10:30
Just finished Tombstone Stairwell
. Firstly, I realised why I thought we could cheat the token destruction if it leaves play by destroying all Tombspawn tokens. It's a World Enchantment so I don't think there could ever be more than one Tombstone Stairwell in play. But I stuck to non-hacked solution anyway.
Edit: @Jeff - I saw you sneaking Pure Reflection out from under my nose from my not-so-secret todo list
Just kidding. Thanks. I've uncommented it's token download link.


- Code: Select all
Name:Tombstone Stairwell
ManaCost:2 B B
Types:World Enchantment
Text:no text
K:Cumulative upkeep:1 B
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ Player | TriggerZones$ Battlefield | IsPresent$ Card.Self | Execute$ TrigTokenYou | TriggerDescription$ At the beginning of each upkeep, if CARDNAME is on the battlefield, each player puts a 2/2 black Zombie creature token with haste named Tombspawn onto the battlefield for each creature card in his or her graveyard.
SVar:TrigTokenYou:DB$Token | TokenAmount$ X | TokenName$ Tombspawn | TokenTypes$ Creature,Zombie | TokenOwner$ You | TokenColors$ Black | TokenPower$ 2 | TokenToughness$ 2 | TokenKeywords$ Haste | SubAbility$ TrigTokenOpp | RememberTokens$ True
SVar:TrigTokenOpp:DB$Token | TokenAmount$ Y | TokenName$ Tombspawn | TokenTypes$ Creature,Zombie | TokenOwner$ Opponent | TokenColors$ Black | TokenPower$ 2 | TokenToughness$ 2 | TokenKeywords$ Haste | RememberTokens$ True
SVar:X:Count$TypeInYourYard.Creature
SVar:Y:Count$TypeInOppYard.Creature
T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ Player | TriggerZones$ Battlefield | Execute$ DestroyRemembered | TriggerDescription$ At the beginning of each end step or when CARDNAME leaves the battlefield, destroy all tokens put onto the battlefield with CARDNAME. They can't be regenerated.
T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Battlefield | Destination$ Any | Execute$ DestroyRemembered | Secondary$ True | TriggerDescription$ At the beginning of each end step or when CARDNAME leaves the battlefield, destroy all tokens put onto the battlefield with CARDNAME. They can't be regenerated.
SVar:DestroyRemembered:DB$DestroyAll | Cost$ 0 | ValidCards$ Creature.IsRemembered | NoRegen$ True | SubAbility$ DBCleanUp
SVar:DBCleanUp:DB$Cleanup | ClearRemembered$ True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/tombstone_stairwell.jpg
SetInfo:MIR|Rare|http://magiccards.info/scans/en/mr/47.jpg
End
Edit: @Jeff - I saw you sneaking Pure Reflection out from under my nose from my not-so-secret todo list

Last edited by moomarc on 01 Nov 2011, 12:07, edited 2 times in total.
-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Card Development Questions
by Iran » 01 Nov 2011, 10:48
Any chance to have Splice onto Arcane in Forge?
Thanks
Thanks
Re: Card Development Questions
by moomarc » 01 Nov 2011, 12:37
Alrighty... on to Saproling Burst. The basic card is
Edit: I tried adding the following to try achieve the desired effect, but I've obviously missed something seeing as it's not working. Basically its a state based static trigger that animates all remembered saprolings with P/T=Current number of fade counters.
- Code: Select all
Name:Saproling Burst
ManaCost:4 G
Types:Enchantment
Text:no text
K:Fading:7
A:AB$ Token | Cost$ SubCounter<1/FADE> | TokenAmount$ 1 | TokenName$ Saproling | TokenTypes$ Creature,Saproling | TokenOwner$ You | TokenColors$ Green | TokenPower$ X | TokenToughness$ X | RememberTokens$ True | SpellDescription$ Put a green Saproling creature token onto the battlefield. It has "This creature's power and toughness are each equal to the number of fade counters on CARDNAME."
SVar:X:Count$CardCounters.FADE
T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Battlefield | Destination$ Any | Execute$ DestroyRemembered | TriggerDescription$ When CARDNAME leaves the battlefield, destroy all tokens put onto the battlefield with CARDNAME. They can't be regenerated.
SVar:DestroyRemembered:DB$DestroyAll | Cost$ 0 | ValidCards$ Creature.IsRemembered | NoRegen$ True | SubAbility$ DBCleanUp
SVar:DBCleanUp:DB$Cleanup | ClearRemembered$ True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/saproling_burst.jpg
End
Edit: I tried adding the following to try achieve the desired effect, but I've obviously missed something seeing as it's not working. Basically its a state based static trigger that animates all remembered saprolings with P/T=Current number of fade counters.
- Code: Select all
T:Mode$ Always | TriggerZones$ Battlefield | Static$ True
SVar:SpecialAnimate:AB$Animate | Cost$ 0 | ValidCard$ Creature.IsRemembered | Power$ Y | Toughness$ Y | Permanent$ True
SVar:Y:Count$CardCounters.FADE
-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Card Development Questions
by jeffwadsworth » 01 Nov 2011, 15:56
I stole it like a thief in the night. I just go down the list of cards on the Wiki page. That page was a secret to me until now...much like Sol's Myr Battlesphere cost fix.moomarc wrote:Edit: @Jeff - I saw you sneaking Pure Reflection out from under my nose from my not-so-secret todo listJust kidding. Thanks. I've uncommented it's token download link.
As for the Saproling Burst, I do not believe it can be scripted right now. The tokens would have to have a staticability that would check the SB for its fade counters, etc. What if you have two or more. I believe you would need a way to reference the SB in script.
Sloth, thanks for cleaning up my silly text mistake. Won't happen again.
- 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 Roujin » 01 Nov 2011, 22:44
Hi there,
I've just recently found this great program, played the quest mode a LOT the last few days
Now I wanted to test play a deck idea, but found that some of the cards I wanted to use are not yet implemented in Forge.
So I had a go at the card scripting API, and tried to implement Aphetto Dredging.
Unfortunately it does not work correctly.
Here's my current script:
The choosing of a creature type only happens when the spell resolves. This does not have any effect currently.
A rule explanation found here http://magiccards.info/pds/en/28.html says
The other cards I was missing for my deck areTrue Believer, Daru Spiritualist, Whipgrass Entangler, Test of Faith and Mindstorm Crown. Can anyone at a glance rule out any of these that are not currently possible to implement? (before I waste my time (again?)
)
PS: just browsed the trunk source code and found out true believer was implemented since the latest release (which I'm using)
I've just recently found this great program, played the quest mode a LOT the last few days

Now I wanted to test play a deck idea, but found that some of the cards I wanted to use are not yet implemented in Forge.
So I had a go at the card scripting API, and tried to implement Aphetto Dredging.
Unfortunately it does not work correctly.
Here's my current script:
- Code: Select all
Name:Aphetto Dredging
ManaCost:3 B
Types:Sorcery
Text:no text
A:SP$ ChooseType | Cost$ 3 B | Defined$ You | Type$ Creature | SubAbility$ SVar=DBReturn | SpellDescription$ Choose a creature type. Return up to three target creature cards from your graveyard to your hand.
SVar:DBReturn:DB$ ChangeZone | Cost$ 0 | TargetMin$ 0 | TargetMax$ 3 | TgtPrompt$ Choose up to three target creatures of chosen type in your graveyard | ValidTgts$ Creature.YouCtrl+ChosenType | Origin$ Graveyard | Destination$ Hand
SVar:Rarity:Common
End
The choosing of a creature type only happens when the spell resolves. This does not have any effect currently.
A rule explanation found here http://magiccards.info/pds/en/28.html says
Is there any way to do this currently in forge? Or have I wasted my time on a card that's currently impossible to implement due to technical restrictions?10/4/2004: You need to choose the creature type before choosing the targets.
The other cards I was missing for my deck are

PS: just browsed the trunk source code and found out true believer was implemented since the latest release (which I'm using)
Re: Card Development Questions
by jeffwadsworth » 02 Nov 2011, 01:38
Most of those cards are scriptable. Learning is rarely a waste of time.
- 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 friarsol » 02 Nov 2011, 02:23
Aphetto Dredging is a strange card. I don't think I've ever seen Targeting wording like that before, and I'm not sure any other card even has that language.
Mindstorm Crown and Daru Spiritualist should be fine. I don't think the other two can be done. Whipgrass Entangler is closer to being possible, but I don't think it quite works. Test of Faith has no way of knowing if it's ability was the ability that prevented the damage to give counters. (I refer to this as the Scars of the Veteran requirement)
Mindstorm Crown and Daru Spiritualist should be fine. I don't think the other two can be done. Whipgrass Entangler is closer to being possible, but I don't think it quite works. Test of Faith has no way of knowing if it's ability was the ability that prevented the damage to give counters. (I refer to this as the Scars of the Veteran requirement)
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Who is online
Users browsing this forum: No registered users and 21 guests