Card Requests
by mtgrares
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: Card Requests
by DennisBergkamp » 18 Jan 2010, 06:49
Hm, Doubling Season is tricky... but it should be doable once we put the token creation code into a single function, which is something I've been wanting to do anyway.
Another tricky thing to implement is cascade... I've got it working, sort of, but then I realized there are more difficulties:
1. the cascaded card is uncastable (Meddling Mage, ... )
2. the cascaded card has buyback abilities...
What else am I missing?
Another tricky thing to implement is cascade... I've got it working, sort of, but then I realized there are more difficulties:
1. the cascaded card is uncastable (Meddling Mage, ... )
2. the cascaded card has buyback abilities...
What else am I missing?
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Card Requests
by Marek14 » 18 Jan 2010, 09:05
Well, cascade would require more precise handling of spells and abilities. Currently, it can be a mess.DennisBergkamp wrote:Hm, Doubling Season is tricky... but it should be doable once we put the token creation code into a single function, which is something I've been wanting to do anyway.
Another tricky thing to implement is cascade... I've got it working, sort of, but then I realized there are more difficulties:
1. the cascaded card is uncastable (Meddling Mage, ... )
2. the cascaded card has buyback abilities...
What else am I missing?
According to rule 601, the precise sequence is like this:
1: You start casting the spell, and move the card (or card copy, in case of things like Isochron Scepter) on the stack. This might have immediate effects - for example if you are casting Reprisal and there is a creature whose power depends on the size of your hand (like Adamaro, First to Desire, or Guul Draz Specter), you don't count Reprisal anymore when choosing a target.
This step is the one where timing is important. Flash, "can be cast as though it had flash" and that weird ability on Mirage enchantments like Soar apply here. So do effects like Ethersworn Canonist and Rule of Law or internal casting limits like Reset. If a card has suspend, the condition for suspending it is that you must be able to do this step of casting it.
When you cast a spell as a part of an effect (which cascade does), only the normal timing restrictions are ignored, not things like Ethersworn Canonist.
2: You announce modes for the spell, if it has any. The currently existing modes are "one of two modes", "one of three modes" (Charms), "two of four modes" (Commands), "one or both of two modes" and "one of two modes with entwine".
Splice: If you wish to splice any cards on the spell, you reveal them.
If a spell has alternative costs, you choose whether or not to use them and which one you will use, if there are several. THIS is where cascade applies, as casting a spell without paying its mana cost is the same thing as casting it for alternative cost of 0. An alternative cost may be prescribed, like in case of cascade or flashback (then you can't use the normal cost or any other alternative cost), or it might be optional like Dream Halls.
Additional costs: Additional costs are just the things that are specifically said to be additional costs, not things that simply raise the cost of a spell. Things like kicker, entwine, buyback or convoke are all additional costs. For each additional cost you declare whether you want to pay it or not (and, in case of replicate, multikicker and a few things like Taste of Paradise, how many times you want to pay it).
If the spell has a variable cost that has to be determined now (the X symbol is the most common occurence, but it might also apply to things like determining X for AEther Burst), the player will choose a value (if possible - AEther Burst, for example, only has one possible value).
If the cost you are about to pay includes hybrid mana, you collapse its quantum wave function by selecting one possible way to replace all hybrid symbols by regular symbols. For Scuzzback Scrapper it's just two ways while for Reaper King it's 32 ways. (This collapsing is also done, for example, if hybrid mana would be added to your mana pool. This can happen with Elemental Resonance and few other cards.)
3: Now the targets are chosen. Basically, you might think of targeting as existing in block, where each block has you choose some number of distinct targets, but the same target might be chosen for multiple blocks. The most complex targeting probably occurs for heavily spliced spells.
Sometimes you are required to distribute something among the targets (damage, counters or damage prevention). In such case you distribute right after you select the targets.
Some targets might depend on some mode or additional cost. In that case you only get to choose them if their condition is fulfilled.
4: The total cost is computed. Apart from mana cost, this might include various other things.
You start by adding up the mana cost (or alternate cost that is used) and all additional costs you signed up to. Then you:
a) apply cost increasing effects like Sphere of Resistance or Fireball.
b) apply cost reducing effects. All existing cost reductors reduce mana costs. When reducing by a colored mana, there are two ways of dealing with excess colored mana: ignore it (Edgewalker) or use it to reduce the generic mana cost (the offering ability from Betrayers of Kamigawa). You might encounter optional cost reducing effects like Stone Calendar - I suggest to sum them up and apply them last to reduce the amount of choices.
c) apply Trinisphere if present.
Once the total cost is computed, it cannot be changed later.
5: If the total cost includes any mana, you get a chance to activate mana abilities.
6: The total cost is paid. If you cannot pay it, the game rewinds all the way back to before you started casting the spell. (Really, there should be a "panic" button during the whole process to allow players to abort.)
Note that this can lead to some "double use" tricks. For example, you can count Black Lotus as an artifact for your affinity spell, and then sacrifice it for mana to pay for the same spell.
7: Now the spell is cast and abilities that triggered during its casting and by its casting can go on the stack.
For abilities, the process is very similar. The cost reducing effects for abilities don't allow to reduce the mana under 1, but as they all reduce just generic mana costs, they are simpler.
I think that Forge is currently mixing all these steps together in a simplified model "Choose targets and pay costs". It needs to be expanded for cascade. The additional costs must be treated as such and not just as modes with cost normal+additional.
Re: Card Requests
by DennisBergkamp » 18 Jan 2010, 19:48
Thanks Marek, for the very complete answer
I guess Cascade might be out of reach for now, there are a lot of tricky corner cases that would be hard to implement.

