[CODE] Counter Improvements (Now Included in SVN)

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

Re: Counter Improvements

Postby salmelo » Wed Mar 24, 2010 2:06 am

Here is another patch, this time adding counters to target specifications, so now you should be able to target things with counters on them as well as use counters for criterion for Lord, aslongas, foreach, etc.

I had to muddle the syntax a little bit though, so heres an example, taken from gwafa hazid, whom I added to the primitives to test with.

lord(creature[counter{0/0.1.Bribe}]|opponentbattlefield) cantattack

obviously the part we are worried about is the counter part, note that those are curly braces { } and periods . instead of parentheses ( ) and commas , this is so that it does not conflict with how targets are normally parsed, which it did before I changed those. Counters still work the same way everywhere else though, you only need to use { } and periods in target code.

Also, you can use counter{any} to specify that it should look for things with any kind of counter on them, not just specific ones, this is used by Kulrath Knight, for example.

I also consolidated most of the code used to parse counter specifications, as it seemed unnecessary duplicating it three times.

Anyway, aside from this major addition, I also added Gwafa Hazid, Profiteer; and Kulrath Knight to the primitives, as well as a test file for each to make sure it worked.

Hopefully y'all will find this patch useful.

Oh, and I should point out that it only works with one Counter in the target specification, i imagine if you put two in the same one then it would either overwrite the first with the second or merge them into some sort of hybrid counter monstrosity, either way, I wouldn't suggest it. :)

EDIT: attachment removed in favor of updated version a few posts down.
Last edited by salmelo on Wed Mar 24, 2010 3:53 pm, edited 1 time in total.
salmelo
 
Posts: 47
Joined: Thu Mar 11, 2010 4:11 pm

Re: Counter Improvements

Postby Dr.Solomat » Wed Mar 24, 2010 1:18 pm

1. Can anyone add this to the svn plz??

2. Can the counter number be 0? This would be interesting for cards with "Fading","Vanishing",etc....

Is this card now possible??

Image


codeline would be:

auto=@each my firstmain:foreach(counter{0/0.Charge}) add{B}

Will this work??
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: Counter Improvements

Postby salmelo » Wed Mar 24, 2010 2:26 pm

well, I can't actually see the picture of the card right now as wherever its hosted is blocked by my current locations webserver, but from the code line I'm guessing you want it to add B to mana pool for each charge counter on the card?

If so, then no, that is not currently possible, the same goes for vanishing and fading, if I remember them correctly.

This is because there is still no way to say "for every counter on this card". what foreach(creature[counter{0/0.1.Charge}]) would do is happen once for every creature in play that had at least one charge counter on it.

I will be working on something like what you were thinking of as my next priority, i think.
salmelo
 
Posts: 47
Joined: Thu Mar 11, 2010 4:11 pm

Re: Counter Improvements

Postby Dr.Solomat » Wed Mar 24, 2010 2:35 pm

vanishing code lines would be like:

[card]
name=Aven Riftwatcher
abilities=flying
auto=counter(0/0,3,Time)
auto=life:2
auto=@movedTo(this|exile,graveyard,hand,library) from(myBattlefield):life:2
auto=@each my upkeep:counter(0/0,-1,Time)
auto=lord(aven riftwatcher[counter{0/0.0.Time}]|myBattlefield) -99/-99
text=Flying -- Vanishing 3 (This permanent enters the battlefield with three time counters on it. At the beginning of your upkeep, remove a time counter from it. When the last is removed, sacrifice it.) -- When Aven Riftwatcher enters the battlefield or leaves the battlefield, you gain 2 life.
mana={2}{W}
type=Creature
subtype=Bird rebel Soldier
power=2
toughness=3
[/card]
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: Counter Improvements

Postby salmelo » Wed Mar 24, 2010 2:57 pm

ah, that way might work.

i would do it this way:
auto=lord(aven riftwatcher[-counter{0/0.1.Time}]|myBattlefield) -99/-99

this is because it normally checks if the card has At Least that many counters, but with a minus sign it does Less Than that many counters, something I probably should have mentioned when i posted the patch... :oops:

so that line would kill it when the number of Time counters on it was < 1, essentially, when it hit 0.

Of course, the code is still flawed because it's technically supposed to be a sacrifice, but since I don't think we have things triggering off of sacrifices yet, thats not a big deal.
salmelo
 
Posts: 47
Joined: Thu Mar 11, 2010 4:11 pm

Re: Counter Improvements

Postby Dr.Solomat » Wed Mar 24, 2010 3:02 pm

salmelo wrote:
i would do it this way:
auto=lord(aven riftwatcher[-counter{0/0.1.Time}]|myBattlefield) -99/-99

this is because it normally checks if the card has At Least that many counters, but with a minus sign it does Less Than that many counters, something I probably should have mentioned when i posted the patch... :oops:

so that line would kill it when the number of Time counters on it was < 1, essentially, when it hit 0.


Are you sure this works? Did you test that? This would be great!


EDIT: The problem I see hear is that not with such an autoline even those Blastoderms get killed which don't have EXACTLY 1 fade counter on them, this means even those with 2 or more fade counters...
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: Counter Improvements

Postby salmelo » Wed Mar 24, 2010 3:31 pm

Dr.Solomat wrote:Are you sure this works? Did you test that? This would be great!


well, i just tested it and no, it does not work, but I think I know why, and I'm going to fix and upload an updated patch.
salmelo
 
Posts: 47
Joined: Thu Mar 11, 2010 4:11 pm

Re: Counter Improvements

Postby Dr.Solomat » Wed Mar 24, 2010 3:45 pm

You are the best, man!
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: Counter Improvements

Postby salmelo » Wed Mar 24, 2010 3:51 pm

Dr.Solomat wrote:You are the best, man!


Thanks :D

anyway, heres the updated patch, it also adds aven riftwatcher to the primitives and a couple testfiles that make sure vanishing works.
Attachments
lordCounters.zip
(16.91 KiB) Downloaded 36 times
salmelo
 
Posts: 47
Joined: Thu Mar 11, 2010 4:11 pm

Re: Counter Improvements

Postby Dr.Solomat » Wed Mar 24, 2010 3:54 pm

what is Aven Riftwatcher's code? Can you post it here?
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 0 guests