Page 1 of 1

Naming for non-targeted recipient of an Effect

PostPosted: 02 Dec 2010, 17:40
by friarsol
In some previous threads we've come up with the need for defining a recipient of an effect, that doesn't actually target.

I couldn't decide what to use when this first came up, so I just went with "Affected" although since I've wrote that I don't think I like Affected that much. At this point I'm leaning towards "Defined" since most of the time it's a pre-defined card that is being affected. Currently, if the spell doesn't target we assume the card is doing the effect to itself. So this makes the default value of Defined - "Self."

I know Sloth said he was using "Valid" for DestroyAll, but that is slightly different for these purposes, since many of the defined recipients won't run through the getValid functions.

Does anyone have any suggested name to use instead? If noone cares, or everyone is ok with "Defined" I'm going to go with that.

Re: Naming for non-targeted recipient of an Effect

PostPosted: 02 Dec 2010, 19:14
by Chris H.
I thought about this for a short while. At this time I'm kind of leaning towards:

Recipient$ Equipped
Recipient$ Enchanted

but I could go with this or Defined$.

Re: Naming for non-targeted recipient of an Effect

PostPosted: 02 Dec 2010, 21:46
by friarsol
Ok. I need to submit some code that I got sidetracked with today. It's going to use Defined$ but I'll go ahead and change it if we decide on a different parameter name.

Re: Naming for non-targeted recipient of an Effect

PostPosted: 03 Dec 2010, 00:00
by Rob Cashwalker
As a variable name in code, I used "Scope". The idea occurs to me, using a two-part definition works....

Defined$ (or other) indicates targeted or non targeted, or other methods to interpret restrictions.
Target$ contains restrictions for targeted effects.
NonTarget$ (or other) contains restrictions for non targeted effects.

Re: Naming for non-targeted recipient of an Effect

PostPosted: 05 Jan 2011, 07:13
by slapshot5
I'm running into a problem with Defined. When a card gives an ability like this (Defined$Enchanted) and has Sac<1/CARDNAME> in the cost, the ability does not resolve correctly. It is put on the stack, but by the time resolve is called, the card has been sacrificed and Enchanted is no longer usable.

See Thrull Retainer for an example of what I'm trying to do.
Code: Select all
A:AB$Regenerate | Cost$ Sac<1/CARDNAME> | Defined$ Enchanted | SpellDescription$ Regenerate enchanted creature.
Any thoughts? Should the AbilityFactory handle this by storing this, or what?

-slapshot5

Re: Naming for non-targeted recipient of an Effect

PostPosted: 05 Jan 2011, 15:24
by friarsol
This is similar to an issue I noticed with Fling. Issue 62 requests a copy of the card when a sacrifice occurs so it can use last known information, when the state of the card matters. By just using the card, it'll be using the reset properties of the card, in your case not being enchanted to other things. For Fling, it would ignore +1/+1 counters, and other such things.

This is called from CostPayment.sacrificeThis() and .sacrificeType(), but the copy should probably just happen inside the call which is SpellAbility.addSacrificedCost()

Code: Select all
    public void addSacrificedCost(Card c){
       if (sacrificedCards == null)
          sacrificedCards = new CardList();
       
// Copy c to gain last known information here
       sacrificedCards.add(c);
    }