It is currently 12 Jun 2025, 10:02
   
Text Size

Card Development Questions

Post MTG Forge Related Programming Questions Here

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

Re: Card Development Questions

Postby Zirbert » 02 Feb 2011, 01:46

Tragically, Giant Shark may be bugged beyond my ability to fix. Jeffwadsworth pointed out, on the Card Contribution thread, that it has some issues. I tested it some more, and found these specific problems:

-If I attack with multiple sharks and one is blocked by a creature that has taken damage, but the others are unblocked (I put Lure on one, then used Pyrohemia before blockers were declared), all the sharks get +2/+0 and trample, not just the blocked one.

-If I attack with only a shark with Lure, and it gets blocked by multiple creatures, only one of which took 1 point of damage earlier, the shark does not get a bonus.

-If I hit everything with Pyrohemia then attack with a shark with Lure, and the shark is blocked by multiple now-damaged creatures, the shark only gets a single +2/+0 bonus. The bonus should trigger once for each damaged blocking creature.

So, two issues that leave me in over my head: (1) The trigger should go off once for each blocking / blocked creature that took damage (the latter could matter, for instance if Blaze of Glory is played). It's only going off once. (2) If one attacking (or presumably blocking, although I didn't go that far in testing yet) shark gets the bonus, so does another, whether it deserves it or not. The trigger seems to be "if a damaged creature blocks", not "if a damaged creature blocks ME."

Am I missing a whole bunch of stuff, or am I running into limits of Forge's triggering system? I suspect the former.

Someone did indeed commit Giant Shark to the svn. Maybe it should come out unless / until it reaches 100% functionality.

And here I thought this would be a really simple card to code for practice. I really want to get some cards in, but it's a lot tougher than I expected. My hat is (even further) off to those of you who submit them by the dozen / hundred!

-Zirbert
Zirbert
 
Posts: 512
Joined: 13 Oct 2010, 16:04
Has thanked: 104 times
Been thanked: 19 times

Re: Card Development Questions

Postby friarsol » 02 Feb 2011, 02:10

Zirbert, I did post a bunch of cards that I think should be doable (which is fairly reliable, but there are times where I didn't read a card properly, or something I thought should work doesn't) if you want to test your card scripting skills on. I'm not sure how many of those are left.

If there's any particular set you prefer to try to work on I can go through the set and figure out which are possible.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Development Questions

Postby Zirbert » 02 Feb 2011, 02:42

friarsol wrote:Zirbert, I did post a bunch of cards that I think should be doable (which is fairly reliable, but there are times where I didn't read a card properly, or something I thought should work doesn't) if you want to test your card scripting skills on. I'm not sure how many of those are left.

