Cost Reorganization
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
49 posts
• Page 3 of 4 • 1, 2, 3, 4
Re: Cost Reorganization
by Braids » 26 Aug 2011, 23:16
of course, the definitive solution would be to use vector graphics for all symbols and have them anti-aliased at run time. except for the card images, resizing would always look perfect.



"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something. 

-
Braids - Programmer
- Posts: 556
- Joined: 22 Jun 2011, 00:39
- Location: Unknown. Hobby: Driving myself and others to constructive madness.
- Has thanked: 1 time
- Been thanked: 1 time
Re: Cost Reorganization
by ArsenalNut » 27 Aug 2011, 00:13
Sol,
How hard would it be to add color restrictions to the x cost? I was looking at Consume Spirit and the only thing keeping it from being scriptable is the black mana restriction for the x cost. I found six other cards the have similar restrictions.
How hard would it be to add color restrictions to the x cost? I was looking at Consume Spirit and the only thing keeping it from being scriptable is the black mana restriction for the x cost. I found six other cards the have similar restrictions.
So many cards, so little time
-
ArsenalNut - Posts: 512
- Joined: 08 Jul 2011, 03:49
- Has thanked: 27 times
- Been thanked: 121 times
Re: Cost Reorganization
by moomarc » 27 Aug 2011, 00:48
Which vector formats are supported in java?Braids wrote:of course, the definitive solution would be to use vector graphics for all symbols and have them anti-aliased at run time. except for the card images, resizing would always look perfect.![]()
-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: Cost Reorganization
by Braids » 27 Aug 2011, 01:50
it looks like SVG is an XML format that certain Java libraries can handle alongside the standard swing GUI toolkit.moomarc wrote:Which vector formats are supported in java?Braids wrote:of course, the definitive solution would be to use vector graphics for all symbols and have them anti-aliased at run time. except for the card images, resizing would always look perfect.![]()
http://juixe.com/techknow/index.php/2007/05/29/swing-vector-graphics/
http://xmlgraphics.apache.org/batik/using/swing.html
http://java.sun.com/developer/technicalArticles/GUI/svg/
edit: @moomarc, are you familiar with exporting to SVG?
edit2: the problem is, this will tax the CPU more. but it wouldn't be as taxing as a 3D interface, which i would strongly oppose.
"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something. 

