It is currently 18 Jul 2025, 22:15
   
Text Size

Formal Request Thread

Moderator: CCGHQ Admins

Re: Formal Request Thread

Postby thefiremind » 27 Dec 2013, 09:29

NeoAnderson wrote:Hey Fire, have you seen my version of Pyromancer's Swath what you think about this solution to change the damage amount?
I know it is not exactly what we would do, but until DotP developers, decide to use functions that make sense, i think can be an acceptable approximation.
If the committer is happy with that, I'm happy too. :lol:

NeoAnderson wrote:There is any possibility to remove an attacking creture (after attacking declared) without using function to put it into another zone?
Not that I know. Having a RemoveFromCombat function would allow a relatively high number of cards to be coded, not only those 2 from Arabian Nights... let's hope for that in DotP2015. :roll:
< 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: 722 times

Re: Formal Request Thread

Postby RiiakShiNal » 27 Dec 2013, 14:15

thefiremind wrote:
NeoAnderson wrote:There is any possibility to remove an attacking creture (after attacking declared) without using function to put it into another zone?
Not that I know. Having a RemoveFromCombat function would allow a relatively high number of cards to be coded, not only those 2 from Arabian Nights... let's hope for that in DotP2015. :roll:
As thefiremind said there is no known way to remove a creature from combat, especially not after STEP_DECLARE_BLOCKERS without changing zone. If we had a RemoveFromCombat function as mentioned by thefiremind then it would indeed be possible, but without it we simply can't properly manage it. If we simply try to prevent both dealing and receiving damage (with any damage received being re-directed to the player) it would still not work as cards like Thicket Basilisk and Cockatrice would still destroy the creature at end of combat due to their abilities and Cunning Giant, Mirror Strike, and Snag would not work properly due to the creature being considered "blocked" even though it's blocker was supposed to be "removed from combat".

Trying to code it by forcibly changing zones has other problems such as zone change triggers, loss of counters/auras/effects, reapplication of summoning sickness, etc....

So no, there is no way to code it properly in DotP 2014.
RiiakShiNal
Programmer
 
Posts: 2188
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Formal Request Thread

Postby NeoAnderson » 27 Dec 2013, 17:35

RiiakShiNal wrote:
thefiremind wrote:
NeoAnderson wrote:There is any possibility to remove an attacking creture (after attacking declared) without using function to put it into another zone?
Not that I know. Having a RemoveFromCombat function would allow a relatively high number of cards to be coded, not only those 2 from Arabian Nights... let's hope for that in DotP2015. :roll:
As thefiremind said there is no known way to remove a creature from combat, especially not after STEP_DECLARE_BLOCKERS without changing zone. If we had a RemoveFromCombat function as mentioned by thefiremind then it would indeed be possible, but without it we simply can't properly manage it. If we simply try to prevent both dealing and receiving damage (with any damage received being re-directed to the player) it would still not work as cards like Thicket Basilisk and Cockatrice would still destroy the creature at end of combat due to their abilities and Cunning Giant, Mirror Strike, and Snag would not work properly due to the creature being considered "blocked" even though it's blocker was supposed to be "removed from combat".

Trying to code it by forcibly changing zones has other problems such as zone change triggers, loss of counters/auras/effects, reapplication of summoning sickness, etc....

So no, there is no way to code it properly in DotP 2014.
As i was supposing, in fact i made some tests, but the only possibility is to use zones change, i removed a card after blockers declared, putting in hand and replacing the putinhand with putontobattlefield, it worked but the unblocked creature doesn't dealt the damage. About the loss of counters/auras/effects could be resolved using the code i used to make Oubliette, but honestly it will become too complicated and still can have some unwanted effect. So just give up.

Now i just coded a card from Arabian Night set, it is Metamorphosis.
I had to face with "Use this mana only for creature spell".
My approach is not to create mana token but just to reduce the cost of creatures spells.
The card works probably the only bad thing is that this fake added mana has the priority when you cast new creature spell.

Please could you take a look to this card and let me know your opinion and if i have not considered something?


