It is currently 19 Apr 2024, 08:46
   
Text Size

Problems with "Life and Limb" [transorm saproling in forest]

Moderator: CCGHQ Admins

Problems with "Life and Limb" [transorm saproling in forest]

Postby Zambooo » 13 Jul 2012, 23:00

Ok guys I'm getting stucked with coding "Life and Limb" (http://magiccards.info/pc/en/133.html)...

I succeeded in transforming all the Forest in Saproling and I also transformed the Saproling in Land and in Forest, but I can't now use them to add mana. So I tried to add all the Saprolings the ability to tap and add {G}, but it makes my game crash... I though "Maybe I created a vicious cicle, adding infinite times the ability to add mana" so I tried to add the ability only to the non-basic land (Saproling are not Basic Land), and it still makes it crash.
Maybe it's just the ability to add mana is the problem... I don't know :s

Here's the code
Code: Select all
<?xml version='1.0'?>
<CARD_V2>
  <FILENAME text="LIFE_AND_LIMB_28336" />
  <CARDNAME text="LIFE_AND_LIMB" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Life and Limb]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Verde Linfa Vitale]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="197865" />
  <ARTID value="28336" />
  <ARTIST name="Jim Nelson" />
  <CASTING_COST cost="{G}" />
  <FLAVOURTEXT>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA["It was a sight of pain and awe—a twisted forest, migrating across the salt plain in search of richer soil."
—Edahlis, greenseeker]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA["Era una visione dolorosa e solenne: una foresta contorta che migra attraverso la pianura salata in cerca di terreno fertile."
—Edahlis, cercatrice verde]]></LOCALISED_TEXT>
  </FLAVOURTEXT>
  <TYPE metaname="Enchantment" />
  <EXPANSION value="WWK" />
  <RARITY metaname="R" />
  <STATIC_ABILITY filter_zone="ZONE_IN_PLAY">
   <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[All Forests and all Saprolings are 1/1 green Saproling creatures and Forest lands in addition to their other types.]]></LOCALISED_TEXT>
   <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Tutte le Foreste e tutti i Saprolingi sono creature Saprolingio 1/1 verdi e terre Foresta in aggiunta ai loro altri tipi.]]></LOCALISED_TEXT>
   <FILTER>
   return not InPlay() or FilteredCard():GetSubType():Test( LAND_TYPE_FOREST ) ~= 0
    </FILTER>
    <CONTINUOUS_ACTION layer="3">
    if FilteredCard() ~= nil then
       FilteredCard():GetCurrentCharacteristics():CardType_GetWritable(FilteredCard()):Add( CARD_TYPE_CREATURE, FilteredCard() )
    end
    </CONTINUOUS_ACTION>
    <CONTINUOUS_ACTION layer="7B">
    if FilteredCard() ~= nil then
       local characteristics = FilteredCard():GetCurrentCharacteristics()
       characteristics:Power_Set( 1 )
       characteristics:Toughness_Set( 1 )
    end
    </CONTINUOUS_ACTION>
    <CONTINUOUS_ACTION layer="4">
    if FilteredCard() ~= nil then
       FilteredCard():GetCurrentCharacteristics():SubType_GetWritable(FilteredCard()):Add( CREATURE_TYPE_SAPROLING, FilteredCard() )
    end
    </CONTINUOUS_ACTION>
    <CONTINUOUS_ACTION layer="5">
    if FilteredCard() ~= nil then
       FilteredCard():GetCurrentCharacteristics():Colour_Get():Add( COLOUR_GREEN )
    end
    </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
 
  <STATIC_ABILITY filter_zone="ZONE_IN_PLAY">
   <FILTER>
   return not InPlay() or FilteredCard():GetSubType():Test( CREATURE_TYPE_SAPROLING ) ~= 0
    </FILTER>
    <CONTINUOUS_ACTION layer="3">
    if FilteredCard() ~= nil then
       FilteredCard():GetCurrentCharacteristics():CardType_GetWritable(FilteredCard()):Add( CARD_TYPE_LAND, FilteredCard() )
    end
    </CONTINUOUS_ACTION>
    <CONTINUOUS_ACTION layer="4">
    if FilteredCard() ~= nil then
       FilteredCard():GetCurrentCharacteristics():SubType_GetWritable(FilteredCard()):Add( LAND_TYPE_FOREST, FilteredCard() )
    end
    </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
 
  <STATIC_ABILITY filter_zone="ZONE_IN_PLAY">
  <FILTER>
    return not InPlay() or (FilteredCard():GetSubType():Test( CREATURE_TYPE_SAPROLING ) ~= 0 and  FilteredCard():GetSupertype:Test( SUPERTYPE_BASIC ) == 0)
    </FILTER>
    <CONTINUOUS_ACTION layer="6">
    if FilteredCard() ~= nil then
     FilteredCard():GetCurrentCharacteristics():GrantAbility(1)
    end
    </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
  <MANA_ABILITY resource_id="1" filter_zone="ZONE_IN_PLAY">
    <COST type="TapSelf" />
    <PRODUCES amount="{G}" />
  </MANA_ABILITY>
  <HELP title="MORE_INFO_BADGE_TITLE_10" body="MORE_INFO_BADGE_BODY_10" zone="ZONE_ANY" />
  <AI_BASE_SCORE score="900" zone="ZONE_IN_PLAY" />
  <AI_BASE_SCORE score="900" zone="ZONE_HAND" />
