Parallel Lives...

For all your questions regarding Image Card Coding.
Please read the Image Posting Guideline & Index before posting in this forum.
Forum rules
DO NOT POST BUG REPORT IN THIS FORUM !!

Please read carefully the forum rules related to the card coding section : viewtopic.php?f=21&t=1545

All post will be edited to follow forum rules.
kevlahnota
Posts: 619
Joined: Tue Feb 08, 2011 3:00 pm
Location: Philippines
Contact:

Parallel Lives...

Post by kevlahnota »

Image

wagic fork (latest commit): https://github.com/kevlahnota/wagic/com ... 73b36ea864

I think doubling season can be done... :)

MTGDefinitions.cpp

Code: Select all

@@ -132,7 +132,8 @@ const char* Constants::MTGBasicAbilities[] = {
     "soulbond",
     "lure",
     "nolegend",
-    "canplayfromgraveyard"
+    "canplayfromgraveyard",
+    "tokenizer"//parallel lives
 };
 
 map<string,int> Constants::MTGBasicAbilitiesMap;
MTGDefinitions.h

Code: Select all

@@ -219,7 +219,8 @@ class Constants
       LURE = 101,
       NOLEGEND = 102,
       CANPLAYFROMGRAVEYARD = 103,
-      NB_BASIC_ABILITIES = 104,
+      TOKENIZER = 104,
+      NB_BASIC_ABILITIES = 105,
 
 
     RARITY_S = 'S',   //Special Rarity
AllAbilities.h

Code: Select all

@@ -3140,7 +3140,7 @@ class ATokenCreator: public ActivatedAbility
             SAFE_DELETE(NewPow);
             SAFE_DELETE(NewTou);
         }
-        for (int i = 0; i < multiplier->getValue(); ++i)
+        for (int i = 0; i < Tokenizer(); ++i)
         {
             //MTGCardInstance * myToken;
             if (tokenId)
 @@ -3199,6 +3199,23 @@ class ATokenCreator: public ActivatedAbility
         return 1;
     }
 
