The card class and the player class
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
6 posts
• Page 1 of 1
The card class and the player class
by Sloth » 30 Aug 2011, 13:22
My plan was to give keywords to players via continuous static abilities (Shroud, Hexproof, ?). This seems to be rather simple, since most of the structure is there already.
When I was working on this, I wondered if it would be helpful to get the card class and the player class in line as much as possible, mainly by adding isValid and hasProperty to the player class with the same syntax.
Is there any benefit in adding an ancestor class for both of them and overwrite functions like isValid, hasKeyword, canTarget, addDamage, ...?
When I was working on this, I wondered if it would be helpful to get the card class and the player class in line as much as possible, mainly by adding isValid and hasProperty to the player class with the same syntax.
Is there any benefit in adding an ancestor class for both of them and overwrite functions like isValid, hasKeyword, canTarget, addDamage, ...?
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: The card class and the player class
by friarsol » 30 Aug 2011, 14:00
Yea I think there's a bunch of benefit in adding a parent class for Cards and Players. I'd call these "GameObjects" but that's not really a great name.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: The card class and the player class
by Sloth » 30 Aug 2011, 14:14
I think "GameObjects" is not so bad.friarsol wrote:Yea I think there's a bunch of benefit in adding a parent class for Cards and Players. I'd call these "GameObjects" but that's not really a great name.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: The card class and the player class
by Rob Cashwalker » 30 Aug 2011, 16:19
GameEntity?
Might also help to make Planeswalkers operate closer to the rules.
Might also help to make Planeswalkers operate closer to the rules.
The Force will be with you, Always.
-
Rob Cashwalker - Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: The card class and the player class
by Sloth » 30 Aug 2011, 16:55
GameEntity might be better, because object actually has a meaning in the comprehensive rules.Rob Cashwalker wrote:GameEntity?
Might also help to make Planeswalkers operate closer to the rules.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: The card class and the player class
by Sloth » 01 Sep 2011, 15:26
I've added the GameEntity class as parent of Card and Player class. There's a lot of room to expand and use it. I guess the targeting code can be done a little more elegant with this (I haven't looked that much at targeting though).
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: Google Adsense [Bot] and 27 guests