Reflecting Pool: Is this keyword worthwhile?
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
10 posts
• Page 1 of 1
Reflecting Pool: Is this keyword worthwhile?
by jim » 08 Apr 2010, 01:03
So I've been playing in my local copy with an implementation of Reflecting Pool. It occurred to me that nearly the same code ought to be useful to implement Fellwar Stone and Exotic Orchard, and I am presently planning to make this my first attempt to add a keyword. It would probably look something like
abAddManaLandProduces:$You (for Reflecting Pool)
abAddManaLandProduces:$Opp (for Exotic Orchard)
Plus there has to be some differentiator to cover the fact that Reflecting pool can add colorless and Exotic Orchard can't. According to Gatherer, there are 3 green creatures (Harvester Druid, Quirion Explorer, and Sylvok Explorer) that would also be easy to implement with this keyword. (Only Reflecting Pool is on the request list though).
It seems to me like it would be worthwhile to add it this way, even though it's clearly a low-use-case keyword (unlike the ones Rob and Chris are adding that enable dozens of new cards). If anyone has another opinion, or feedback on the overly long keyword itself
, let me know.
abAddManaLandProduces:$You (for Reflecting Pool)
abAddManaLandProduces:$Opp (for Exotic Orchard)
Plus there has to be some differentiator to cover the fact that Reflecting pool can add colorless and Exotic Orchard can't. According to Gatherer, there are 3 green creatures (Harvester Druid, Quirion Explorer, and Sylvok Explorer) that would also be easy to implement with this keyword. (Only Reflecting Pool is on the request list though).
It seems to me like it would be worthwhile to add it this way, even though it's clearly a low-use-case keyword (unlike the ones Rob and Chris are adding that enable dozens of new cards). If anyone has another opinion, or feedback on the overly long keyword itself

- jim
- Posts: 46
- Joined: 19 Feb 2010, 01:46
- Location: Sunny New England
- Has thanked: 0 time
- Been thanked: 0 time
Re: Reflecting Pool: Is this keyword worthwhile?
by Chris H. » 08 Apr 2010, 02:01
`It seems to me like it would be worthwhile to add it this way, even though it's clearly a low-use-case keyword (unlike the ones Rob and Chris are adding that enable dozens of new cards). If anyone has another opinion, or feedback on the overly long keyword itself, let me know.
I think that it sounds like a good idea. As you work on the code you may decide to shorten the name. It should be fairly easy to find and replace the keyword name. Rob is good at coming up with names for keywords.
-
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: Reflecting Pool: Is this keyword worthwhile?
by zerker2000 » 08 Apr 2010, 04:50
Considering I made "{1], sac CARDNAME: draw 1" merely for Spellbombs, I'd say go for it. CardFactory already has excessively copy-pasted code; a lot of good could come out of e.g. rerouting the whole targeting system through some kind of "CardFactoryUtil.getTargetType(Card, description)", and/or making something similar for simple setTargetAI logic("scariest human creature", "best artifact to animate", etc.).
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: Reflecting Pool: Is this keyword worthwhile?
by Rob Cashwalker » 08 Apr 2010, 05:30
Yeah, I give it my seal of approval... I'm not coming up with anything solid on names.... It's good enough. Consider the fact that we use "When this card would be put into a graveyard, shuffle it into your library instead" as a limited application keyword.
Edit - on the other hand, I just thought of a cool name - "abAddReflectedMana:1:You|Opp"
Edit - on the other hand, I just thought of a cool name - "abAddReflectedMana:1:You|Opp"
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: Reflecting Pool: Is this keyword worthwhile?
by jim » 08 Apr 2010, 10:08
That is a cool name, and I think I'll use it. I am terrible at coming up with names and appreciate the help.Rob Cashwalker wrote:Edit - on the other hand, I just thought of a cool name - "abAddReflectedMana:1:You|Opp"
- jim
- Posts: 46
- Joined: 19 Feb 2010, 01:46
- Location: Sunny New England
- Has thanked: 0 time
- Been thanked: 0 time
Re: Reflecting Pool: Is this keyword worthwhile?
by jim » 08 Apr 2010, 10:19
Yes, part of my motivation for wanting to do this as a keyword is to avoid even the small amount of copy-paste and hardcoding that would result. I was hoping that you folks would approve -- thanks for your responses.zerker2000 wrote:Considering I made "{1], sac CARDNAME: draw 1" merely for Spellbombs, I'd say go for it. CardFactory already has excessively copy-pasted code; a lot of good could come out of e.g. rerouting the whole targeting system through some kind of "CardFactoryUtil.getTargetType(Card, description)", and/or making something similar for simple setTargetAI logic("scariest human creature", "best artifact to animate", etc.).
The targeting system reroute sounds like a good idea, though it would probably be quite a project. I'd rather not sign up for that task just yet...

- jim
- Posts: 46
- Joined: 19 Feb 2010, 01:46
- Location: Sunny New England
- Has thanked: 0 time
- Been thanked: 0 time
Re: Reflecting Pool: Is this keyword worthwhile?
by zerker2000 » 08 Apr 2010, 21:09
But that's the thing: for the first part at least, after minimal editing to CardFactoryUtil(just a parser of some sort) and SpellAbility.getText, all spells and abilities in card factory can gradually be converted to use it, reducing line count, without any major problems in leaving the rest still using hardcoded ones(at least not until someone comes along and makes an incorrect assumption that All targeting uses it, and/or forgets AI, but in that case, major improvement must already have been made).
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: Reflecting Pool: Is this keyword worthwhile?
by Chris H. » 09 Apr 2010, 13:29
`So I've been playing in my local copy with an implementation of Reflecting Pool. It occurred to me that nearly the same code ought to be useful to implement Fellwar Stone and Exotic Orchard
`According to Gatherer, there are 3 green creatures (Harvester Druid, Quirion Explorer, and Sylvok Explorer) that would also be easy to implement with this keyword.
It looks like the keyword code would need to appear in three of the CardFactories files:
CardFactories_Creatures.java
CardFactories_Lands.java
CardFactories.java
Would it make sense to have only the parsing code in these three files and to call the SpellAbility method which would be placed in CardFactoryUtil.java? This would be similar to what we have done with eqPump and enPump.
I seem to remember someone in the past suggested that we might want to move the SpellAbility methods for the keywords to a separate class file, CardFactoryUtil_SpellAbilities.java?
-
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: Reflecting Pool: Is this keyword worthwhile?
by zerker2000 » 09 Apr 2010, 20:51
CardFactory_Keywords: All the card factories' code is already mostly SpellAbilities.
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: Reflecting Pool: Is this keyword worthwhile?
by jim » 09 Apr 2010, 21:03
That's in line with what I was thinking: the method to manufacture the spell ability would appear in CardFactoryUtil.java, which would be called from CardFactory_Lands and CardFactory_Creatures. I hadn't realized the parsing code would need to appear in all three files, but I guess there probably isn't a way to avoid this -- we dispatch to the sub-factories before we do any parsing.Chris H. wrote:It looks like the keyword code would need to appear in three of the CardFactories files:
CardFactories_Creatures.java
CardFactories_Lands.java
CardFactories.java
Would it make sense to have only the parsing code in these three files and to call the SpellAbility method which would be placed in CardFactoryUtil.java? This would be similar to what we have done with eqPump and enPump.
- jim
- Posts: 46
- Joined: 19 Feb 2010, 01:46
- Location: Sunny New England
- Has thanked: 0 time
- Been thanked: 0 time
10 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 38 guests