I guess Cascade might be out of reach for now, there are a lot of tricky corner cases that would be hard to implement.
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Card Requests
by Marek14 » 18 Jan 2010, 20:10
One thing that is absolutely necessary, I think, is to split the casting cost into basic (mana cost or alternate) plus additional.DennisBergkamp wrote:Thanks Marek, for the very complete answer![]()
I guess Cascade might be out of reach for now, there are a lot of tricky corner cases that would be hard to implement.
For starters, you could define things like kicker not with total cost, but just with the additional cost.
Second thing is casting spells during resolution. That might not be too hard, but I don't know the details of code.
Re: Card Requests
by DennisBergkamp » 18 Jan 2010, 21:02
Yes, currently buyback or kicker just sets the total cost of the "SpellAbility" to the total cost (4 U U for Capsize), we would have to store the additional cost (3) somewhere.
I'm not sure what you mean by casting spells during resolution.
I'm not sure what you mean by casting spells during resolution.
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Card Requests
by Marek14 » 18 Jan 2010, 22:34
In case of cascade, for example, it goes like this:DennisBergkamp wrote:Yes, currently buyback or kicker just sets the total cost of the "SpellAbility" to the total cost (4 U U for Capsize), we would have to store the additional cost (3) somewhere.
I'm not sure what you mean by casting spells during resolution.
You cast a spell, cascade triggers, cascade resolves and reveals cards, and then you cast the revealed spell - still while resolving the cascade ability. Basically, spells and abilities that instruct you to cast or play something and don't tell you when - compare Djinn of Wishes with Aerial Caravan - make you do it right away, ignoring normal timing rules (but not things like Rule of Law etc.)
Re: Card Requests
by DennisBergkamp » 18 Jan 2010, 23:46
Ah yes, I see. That actually seems to be working alright (the original spell that has cascade is still on the stack, and hasn't resolved yet).
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Card Requests
by apthaven » 19 Jan 2010, 07:51
Vampires and Kors are starting to get more interesting with the newer cards out. So it would be nice to see more of them in Forge.
Here's a list:
Vampires:
Ascendant Evincar
Baron Sengir
*Blade of the Bloodchief
Blood Seeker
Blood Tyrant
*Gatekeeper of Malakir
*Guul Draz Vampire
*Kalitas, Bloodchief of Ghet
Krovikan Vampire
Mephidross Vampire
Ravenous Vampire
Repentant Vampire
Sengir Nosferatu
Shauku, Endbringer
Skeletal Vampire
Skyshroud Vampire
Soul Collector
Stalking Bloodsucker
Szadek, Lord of Secrets
Treacherous Vampire
Vampire Aristocrat
*Vampire Hexmage
Vampire Hounds
Vampire Lacerator
*Vampire Nocturnus
Vampiric Dragon
Vein Drinker
Kors:
*Armament Master
Kor Aeronaut
Kor Duelist
*Kor Hookmaster
Kor Outfitter
*Kor Sanctifiers
*Kor Skyfisher
Lawbringer
Lightbringer
Looter il-Kor
*Recommended.
This list would perhaps grow once Worldwake is out.
Here's a list:
Vampires:
Ascendant Evincar
Baron Sengir
*Blade of the Bloodchief
Blood Seeker
Blood Tyrant
*Gatekeeper of Malakir
*Guul Draz Vampire
*Kalitas, Bloodchief of Ghet
Krovikan Vampire
Mephidross Vampire
Ravenous Vampire
Repentant Vampire
Sengir Nosferatu
Shauku, Endbringer
Skeletal Vampire
Skyshroud Vampire
Soul Collector
Stalking Bloodsucker
Szadek, Lord of Secrets
Treacherous Vampire
Vampire Aristocrat
*Vampire Hexmage
Vampire Hounds
Vampire Lacerator
*Vampire Nocturnus
Vampiric Dragon
Vein Drinker
Kors:
*Armament Master
Kor Aeronaut
Kor Duelist
*Kor Hookmaster
Kor Outfitter
*Kor Sanctifiers
*Kor Skyfisher
Lawbringer
Lightbringer
Looter il-Kor
*Recommended.
This list would perhaps grow once Worldwake is out.
"I am a man and real men do not consume pink beverages. Get thee gone woman, and bring me something brown." - Jace Wayland
Re: Card Requests
by Marek14 » 19 Jan 2010, 08:50
Yup.DennisBergkamp wrote:Ah yes, I see. That actually seems to be working alright (the original spell that has cascade is still on the stack, and hasn't resolved yet).
Some time ago, BTW, I suggested to rename the Flashback "zone" to "Special" and use it as a repository for all the cards that can be played or activated but are not on the battlefield or in hand, not just Flashback. Things like Worldheart Phoenix, Haakon, Stromgald Scourge or Future Sight. Or retrace. In the list every card would be listed with name and reason in parenthesis - one card may be played in multiple ways, and this would help to differ between them. This would be useful for many cards, for example:
Aerial Caravan
Bosium Strip
Djinn of Wishes
Elkin Bottle
Elkin Lair
Grinning Totem
Ice Cauldron
Intet, the Dreamer
Knacksaw Clique
Mind's Desire
Muse Vessel
Nivix, Aerie of the Firemind
Ornate Kanzashi
Psychic Theft
Temporal Aperture
Three Wishes
And examples of cards that are cast immediately by spells or abilities (it would be quite hard to put together a full list):
All madness cards (like Arrogant Wurm)
These require a change in discards: when a card is discarded, it doesn't necessarily have to end up in graveyard. Madness cards can be discarded to exile. (This would also enable a few other cards like Library of Leng or Wilt-Leaf Liege.) Once the madness card is exiled via madness, it triggers and on resolution of that trigger you are allowed to cast it for madness cost.
Illusionary Mask
Knowledge Exploitation
Leaf-Crowned Elder
Spellshift
Sunforger
Guile
And there are activated abilities like Necrosavant.
Re: Card Requests
by psillusionist » 20 Jan 2010, 01:09
Wild Growth or other similar auras.
More reanimation cards like Exhume, Recurring Nightmare, Doomed Necromancer.
Psychatog
Arrogant Wurm
Basking Rootwalla
Circular Logic
EDIT: Wanted to request for these cards as well:
Mind Over Matter
Scroll Rack
Fling
Wall of Blood
Goblin Warchief
More reanimation cards like Exhume, Recurring Nightmare, Doomed Necromancer.
Psychatog
Arrogant Wurm
Basking Rootwalla
Circular Logic
EDIT: Wanted to request for these cards as well:
Mind Over Matter
Scroll Rack
Fling
Wall of Blood
Goblin Warchief
- psillusionist
- Posts: 70
- Joined: 20 Jan 2010, 00:15
- Has thanked: 0 time
- Been thanked: 0 time
Re: Card Requests
by DennisBergkamp » 20 Jan 2010, 20:21
I made some more progress on Cascade, I think I can implement some of those other cards that allow casting spells without paying their mana cost... Regarding Cascade: the AI can use it, targeting works, I'm pretty sure it also recurses if the revealed card has Cascade... the only thing that does not yet work is allowing to pay for Buyback, Entwine and Kicker costs.Marek14 wrote:Yup.DennisBergkamp wrote:Ah yes, I see. That actually seems to be working alright (the original spell that has cascade is still on the stack, and hasn't resolved yet).
Some time ago, BTW, I suggested to rename the Flashback "zone" to "Special" and use it as a repository for all the cards that can be played or activated but are not on the battlefield or in hand, not just Flashback. Things like Worldheart Phoenix, Haakon, Stromgald Scourge or Future Sight. Or retrace. In the list every card would be listed with name and reason in parenthesis - one card may be played in multiple ways, and this would help to differ between them. This would be useful for many cards, for example:
Aerial Caravan
Bosium Strip
Djinn of Wishes
Elkin Bottle
Elkin Lair
Grinning Totem
Ice Cauldron
Intet, the Dreamer
Knacksaw Clique
Mind's Desire
Muse Vessel
Nivix, Aerie of the Firemind
Ornate Kanzashi
Psychic Theft
Temporal Aperture
Three Wishes
And examples of cards that are cast immediately by spells or abilities (it would be quite hard to put together a full list):
All madness cards (like Arrogant Wurm)
These require a change in discards: when a card is discarded, it doesn't necessarily have to end up in graveyard. Madness cards can be discarded to exile. (This would also enable a few other cards like Library of Leng or Wilt-Leaf Liege.) Once the madness card is exiled via madness, it triggers and on resolution of that trigger you are allowed to cast it for madness cost.
Illusionary Mask
Knowledge Exploitation
Leaf-Crowned Elder
Spellshift
Sunforger
Guile
And there are activated abilities like Necrosavant.
We currently have Leaf-Crowned Elder, but it's coded incorrectly (it will just throw a Treefolk in play if it's at the top of your library - and without providing a choice to do so, by the way). I'll start by trying to fix that one.
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Card Requests
by Marek14 » 20 Jan 2010, 21:11
BTW, it seems that when AI uses Worldly Tutor, you now see what card it picked... could Enlightened Tutor and Mystical Tutor work the same way?
Plus other things that search for a card with specific characteristics like Beseech the Queen and Harbingers...
Plus other things that search for a card with specific characteristics like Beseech the Queen and Harbingers...
Re: Card Requests
by DennisBergkamp » 20 Jan 2010, 21:18
Sure, I'll add it to those as well.
I think the Harbingers already show it though (in the stack description I think it would say something like "Treefolk Harbinger - targeting Forest", even though they don't actually target
).
I think the Harbingers already show it though (in the stack description I think it would say something like "Treefolk Harbinger - targeting Forest", even though they don't actually target

-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Card Requests
by Marek14 » 21 Jan 2010, 00:03
The problem is that you have to scroll to see what they actually want to get, which gets tiring after a while. Plus, it's imprecise - the card to fetch shouldn't be decided until resolution of the ability.DennisBergkamp wrote:Sure, I'll add it to those as well.
I think the Harbingers already show it though (in the stack description I think it would say something like "Treefolk Harbinger - targeting Forest", even though they don't actually target).
Who is online
Users browsing this forum: No registered users and 54 guests