It is currently 17 Sep 2025, 13:06
   
Text Size

Card Contributions

Post MTG Forge Related Programming Questions Here

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

Re: Card Contributions

Postby friarsol » 10 Jun 2011, 15:39

I was just debugging some multi-targeting code, when I came across the hard-coded Counterbalance. What would we need to convert this to Trigger+AF_Counter?

Edit: And similarly, Chalice of the Void, Dovescape, and a few others that are similarly coded.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Contributions

Postby jeffwadsworth » 10 Jun 2011, 16:38

friarsol wrote:I was just debugging some multi-targeting code, when I came across the hard-coded Counterbalance. What would we need to convert this to Trigger+AF_Counter?

Edit: And similarly, Chalice of the Void, Dovescape, and a few others that are similarly coded.
For Counterbalance, you would need to remember the Dig card that was revealed.

Something like this:

Code: Select all
Name:Counterbalance
ManaCost:U U
Types:Enchantment
Text:no text
T:Mode$ SpellCast | ValidCard$ Card | ValidActivatingPlayer$ Opponent | OptionalDecider$ You | TriggerZones$ Battlefield | Execute$ TrigReveal | TriggerDescription$ Whenever an opponent casts a spell, you may reveal the top card of your library. If you do, counter that spell if it has the same converted mana cost as the revealed card.
SVar:TrigReveal:AB$Dig | Cost$ 0 | DigNum$ 1 | Reveal$ True | RememberDigged$ True | ForgetOtherDigged$ True | SubAbility$ SVar=DBCounter
SVar:DBCounter:DB$Counter | Defined$ TriggeredSpellAbility | ConditionDefined$ Triggered | ConditionPresent$ Card.cmcEQX | ConditionCompare$ EQ1
SVar:X:Remembered$CardManaCost
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/counterbalance.jpg
End
jeffwadsworth
Super Tester Elite
 
Posts: 1172
Joined: 20 Oct 2010, 04:47
Location: USA
Has thanked: 287 times
Been thanked: 70 times

Re: Card Contributions

Postby Sloth » 10 Jun 2011, 17:09

friarsol wrote:I was just debugging some multi-targeting code, when I came across the hard-coded Counterbalance. What would we need to convert this to Trigger+AF_Counter?

Edit: And similarly, Chalice of the Void, Dovescape, and a few others that are similarly coded.
The difficulties won't lie in AF Countermagic. Slapshot made cards like Nether Void possible. Counterbalance can be easily converted by adding something to xcount (like topOfLibraryCMC).
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Card Contributions

Postby slapshot5 » 10 Jun 2011, 19:02

. Dovescape should be ok to convert. I'll check it in soon.

-slapshot5
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: Card Contributions

Postby jeffwadsworth » 10 Jun 2011, 19:05

Sloth wrote:
friarsol wrote:I was just debugging some multi-targeting code, when I came across the hard-coded Counterbalance. What would we need to convert this to Trigger+AF_Counter?

Edit: And similarly, Chalice of the Void, Dovescape, and a few others that are similarly coded.
The difficulties won't lie in AF Countermagic. Slapshot made cards like Nether Void possible. Counterbalance can be easily converted by adding something to xcount (like topOfLibraryCMC).
Eh, that is too easy. Besides, I wanted to spread the Remembered love.

Counterbalance...jeez. The SubAbility fires even if you choose No on the option to reveal the card. Sloth's idea is added if someone wants to give it a go.

Code: Select all
Name:Counterbalance
ManaCost:U U
Types:Enchantment
Text:no text
T:Mode$ SpellCast | ValidCard$ Card | ValidActivatingPlayer$ Opponent | OptionalDecider$ You | TriggerZones$ Battlefield | Execute$ TrigReveal | TriggerDescription$ Whenever an opponent casts a spell, you may reveal the top card of your library. If you do, counter that spell if it has the same converted mana cost as the revealed card.
SVar:TrigReveal:AB$Dig | Cost$ 0 | DigNum$ 1 | Reveal$ True | DestinationZone$ Library | LibraryPosition$ 0 | SubAbility$ SVar=DBCounter
SVar:DBCounter:DB$Counter | Defined$ TriggeredSpellAbility | IsPresent$ TriggeredSpellAbility.cmcEQX
SVar:X:Count$TopOfLibraryCMC
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/counterbalance.jpg
End
As for Chalice of the Void:


