Page 9 of 10
Re: Implementing new Ability Factories and Card Support Code

Posted:
17 Dec 2012, 08:53
by Agetian
kk I can think of a possible way out for the problem with CMC - maybe the code that queries CMC can also query the special "SplitCard" parameter in the script, and, if it exists, also call something like getCMC2() which will return the alternate CMC. It could even be a SVar or a set of SVars defining the properties of the card that are only applicable to split cards (secondary mana cost and secondary color come to mind). E.g.:
- Code: Select all
SVar:SplitCard:SecondaryColor$ Red | SecondaryManaCost$ 3 R
The problem here is mostly just knowing which spellabilities and stuff query CMC and colors in that way, to know where the code like that has to be hooked. Hooking it as such should not present a super major problem.
Does anybody have an idea or at least a short list "to begin with" (not necessarily comprehensive, just something to start with and to learn a bit more about what to look for in the code)?
- Agetian
Re: Implementing new Ability Factories and Card Support Code

Posted:
17 Dec 2012, 10:03
by Sloth
Agetian wrote:- Code: Select all
SVar:SplitCard:SecondaryColor$ Red | SecondaryManaCost$ 3 R
Yes, this should be enough info.
Example:
- Fire//Ice | Open
- Name:Fire//Ice
ManaCost:1 R
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.
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.
SVar:DBDraw:DB$Draw | Cost$ 0 | NumCards$ 1
SVar:SplitCard:SecondaryColor$ Blue | SecondaryManaCost$ 1 U
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 wrote:The problem here is mostly just knowing which spellabilities and stuff query CMC and colors in that way, to know where the code like that has to be hooked. Hooking it as such should not present a super major problem.
Does anybody have an idea or at least a short list "to begin with" (not necessarily comprehensive, just something to start with and to learn a bit more about what to look for in the code)?
I would start with the easy stuff. getColor should return all colors and getCMC should return the sum of both cmc's.
Re: Implementing new Ability Factories and Card Support Code

Posted:
17 Dec 2012, 10:18
by krevett
Just an idea, can getCMC return both cmc separately? That way you just need to alter scripts of problematic cards (
Counterbalance and
Dark Confidant come to mind) and check for the sVar Split card. If it's TRUE, you can check against both cmc for
Counterbalance and lose life for both cmc for
Dark Confidant.
I speak about those two cards because I think they are the most emblematic with split cards, but there's also
Isochron Scepter to consider (you can imprint a split card if one of the cmc is 2 or less and then play the card for any of its cmc)
I just post some supposition as I don't even know how java works

so perhaps I'm thinking the wrong way!
Edit: with the code posted by Sloth wouldn't the card be red when in hand? If that's the case that would cause a problem...
Re: Implementing new Ability Factories and Card Support Code

Posted:
17 Dec 2012, 11:20
by Agetian
Thanks for the suggestions, guys! I'll think it over and will get down to implementation!

- Agetian
Re: Implementing new Ability Factories and Card Support Code

Posted:
17 Dec 2012, 13:23
by friarsol
So I think the easiest way to handle this is to make some medium size changes in hasProperty().
Basically, in places that care about CMC we need to split it into totalCMC and regular old CMC.
totalCMC =
Dark Confidant/
Pyromancy, where it'll loop over all of the base spells on a card and tally up the CMC for each and compare via that value.
CMC =
Counterbalance, this will loop over all of the base spells on a card, and compare the value to each spell's CMC. If all of them don't succeed, return false.
I think this is much cleaner than a SplitCard SVar (which could be accidentally overwritten).
Re: Implementing new Ability Factories and Card Support Code

