It is currently 25 Apr 2024, 08:30
   
Text Size

set PT as a CDA and cards with */*

Post MTG Forge Related Programming Questions Here

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

set PT as a CDA and cards with */*

Postby slapshot5 » 04 Dec 2010, 14:36

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
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

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

Postby Chris H. » 04 Dec 2010, 15:34

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.
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: set PT as a CDA and cards with */*

Postby Sloth » 05 Dec 2010, 21:10

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).
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

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

Postby slapshot5 » 06 Dec 2010, 01:25

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
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

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

Postby slapshot5 » 06 Dec 2010, 02:12

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
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

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

Postby friarsol » 07 Dec 2010, 04:25

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?
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

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

Postby MageKing17 » 07 Dec 2010, 08:25

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)).
User avatar
MageKing17
Programmer
 
Posts: 473
Joined: 12 Jun 2008, 20:40
Has thanked: 5 times
Been thanked: 9 times

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

Postby slapshot5 » 12 Dec 2010, 04:02

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
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

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

Postby slapshot5 » 12 Dec 2010, 04:04

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
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

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

Postby Sloth » 12 Dec 2010, 09:20

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
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

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

Postby Sloth » 12 Dec 2010, 11:12

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?
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

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

Postby slapshot5 » 12 Dec 2010, 13:08

I think it's in ComputerUtil.playCards()
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

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

Postby Rob Cashwalker » 15 Dec 2010, 21:34

. Sutured Ghoul only prompted once to select a creature to exile, then didn't stay in play long enough to matter.
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


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 68 guests


Who is online

In total there are 68 users online :: 0 registered, 0 hidden and 68 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 68 guests

Login Form