Page 1 of 2

if anybody want it... here all about mana tokens 2013

PostPosted: 25 Jul 2012, 22:55
by nabeshin
function, token cards, Izzet Signet as working example, func file contains also nice scry code, i add card with it - Foresee

Re: if anybody want it... here all about mana tokens 2013

PostPosted: 26 Jul 2012, 14:48
by Tyrany
i was tryin to implement the gemhide sliver and everything works on choosing the target color

but then nothing works is the manapool implemented?

this is the used code for the function

Code: Select all
<PLAY_TIME_ACTION>
      Object():GetPlayer():ChooseColour( "CARD_QUERY_CHOOSE_COLOUR", 1 )
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local LNG_COLOUR = Object():GetPlayer():GetChosenColour()   
    if (LNG_COLOUR == 4) then
   ProduceMana( "U", 1 )
    end
    if (LNG_COLOUR == 3) then
   ProduceMana( "B", 1 )
    end
    if (LNG_COLOUR == 1) then
   ProduceMana( "R", 1 )
    end
    if (LNG_COLOUR == 2) then
   ProduceMana( "G", 1 )
    end
    if (LNG_COLOUR == 5) then
   ProduceMana( "W", 1 )
    end
  </RESOLUTION_TIME_ACTION>

Re: if anybody want it... here all about mana tokens 2013

PostPosted: 26 Jul 2012, 16:47
by Aiodren
Your problem is not the mana functions but the colour choice. In 2013 ChooseColour doesn't return numbers but the actual colours (COLOUR_RED,COLOUR_BLUE,...). You could use the following example to code it:
Code: Select all
    <PLAY_TIME_ACTION>
      EffectController():ChooseColour( "CARD_QUERY_CHOOSE_COLOUR", 1 )
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local LNG_COLOUR = GetChosenColour()   
    if (LNG_COLOUR == COLOUR_RED) then
   ProduceMana( "R", 1 )
    end
    if (LNG_COLOUR == COLOUR_GREEN) then
   ProduceMana( "G", 1 )
    end
    if (LNG_COLOUR == COLOUR_BLACK) then
   ProduceMana( "B", 1 )
    end
    if (LNG_COLOUR == COLOUR_BLUE) then
   ProduceMana( "U", 1 )
    end
    if (LNG_COLOUR == COLOUR_WHITE) then
   ProduceMana( "W", 1 )
    end
    </RESOLUTION_TIME_ACTION>

Re: if anybody want it... here all about mana tokens 2013

PostPosted: 26 Jul 2012, 17:17
by RiiakShiNal
Aiodren wrote:Your problem is not the mana functions but the colour choice. In 2013 ChooseColour doesn't return numbers but the actual colours (COLOUR_RED,COLOUR_BLUE,...). You could use the following example to code it:
Well, that's not entirely true, he did have the numbers wrong, but GetChosenColour() does return numbers (which relate to the colour constants as follows):
  • COLOUR_WHITE = 1
  • COLOUR_BLUE = 2
  • COLOUR_BLACK = 3
  • COLOUR_RED = 4
  • COLOUR_GREEN = 5

Re: if anybody want it... here all about mana tokens 2013

PostPosted: 26 Jul 2012, 22:03
by Aiodren
@Riiak: Are you sure? First i had the same code as Tyrany and it didn't work at all, so i assumed after seeing the code of fireminds Apostle's Blessing that the function now doesn't return numbers anymore.

Re: if anybody want it... here all about mana tokens 2013

PostPosted: 26 Jul 2012, 22:21
by RiiakShiNal
Aiodren wrote:@Riiak: Are you sure? First i had the same code as Tyrany and it didn't work at all, so i assumed after seeing the code of fireminds Apostle's Blessing that the function now doesn't return numbers anymore.
Yes, I'm sure if you look at the decoded lol files the COLOUR_ constants are defined there (that's where I pulled the list from in my previous post). The chosen colour can be stored using either Int_Set() or Set_Int() and later retrieved using Int_Get() or Get_Int() (I actually depend on this to work for Voice of All).