Posted:
17 Dec 2012, 13:41
by Sloth
friarsol wrote:totalCMC =
Dark Confidant/
Pyromancy, where it'll loop over all of the base spells on a card and tally up the CMC for each and compare via that value.
CMC =
Counterbalance, this will loop over all of the base spells on a card, and compare the value to each spell's CMC. If all of them don't succeed, return false.
I think this is much cleaner than a SplitCard SVar (which could be accidentally overwritten).
Scripts overwriting the SplitCard SVar shouldn't be there (and can easily be fixed). But i think there are effects that can clear all base spells (AF Animate and continuous static abilities).
Re: Implementing new Ability Factories and Card Support Code

Posted:
17 Dec 2012, 14:54
by Agetian
Here's one more question: if a card color of a split card becomes overridden by something (isColorOverridden returns true), e.g., I assume, by another effect that says "card becomes <color>", does it means that it should only show the overriding color (so, it temporarily/permanently, depending on the effect, becomes mono-colored and is of the overriding color)?
- Agetian
Re: Implementing new Ability Factories and Card Support Code

Posted:
17 Dec 2012, 15:12
by Agetian
And also, one more question that simply got me baffled: looks like there are two incompatible card color classes in Forge, forge.CardColor and forge.card.CardColor. I wanted the CardCharacteristics class to take care of the colors (basically, implement the second color as an extra card characteristic and implement getters/setters for that, to begin with), but I don't know how to properly convert the string representation of a mana cost (e.g. "3 B") to its forge.CardColor representation, which is something that is stored inside CardCharacteristics for the primary color (and I can't seem to find how even with the "Find Usages" feature of Netbeans on setColor(), both of the characteristics object and of the card object itself). I know of a way to create the forge.card.CardColor representation from a string representation of the mana cost, but then there's no way to convert to forge.CardColor, which means that two arrays (storing the main color and the secondary color) will be incompatible, which is definitely not something I want. Do you have any ideas how to approach this?...
- Agetian
Re: Implementing new Ability Factories and Card Support Code

Posted:
17 Dec 2012, 16:19
by friarsol
Sloth wrote:Scripts overwriting the SplitCard SVar shouldn't be there (and can easily be fixed). But i think there are effects that can clear all base spells (AF Animate and continuous static abilities).
While there are definitely cards that should clear all abilities
Humility etc, I can't think of any cards that clear Base Spells that doesn't replace them (like I do in
Animate Dead). Am I just missing some?
And I realized that the TotalCMC is more of a Count thing, so there shouldn't be a need to split anything up in hasProperty.
Re: Implementing new Ability Factories and Card Support Code

Posted:
17 Dec 2012, 16:57
by Agetian
Umm a Count thing? Can you please elaborate a bit on what you suggest for the implementation then?.. Thanks in advance!
- Agetian
Re: Implementing new Ability Factories and Card Support Code

Posted:
17 Dec 2012, 17:22
by Sloth
Agetian wrote:Umm a Count thing? Can you please elaborate a bit on what you suggest for the implementation then?.. Thanks in advance!
He means the xCount function with the parameter "CardManaCost" (used by
Dark Confidant for example).
Re: Implementing new Ability Factories and Card Support Code

Posted:
17 Dec 2012, 17:26
by friarsol
Agetian wrote:Umm a Count thing? Can you please elaborate a bit on what you suggest for the implementation then?.. Thanks in advance!
Like when scripts say Count$ CardManaCost (or something similar). It would still be as I said though if you were going the route I suggested (not if you do the SVar), where you loop through all the base spells and tally the CMC of each.
Re: Implementing new Ability Factories and Card Support Code

Posted:
17 Dec 2012, 17:33
by Agetian
Oh OK, gotcha. Thanks!
- Agetian
Re: Implementing new Ability Factories and Card Support Code

Posted:
22 Dec 2012, 05:27
by Agetian
OK, now that I feel a little bit better already, I'll hopefully be getting back to coding Forge and, as such, to my primary developer target outlined above (split cards), relatively shortly.
- Agetian
Re: Implementing new Ability Factories and Card Support Code

Posted:
22 Dec 2012, 07:59
by krevett
Glad to hear you're getting better before christmas!