Code: Select all
Name:Chalice of the Void
ManaCost:X X
Types:Artifact
Text:no text
K:etbCounter:CHARGE:X
T:Mode$ SpellCast | ValidCard$ Card.cmcEQY | ValidActivatingPlayer$ Each | TriggerZones$ Battlefield | Execute$ TrigCounter | TriggerDescription$ Whenever a player casts a spell with converted mana cost equal to the number of charge counters on CARDNAME, counter that spell.
SVar:TrigCounter:AB$Counter | Cost$ 0 | Defined$ TriggeredSpellAbility
SVar:X:Count$xPaid
SVar:Y:Count$CardCounters.CHARGE
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/chalice_of_the_void.jpg
End
ValidCard$ doesn't handle Card.cmcEQY very well.
jeffwadsworth
Super Tester Elite
 
Posts: 1172
Joined: 20 Oct 2010, 04:47
Location: USA
Has thanked: 287 times
Been thanked: 70 times

Re: Card Contributions

Postby Starcrash » 11 Jun 2011, 03:23

Name:Deathbringer Liege
ManaCost:2 WB WB WB
Types:Creature Horror
Text:no text
PT:3/4
K:stPumpAll:Creature.White+Other+YouCtrl:1/1:No Condition:Other white creatures you control get +1/+1.
K:stPumpAll:Creature.Black+Other+YouCtrl:1/1:No Condition:Other black creatures you control get +1/+1.
T:Mode$ SpellCast | ValidCard$ Card.White+YouCtrl | TriggerZones$ Battlefield | Execute$ TrigTap | OptionalDecider$ You | TriggerDescription$ Whenever you cast a white spell, you may tap target creature.
T:Mode$ SpellCast | ValidCard$ Card.Black+YouCtrl | TriggerZones$ Battlefield | Execute$ TrigDestroy | OptionalDecider$ You | TriggerDescription$ Whenever you cast a black spell, you may destroy target creature if it's tapped.
SVar:TrigTap:AB$ Tap | Cost$ 0 | ValidTgts$ Creature | TgtPrompt$ Select target creature to tap
SVar:TrigDestroy:AB$ Destroy | Cost$ 0 | ValidTgts$ Creature | TgtPrompt$ Select target creature to destroy | ConditionDefined$ Targeted | ConditionPresent$ Creature.tapped
SVar:BuffedBy:Spell.White,Spell.Black
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/deathbringer_liege.jpg
SetInfo:EVE|Rare|http://magiccards.info/scans/en/eve/85.jpg
End
Despite working properly in other respects, it includes the phrase "(Targeting ERROR)" after each of the listed trigger descriptions upon playing a spell. If anyone understands why this is showing up, or better yet how to fix it, I'd appreciate the input.
Starcrash
 
Posts: 96
Joined: 30 May 2011, 18:39
Has thanked: 2 times
Been thanked: 1 time

Re: Card Contributions

Postby Sloth » 11 Jun 2011, 08:34

jeffwadsworth wrote:As for Chalice of the Void:

Code: Select all
Name:Chalice of the Void
ManaCost:X X
Types:Artifact
Text:no text
K:etbCounter:CHARGE:X
T:Mode$ SpellCast | ValidCard$ Card.cmcEQY | ValidActivatingPlayer$ Each | TriggerZones$ Battlefield | Execute$ TrigCounter | TriggerDescription$ Whenever a player casts a spell with converted mana cost equal to the number of charge counters on CARDNAME, counter that spell.
SVar:TrigCounter:AB$Counter | Cost$ 0 | Defined$ TriggeredSpellAbility
SVar:X:Count$xPaid
SVar:Y:Count$CardCounters.CHARGE
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/chalice_of_the_void.jpg
End
ValidCard$ doesn't handle Card.cmcEQY very well.
This should work now.

