Board index
Programs with AI or Rules Enforcement
Magic: The Gathering - Duels of the Planeswalkers
Programming Talk



Surgical Extraction
Moderator: CCGHQ Admins
5 posts
• Page 1 of 1
Surgical Extraction
by pcastellazzi » 02 Nov 2012, 18:50
Surgical Extraction (Choose target card in a graveyard other than a basic land card. Search its owner's graveyard, hand, and library for any number of cards with the same name as that card and exile them. Then that player shuffles his or her library.) is a tricky card to code. I want to explore a few solutions and to know what you think about them.
The last problem is how to "reveal" all cards in a zone. I know i can loop over all cards with EvaluateObjects() and GetNthEvaluatedObject() but is a PITA to watch it over a whole library.
How you think this may be done?
- Try 1: A filter with multiple zones.
This is a no go, Object():GetFilter():SetZone() does not allow multiple calls. - Try 2: Loop over all zones copying all cards to a data chest, and make a selection from it.
This is a no go too, when using a data chest as a source for a prompt the filter is ignored. - Try 3: Use GuidedReveal() and RemoveFromGame() for each copy while looping across all zones.
This works, but is not quite exactly what the card should do. I think a great part of Surgical Extraction's value reside in the ability to look at your oponent hand and library. - Try 4: Filter each zone independently allowing to remove from each one at a time.
This also works, and is a bit closer to what's required, the problem is only filtered cards are shown unless "Browser the entire library" is enabled.
The last problem is how to "reveal" all cards in a zone. I know i can loop over all cards with EvaluateObjects() and GetNthEvaluatedObject() but is a PITA to watch it over a whole library.
How you think this may be done?
The lights then came up and the crowd erupted in applause, because that's what the crowd does after it watches destruction on a large screen.
— Ben Kuchera, Mordern Warfare 3 review.
— Ben Kuchera, Mordern Warfare 3 review.
-
pcastellazzi - Posts: 184
- Joined: 25 Apr 2012, 00:40
- Location: Montevideo, Uruguay
- Has thanked: 11 times
- Been thanked: 30 times
Re: Surgical Extraction
by thefiremind » 02 Nov 2012, 20:47
I would go with "Try 4", which is similar to what I did for Dark Supplicant (this is easier because you don't have to stop at the first occurrence you select). When you search for a card in a place where not everyone can see (library and hand, while the graveyard can be seen by all players), rules say you are not forced to find the card(s) you're looking for, so it's best if you let the player click on them all. If you want to make the card so that it doesn't matter if the "browse entire library" option is checked, you can add a "dummy query" that just lets you see the library and does nothing, then the real query begins and you select the required cards.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 722 times
Re: Surgical Extraction
by pcastellazzi » 02 Nov 2012, 23:33
I was experimenting with your suggestion. I made it work but one problem remains unsolved. Error handling. Filter's objective is make sure you can not make a bad choice. With this aproach the error handling should be done manually. A repeating resolution timed action may work, but is going to be confusing for the player when he/she made an error and is prompted again for the same input without any explanation of what happend. Also the AI will probably collapse without them.
The lights then came up and the crowd erupted in applause, because that's what the crowd does after it watches destruction on a large screen.
— Ben Kuchera, Mordern Warfare 3 review.
— Ben Kuchera, Mordern Warfare 3 review.
-
pcastellazzi - Posts: 184
- Joined: 25 Apr 2012, 00:40
- Location: Montevideo, Uruguay
- Has thanked: 11 times
- Been thanked: 30 times
Re: Surgical Extraction
by thefiremind » 03 Nov 2012, 10:58
In fact I suggested to use 2 distinct queries: the first one lets you browse through the entire library with no error handling and no effect no matter what card you click on. The second has the filter and lets you click only on the cards with the same name as the one selected in the graveyard. If you can always browse through the entire library, the first query will be unuseful, but you will be ready for any situation this way.pcastellazzi wrote:Filter's objective is make sure you can not make a bad choice.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 722 times
Re: Surgical Extraction
by pcastellazzi » 03 Nov 2012, 14:54
Your idea still have some rough edges. One that came to mind is the "Browse the entire library option", when enabled you will see a library explorer twice.
I dont think there is a good way to do this without a compromise. My take on this is to remove the target's copies from the zones using GuidedReveal() for some visual feedback, and finally use RevealHand(). I dont think revealing the library and graveyard are necessary since you can only play against the AI and the AI always use the default deck configuration, there is not point in showing what's in it, also the graveyard is public.
Still the cleaner way is to do it filtering one zone at time and relay on "Browse the entire library" to be enabled.
I dont think there is a good way to do this without a compromise. My take on this is to remove the target's copies from the zones using GuidedReveal() for some visual feedback, and finally use RevealHand(). I dont think revealing the library and graveyard are necessary since you can only play against the AI and the AI always use the default deck configuration, there is not point in showing what's in it, also the graveyard is public.
Still the cleaner way is to do it filtering one zone at time and relay on "Browse the entire library" to be enabled.
The lights then came up and the crowd erupted in applause, because that's what the crowd does after it watches destruction on a large screen.
— Ben Kuchera, Mordern Warfare 3 review.
— Ben Kuchera, Mordern Warfare 3 review.
-
pcastellazzi - Posts: 184
- Joined: 25 Apr 2012, 00:40
- Location: Montevideo, Uruguay
- Has thanked: 11 times
- Been thanked: 30 times
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 0 guests