Metamorphosis | Open
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
  <FILENAME text="METAMORPHOSIS_2833" />
  <CARDNAME text="METAMORPHOSIS" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Metamorphosis]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Métamorphose]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Metamorfosis]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Metamorphose]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Metamorfosi]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[変態]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[변형]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[метаморфоза]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Metamorfose]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="2833" />
  <ARTID value="2833" />
  <ARTIST name="Christopher Rush" />
  <CASTING_COST cost="{G}" />
  <TYPE metaname="Sorcery" />
  <EXPANSION value="AN" />
  <RARITY metaname="C" />
    <UTILITY_ABILITY qualifier="Additional">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[As an additional cost to cast Metamorphosis, sacrifice a creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[As an additional cost to cast Metamorphosis, sacrifice a creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[As an additional cost to cast Metamorphosis, sacrifice a creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[As an additional cost to cast Metamorphosis, sacrifice a creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[As an additional cost to cast Metamorphosis, sacrifice a creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[As an additional cost to cast Metamorphosis, sacrifice a creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[As an additional cost to cast Metamorphosis, sacrifice a creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[As an additional cost to cast Metamorphosis, sacrifice a creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[As an additional cost to cast Metamorphosis, sacrifice a creature.]]></LOCALISED_TEXT>
    <COST type="generic">
      <PREREQUISITE>
        local filter = ClearFilter()
        filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
        filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
        return filter:CountStopAt(1) == 1
      </PREREQUISITE>
      <RESOLUTION_TIME_ACTION>
        local filter = ClearFilter()
        filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
        filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
        EffectController():ChooseItem( "CARD_QUERY_CHOOSE_CREATURE_TO_SACRIFICE", EffectDC():Make_Targets(0) )
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
        local Chest_id = Object():GetRef()
        local creature = EffectDC():Get_Targets(0):Get_CardPtr(0)
         local chest = EffectController():PlayerDataChest():Get_Chest(Chest_id)
         if chest == nil then
            chest = EffectController():PlayerDataChest():Make_Chest(Chest_id)
         end
        if creature ~= nil then
            EffectDC():Get_Targets(0):LKIShield_CardPtr(0)
           local Quantity = creature:GetConvertedManaCost()
           chest:Set_Int(0,Quantity)
            EffectController():Sacrifice(creature)
        end
      </RESOLUTION_TIME_ACTION>
    </COST>
</UTILITY_ABILITY>

<SPELL_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Add X mana of any one color to your mana pool, where X is one plus the sacrificed creature’s converted mana cost. Spend this mana only to cast creature spells.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[En tant que coût supplémentaire pour lancer la Métamorphose, sacrifiez une créature. Ajoutez X manas de la couleur à votre réserve, où X est un plus le coût converti de mana de la créature sacrifiée. Ne dépensez ce mana que pour lancer des sorts de créature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Como coste adicional para lanzar Metamorfosis, sacrifica una criatura. Agrega X maná de cualquier color a tu reserva de maná, donde X es uno más coste de maná convertido de la criatura sacrificada. Usa este maná sólo para lanzar hechizos de criatura.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Als zusätzliche Kosten, Metamorphosis zu werfen, eine Kreatur zu opfern. In X Mana einer beliebigen Farbe zu deinem Manavorrat, wobei X ein Plus der geopferten Kreatur umgewandelten Manakosten. Dieses Mana nur, um Geschöpf Zaubersprüche.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Come costo addizionale per lanciare Metamorfosi, sacrifica una creatura. Aggiungi X mana di qualsiasi colore alla tua riserva di mana, dove X è uno più il costo di mana convertito della creatura sacrificata. Spendi questo mana solo per lanciare magie creatura.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[追加コストが変身をキャストするように、クリーチャーを1体生け贄に捧げる。 Xが1プラス犠牲にクリーチャーの点数で見たマナ·コストであるあなたのマナ·プールにいずれか1色のX点を加える。唯一のクリーチャー呪文を唱えるために、このマナを費やしています。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[추가 비용이 변태 캐스팅으로, 동물을 희생. X가 하나 더하기 희생 된 생물의 변환 마나 당신의 마나 풀, 어느 한 색상의 X 마나를 추가합니다. 단지 생물 마법을이 마나를 소비한다.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[В качестве дополнительной стоимости, чтобы бросить Метаморфоза, пожертвуйте существо. Добавить X ману любого одного цвета в ваше хранилище маны, где Х один плюс превращается затраты маны принесенного в жертву существа. Проведите эту ману только бросить земные заклинания.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Como custo adicional para conjurar Metamorphosis, sacrifique uma criatura. Adicionar X mana de qualquer cor à sua reserva de mana, onde X é um mais o custo de mana convertido da criatura sacrificada. Gaste este mana somente para jogar mágicas de criatura.]]></LOCALISED_TEXT>
       <RESOLUTION_TIME_ACTION>
                EffectController():ChooseColour( "CARD_QUERY_CHOOSE_COLOUR", true )
      </RESOLUTION_TIME_ACTION>

      <RESOLUTION_TIME_ACTION>
   local nColour = GetChosenColour()
        local Chest_id = Object():GetRef()
        local chest = EffectController():PlayerDataChest():Get_Chest(Chest_id)
         if chest == nil then
            chest = EffectController():PlayerDataChest():Make_Chest(Chest_id)
         end
            chest:Set_Int(1,nColour)
            chest:Int_Inc(0)
   
    </RESOLUTION_TIME_ACTION>

      <RESOLUTION_TIME_ACTION>
        local Chest_id = Object():GetRef()
        local delayDC = EffectDC():Make_Chest(1)
       delayDC:Set_CardPtr(0, TriggerObject())
        delayDC:Protect_CardPtr(0)
        delayDC:Set_Int(1, Chest_id)
        MTG():CreateDelayedTrigger(1, delayDC)
        MTG():CreateDelayedTrigger(2, delayDC)
        MTG():CreateDelayedTrigger(4, delayDC)
    </RESOLUTION_TIME_ACTION>
</SPELL_ABILITY>


<TRIGGERED_ABILITY resource_id="1" replacement_effect="1" >
 <TRIGGER value="CONSIDERED_FOR_CAST" simple_qualifier="controller" pre_trigger="1">
      local Chest_id = EffectDC():Get_Int(1)
      local chest = EffectController():PlayerDataChest():Get_Chest(Chest_id)
      if chest ~= nil then
         local Quantity = chest:Get_Int(0)
         if ( TriggerObject():GetCardType():Test( CARD_TYPE_CREATURE ) ) and (Quantity &gt; 0) then
            return true
         end
      else
          return false
     end
 </TRIGGER>

      <RESOLUTION_TIME_ACTION>
        local Chest_id = EffectDC():Get_Int(1)
        local chest = EffectController():PlayerDataChest():Get_Chest(Chest_id)
       if chest ~= nil then
            local nColour = chest:Get_Int(1)
            local Quantity = chest:Get_Int(0)
        if TriggerObject() ~= nil then
           TriggerObject():DecreaseColouredCost( nColour, Quantity )
           CurrentChromaCount =  ColourManaCountIntoCardIntoZone(nColour, TriggerObject(), EffectController(), ZONE_HAND)
           ColourlessCount = ColourManaCountIntoCardIntoZone(COLOUR_COLOURLESS, TriggerObject(), EffectController(), ZONE_HAND)
           if Quantity &gt; CurrentChromaCount and ColourlessCount &gt; 0 then
              local remainQuantity = Quantity - CurrentChromaCount
              TriggerObject():DecreaseCost( remainQuantity )
           end
        end
      end
     </RESOLUTION_TIME_ACTION>

</TRIGGERED_ABILITY>



<TRIGGERED_ABILITY resource_id="2">
 <TRIGGER value="SPELL_PLAYED" simple_qualifier="objectyoucontrol">
      local Chest_id = EffectDC():Get_Int(1)
      local chest = EffectController():PlayerDataChest():Get_Chest(Chest_id)
      if chest ~= nil and TriggerObject():WasCast() then
         local Quantity = chest:Get_Int(0)
         if ( TriggerObject():GetCardType():Test( CARD_TYPE_CREATURE ) ) and (Quantity &gt; 0) then
            local delayDC = EffectDC():Make_Chest(1)
           delayDC:Set_CardPtr(0, TriggerObject())
            delayDC:Protect_CardPtr(0)
            delayDC:Set_Int(1, Chest_id)
           MTG():CreateDelayedTrigger(3, delayDC)
            return true
         end
      else
          return false
     end
 </TRIGGER>

</TRIGGERED_ABILITY>

<TRIGGERED_ABILITY resource_id="3">
<TRIGGER value="ZONECHANGE_END" simple_qualifier="objectyoucontrol" to_zone="ZONE_ANY" >
      local Chest_id = EffectDC():Get_Int(1)
      local chest = EffectController():PlayerDataChest():Get_Chest(Chest_id)
      if chest ~= nil and TriggerObject() == EffectDC():Get_CardPtr(0) then
         local Quantity = chest:Get_Int(0)
         if ( TriggerObject():GetCardType():Test( CARD_TYPE_CREATURE ) ) and (Quantity &gt; 0) then
            return true
         end
      else
          return false
     end
 </TRIGGER>
 <CLEANUP fire_once="1" />

    <RESOLUTION_TIME_ACTION>
     local Chest_id = EffectDC():Get_Int(1)
     local chest = EffectController():PlayerDataChest():Get_Chest(Chest_id)
     if chest ~= nil then
        local nColour = chest:Get_Int(1)
        local Quantity = chest:Get_Int(0)
        local card = EffectDC():Get_CardPtr(0)
        local cardzone = card:GetZone()
        CurrentChromaCount =  ColourManaCountIntoCardIntoZone(nColour, card, EffectController(), cardzone)
        ColourlessCount = ColourManaCountIntoCardIntoZone(COLOUR_COLOURLESS, card, EffectController(), cardzone)
        if Quantity &gt;= CurrentChromaCount  then
           Quantity = Quantity - CurrentChromaCount
           if Quantity &gt; ColourlessCount then
                 Quantity = Quantity - ColourlessCount
           else
       Quantity = 0
           end
        else
           Quantity = 0
        end
       chest:Set_Int(0,Quantity)
     end
       
    </RESOLUTION_TIME_ACTION>

  <RESOLUTION_TIME_ACTION>
     local Chest_id = EffectDC():Get_Int(1)
     local chest = EffectController():PlayerDataChest():Get_Chest(Chest_id)
     if chest ~= nil then
        local nColour = chest:Get_Int(1)
        local Quantity = chest:Get_Int(0)
        local CharColour = ""
         if (nColour == 1) then
      CharColour = "{W}"
   elseif (nColour == 2) then
      CharColour = "{U}"
   elseif (nColour == 3) then
      CharColour = "{B}"
   elseif (nColour == 4) then
      CharColour = "{R}"
   else   
      CharColour = "{G}"
        end
      EffectController():DisplayMessage("Remaining mana -  "..CharColour.." : "..Quantity)
    end
  </RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>

<TRIGGERED_ABILITY resource_id="4">
<TRIGGER value="BEGINNING_OF_STEP">
      local Chest_id = EffectDC():Get_Int(1)
      local chest = EffectController():PlayerDataChest():Get_Chest(Chest_id)
      if chest ~= nil then
         if MTG():GetStep() == STEP_BEGIN_COMBAT or MTG():GetStep() == STEP_END_OF_TURN then
            return true
         end
      else
          return false
     end
</TRIGGER>
 <CLEANUP fire_once="1" />
 <CLEANUP simple_cleanup="EndOfTurn" />
 <RESOLUTION_TIME_ACTION>
  local Chest_id = EffectDC():Get_Int(1)
  local chest = EffectController():PlayerDataChest():Get_Chest(Chest_id)
  local Quantity = chest:Get_Int(0)
  if Quantity &gt; 0 then
     chest:Set_Int(0,0)
  end
  MTG():RemoveDelayedTrigger(1)
  MTG():RemoveDelayedTrigger(2)
  </RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>

</CARD_V2>
Needed custom function (without this function the card will not work):
Custom Function | Open
Code: Select all
ColourManaCountIntoCardIntoZone = function(nColour, nCard, nPlayer, nZone)
local filter = ClearFilter()
    local CurrentChromaCount = 0
         if nCard ~= nil then
        filter:Clear()
             local filter = ClearFilter()
        filter:SetZone(nZone, nPlayer)
             filter:Add(FE_CARD_INSTANCE, OP_IS, nCard)
             CurrentChromaCount =  filter:ChromaCount(nColour)
               if (CurrentChromaCount > 0) then
                   return CurrentChromaCount
               else
                   return 0
               end
        else
       return 0
        end
end
NeoAnderson
 
Posts: 914
Joined: 10 Sep 2013, 07:49
Has thanked: 18 times
Been thanked: 139 times

Re: Formal Request Thread

Postby RiiakShiNal » 28 Dec 2013, 01:16

NeoAnderson wrote:As i was supposing, in fact i made some tests, but the only possibility is to use zones change, i removed a card after blockers declared, putting in hand and replacing the putinhand with putontobattlefield, it worked but the unblocked creature doesn't dealt the damage. About the loss of counters/auras/effects could be resolved using the code i used to make Oubliette, but honestly it will become too complicated and still can have some unwanted effect. So just give up.
The reason the "unblocked" creature did no damage is that it is still counted as blocked by MtG rules and the DotP engine. This is why tricks like blocking a creature then returning it to your hand work to prevent taking damage.

Though what you did for Oubliette won't work for restoring effects as we have no way of restoring those. For example if you use Sensei Golden-Tail to add Bushido 1 to a creature then use Oubliette the creature will lose that effect. No matter what tricks we try to use we can't restore used ability effects so removing a creature from battle will never work without full support from the engine.

NeoAnderson wrote:Now i just coded a card from Arabian Night set, it is Metamorphosis.
I had to face with "Use this mana only for creature spell".
My approach is not to create mana token but just to reduce the cost of creatures spells.
The card works probably the only bad thing is that this fake added mana has the priority when you cast new creature spell.

Please could you take a look to this card and let me know your opinion and if i have not considered something?


Metamorphosis | Open
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
  <FILENAME text="METAMORPHOSIS_2833" />
  <CARDNAME text="METAMORPHOSIS" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Metamorphosis]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Métamorphose]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Metamorfosis]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Metamorphose]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Metamorfosi]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[変態]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[변형]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[метаморфоза]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Metamorfose]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="2833" />
  <ARTID value="2833" />
  <ARTIST name="Christopher Rush" />
  <CASTING_COST cost="{G}" />
  <TYPE metaname="Sorcery" />
  <EXPANSION value="AN" />
  <RARITY metaname="C" />
    <UTILITY_ABILITY qualifier="Additional">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[As an additional cost to cast Metamorphosis, sacrifice a creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[As an additional cost to cast Metamorphosis, sacrifice a creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[As an additional cost to cast Metamorphosis, sacrifice a creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[As an additional cost to cast Metamorphosis, sacrifice a creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[As an additional cost to cast Metamorphosis, sacrifice a creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[As an additional cost to cast Metamorphosis, sacrifice a creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[As an additional cost to cast Metamorphosis, sacrifice a creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[As an additional cost to cast Metamorphosis, sacrifice a creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[As an additional cost to cast Metamorphosis, sacrifice a creature.]]></LOCALISED_TEXT>
    <COST type="generic">
      <PREREQUISITE>
        local filter = ClearFilter()
        filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
        filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
        return filter:CountStopAt(1) == 1
      </PREREQUISITE>
      <RESOLUTION_TIME_ACTION>
        local filter = ClearFilter()
        filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
        filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
        EffectController():ChooseItem( "CARD_QUERY_CHOOSE_CREATURE_TO_SACRIFICE", EffectDC():Make_Targets(0) )
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
        local Chest_id = Object():GetRef()
        local creature = EffectDC():Get_Targets(0):Get_CardPtr(0)
         local chest = EffectController():PlayerDataChest():Get_Chest(Chest_id)
         if chest == nil then
            chest = EffectController():PlayerDataChest():Make_Chest(Chest_id)
         end
        if creature ~= nil then
            EffectDC():Get_Targets(0):LKIShield_CardPtr(0)
           local Quantity = creature:GetConvertedManaCost()
           chest:Set_Int(0,Quantity)
            EffectController():Sacrifice(creature)
        end
      </RESOLUTION_TIME_ACTION>
    </COST>
</UTILITY_ABILITY>

<SPELL_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Add X mana of any one color to your mana pool, where X is one plus the sacrificed creature’s converted mana cost. Spend this mana only to cast creature spells.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[En tant que coût supplémentaire pour lancer la Métamorphose, sacrifiez une créature. Ajoutez X manas de la couleur à votre réserve, où X est un plus le coût converti de mana de la créature sacrifiée. Ne dépensez ce mana que pour lancer des sorts de créature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Como coste adicional para lanzar Metamorfosis, sacrifica una criatura. Agrega X maná de cualquier color a tu reserva de maná, donde X es uno más coste de maná convertido de la criatura sacrificada. Usa este maná sólo para lanzar hechizos de criatura.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Als zusätzliche Kosten, Metamorphosis zu werfen, eine Kreatur zu opfern. In X Mana einer beliebigen Farbe zu deinem Manavorrat, wobei X ein Plus der geopferten Kreatur umgewandelten Manakosten. Dieses Mana nur, um Geschöpf Zaubersprüche.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Come costo addizionale per lanciare Metamorfosi, sacrifica una creatura. Aggiungi X mana di qualsiasi colore alla tua riserva di mana, dove X è uno più il costo di mana convertito della creatura sacrificata. Spendi questo mana solo per lanciare magie creatura.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[追加コストが変身をキャストするように、クリーチャーを1体生け贄に捧げる。 Xが1プラス犠牲にクリーチャーの点数で見たマナ·コストであるあなたのマナ·プールにいずれか1色のX点を加える。唯一のクリーチャー呪文を唱えるために、このマナを費やしています。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[추가 비용이 변태 캐스팅으로, 동물을 희생. X가 하나 더하기 희생 된 생물의 변환 마나 당신의 마나 풀, 어느 한 색상의 X 마나를 추가합니다. 단지 생물 마법을이 마나를 소비한다.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[В качестве дополнительной стоимости, чтобы бросить Метаморфоза, пожертвуйте существо. Добавить X ману любого одного цвета в ваше хранилище маны, где Х один плюс превращается затраты маны принесенного в жертву существа. Проведите эту ману только бросить земные заклинания.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Como custo adicional para conjurar Metamorphosis, sacrifique uma criatura. Adicionar X mana de qualquer cor à sua reserva de mana, onde X é um mais o custo de mana convertido da criatura sacrificada. Gaste este mana somente para jogar mágicas de criatura.]]></LOCALISED_TEXT>
       <RESOLUTION_TIME_ACTION>
                EffectController():ChooseColour( "CARD_QUERY_CHOOSE_COLOUR", true )
      </RESOLUTION_TIME_ACTION>

      <RESOLUTION_TIME_ACTION>
   local nColour = GetChosenColour()
        local Chest_id = Object():GetRef()
        local chest = EffectController():PlayerDataChest():Get_Chest(Chest_id)
         if chest == nil then
            chest = EffectController():PlayerDataChest():Make_Chest(Chest_id)
         end
            chest:Set_Int(1,nColour)
            chest:Int_Inc(0)
   
    </RESOLUTION_TIME_ACTION>

      <RESOLUTION_TIME_ACTION>
        local Chest_id = Object():GetRef()
        local delayDC = EffectDC():Make_Chest(1)
       delayDC:Set_CardPtr(0, TriggerObject())
        delayDC:Protect_CardPtr(0)
        delayDC:Set_Int(1, Chest_id)
        MTG():CreateDelayedTrigger(1, delayDC)
        MTG():CreateDelayedTrigger(2, delayDC)
        MTG():CreateDelayedTrigger(4, delayDC)
    </RESOLUTION_TIME_ACTION>
</SPELL_ABILITY>


<TRIGGERED_ABILITY resource_id="1" replacement_effect="1" >
 <TRIGGER value="CONSIDERED_FOR_CAST" simple_qualifier="controller" pre_trigger="1">
      local Chest_id = EffectDC():Get_Int(1)
      local chest = EffectController():PlayerDataChest():Get_Chest(Chest_id)
      if chest ~= nil then
         local Quantity = chest:Get_Int(0)
         if ( TriggerObject():GetCardType():Test( CARD_TYPE_CREATURE ) ) and (Quantity &gt; 0) then
            return true
         end
      else
          return false
     end
 </TRIGGER>

      <RESOLUTION_TIME_ACTION>
        local Chest_id = EffectDC():Get_Int(1)
        local chest = EffectController():PlayerDataChest():Get_Chest(Chest_id)
       if chest ~= nil then
            local nColour = chest:Get_Int(1)
            local Quantity = chest:Get_Int(0)
        if TriggerObject() ~= nil then
           TriggerObject():DecreaseColouredCost( nColour, Quantity )
           CurrentChromaCount =  ColourManaCountIntoCardIntoZone(nColour, TriggerObject(), EffectController(), ZONE_HAND)
           ColourlessCount = ColourManaCountIntoCardIntoZone(COLOUR_COLOURLESS, TriggerObject(), EffectController(), ZONE_HAND)
           if Quantity &gt; CurrentChromaCount and ColourlessCount &gt; 0 then
              local remainQuantity = Quantity - CurrentChromaCount
              TriggerObject():DecreaseCost( remainQuantity )
           end
        end
      end
     </RESOLUTION_TIME_ACTION>

</TRIGGERED_ABILITY>



<TRIGGERED_ABILITY resource_id="2">
 <TRIGGER value="SPELL_PLAYED" simple_qualifier="objectyoucontrol">
      local Chest_id = EffectDC():Get_Int(1)
      local chest = EffectController():PlayerDataChest():Get_Chest(Chest_id)
      if chest ~= nil and TriggerObject():WasCast() then
         local Quantity = chest:Get_Int(0)
         if ( TriggerObject():GetCardType():Test( CARD_TYPE_CREATURE ) ) and (Quantity &gt; 0) then
            local delayDC = EffectDC():Make_Chest(1)
           delayDC:Set_CardPtr(0, TriggerObject())
            delayDC:Protect_CardPtr(0)
            delayDC:Set_Int(1, Chest_id)
           MTG():CreateDelayedTrigger(3, delayDC)
            return true
         end
      else
          return false
     end
 </TRIGGER>

</TRIGGERED_ABILITY>

<TRIGGERED_ABILITY resource_id="3">
<TRIGGER value="ZONECHANGE_END" simple_qualifier="objectyoucontrol" to_zone="ZONE_ANY" >
      local Chest_id = EffectDC():Get_Int(1)
      local chest = EffectController():PlayerDataChest():Get_Chest(Chest_id)
      if chest ~= nil and TriggerObject() == EffectDC():Get_CardPtr(0) then
         local Quantity = chest:Get_Int(0)
         if ( TriggerObject():GetCardType():Test( CARD_TYPE_CREATURE ) ) and (Quantity &gt; 0) then
            return true
         end
      else
          return false
     end
 </TRIGGER>
 <CLEANUP fire_once="1" />

    <RESOLUTION_TIME_ACTION>
     local Chest_id = EffectDC():Get_Int(1)
     local chest = EffectController():PlayerDataChest():Get_Chest(Chest_id)
     if chest ~= nil then
        local nColour = chest:Get_Int(1)
        local Quantity = chest:Get_Int(0)
        local card = EffectDC():Get_CardPtr(0)
        local cardzone = card:GetZone()
        CurrentChromaCount =  ColourManaCountIntoCardIntoZone(nColour, card, EffectController(), cardzone)
        ColourlessCount = ColourManaCountIntoCardIntoZone(COLOUR_COLOURLESS, card, EffectController(), cardzone)
        if Quantity &gt;= CurrentChromaCount  then
           Quantity = Quantity - CurrentChromaCount
           if Quantity &gt; ColourlessCount then
                 Quantity = Quantity - ColourlessCount
           else
       Quantity = 0
           end
        else
           Quantity = 0
        end
       chest:Set_Int(0,Quantity)
     end
       
    </RESOLUTION_TIME_ACTION>

  <RESOLUTION_TIME_ACTION>
     local Chest_id = EffectDC():Get_Int(1)
     local chest = EffectController():PlayerDataChest():Get_Chest(Chest_id)
     if chest ~= nil then
        local nColour = chest:Get_Int(1)
        local Quantity = chest:Get_Int(0)
        local CharColour = ""
         if (nColour == 1) then
      CharColour = "{W}"
   elseif (nColour == 2) then
      CharColour = "{U}"
   elseif (nColour == 3) then
      CharColour = "{B}"
   elseif (nColour == 4) then
      CharColour = "{R}"
   else   
      CharColour = "{G}"
        end
      EffectController():DisplayMessage("Remaining mana -  "..CharColour.." : "..Quantity)
    end
  </RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>

<TRIGGERED_ABILITY resource_id="4">
<TRIGGER value="BEGINNING_OF_STEP">
      local Chest_id = EffectDC():Get_Int(1)
      local chest = EffectController():PlayerDataChest():Get_Chest(Chest_id)
      if chest ~= nil then
         if MTG():GetStep() == STEP_BEGIN_COMBAT or MTG():GetStep() == STEP_END_OF_TURN then
            return true
         end
      else
          return false
     end
</TRIGGER>
 <CLEANUP fire_once="1" />
 <CLEANUP simple_cleanup="EndOfTurn" />
 <RESOLUTION_TIME_ACTION>
  local Chest_id = EffectDC():Get_Int(1)
  local chest = EffectController():PlayerDataChest():Get_Chest(Chest_id)
  local Quantity = chest:Get_Int(0)
  if Quantity &gt; 0 then
     chest:Set_Int(0,0)
  end
  MTG():RemoveDelayedTrigger(1)
  MTG():RemoveDelayedTrigger(2)
  </RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>

</CARD_V2>
Needed custom function (without this function the card will not work):
Custom Function | Open
Code: Select all
ColourManaCountIntoCardIntoZone = function(nColour, nCard, nPlayer, nZone)
local filter = ClearFilter()
    local CurrentChromaCount = 0
         if nCard ~= nil then
        filter:Clear()
             local filter = ClearFilter()
        filter:SetZone(nZone, nPlayer)
             filter:Add(FE_CARD_INSTANCE, OP_IS, nCard)
             CurrentChromaCount =  filter:ChromaCount(nColour)
               if (CurrentChromaCount > 0) then
                   return CurrentChromaCount
               else
                   return 0
               end
        else
       return 0
        end
end
Actually there is quite a bit you haven't considered:
  • Mana should be emptied at the end of each step not just at beginning of combat or end of turn. There are ways to cast Sorcery spells outside of the 2 main phases.
  • Will not work with cards that prevent mana from being emptied from the mana pool at the end of each step.
  • Will not properly work for creatures with {X} in their mana costs.
  • You are forcing the player to use your "mana" first even if they may prefer using mana from other sources for the colourless mana. For example from Metamorphose they get 4 {R} mana and have 7 untapped {G} mana sources they should be able to cast a Shivan Dragon and an Eron the Relentless, but with your method they have no choice but to pick one or the other.
  • Mana is consumed when a spell is cast not when the spell resolves so as you have it coded you could cast a creature then continue casting creatures with flash and no mana would be consumed until the last creature cast with flash hit the battlefield (all other cast creatures are still waiting to be resolved).
  • Will not work properly for creatures with Sunburst as you are reducing the cost rather than actually providing mana.
  • Will not work with spells/abilities that allow for increasing the amount of mana in the mana pool by copying what is already there. I know there is at least one card that can do this, but I can't remember its name off the top of my head.
  • Will not work for spells/abilities that forcibly empty a player's mana pool (your "mana" would still be available even though it shouldn't be).

The only way to properly code "Spend this mana only to cast Y spells" (in the DotP 2014 engine) is by using mana tokens and having the mana tokens modified such that the mana ability is only active if the spell being considered for cast is a spell of Y type. This is quite a complex issue that I am still working through.
RiiakShiNal
Programmer
 
Posts: 2188
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Formal Request Thread

Postby NeoAnderson » 28 Dec 2013, 02:07

RiiakShiNal wrote:Actually there is quite a bit you haven't considered:
  • Mana should be emptied at the end of each step not just at beginning of combat or end of turn. There are ways to cast Sorcery spells outside of the 2 main phases.
  • Will not work with cards that prevent mana from being emptied from the mana pool at the end of each step.
  • Will not properly work for creatures with {X} in their mana costs.
  • You are forcing the player to use your "mana" first even if they may prefer using mana from other sources for the colourless mana. For example from Metamorphose they get 4 {R} mana and have 7 untapped {G} mana sources they should be able to cast a Shivan Dragon and an Eron the Relentless, but with your method they have no choice but to pick one or the other.
  • Mana is consumed when a spell is cast not when the spell resolves so as you have it coded you could cast a creature then continue casting creatures with flash and no mana would be consumed until the last creature cast with flash hit the battlefield (all other cast creatures are still waiting to be resolved).
  • Will not work properly for creatures with Sunburst as you are reducing the cost rather than actually providing mana.
  • Will not work with spells/abilities that allow for increasing the amount of mana in the mana pool by copying what is already there. I know there is at least one card that can do this, but I can't remember its name off the top of my head.
  • Will not work for spells/abilities that forcibly empty a player's mana pool (your "mana" would still be available even though it shouldn't be).

The only way to properly code "Spend this mana only to cast Y spells" (in the DotP 2014 engine) is by using mana tokens and having the mana tokens modified such that the mana ability is only active if the spell being considered for cast is a spell of Y type. This is quite a complex issue that I am still working through.
Ok just let me say, i am out of mind, i don't know how i didn't thought about of any of these issues.
Probably the simple answer is that i was too focused to understand how to avoid to use modified mana tokens, that i only thought for a walk around, forgetting all the possible interactions for the mana pool.
Thanks a lot to clarified my mind Riiak, sometimes without comparing the opinion is easy to lose the right way :-)
NeoAnderson
 
Posts: 914
Joined: 10 Sep 2013, 07:49
Has thanked: 18 times
Been thanked: 139 times

Re: Formal Request Thread

Postby RiiakShiNal » 28 Dec 2013, 02:14

NeoAnderson wrote:Ok just let me say, i am out of mind, i don't know how i didn't thought about of any of these issues.
Probably the simple answer is that i was too focused to understand how to avoid to use modified mana tokens, that i only thought for a walk around, forgetting all the possible interactions for the mana pool.
Thanks a lot to clarified my mind Riiak, sometimes without comparing the opinion is easy to lose the right way :-)
In many respects I wish there was another way to get mana to work without tokens (as there are still several drawbacks to the token method), but unfortunately we just don't have the engine support for it.
RiiakShiNal
Programmer
 
Posts: 2188
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Formal Request Thread

Postby drleg3nd » 28 Dec 2013, 14:53

hey TFM or Gorem(if ya still around) would it be possible to create a early version of Kiora planeswalker card ? i know you like to wait till it's available on gatherer but if ya help me with +1 and -5 ability i can give it a shot.thx
drleg3nd
 
Posts: 528
Joined: 14 May 2012, 20:05
Has thanked: 5 times
Been thanked: 30 times

Re: Formal Request Thread

Postby thefiremind » 28 Dec 2013, 15:31

drleg3nd wrote:hey TFM or Gorem(if ya still around) would it be possible to create a early version of Kiora planeswalker card ? i know you like to wait till it's available on gatherer but if ya help me with +1 and -5 ability i can give it a shot.thx
Kiora's +1 and -5 abilities (untested) | Open
Code: Select all
  <ACTIVATED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[(+1): Until your next turn, prevent all damage that would be dealt to and dealt by target permanent an opponent controls.]]></LOCALISED_TEXT>
    <AVAILABILITY sorcery_time="1" per_turn_limit="1" />
    <COST type="generic">
      <PREREQUISITE>
      return true
      </PREREQUISITE>
      <RESOLUTION_TIME_ACTION>
      if EffectSource() ~= nil then
         PLW_ShutDownDoublingSeason()
         EffectSource():AddCounters( MTG():GetCountersType("Loyalty"), 1 )
      end
      </RESOLUTION_TIME_ACTION>
    </COST>
    <TARGET tag="CARD_QUERY_CHOOSE_PERMANENT_AN_OPPONENT_CONTROLS" definition="0" compartment="0" count="1" />
    <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    filter:Add( FE_TEAM, OP_NOT, EffectController():GetTeam() )
    PLW_FilterPermanents(filter)
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION>
    EffectDC():Set_Int( 1, MTG():GetTurnNumber() )
    </RESOLUTION_TIME_ACTION>
    <CONTINUOUS_ACTION layer="8">
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       local characteristics = target:GetCurrentCharacteristics()
       characteristics:Bool_Set(CHARACTERISTIC_DOESNT_RECEIVE_DAMAGE, 1)
       characteristics:Bool_Set(CHARACTERISTIC_DOESNT_DEAL_DAMAGE, 1)
    end
    </CONTINUOUS_ACTION>
    <DURATION>
    return EffectDC():Get_Targets(0):Get_CardPtr(0) == nil or PLW_UntilMyNextTurn( EffectDC():Get_Int(1) )
    </DURATION>
    <SFX text="TARGET_PLASMA_PLAY" />
  </ACTIVATED_ABILITY>
Code: Select all
  <ACTIVATED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[(-5): You get an emblem with “At the beginning of your end step, put a 9/9 blue Kraken creature token onto the battlefield.”]]></LOCALISED_TEXT>
    <AVAILABILITY sorcery_time="1" per_turn_limit="1" />
    <COST type="RemoveCountersSelf" amount="5" counter_type="Loyalty" />
    <RESOLUTION_TIME_ACTION>
    MTG():CreateDelayedTrigger(1, nil)
    </RESOLUTION_TIME_ACTION>
    <SFX text="GLOBAL_TIDE_PLAY" />
  </ACTIVATED_ABILITY>
  <TRIGGERED_ABILITY resource_id="1">
    <CLEANUP>
    return EffectController() == nil
    </CLEANUP>
    <TRIGGER value="BEGINNING_OF_PLAYERS_STEP" simple_qualifier="controller">
    return MTG():GetStep() == STEP_END_OF_TURN
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    MTG():PutTokensOntoBattlefield( "TOKEN_KRAKEN_9_9_U_CHANGE_ME", 1, EffectController() )
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TOKEN_REGISTRATION reservation="1" type="TOKEN_KRAKEN_9_9_U_CHANGE_ME" />
Remember to make the Kraken token and change its name on the ability accordingly.
< 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: 722 times

Re: Formal Request Thread

Postby drleg3nd » 28 Dec 2013, 16:26

thefiremind wrote:
drleg3nd wrote:hey TFM or Gorem(if ya still around) would it be possible to create a early version of Kiora planeswalker card ? i know you like to wait till it's available on gatherer but if ya help me with +1 and -5 ability i can give it a shot.thx
Kiora's +1 and -5 abilities (untested) | Open
Code: Select all
  <ACTIVATED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[(+1): Until your next turn, prevent all damage that would be dealt to and dealt by target permanent an opponent controls.]]></LOCALISED_TEXT>
    <AVAILABILITY sorcery_time="1" per_turn_limit="1" />
    <COST type="generic">
      <PREREQUISITE>
      return true
      </PREREQUISITE>
      <RESOLUTION_TIME_ACTION>
      if EffectSource() ~= nil then
         PLW_ShutDownDoublingSeason()
         EffectSource():AddCounters( MTG():GetCountersType("Loyalty"), 1 )
      end
      </RESOLUTION_TIME_ACTION>
    </COST>
    <TARGET tag="CARD_QUERY_CHOOSE_PERMANENT_AN_OPPONENT_CONTROLS" definition="0" compartment="0" count="1" />
    <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    filter:Add( FE_TEAM, OP_NOT, EffectController():GetTeam() )
    PLW_FilterPermanents(filter)
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION>
    EffectDC():Set_Int( 1, MTG():GetTurnNumber() )
    </RESOLUTION_TIME_ACTION>
    <CONTINUOUS_ACTION layer="8">
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       local characteristics = target:GetCurrentCharacteristics()
       characteristics:Bool_Set(CHARACTERISTIC_DOESNT_RECEIVE_DAMAGE, 1)
       characteristics:Bool_Set(CHARACTERISTIC_DOESNT_DEAL_DAMAGE, 1)
    end
    </CONTINUOUS_ACTION>
    <DURATION>
    return EffectDC():Get_Targets(0):Get_CardPtr(0) == nil or PLW_UntilMyNextTurn( EffectDC():Get_Int(1) )
    </DURATION>
    <SFX text="TARGET_PLASMA_PLAY" />
  </ACTIVATED_ABILITY>
Code: Select all
  <ACTIVATED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[(-5): You get an emblem with “At the beginning of your end step, put a 9/9 blue Kraken creature token onto the battlefield.”]]></LOCALISED_TEXT>
    <AVAILABILITY sorcery_time="1" per_turn_limit="1" />
    <COST type="RemoveCountersSelf" amount="5" counter_type="Loyalty" />
    <RESOLUTION_TIME_ACTION>
    MTG():CreateDelayedTrigger(1, nil)
    </RESOLUTION_TIME_ACTION>
    <SFX text="GLOBAL_TIDE_PLAY" />
  </ACTIVATED_ABILITY>
  <TRIGGERED_ABILITY resource_id="1">
    <CLEANUP>
    return EffectController() == nil
    </CLEANUP>
    <TRIGGER value="BEGINNING_OF_PLAYERS_STEP" simple_qualifier="controller">
    return MTG():GetStep() == STEP_END_OF_TURN
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    MTG():PutTokensOntoBattlefield( "TOKEN_KRAKEN_9_9_U_CHANGE_ME", 1, EffectController() )
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TOKEN_REGISTRATION reservation="1" type="TOKEN_KRAKEN_9_9_U_CHANGE_ME" />
Remember to make the Kraken token and change its name on the ability accordingly.
thx TFM, chk out first draft, looks good ?
Kiora, the Crashing Wave[code | Open
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="2">
<FILENAME text="KIORA,_THE_CRASHING_WAVE_812195297" />
<CARDNAME text="KIORA,_THE_CRASHING_WAVE" />
<TITLE>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Kiora, the Crashing Wave]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Kiora, the Crashing Wave]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Kiora, the Crashing Wave]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Kiora, the Crashing Wave]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Kiora, the Crashing Wave]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Kiora, the Crashing Wave]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Kiora, the Crashing Wave]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Kiora, the Crashing Wave]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Kiora, the Crashing Wave]]></LOCALISED_TEXT>
</TITLE>
<MULTIVERSEID value="812195297" />
<ARTID value="812195297" />
<ARTIST name="Scott M Fischer" />
<CASTING_COST cost="{2}{G}{U}" />
<TYPE metaname="Planeswalker" />
<TYPE metaname="Enchantment" />
<SUB_TYPE metaname="Kiora" />
<EXPANSION value="WWK" />
<RARITY metaname="M" />
<TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_TRANSITION">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[|(Loyalty 2)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[|(Loyauté 2)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[|(Lealtad 2)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[|(Loyalität 2)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[|(Fedeltà 2)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[(忠誠 2)]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[|(충성 2)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[|(Верность 2)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[|(Lealdade 2)|]]></LOCALISED_TEXT>
<COUNTER_REGISTRATION name="Loyalty" proliferate="11" />
<TRIGGER value="ZONECHANGE_TRANSITION" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY" />
<RESOLUTION_TIME_ACTION>
if EffectSource() ~= nil then
EffectSource():AddCounters( MTG():GetCountersType("Loyalty"), 2 )
end
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<ACTIVATED_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[(+1): Until your next turn, prevent all damage that would be dealt to and dealt by target permanent an opponent controls.]]></LOCALISED_TEXT>
<AVAILABILITY sorcery_time="1" per_turn_limit="1" />
<COST type="generic">
<PREREQUISITE>
return true
</PREREQUISITE>
<RESOLUTION_TIME_ACTION>
if EffectSource() ~= nil then
PLW_ShutDownDoublingSeason()
EffectSource():AddCounters( MTG():GetCountersType("Loyalty"), 1 )
end
</RESOLUTION_TIME_ACTION>
</COST>
<TARGET tag="CARD_QUERY_CHOOSE_PERMANENT_AN_OPPONENT_CONTROLS" definition="0" compartment="0" count="1" />
<TARGET_DEFINITION id="0">
local filter = ClearFilter()
filter:Add( FE_TEAM, OP_NOT, EffectController():GetTeam() )
PLW_FilterPermanents(filter)
</TARGET_DEFINITION>
<RESOLUTION_TIME_ACTION>
EffectDC():Set_Int( 1, MTG():GetTurnNumber() )
</RESOLUTION_TIME_ACTION>
<CONTINUOUS_ACTION layer="8">
local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
if target ~= nil then
local characteristics = target:GetCurrentCharacteristics()
characteristics:Bool_Set(CHARACTERISTIC_DOESNT_RECEIVE_DAMAGE, 1)
characteristics:Bool_Set(CHARACTERISTIC_DOESNT_DEAL_DAMAGE, 1)
end
</CONTINUOUS_ACTION>
<DURATION>
return EffectDC():Get_Targets(0):Get_CardPtr(0) == nil or PLW_UntilMyNextTurn( EffectDC():Get_Int(1) )
</DURATION>
<SFX text="TARGET_PLASMA_PLAY" />
</ACTIVATED_ABILITY>


