It is currently 07 Sep 2025, 22:07
   
Text Size

New keyword: spMakeToken

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

New keyword: spMakeToken

Postby slapshot5 » 25 Sep 2010, 19:56

I would like to propose a new keyword: spMakeToken

The syntax would be as follows:
Code: Select all
spMakeToken<>Num<>Name<>imageName<>controller<>manaCost<>type1;type2<>attack<>defense<>keyword1;keyword2
If no keywords are to be added, use "None".
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
That would make Dragon Fodder:
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
and Howl of the Night Pack:
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
This is not yet committed. Questions/Comments/Concerns before I commit and update some cards?

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

Postby 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.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: New keyword: spMakeToken

Postby slapshot5 » 25 Sep 2010, 20:57

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.
10-4. I'll have a look.

-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

Postby 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.
The Force will be with you, Always.
User avatar
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

Postby 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().
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: New keyword: spMakeToken

Postby Sloth » 25 Sep 2010, 21:25

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.
Some of them are triggered abilities (wheneverkeyword) or static (stPump). I'm not sure if there are tokens that use them though.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: New keyword: spMakeToken

Postby 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.
The Force will be with you, Always.
User avatar
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

Postby slapshot5 » 26 Sep 2010, 03:33

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().
This is now handled.

-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

Postby slapshot5 » 26 Sep 2010, 03:34

slapshot5 wrote:
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.
10-4. I'll have a look.
Is there a card you have in mind to make use of this?

-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

Postby slapshot5 » 26 Sep 2010, 03:34

I am also now taking into account Doubling Season, which should improve consistency with making tokens.

-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

Postby Sloth » 26 Sep 2010, 08:15

slapshot5 wrote:I am also now taking into account Doubling Season, which should improve consistency with making tokens.

-slapshot5
There is an entry for Doubling Season in makeToken already. Did you test that Doubling Season doesn't work twice now?


slapshot5 wrote:
slapshot5 wrote:
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.
10-4. I'll have a look.
Is there a card you have in mind to make use of this?

-slapshot5
The Mutations would be nice: Artifact Mutation, AEther Mutation, Aura Mutation and Death Mutation.

Other: Gloomwidow's Feast, Kirtar's Wrath, Violet Pall
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: New keyword: spMakeToken

Postby slapshot5 » 26 Sep 2010, 13:41

Sloth wrote:There is an entry for Doubling Season in makeToken already. Did you test that Doubling Season doesn't work twice now?
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:The Mutations would be nice: Artifact Mutation, AEther Mutation, Aura Mutation and Death Mutation.

Other: Gloomwidow's Feast, Kirtar's Wrath, Violet Pall
Ahh. Thank you. All these cards I've never heard of. (That would be anything past Ice Age though...)

-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

Postby slapshot5 » 27 Sep 2010, 03:08

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
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
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

Postby Sloth » 27 Sep 2010, 15:58

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
Actually you did submit only one of the mutations. I tested it and Violet Pall and they work flawlessly. Good job slapshot.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: New keyword: spMakeToken

Postby slapshot5 » 28 Sep 2010, 03:25

Sloth wrote:Actually you did submit only one of the mutations. I tested it and Violet Pall and they work flawlessly. Good job slapshot.
The other 3 mutations should be there. I submitted them in:
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

Next

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 58 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 58 users online :: 0 registered, 0 hidden and 58 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 58 guests

Login Form