It is currently 17 Sep 2025, 20:17
   
Text Size

Card Development Questions

Post MTG Forge Related Programming Questions Here

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

Re: Card Development Questions

Postby ArsenalNut » 28 Jul 2011, 04:37

I have a couple newbie questions. I haven't worked on an Open Source project before.

I am planning to start learning the code structure of Forge by mostly card scripting and then looking for low hanging fruit code changes to make cards script-able. For example, I was able to make Cloud Key script-able by adding couple lines to the code that handles the ChangeCost keyword so that ChosenType is supported.

Now that I am setup to push changes to Git, is it better to add the cards myself or still post the card code in the Card Contributions topic? If I make a code change and its tested and working, do I just push it back into the master branch? Other than making a comment when I commit a change, should I post the change in this topic?
So many cards, so little time
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

Re: Card Development Questions

Postby Sloth » 28 Jul 2011, 06:33

ArsenalNut wrote:I have a couple newbie questions. I haven't worked on an Open Source project before.

I am planning to start learning the code structure of Forge by mostly card scripting and then looking for low hanging fruit code changes to make cards script-able. For example, I was able to make Cloud Key script-able by adding couple lines to the code that handles the ChangeCost keyword so that ChosenType is supported.

Now that I am setup to push changes to Git, is it better to add the cards myself or still post the card code in the Card Contributions topic? If I make a code change and its tested and working, do I just push it back into the master branch? Other than making a comment when I commit a change, should I post the change in this topic?
You can just push it to the master branch. Discussing changes is only necessary, when you are unsure or the implementation is disputable.

Welcome aboard ArsenalNut. :D
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Card Development Questions

Postby friarsol » 28 Jul 2011, 12:02

slapshot5 wrote:But, if all 3 are in play, and I use Crown of Empires, the Stack get stuck with "1 to Resolve", but nothing visibly on the stack.

Does anyone have insight into this problem?
I'll try to test these tonight. Mind posting the other two, so I don't have to rescript them?
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Development Questions

Postby ArsenalNut » 29 Jul 2011, 14:51

More newbie questions. I am confused about the difference between RemRandomDeck
and RemAIDeck. I couldn't find a description of RemRandomDeck in the wiki and the description of RemAIDeck seems to overlap with what I think RemRandomDeck means.

Here's what I assume they were used for.
1)RemRandomDeck - I was putting this on cards that have creature type or color effects. I assumed that setting this true means the card won't show up in a random decks, but this doesn't mean necessarily mean the AI can't use them in a theme deck.

2)RemAIDeck - I assume this is for cards that the AI can't use so you don't want them is random decks for the AI. The end of the description in the wiki "and cards that are too narrow for random decks" sounds like what RemRandomDeck is suppose to do. Does RemAIDeck really effect random decks for the Human?

What is the difference between the two flags? When do you use one versus the other?
So many cards, so little time
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

Re: Card Development Questions

Postby Sloth » 29 Jul 2011, 14:58

ArsenalNut wrote:More newbie questions. I am confused about the difference between RemRandomDeck
and RemAIDeck. I couldn't find a description of RemRandomDeck in the wiki and the description of RemAIDeck seems to overlap with what I think RemRandomDeck means.

Here's what I assume they were used for.
1)RemRandomDeck - I was putting this on cards that have creature type or color effects. I assumed that setting this true means the card won't show up in a random decks, but this doesn't mean necessarily mean the AI can't use them in a theme deck.

2)RemAIDeck - I assume this is for cards that the AI can't use so you don't want them is random decks for the AI. The end of the description in the wiki "and cards that are too narrow for random decks" sounds like what RemRandomDeck is suppose to do. Does RemAIDeck really effect random decks for the Human?

What is the difference between the two flags? When do you use one versus the other?
Your deduction is right. RemAIDeck does no longer affect human decks. We split this not long ago and the wiki is out of date here.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Card Development Questions

Postby Chris H. » 29 Jul 2011, 17:45