</CARD_V2>
Can someone help me?
User avatar
Zambooo
 
Posts: 242
Joined: 01 Jul 2012, 21:33
Has thanked: 19 times
Been thanked: 17 times

Re: Problems with "Life and Limb" [transorm saproling in for

Postby RiiakShiNal » 13 Jul 2012, 23:55

I haven't tried it out yet, but I cleaned up the code and removed what I thought was extraneous (I also corrected the filter, filename, multiverse id, casting cost, and expansion and added the other localized languages) though I left your art id alone. It looked like your filters were screwed up because you were trying to change everything that wasn't in play as well as forests and saprolings.
Code: Select all
<?xml version='1.0'?>
<CARD_V2>
   <FILENAME text="LIFE_AND_LIMB_124471" />
   <CARDNAME text="LIFE_AND_LIMB" />
   <TITLE>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Life and Limb]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Survivre à la force des bras]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Cuerpo y alma]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Lebende Äste]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Verde Linfa Vitale]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[生命と枝]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Life and Limb]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Жизнь и Ветвь]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Vida e Limbo]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="124471" />
   <ARTID value="28336" />
   <ARTIST name="Jim Nelson" />
   <CASTING_COST cost="{3}{G}" />
   <FLAVOURTEXT>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA["It was a sight of pain and awe—a twisted forest, migrating across the salt plain in search of richer soil."
—Edahlis, greenseeker]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[« C'était une vision à la fois triste et fascinante — une forêt aux arbres tordus, qui traversait la plaine de sel en quête d'un sol plus riche. »
—Edahlis, chercheuse de verdure]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA["Era una visión dolorosa y majestuosa: un bosque retorcido, migrando por una llanura salitre en busca de un terreno más fértil."
—Édahlis, buscadora de verde]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[„Es war ein schmerzhafter und gleichzeitig erstaunlicher Anblick – ein verzerrter Wald, der sich auf der Suche nach reicheren Böden über die Salzebenen bewegte."
—Edahlis, Pflanzensucher]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA["Era una visione dolorosa e solenne: una foresta contorta che migra attraverso la pianura salata in cerca di terreno fertile."
—Edahlis, cercatrice verde]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[苦痛と畏怖の現実ね――森が捻れて、肥えた土地を探して塩の平原を移動しているのよ。
――緑探しのエダリス]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA["It was a sight of pain and awe—a twisted forest, migrating across the salt plain in search of richer soil."
—Edahlis, greenseeker]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[«Это было и больно и восхитительно искореженный лес, мигрирующий по соляным пустошам в поисках более богатой почвы».
— Эдалис, искатель цветущих земель]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA["Foi uma visão de dor e terror uma floresta distorcida, migrando através da planície salina em busca de terreno mais fértil."
— Edahlis, busca-verde]]></LOCALISED_TEXT>
   </FLAVOURTEXT>
   <TYPE metaname="Enchantment" />
   <EXPANSION value="PLC" />
   <RARITY metaname="R" />
   <STATIC_ABILITY filter_zone="ZONE_IN_PLAY">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[All Forests and all Saprolings are 1/1 green Saproling creatures and Forest lands in addition to their other types.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Toutes les forêts et tous les saprobiontes sont des créatures 1/1 vertes Saprobionte et des terrains de forêt en plus de leurs autres types.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Todos los bosques y todos los Saprolines son criaturas Saprolín verde 1/1 y tierras bosque además de sus otros tipos.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Alle Wälder und alle Saprolinge sind 1/1 grüne Saprolinge und Wälder zusätzlich zu ihren anderen Typen.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Tutte le Foreste e tutti i Saprolingi sono creature Saprolingio 1/1 verdi e terre Foresta in aggiunta ai loro altri tipi.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[すべての森とすべての苗木は、他のタイプに加えて緑の1/1の苗木クリーチャーであるととともに森土地でもある。]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[All Forests and all Saprolings are 1/1 green Saproling creatures and Forest lands in addition to their other types.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Все Леса и все Сапролинги являются 1/1 зелеными существами Сапролинг и землями Лес в дополнение к своим другим типам.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Todas as Florestas e todos os Saprófitas são criaturas verdes 1/1 do tipo Saprófita e terrenos de Floresta, além de seus outros tipos.]]></LOCALISED_TEXT>
      <FILTER>
         -- Filter only Forests and Saprolings in play.
         return InPlay() and
            ((FilteredCard():GetSubType():Test( LAND_TYPE_FOREST ) ~= 0) or
            (FilteredCard():GetSubType():Test( CREATURE_TYPE_SAPROLING ) ~= 0))
      </FILTER>
      <CONTINUOUS_ACTION layer="4">
         -- Make them Land/Forest, Creature/Saprolings
         local oCard = FilteredCard()
         if (oCard ~= nil) then
            local oCharacteristics = oCard:GetCurrentCharacteristics()
            oCharacteristics:CardType_GetWritable( oCard ):Add( CARD_TYPE_LAND, oCard )
            oCharacteristics:CardType_GetWritable( oCard ):Add( CARD_TYPE_CREATURE, oCard )
            oCharacteristics:SubType_GetWritable( oCard ):Add( LAND_TYPE_FOREST, oCard )
            oCharacteristics:SubType_GetWritable( oCard ):Add( CREATURE_TYPE_SAPROLING, oCard )
         end
      </CONTINUOUS_ACTION>
      <CONTINUOUS_ACTION layer="5">
         -- Make them Green
         if (FilteredCard() ~= nil) then
            FilteredCard():GetCurrentCharacteristics():Colour_Get():Add( COLOUR_GREEN )
         end
      </CONTINUOUS_ACTION>
      <CONTINUOUS_ACTION layer="7B">
         -- Make them 1/1
         if (FilteredCard() ~= nil) then
            FilteredCard():GetCurrentCharacteristics():Power_Set( 1 )
            FilteredCard():GetCurrentCharacteristics():Toughness_Set( 1 )
         end
      </CONTINUOUS_ACTION>
      <CONTINUOUS_ACTION layer="6">
         if (FilteredCard() ~= nil) then
            if (FilteredCard():GetSupertype():Test( SUPERTYPE_BASIC ) == 0) then
               FilteredCard():GetCurrentCharacteristics():GrantAbility( 1 )
            end
         end
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <MANA_ABILITY resource_id="1" filter_zone="ZONE_IN_PLAY">
      <COST type="TapSelf" />
      <PRODUCES amount="{G}" />
   </MANA_ABILITY>