<ACTIVATED_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[(-1): Draw a card, You may play an additional land this turn.]]></LOCALISED_TEXT>
<AVAILABILITY sorcery_time="1" per_turn_limit="1" />
<COST type="RemoveCountersSelf" amount="1" counter_type="Loyalty" />
<RESOLUTION_TIME_ACTION>
EffectController():DrawCards(1)
</RESOLUTION_TIME_ACTION>
<CONTINUOUS_ACTION layer="8">
local player_characteristics = EffectController():GetCurrentCharacteristics()
player_characteristics:Int_Increment( PLAYER_INTCHARACTERISTIC_EXTRA_LAND_DROPS )
</CONTINUOUS_ACTION>
<DURATION simple_duration="UntilEOT" />
</ACTIVATED_ABILITY>



<ACTIVATED_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[(-5): You get an emblem with “At the beginning of your end step, put a 9/9 blue Kraken creature token onto the battlefield.”]]></LOCALISED_TEXT>
<AVAILABILITY sorcery_time="1" per_turn_limit="1" />
<COST type="RemoveCountersSelf" amount="5" counter_type="Loyalty" />
<RESOLUTION_TIME_ACTION>
MTG():CreateDelayedTrigger(1, nil)
</RESOLUTION_TIME_ACTION>
<SFX text="GLOBAL_TIDE_PLAY" />
</ACTIVATED_ABILITY>
<TRIGGERED_ABILITY resource_id="1">
<CLEANUP>
return EffectController() == nil
</CLEANUP>
<TRIGGER value="BEGINNING_OF_PLAYERS_STEP" simple_qualifier="controller">
return MTG():GetStep() == STEP_END_OF_TURN
</TRIGGER>
<RESOLUTION_TIME_ACTION>
MTG():PutTokensOntoBattlefield( "TOKEN_KRAKEN_9_9_U_CHANGE_ME", 1, EffectController() )
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<TOKEN_REGISTRATION reservation="1" type="TOKEN_KRAKEN_9_9_U_CHANGE_ME" />

