New features for unless and stack description
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
3 posts
• Page 1 of 1
New features for unless and stack description
by Max mtg » 11 Feb 2013, 02:04
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
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)
- 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, ", "));
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: New features for unless and stack description
by friarsol » 11 Feb 2013, 02:18
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.
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.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: New features for unless and stack description
by Max mtg » 11 Feb 2013, 03:11
Shocklands!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
I think unless as a separate api should have been added to forge long ago.
Calculated values are not supported there yetI'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.
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 58 guests