Page 1 of 1

CardCharacteristics containing SVars

PostPosted: 20 Nov 2011, 13:41
by Sloth
At the moment CardCharacteristics contains SVars so they get overwritten whenever a card changes state, but some SVars need to persist through cards changing state: For example AF Animate can grant SVars that belong to granted abilities, Warbreak Trumpeter needs "SVar:X:Count$xPaid" while morphed and there might be cards that need the SVar ChosenX in multiple states.

Can we simply remove SVars from CardCharacteristics or are there any SVars that cause problems when they persist through a card state change?

Re: CardCharacteristics containing SVars

PostPosted: 20 Nov 2011, 14:02
by Hellfish
Nah, should be fine. Some cards have the samenamed SVar in both states but that's an easy fix. I'll get right on it.

EDIT: On second thoughts, LQ picture URL SVars are different for each state.. :S

Re: CardCharacteristics containing SVars

PostPosted: 21 Nov 2011, 08:32
by Sloth
Good point, Hellfish. So basically there are SVars that should be copied and some which should have seperate values. :(

I came up with two possible solutions, one is easy to implement, the other will look cleaner:
1. Easy solution: setState will copy all SVars from the old cardCharacteristic to the new one with the exception of LQPic and Rarity (and maybe some selected others).

2. Cleaner solution: We differentiate our SVars. We give LQPic and Rarity a new type like CVars or something.

I can implement solution 1 without problems, but for solution 2 I would need some help (i.e. writing a script that replaces "SVar:Picture:" with "CVar:Picture:" and uploading 9700+ txt files).

Re: CardCharacteristics containing SVars

PostPosted: 21 Nov 2011, 08:41
by Hellfish
Another option is to eliminate the Rarity SVar altogether (it's not referenced in code anywhere that I can see) and change the only place that uses the Picture SVar (the LQ Picture Downloader) to grab all SVars whose name starts with Picture. I think this makes the most sense, since it only requires immediate change on DFCs and Flips and the Rarity SVar can later be incrementally eliminated.

Re: CardCharacteristics containing SVars

PostPosted: 21 Nov 2011, 12:49
by Sloth
Sounds like a plan. Will you give it a try Hellfish?

Re: CardCharacteristics containing SVars

PostPosted: 21 Nov 2011, 16:27
by Hellfish
Done! :)

Re: CardCharacteristics containing SVars

PostPosted: 21 Nov 2011, 21:16
by Sloth
Thanks Hellfish. At least Warbreak Trumpeter is fixed now.