It is currently 31 Oct 2025, 19:38
   
Text Size

Contrib. Coll.

Post MTG Forge Related Programming Questions Here

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

Re: Contrib. Coll.

Postby Hellfish » 23 Jul 2010, 10:44

Yes, the counterspells are still coming. :)

The thing is, I was thinking about condensing the counterspells (except for the "Unless it's controller pays X" ones, and Thwart and Force of Will because they have a different structure) into a single else if-block of CardFactory. Yay or Nay?

The new condensed block will be pretty slick, and it's easy to see what code belongs to what card in it and it avoids some code duplication that exists when each counterspell has it's own block.

As for progress, I'm currently in the process of testing the usage of the cards both with the AI playing it and me. :) New list of included cards:
Annul
Artifact Blast
Avoid Fate
Confound
Countersquall
Dismal Failure
Dispel
Dream Fracture
Envelop
Extinguish
Fervent Denial
Flash Counter
Flashfreeze
Frazzle
Gainsay
Guttural Response
Hisoka's Defiance
Illumination
Intervene
Lapse of Certainty
Liquify
Mystic Denial
Memory Lapse
Negate
Rebuff the Wicked
Remand
Thoughtbind
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: Contrib. Coll.

Postby Rob Cashwalker » 23 Jul 2010, 14:50

You should be able to work out a simple Counterspell keyword.
Something like:
spCounterTgtSpell:{type/restrictions}:{Unless$Action}:{Drawback$Action}
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: Contrib. Coll.

Postby Hellfish » 23 Jul 2010, 17:09

Actually, I had semifunctioning code for a Counter-keyword but I dropped that because well... it was a massive mess. From a beginner's standpoint it was probably more intimidating than Whenever.. I'll look into something different there.
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: Contrib. Coll.

Postby Hellfish » 12 Aug 2010, 17:51

*sigh*

So apparently I somehow mangled my local source copy and lost my counterspell code.
[Ten solid minutes of headdesking]
It's probably for the best anyway, more incentive to do it again and do it right as a keyword.
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: Contrib. Coll.

Postby Hellfish » 14 Aug 2010, 11:16

So yeah, I knuckled down and actually keyworded counterspells. Thanks, Rob, for urging me on there.
It's not all-encompassing, but it can probably be extended in the future for the few things that it lacks, such as "Unless" clauses. The format is
Code: Select all
spCounter:<TargetType>:<TargetingRestrictions>:<Destination>:<ExtraActions>
where <TargetType> is "Spell","Ability" or "SpellOrAbility".
<TargetingRestrictions> is a list of spaceseparated functioncall-lookalikes. They consist of an identifier ("Type","Targets","CMC" or "Color") followed by a comma-separated list of parameters enclosed by parentheses."Type" restricts the type of the spell you're trying to counter. "Targets", of course, restricts what the spell you're trying to counter must target. "CMC" restricts the converted manacost of the spell you're trying to counter (less than, less than or equal, equal, not equal, greater than or equal or greater than a value) and "Color" restricts the color of the spell you're trying to counter.

"Type" parameters can be prefixed with "Non-" to specify all types but the parameter.
"Targets" parameters can be prefixed with "My-" and "Opp-" to specify who must control the target and they can both be combined with "Non-" (for example "My-Non-Goblin" to specify Non-Goblin permanents you own)"My","Opp" and "CC" can also be on their own (without the hyphen and anything else) to specify that the spell should target that player.

"CMC" takes exactly two parameters, mode and value. Mode can be "<","<=","==","!=",">",">=". Value is any integer.
"Color" parameters can also be prefixed with "Non-"

<Destination> can be "Graveyard","Exile","Hand","Topdeck","Bottomdeck" or "Shuffle" and specifies where the countered spell ends up.

<ExtraActions> are a spaceseparated list of "bonuses" that the counterspell gives. They can be "Draw","Discard","GainLife","LoseLife","RearrangeTopOfLibrary"(A'la Aven Fateshaper),"RevealHand". Rather self-explanatory. :wink: They must all be prefixed with either "My-","Opp-" or "CC-"(Countered's Controller) to specify who gets the "bonus". In the vein of the targeting restrictions, they take exactly one integer parameter each,except RevealHand which takes none.To specify an action as optional, add the "May-" prefix after the targetplayer prefix(See Vex example below.).

<TargetingRestrictions>,<Destination> and <ExtraActions> can be "None".

EXAMPLES AHOY!
Code: Select all
Name:Avoid Fate
ManaCost:G
Types:Instant
Text:Counter target instant or Aura spell that targets a permanent you control.
K:spCounter:Spell:Type(Instant,Aura) Targets(My-Creature,My-Enchantment,My-Artifact,My-Land,My-Equipment,My-Planeswalker):Graveyard:None
End

Name:Bind
ManaCost:1 G
Types:Instant
Text:Counter target activated ability. Draw a card.
K:spCounter:Ability:None:None:My-Draw(1)
End

Name:Liquify
ManaCost:2 U
Types:Instant
Text:Counter target spell with converted mana cost 3 or less. If that spell is countered this way, exile it instead of putting it into its owner's graveyard.
K:spCounter:Spell:CMC(<=,3):Exile:None
End

