Conditions in AF
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
8 posts
• Page 1 of 1
Conditions in AF
by 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
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
by 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
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
by 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.
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
by slapshot5 » 15 Jun 2011, 14:44
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...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.
-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
by 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."
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.
-

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
by Sloth » 15 Jun 2011, 17:08
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.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."
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Conditions in AF
by slapshot5 » 15 Jun 2011, 17:39
I agree that consistency when related to any kind of condition is favorable.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.
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
by 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
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
8 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 25 guests