[WIP] Split Cards Support
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: [WIP] Split Cards Support
by Max mtg » 03 Mar 2013, 18:02
see r20005
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
by Max mtg » 03 Mar 2013, 18:04
Next, you have to transform the card into its left or right side as it reaches stack
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
by Agetian » 03 Mar 2013, 18:20
@ Max: Thanks a lot for assistance! kk, will get on with the next goal very soon (hopefully tomorrow).
- Agetian
- Agetian
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: [WIP] Split Cards Support
by Agetian » 04 Mar 2013, 06:52
Ok, the implementation of transformation of the split card into one of its two faces seems to work correctly (r20020). I had to add an extra SA parameter to the script in order for it to work (the left side of the split now has "SplitSide$ LeftSplit" specified, and the right side of the split now has "SplitSide$ RightSplit" specified). Not sure how to do it in a better way, but it works with this setup and seems to work correctly. If the parameter is not present in the script, the game will display an error debug message to System.out and will throw the full split card face onto the stack (I'm not sure if maybe throwing an exception is a better idea?)
As far as I understand, if this part of the implementation works thus far (I mean, the combined face + individual splits thrown onto stack), it's time to deal with the idiosyncrasies of split cards such as the CMC, right? I have a few ideas but I need a consultation:
I thought of overloading getCMC in such a fashion that, when it's called the way it is right now, it functions just the way it does right now (so we don't need to go over all the individual calls to reimplement them differently). However, if it takes an extra parameter, depending on its value, it can return either the combined mana cost of both split sides or the mana cost of a particular split card side (so that it can be called twice in succession to get "two answers" for two split sides where necessary). In that case, we may have to only rewrite the calls to getCMC that actually interact with split cards in one way or another. I'm not sure if this is viable enough, but if you have better ideas, I'm open to suggestions!
Also, the bigger part of the problem is that I'm not sure how exactly to understand which calls should be jury-rigged to get more than one response and which ones shouldn't... can you please tell me how I should determine which calls to getCMC should actually be able to produce different responses for split cards?
P.S. Starting with r20022 I revert the state of the split card to the original full face before the card reaches the graveyard. Please let me know if this is correct behavior. Also, in r20023, I added a similar back-transformation for exiling the card, not sure if it can ever be exiled while on stack, so if it can't, feel free to revert or let me know so that I can revert it.
- Agetian
As far as I understand, if this part of the implementation works thus far (I mean, the combined face + individual splits thrown onto stack), it's time to deal with the idiosyncrasies of split cards such as the CMC, right? I have a few ideas but I need a consultation:
I thought of overloading getCMC in such a fashion that, when it's called the way it is right now, it functions just the way it does right now (so we don't need to go over all the individual calls to reimplement them differently). However, if it takes an extra parameter, depending on its value, it can return either the combined mana cost of both split sides or the mana cost of a particular split card side (so that it can be called twice in succession to get "two answers" for two split sides where necessary). In that case, we may have to only rewrite the calls to getCMC that actually interact with split cards in one way or another. I'm not sure if this is viable enough, but if you have better ideas, I'm open to suggestions!

