It is currently 29 Oct 2025, 22:22
   
Text Size

Naming for non-targeted recipient of an Effect

Post MTG Forge Related Programming Questions Here

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

Naming for non-targeted recipient of an Effect

Postby friarsol » 02 Dec 2010, 17:40

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

Re: Naming for non-targeted recipient of an Effect

Postby Chris H. » 02 Dec 2010, 19:14

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$.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Naming for non-targeted recipient of an Effect

Postby friarsol » 02 Dec 2010, 21:46

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

Re: Naming for non-targeted recipient of an Effect

Postby Rob Cashwalker » 03 Dec 2010, 00:00

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.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: Naming for non-targeted recipient of an Effect

Postby slapshot5 » 05 Jan 2011, 07:13

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
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: Naming for non-targeted recipient of an Effect

Postby friarsol » 05 Jan 2011, 15:24

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);
    }
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: LetMeThrough, Timothysow and 24 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 26 users online :: 2 registered, 0 hidden and 24 guests (based on users active over the past 10 minutes)
Most users ever online was 9298 on 10 Oct 2025, 12:54

Users browsing this forum: LetMeThrough, Timothysow and 24 guests

Login Form