jeffwadsworth wrote:Eh, that is too easy. Besides, I wanted to spread the Remembered love.

Counterbalance...jeez. The SubAbility fires even if you choose No on the option to reveal the card. Sloth's idea is added if someone wants to give it a go.

Code: Select all
Name:Counterbalance
ManaCost:U U
Types:Enchantment
Text:no text
T:Mode$ SpellCast | ValidCard$ Card | ValidActivatingPlayer$ Opponent | OptionalDecider$ You | TriggerZones$ Battlefield | Execute$ TrigReveal | TriggerDescription$ Whenever an opponent casts a spell, you may reveal the top card of your library. If you do, counter that spell if it has the same converted mana cost as the revealed card.
SVar:TrigReveal:AB$Dig | Cost$ 0 | DigNum$ 1 | Reveal$ True | DestinationZone$ Library | LibraryPosition$ 0 | SubAbility$ SVar=DBCounter
SVar:DBCounter:DB$Counter | Defined$ TriggeredSpellAbility | IsPresent$ TriggeredSpellAbility.cmcEQX
SVar:X:Count$TopOfLibraryCMC
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/counterbalance.jpg
End
I will try to get Counterbalance to work.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Card Contributions

Postby jeffwadsworth » 11 Jun 2011, 14:33

Starcrash wrote:
Name:Deathbringer Liege
ManaCost:2 WB WB WB
Types:Creature Horror
Text:no text
PT:3/4
K:stPumpAll:Creature.White+Other+YouCtrl:1/1:No Condition:Other white creatures you control get +1/+1.
K:stPumpAll:Creature.Black+Other+YouCtrl:1/1:No Condition:Other black creatures you control get +1/+1.
T:Mode$ SpellCast | ValidCard$ Card.White+YouCtrl | TriggerZones$ Battlefield | Execute$ TrigTap | OptionalDecider$ You | TriggerDescription$ Whenever you cast a white spell, you may tap target creature.
T:Mode$ SpellCast | ValidCard$ Card.Black+YouCtrl | TriggerZones$ Battlefield | Execute$ TrigDestroy | OptionalDecider$ You | TriggerDescription$ Whenever you cast a black spell, you may destroy target creature if it's tapped.
SVar:TrigTap:AB$ Tap | Cost$ 0 | ValidTgts$ Creature | TgtPrompt$ Select target creature to tap
SVar:TrigDestroy:AB$ Destroy | Cost$ 0 | ValidTgts$ Creature | TgtPrompt$ Select target creature to destroy | ConditionDefined$ Targeted | ConditionPresent$ Creature.tapped
SVar:BuffedBy:Spell.White,Spell.Black
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/deathbringer_liege.jpg
SetInfo:EVE|Rare|http://magiccards.info/scans/en/eve/85.jpg
End
Despite working properly in other respects, it includes the phrase "(Targeting ERROR)" after each of the listed trigger descriptions upon playing a spell. If anyone understands why this is showing up, or better yet how to fix it, I'd appreciate the input.
I believe you need "ConditionCompare$ EQ1" to finish up the check. No idea if this helps with the "Targeting ERROR" you are seeing.
jeffwadsworth
Super Tester Elite
 
Posts: 1172
Joined: 20 Oct 2010, 04:47
Location: USA
Has thanked: 287 times
Been thanked: 70 times

Re: Card Contributions

Postby jeffwadsworth » 11 Jun 2011, 14:35

Sloth wrote:
This should work now.

Thanks Sloth. After more testing, the value for Y always remains 0. So I will check the issue in the line SVar:Y:Count$CardCounters.CHARGE

