Page 1 of 1

New features for unless and stack description

PostPosted: 11 Feb 2013, 02:04
by Max mtg
Since noone seems to read Card development questions, I'll copy that part with new features announcement here.

New features include: UnlessResolveSubs$ - indicates when subabilities should be resolved. By default they are resolved at all times. That's useful for cards like Disrupt, but Power Sink should resolve its "tap all lands" and DrainMana only if X cost is not paid. So specify "UnlessResolveSubs$ WhenNotPaid" and you'll get the intended behaviour.

Stack Descriptions now may contain other varaibles besides CARDNAME. When a spell is put onto stack its targets are alredy known, so thay can be substituted in description. For instance
Code: Select all
SVar:TapLands:DB$ TapAll | ValidCards$ Land.hasManaAbility | Defined$ TargetedController | SubAbility$ ManaLose| StackDescription$ If {p:TargetedController} doesn't, that player taps all lands with mana abilities he or she controls and (subability text will get appended here)
And there's a little explaination how the text inside braces is parsed.
how it works | Open
Code: Select all
if ( isPlainText )
    sb.append(t.replace("CARDNAME", sa.getSourceCard().getName()));
else {
    List<?> objs = null;
    if ( t.startsWith("p:") )
        objs = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), t.substring(2), sa);
    else if ( t.startsWith("s:"))
        objs = AbilityFactory.getDefinedSpellAbilities(sa.getSourceCard(), t.substring(2), sa);
    else if ( t.startsWith("c:"))
        objs = AbilityFactory.getDefinedCards(sa.getSourceCard(), t.substring(2), sa);
    else
        objs = AbilityFactory.getDefinedObjects(sa.getSourceCard(), t, sa);
           
    sb.append(StringUtils.join(objs, ", "));

Re: New features for unless and stack description

PostPosted: 11 Feb 2013, 02:18
by friarsol
UnlessResolvesSubs looks to be useful when the Effect that's occurring in the Unless line isn't really something that can be remembered, and can definitely simplify some scripts that have unnecessary remembering/forking.

I'll need to see the StackDescription macros to see how seemless they are, but it seems very useful for spells like "Do X to target Blah. Do Y to target Blah." such as Consume Strength.

Re: New features for unless and stack description

PostPosted: 11 Feb 2013, 03:11
by Max mtg
friarsol wrote:UnlessResolvesSubs looks to be useful when the Effect that's occurring in the Unless line isn't really something that can be remembered
Shocklands!

I think unless as a separate api should have been added to forge long ago.

I'll need to see the StackDescription macros to see how seemless they are, but it seems very useful for spells like "Do X to target Blah. Do Y to target Blah." such as Consume Strength.
Calculated values are not supported there yet