Card Development Questions
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: Card Development Questions
by jeffwadsworth » 09 Mar 2011, 01:51
Script for Archery Training. It does not like the SVar use of X.
- Code: Select all
Name:Archery Training
ManaCost:W
Types:Enchantment Aura
Text:no text
K:Enchant creature
K:enPump:0/0
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigPutCounter | OptionalDecider$ You | TriggerDescription$ At the beginning of your upkeep, you may put an arrow counter on CARDNAME.
SVar:TrigPutCounter:AB$PutCounter | Cost$ 0 | Defined$ Self | CounterType$ ARROW | CounterNum$ 1
K:stPumpEnchanted:Creature:0/0/SVar=Damage:No Condition:Enchanted creature has "tap: This creature deals X damage to target attacking or blocking creature, where X is the number of arrow counters on CARDNAME.
SVar:Damage:AB$DealDamage | Cost$ T | ValidTgts$ Creature.attacking,Creature.blocking | TgtPrompt$ Select target attacking or blocking creature | NumDmg$ X
SVar:X:Count$CardCounters.ARROW
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/archery_training.jpg
End
- Code: Select all
An error has occured. You can copy/paste this message or save it to a file.
Please report this, plus what you tried to do, to:
http://www.slightlymagic.net/forum/viewforum.php?f=26
If you don't want to register an account, you can mail it directly to
mtgerror@yahoo.com
For input string: "X"
Version:
Forge -- official beta: $Date: 2011-01-06 10:34:48 -0600 (Thu, 06 Jan 2011) $, SVN revision: $Revision: 4891 $
OS: Windows 7 Version: 6.1 Architecture: amd64
Java Version: 1.6.0_22 Vendor: Sun Microsystems Inc.
Detailed error trace:
java.lang.NumberFormatException: For input string: "X"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at forge.AbilityFactory.calculateAmount(AbilityFactory.java:771)
at forge.AbilityFactory_DealDamage.getNumDamage(AbilityFactory_DealDamage.java:147)
at forge.AbilityFactory_DealDamage.damageStackDescription(AbilityFactory_DealDamage.java:115)
at forge.AbilityFactory_DealDamage.access$2(AbilityFactory_DealDamage.java:111)
at forge.AbilityFactory_DealDamage$1.getStackDescription(AbilityFactory_DealDamage.java:37)
at forge.SpellAbility_Requirements.addAbilityToStack(SpellAbility_Requirements.java:110)
at forge.SpellAbility_Requirements.finishPaying(SpellAbility_Requirements.java:90)
at forge.Cost_Payment.payCost(Cost_Payment.java:396)
at forge.SpellAbility_Requirements.startPaying(SpellAbility_Requirements.java:78)
at forge.SpellAbility_Requirements.needPayment(SpellAbility_Requirements.java:71)
at forge.SpellAbility_Requirements.finishedTargeting(SpellAbility_Requirements.java:66)
at forge.Target_Selection.chooseTargets(Target_Selection.java:54)
at forge.Target_Selection$2.done(Target_Selection.java:191)
at forge.Target_Selection$2.selectCard(Target_Selection.java:175)
at forge.GuiInput.selectCard(GuiInput.java:47)
at forge.GuiDisplay4$10.mousePressed(GuiDisplay4.java:374)
at java.awt.AWTEventMulticaster.mousePressed(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
- 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 » 09 Mar 2011, 03:40
TriggeredCardController ?jeffwadsworth wrote:Here is a script for Pattern of Rebirth.Note that it needs some kind of Defined$ TriggeredController...but that does not work here. Is there anything that can be done about that?
- Code: Select all
Name:Pattern of Rebirth
ManaCost:3 G
Types:Enchantment Aura
Text:no text
K:Enchant creature
K:enPump:0/0
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.AttachedBy | Execute$ TrigSearch | TriggerDescription$ When enchanted creature is put into a graveyard, that creature's controller may search his or her library for a creature card and put that card onto the battlefield. If that player does, he or she shuffles his or her library.
SVar:TrigSearch:AB$ChangeZone | Cost$ 0 | ChangeType$ Creature | ChangeNum$ 1 | Hidden$ True | Origin$ Library | Destination$ Battlefield | Shuffle$ True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/pattern_of_rebirth.jpg
End
- 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 Chris H. » 09 Mar 2011, 04:07
`slapshot5 wrote:TriggeredCardController ?
There are currently 20 cards using "TriggeredCardController", so this should work.

-
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
- 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 » 09 Mar 2011, 08:22
Re: Archery Training
Not sure what to do about this one. the stPump gives the enchanted creature the damage ability, but not the X svar so it can't be found when you activate the ability. But even if you copy the X svar the damage will be 0 because the counters aren't on the enchanted creature.
The only way I can think to do this is hardcoding or a hack where we wait until we implement Defined sources for DealDamage AF (like "Target creature deals damage...") and let the aura have the ability and tap the enchanted creature in a subability or something.
Not sure what to do about this one. the stPump gives the enchanted creature the damage ability, but not the X svar so it can't be found when you activate the ability. But even if you copy the X svar the damage will be 0 because the counters aren't on the enchanted creature.
The only way I can think to do this is hardcoding or a hack where we wait until we implement Defined sources for DealDamage AF (like "Target creature deals damage...") and let the aura have the ability and tap the enchanted creature in a subability or something.
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 friarsol » 09 Mar 2011, 15:07
I think the right way to do this is to have calculateAmount "look" at the aura, just like it does in cases for Targeted. So it would be X:AttachedBy$CardCounters.ARROW but even with that in place, we still would need a way to narrow down which card we are counting from, which is a bit trickier.Hellfish wrote:Re: Archery Training
Not sure what to do about this one. the stPump gives the enchanted creature the damage ability, but not the X svar so it can't be found when you activate the ability. But even if you copy the X svar the damage will be 0 because the counters aren't on the enchanted creature.
The only way I can think to do this is hardcoding or a hack where we wait until we implement Defined sources for DealDamage AF (like "Target creature deals damage...") and let the aura have the ability and tap the enchanted creature in a subability or something.
Do we currently keep track of what card is granting the ability? If that's the case we could probably do a X:Granted$CardCounters.ARROW or something similar without much fuss.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Card Development Questions
by jeffwadsworth » 10 Mar 2011, 00:32
Here is some script for Put Away:
- Code: Select all
Name:Put Away
ManaCost:2 U U
Types:Instant
Text:no text
A:SP$ Counter | Cost$ 2 U U | Type$ Spell | Destination$ Graveyard | SubAbility$ SVar=DBChangeZone | SpellDescription$ Counter target spell. You may shuffle up to one target card from your graveyard into your library.
SVar:DBChangeZone:DB$ChangeZone | Origin$ Graveyard | Destination$ Library | ValidTgts$ Card.YouCtrl | TgtPrompt$ Select target card from your graveyard | Shuffle$ True | OptionalDecider$ You | TargetMin$ 0 | TargetMax$ 1
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/put_away.jpg
End
Last edited by jeffwadsworth on 10 Mar 2011, 01:43, 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 friarsol » 10 Mar 2011, 01:09
"Up to" in the card. Use a MinTargets$ 0 and MaxTargets$ 1
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Card Development Questions
by jeffwadsworth » 10 Mar 2011, 01:42
That is true, but if no card is targeted in your graveyard, the targeted spell does not get countered.friarsol wrote:"Up to" in the card. Use a MinTargets$ 0 and MaxTargets$ 1
- 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 » 10 Mar 2011, 01:55
Oh I didn't think you had them at all because they weren't grouped with the other targeting things.jeffwadsworth wrote:That is true, but if no card is targeted in your graveyard, the targeted spell does not get countered.friarsol wrote:"Up to" in the card. Use a MinTargets$ 0 and MaxTargets$ 1
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Card Development Questions
by Replika » 10 Mar 2011, 18:26
I had the same problem when trying to sricpt Conjurer's Bauble. If no target is chosen for the "up to" part, the whole thing doesn't do anything.
However, you could script Put Away as a modal spell and it would be functionally identical with the original card because you have to choose whether ot not you shuffle a card away when casting Put Away anyways.
However, you could script Put Away as a modal spell and it would be functionally identical with the original card because you have to choose whether ot not you shuffle a card away when casting Put Away anyways.
Re: Card Development Questions
by friarsol » 10 Mar 2011, 20:38
I'll take a look at the Put Away/Conjurer's Bauble issue probably tomorrow.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Card Development Questions
by jeffwadsworth » 10 Mar 2011, 21:17
I will believe that when I see a working sample...Replika wrote:I had the same problem when trying to sricpt Conjurer's Bauble. If no target is chosen for the "up to" part, the whole thing doesn't do anything.
However, you could script Put Away as a modal spell and it would be functionally identical with the original card because you have to choose whether ot not you shuffle a card away when casting Put Away anyways.

- 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 » 10 Mar 2011, 22:12
Here is a script for Repopulate.
- Code: Select all
Name:Repopulate
ManaCost:1 G
Types:Instant
Text:no text
K:Cycling:2
A:SP$ ChangeZoneAll | Cost$ 1 G | Origin$ Graveyard | Destination$ Library | ValidTgts$ Player | TgtPrompt$ Select target player | ChangeType$ Creature | Shuffle$ True | SpellDescription$ Shuffle all creature cards from target player's graveyard into that player's library.
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/repopulate.jpg
End
- 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 » 10 Mar 2011, 22:55
Repopulate looks like it's part of the http://code.google.com/p/cardforge/issues/detail?id=111 issue.
- 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 43 guests