It is currently 09 Sep 2025, 17:26
   
Text Size

[WIP] Split Cards Support

Post MTG Forge Related Programming Questions Here

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

Re: [WIP] Split Cards Support

Postby Agetian » 20 Feb 2013, 13:53

@ Sloth: Umm no I was using the NetBeans internal Subversion support facilities, they are working fine at least as far as working with trunk itself goes... Ok, I'll try again. If it fails, should I switch to using TortoiseSVN?

@ Max Mtg: Thanks for the changes, they're definitely going to be an important part of this!

- Agetian
Agetian
Programmer
 
Posts: 3489
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: [WIP] Split Cards Support

Postby friarsol » 20 Feb 2013, 14:50

Agetian wrote:@ Sloth: Umm no I was using the NetBeans internal Subversion support facilities, they are working fine at least as far as working with trunk itself goes... Ok, I'll try again. If it fails, should I switch to using TortoiseSVN?
Since I just merged the branch, there may not be much to merge. But I did it using Tortoise (which is much better than an IDE plugin)
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: [WIP] Split Cards Support

Postby Agetian » 20 Feb 2013, 15:26

I tried the internal plugin and it failed again, so I'm currently merging the branch using TortoiseSVN, so far it works fine - it's weird but it shows a lot of files to be merged, by the way... not sure if that's an error or not, but seeing no commits in the SplitCards branch that are related to merging, maybe you did not commit the merge or something like that?... Anyhow, will finish this merge and will see what happens.

- Agetian
Agetian
Programmer
 
Posts: 3489
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: [WIP] Split Cards Support

Postby friarsol » 20 Feb 2013, 15:30

Agetian wrote:not sure if that's an error or not, but seeing no commits in the SplitCards branch that are related to merging, maybe you did not commit the merge or something like that?...
Ahh could be, I was doing it on the way off to work, so I may not have actually pushed it through. It sounded like the actual merging wasn't working for you, so glad that's resolved. I'll make sure to revert the merge on my local machine just in case.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: [WIP] Split Cards Support

Postby Max mtg » 21 Feb 2013, 12:52

Please, can anyone provide any Split card scripted - for tests and further research?
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: [WIP] Split Cards Support

Postby friarsol » 21 Feb 2013, 13:11

Max mtg wrote:Please, can anyone provide any Split card scripted - for tests and further research?
While we haven't discussed all the specifics about how a card script might look, here is how I picture them.

Code: Select all
Name:Assault/Battery
ManaCost:R/3 G
Types:Sorcery
A:SP$ DealDamage | Cost$ R | NumDmg$ 2 | ValidTgts$ Creature,Player | SpellDescription$ Assault deals 2 damage to target creature or player.
A:SP$ Token | Cost$ 3 G | TokenAmount$ 1 | TokenName$ Elephant| TokenTypes$ Creature,Elephant| TokenOwner$ You | TokenColors$ Green | TokenPower$ 3 | TokenToughness$ 3 | TokenImage$ g 3 3 elephant | SpellDescription$ Put a 3/3 green Elephant creature token onto the battlefield.
End
We'd probably have something inside each spell to say that it's a split face.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: [WIP] Split Cards Support

Postby Agetian » 21 Feb 2013, 13:35

Yeah, I believe each of the SP$ lines can have an extra parameter, like a SVar or something, that will determine that it's a part of the split card face. Then, the necessary routines (e.g. getCMC) can pick that information and return the required part of the mana cost or the combined mana cost depending on the situation.

P.S. It's unlikely that I'll be able to start active coding this week (at least until Sunday), but the weekend and the next week seem like a feasible option for some coding. ;)

EDIT:
Here's another script of a split card which I dug from the previous materials I was provided with, sadly, I don't remember who the author was... I updated it a bit to show the possibilities of how to determine that the spell abilities are parts of a split card face etc.

Code: Select all
Name:Fire//Ice
ManaCost:1 R / 1 U
Types:Instant
Text:no text
A:SP$ Effect | Cost$ 1 R | SP$ DealDamage | ValidTgts$ Creature,Player | TgtPrompt$ Select target creature or player (1) | NumDmg$ 1 | SubAbility$ DBDamage2 | SpellDescription$ Fire deals 2 damage divided as you choose among one or two target creatures and/or players. | SplitCardFace$ True
SVar:DBDamage2:DB$DealDamage | Cost$ 0 | ValidTgts$ Creature,Player | TgtPrompt$ Select target creature or player (2) | NumDmg$ 1
A:SP$ Effect | Cost$ 1 U | SP$ Tap | ValidTgts$ Permanent | TgtPrompt$ Select target permanent | SubAbility$ DBDraw | SpellDescription$ Tap target permanent. Draw a card. | SplitCardFace$ True
SVar:DBDraw:DB$Draw | Cost$ 0 | NumCards$ 1
SVar:RemAIDeck:True
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/fire_ice.jpg
SetInfo:APC|Uncommon|http://magiccards.info/scans/en/ap/128.jpg
Oracle: Fire deals 2 damage divided as you choose among one or two target creatures and/or players.|| Tap target permanent. Draw a card.
End
- Agetian
Last edited by Agetian on 21 Feb 2013, 13:53, edited 1 time in total.
Agetian
Programmer
 