<AI_COUNTER_SCORE type="Loyalty" score="100" />
<AI_BASE_SCORE score="600" zone="ZONE_BATTLEFIELD" />
</CARD_V2>[/code]]
drleg3nd
 
Posts: 528
Joined: 14 May 2012, 20:05
Has thanked: 5 times
Been thanked: 30 times

Re: Formal Request Thread

Postby thefiremind » 28 Dec 2013, 16:42

You are missing the ability that spawns the Planeswalker manager:
Code: Select all
  <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_ANY">
    <TRIGGER value="BEGINNING_OF_STEP">
    return MTG():GetStep() == STEP_UPKEEP and MTG():GetTurnNumber() == 0
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    PLW_CreateUniqueToken( "_PLANESWALKERS_MANAGER_991800002", "_PLANESWALKERS_MANAGER", EffectController() )
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TOKEN_REGISTRATION reservation="1" type="_PLANESWALKERS_MANAGER_991800002" />
Then you'll need to add PLANESWALKER_TYPE_KIORA in the LOL file and in the TEXT_PERMANENT XML file (easiest way: search for a Planeswalker that is still unique, such as Xenagos, and add the entries for Kiora wherever you see an entry for Xenagos).
< 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: 722 times

Re: Formal Request Thread

Postby NeoAnderson » 28 Dec 2013, 18:19

