It is currently 29 Oct 2025, 00:46
   
Text Size

Conditions in AF

Post MTG Forge Related Programming Questions Here

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

Conditions in AF

Postby friarsol » 21 May 2011, 15:10

Originally I was thinking Conditions would exist as a separate AbilityFactory, but as time has gone on I realized that doesn't make sense. It should exist as something similar to a Restriction. On Resolution, we check if the Condition is true, and if it is, resolve the ability as normal. Otherwise, try to run any SubAbilities.

So today I present to you the initial carnation of Condition. It is remarkably similar to IsPresent (with an added bonus we might want to provide for IsPresent).

I used Molten Rain as a Proof of Concept for AF$Damage, but it should be a simple C/P to get it functional for other AFs. You'll probably want to add a line in the StackDescription with the Conditional Text as I did for Damage.

At some point, we will want to the AI to consider the Conditions before playing cards. If the Condition is on the Parent Ability (like Pyroblast) then the Condition should be abided (otherwise it's just a wasted spell). If the Condition is on the SubAbility, it probably should reduce likelihood of playing, but not outright return false if it can't.

And here's some wiki page for it: http://www.slightlymagic.net/wiki/Forge_Condition
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Conditions in AF

Postby slapshot5 » 15 Jun 2011, 13:58

Hey Sol, I'm interested in expanding this, so we can have conditions like Threshold or "if you have more life than all opponents"

Have you thought at all about where this is heading?

Is there an advantage to having a SpellAbility_Conditions class? Maybe SpellAbility_Restrictions and SpellAbility_Conditions both extend a parent class since there is a fair amount of overlap?

Ideally, in my mind, defining conditions and restrictions in the card text file would be as similar as possible.

Threshold, Hellbent could be handled something like:

Condition$ Hellbent
Restriction$ Hellbent

instead of the current use of:

ActivatingCardsInHand$ 0

or perhaps everything related to restictions would use "Activating" since that's what most things use now.

There are several different things we could do syntactically, but I think making them as similar as possible with the "Activating" vs. "Condition" distinction would make things the simplest moving forward.

If anyone has thoughts/questions/comments/concerns, please post.

-slapshot5
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: Conditions in AF

Postby friarsol » 15 Jun 2011, 14:10

Makes sense. There is a lot of overlap between the two, and the simpler and more consistent we make the scripting language the better. Plus it looks like AbilityFactory class is now over 1200+ lines of codes, so anything we can pull out of there is probably for the best.

Feel free to take this over and run with it. I probably won't have much time to work on anything significant for a few weeks as things are getting busy at work, which is mostly why I was trying to get the targeting/triggered thing done this past weekend.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Conditions in AF

Postby slapshot5 » 15 Jun 2011, 14:44

friarsol wrote:Makes sense. There is a lot of overlap between the two, and the simpler and more consistent we make the scripting language the better. Plus it looks like AbilityFactory class is now over 1200+ lines of codes, so anything we can pull out of there is probably for the best.

Feel free to take this over and run with it. I probably won't have much time to work on anything significant for a few weeks as things are getting busy at work, which is mostly why I was trying to get the targeting/triggered thing done this past weekend.
Will do. I'm starting a new job on Monday, and this weekend I'm reffing a lacrosse tournament. So, I have today, tomorrow, and Friday before my contribution numbers start decreasing too...

-slapshot5
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: Conditions in AF

Postby Rob Cashwalker » 15 Jun 2011, 16:04

There are at least two categories of how conditions matter - (Hellbent as an example)

A condition may enable an ability like "Hellbent - play this ability only if you have no cards in hand." Which may be close enough for implementing "Hellbent - cardname gets +2/+2 as long as you have no cards in hand."

A condition modifies an ability like "Hellbent - if you have no cards in hand, ability does 4 damage instead."
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: Conditions in AF

Postby Sloth » 15 Jun 2011, 17:08

Rob Cashwalker wrote:There are at least two categories of how conditions matter - (Hellbent as an example)

A condition may enable an ability like "Hellbent - play this ability only if you have no cards in hand." Which may be close enough for implementing "Hellbent - cardname gets +2/+2 as long as you have no cards in hand."

A condition modifies an ability like "Hellbent - if you have no cards in hand, ability does 4 damage instead."
Now that Rob mentions static abilities, you should consider taking a look at specialConditionsMet in GameActionUtil, in case you want to streamline/use that too.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Conditions in AF

Postby slapshot5 » 15 Jun 2011, 17:39

Sloth wrote:Now that Rob mentions static abilities, you should consider taking a look at specialConditionsMet in GameActionUtil, in case you want to streamline/use that too.
I agree that consistency when related to any kind of condition is favorable.

However, this may be a Phase 4 project, and I'm still on Phase 1. There seems to just be too much difference between the st[Keyword] stuff and AbilityFactory to marry the two at this point.

-slapshot5
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: Conditions in AF

Postby slapshot5 » 15 Jun 2011, 19:22

Ok, I have a first pass checked in for this. Not much changed, it's largely as it was before with slight renamings for consistency. Wiki has been updated with the biggest of the changes.

-slapshot5
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 25 guests

Main Menu

User Menu

Our Partners


Who is online

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

Login Form