</CARD_V2>
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

Re: Problems with "Life and Limb" [transorm saproling in for

Postby Zambooo » 14 Jul 2012, 00:08

There's something wrong with the code cause the card doesn't even appear in the Deck

No ok it was my fault, now i'll try it out
Last edited by Zambooo on 14 Jul 2012, 00:12, edited 1 time in total.
User avatar
Zambooo
 
Posts: 242
Joined: 01 Jul 2012, 21:33
Has thanked: 19 times
Been thanked: 17 times

Re: Problems with "Life and Limb" [transorm saproling in for

Postby RiiakShiNal » 14 Jul 2012, 00:11

Zambooo wrote:There's something wrong with the code cause the card doesn't even appear in the Deck
Did you remember to change the filename for the file and in the deck xml (because I corrected it in my xml)?
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

Re: Problems with "Life and Limb" [transorm saproling in for

Postby Zambooo » 14 Jul 2012, 00:16

Sigh still makes the game crash :(
User avatar
Zambooo
 
Posts: 242
Joined: 01 Jul 2012, 21:33
Has thanked: 19 times
Been thanked: 17 times

Re: Problems with "Life and Limb" [transorm saproling in for

Postby sadlyblue » 14 Jul 2012, 08:14

I believe the problem is in <PRODUCES amount="{G}" />
sadlyblue
 
Posts: 175
Joined: 06 Feb 2012, 13:18
Has thanked: 18 times
Been thanked: 16 times

Re: Problems with "Life and Limb" [transorm saproling in for

Postby thefiremind » 14 Jul 2012, 09:08

That's bad news, I would have liked to make this card, too, sooner or later. The real Magic rules state that basic land types imply the production of their kind of mana, but it seems that this rule has been forgotten by the developers.

Maybe you already tried and maybe it's a stupid idea, but... have you tried to make 2 different abilities, one for Saprolings to turn them into Forests and one for Forests to turn them into Saprolings? (And maybe even a third one, separated from the other ones, that grants the mana ability to non-basic Saproling Forests?)
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Problems with "Life and Limb" [transorm saproling in for

Postby Zambooo » 14 Jul 2012, 10:35

thefiremind wrote:That's bad news, I would have liked to make this card, too, sooner or later. The real Magic rules state that basic land types imply the production of their kind of mana, but it seems that this rule has been forgotten by the developers.

Maybe you already tried and maybe it's a stupid idea, but... have you tried to make 2 different abilities, one for Saprolings to turn them into Forests and one for Forests to turn them into Saprolings? (And maybe even a third one, separated from the other ones, that grants the mana ability to non-basic Saproling Forests?)
That was exactly what I tried to do but it still makes the game crash when I play a Saproling Token whenever is on play Life and Limb. As I said the Forests were correctly transformed into Saproling.
User avatar
Zambooo
 
Posts: 242
Joined: 01 Jul 2012, 21:33
Has thanked: 19 times
Been thanked: 17 times

Re: Problems with "Life and Limb" [transorm saproling in for

Postby thefiremind » 14 Jul 2012, 13:29

I just had an idea for Life and Limb, but it could be hard to make it the right way: make all the non-basic Saprolings clone a Forest. The rest of the effect of Life and Limb should turn them into creatures again, but they would have the ability of the Forests because they copied one.
A problem is given by the new restrictions on cloning: you can't copy something that isn't on the battlefield. So it would be mandatory to have at least 1 Forest on the battlefield when you play Life and Limb (which is reasonable since you need to pay a green mana). I'm not sure if this problem could be avoided by making all Life and Limb (no matter where they are) copy the first Forest they see hitting the battlefield: I don't know for how many zone changes we protect a pointer when using Protect_CardPtr (one or infinite?).
This is going to be interesting... I'll make some tests.

EDIT: The idea works, but there's something I didn't think about: the Saprolings should still be called "Saproling", while with my method their name becomes "Forest". This matters for things like Maelstrom Pulse. Oh and they become basic, too.
Anyway, if you are interested in checking the effect, add this to RiiakShiNal's code and remove the part about the mana ability:
Code: Select all
  <TRIGGERED_ABILITY forced_skip="1" filter_zone="ZONE_IN_PLAY">
    <TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_IN_PLAY" />
    <RESOLUTION_TIME_ACTION>
    local filter = Object():GetFilter()
    filter:Clear()
    filter:NotTargetted()
    filter:AddCardType( CARD_TYPE_LAND )
    filter:AddSupertype( SUPERTYPE_BASIC )
    filter:AddSubType( LAND_TYPE_FOREST )
    local filter_count = filter:EvaluateObjects()
    if filter_count &gt; 0 then
       filter:GetNthEvaluatedObject(0):StoreCopiableValues(ObjectDC():Make_Chest(1))
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <STATIC_ABILITY filter_zone="ZONE_IN_PLAY">
    <FILTER>
    return InPlay() and
    FilteredCard():GetSubType():Test( CREATURE_TYPE_SAPROLING ) ~= 0 and
    FilteredCard():GetSupertype():Test( SUPERTYPE_BASIC ) == 0
    </FILTER>
    <CONTINUOUS_ACTION layer="1">
    if (FilteredCard() ~= nil and ObjectDC():Get_Chest(1) ~= nil) then
       FilteredCard():UseCopiableValues(ObjectDC():Get_Chest(1))
    end
    </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
Basically, it picks up the first basic Forest it finds (I think it's searched in any zone since I didn't specify one) and saves its values, then makes all non-basic Saprolings become clones of that Forest.

EDIT 2: I was testing the solution with the mana ability and it's strange, the game doesn't crash immediately after I play Life and Limb, it crashes after about 2-3 seconds.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Problems with "Life and Limb" [transorm saproling in for

Postby RiiakShiNal » 14 Jul 2012, 20:09

Well, I've been playing around with Life and Limb for a while now and the problem seems to be the mana ability on an enchantment (it crashes even if I don't grant it to anything). I also noticed that when I wasn't granting it to anything that I could tap the enchantment for mana (even though the resource_id attribute was present) just before the game would crash.

I did find a working alternative, but it's still not great. If you add the "Basic" supertype (in addition to the land type and forest subtype) to the saprolings then they can be tapped for mana and there is no crash. It is a better alternative than cloning a basic forest, but it gives them the "Basic" supertype which they really aren't supposed to get. Apparently the coders did put in code to make sure that BASIC land sub-types produce the correct color of mana, but they required that the land with the sub-type be a "Basic" land.

I think I've done about as much as I can with this for now so I'm going to go back to working on converting cards from 2010. Anyway here is my finished code (again I have left your art id alone):
Code: Select all
<?xml version='1.0'?>
<CARD_V2>
   <FILENAME text="LIFE_AND_LIMB_124471" />
   <CARDNAME text="LIFE_AND_LIMB" />
   <TITLE>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Life and Limb]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Survivre à la force des bras]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Cuerpo y alma]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Lebende Äste]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Verde Linfa Vitale]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[生命と枝]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Life and Limb]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Жизнь и Ветвь]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Vida e Limbo]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="124471" />
   <ARTID value="28336" />
   <ARTIST name="Jim Nelson" />
   <CASTING_COST cost="{3}{G}" />
   <FLAVOURTEXT>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA["It was a sight of pain and awe—a twisted forest, migrating across the salt plain in search of richer soil."
—Edahlis, greenseeker]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[« C'était une vision à la fois triste et fascinante — une forêt aux arbres tordus, qui traversait la plaine de sel en quête d'un sol plus riche. »
—Edahlis, chercheuse de verdure]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA["Era una visión dolorosa y majestuosa: un bosque retorcido, migrando por una llanura salitre en busca de un terreno más fértil."
—Édahlis, buscadora de verde]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[„Es war ein schmerzhafter und gleichzeitig erstaunlicher Anblick – ein verzerrter Wald, der sich auf der Suche nach reicheren Böden über die Salzebenen bewegte."
—Edahlis, Pflanzensucher]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA["Era una visione dolorosa e solenne: una foresta contorta che migra attraverso la pianura salata in cerca di terreno fertile."
—Edahlis, cercatrice verde]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[苦痛と畏怖の現実ね――森が捻れて、肥えた土地を探して塩の平原を移動しているのよ。
――緑探しのエダリス]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA["It was a sight of pain and awe—a twisted forest, migrating across the salt plain in search of richer soil."
—Edahlis, greenseeker]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[«Это было и больно и восхитительно искореженный лес, мигрирующий по соляным пустошам в поисках более богатой почвы».
— Эдалис, искатель цветущих земель]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA["Foi uma visão de dor e terror uma floresta distorcida, migrando através da planície salina em busca de terreno mais fértil."
— Edahlis, busca-verde]]></LOCALISED_TEXT>
   </FLAVOURTEXT>
   <TYPE metaname="Enchantment" />
   <EXPANSION value="PLC" />
   <RARITY metaname="R" />
   <STATIC_ABILITY filter_zone="ZONE_IN_PLAY">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[All Forests and all Saprolings are 1/1 green Saproling creatures and Forest lands in addition to their other types.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Toutes les forêts et tous les saprobiontes sont des créatures 1/1 vertes Saprobionte et des terrains de forêt en plus de leurs autres types.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Todos los bosques y todos los Saprolines son criaturas Saprolín verde 1/1 y tierras bosque además de sus otros tipos.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Alle Wälder und alle Saprolinge sind 1/1 grüne Saprolinge und Wälder zusätzlich zu ihren anderen Typen.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Tutte le Foreste e tutti i Saprolingi sono creature Saprolingio 1/1 verdi e terre Foresta in aggiunta ai loro altri tipi.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[すべての森とすべての苗木は、他のタイプに加えて緑の1/1の苗木クリーチャーであるととともに森土地でもある。]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[All Forests and all Saprolings are 1/1 green Saproling creatures and Forest lands in addition to their other types.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Все Леса и все Сапролинги являются 1/1 зелеными существами Сапролинг и землями Лес в дополнение к своим другим типам.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Todas as Florestas e todos os Saprófitas são criaturas verdes 1/1 do tipo Saprófita e terrenos de Floresta, além de seus outros tipos.]]></LOCALISED_TEXT>
      <FILTER>
         -- Filter only Forests and Saprolings in play.
         return InPlay() and
            ((FilteredCard():GetSubType():Test( LAND_TYPE_FOREST ) ~= 0) or
            (FilteredCard():GetSubType():Test( CREATURE_TYPE_SAPROLING ) ~= 0))
      </FILTER>
      <CONTINUOUS_ACTION layer="3">
         -- Make them Land/Forest
         local oCard = FilteredCard()
         if (oCard ~= nil) then
            local oCharacteristics = oCard:GetCurrentCharacteristics()
            oCharacteristics:CardType_GetWritable( oCard ):Add( CARD_TYPE_LAND, oCard )
            oCharacteristics:CardType_GetWritable( oCard ):Add( CARD_TYPE_CREATURE, oCard )
         end
      </CONTINUOUS_ACTION>
      <CONTINUOUS_ACTION layer="7B">
         -- Make them 1/1
         if (FilteredCard() ~= nil) then
            FilteredCard():GetCurrentCharacteristics():Power_Set( 1 )
            FilteredCard():GetCurrentCharacteristics():Toughness_Set( 1 )
         end
      </CONTINUOUS_ACTION>
      <CONTINUOUS_ACTION layer="5">
         -- Make them Green
         if (FilteredCard() ~= nil) then
            FilteredCard():GetCurrentCharacteristics():Colour_Get():Add( COLOUR_GREEN )
         end
      </CONTINUOUS_ACTION>
      <CONTINUOUS_ACTION layer="4">
         -- Make them Creature/Saprolings
         local oCard = FilteredCard()
         if (oCard ~= nil) then
            local oCharacteristics = oCard:GetCurrentCharacteristics()
            oCharacteristics:SubType_GetWritable( oCard ):Add( LAND_TYPE_FOREST, oCard )
            oCharacteristics:SubType_GetWritable( oCard ):Add( CREATURE_TYPE_SAPROLING, oCard )
            oCharacteristics:Supertype_GetWritable( oCard ):Add( SUPERTYPE_BASIC, oCard )
         end
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
</CARD_V2>
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

