It is currently 09 Sep 2025, 17:29
   
Text Size

X costs?

Post MTG Forge Related Programming Questions Here

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

X costs?

Postby DennisBergkamp » 01 Mar 2010, 00:47

Multikicker seems to work alright... we could probably use the same code for X costs. What do you guys think?
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: X costs?

Postby Chris H. » 01 Mar 2010, 01:39

DennisBergkamp wrote:Multikicker seems to work alright...
`
I put together a test deck and it worked fine for the human. When I gave the same deck to the computer, well I guess that the AI part is still a work in progress. :)
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: X costs?

Postby DennisBergkamp » 01 Mar 2010, 01:54

Ahh oops, I messed this up after my second update on the SVN. It should be fixed though for the AI if you add a "push(sa);" right after the while (in MagicStack.java) :

Code: Select all
else //computer
               {
                   while(ComputerUtil.canPayCost(ability)) ComputerUtil.playNoStack(ability);
                   push(sa);
               }
Anyway, I've been playing around with X costs, tested using Prosperity and it seems to work alright (both for AI and player).
The thing I'm more concerned about though, is that with X cost we should probably be using those Mana classes, currently I'm not doing this at all...

Also, we should probably be combining this with the existing keywords (spDrawCards, spDamageTgt, etc.).
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: X costs?

Postby zerker2000 » 01 Mar 2010, 02:40

Combining should be easy: just use card.setSVar("X", n), and write x for the number.
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.


--Eladamri, the Seed of Freyalise
zerker2000
Programmer
 
Posts: 569
Joined: 09 May 2009, 21:40
Location: South Pasadena, CA
Has thanked: 0 time
Been thanked: 0 time

Re: X costs?

Postby DennisBergkamp » 01 Mar 2010, 04:07

Oh, that's good to know, I've added a separate int xManaCost, I guess I should just be using X.
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: X costs?

Postby DennisBergkamp » 01 Mar 2010, 04:53

I'll just commit what I have so far... will convert to using keywords later.
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: X costs?

Postby Mr.Chaos » 01 Mar 2010, 07:24

Call me crazy if you must, but I am happy to say I see a Hurricane on the horizon. :D =D>
As a matter of fact, I even predict a serious Blaze coming this way!
And that is just the tip of the iceberg. :mrgreen:
](*,) = coder at work, according to a coder.It does explain some of the bugs. :wink:
Mr.Chaos
Tester
 
Posts: 625
Joined: 06 Sep 2008, 08:15
Has thanked: 0 time
Been thanked: 0 time

Re: X costs?

Postby zerker2000 » 01 Mar 2010, 09:32

Eh? Iceberg? That shouldn't be hard at all actually; I do think that "Comes into play with counters" and "{cost}: add n TYPE counters" should be keyworded better though.
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.


--Eladamri, the Seed of Freyalise
zerker2000
Programmer
 
Posts: 569
Joined: 09 May 2009, 21:40
Location: South Pasadena, CA
Has thanked: 0 time
Been thanked: 0 time

Re: X costs?

Postby apthaven » 01 Mar 2010, 12:38

Definitely will LURK this thread more often for updates regarding this.

X costs are going to make Forge even more awesome than it already is :wink:
"I am a man and real men do not consume pink beverages. Get thee gone woman, and bring me something brown." - Jace Wayland
apthaven
Tester
 
Posts: 242
Joined: 20 Jun 2009, 12:34
Has thanked: 0 time
Been thanked: 1 time

Re: X costs?

Postby Huggybaby » 01 Mar 2010, 12:50

As a red/green player I'm really looking forward to this.
User avatar
Huggybaby
Administrator
 
Posts: 3228
Joined: 15 Jan 2006, 19:44
Location: Finally out of Atlanta
Has thanked: 753 times
Been thanked: 601 times

Re: X costs?

Postby juzamjedi » 01 Mar 2010, 16:36

I would be pretty thrilled to see a Fireball in my booster drafts. R/U draft decks are overpowered why not make them stronger :)
juzamjedi
Tester
 
Posts: 575
Joined: 13 Nov 2008, 08:35
Has thanked: 6 times
Been thanked: 8 times

Re: X costs?

Postby DennisBergkamp » 01 Mar 2010, 18:21

Well, I sort of got this stuff working through some hacks. I don't think it's possible to use SVar directly, since I have to use some form of recursion (each time the X is increased by 1, when a mana source is used). So I still store the amount of X that's paid in a separate variable xManaCostPaid in Card.java.

The trickiest part is the AI, since determining the value of X is difficult... I currently just base it on ComputerUtil.getAvailableMana() - convertedManaCost of the card.
Then resolving is different again, since it needs to base the value of X on how much it actually paid (card.getXManaCostPaid()).

Anyway, at least what works so far is that Blaze can be coded like this:

Code: Select all
Blaze
X R
Sorcery
no text
spDamageTgtCP:X:Blaze deals X damage to target creature or player.
SVar:X:Count$xPaid
What doesn't work (yet) :

- spDamageTgtCP:X will still need a following description, since X in "deals X damage" can only be an int.
- No matter what the AI will target, it will attempt to spend a max amount of mana on X... if I play a Savannah Lions, the AI will hit it with a Blaze of 6 damage if it has 7 mana available. This will be tricky to get working correctly...
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: X costs?

Postby Rob Cashwalker » 01 Mar 2010, 18:55

Don't worry about the description. I think it's just fine to use "X" in the description without exact numbers.

Did you have to hack the AI of spDamageTgt to know how much X would be before selecting a target? Or is the X chosen before the canPlayAI is called?
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: X costs?

Postby DennisBergkamp » 01 Mar 2010, 19:59

I hacked xCount so it will return X used in getNumDamage in spDamageTgt for canPlayAI().
Then I added a getNumXDamage to spDamageTgt which is used by resolve() (and is based on how much was actually paid).

There might be a smarter way of doing this... but in either case, the way of obtaining X for the canPlayAI() and the resolve() are going to be different.
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: X costs?

Postby Chris H. » 01 Mar 2010, 20:07

Adding the "push(sa);" did the trick. It was fun watching the computer use Multikicker. :)

I noticed something UI related and I am not an expert in this area.

While casting a Gnarlid Pack the Cancel button is the only active button and we can cancel the casting before the full mana cost of "1 G" is paid. Great.

Once the full mana cost is paid, MagicStack.java prompts us for the extra kicker mana cost. The cancel button remains the only active button. Would it be better and possible to switch over to the OK button being the only active button at this point?

I am not sure that the result would be worth the effort. It is just one of the things to consider as we implement X costs, particularly as it relates to something like Multikicker.
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

Next

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 63 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 63 users online :: 0 registered, 0 hidden and 63 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 63 guests

Login Form