Page 1 of 1

set PT as a CDA and cards with */*

PostPosted: 04 Dec 2010, 14:36
by slapshot5
One of the projects I'd like to begin working on is consolidating and standardizing code and cards that set power/toughness as a Characteristic-Defining Ability.

This would be cards like Nightmare, People of the Woods, Angry Mob, Keldon Warlord, etc.

Also, I would like to update Forge to be able to display */* in the Deck Editor instead of the usual 1/1 that is arbitrarily assigned (in the card.txt). In all Zones within the game, the P/T displayed would be what it actually is since CDA's function everywhere.

The code would borrow a lot from the StaticEffect keyword code now, but be standardized with syntax similar to other things we use.

I was thinking of a keyword something along the line of stSetPT. If anyone thoughts on this part, please post.

If you have any thoughts in general about this, please post them here as well.

It sounds like we may be releasing a beta fairly soon, and I won't have this in before then. But hopefully for the beta after that.

If there are cards with unique twists on this that should be considered when coding, like Angry Mob and Gaea's Liege, please post here.

-slapshot5

Re: set PT as a CDA and cards with */*

PostPosted: 04 Dec 2010, 15:34
by Chris H.
I guess that several people tried several different approaches. At this point, consolidating and standardizing this type of code would be great.

I am considering releasing a new beta in about one week. I think that we want to give Sloth's blocking code a more thorough testing with a larger number of people. I have played several random decks and it worked but I and the computer did not have any of the creatures with special combat abilities in play.

Rob's sets with pics project may take a few betas to sort out the various issues. In a test deck I noticed that the recent new cards had the right pic in the editor but was using the none.jpg in game.

Re: set PT as a CDA and cards with */*

PostPosted: 05 Dec 2010, 21:10
by Sloth
slapshot5 wrote:I was thinking of a keyword something along the line of stSetPT. If anyone thoughts on this part, please post.
Sounds good slapshot5. Be sure it takes effect before stPump (see http://code.google.com/p/cardforge/issues/detail?id=81).

Re: set PT as a CDA and cards with */*

PostPosted: 06 Dec 2010, 01:25
by slapshot5
Sloth wrote:
Sounds good slapshot5. Be sure it takes effect before stPump (see http://code.google.com/p/cardforge/issues/detail?id=81).
Yep. I've got it. I haven't tested it with stPump, but I have it listed first in GameAction.java

Re: set PT as a CDA and cards with */*

PostPosted: 06 Dec 2010, 02:12
by slapshot5
I need a bit of help with one part of this:

The white card overlay text does not get updated for cards in hand. I imagine this is just cached, and never marked as dirty. The card P/T is set correctly in the card panel, so I know the card power/toughness is working in the hand.

Does anyone know what code I need to change to get the white overlay text updating in the player hand?

Thanks,
slapshot5

Re: set PT as a CDA and cards with */*

PostPosted: 07 Dec 2010, 04:25
by friarsol
I haven't worked in any of that code at all, and I believe the guy that had done most of that work hasn't been on the boards in a few months at least.

I think the function that does the overlay is arcane.ui.CardPanel.java setText() function? As it's the only one that cares about Loyalty counters.

Hopefully you can climb up the Call Hierarchy and see when it gets called, and why your changes might not be getting set properly?

Re: set PT as a CDA and cards with */*

PostPosted: 07 Dec 2010, 08:25
by MageKing17
I would just like to point out a potential rules snag to do with CDA-defined power and toughness: if * hasn't yet had its value defined, it's considered to be zero. This doesn't necessarily mean that the characteristic is 0; if it's written "7-*" as in Shapeshifter, the value when * is undefined is 7. As a result, Shapeshifter is a 0/7 when it hasn't had a value chosen (as is the case when it's not on the battlefield, or something's been turned into it with something (e.g. Cytoshape)).

Re: set PT as a CDA and cards with */*

PostPosted: 12 Dec 2010, 04:02
by slapshot5
The initial work for this has been submitted. The basics turned out to be easier than I thought.

The syntax:
Code: Select all
K:stSetPT:attack:defense:[alternateCondition:alternateAttack:alternateDefense:]Description
The alternate vars are all optional.

Attack/Defense can be a number or anything that CardFactoryUtil.xCount can handle. I thought about accepting "valid" things here and doing the counting behind the scenes, but xCount seemed more geared toward what this is doing.

I will be converting and adding more cards over the next few days. Please post here if you notice problems with this.

-slapshot5

Re: set PT as a CDA and cards with */*

PostPosted: 12 Dec 2010, 04:04
by slapshot5
Note: I was not able to get card overlays to update correctly when the card is in the hand. The actual stats are updated when the card is in the hand though.

If anyone knows how to have the card overlays update, please go for it, or let me know. As far as I can tell, the cards in hand need a new observer or something like that. I have no experience with GUI stuff.

-slapshot5

Re: set PT as a CDA and cards with */*

PostPosted: 12 Dec 2010, 09:20
by Sloth
slapshot5 wrote:Attack/Defense can be a number or anything that CardFactoryUtil.xCount can handle. I thought about accepting "valid" things here and doing the counting behind the scenes, but xCount seemed more geared toward what this is doing.
Actually xCount can redirect to isValid. Example:

Code: Select all
Count$Valid Beeble.nonToken+Other+YouDontCtrl+unequipped

Re: set PT as a CDA and cards with */*

PostPosted: 12 Dec 2010, 11:12
by Sloth
I just tested if the AI would cast a creature with zero toughness and it does (for example Uktabi Wildcats with only Moxen out). Do you have any idea where to check if the AI would play a permanent?

Re: set PT as a CDA and cards with */*

PostPosted: 12 Dec 2010, 13:08
by slapshot5
I think it's in ComputerUtil.playCards()

Re: set PT as a CDA and cards with */*

PostPosted: 15 Dec 2010, 21:34
by Rob Cashwalker
. Sutured Ghoul only prompted once to select a creature to exile, then didn't stay in play long enough to matter.