It is currently 11 Sep 2025, 18:59
   
Text Size

Destroy N permanents (r19700)

Post MTG Forge Related Programming Questions Here

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

Destroy N permanents (r19700)

Postby 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.
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)

Postby 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.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Destroy N permanents (r19700)

Postby Max mtg » 18 Feb 2013, 06:42

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 is the question.

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)

Postby friarsol » 18 Feb 2013, 13:39

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.
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.)
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Destroy N permanents (r19700)

Postby Max mtg » 18 Feb 2013, 18:45

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.)
The AI does choose indestructible permanents first, if the ability uses 'destroy' mechanics.
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)

Postby friarsol » 18 Feb 2013, 19:04

Max mtg wrote:The AI does choose indestructible permanents first, if the ability uses 'destroy' mechanics.
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.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Destroy N permanents (r19700)

Postby Sloth » 18 Feb 2013, 20:34

friarsol wrote:
Max mtg wrote:The AI does choose indestructible permanents first, if the ability uses 'destroy' mechanics.
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.
Why do you want to convert anything? The AI does it correctly. When you play Imperial Edict it will choose Darksteel Colossus.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Destroy N permanents (r19700)

Postby friarsol » 18 Feb 2013, 20:37

Sloth wrote:Why do you want to convert anything? The AI does it correctly. When you play Imperial Edict it will choose Darksteel Colossus.
I guess I misunderstood, I thought Max meant the AI was targeting Indestructible creatures the Human controlled with destroy style effects.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 49 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 49 users online :: 0 registered, 0 hidden and 49 guests (based on users active over the past 10 minutes)
Most users ever online was 7967 on 09 Sep 2025, 23:08

Users browsing this forum: No registered users and 49 guests

Login Form