Destroy N permanents (r19700)
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
8 posts
• Page 1 of 1
Destroy N permanents (r19700)
by Max mtg » 17 Feb 2013, 19:13
I've added a common routine for AI and Human to gather all permenents before actually destroying them.
Previously it started a loop from 1 to amount and sac'd units inside that loop. Now there are separate loops for selection and execution.
So I've some questions about selecting permanents:
* Are undestructable permanents valid targets for 'destroy' api?
* Should sacrifice targets be selected when "opponent's abilities cannot make you sac permanents" is in effect?
Also open for comments and opinions on that revision.
Previously it started a loop from 1 to amount and sac'd units inside that loop. Now there are separate loops for selection and execution.
So I've some questions about selecting permanents:
* Are undestructable permanents valid targets for 'destroy' api?
* Should sacrifice targets be selected when "opponent's abilities cannot make you sac permanents" is in effect?
Also open for comments and opinions on that revision.
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: Destroy N permanents (r19700)
by friarsol » 17 Feb 2013, 23:24
Just a quick clarification, you are trying to determine when you are accumulating the valid permanents, if you should throw it indestructible ones for destroy effects (or can't be sacrificed for sacrifice effects)? If a card is targeted, and is an invalid target when the spell is about to resolve, it is removed from the target object before it even gets to the effects.
My instinct is to say you don't need to include them, although the function should return if it can't do the expected action on the passed card anyway.
My instinct is to say you don't need to include them, although the function should return if it can't do the expected action on the passed card anyway.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Destroy N permanents (r19700)
by Max mtg » 18 Feb 2013, 06:42
That is the question.friarsol wrote:My instinct is to say you don't need to include them, although the function should return if it can't do the expected action on the passed card anyway.
That's how it works now - any permanent matching ValidTgt$ can be choosen, and if it can't be sacrificed or destroyed, noone cares.
That seems fair - I can cast Viridian Corrupter, target my Darksteel Axe which won't get destroyed anyway and dont touch the Batterskull.
Ok, will leave the code as it is. Just in case, there are a couple of routines that can test a card for being destroyable and "sacrificable".
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: Destroy N permanents (r19700)
by friarsol » 18 Feb 2013, 13:39
Yep, that's totally legal. The AI shouldn't do it (unless they are forced to, then it's better to choose something they control that won't actually be effected.)Max mtg wrote:That's how it works now - any permanent matching ValidTgt$ can be choosen, and if it can't be sacrificed or destroyed, noone cares.
That seems fair - I can cast Viridian Corrupter, target my Darksteel Axe which won't get destroyed anyway and dont touch the Batterskull.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Destroy N permanents (r19700)
by Max mtg » 18 Feb 2013, 18:45
The AI does choose indestructible permanents first, if the ability uses 'destroy' mechanics.friarsol wrote:The AI shouldn't do it (unless they are forced to, then it's better to choose something they control that won't actually be effected.)
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: Destroy N permanents (r19700)
by friarsol » 18 Feb 2013, 19:04
It looks like there are only three cards that even use the Destroy inside Sacrifice mechanics. We should try to convert these to actual Destroy effects since the AI knows how to avoid Indestructible cards for those effects.Max mtg wrote:The AI does choose indestructible permanents first, if the ability uses 'destroy' mechanics.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Destroy N permanents (r19700)
by Sloth » 18 Feb 2013, 20:34
Why do you want to convert anything? The AI does it correctly. When you play Imperial Edict it will choose Darksteel Colossus.friarsol wrote:It looks like there are only three cards that even use the Destroy inside Sacrifice mechanics. We should try to convert these to actual Destroy effects since the AI knows how to avoid Indestructible cards for those effects.Max mtg wrote:The AI does choose indestructible permanents first, if the ability uses 'destroy' mechanics.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Destroy N permanents (r19700)
by friarsol » 18 Feb 2013, 20:37
I guess I misunderstood, I thought Max meant the AI was targeting Indestructible creatures the Human controlled with destroy style effects.Sloth wrote:Why do you want to convert anything? The AI does it correctly. When you play Imperial Edict it will choose Darksteel Colossus.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
8 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 49 guests