+    int Tokenizer()//tokenizer
+    {
+        int tokenize = 1;
+        if (source->controller()->game->battlefield->hasAbility(Constants::TOKENIZER))
+        {
+            int nbcards = source->controller()->game->battlefield->nb_cards;
+            for (int j = 0; j < nbcards; j++)
+            {
+                if (source->controller()->game->battlefield->cards[j]->has(Constants::TOKENIZER))
+                    tokenize *= 2;
+            }
+            return multiplier->getValue()*tokenize;
+        }
+		else
+            return multiplier->getValue();
+    }
+   
     void setTokenOwner()
     {
         switch(who)
primitve:

Code: Select all

@@ -68366,6 +68366,13 @@ mana={3}{G}{G}
 type=Sorcery
  [/card]
  [card]
 +name=Parallel Lives
 +abilities=tokenizer
 +text=If an effect would put one or more tokens onto the battlefield under your control, it puts twice that many of those tokens onto the battlefield instead.
 +mana={3}{G}
 +type=Enchantment
 +[/card]
 +[card]
  name=Paralyze
  target=creature
  auto=tap
Tacoghandi
Posts: 1197
Joined: Thu Apr 28, 2011 11:34 pm

Re: Parallel Lives...

Post by Tacoghandi »

Awesome. But Doubling Season is prob still not supported. As it deals with more than tokens. Doubling Season deals with counters as well. Which would be fine to be added for other cards that only deal with 1/1 counters, but doubling season adds all counters.

Other issue is that Wagic is not able to differentiate how the counters are being put on due to doubling seasons rules. The card only doubles from effects that add counters and not adding counters to activate abilities.

Example A planeswalker enters the battlefield with double counters but does not get double counters when increasing the counters activation of a + ability.

As much as I would like to see Doubling Season, it will probably have to use a custom alias code. Parallel Lives is a great add though.
!!Check out My Created Sets and other Stuff!!

viewtopic.php?f=22&t=3380
Tacoghandi
Posts: 1197
Joined: Thu Apr 28, 2011 11:34 pm

Re: Parallel Lives...

Post by Tacoghandi »

I also noticed that while this is a great add. any card that must use a custom token workaround will also create double the custom tokens. Is there a way we can have it only work on tokens that don't have the type=nothing. I looked at the code and I am really not sure where to put a restriction in on it.
!!Check out My Created Sets and other Stuff!!

viewtopic.php?f=22&t=3380
kevlahnota
Posts: 619
Joined: Tue Feb 08, 2011 3:00 pm
Location: Philippines
Contact:

Re: Parallel Lives...

Post by kevlahnota »

Thanks taco. I remember zethfox always tells me that token workarounds is a big no that's why I don't use token workarounds. Anyway If you want an observer for a certain cards you can use emblem transforms.. ueot, it will last ueot for the effect...

example:

Code: Select all

[card]
name=Glimpse of Nature
auto=emblem transforms((,newability[@movedTo(creature|mystack):draw:1 controller])) ueot
text=Whenever you cast a creature spell this turn, draw a card.
mana={G}
type=Sorcery
[/card]
anyway what cards needs token workarounds? can you give example?
Tacoghandi
Posts: 1197
Joined: Thu Apr 28, 2011 11:34 pm

Re: Parallel Lives...

Post by Tacoghandi »

Its basically for cards that I code in the extras section of my fork that have too many effects they need to accomplish to be contained in a single cards code. So I have to have that card create a quick token that contains the additional things that the card needs to do. Or for abilities I have added using workarounds like Cascade.

Here is an example of a reveal card I use but I cant contain it to one card because of the targets that need to happen before the rest of the cards get moved to another zone.

Code: Select all

[card]
name=Kruphix's Insight
auto=token(-380447) controller
text=Reveal the top six cards of your library. Put up to three enchantment cards from among them into your hand and the rest of the revealed cards into your graveyard. (WORKAROUND you can't choose to not target an enchantment if 3 or less get revealed)
mana={2}{G}
type=Sorcery
[/card]
[card]
name=Kruphix's Insight ability
id=-380447
type=nothing
auto=counter(0/0,1,original) all(*|myhand)
auto=moveto(myhand) all(*[pos=6]|mylibrary)
auto=counter(0/0,1,original) target(<upto:3>*[enchantment;pos=6]|myhand)
auto=@movedto(this|nonbattlezone):moveto(mygraveyard) all(*[-counter{0/0.1.original}]|myhand) && counter(0/0,-1,original) all(*|myhand)
auto=moveto(exile) all(this)
[/card]
I will play around with emblem codes to see if I can get a similar effect but I am not sure it will work. Perhaps I can use ability$! codes as well. I will try to move away from the token workaround. It is just I need to make sure the targets are chosen before the rest of the card resolves which is why I use the token and an exile with movedto code.

here I have created an effect that repeats until a certain objective is met.

Code: Select all

[card]
name=Mind Grind
auto=token(-366418) opponent
auto=token(-366418)*X opponent
text=Each opponent reveals cards from the top of his or her library until he or she reveals X land cards, then puts all cards revealed this way into his or her graveyard. X can't be 0.
mana={X}{1}}{U}{B}
type=Sorcery
[/card]
[card]
name=Mind Grind ability
id=-366418
abilities=split second
auto=all(*[pos=1]|mylibrary) moveto(mygraveyard) and!( transforms((,newability[if cantargetcard(*[land]|mygraveyard) then donothing else token(-366418) controller])) oneshot)!
auto=moveto(exile) all(this)
type=nothing
[/card]
!!Check out My Created Sets and other Stuff!!

viewtopic.php?f=22&t=3380
kevlahnota
Posts: 619
Joined: Tue Feb 08, 2011 3:00 pm
Location: Philippines
Contact:

Re: Parallel Lives...

Post by kevlahnota »

I see. I'm working on cascade as a built in ability but it is still incomplete, it works like in the duels of the planeswalker game(steam), it doesn't reveal the card but works fine. I just having trouble to make it moverandomly at the bottom of the library. I also have an idea about revealing cards, but I don't know yet about cardviews on the source. Its something like forge(card engine), you draw a menu with a list of cards then when you highlight the name, show the bigpos card view(just like when you highlight the cards it shows the big card image), then after clicking finish on the menu, do the ability...
Tacoghandi
Posts: 1197
Joined: Thu Apr 28, 2011 11:34 pm

Re: Parallel Lives...

Post by Tacoghandi »

kevlahnota wrote:I see. I'm working on cascade as a built in ability but it is still incomplete, it works like in the duels of the planeswalker game(steam), it doesn't reveal the card but works fine. I just having trouble to make it moverandomly at the bottom of the library. I also have an idea about revealing cards, but I don't know yet about cardviews on the source. Its something like forge(card engine), you draw a menu with a list of cards then when you highlight the name, show the bigpos card view(just like when you highlight the cards it shows the big card image), then after clicking finish on the menu, do the ability...
Sounds awesome. I would like to make a request if possible. Currently there are cards that target monocolored cards. Wagic is currently using [-multicolor]. While multicolor works to look for multicolor cards. It does not work as a monocolored check as it just looks for cards that are not multicolored. This means cards like Ultimate Price hit artifact creatures and other colorless creatures when it should not.

My request is this. Could you create a monocolor keyword that would only look at cards that are a single color. It seems as though it would not be hard to do but I don't have the knowledge to do it myself.

Much thanks.
!!Check out My Created Sets and other Stuff!!

viewtopic.php?f=22&t=3380
kevlahnota
Posts: 619
Joined: Tue Feb 08, 2011 3:00 pm
Location: Philippines
Contact:

Re: Parallel Lives...

Post by kevlahnota »

I revised -multicolor to return monocolred cards only :)
use iscolorless attribute to find colorless cards...
-multicolor = monocolored only
multicolor = multicolored only