Hi guys i have a question
I am encountering an issue.
I am trying to ovveride the draw action, replacing it with another action.
I have the follow problem.
If the draw trigger fire during any step different of STEP_DRAW it works.
When it fire during STEP_DRAW the game don't let me go forward.
To be more clear the action i am using to replace the draw action include a selection of an item, through chooseitems.

The card i am working is Ring of Ma’rûf

Ring of Ma’rûf - not working | Open
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
  <FILENAME text="RING_OF_MARÛF_159136" />
  <CARDNAME text="RING_OF_MARÛF" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Ring of Ma’rûf]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Ring of Ma’rûf]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Ring of Ma’rûf]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Ring of Ma’rûf]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ring of Ma’rûf]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Ring of Ma’rûf]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Ring of Ma’rûf]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Ring of Ma’rûf]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Ring of Ma’rûf]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="159136" />
  <ARTID value="159136" />
  <ARTIST name="Dan Frazier" />
  <CASTING_COST cost="{5}" />
  <TYPE metaname="Artifact" />
  <EXPANSION value="MED" />
  <RARITY metaname="R" />
  <ACTIVATED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{5}, {T}, Exile Ring of Ma’rûf: The next time you would draw a card this turn, instead choose a card you own from outside the game and put it into your hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[{5}, {T}, Exile Ring of Ma’rûf: The next time you would draw a card this turn, instead choose a card you own from outside the game and put it into your hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[{5}, {T}, Exile Ring of Ma’rûf: The next time you would draw a card this turn, instead choose a card you own from outside the game and put it into your hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[{5}, {T}, Exile Ring of Ma’rûf: The next time you would draw a card this turn, instead choose a card you own from outside the game and put it into your hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[{5}, {T}, Exile Ring of Ma’rûf: The next time you would draw a card this turn, instead choose a card you own from outside the game and put it into your hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[{5}, {T}, Exile Ring of Ma’rûf: The next time you would draw a card this turn, instead choose a card you own from outside the game and put it into your hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[{5}, {T}, Exile Ring of Ma’rûf: The next time you would draw a card this turn, instead choose a card you own from outside the game and put it into your hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[{5}, {T}, Exile Ring of Ma’rûf: The next time you would draw a card this turn, instead choose a card you own from outside the game and put it into your hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[{5}, {T}, Exile Ring of Ma’rûf: The next time you would draw a card this turn, instead choose a card you own from outside the game and put it into your hand.]]></LOCALISED_TEXT>
    <COST mana_cost="{5}" type="Mana" />
    <COST type="TapSelf" />

   <RESOLUTION_TIME_ACTION>
    local delayDC = EffectDC():Make_Chest(1)
    delayDC:Set_Int(1, MTG():GetTurnNumber())
    MTG():CreateDelayedTrigger(1, delayDC)
    </RESOLUTION_TIME_ACTION>
  </ACTIVATED_ABILITY>


<TRIGGERED_ABILITY resource_id="1" replacement_effect="1">
 <TRIGGER value="DREW_CARD" simple_qualifier="controller" pre_trigger="1" >
 local TurnNo = EffectDC():Get_Int(1)
    if (MTG():GetTurnNumber() == TurnNo) then
       MTG():OverrideEvent()
       return true
    else
       return false
    end
   </TRIGGER>
<CLEANUP simple_cleanup="EndOfTurn" fire_once="1" />

 <RESOLUTION_TIME_ACTION>
   local filter = ClearFilter()
   local player = EffectController()
   if player ~= nil then
      filter:SetZone( ZONE_EXILE, player)
      player:SetItemCount(1)
      for i = 0, (1 - 1) do
         player:SetItemPrompt (i, "CARD_QUERY_CHOOSE_CARD_TO_PUT_INTO_HAND" )
      end
      player:ChooseItems( EffectDC():Make_Targets(0) )
   end
 </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       target:PutInHand()
    end 
    </RESOLUTION_TIME_ACTION>

</TRIGGERED_ABILITY>
</CARD_V2>
I had the same problem when i have coded Aladdin’s Lamp, in that case i had to make a workaround to avoid the issue.
I used this solution but i would know if you can tell me why this happens, i would keep the code shorter and clean.

Aladdin’s Lamp - working | Open
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
  <FILENAME text="ALADDINS_LAMP_2014" />
  <CARDNAME text="ALADDINS_LAMP" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Aladdin’s Lamp]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Aladdin’s Lamp]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Aladdin’s Lamp]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Aladdin’s Lamp]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Lampada di Aladino]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Aladdin’s Lamp]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Aladdin’s Lamp]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Aladdin’s Lamp]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Aladdin’s Lamp]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="2014" />
  <ARTID value="2014" />
  <ARTIST name="Mark Tedin" />
  <CASTING_COST cost="{10}" />
  <TYPE metaname="Artifact" />
  <EXPANSION value="AN" />
  <RARITY metaname="R" />
  <ACTIVATED_ABILITY linked_ability_group="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{X}, {T}: The next time you would draw a card this turn, instead look at the top X cards of your library, put all but one of them on the bottom of your library in a random order, then draw a card. X can’t be 0.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[{X}, {T}: The next time you would draw a card this turn, instead look at the top X cards of your library, put all but one of them on the bottom of your library in a random order, then draw a card. X can’t be 0.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[{X}, {T}: The next time you would draw a card this turn, instead look at the top X cards of your library, put all but one of them on the bottom of your library in a random order, then draw a card. X can’t be 0.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[{X}, {T}: The next time you would draw a card this turn, instead look at the top X cards of your library, put all but one of them on the bottom of your library in a random order, then draw a card. X can’t be 0.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[{X}, {T}: La prossima volta che stai per pescare una carta in questo turno, invece guarda le prime X carte del tuo grimorio, mescolale tutte tranne una, metti le carte mescolate in fondo al tuo grimorio, poi pesca una carta. X non può essere 0.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[{X}, {T}: The next time you would draw a card this turn, instead look at the top X cards of your library, put all but one of them on the bottom of your library in a random order, then draw a card. X can’t be 0.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[{X}, {T}: The next time you would draw a card this turn, instead look at the top X cards of your library, put all but one of them on the bottom of your library in a random order, then draw a card. X can’t be 0.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[{X}, {T}: The next time you would draw a card this turn, instead look at the top X cards of your library, put all but one of them on the bottom of your library in a random order, then draw a card. X can’t be 0.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[{X}, {T}: The next time you would draw a card this turn, instead look at the top X cards of your library, put all but one of them on the bottom of your library in a random order, then draw a card. X can’t be 0.]]></LOCALISED_TEXT>