P.S. Starting with r20022 I revert the state of the split card to the original full face before the card reaches the graveyard. Please let me know if this is correct behavior. Also, in r20023, I added a similar back-transformation for exiling the card, not sure if it can ever be exiled while on stack, so if it can't, feel free to revert or let me know so that I can revert it.
- Agetian
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: [WIP] Split Cards Support
by Max mtg » 04 Mar 2013, 07:13
http://svn.slightlymagic.net/websvn/dif ... &peg=20020Agetian wrote:Ok, the implementation of transformation of the split card into one of its two faces seems to work correctly (r20020). I had to add an extra SA parameter to the script in order for it to work (the left side of the split now has "SplitSide$ LeftSplit" specified, and the right side of the split now has "SplitSide$ RightSplit" specified). Not sure how to do it in a better way, but it works with this setup and seems to work correctly. If the parameter is not present in the script, the game will display an error debug message to System.out and will throw the full split card face onto the stack (I'm not sure if maybe throwing an exception is a better idea?)
- Agetian
You may just search the matching ability on each side of card, and transform into the one that would have it.
As you may have noted, the abilities from each face are copied by reference to the combined face, so that they can be checked for equlality with plain == operator. That won't have you mantain that extra parameter of "SplitSide"
You asked, if a card can be exiled from stack - yes, it's possible (Mindbreak Trap)
I think it's correct to transform card back to 'original' state when it hits any zone other than stack.
Check also that card is transformed back to original when the mana cost payment is cancelled and the card returns to hand
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
by Agetian » 04 Mar 2013, 08:00
- Agetian
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: [WIP] Split Cards Support
by Agetian » 04 Mar 2013, 08:10
Ok, done and done - the split card is now correctly back-transformed in all known zone movement and cancelation cases except when going to stack.
- Agetian
- Agetian
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: [WIP] Split Cards Support
by Agetian » 04 Mar 2013, 08:34
r20027: Now, the spell ability parameter SplitSide is no longer required, the spell ability is determined by testing for equality. Also, the NPE related to the process of back-transformation of split cards is fixed. The split card correctly returns to its initial state when moved to graveyard/exile/hand/etc. and when the targeting or mana cost payment is canceled.
- Agetian
- Agetian
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: [WIP] Split Cards Support
by Agetian » 04 Mar 2013, 14:53
There's one more major series of commits related to full update of all cards in the trunk, what should I do with it? Should I merge it one revision by one so that it can later be reintegrated into trunk one by one or can I merge them all into one large commit? Not sure what would be the best option given that earlier I had problems merging everything at once into SplitCards...
- Agetian
- Agetian
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: [WIP] Split Cards Support
by Chris H. » 04 Mar 2013, 15:21
Agetian wrote:Should I merge it one revision by one so that it can later be reintegrated into trunk one by one
I plan to do it this way myself.
-
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: [WIP] Split Cards Support
by Agetian » 04 Mar 2013, 15:24
@ Chris: Thanks a lot for help, Chris! I'd appreciate that!
- Agetian
- Agetian
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: [WIP] Split Cards Support
by Chris H. » 04 Mar 2013, 15:50
Agetian wrote:@ Chris: Thanks a lot for help, Chris! I'd appreciate that!
- Agetian
I just finished updating and am now at the head revision 20070. I am just a point and click sort of guy and updated using Eclipse.
There may be a way to update one rev at a time using a terminal command/script that increments the rev number.
-
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: [WIP] Split Cards Support
by Agetian » 04 Mar 2013, 15:52
@ Chris: updating is not a problem (just within trunk) but it's a major problem for merging (and, I assume, reintegrating later)... would it be possible for you to assist me in merging those revisions into SplitCards or would you like me to try and proceed on my own? I'm afraid I can ruin something, either now or in the long run.
- Agetian
- Agetian
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: [WIP] Split Cards Support
by Chris H. » 04 Mar 2013, 16:15
Agetian wrote:@ Chris: updating is not a problem (just within trunk) but it's a major problem for merging (and, I assume, reintegrating later)... would it be possible for you to assist me in merging those revisions into SplitCards or would you like me to try and proceed on my own? I'm afraid I can ruin something, either now or in the long run.
- Agetian
I would be happy to help but I am afraid that my knowledge level is fairly low.

It looks like you have gotten up to r20045 and resolved any conflicts so as to keep your own code mods.
I would assume that the later revs are dealing only with the card files but I guess that you have a few split cards as part of your branch and are concerned about resolving these conflicts in the later rev numbers?
I can understand that you want to be careful in order not to have to start up a new branch again and lose your existing branch work.
-
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: [WIP] Split Cards Support
by Agetian » 04 Mar 2013, 16:41
@ Chris: Yeah, basically it's too far into coding already to be lost. I can try merging one revision by one though, see how that goes.
- Agetian
- Agetian
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Who is online
Users browsing this forum: No registered users and 31 guests