Splitting GameActionUtil
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Splitting GameActionUtil
by DennisBergkamp » 10 Nov 2009, 18:19
Another big file is GameActionUtil (I've been adding some new cards and mechanics to this file, my local file is over 11,000 lines now).
Splitting this should be much easier than CardFactory. But how do you guys think it should be split up?
GameActionUtil currently consists of:
- Upkeep effects (lots of code)
- "Play card" effects (Standstill, Gilt-Leaf Archdruid, Sigil of the Empty Throne, etc.)
- "Draw Triggered" effects (currently only 3 cards: Niv-Mizzet, Hoofprints of the Stag and Lorescale Coatl - but this will most likely grow as well
- Some misc stuff: exalted, lifelink, a check to see if Rafiq of the Many is in play, "vampiric effects" (Sengir Vampire, ...), Guilty Conscience triggers, ... not even sure if these should be in this file.
- Ally effects
- Landfall effects
- "Destroy card" effects, this is what I've been playing around with, I've added cards like Fecundity, Dingus Egg, Dingus Staff, Goblin Sharpshooter and Dauthi Ghoul
- "Player combat damage" effects (Shadowmage Infiltrator, Hypnotic Specter, etc.)
- Last but not least, State Based Effects (Glorious Anthem, Goblin King, Nightmare, Engineered Plague, Fervor, etc.) which I think takes up most of the code.
What do you guys think? Should it be split up in 7 - 8 parts ? Or maybe for now just split the Upkeep, State Based Effects and the rest into three separate files?
Splitting this should be much easier than CardFactory. But how do you guys think it should be split up?
GameActionUtil currently consists of:
- Upkeep effects (lots of code)
- "Play card" effects (Standstill, Gilt-Leaf Archdruid, Sigil of the Empty Throne, etc.)
- "Draw Triggered" effects (currently only 3 cards: Niv-Mizzet, Hoofprints of the Stag and Lorescale Coatl - but this will most likely grow as well
- Some misc stuff: exalted, lifelink, a check to see if Rafiq of the Many is in play, "vampiric effects" (Sengir Vampire, ...), Guilty Conscience triggers, ... not even sure if these should be in this file.
- Ally effects
- Landfall effects
- "Destroy card" effects, this is what I've been playing around with, I've added cards like Fecundity, Dingus Egg, Dingus Staff, Goblin Sharpshooter and Dauthi Ghoul
- "Player combat damage" effects (Shadowmage Infiltrator, Hypnotic Specter, etc.)
- Last but not least, State Based Effects (Glorious Anthem, Goblin King, Nightmare, Engineered Plague, Fervor, etc.) which I think takes up most of the code.
What do you guys think? Should it be split up in 7 - 8 parts ? Or maybe for now just split the Upkeep, State Based Effects and the rest into three separate files?
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Splitting GameActionUtil
by Marek14 » 10 Nov 2009, 21:38
Well, "State-Based Effects" is a bad name here (it means something different), better just call them "static effects". I think they should be definitely separate.DennisBergkamp wrote:Another big file is GameActionUtil (I've been adding some new cards and mechanics to this file, my local file is over 11,000 lines now).
Splitting this should be much easier than CardFactory. But how do you guys think it should be split up?
GameActionUtil currently consists of:
- Upkeep effects (lots of code)
- "Play card" effects (Standstill, Gilt-Leaf Archdruid, Sigil of the Empty Throne, etc.)
- "Draw Triggered" effects (currently only 3 cards: Niv-Mizzet, Hoofprints of the Stag and Lorescale Coatl - but this will most likely grow as well
- Some misc stuff: exalted, lifelink, a check to see if Rafiq of the Many is in play, "vampiric effects" (Sengir Vampire, ...), Guilty Conscience triggers, ... not even sure if these should be in this file.
- Ally effects
- Landfall effects
- "Destroy card" effects, this is what I've been playing around with, I've added cards like Fecundity, Dingus Egg, Dingus Staff, Goblin Sharpshooter and Dauthi Ghoul
- "Player combat damage" effects (Shadowmage Infiltrator, Hypnotic Specter, etc.)
- Last but not least, State Based Effects (Glorious Anthem, Goblin King, Nightmare, Engineered Plague, Fervor, etc.) which I think takes up most of the code.
What do you guys think? Should it be split up in 7 - 8 parts ? Or maybe for now just split the Upkeep, State Based Effects and the rest into three separate files?
As for draw triggers, other possible cards for them are Diviner's Wand, Moonring Mirror, Kederekt Parasite, Mind's Eye, Phyrexian Tyranny, Psychic Possession, Spiteful Visions, Underworld Dreams
Re: Splitting GameActionUtil
by DennisBergkamp » 10 Nov 2009, 22:09
Ah, you're right! Wow, I even made a class called "StateBasedEffects.java" which keeps track of these "static effects". I guess I completely misnamed it
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Splitting GameActionUtil
by zerker2000 » 11 Nov 2009, 02:47
Is it just me or should "some misc stuff" be moved to Combat?
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
- zerker2000
- Programmer
- Posts: 569
- Joined: 09 May 2009, 21:40
- Location: South Pasadena, CA
- Has thanked: 0 time
- Been thanked: 0 time
Re: Splitting GameActionUtil
by Rob Cashwalker » 11 Nov 2009, 16:11
I think it should be completely blown away.
Each individual card's code should be translated into an Execute method of a Command object, defined in CardFactory_{Type}. This Command is assigned to an array of Commands defined by the card. Whenever the state effects code would have executed the code it once contained it instead calls the execute method of the appropriate command for the card.
Each individual card's code should be translated into an Execute method of a Command object, defined in CardFactory_{Type}. This Command is assigned to an array of Commands defined by the card. Whenever the state effects code would have executed the code it once contained it instead calls the execute method of the appropriate command for the card.
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: Splitting GameActionUtil
by DennisBergkamp » 11 Nov 2009, 18:40
Yes, this would be ideal. I will start messing around with this and move some of the code into Commands.
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Splitting GameActionUtil
by zerker2000 » 12 Nov 2009, 02:42
"Drat, foiled again!": I do remember thinking along the exact same lines, but ended up not posting for some reason .
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
- zerker2000
- Programmer
- Posts: 569
- Joined: 09 May 2009, 21:40
- Location: South Pasadena, CA
- Has thanked: 0 time
- Been thanked: 0 time
Re: Splitting GameActionUtil
by Rob Cashwalker » 12 Nov 2009, 14:38
this approach would open up the ability to keyword static pumps and other standardized static effects.
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
8 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 109 guests