<COST type="TapSelf" />
<COST mana_cost="{X}" type="Mana" />
    <RESOLUTION_TIME_ACTION>
    local delayDC = EffectDC():Make_Chest(1)
    delayDC:Set_Int(20, GetEffectX())
    MTG():CreateDelayedTrigger(1, delayDC)
    MTG():CreateDelayedTrigger(2, delayDC)
    </RESOLUTION_TIME_ACTION>
</ACTIVATED_ABILITY>

<TRIGGERED_ABILITY>
<TRIGGER value="BEGINNING_OF_PLAYERS_STEP" simple_qualifier="controller">
      return  (MTG():GetStep() == STEP_UPKEEP)
    </TRIGGER>
<RESOLUTION_TIME_ACTION>
  local j = 0
  for i = 0, 1000 do
        j = j + 1
    end
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>


<TRIGGERED_ABILITY resource_id="1" replacement_effect="1">
 <TRIGGER value="DREW_CARD" simple_qualifier="controller" pre_trigger="1" >
  if (MTG():GetStep() == STEP_DRAW)  and (EffectDC():Get_Int(20) &gt; 0) then
    MTG():OverrideEvent()
    local delayDC = EffectDC():Make_Chest(1)
    local max_cards = EffectDC():Get_Int(20)
    delayDC:Set_Int(20, max_cards)
    MTG():CreateDelayedTrigger(3, delayDC)
    MTG():RemoveDelayedTrigger(2)
    return true
  else
    return false
  end
    </TRIGGER>
