[CODE] Counter Improvements (Now Included in SVN)

All additions requested or suggested to improve the card coding language.

Re: Named counters

Postby salmelo » Thu Mar 18, 2010 3:23 am

So, I sent the patches along to wololo (i think thats the same guy as wagic.the.homebrew on google) and he suggested I also post them here, so here they are.
Attachments
NamedCounters.zip
Counters with names, counters as a cost and simple text display of counters.
(9.03 KiB) Downloaded 37 times
salmelo
 
Posts: 47
Joined: Thu Mar 11, 2010 4:11 pm

Re: Named counters

Postby abrasax » Thu Mar 18, 2010 8:41 am

salmelo wrote:o, I sent the patches along to wololo (i think thats the same guy as wagic.the.homebrew on google)


We all have splitted personality :-D i'm wagic.laurent on the SVN by the way.

Thanks a lot for the patch.

So this mean we can now add a spore counter with the following code
auto={G}:counter(0/0,1,spore)

I suppose we always need to put the 0/0 in case of just a "named" counter ?

And we could code cards with i.e:

auto={0}:counter(0/0,-3,spore) && token(thallid,creature thallid,1/1,green)

Or something approching...

I cannot really test atm, I will try to test it during the WE.

This new functionnality will also be one way to approach "cummulative upkeep" coding, since the cummulative upkeep cost is depending on the number of "age" counter on a card...

maybe something like
upkeepcost=foreach(this[age]|myBattelfield) {G}

Could work in the future (at least I hope so...)

Grüssi

Abra
We need your Help !!!
New to wagic ? Be sure to check the following :

Bug report: Bug reporting
Help us: Add cards & Compiling.
Customize: Themes FAQ, All images thread, Abra's Mediafire folder
abrasax
 
Posts: 976
Joined: Wed Oct 15, 2008 7:46 am
Location: Switzerland

Re: Named counters

Postby baldersmashed » Thu Mar 18, 2010 6:29 pm

I am excited to see this finally come around! Great Job!!
Dr.Solomat wrote:"Vegeta! What does the scouter say about Wagics power level?"

"It's over ten thooooouuuuuusaaaaaaaaand!"

"What 10.000? There's no way that can be right!"
baldersmashed
 
Posts: 156
Joined: Sat Apr 25, 2009 12:00 am

Re: Named counters

Postby salmelo » Thu Mar 18, 2010 9:40 pm

abrasax wrote:
salmelo wrote:o, I sent the patches along to wololo (i think thats the same guy as wagic.the.homebrew on google)


We all have splitted personality :-D i'm wagic.laurent on the SVN by the way.

Thanks a lot for the patch.

So this mean we can now add a spore counter with the following code
auto={G}:counter(0/0,1,spore)

I suppose we always need to put the 0/0 in case of just a "named" counter ?


That is correct, currently the p/t is required, I may at some point go in and make it so counter(spore) works, but it is not high priority. So for now, if you want a non p/t counter you will have to specify 0/0.

abrasax wrote:And we could code cards with i.e:

auto={0}:counter(0/0,-3,spore) && token(thallid,creature thallid,1/1,green)

Or something approching...


something approaching ;). specifically it would be {C(0/0,3,spore)}. the number is how many to take off, and I honestly don't know what would happen if you put a negative there, I may eventually set negatives up so they put counters on, but thats not how it works now.

Actually, how you wrote it would work, except that the counter removal would then be an effect rather than a cost, so it would work even if you had no counters on the thallid, which would not be quite right. Also, thallids make saproling tokens, not thallid tokens, but that is besides the point. I ended up just putting a saproling token into the FEM _cards.dat file so that all the thallids could make the same exact token, mostly so that people who use pictures would need only one saproling pic, and not one saproling pic for each different thallid.

abrasax wrote:I cannot really test atm, I will try to test it during the WE.

This new functionnality will also be one way to approach "cummulative upkeep" coding, since the cummulative upkeep cost is depending on the number of "age" counter on a card...

maybe something like
upkeepcost=foreach(this[age]|myBattelfield) {G}

Could work in the future (at least I hope so...)

Grüssi

Abra


Getting counters referenced by foreach, aslongas, is actually my next goal.
salmelo
 
Posts: 47
Joined: Thu Mar 11, 2010 4:11 pm

Re: Named counters

Postby salmelo » Fri Mar 19, 2010 10:03 pm

well, I seem to have run into some problems while attempting to implement counter use in foreach, aslongas, lord, etc.