I believe the issue is possibly related to the object issue some others have been noticing. The card has the correct counter number after it is set via etbCounter. But, even if you set it to another value and increment it every turn, 2 different int values will exist (0 in Card and whatever int is set up within CardFactoryUtil.
Last edited by jeffwadsworth on 12 Jun 2011, 05:07, edited 1 time in total.
jeffwadsworth
Super Tester Elite
 
Posts: 1172
Joined: 20 Oct 2010, 04:47
Location: USA
Has thanked: 287 times
Been thanked: 70 times

Re: Card Contributions

Postby Starcrash » 12 Jun 2011, 00:28

Name:Canker Abomination
ManaCost:2 BG BG
Types:Creature Treefolk Horror
Text:As CARDNAME enters the battlefield, choose an opponent. CARDNAME enters the battlefield with a -1/-1 counter on it for each creature that player controls.
PT:6/6
K:etbCounter:M1M1:X
SVar:X:Count$Valid Creature.YouDontCtrl
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/canker_abomination.jpg
SetInfo:EVE|Uncommon|http://magiccards.info/scans/en/eve/115.jpg
End
The description on the card is horrible, as the Keyword description is automatic, redundant, and uninformative (CARDNAME gets X -1/-1 counters when it comes into play). But functionally the card works like it's supposed to.
Starcrash
 
Posts: 96
Joined: 30 May 2011, 18:39
Has thanked: 2 times
Been thanked: 1 time

Re: Card Contributions

Postby Sloth » 12 Jun 2011, 07:55

Starcrash wrote:
Name:Canker Abomination
ManaCost:2 BG BG
Types:Creature Treefolk Horror
Text:As CARDNAME enters the battlefield, choose an opponent. CARDNAME enters the battlefield with a -1/-1 counter on it for each creature that player controls.
PT:6/6
K:etbCounter:M1M1:X
SVar:X:Count$Valid Creature.YouDontCtrl
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/canker_abomination.jpg
SetInfo:EVE|Uncommon|http://magiccards.info/scans/en/eve/115.jpg
End
The description on the card is horrible, as the Keyword description is automatic, redundant, and uninformative (CARDNAME gets X -1/-1 counters when it comes into play). But functionally the card works like it's supposed to.
I've added your Liege (Target ERROR inclusive) and Canker Abomination (etbCounter does allow an optional description - just look at my submitted version). Thanks Starcrash.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Card Contributions

Postby Starcrash » 12 Jun 2011, 13:53

Name:Genesis Chamber
ManaCost:2
Types:Artifact
Text:no text
T:Mode$ ChangesZone | ValidPlayer$ Player | Origin$ Any | Destination$ Battlefield | ValidCard$ Creature.nonToken | TriggerZones$ Battlefield | Execute$ TrigToken | IsPresent$ Card.Self+untapped | TriggerDescription$ Whenever a nontoken creature enters the battlefield, if CARDNAME is untapped, that creature's controller puts a 1/1 Myr artifact creature token onto the battlefield.
SVar:TrigToken:AB$ Token | Cost$ 0 | TokenAmount$ 1 | TokenOwner$ TriggeredCardController | TokenName$ Myr | TokenTypes$ Artifact,Creature,Myr | TokenColors$ Colorless | TokenPower$ 1 | TokenToughness$ 1 | SpellDescription$ Put a 1/1 Myr artifact creature token onto the battlefield.
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/genesis_chamber.jpg
SetInfo:DST|Rare|http://magiccards.info/scans/en/ds/122.jpg
End
Name:Spawning Pit
ManaCost:2
Types:Artifact
Text:no text
A:AB$ PutCounter | Cost$ Sac<1/Creature> | Defined$ Self | CounterType$ CHARGE | CounterNum$ 1 | SpellDescription$ Put a charge counter on CARDNAME.
A:AB$ Token | Cost$ 1 SubCounter<2/CHARGE> | TokenAmount$ 1 | TokenController$ You | TokenName$ Spawn | TokenTypes$ Artifact,Creature,Spawn | TokenColors$ Colorless | TokenPower$ 2 | TokenToughness$ 2 | SpellDescription$ Put a 2/2 Spawn artifact creature token onto the battlefield.
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/spawning_pit.jpg
SetInfo:DST|Rare|http://magiccards.info/scans/en/ds/141.jpg
End
Starcrash
 
Posts: 96
Joined: 30 May 2011, 18:39
Has thanked: 2 times
Been thanked: 1 time

Re: Card Contributions

Postby jeffwadsworth » 12 Jun 2011, 17:00

Sloth wrote:
jeffwadsworth wrote:Eh, that is too easy. Besides, I wanted to spread the Remembered love.

Counterbalance...jeez. The SubAbility fires even if you choose No on the option to reveal the card. Sloth's idea is added if someone wants to give it a go.

Code: Select all
Name:Counterbalance
ManaCost:U U
Types:Enchantment
Text:no text
T:Mode$ SpellCast | ValidCard$ Card | ValidActivatingPlayer$ Opponent | OptionalDecider$ You | TriggerZones$ Battlefield | Execute$ TrigReveal | TriggerDescription$ Whenever an opponent casts a spell, you may reveal the top card of your library. If you do, counter that spell if it has the same converted mana cost as the revealed card.
SVar:TrigReveal:AB$Dig | Cost$ 0 | DigNum$ 1 | Reveal$ True | DestinationZone$ Library | LibraryPosition$ 0 | SubAbility$ SVar=DBCounter
SVar:DBCounter:DB$Counter | Defined$ TriggeredSpellAbility | IsPresent$ TriggeredSpellAbility.cmcEQX
SVar:X:Count$TopOfLibraryCMC
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/counterbalance.jpg
End
I will try to get Counterbalance to work.
Well, one reason why Counterbalance didn't work for me was my src installation got screwed up. Thanks.
jeffwadsworth
Super Tester Elite
 
Posts: 1172
Joined: 20 Oct 2010, 04:47
Location: USA
Has thanked: 287 times
Been thanked: 70 times

Re: Card Contributions

Postby Starcrash » 12 Jun 2011, 19:44

Name:Arcbound Fiend
ManaCost:6
Types:Artifact Creature Horror
Text:no text
PT:0/0
K:Fear
K:Modular 3
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | Execute$ TrigRemoveCounter | TriggerZones$ Battlefield | OptionalDecider$ You | TriggerDescription$ At the beginning of your upkeep, you may move a +1/+1 counter from target creature onto Arcbound Fiend.
SVar:TrigRemoveCounter:AB$ RemoveCounter | Cost$ 0 | ValidTgts$ Creature.Other+YouCtrl | CounterType$ P1P1 | CounterNum$ 1 | SubAbility$ SVar=TrigAddCounter | TgtPrompt$ Select target creature you control with a +1/+1 counter on it
SVar:TrigAddCounter:DB$ PutCounter | Cost$ 0 | Defined$ Self | CounterType$ P1P1 | CounterNum$ 1
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/arcbound_fiend.jpg
SetInfo:DST|Uncommon|http://magiccards.info/scans/en/ds/96.jpg
End
Starcrash
 
Posts: 96
Joined: 30 May 2011, 18:39
Has thanked: 2 times
Been thanked: 1 time

Re: Card Contributions

Postby friarsol » 12 Jun 2011, 19:50

Starcrash, two things about Arcbound Fiend. First, it looks like the creature you are stealing counters from doesn't have to be a Creature you Control (even though it feels like it should be). The other is this:
"The creature that's targeted by Arcbound Fiend's middle ability doesn't have to have any +1/+1 counters on it. If it doesn't have a counter on it when the ability resolves, nothing happens." Where your script will try add a Counter whether or not the targeted creature has a Counter. We probably need a AF_MoveCounter for this to work properly.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 32 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 32 users online :: 0 registered, 0 hidden and 32 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 32 guests

Login Form