New keyword: spMakeToken
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
18 posts
• Page 1 of 2 • 1, 2
New keyword: spMakeToken
by slapshot5 » 25 Sep 2010, 19:56
I would like to propose a new keyword: spMakeToken
The syntax would be as follows:
X is accepted for Num.
I chose "<>" and ";" for delimiters so keywords to be added to the token containing ":" and"," could be accepted.
CardFactory.java:
I will be updating the following cards with this keyword:
Dragon Fodder
Empty the Warrens
Feral Lightning
Howl of the Night Pack
Hunting Pack
Join the Ranks
Martial Coup - needs some looking into
Raise the Alarm
Reach of Branches
Skittering Invasion
Sound the Call
Spectral Procession
Storm Herd
-slapshot5
The syntax would be as follows:
- Code: Select all
spMakeToken<>Num<>Name<>imageName<>controller<>manaCost<>type1;type2<>attack<>defense<>keyword1;keyword2
X is accepted for Num.
I chose "<>" and ";" for delimiters so keywords to be added to the token containing ":" and"," could be accepted.
CardFactory.java:
- Code: Select all
if(hasKeyword(card, "spMakeToken") != -1) {
int n = hasKeyword(card, "spMakeToken");
String parse = card.getKeyword().get(n).toString();
card.removeIntrinsicKeyword(parse);
final String[] k = parse.split("<>");
SpellAbility spell = new Spell(card) {
private static final long serialVersionUID = -5286946184688616830L;
@Override
public void resolve() {
final int num = "X".equals(k[1]) ? CardFactoryUtil.xCount(card, card.getSVar("X")) : Integer.valueOf(k[1]);
final String name = k[2];
final String imageName = k[3];
final String controller = (k[4].equals("Controller") ? card.getController() : AllZone.GameAction.getOpponent(card.getController()));
final String manaCost = k[5];
final String[] types = k[6].split(";");
final int attack = Integer.valueOf(k[7]);
final int defense = Integer.valueOf(k[8]);
final String[] keywords = k[9].split(";");
for(int i = 0; i < num; i ++ ){
if(k[9].equals("None")) keywords[0] = "";
CardFactoryUtil.makeToken(name, imageName, controller, manaCost, types, attack, defense, keywords);
}
}
};
card.clearSpellAbility();
card.addSpellAbility(spell);
}//end MakeToken
- Code: Select all
Name:Dragon Fodder
ManaCost:1 R
Types:Sorcery
Text:Put two 1/1 red Goblin creature tokens onto the battlefield.
K:spMakeToken<>2<>Goblin<>R 1 1 Goblin<>Controller<>R<>Creature;Goblin<>1<>1<>None
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/dragon_fodder.jpg
End
- Code: Select all
Name:Howl of the Night Pack
ManaCost:6 G
Types:Sorcery
Text:Put a 2/2 green Wolf creature token onto the battlefield for each Forest you control.
K:spMakeToken<>1<>Wolf<>G 2 2 Wolf<>Controller<>G<>Creature;Wolf<>2<>2<>None
SVar:X:Count$TypeYouCtrl.Forest
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/howl_of_the_night_pack.jpg
End
I will be updating the following cards with this keyword:
Dragon Fodder
Empty the Warrens
Feral Lightning
Howl of the Night Pack
Hunting Pack
Join the Ranks
Martial Coup - needs some looking into
Raise the Alarm
Reach of Branches
Skittering Invasion
Sound the Call
Spectral Procession
Storm Herd
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: New keyword: spMakeToken
by Sloth » 25 Sep 2010, 20:56
Looks good to me. The xCount is really usefull. I look forward to have Ordered Migration for domain decks.
PS: While you are into tokens slapshot5, you might want to implement the missing generate Token Drawback that is just a placeholder in doDrawBack in CardFactoryUtil at the moment.
PS: While you are into tokens slapshot5, you might want to implement the missing generate Token Drawback that is just a placeholder in doDrawBack in CardFactoryUtil at the moment.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: New keyword: spMakeToken
by slapshot5 » 25 Sep 2010, 20:57
10-4. I'll have a look.Sloth wrote:PS: While you are into tokens slapshot5, you might want to implement the missing generate Token Drawback that is just a placeholder in doDrawBack in CardFactoryUtil at the moment.
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: New keyword: spMakeToken
by Rob Cashwalker » 25 Sep 2010, 21:11
I'd suggest using an SVar to store the keywords to be added, to maintain our current delimiter style. Keep in mind that until we develop an ability factory, any keyword with a ":" in it (likely representing activated abilities) will be useless.
Weren't we using "&" for multiple-keyword pumps?
Yes, definitely make the drawback handle generating tokens, with some similar syntax.
Also, I'd recommend not using the "k[n]" elements directly in the SpellAbility. Assign them to meaningful names, with proper types, check for "X" and store the "Count$" separately.
Weren't we using "&" for multiple-keyword pumps?
Yes, definitely make the drawback handle generating tokens, with some similar syntax.
Also, I'd recommend not using the "k[n]" elements directly in the SpellAbility. Assign them to meaningful names, with proper types, check for "X" and store the "Count$" separately.
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: New keyword: spMakeToken
by Sloth » 25 Sep 2010, 21:18
I just thought up a case where the AI should not cast a spMakeToken spell: if xCount is zero (might happen with Elvish Promenade). Otherwise it should be safe to just return true with canPlayAI().
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: New keyword: spMakeToken
by Sloth » 25 Sep 2010, 21:25
Some of them are triggered abilities (wheneverkeyword) or static (stPump). I'm not sure if there are tokens that use them though.Rob Cashwalker wrote:Keep in mind that until we develop an ability factory, any keyword with a ":" in it (likely representing activated abilities) will be useless.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: New keyword: spMakeToken
by Rob Cashwalker » 25 Sep 2010, 23:55
Nonetheless, you can have the parser pull any such keyword(s) from an SVar, which doesn't parse more than the first 2 ":", leaving the rest of the keyword safe.
Here's the example I thought of - The ooze creature from 2011, which spawns two ooze tokens when it goes to the graveyard, each of which spawn two ooze tokens when they go to the graveyard.
Here's the example I thought of - The ooze creature from 2011, which spawns two ooze tokens when it goes to the graveyard, each of which spawn two ooze tokens when they go to the graveyard.
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: New keyword: spMakeToken
by slapshot5 » 26 Sep 2010, 03:33
This is now handled.Sloth wrote:I just thought up a case where the AI should not cast a spMakeToken spell: if xCount is zero (might happen with Elvish Promenade). Otherwise it should be safe to just return true with canPlayAI().
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: New keyword: spMakeToken
by slapshot5 » 26 Sep 2010, 03:34
Is there a card you have in mind to make use of this?slapshot5 wrote:10-4. I'll have a look.Sloth wrote:PS: While you are into tokens slapshot5, you might want to implement the missing generate Token Drawback that is just a placeholder in doDrawBack in CardFactoryUtil at the moment.
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: New keyword: spMakeToken
by slapshot5 » 26 Sep 2010, 03:34
I am also now taking into account Doubling Season, which should improve consistency with making tokens.
-slapshot5
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: New keyword: spMakeToken
by Sloth » 26 Sep 2010, 08:15
There is an entry for Doubling Season in makeToken already. Did you test that Doubling Season doesn't work twice now?slapshot5 wrote:I am also now taking into account Doubling Season, which should improve consistency with making tokens.
-slapshot5
The Mutations would be nice: Artifact Mutation, AEther Mutation, Aura Mutation and Death Mutation.slapshot5 wrote:Is there a card you have in mind to make use of this?slapshot5 wrote:10-4. I'll have a look.Sloth wrote:PS: While you are into tokens slapshot5, you might want to implement the missing generate Token Drawback that is just a placeholder in doDrawBack in CardFactoryUtil at the moment.
-slapshot5
Other: Gloomwidow's Feast, Kirtar's Wrath, Violet Pall
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: New keyword: spMakeToken
by slapshot5 » 26 Sep 2010, 13:41
I did notice that, but Doubling Season didn't work until I added it in my code. I will do some more testing today. The stuff in makeToken should be sufficient, I agree.Sloth wrote:There is an entry for Doubling Season in makeToken already. Did you test that Doubling Season doesn't work twice now?
Ahh. Thank you. All these cards I've never heard of. (That would be anything past Ice Age though...)Sloth wrote:The Mutations would be nice: Artifact Mutation, AEther Mutation, Aura Mutation and Death Mutation.
Other: Gloomwidow's Feast, Kirtar's Wrath, Violet Pall
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: New keyword: spMakeToken
by slapshot5 » 27 Sep 2010, 03:08
The Drawback$MakeToken code has been committed along with the 4 mutations listed above and Violet Pall.Sloth wrote:The Mutations would be nice: Artifact Mutation, AEther Mutation, Aura Mutation and Death Mutation.
Other: Gloomwidow's Feast, Kirtar's Wrath, Violet Pall
I have a bit of tweaking to do with the X stuff, but everything is currently working to the best of my knowledge. Please play test as this is my first experience with anything Drawback related.
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: New keyword: spMakeToken
by Sloth » 27 Sep 2010, 15:58
Actually you did submit only one of the mutations. I tested it and Violet Pall and they work flawlessly. Good job slapshot.slapshot5 wrote:The Drawback$MakeToken code has been committed along with the 4 mutations listed above and Violet Pall.
I have a bit of tweaking to do with the X stuff, but everything is currently working to the best of my knowledge. Please play test as this is my first experience with anything Drawback related.
-slapshot5
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: New keyword: spMakeToken
by slapshot5 » 28 Sep 2010, 03:25
The other 3 mutations should be there. I submitted them in:Sloth wrote:Actually you did submit only one of the mutations. I tested it and Violet Pall and they work flawlessly. Good job slapshot.
http://code.google.com/p/cardforge/source/detail?r=2326
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
18 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 58 guests