Re: if anybody want it... here all about mana tokens 2013

PostPosted: 26 Jul 2012, 23:20
by thefiremind
Aiodren wrote:@Riiak: Are you sure? First i had the same code as Tyrany and it didn't work at all, so i assumed after seeing the code of fireminds Apostle's Blessing that the function now doesn't return numbers anymore.
The fact is that COLOUR_WHITE, COLOUR_BLUE, etc. are numbers, because each of them is a constant whose value is a number. So it doesn't matter if you use the constant or the number: the constants exist because it's faster to write COLOUR_BLUE instead of having to check what number stands for blue (and you can adjust the value, if needed, only on the constant declaration, rather than everywhere you used that value). If you look at my Silhana Starfletcher, I use the numbers to select which mana ability he should grant to himself.

Re: if anybody want it... here all about mana tokens 2013

PostPosted: 29 Jul 2012, 23:45
by Persee
Thx for the job nabeshin.

Re: if anybody want it... here all about mana tokens 2013

PostPosted: 30 Jul 2012, 21:38
by nabeshin
Persee wrote:Thx for the job nabeshin.
it is adaptation from 2012, collaboration, it is not necessary to thank. :) (modesty: default - on)

Re: if anybody want it... here all about mana tokens 2013

PostPosted: 04 Aug 2012, 15:55
by alexandreonly
I'm having problems with dark ritual.
Code: Select all
<?xml version='1.0'?>
<CARD_V2>
  <FILENAME text="DARK_RITUAL_3285" />
  <CARDNAME text="DARK_RITUAL" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Dark Ritual]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Dark Ritual]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Dark Ritual]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Dark Ritual]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Dark Ritual]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Dark Ritual]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Dark Ritual]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Dark Ritual]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Dark Ritual]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="3285" />
  <ARTID value="3285" />
  <ARTIST name="John Coulthart" />
  <CASTING_COST cost="{B}" />
  <FLAVOURTEXT>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[“The ceremony ended with a voice from the shadows, a voice with vast, ominous power.”
—Kifimbo, Shadow Guildmage]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[“The ceremony ended with a voice from the shadows, a voice with vast, ominous power.”
—Kifimbo, Shadow Guildmage]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[“The ceremony ended with a voice from the shadows, a voice with vast, ominous power.”
—Kifimbo, Shadow Guildmage]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[“The ceremony ended with a voice from the shadows, a voice with vast, ominous power.”
—Kifimbo, Shadow Guildmage]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[“The ceremony ended with a voice from the shadows, a voice with vast, ominous power.”
—Kifimbo, Shadow Guildmage]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[“The ceremony ended with a voice from the shadows, a voice with vast, ominous power.”
—Kifimbo, Shadow Guildmage]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[“The ceremony ended with a voice from the shadows, a voice with vast, ominous power.”
—Kifimbo, Shadow Guildmage]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[“The ceremony ended with a voice from the shadows, a voice with vast, ominous power.”
—Kifimbo, Shadow Guildmage]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[“The ceremony ended with a voice from the shadows, a voice with vast, ominous power.”
—Kifimbo, Shadow Guildmage]]></LOCALISED_TEXT>
  </FLAVOURTEXT>
  <TYPE metaname="Instant" />
  <EXPANSION value="DPG" />
  <RARITY metaname="C" />
  <SPELL_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Add {B}{B}{B} to your mana pool.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Add {B}{B}{B} to your mana pool.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Add {B}{B}{B} to your mana pool.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Add {B}{B}{B} to your mana pool.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Add {B}{B}{B} to your mana pool.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Add {B}{B}{B} to your mana pool.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Add {B}{B}{B} to your mana pool.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Add {B}{B}{B} to your mana pool.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Add {B}{B}{B} to your mana pool.]]></LOCALISED_TEXT>
    <RESOLUTION_TIME_ACTION>
     ProduceMana( "B", 3 )
   </RESOLUTION_TIME_ACTION>
  </SPELL_ABILITY>
</CARD_V2>