If there's any particular set you prefer to try to work on I can go through the set and figure out which are possible.
That's OK, thanks - no need to go to any trouble. I'll check over your lists (although I think they've been largely snatched up by the prolific and competent). I've also just been watching cards as I play (real life) games, and browsing through my binders. It's surprising how many (relatively) simple ones are still out there! I've got a list of my own, and will keep looking. I'm partial to older, obscure stuff.

I posted Awakening to the contribution thread a minute ago - one of my favourites, and really simple with the triggers system. I pretty much just based it on Intruder Alarm, changed the trigger condition, and set the ValidCard$ parameter to include lands.

I'll tell you some cards that I've looked at, but hit stumbling blocks on (and what they were). Maybe you (or anyone else) can suggest solutions. I haven't actually tried coding most of these up yet:

Wall of Tombstones (don't see how to indefinitely reset toughness, as opposed to until EOT)

Gravebane Zombie (that bloody word "instead" at the end makes all the difference - last I checked, I don't think that variant was in AF)

Thawing Glaciers (triggering at End of Turn is easy, but Cleanup?)

Necromancer's Covenant (well, you know.... I'm still trying to figure a way to get that count done earlier)

Lat-Nam's Legacy (that "if you do" clause...)

Minion of Leshrac (I think all the similar feed me-or-bleed demons are hardcoded, so I don't have a template for the upkeep cost)

-Zirbert, Still In There Swinging
Last edited by Zirbert on 02 Feb 2011, 03:04, edited 1 time in total.
Zirbert
 
Posts: 512
Joined: 13 Oct 2010, 16:04
Has thanked: 104 times
Been thanked: 19 times

Re: Card Development Questions

Postby lazylockie » 02 Feb 2011, 02:52

Is it implemented a parameter for non-combat on DamageDone trigger?
lazylockie
 
Posts: 508
Joined: 13 Jul 2010, 22:44
Has thanked: 74 times
Been thanked: 15 times

Re: Card Development Questions

Postby friarsol » 02 Feb 2011, 03:10

It doesn't take that long. Maybe 15 minutes to run through a set. Plus I've done a few sets locally that I haven't even posted, for when I feel like just doing cards so it might be done already.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Development Questions

Postby Zirbert » 02 Feb 2011, 03:42

Are there trigger parameters for "whenever you play a land", or "whenever a player plays a land", etc.? The only cards I can find that use that trigger (like Horn of Greed or Fastbond) are hardcoded. Dirtcowl Wurm cheats on it a bit, using Mode$ ChangesZone, which is close but not functionally identical - for example, the Wurm would trigger twice on the opponent playing, then cracking, a Terramorphic Expanse.

If playing a land is a triggerable (Hey! New word!) action, it opens up a few interesting scriptable cards, notably Recycle / Null Profusion. I really don't want to use the Mode$ ChangesZone trigger, though, because of the distinction noted above.

-Zirbert
Zirbert
 
Posts: 512
Joined: 13 Oct 2010, 16:04
Has thanked: 104 times
Been thanked: 19 times

Re: Card Development Questions

Postby Hellfish » 02 Feb 2011, 08:53

lazylockie wrote:Is it implemented a parameter for non-combat on DamageDone trigger?
I just modified the DamageDone trigger mode so that you can set "CombatDamage$ False" to achieve this.
Zirbert wrote:Are there trigger parameters for "whenever you play a land", or "whenever a player plays a land", etc.? The only cards I can find that use that trigger (like Horn of Greed or Fastbond) are hardcoded. Dirtcowl Wurm cheats on it a bit, using Mode$ ChangesZone, which is close but not functionally identical - for example, the Wurm would trigger twice on the opponent playing, then cracking, a Terramorphic Expanse.

If playing a land is a triggerable (Hey! New word!) action, it opens up a few interesting scriptable cards, notably Recycle / Null Profusion. I really don't want to use the Mode$ ChangesZone trigger, though, because of the distinction noted above.

-Zirbert
I'll set up a "PlayedLand" trigger-mode ASAP.
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
User avatar
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

Postby Chris H. » 02 Feb 2011, 17:18

I commented out the code block for Briarhorn in CardFactory_Creatures. I then edited the Briarhorn card txt file and made it look like this:

Code: Select all
Name:Briarhorn
ManaCost:3 G
Types:Creature Elemental
Text:no text
PT:3/3
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigPump | TriggerDescription$ When CARDNAME enters the battlefield, target creature gets +3/+3 until end of turn.
K:Evoke:1 G
SVar:TrigPump:AB$Pump | Cost$ 0 | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ +3 | NumDef$ +3
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self+evoked | Execute$ TrigSac | Secondary$ True | TriggerDescription$ When CARDNAME enters the battlefield, if you cast it by it's evoke cost, sacrifice it.
SVar:TrigSac:AB$Sacrifice | Cost$ 0
SVar:PlayMain1:TRUE
K:Flash
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/briarhorn.jpg
SetInfo:LRW|Uncommon|http://magiccards.info/scans/en/lw/199.jpg
End
`
It works correctly for the human. The computer on the other hand. The AI will use the evoke ability and will target the same Briarhorn that it just evoked.
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 Development Questions

Postby friarsol » 02 Feb 2011, 17:23

Chris H. wrote:It works correctly for the human. The computer on the other hand. The AI will use the evoke ability and will target the same Briarhorn that it just evoked.
The pumping AI does need some other improvements. I'll see if I can add some stuff when I'm adding the hooks for triggers soon.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Development Questions

Postby jeffwadsworth » 03 Feb 2011, 01:29

Cheers.
Last edited by jeffwadsworth on 03 Feb 2011, 05: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

Postby Zirbert » 03 Feb 2011, 03:54

Am I correct that K:etbCounter must be a numeric value, not a calculated one? Here's what I was trying to do, for Zombie Mob - it didn't work:

Code: Select all
K:etbCounter:P1P1:X
SVar:X:Count$TypeInYourYard.Creature
I get this error upon starting Forge with the card containing this in my cardsfolder:

Code: Select all
For input string: "X"


Version:
Forge -- official beta: $Date: 2011-01-06 11:34:48 -0500 (Thu, 06 Jan 2011) $, SVN revision: $Revision: 4891 $

OS: Linux Version: 2.6.31-9-rt Architecture: amd64

Java Version: 1.6.0_18 Vendor: Sun Microsystems Inc.

Detailed error trace:
java.lang.NumberFormatException: For input string: "X"
   at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
   at java.lang.Integer.parseInt(Integer.java:481)
   at java.lang.Integer.parseInt(Integer.java:514)
   at forge.CardFactory.getCard2(CardFactory.java:4339)
   at forge.CardFactory.getCard(CardFactory.java:238)
   at forge.CardFactory.<init>(CardFactory.java:74)
   at forge.AllZone.<clinit>(AllZone.java:29)
   at forge.Gui_NewGame$2.run(Gui_NewGame.java:183)
   at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:226)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
Zirbert
 
Posts: 512
Joined: 13 Oct 2010, 16:04
Has thanked: 104 times
Been thanked: 19 times

Re: Card Development Questions

Postby friarsol » 03 Feb 2011, 17:59

Zirbert wrote:Am I correct that K:etbCounter must be a numeric value, not a calculated one? Here's what I was trying to do, for Zombie Mob - it didn't work:

Code: Select all
K:etbCounter:P1P1:X
SVar:X:Count$TypeInYourYard.Creature
Yea it's expecting an integer. You might be able to convince someone to add a section to call xCount on it. However this will probably mess up the generated value that's written on the card.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Development Questions

Postby jeffwadsworth » 03 Feb 2011, 18:01

Does anyone see any problems with this test card? The loselife portion does not work on the targeted player. I mistakenly posted this in the wrong thread.


Code: Select all
Name:Kalastria Highborn
ManaCost:B B
Types:Creature Vampire Shaman
Text:no text
PT:2/2
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self,Vampire.YouCtrl | Execute$ TrigLoseLife | TriggerZones$ Battlefield | Optional$ True | TriggerDescription$ Whenever CARDNAME or another Vampire you control is put into a graveyard from the battlefield, you may pay B.  If you do, target player loses 2 life and you gain 2 life.
SVar:TrigLoseLife:AB$LoseLife | ValidTgts$ Player | TgtPrompt$ Select target player | LifeAmount$ 2 | SubAbility$ DBGainLife
SVar:DBGainLife:DB$GainLife | Defined$ You | LifeAmount$ 2
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/Kalastria_Highborn.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

Postby Chris H. » 03 Feb 2011, 20:02

I am in the process of attempting to convert Meadowboon to script via Trigger. I have worked on this for far too long. :) I changed the Meadowboon txt file to look like this:

Code: Select all
Name:Meadowboon
ManaCost:2 W W
Types:Creature Elemental
Text:no text
PT:3/3
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Any | ValidCard$ Card.Self | Execute$ TrigPutCounterAll | TriggerDescription$ When CARDNAME leaves the battlefield, put a +1/+1 counter on each creature target player controls.
K:Evoke:3 W
SVar:TrigPutCounterAll:AB$PutCounterAll | Cost$ 0 | ValidTgts$ Player | TgtPrompt$ Select a player | ValidCards$ Creature.Other | CounterType$ P1P1 | CounterNum$ 1
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self+evoked | Execute$ TrigSac | Secondary$ True | TriggerDescription$ When CARDNAME leaves the battlefield, if you cast it by it's evoke cost, sacrifice it.
SVar:TrigSac:AB$Sacrifice | Cost$ 0
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/meadowboon.jpg
SetInfo:MOR|Uncommon|http://magiccards.info/scans/en/mt/17.jpg
End
`
I had some problems getting the Evoke to work at first. The card will now Evoke. Meadowboon uses a "leaves the battlefield" trigger which is different and the result is not as smooth as the "enters the battlefield" Evoke cards. But it works. :mrgreen:

I guess that the other "leaves the battlefield" Evoke cards could be added using this approach.

There is still a problem with this scripted version of Meadowboon. The ability states "When CARDNAME leaves the battlefield, put a +1/+1 counter on each creature target player controls.". I can ask the human to select a target player, but then I get stuck. How do I limit the ValidCards appropriately? I suspect that ValidCards may not yet be able to handle:

Code: Select all
Creature.Other+{TgtPlayerCtrl}
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 Development Questions

Postby friarsol » 03 Feb 2011, 21:34

jeffwadsworth wrote:Kalastria Highborn
Alright so I submitted a patch for this situation, but it needs to be tested with a lot more of the Triggers, because I don't know if getting rid of it will cause any issues.

The Highborn I was testing with looks like this:

Code: Select all
Name:Kalastria Highborn
ManaCost:B B
Types:Creature Vampire Shaman
Text:no text
PT:2/2
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self,Vampire.YouCtrl | Execute$ TrigLoseLife | TriggerZones$ Battlefield | Optional$ True | TriggerDescription$ Whenever CARDNAME or another Vampire you control is put into a graveyard from the battlefield, you may pay B.  If you do, target player loses 2 life and you gain 2 life.
SVar:TrigLoseLife:AB$LoseLife | Cost$ B | ValidTgts$ Player | TgtPrompt$ Select target player | LifeAmount$ 2 | SubAbility$ SVar=DBGainLife
SVar:DBGainLife:DB$GainLife | Defined$ You | LifeAmount$ 2
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/kalastria_highborn.jpg
End
Although that's not 100% right either, since it won't trigger when it goes to the graveyard (since it's in the Graveyard and not on the Battlefield). Not sure if Triggers can really handle the multiple things going to the graveyard at once. Hellfish might know more.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 26 guests


Who is online

In total there are 26 users online :: 0 registered, 0 hidden and 26 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 26 guests

Login Form