Sloth wrote:Your deduction is right. RemAIDeck does no longer affect human decks. We split this not long ago and the wiki is out of date here.
`
The SVar section of the wiki is in need of updating. I moved the material that you placed in that one topic here over to the wiki a few months ago. Been too busy to go back and make some refinements.
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: Card Development Questions

Postby ArsenalNut » 30 Jul 2011, 02:22

Another new to me SVar, BuffedBy, popped up when I was looking at adding a new Sliver creature. What is this SVar used for?
So many cards, so little time
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

Re: Card Development Questions

Postby friarsol » 30 Jul 2011, 02:41

ArsenalNut wrote:Another new to me SVar, BuffedBy, popped up when I was looking at adding a new Sliver creature. What is this SVar used for?
This one is on the Wiki:

http://www.slightlymagic.net/wiki/Forge_API#SVars

SVar:BuffedBy:[ValidCards]

If a permanent with this SVar is on the battlefield under its control the AI will play the specified cards in Main1. Applicable for creatures with a P/T setting static ability (Kithkin Rabble) or additional buffes (Radiant, Archangel).
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Development Questions

Postby ArsenalNut » 01 Aug 2011, 05:42

I am trying to test my script of Molten Disaster and I think there is a bug in how Split second works. I tried to test the kicked Split second by casting Lightning Bolt and using Prodigal Pyromancer's activated ability right after I cast Molten Disaster. Both were put on to the stack and resolved before Molten Disaster resolved. To make sure the problem wasn't my script, I cast Sudden Shock to kill my own Prodigal Pyromancer then cast Giant Growth to save it. This shouldn't save my creature because the Sudden Shock with split second should resolve before Giant Growth but it does in Forge 1.1.1-SNAPSHOT.

Here's my script for Molten Disaster
| Open
Name:Molten Disaster
ManaCost:X R R
Types:Sorcery
Text:If CARDNAME was kicked, it has split second. (As long as this spell is on the stack, players can't cast spells or activate abilities that aren't mana abilities.)\r\n\r\n
A:SP$ DamageAll | Cost$ X R R | ValidCards$ Creature.withoutFlying | ValidPlayers$ Each | NumDmg$ X | SpellDescription$ CARDNAME deals X damage to each creature without flying and each player.
A:SP$ DamageAll | Cost$ X R R R | ValidCards$ Creature.withoutFlying | ValidPlayers$ Each | NumDmg$ X | SpellDescription$ Kicker R (You may pay an additional R as you cast this spell.) | SubAbility$ DBKicker
SVar:DBKicker:DB$ Pump | Cost$ 0 | AddKeyword$ Split second | Defined$ Self
SVar:X:Count$xPaid
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/molten_disaster.jpg
SetInfo:FUT|Rare|http://magiccards.info/scans/en/fut/102.jpg
End
So many cards, so little time
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

Re: Card Development Questions

Postby friarsol » 01 Aug 2011, 12:14

ArsenalNut wrote:I am trying to test my script of Molten Disaster and I think there is a bug in how Split second works.
You're right. The place that checks the Split second keyword is looking for "Split Second" where the keyworded ability is "Split second" I'm not at a place that I can fix this so maybe someone else can. It's in MagicStack.java and the functions are incrementSplitSecond() and decrementSplitSecond().
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Development Questions

Postby Sloth » 01 Aug 2011, 12:30

friarsol wrote:
ArsenalNut wrote:I am trying to test my script of Molten Disaster and I think there is a bug in how Split second works.
You're right. The place that checks the Split second keyword is looking for "Split Second" where the keyworded ability is "Split second" I'm not at a place that I can fix this so maybe someone else can. It's in MagicStack.java and the functions are incrementSplitSecond() and decrementSplitSecond().
Fixed!
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Card Development Questions

Postby jeffwadsworth » 03 Aug 2011, 14:44

Consume Strength is not scriptable yet. If we had a way to get the first ability to resolve completely, it should be doable.

| Open
Name:Consume Strength
ManaCost:1 B G
Types:Instant
Text:no text
A:SP$ Pump | Cost$ 1 B G | ValidTgts$ Creature | TgtPrompt$ Select target creature | RememberTargets$ True | ForgetOtherTargets$ True | NumAtt$ +2 | NumDef$ +2 | SubAbility$ DBPumpCurse
A:DBPumpCurse:DB$Pump | ValidTgts$ Creature.IsRemembered+Other | TgtPrompt$ Select a different target creature | NumAtt$ -2 | NumDef$ -2
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/consume_strength.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 Development Questions

Postby jeffwadsworth » 03 Aug 2011, 15:47

Elephant Resurgence. Is there a way to get something like this to work currently?

| Open
Name:Elephant Resurgence
ManaCost:1 G
Types:Sorcery
Text:no text
A:SP$ Token | Cost$ 1 G | TokenAmount$ 1 | TokenName$ Elephant | TokenTypes$ Creature,Elephant | TokenOwner$ You | TokenColors$ Green | TokenPower$ X | TokenToughness$ X | TokenTriggers$ TrigPump | TokenSVars$ X | SubAbility$ DBComputerToken | SpellDescription$ Each player puts a green Elephant creature token onto the battlefield. Those creatures have "This creature's power and toughness are each equal to the number of creature cards in its controller's graveyard."
SVar:TrigPump:Mode$ Continuous | Affected$ Self | SetPower$ X | SetToughness$ X | CharacteristicDefining$ True
SVar:TrigPump2:Mode$ Continuous | Affected$ Self | SetPower$ Y | SetToughness$ Y | CharacteristicDefining$ True
SVar:DBComputerToken:DB$Token | TokenAmount$ 1 | TokenName$ Elephant | TokenTypes$ Creature,Elephant | TokenOwner$ Opponent | TokenColors$ Green | TokenPower$ Y | TokenToughness$ Y | TokenTriggers$ TrigPump2 | TokenSVars$ Y
SVar:X:Count$InYourYard.Creature
SVar:Y:Count$InOppYard.Creature
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/elephant_resurgence.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 Development Questions

Postby ArsenalNut » 03 Aug 2011, 17:42

jeffwadsworth wrote:Elephant Resurgence. Is there a way to get something like this to work currently?

| Open
Name:Elephant Resurgence
ManaCost:1 G
Types:Sorcery
Text:no text
A:SP$ Token | Cost$ 1 G | TokenAmount$ 1 | TokenName$ Elephant | TokenTypes$ Creature,Elephant | TokenOwner$ You | TokenColors$ Green | TokenPower$ X | TokenToughness$ X | TokenTriggers$ TrigPump | TokenSVars$ X | SubAbility$ DBComputerToken | SpellDescription$ Each player puts a green Elephant creature token onto the battlefield. Those creatures have "This creature's power and toughness are each equal to the number of creature cards in its controller's graveyard."
SVar:TrigPump:Mode$ Continuous | Affected$ Self | SetPower$ X | SetToughness$ X | CharacteristicDefining$ True
SVar:TrigPump2:Mode$ Continuous | Affected$ Self | SetPower$ Y | SetToughness$ Y | CharacteristicDefining$ True
SVar:DBComputerToken:DB$Token | TokenAmount$ 1 | TokenName$ Elephant | TokenTypes$ Creature,Elephant | TokenOwner$ Opponent | TokenColors$ Green | TokenPower$ Y | TokenToughness$ Y | TokenTriggers$ TrigPump2 | TokenSVars$ Y
SVar:X:Count$InYourYard.Creature
SVar:Y:Count$InOppYard.Creature
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/elephant_resurgence.jpg
End
I think to do this right you would need a keyword that you could give the token when its created. Because of the "those creatures" text, you need to apply the ability to the specific token instances created by the spell and not just all tokens that match the desired type. I haven't found a mechanism to do this with pump and continuous effects. I ran across this when I was trying to script Gilt-Leaf Ambush. I could give all Elf Warrior token deathtouch till end of turn but not just the ones created by the spell.
So many cards, so little time
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

Re: Card Development Questions

Postby jeffwadsworth » 03 Aug 2011, 19:21

ArsenalNut wrote:
jeffwadsworth wrote:Elephant Resurgence. Is there a way to get something like this to work currently?

| Open
Name:Elephant Resurgence
ManaCost:1 G
Types:Sorcery
Text:no text
A:SP$ Token | Cost$ 1 G | TokenAmount$ 1 | TokenName$ Elephant | TokenTypes$ Creature,Elephant | TokenOwner$ You | TokenColors$ Green | TokenPower$ X | TokenToughness$ X | TokenTriggers$ TrigPump | TokenSVars$ X | SubAbility$ DBComputerToken | SpellDescription$ Each player puts a green Elephant creature token onto the battlefield. Those creatures have "This creature's power and toughness are each equal to the number of creature cards in its controller's graveyard."
SVar:TrigPump:Mode$ Continuous | Affected$ Self | SetPower$ X | SetToughness$ X | CharacteristicDefining$ True
SVar:TrigPump2:Mode$ Continuous | Affected$ Self | SetPower$ Y | SetToughness$ Y | CharacteristicDefining$ True
SVar:DBComputerToken:DB$Token | TokenAmount$ 1 | TokenName$ Elephant | TokenTypes$ Creature,Elephant | TokenOwner$ Opponent | TokenColors$ Green | TokenPower$ Y | TokenToughness$ Y | TokenTriggers$ TrigPump2 | TokenSVars$ Y
SVar:X:Count$InYourYard.Creature
SVar:Y:Count$InOppYard.Creature
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/elephant_resurgence.jpg
End
I think to do this right you would need a keyword that you could give the token when its created. Because of the "those creatures" text, you need to apply the ability to the specific token instances created by the spell and not just all tokens that match the desired type. I haven't found a mechanism to do this with pump and continuous effects. I ran across this when I was trying to script Gilt-Leaf Ambush. I could give all Elf Warrior token deathtouch till end of turn but not just the ones created by the spell.
That is why the "Affected$ Self" is in there.
jeffwadsworth
Super Tester Elite
 
Posts: 1172
Joined: 20 Oct 2010, 04:47
Location: USA
Has thanked: 287 times
Been thanked: 70 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 53 guests

Main Menu

User Menu

Our Partners


Who is online

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

Login Form