-
Braids - Programmer
- Posts: 556
- Joined: 22 Jun 2011, 00:39
- Location: Unknown. Hobby: Driving myself and others to constructive madness.
- Has thanked: 1 time
- Been thanked: 1 time
Re: Cost Reorganization
by friarsol » 27 Aug 2011, 03:00
I can look into it, but I'm not sure. X can't be 0. Should be pretty simple, since I can cancel a spell that doesn't pay X properly, but Paying Mana doesn't actually occur in Cost, it happens in Input_PayManaCostUtil (which is overly complex and someone should refactor it). This would basically need to check for Mana limitations and apply them to the possible valid colors.ArsenalNut wrote:Sol,
How hard would it be to add color restrictions to the x cost? I was looking at Consume Spirit and the only thing keeping it from being scriptable is the black mana restriction for the x cost. I found six other cards the have similar restrictions.
Ugh. On second thought, I don't really want to look into it. Maybe after I clear a few other things off my plate.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Cost Reorganization
by Chris H. » 27 Aug 2011, 03:08
`ArsenalNut wrote:I've noticed that the summoning sickness icon doesn't seem to show up until I have three or four permanents on the battlefield. Is this a related issue?
Edit: My screen resolution is set at 1900x1080
Your monitor is close to the same size as mine. You are seeing the same thing that I noticed.
Once there are several cards on the screen the pic size is scaled down small enough that it passes a test and the summoning sickness icon is drawn.
-
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: Cost Reorganization
by Sloth » 05 Sep 2011, 12:30
Sorry to bring up this thread again, but I noticed today that the CostChange keyword doesn't work anymore. Could it be rellated to you're work Sol?
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Cost Reorganization
by friarsol » 05 Sep 2011, 13:12
I'm not sure. I always thought CostChange didn't work very consistently. (And was secretly hoping it would be nominated for the next Static Ability). I can take a look at some point and see what it's trying to do.Sloth wrote:Sorry to bring up this thread again, but I noticed today that the CostChange keyword doesn't work anymore. Could it be rellated to you're work Sol?
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Cost Reorganization
by Sloth » 05 Sep 2011, 13:28
I think it's the last keyword BeachedAs left us behind with. It definitely has to be rewritten at some point.friarsol wrote:I'm not sure. I always thought CostChange didn't work very consistently. (And was secretly hoping it would be nominated for the next Static Ability). I can take a look at some point and see what it's trying to do.Sloth wrote:Sorry to bring up this thread again, but I noticed today that the CostChange keyword doesn't work anymore. Could it be rellated to you're work Sol?

-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Cost Reorganization
by Sloth » 05 Sep 2011, 19:13
I did some testing and it looks like getSpellCostChange doesn't get used when I cast a spell.
I actually think about rewriting this (using static effect), but the function will basically stay the same (the params being a spellability and a manacost and returning a manacost). Maybe you can take a look at your cost code Sol and find out, if that is still the best solution.
I actually think about rewriting this (using static effect), but the function will basically stay the same (the params being a spellability and a manacost and returning a manacost). Maybe you can take a look at your cost code Sol and find out, if that is still the best solution.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Cost Reorganization
by Sloth » 05 Sep 2011, 20:12
I just did a test for the AI and cost change works (at least Sphere of Resistance and Frogmite).
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Cost Reorganization
by friarsol » 05 Sep 2011, 22:22
I think the functions staying the same is ok for now, we can improve things on the Cost side as a separate portion.
I see Cost_Payment.changeCost() being called from playSpellAbility(). And it seems like that's the path a Spell would come down? It's possible the new CostMana handles the CostChange just enough differently to not be functional, so I think you may be right that this is where the issue arises from. I can put the UnlessCost stuff on hold and see if I can get it resolved next.
Edit: Ah I see the issue. I grab the adjustedMana amount, but never actually use it for anything. Fix coming soon. I believe we still suffer from the issue where CostChanging doesn't add to X Mana Costs, but that's something we can look into once it's rewritten.
I see Cost_Payment.changeCost() being called from playSpellAbility(). And it seems like that's the path a Spell would come down? It's possible the new CostMana handles the CostChange just enough differently to not be functional, so I think you may be right that this is where the issue arises from. I can put the UnlessCost stuff on hold and see if I can get it resolved next.
Edit: Ah I see the issue. I grab the adjustedMana amount, but never actually use it for anything. Fix coming soon. I believe we still suffer from the issue where CostChanging doesn't add to X Mana Costs, but that's something we can look into once it's rewritten.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Cost Reorganization
by Max mtg » 05 Sep 2011, 23:24
http://svn.slightlymagic.net/websvn/dif ... &peg=10263
Use "0".equals(mana) instead
A simple console app to check this out:
- Code: Select all
if (mana != "0") { // 11/15/10 use getTotalMana() to account for X reduction
Use "0".equals(mana) instead
A simple console app to check this out:
- Code: Select all
class ExampleProgram {
public static void main(String[] args) throws java.io.IOException {
System.out.print("Type s: ");
char c = (char) System.in.read();
String s = new String(new char[]{c});
System.out.println("I'm a Simple Program");
System.out.println( "\"0\".equals(s) => " + "0".equals(s));
System.out.println( "\"0\" == s => "+ ("0" == s));
}
}
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: Cost Reorganization
by Sloth » 06 Sep 2011, 08:38
I've tested in R10278 and CostChange still isn't applied (tested Sphere of Resistance, Frogmite and Animar, Soul of Elements).
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Cost Reorganization
by friarsol » 07 Sep 2011, 02:30
Ah, I missed the ! sign when switching to the .equals() statement. I just tested it and it works again. The only thing that doesn't work is for cards with ManaCost = 0. This is because no Mana element exists in the cost currently.Sloth wrote:I've tested in R10278 and CostChange still isn't applied (tested Sphere of Resistance, Frogmite and Animar, Soul of Elements).
Not sure the best way to handle this quite yet, but I'll get back to it soon.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
49 posts
• Page 3 of 4 • 1, 2, 3, 4
Who is online
Users browsing this forum: No registered users and 45 guests