Re: if anybody want it... here all about mana tokens 2013

PostPosted: 04 Aug 2012, 21:10
by BlindWillow
alexandreonly wrote:I'm having problems with dark ritual.
You need to register the black mana tokens.

Code: Select all
<TOKEN_REGISTRATION reservation="1" type="MANATOKEN_B"/>

Re: if anybody want it... here all about mana tokens 2013

PostPosted: 05 Aug 2012, 01:40
by alexandreonly
BlindWillow wrote:
alexandreonly wrote:I'm having problems with dark ritual.
You need to register the black mana tokens.

Code: Select all
<TOKEN_REGISTRATION reservation="1" type="MANATOKEN_B"/>
I did it now, but dark ritual still go to graveyard without producing mana.

Re: if anybody want it... here all about mana tokens 2013

PostPosted: 06 Aug 2012, 04:37
by BlindWillow
alexandreonly wrote:I did it now, but dark ritual still go to graveyard without producing mana.
I tested it, and it worked for me. Make sure you have all of the mana token cards in the "CARDS" folder (there should be six), 01_FUNC.lol in the "FUNCTIONS" folder (which you have to create, if you haven't already), and 88888888.tdx in the ART_ASSETS/ILLUSTRATIONS folder.

Re: if anybody want it... here all about mana tokens 2013

PostPosted: 28 Feb 2013, 13:39
by thefiremind
Here is something that you probably would never expected, but... I coded my own mana tokens! My aim is to make a storm deck and I need Pyretic Ritual and similar cards to achieve that. Since those mana-producing spells aren't mana abilities, they are free from the incompatibilities that always keep me away from mana tokens.

While I know that nabeshin's version works perfectly already, I wanted to code my own because I needed to experiment something and it's easier when I know and understand 100% of the involved code. The results of my experiment were good: I invented a way to nullify the interaction between token-duplicating cards (Doubling Season, Parallel Lives, etc.) and mana tokens (or any kind of invisibile token that you don't want to be replicated), without the need to edit the token-duplicating cards! The idea is simple: pass a chest to the token-creating function. Now you have pointers to the created tokens, and you know how many of them you wanted, so you can iterate over the chest and exile the excess tokens! :D

This is the content of the new LOL file I created:
Code: Select all
CreateManaTokens = function(color, number, chest)
-- creates the selected number of mana tokens of the selected color (it needs a chest for storing tokens and allowing use of the next function)
   local color_letter = {"W", "U", "B", "R", "G", "C"}
   local fixed_color = color
   if color == 0 then
      fixed_color = 6
   end
   local file_name = "_MANA_TOKEN_"..color_letter[fixed_color].."_1999200"..fixed_color
   MTG():PutTokensIntoPlay( file_name, number, EffectController(), chest )
end

RemoveRedundantTokens = function(number, chest)
-- removes tokens beyond number from chest (against effects like Doubling Season)
   if chest ~= nil then
      local i = number
      local token = chest:Get_NthCardPtr(i)
      while token ~= nil do
         token:RemoveFromGame()
         i = i+1
         token = chest:Get_NthCardPtr(i)
      end
   end
end

CheckManaPool = function()
-- gives a message that displays the available mana tokens
   local player = EffectController()
   if player:IsAI() == 0 then
      local color_letter = {"W", "U", "B", "R", "G"}
      local message = ""
      local filter = Object():GetFilter()
      filter:Clear()
      filter:SetZone(ZONE_IN_PLAY)
      filter:SetController(player)
      filter:AddCardName("_MANA_TOKEN_C")
      filter:NotTargetted()
      local count = filter:Count()
      if count > 0 then
         message = "{"..count.."}"
      end
      for i=1,5 do
         filter:Clear()
         filter:SetZone(ZONE_IN_PLAY)
         filter:SetController(player)
         filter:AddCardName("_MANA_TOKEN_"..color_letter[i])
         filter:NotTargetted()
         count = filter:Count()
         if count > 0 then
            for j=1,count do
               message = message.."{"..color_letter[i].."}"
            end
         end
      end
      player:DisplayMessage(" mana pool: \]\n\n\["..message)
   end
end
This is Pyretic Ritual as an example:
Code: Select all
<?xml version='1.0'?>
<CARD_V2>
  <FILENAME text="PYRETIC_RITUAL_205067" />
  <CARDNAME text="PYRETIC_RITUAL" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Pyretic Ritual]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Rituale Febbrile]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Pyretisches Ritual]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Rituel pyrétique]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Ritual febril]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[発熱の儀式]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Pyretic Ritual]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Пирогенный Ритуал]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Ritual Pirético]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="205067" />
  <ARTID value="A205067" />
  <ARTIST name="James Paick" />
  <CASTING_COST cost="{1}{R}" />
  <FLAVOURTEXT>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[The Multiverse is filled with limitless power just waiting for someone to reach out and seize it.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Il Multiverso è pieno di potere illimitato in attesa di qualcuno che allunghi la mano per coglierlo.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Das Multiversum steckt voll mit unendlicher Kraft, die nur darauf wartet, dass jemand nach ihr greift und sie nutzt.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Le Multivers contient une puissance illimitée qui n’attend que celui qui s’en emparera.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[El Multiverso está lleno de poder infinito esperando a ser alcanzado y aprovechado.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[多元宇宙は、誰かが手を伸ばして捕まえるのを待ち続ける無限の力に満ちている。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[The Multiverse is filled with limitless power just waiting for someone to reach out and seize it.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Мультивселенная наполнена безграничной силой — осталось лишь сделать усилие и заполучить ее.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[O multiverso está repleto de poder ilimitado aguardando por alguém que estenda a mão e o capture.]]></LOCALISED_TEXT>
  </FLAVOURTEXT>
  <TYPE metaname="Instant" />
  <EXPANSION value="M11" />
  <RARITY metaname="C" />
  <SPELL_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Add {R}{R}{R} to your mana pool.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Aggiungi {R}{R}{R} alla tua riserva di mana.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Erhöhe deinen Manavorrat um {R}{R}{R}.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Ajoutez {R}{R}{R} à votre réserve.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Agrega {R}{R}{R} a tu reserva de maná.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[あなたのマナ・プールに{R}{R}{R}を加える。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[{R}{R}{R}를 당신의 마나풀에 담는다.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Добавьте {R}{R}{R} в ваше хранилище маны.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Adicione {R}{R}{R} à sua reserva de mana.]]></LOCALISED_TEXT>
    <RESOLUTION_TIME_ACTION>
    CreateManaTokens( COLOUR_RED, 3, EffectDC():Make_Chest(1) )
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    RemoveRedundantTokens( 3, EffectDC():Get_Chest(1) )
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    CheckManaPool()
    </RESOLUTION_TIME_ACTION>
  </SPELL_ABILITY>
  <AI_AVAILABILITY type="in_response" />
  <AI_AVAILABILITY step="main_1" turn="my_turn" />
  <AI_AVAILABILITY step="main_2" turn="my_turn" />
  <TOKEN_REGISTRATION reservation="1" type="_MANA_TOKEN_R_19992004" />
  <AI_BASE_SCORE score="150" zone="ZONE_HAND" />
</CARD_V2>
The last function you see in the LOL file returns a message with the available mana from mana tokens: since they are invisible, it should be helpful in doing the math.

I made two tests with both me and the AI using a test deck composed by just 15 copies of Pyretic Ritual and 15 copies of Doubling Season. In the first test I had forgot the AI_AVAILABILITY blocks and the AI never used Pyretic Ritual, but after adding them, the AI correctly played 2 Pyretic Ritual to be able to cast Doubling Season!

I attached the involved files so you can try and experiment (and eventually find bugs :wink:).

Re: if anybody want it... here all about mana tokens 2013

PostPosted: 28 Feb 2013, 18:55
by NEMESiS
I was also pondering about making a storm deck, possibly make cifka's deck that I compiled here:

http://www.mtgdeckbuilder.net/Decks/EditDeck/446523

Are you making a dragon storm deck?