<CLEANUP simple_cleanup="EndOfTurn" fire_once="1" />
</TRIGGERED_ABILITY>

<TRIGGERED_ABILITY resource_id="2" replacement_effect="1">
 <TRIGGER value="DREW_CARD" simple_qualifier="controller" pre_trigger="1" >
 if (MTG():GetStep() ~= STEP_DRAW)  and (EffectDC():Get_Int(20) &gt; 0) then
    MTG():OverrideEvent()
    local delayDC = EffectDC():Make_Chest(4)
    MTG():CreateDelayedTrigger(4, delayDC)
    MTG():RemoveDelayedTrigger(1)
    return true
 else
    return false
 end
   </TRIGGER>
<CLEANUP simple_cleanup="EndOfTurn" fire_once="1" />

 <RESOLUTION_TIME_ACTION>
    local max_cards = EffectDC():Get_Int(20)
    local queryDC = EffectDC():Make_Chest(1)
    local player = EffectController()
    local cardsinlibrary = player:Library_Count()
    if max_cards &gt; cardsinlibrary then
       max_cards = cardsinlibrary
    end
    for i=0,(max_cards-1) do
       local card = player:Library_GetNth(i)       
       if card ~= nil then
          queryDC:Set_CardPtr(i, card)
       end
    end
    player:SetItemCount(1)
    for i = 0, (1 - 1) do
        player:SetItemPrompt(i, "CARD_QUERY_CHOOSE_CARD_TO_PUT_ONTO_LIBRARY" )
    end
    player:ChooseItemsFromDC( queryDC, EffectDC():Make_Targets(0) )
    </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       target:PutOnTopOfLibrary()
    end 
    </RESOLUTION_TIME_ACTION>

    <RESOLUTION_TIME_ACTION>
    local queryDC = EffectDC():Get_Chest(1)
    if queryDC ~= nil then
       local num_cards = queryDC:Count()
       for i=0,num_cards-1 do
          local card = queryDC:Remove_RandomCardPtr()
          if card ~= nil then
             card:PutOnBottomOfLibrary()
          else
             break
          end
       end
    end
    </RESOLUTION_TIME_ACTION>

</TRIGGERED_ABILITY>

<TRIGGERED_ABILITY resource_id="3" forced_skip="1">
<TRIGGER value="BEGINNING_OF_PLAYERS_STEP" simple_qualifier="controller">
      return  (MTG():GetStep() == STEP_MAIN_1)
    </TRIGGER>
<CLEANUP simple_cleanup="EndOfTurn" fire_once="1" />
    <RESOLUTION_TIME_ACTION>
    local max_cards = EffectDC():Get_Int(20)
    local queryDC = EffectDC():Make_Chest(1)
    local player = EffectController()
    local cardsinlibrary = player:Library_Count()
    if max_cards &gt; cardsinlibrary then
       max_cards = cardsinlibrary
    end
    for i=0,(max_cards-1) do
       local card = player:Library_GetNth(i)       
       if card ~= nil then
          queryDC:Set_CardPtr(i, card)
       end
    end
    player:SetItemCount(1)
    for i = 0, (1 - 1) do
        player:SetItemPrompt(i, "CARD_QUERY_CHOOSE_CARD_TO_PUT_ONTO_LIBRARY" )
    end
    player:ChooseItemsFromDC( queryDC, EffectDC():Make_Targets(0) )
    </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       target:PutOnTopOfLibrary()
    end 
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local queryDC = EffectDC():Get_Chest(1)
    if queryDC ~= nil then
       local num_cards = queryDC:Count()
       for i=0,num_cards-1 do
          local card = queryDC:Remove_RandomCardPtr()
          if card ~= nil then
             card:PutOnBottomOfLibrary()
          else
             break
          end
       end
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
       EffectController():DrawCards(1)
    </RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>

<TRIGGERED_ABILITY resource_id="4" forced_skip="1">
    <TRIGGER value="ABILITY_RESOLVED" />
<CLEANUP simple_cleanup="EndOfTurn" fire_once="1" />
     <RESOLUTION_TIME_ACTION>
       EffectController():DrawCards(1)
    </RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>

</CARD_V2>
NeoAnderson
 
Posts: 914
Joined: 10 Sep 2013, 07:49
Has thanked: 18 times
Been thanked: 139 times

Re: Formal Request Thread

Postby Real » 28 Dec 2013, 18:46

May I request the following two cards?
I have no ideal how to code them myself.
Thanks in advance.

Incandescent Soulstoke
Thunderblust
Real
 
Posts: 19
Joined: 12 Aug 2013, 16:23
Has thanked: 2 times
Been thanked: 0 time

Re: Formal Request Thread

Postby RiiakShiNal » 28 Dec 2013, 19:27

NeoAnderson wrote:Hi guys i have a question
I am encountering an issue.
I am trying to ovveride the draw action, replacing it with another action.
I have the follow problem.
If the draw trigger fire during any step different of STEP_DRAW it works.
When it fire during STEP_DRAW the game don't let me go forward.
To be more clear the action i am using to replace the draw action include a selection of an item, through chooseitems.

The card i am working is Ring of Ma’rûf

Ring of Ma’rûf - not working | Open
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
  <FILENAME text="RING_OF_MARÛF_159136" />
  <CARDNAME text="RING_OF_MARÛF" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Ring of Ma’rûf]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Ring of Ma’rûf]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Ring of Ma’rûf]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Ring of Ma’rûf]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ring of Ma’rûf]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Ring of Ma’rûf]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Ring of Ma’rûf]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Ring of Ma’rûf]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Ring of Ma’rûf]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="159136" />
  <ARTID value="159136" />
  <ARTIST name="Dan Frazier" />
  <CASTING_COST cost="{5}" />
  <TYPE metaname="Artifact" />
  <EXPANSION value="MED" />
  <RARITY metaname="R" />
  <ACTIVATED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{5}, {T}, Exile Ring of Ma’rûf: The next time you would draw a card this turn, instead choose a card you own from outside the game and put it into your hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[{5}, {T}, Exile Ring of Ma’rûf: The next time you would draw a card this turn, instead choose a card you own from outside the game and put it into your hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[{5}, {T}, Exile Ring of Ma’rûf: The next time you would draw a card this turn, instead choose a card you own from outside the game and put it into your hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[{5}, {T}, Exile Ring of Ma’rûf: The next time you would draw a card this turn, instead choose a card you own from outside the game and put it into your hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[{5}, {T}, Exile Ring of Ma’rûf: The next time you would draw a card this turn, instead choose a card you own from outside the game and put it into your hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[{5}, {T}, Exile Ring of Ma’rûf: The next time you would draw a card this turn, instead choose a card you own from outside the game and put it into your hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[{5}, {T}, Exile Ring of Ma’rûf: The next time you would draw a card this turn, instead choose a card you own from outside the game and put it into your hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[{5}, {T}, Exile Ring of Ma’rûf: The next time you would draw a card this turn, instead choose a card you own from outside the game and put it into your hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[{5}, {T}, Exile Ring of Ma’rûf: The next time you would draw a card this turn, instead choose a card you own from outside the game and put it into your hand.]]></LOCALISED_TEXT>
    <COST mana_cost="{5}" type="Mana" />
    <COST type="TapSelf" />

   <RESOLUTION_TIME_ACTION>
    local delayDC = EffectDC():Make_Chest(1)
    delayDC:Set_Int(1, MTG():GetTurnNumber())
    MTG():CreateDelayedTrigger(1, delayDC)
    </RESOLUTION_TIME_ACTION>
  </ACTIVATED_ABILITY>


<TRIGGERED_ABILITY resource_id="1" replacement_effect="1">
 <TRIGGER value="DREW_CARD" simple_qualifier="controller" pre_trigger="1" >
 local TurnNo = EffectDC():Get_Int(1)
    if (MTG():GetTurnNumber() == TurnNo) then
       MTG():OverrideEvent()
       return true
    else
       return false
    end
   </TRIGGER>
<CLEANUP simple_cleanup="EndOfTurn" fire_once="1" />

 <RESOLUTION_TIME_ACTION>
   local filter = ClearFilter()
   local player = EffectController()
   if player ~= nil then
      filter:SetZone( ZONE_EXILE, player)
      player:SetItemCount(1)
      for i = 0, (1 - 1) do
         player:SetItemPrompt (i, "CARD_QUERY_CHOOSE_CARD_TO_PUT_INTO_HAND" )
      end
      player:ChooseItems( EffectDC():Make_Targets(0) )
   end
 </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       target:PutInHand()
    end 
    </RESOLUTION_TIME_ACTION>

</TRIGGERED_ABILITY>
</CARD_V2>
I had the same problem when i have coded Aladdin’s Lamp, in that case i had to make a workaround to avoid the issue.
I used this solution but i would know if you can tell me why this happens, i would keep the code shorter and clean.

Aladdin’s Lamp - working | Open
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
  <FILENAME text="ALADDINS_LAMP_2014" />
  <CARDNAME text="ALADDINS_LAMP" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Aladdin’s Lamp]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Aladdin’s Lamp]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Aladdin’s Lamp]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Aladdin’s Lamp]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Lampada di Aladino]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Aladdin’s Lamp]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Aladdin’s Lamp]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Aladdin’s Lamp]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Aladdin’s Lamp]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="2014" />
  <ARTID value="2014" />
  <ARTIST name="Mark Tedin" />
  <CASTING_COST cost="{10}" />
  <TYPE metaname="Artifact" />
  <EXPANSION value="AN" />
  <RARITY metaname="R" />
  <ACTIVATED_ABILITY linked_ability_group="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{X}, {T}: The next time you would draw a card this turn, instead look at the top X cards of your library, put all but one of them on the bottom of your library in a random order, then draw a card. X can’t be 0.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[{X}, {T}: The next time you would draw a card this turn, instead look at the top X cards of your library, put all but one of them on the bottom of your library in a random order, then draw a card. X can’t be 0.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[{X}, {T}: The next time you would draw a card this turn, instead look at the top X cards of your library, put all but one of them on the bottom of your library in a random order, then draw a card. X can’t be 0.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[{X}, {T}: The next time you would draw a card this turn, instead look at the top X cards of your library, put all but one of them on the bottom of your library in a random order, then draw a card. X can’t be 0.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[{X}, {T}: La prossima volta che stai per pescare una carta in questo turno, invece guarda le prime X carte del tuo grimorio, mescolale tutte tranne una, metti le carte mescolate in fondo al tuo grimorio, poi pesca una carta. X non può essere 0.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[{X}, {T}: The next time you would draw a card this turn, instead look at the top X cards of your library, put all but one of them on the bottom of your library in a random order, then draw a card. X can’t be 0.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[{X}, {T}: The next time you would draw a card this turn, instead look at the top X cards of your library, put all but one of them on the bottom of your library in a random order, then draw a card. X can’t be 0.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[{X}, {T}: The next time you would draw a card this turn, instead look at the top X cards of your library, put all but one of them on the bottom of your library in a random order, then draw a card. X can’t be 0.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[{X}, {T}: The next time you would draw a card this turn, instead look at the top X cards of your library, put all but one of them on the bottom of your library in a random order, then draw a card. X can’t be 0.]]></LOCALISED_TEXT>