Re: Problems with "Life and Limb" [transorm saproling in for

Postby thefiremind » 15 Jul 2012, 09:08

If the problem is only on enchantments with mana abilities, we could grant the mana ability from an invisible token... I'll do some tests.

EDIT: Nope, it crashes anyway. But I made some tests for Eldrazi Spawn tokens before, and I made an invisible token that produces colorless mana... so, the problem probably is granting mana abilities from something that isn't artifact, creature or land.

EDIT 2: Looking at the problem the other way around... there's still something that could probably be done: override the Saproling tokens (both TOKEN_SAPROLING_1_1_277461 and TOKEN_SAPROLING_1_1_GARRUK_29, just to be sure) and code new versions that grant themselves the mana ability when they are Forests.

EDIT 3: Damn, it crashes even if the Saprolings grant the ability by themselves! :cry:
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Problems with "Life and Limb" [transorm saproling in for

Postby RiiakShiNal » 15 Jul 2012, 14:22

Even if overriding the saprolings to give themselves the ability worked then you would also have to override anything with changeling (such as Chameleon Colossus) and any card that can get the saproling creature type like Mistform Ultimus. So it really isn't a good solution anyway, though it was a good thought.

Also as I said it was like the enchantment got the mana ability even though I included the resource_id attribute and did NOT grant it to anything. So there may be other issues with mana abilities and/or granting abilities that we don't fully understand yet.

It could even be a combination of issues for example having a mana ability on something that isn't a land, creature, or artifact AND trying to assign a mana ability to something that has one of the land subtypes.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

Re: Problems with "Life and Limb" [transorm saproling in for

Postby thefiremind » 15 Jul 2012, 14:24

RiiakShiNal wrote:It could even be a combination of issues for example having a mana ability on something that isn't a land, creature, or artifact AND trying to assign a mana ability to something that has one of the land subtypes.
When I made the tokens that granted the ability to themselves, I made it so they granted it only if they were Forests, but the game crashed soon after I played Sprout, without even playing Life and Limb, so they weren't granting the ability yet.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Problems with "Life and Limb" [transorm saproling in for

Postby RiiakShiNal » 15 Jul 2012, 15:15

thefiremind wrote:When I made the tokens that granted the ability to themselves, I made it so they granted it only if they were Forests, but the game crashed soon after I played Sprout, without even playing Life and Limb, so they weren't granting the ability yet.
That could be the problem, a card that has a mana ability with a resource_id, but does not have a mana ability active. Cloudpost would be immune because it would always have at least one mana ability active at any given time (well up to 6 loci with the way the game has it coded). I haven't coded any cards that would meet that condition except for Life and Limb thus far, but it matches with your overridden saprolings.

It gives me one other possibility to test anyway.

Edit: An enchantment having a mana ability does not seem to be a problem as I gave Life and Limb a mana ability and I've gone through several turns now with no crash (even with giving the saprolings the mana ability as well).

Edit 2: Interesting side-effect with X casting cost items, if X is greater than a certain number (I'm not sure what the lower limit is yet) for a spell then you can cast that spell for free (even after specifying X as much greater than 0). I cast both a 21-power Stream of Life and a 19-power Stream of life in the same turn for free (only 22 mana available so my upper limit for X was 21).

Edit 3: I haven't been able to give the saprolings a mana ability without either a making them basic (as I did before) or giving Life and Limb a mana ability that produces at least 1 mana (Produces "{0}" crashes the game still). If I give Life and Limb a 1 mana (coloured or not) mana ability it produces the bug I noticed in Edit 2 (I was even able to cast a Verdant Force for free at one point). So my conclusion for now is still that making the saprolings "Basic" is still the best solution (which is still not perfect because they're not supposed to be basic).
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

Re: Problems with "Life and Limb" [transorm saproling in for

Postby thefiremind » 06 Aug 2012, 12:49

I noticed another thing about granting mana abilities.
I could code Coldsteel Heart without problems by just giving it the right mana ability after the color has been chosen, but Paradise Plume, coded exactly the same way, was making the game crash. After lots of tries I discovered what was the important difference: Coldsteel Heart enters the battlefield tapped, so the game probably doesn't even try to read its mana abilities until the next turn. Silhana Starfletcher was also coded this way, but the summoning sickness was probably saving him from crashing.
I solved the problem by creating a 6th mana ability that stays active while no color has been chosen: players will never use that ability, but it prevents crashes. Here is the code for the fixed Paradise Plume:
Code: Select all
<?xml version='1.0'?>
<CARD_V2>
  <FILENAME text="PARADISE_PLUME_122091" />
  <CARDNAME text="PARADISE_PLUME" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Paradise Plume]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Piuma del Paradiso]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Paradiesfeder]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Panache de paradis]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Pluma del paraíso]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[極楽の羽飾り]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Paradise Plume]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Райское Перо]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Pluma do Paraíso]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="122091" />
  <ARTID value="A122091" />
  <ARTIST name="Wayne England" />
  <CASTING_COST cost="{4}" />
  <FLAVOURTEXT>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[A last wisp of paradise in a fallen world.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Un ultimo ciuffo di paradiso in un mondo decaduto.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Ein letzter Hauch des Paradieses in einer untergegangenen Welt.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[La dernière douceur du paradis dans un monde déchu.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Un último vestigio de paraíso en un mundo caído.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[落ちぶれた世界の中の、楽園の最後の一欠片。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[A last wisp of paradise in a fallen world.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Последний след рая в падшем мире.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Um último pedacinho do paraíso em um mundo decadente.]]></LOCALISED_TEXT>
  </FLAVOURTEXT>
  <TYPE metaname="Artifact" />
  <EXPANSION value="TSP" />
  <RARITY metaname="U" />
  <TRIGGERED_ABILITY forced_skip="1" active_zone="ZONE_TRANSITION">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[As Paradise Plume enters the battlefield, choose a color.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Mentre la Piuma del Paradiso entra nel campo di battaglia, scegli un colore.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Sowie die Paradiesfeder ins Spiel kommt, bestimme eine Farbe.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Au moment où le Panache de paradis arrive sur le champ de bataille, choisissez une couleur.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[En cuanto la Pluma del paraíso entre al campo de batalla, elige un color.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[極楽の羽飾りが場に出るに際し、色を1色選ぶ。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[As Paradise Plume enters the battlefield, choose a color.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[При входе Райского Пера в игру выберите цвет.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Conforme Pluma do Paraíso entra no campo de batalha, escolha uma cor.]]></LOCALISED_TEXT>
    <TRIGGER value="ZONECHANGE_TRANSITION" simple_qualifier="self" to_zone="ZONE_IN_PLAY" />
    <PLAY_TIME_ACTION>
    EffectController():ChooseColour( "CARD_QUERY_CHOOSE_COLOUR", 1 )
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    ObjectDC():Set_Int(0, GetChosenColour())
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY auto_skip="1" filter_zone="ZONE_IN_PLAY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever a player casts a spell of the chosen color, you may gain 1 life.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ogniqualvolta un giocatore lancia una magia del colore scelto, puoi guadagnare 1 punto vita.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Immer wenn ein Spieler einen Zauberspruch der bestimmten Farbe wirkt, kannst du 1 Lebenspunkt dazu erhalten.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[À chaque fois qu’un joueur lance un sort de la couleur choisie, vous pouvez gagner 1 point de vie.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Siempre que un jugador lance un hechizo del color elegido, puedes ganar 1 vida.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[いずれかのプレイヤーが選ばれた色の呪文をプレイするたび、あなたは1点のライフを得てもよい。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Whenever a player casts a spell of the chosen color, you may gain 1 life.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Когда игрок играет заклинание выбранного цвета, вы можете получить 1 жизнь.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Toda vez que um jogador conjura uma mágica da cor escolhida, você poderá ganhar 1 ponto de vida.]]></LOCALISED_TEXT>
    <TRIGGER value="SPELL_PLAYED">
    if ObjectDC() ~= nil then
       local chosen = ObjectDC():Get_Int(0)
       if chosen ~= 0 then
          return TriggerObject():GetColour():Test( chosen ) ~= 0
       end
    end
    return false
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local player = EffectController()
    if (player ~= nil) then
       player:GainLife(1)
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <STATIC_ABILITY filter_zone="ZONE_IN_PLAY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{T}: Add one mana of the chosen color to your mana pool.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[{T}: Aggiungi un mana del colore scelto alla tua riserva.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[{T}: Erhöhe deinen Manavorrat um ein Mana der bestimmten Farbe.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[{T} : Ajoutez un mana de la couleur choisie à votre réserve.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[{T}: Agrega un maná del color elegido a tu reserva de maná.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[{T}:あなたのマナ・プールに、選んだ色のマナ1点を加える。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[{T}: Add one mana of the chosen color to your mana pool.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[{T}: Добавьте одну ману выбранного цвета в свой запас маны.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[{T}: Adicione um mana da cor escolhida à sua reserva de mana.]]></LOCALISED_TEXT>
    <CONTINUOUS_ACTION>
    if ObjectDC() ~= nil and ObjectDC():Get_Int(0) ~= 0 then
       Object():GetCurrentCharacteristics():GrantAbility( ObjectDC():Get_Int(0) )
    else
       Object():GetCurrentCharacteristics():GrantAbility( 6 )
    end
    </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
  <MANA_ABILITY resource_id="1" filter_zone="ZONE_IN_PLAY">
    <COST type="TapSelf" />
    <PRODUCES amount="{W}" />
  </MANA_ABILITY>
  <MANA_ABILITY resource_id="2" filter_zone="ZONE_IN_PLAY">
    <COST type="TapSelf" />
    <PRODUCES amount="{U}" />
  </MANA_ABILITY>
  <MANA_ABILITY resource_id="3" filter_zone="ZONE_IN_PLAY">
    <COST type="TapSelf" />
    <PRODUCES amount="{B}" />
  </MANA_ABILITY>
  <MANA_ABILITY resource_id="4" filter_zone="ZONE_IN_PLAY">
    <COST type="TapSelf" />
    <PRODUCES amount="{R}" />
  </MANA_ABILITY>
  <MANA_ABILITY resource_id="5" filter_zone="ZONE_IN_PLAY">
    <COST type="TapSelf" />
    <PRODUCES amount="{G}" />
  </MANA_ABILITY>
  <MANA_ABILITY resource_id="6" filter_zone="ZONE_IN_PLAY">
    <COST type="TapSelf" />
    <PRODUCES amount="{1}" />
  </MANA_ABILITY>
  <AI_BASE_SCORE score="150" zone="ZONE_IN_PLAY" />
</CARD_V2>
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 12 guests


Who is online

In total there are 12 users online :: 0 registered, 0 hidden and 12 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 12 guests

Login Form