I didn't pull request yet but heres the code(or you can look here: https://github.com/kevlahnota/wagic/com ... aa9e3bb692)

CardGui.cpp starts @line: 1239

Code: Select all

                else if (attribute.find("multicolor") != string::npos)
                {
                    //card is multicolored?
                    if (minus)
                    {
                        cd.setisMultiColored(-1);
                        cd.SetExclusionColor(0);//not multicolored is monocolored not colorless, use iscolorless attribute
                        cd.SetExclusionColor(6);//restriction... green, red, blue, black or white colored only
                        cd.mode = CardDescriptor::CD_OR;
                    }
                    else
                    {
                        cd.setisMultiColored(1);
                    }

                }

TargetChooser.cpp starts @line: 500

Code: Select all

                else if (attribute.find("multicolor") != string::npos)
                {
                    //card is multicolored?
                    if (minus)
                    {
                        cd->setisMultiColored(-1);
                        cd->SetExclusionColor(0);//not multicolored is monocolored not colorless, use iscolorless attribute
                        cd->SetExclusionColor(6);//restriction... green, red, blue, black or white colored only
                        cd->mode = CardDescriptor::CD_OR;
                    }
                    else
                    {
                        cd->setisMultiColored(1);
                    }

                }
Tacoghandi wrote:
My request is this. Could you create a monocolor keyword that would only look at cards that are a single color. It seems as though it would not be hard to do but I don't have the knowledge to do it myself.

Much thanks.
Tacoghandi
Posts: 1197
Joined: Thu Apr 28, 2011 11:34 pm

Re: Parallel Lives...

Post by Tacoghandi »

Thank you so much. I wish I had the knowledge to be able to do this stuff. I am a beginner when it comes to the code and all the different files this game has really overwhelms me.
!!Check out My Created Sets and other Stuff!!

viewtopic.php?f=22&t=3380
Zethfox
Posts: 3029
Joined: Thu Jun 10, 2010 11:28 pm

Re: Parallel Lives...

Post by Zethfox »

this is a bit of a necro but, ability$!, the basis of this ability is that it does exactly what a token workaround does, but without ever creating a token.
it fires the ability off just as a token workaround would do, but without being a workaround. everything that can be done with a token workaround can most likely also be done with ability$!.

and yeah, token workaround is gross. there was a point where I was planning on adding engine code to completely stop it from working, but I didnt becuase it hurt the ability to create custom cards. thats how much i dislike it.
Locked