Name:Punish Ignorance
ManaCost:W U U B
Types:Instant
Text:Counter target spell. It's controller loses 3 life and you gain 3 life.
K:spCounter:Spell:None:Graveyard:CC-LoseLife(3) My-GainLife(3)
End

Name:Vex
ManaCost:2 U
Types:Instant
Text:Counter target spell. It's controller may draw a card.
K:spCounter:Spell:None:Graveyard:CC-May-Draw(1)
End
If there are no objections, I will go ahead and attempt a commit. :)

NINJA EDIT: Forgot to mention that the AI can use any of the keyworded counterspells without other alterations.

SAMURAI EDIT: Here are the cards it will enable to be used keyword only:
Absorb
Annul
Artifact Blast
Assert Authority
Avoid Fate
Bind
Cancel
Confound
Counterspell
Countersquall
Dismal Failure
Dismiss
Dispel
Dissipate
Dream Fracture
Envelop
Essence Scatter
Exclude
Extinguish
Faerie Trickery
False Summoning
Fervent Denial
Flash Counter
Flashfreeze
Frazzle
Gainsay
Guttural Response
Hisoka's Defiance
Intervene
Lapse of Certainty
Last Word
Liquify
Memory Lapse
Muddle the Mixture
Mystic Denial
Negate
Preemptive Strike
Punish Ignorance
Rebuff the Wicked
Remand
Remove Soul
Spell Snare
Squelch
Stifle
Thoughtbind
Traumatic Visions
Undermine
Voidslime

EDIT: Added description of the new extra actions and functionality of Targets(). There is now also support for Lay Bare,Hindering Light & Discombobulate.
Last edited by Hellfish on 05 Nov 2010, 10:28, edited 4 times in total.
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: Contrib. Coll.

Postby Rob Cashwalker » 14 Aug 2010, 12:37

Nice work. That's quite the list of cards.

The unless clause will be the most tricky, since the AI might have to respond to your Mana Leak by either paying mana or not.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: Contrib. Coll.

Postby Hellfish » 14 Aug 2010, 13:39

Um, so yeah, how does committing via Subclipse work, or should I even use subclipse for comitting? I get 405 Method Not Allowed when I try to commit, of course because I havn't told Subclipse any login credentials but I can't seem to find where I do that. Anybody lend a hand? ;)
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: Contrib. Coll.

Postby Chris H. » 14 Aug 2010, 13:51

Hellfish wrote:So yeah, I knuckled down and actually keyworded counterspells.
If there are no objections, I will go ahead and attempt a commit. :)
`
Thank you. =D>

Go ahead and try to make a commit. If you make a bad mistake we can just revert to a previous build and you can try again. :D We all were beginners at one point or another.
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: Contrib. Coll.

Postby Rob Cashwalker » 14 Aug 2010, 13:53

When you create the SVN project, it gives you the opportunity to add the credentials. If Dennis hasn't given your google account committer privileges, then send him a PM with your google account info.

When you commit in the SVN, it's best to only commit only the file(s) that you changed, don't right-click on the whole project. I prefer to only commit one file at a time.

Alternatively, if you're not confident with the SVN stuff, then just post all code you added or changed here, and Chris will take care of it.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: Contrib. Coll.

Postby Hellfish » 14 Aug 2010, 14:06

Dennis has added me as a contributor already.

Either I am part-bat or Subclipse doesn't give me an opportunity.. *sigh* Alright, I've got one more thing to test before I give in and post the changes.

EDIT: Alright, I got CollabNet's svn working. I 'll just use a batch file to run that in the future. And yes, it only commit's the files I've made changes to (I keep a separate working copy for experiments). First commit, woo!
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: Contrib. Coll.

Postby silly freak » 14 Aug 2010, 15:50

maybe you're using the http address instead of https?
___

where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
silly freak
DEVELOPER
 
Posts: 598
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 93 times
Been thanked: 25 times

Re: Contrib. Coll.

Postby Hellfish » 14 Aug 2010, 17:01

No, I tried that as well.But at least commandline svn works, so I'm good. :)
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: Contrib. Coll.

Postby Sloth » 16 Aug 2010, 13:04

I tested your Counterspells today and the countering worked fine, great work Hellfish!

I found some other issues though:

- the transmute ability of Muddle the Mixture and TypeCycling of Traumatic Visions were not available.

- When I counter my own spell with Dream Fracture the opponent still draws a card (instead of me drawing 2 cards). The same is true for Dismal Failure (with discarding).
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Contrib. Coll.

Postby Hellfish » 16 Aug 2010, 17:47

Thanks for testing them,Sloth! :)
I'll amend the bonus section a little, as I stupidly assumed one wouldn't counter one's own spells.. :oops:
Relocating the keyword handler in CardFactory will fix the other two issues.
EDIT: Done, see explanation post above.
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: Contrib. Coll.

Postby Hellfish » 18 Aug 2010, 06:24

Next up: attempts at Sutured Ghoul , Patriarch's Bidding and fixing flashback for the AI.
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

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 21 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 21 users online :: 0 registered, 0 hidden and 21 guests (based on users active over the past 10 minutes)
Most users ever online was 9298 on 10 Oct 2025, 12:54

Users browsing this forum: No registered users and 21 guests

Login Form