Posts: 3489
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: [WIP] Split Cards Support

Postby Max mtg » 21 Feb 2013, 13:51

Thanks for the example.
That was an excellent starting point!

Code: Select all
Name:Assault
ManaCost:R
AlternateMode: Split
Types:Sorcery
A:SP$ DealDamage | Cost$ R | NumDmg$ 2 | ValidTgts$ Creature,Player | SpellDescription$ Assault deals 2 damage to target creature or player.
SetInfo:INV|Uncommon|http://magiccards.info/scans/en/in/295a.jpg
Oracle:Assault deals 2 damage to target creature or player.

ALTERNATE

Name:Battery
ManaCost:3 G
Types:Sorcery
A:SP$ Token | Cost$ 3 G | TokenAmount$ 1 | TokenName$ Elephant| TokenTypes$ Creature,Elephant| TokenOwner$ You | TokenColors$ Green | TokenPower$ 3 | TokenToughness$ 3 | TokenImage$ g 3 3 elephant | SpellDescription$ Put a 3/3 green Elephant creature token onto the battlefield.
SetInfo:INV|Uncommon|http://magiccards.info/scans/en/in/295b.jpg
Oracle:Put a 3/3 green Elephant creature token onto the battlefield.
    End
This is however what CardDb expects to see.


The game crashes now it setinfo is missing. I should replace that with a warning, that such cards will be unobtainable from carddb and skip them creating CardPrinted instances
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: [WIP] Split Cards Support

Postby Agetian » 21 Feb 2013, 14:01

Oh, that looks like a highly reasonable implementation to utilize the similar script format for the split cards as for the flip/transforming cards. Isn't it critical though that these cards are obtainable from CardDb like any other?.. (I mean, a lot of game facilities are using CardDb...)

- Agetian
Agetian
Programmer
 
Posts: 3489
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: [WIP] Split Cards Support

Postby Max mtg » 21 Feb 2013, 14:04

Agetian wrote:Yeah, I believe each of the SP$ lines can have an extra parameter, like a SVar or something, that will determine that it's a part of the split card face. Then, the necessary routines (e.g. getCMC) can pick that information and return the required part of the mana cost or the combined mana cost depending on the situation.
That is why ALTERNATE Syntax must be used.

Agetian wrote:P.S. It's unlikely that I'll be able to start active coding this week (at least until Sunday), but the weekend and the next week seem like a feasible option for some coding. ;)
That is good. I'll tie everything to the format using alternates. :)

Agetian wrote:EDIT:
Here's another script of a split card which I dug from the previous materials I was provided with, sadly, I don't remember who the author was... I updated it a bit to show the possibilities of how to determine that the spell abilities are parts of a split card face etc.
Just use the alternate sides to distinguish.
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: [WIP] Split Cards Support

Postby Agetian » 21 Feb 2013, 14:05

Ok, sounds awesome! And yeah, I like the ALTERNATE approach much more than the spell parameter approach! Good call!

- Agetian
Agetian
Programmer
 
Posts: 3489
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: [WIP] Split Cards Support

Postby Max mtg » 21 Feb 2013, 14:05

Agetian wrote:Isn't it critical though that these cards are obtainable from CardDb like any other?.. (I mean, a lot of game facilities are using CardDb...)
It is critical if card has no setinfo and is not registered in CardDb
You won't be able to add such card into a deck and start game with it.

The split card will be obatinable from Db only by names like 'Assault // Battery'. There is no way to query an individual part (or backside or a transformable card) - that is a bug by the way, since Pithing Needle users won't be able to name Garruk's back side. But that is to be fixed on the scope of api responsible 'name card'.
Last edited by Max mtg on 21 Feb 2013, 14:17, edited 3 times in total.
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: [WIP] Split Cards Support

Postby Max mtg » 21 Feb 2013, 14:10

Agetian wrote:Then, the necessary routines (e.g. getCMC) can pick that information and return the required part of the mana cost or the combined mana cost depending on the situation.
I've been thinking about this.

Since Cards already support different states (like 'transformed'), I suggest such a split card gets changed into one of its halves' state as it is put onto stack.
The initial 'combined' state is to be built programmatically by the card factory

Looks like manacost is the only problematic part here. The queries for other characteristics returning 'two answers' can return a result which aggregates the ones of both parts - should work fine for color, types.
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: [WIP] Split Cards Support

Postby Agetian » 21 Feb 2013, 14:23

Yeah, that sounds quite optimal! I'd say we should stick to this idea. Thanks for looking into it, Max!

- Agetian
Agetian
Programmer
 
Posts: 3489
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: [WIP] Split Cards Support

Postby Max mtg » 22 Feb 2013, 09:01

Ok, get 19818, 19819 (and any bugfixes for them)
There you'll find split cards working in deck editor and you'll find a starting point in CardFactory class to build split cards' 'original' characteristics set.

I finish my work here, since have only promised to adapt CardDb and its dependent classes, and I already have done more than this.
Attachments
assault__battery.txt
The script
(899 Bytes) Downloaded 275 times
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 74 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 74 users online :: 0 registered, 0 hidden and 74 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 74 guests

Login Form