<COST type="TapSelf" />
<COST mana_cost="{X}" type="Mana" />
    <RESOLUTION_TIME_ACTION>
    local delayDC = EffectDC():Make_Chest(1)
    delayDC:Set_Int(20, GetEffectX())
    MTG():CreateDelayedTrigger(1, delayDC)
    MTG():CreateDelayedTrigger(2, delayDC)
    </RESOLUTION_TIME_ACTION>
</ACTIVATED_ABILITY>

<TRIGGERED_ABILITY>
<TRIGGER value="BEGINNING_OF_PLAYERS_STEP" simple_qualifier="controller">
      return  (MTG():GetStep() == STEP_UPKEEP)
    </TRIGGER>
<RESOLUTION_TIME_ACTION>
  local j = 0
  for i = 0, 1000 do
        j = j + 1
    end
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>


<TRIGGERED_ABILITY resource_id="1" replacement_effect="1">
 <TRIGGER value="DREW_CARD" simple_qualifier="controller" pre_trigger="1" >
  if (MTG():GetStep() == STEP_DRAW)  and (EffectDC():Get_Int(20) &gt; 0) then
    MTG():OverrideEvent()
    local delayDC = EffectDC():Make_Chest(1)
    local max_cards = EffectDC():Get_Int(20)
    delayDC:Set_Int(20, max_cards)
    MTG():CreateDelayedTrigger(3, delayDC)
    MTG():RemoveDelayedTrigger(2)
    return true
  else
    return false
  end
    </TRIGGER>
<CLEANUP simple_cleanup="EndOfTurn" fire_once="1" />
</TRIGGERED_ABILITY>

<TRIGGERED_ABILITY resource_id="2" replacement_effect="1">
 <TRIGGER value="DREW_CARD" simple_qualifier="controller" pre_trigger="1" >
 if (MTG():GetStep() ~= STEP_DRAW)  and (EffectDC():Get_Int(20) &gt; 0) then
    MTG():OverrideEvent()
    local delayDC = EffectDC():Make_Chest(4)
    MTG():CreateDelayedTrigger(4, delayDC)
    MTG():RemoveDelayedTrigger(1)
    return true
 else
    return false
 end
   </TRIGGER>
<CLEANUP simple_cleanup="EndOfTurn" fire_once="1" />

 <RESOLUTION_TIME_ACTION>
    local max_cards = EffectDC():Get_Int(20)
    local queryDC = EffectDC():Make_Chest(1)
    local player = EffectController()
    local cardsinlibrary = player:Library_Count()
    if max_cards &gt; cardsinlibrary then
       max_cards = cardsinlibrary
    end
    for i=0,(max_cards-1) do
       local card = player:Library_GetNth(i)       
       if card ~= nil then
          queryDC:Set_CardPtr(i, card)
       end
    end
    player:SetItemCount(1)
    for i = 0, (1 - 1) do
        player:SetItemPrompt(i, "CARD_QUERY_CHOOSE_CARD_TO_PUT_ONTO_LIBRARY" )
    end
    player:ChooseItemsFromDC( queryDC, EffectDC():Make_Targets(0) )
    </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       target:PutOnTopOfLibrary()
    end 
    </RESOLUTION_TIME_ACTION>

    <RESOLUTION_TIME_ACTION>
    local queryDC = EffectDC():Get_Chest(1)
    if queryDC ~= nil then
       local num_cards = queryDC:Count()
       for i=0,num_cards-1 do
          local card = queryDC:Remove_RandomCardPtr()
          if card ~= nil then
             card:PutOnBottomOfLibrary()
          else
             break
          end
       end
    end
    </RESOLUTION_TIME_ACTION>

</TRIGGERED_ABILITY>

<TRIGGERED_ABILITY resource_id="3" forced_skip="1">
<TRIGGER value="BEGINNING_OF_PLAYERS_STEP" simple_qualifier="controller">
      return  (MTG():GetStep() == STEP_MAIN_1)
    </TRIGGER>
<CLEANUP simple_cleanup="EndOfTurn" fire_once="1" />
    <RESOLUTION_TIME_ACTION>
    local max_cards = EffectDC():Get_Int(20)
    local queryDC = EffectDC():Make_Chest(1)
    local player = EffectController()
    local cardsinlibrary = player:Library_Count()
    if max_cards &gt; cardsinlibrary then
       max_cards = cardsinlibrary
    end
    for i=0,(max_cards-1) do
       local card = player:Library_GetNth(i)       
       if card ~= nil then
          queryDC:Set_CardPtr(i, card)
       end
    end
    player:SetItemCount(1)
    for i = 0, (1 - 1) do
        player:SetItemPrompt(i, "CARD_QUERY_CHOOSE_CARD_TO_PUT_ONTO_LIBRARY" )
    end
    player:ChooseItemsFromDC( queryDC, EffectDC():Make_Targets(0) )
    </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       target:PutOnTopOfLibrary()
    end 
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local queryDC = EffectDC():Get_Chest(1)
    if queryDC ~= nil then
       local num_cards = queryDC:Count()
       for i=0,num_cards-1 do
          local card = queryDC:Remove_RandomCardPtr()
          if card ~= nil then
             card:PutOnBottomOfLibrary()
          else
             break
          end
       end
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
       EffectController():DrawCards(1)
    </RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>

<TRIGGERED_ABILITY resource_id="4" forced_skip="1">
    <TRIGGER value="ABILITY_RESOLVED" />
<CLEANUP simple_cleanup="EndOfTurn" fire_once="1" />
     <RESOLUTION_TIME_ACTION>
       EffectController():DrawCards(1)
    </RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>

</CARD_V2>
Ring of Ma'ruf can't be coded because we can't choose cards from outside the game. Exile is not outside of the game as determined by MtG rules. So trying to fix that problem is pointless for this card.

As for Aladdin's Lamp you seem to be using replacement_effect instead of replacement_query. Whenever you need to ask the player something (multiple choice, numeric choice, colour choice, target choice, etc...) in something that is a replacement then you need to use replacement_query.
RiiakShiNal
Programmer
 
Posts: 2188
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Formal Request Thread

Postby drleg3nd » 28 Dec 2013, 20:13

hey guys just wanna share my version of the new planeswalker of Kiora with help from TFM, let me know how it works..cant use yet since i'm at work :(
Attachments
Kiora, the Crashing Wave.zip
Kiora, the Crashing Wave
(576.61 KiB) Downloaded 211 times
drleg3nd
 
Posts: 528
Joined: 14 May 2012, 20:05
Has thanked: 5 times
Been thanked: 30 times

Re: Formal Request Thread

Postby NeoAnderson » 28 Dec 2013, 20:51

RiiakShiNal wrote:Ring of Ma'ruf can't be coded because we can't choose cards from outside the game. Exile is not outside of the game as determined by MtG rules. So trying to fix that problem is pointless for this card.

As for Aladdin's Lamp you seem to be using replacement_effect instead of replacement_query. Whenever you need to ask the player something (multiple choice, numeric choice, colour choice, target choice, etc...) in something that is a replacement then you need to use replacement_query.
Thank you Riiak, your help is really precious,
Now it works fine.
About Ring of Ma'ruf so Exile zone is not out of game and what about ZONE_CEASED_TO_EXIST ? What does means this zone? Is there some cards who are using that zone?
NeoAnderson
 
Posts: 914
Joined: 10 Sep 2013, 07:49
Has thanked: 18 times
Been thanked: 139 times

PreviousNext

Return to 2014

Who is online

Users browsing this forum: Majestic-12 [Bot] and 10 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 11 users online :: 1 registered, 0 hidden and 10 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: Majestic-12 [Bot] and 10 guests

Login Form