For some reason when I run the test suite it conks out with an error box
Code: Select all
template.exe has triggered a breakpoint
HEAP[template.exe]: Invalid Address specified to RtlValidateHeap( 00360000, 05C78BF8 )
Windows has triggered a breakpoint in template.exe.

This may be due to a corruption of the heap, which indicates a bug in template.exe or any of the DLLs it has loaded.

This may also be due to the user pressing F12 while template.exe has focus.

The output window may have more diagnostic information.


shortly after the debugger outputs that the civic wayfinder test was successful.
salmelo
 
Posts: 47
Joined: Thu Mar 11, 2010 4:11 pm

Re: Named counters

Postby wololo » Mon Mar 22, 2010 5:06 am

I added your patch to the SVN, with some minor modifications, and one major one:
auto={C(0/0,-3,Spore)}:Token(-1924)

note the "-3" instead of "3" in your code.
This means "remove 3 counters". I also updated the code so that a positive number means "add counters" although I haven't tested it.
Some costs involve "adding counters". Most of the time, these can usually be coded as an effect rather than a cost, but I think it's more natural this way.

Other than that, I fixed a memory leak. If you are using Visual Studio, it should give you warnings in the console debug about memory leaks detected, you can use that to see what objects you forgot to de-allocate. That one wasn't an easy one anyways so.

Overall great job, I'm hoping that the counters display will improve, as it is very basic right now, but I'm sure one of our coders/designers will have neat ideas for that :)

Thanks :)
wololo
Site Admin
 
Posts: 3712
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: Named counters

Postby Dr.Solomat » Mon Mar 22, 2010 10:38 am

If you code the counter removal as part of the activation cost gamers shouldn't be able anymore to activate the ability infinite times.

Did anyone test that?
Sets Coded/Released: Legends, Visions, Weatherlight, Tempest, Stronghold, Portal I & III, Urza's Saga BLOCK, Mercadian Masques, Invasion BLOCK, Mirrodin, Ravnica, Guildpact, Conflux, Alara Reborn
Dr.Solomat
 
Posts: 975
Joined: Mon Dec 15, 2008 5:12 pm
Location: Germany

Re: Named counters

Postby salmelo » Mon Mar 22, 2010 2:40 pm

Dr.Solomat wrote:If you code the counter removal as part of the activation cost gamers shouldn't be able anymore to activate the ability infinite times.

Did anyone test that?


Yes, in fact I made sure to include that in the test file. ;)
salmelo
 
Posts: 47
Joined: Thu Mar 11, 2010 4:11 pm

Re: Named counters

Postby salmelo » Mon Mar 22, 2010 2:48 pm

wololo wrote:I added your patch to the SVN, with some minor modifications, and one major one:
auto={C(0/0,-3,Spore)}:Token(-1924)

note the "-3" instead of "3" in your code.
This means "remove 3 counters". I also updated the code so that a positive number means "add counters" although I haven't tested it.
Some costs involve "adding counters". Most of the time, these can usually be coded as an effect rather than a cost, but I think it's more natural this way.

Other than that, I fixed a memory leak. If you are using Visual Studio, it should give you warnings in the console debug about memory leaks detected, you can use that to see what objects you forgot to de-allocate. That one wasn't an easy one anyways so.

Overall great job, I'm hoping that the counters display will improve, as it is very basic right now, but I'm sure one of our coders/designers will have neat ideas for that :)

Thanks :)


I had not noticed / remembered any cards that add counters as a cost, well, planeswalkers I suppose so it will be used for them eventually.

I'll have to watch out for memory leaks in the future, i had not noticed the debugger complaining.

Anyway, I'm glad it all worked out.
salmelo
 
Posts: 47
Joined: Thu Mar 11, 2010 4:11 pm

Re: Named counters

Postby Dr.Solomat » Mon Mar 22, 2010 4:50 pm

Okay,

I tested it. It works perfectly! Could add all Fungi to the svn! :)

Next will be Spikes!
Sets Coded/Released: Legends, Visions, Weatherlight, Tempest, Stronghold, Portal I & III, Urza's Saga BLOCK, Mercadian Masques, Invasion BLOCK, Mirrodin, Ravnica, Guildpact, Conflux, Alara Reborn
Dr.Solomat
 
Posts: 975
Joined: Mon Dec 15, 2008 5:12 pm
Location: Germany

Advertising

PreviousNext

Return to Card Coding & Parser

Who is online

Users browsing this forum: No registered users and 1 guest