It is currently 16 Apr 2024, 04:21
   
Text Size

Formal Request Thread

Moderator: CCGHQ Admins

Re: Formal Request Thread

Postby infernalsham » 06 Jul 2013, 16:51

Agreed. Probably wiser going with firebrand since it doesn't have secondary effects and thus cleaner code. Main focus is making sure the "X" damage is able to be distributed and from there going for the side effects. Thanks TFM.

Edit: The code works perfectly for dealing damage. :D
Last edited by infernalsham on 06 Jul 2013, 18:31, edited 1 time in total.
Want to speed up the loading of DotP Magic 2014 when you start it?
Go to: "C:\*\Magic 2014\Movies" and delete Alienware, Stainless and WotC .bik files.
infernalsham
 
Posts: 17
Joined: 27 Jun 2013, 15:54
Has thanked: 3 times
Been thanked: 1 time

Re: Formal Request Thread

Postby Xander9009 » 06 Jul 2013, 17:16

Xander9009 wrote:Mystic Genesis - I can't quite get it to work. It makes the token, but I can't get it to change the token's power and toughness.
| Open
Code: Select all
   <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Counter target spell. Put an X/X green Ooze creature token onto the battlefield, where X is that spell’s converted mana cost.]]></LOCALISED_TEXT>
    <TARGET tag="CARD_QUERY_CHOOSE_SPELL_TO_COUNTER" definition="0" compartment="0" count="1" />
    <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    filter:SetZone( ZONE_STACK )
    </TARGET_DEFINITION>
   <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       local cmc = target:GetConvertedManaCost()
       EffectDC():Set_Int( 1, cmc )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       target:CounterSpell()
    end
    </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
    MTG():PutTokensOntoBattlefield( "TOKEN_OOZE_0_1_G_909002", 1, EffectController(), EffectDC():Make_Chest(0) )
    </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
   local TokenPT = EffectDC():Get_Int(1)
   local token = EffectDC():Get_Chest(0):Get_CardPtr(0)
    if token ~= nil then
       local characteristics = token:GetCurrentCharacteristics()
       characteristics:Power_Set( TokenPT )
       characteristics:Toughness_Set( TokenPT )
    end
    </RESOLUTION_TIME_ACTION>
Sphinx of Uthuun - Too many chests! This one's got my brain scrambled through and through. Unlike with Mystic Genesis, I don't even have basic code to work from.
Triumph of Ferocity - If someone knows how to do this one easily, that would be awesome. At the moment I'm planning to copy Overwhelming Stampede for myself and then all opponents' creatures and then compare the results.
Zameck Guildmage - I've got its second ability working, but the first ability simply won't trigger no matter how much I mess with it.
| Open
Code: Select all
<ACTIVATED_ABILITY>
        <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{G}{U}: This turn, each creature you control enters the battlefield with an additional +1/+1 counter on it.]]></LOCALISED_TEXT>
   <COST mana_cost="{G}{U}" type="Mana" />
   <TRIGGERED_EFFECT replacement_effect="1">
    <TRIGGER value="ZONECHANGE_TRANSITION" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY" pre_trigger="1">
    return (TriggerObject() == EffectDC():Get_CardPtr(0))
    </TRIGGER>
    <CLEANUP simple_cleanup="EndOfTurn" />
    <RESOLUTION_TIME_ACTION>
    if TriggerObject() ~= nil then
      if TriggerObject():GetCardType():Test( CARD_TYPE_CREATURE ) then
         TriggerObject():AddCounters( MTG():PlusOnePlusOneCounters(), 1)
      end
    end
    </RESOLUTION_TIME_ACTION>
   </TRIGGERED_EFFECT>
  </ACTIVATED_ABILITY>
I managed to get Mystic Genesis working. Dumb mistake on my part; used resolution action instead of continuous (and learned that a continuous action requires a duration). Working code:
| Open
Code: Select all
     <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Counter target spell. Put an X/X green Ooze creature token onto the battlefield, where X is that spell’s converted mana cost.]]></LOCALISED_TEXT>   
<TARGET tag="CARD_QUERY_CHOOSE_SPELL_TO_COUNTER" definition="0" compartment="0" count="1" />
    <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    filter:SetZone( ZONE_STACK )
    </TARGET_DEFINITION>
   <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       local cmc = target:GetConvertedManaCost()
       EffectDC():Set_Int( 1, cmc )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       target:CounterSpell()
    end
    </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
    MTG():PutTokensOntoBattlefield( "TOKEN_OOZE_0_1_G_909002", 1, EffectController(), EffectDC():Make_Chest(0) )
    </RESOLUTION_TIME_ACTION>
   <CONTINUOUS_ACTION layer="7B">
   local targetpt = EffectDC():Get_Int(1)
    local target = EffectDC():Get_Chest(0):Get_CardPtr(0)
    if target ~= nil then
       local characteristics = target:GetCurrentCharacteristics()
       characteristics:Power_Set( targetpt )
       characteristics:Toughness_Set( targetpt )
    end
    </CONTINUOUS_ACTION>
   <DURATION>
   local target = EffectDC():Get_Chest(0):Get_CardPtr(0)
    return (target == nil)
    </DURATION>
I also got Triumph of Ferocity working. Working code:
| Open
Code: Select all
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[At the beginning of your upkeep, draw a card if you control the creature with the greatest power or tied for the greatest power.]]></LOCALISED_TEXT>
<TRIGGER value="BEGINNING_OF_PLAYERS_STEP" simple_qualifier="controller">
    return MTG():GetStep() == STEP_UPKEEP
    </TRIGGER>
   <FILTER filter_id="0">
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE  )
    filter:Add( FE_CONTROLLER, OP_IS, EffectController())
    </FILTER>
    <RESOLUTION_TIME_ACTION>
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE  )
    filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
    local number = filter:EvaluateObjects()
    local power = 0
    for i = 0, (number-1) do
       local card = filter:GetNthEvaluatedObject(i)
       if card ~= nil then
          local temp = card:GetCurrentCharacteristics():Power_Get()
          if temp &gt; power then
             power = temp
             EffectDC():Set_Int(0, power)
          end
       end
    end
    </RESOLUTION_TIME_ACTION>
   <FILTER filter_id="1">
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE  )
    filter:Add( FE_CONTROLLER, OP_NOT, EffectController())
    </FILTER>
    <RESOLUTION_TIME_ACTION>
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE  )
    filter:Add( FE_CONTROLLER, OP_NOT, EffectController() )
    local number = filter:EvaluateObjects()
    local power = 0
    for i = 0, (number-1) do
       local card = filter:GetNthEvaluatedObject(i)
       if card ~= nil then
          local temp = card:GetCurrentCharacteristics():Power_Get()
          if temp &gt; power then
             power = temp
             EffectDC():Set_Int(1, power)
          end
       end
    end
    </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
   local power0 = EffectDC():Get_Int(0)
   local power1 = EffectDC():Get_Int(1)
   power1 = power1 - 1
   if power0 &gt; power1 then
      EffectController():DrawCards(1)
   end
   </RESOLUTION_TIME_ACTION>
I also got the first ability for Zameck Guildmage working thanks to Savage Summoning. The only issue I've found is that for the second ability, you pay the mana and choose a creature with a counter. It goes on the stack and only when it resolves does it remove the counter. If it doesn't remove a counter, then you don't draw a card. So, if the creature is destroyed after paying the mana but before it removes the counter, then the mana is wasted and that's not how it's supposed to work. Here's the 95% working code:
| Open
Code: Select all
  <ACTIVATED_ABILITY>
    <COST mana_cost="{G}{U}" type="Mana" />
   <RESOLUTION_TIME_ACTION>
    local delayDC_A = EffectDC():Make_Chest(1)
    MTG():CreateDelayedTrigger(1, delayDC_A)
    </RESOLUTION_TIME_ACTION>
  </ACTIVATED_ABILITY>
  <TRIGGERED_ABILITY resource_id="1" replacement_query="1">
    <TRIGGER value="SPELL_PLAYED" simple_qualifier="controller">
    return  TriggerObject():GetCardType():Test( CARD_TYPE_CREATURE )
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local delayDC = EffectDC():Make_Chest(1)
    delayDC:Set_CardPtr(0, TriggerObject())
    delayDC:Protect_CardPtr(0)
    MTG():CreateDelayedTrigger(2, delayDC)
    </RESOLUTION_TIME_ACTION>
    <CLEANUP simple_cleanup="EndOfTurn" />
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY replacement_effect="1" resource_id="2">
    <TRIGGER value="ZONECHANGE_TRANSITION" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY" pre_trigger="1">
    return (TriggerObject() == EffectDC():Get_CardPtr(0))
    </TRIGGER>
    <CLEANUP simple_cleanup="EndOfTurn" />
    <RESOLUTION_TIME_ACTION>
    if TriggerObject() ~= nil then
       TriggerObject():AddCounters( MTG():PlusOnePlusOneCounters(), 1)
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <ACTIVATED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{G}{U}, Remove a +1/+1 counter from a creature you control: Draw a card.]]></LOCALISED_TEXT>
   <COST mana_cost="{G}{U}" type="Mana" />
   <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_TO_GET_PLUS1_PLUS1_COUNTER" definition="0" compartment="0" count="1" />
    <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
    filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
   filter:Add( FE_LUA_CONDITION, 0, EffectController())
    </TARGET_DEFINITION>
    <FILTER_CONDITION id="0">
    local num_counters_on_thing = FilteredCard():CountCounters( MTG():PlusOnePlusOneCounters())
       
    if Object():GetParent() == FilteredCard() then
       if num_counters_on_thing &gt;1 then
          return true
       else
          return false
       end
    else
       if num_counters_on_thing &gt; 0 then
          return true
       else
          return false
       end
    end
    </FILTER_CONDITION>
   <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       target:RemoveCounters( MTG():PlusOnePlusOneCounters(), 1)
    end
    </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
    EffectController():DrawCards(1)
    </RESOLUTION_TIME_ACTION>
  </ACTIVATED_ABILITY>
How can I make Zameck Guildmage first ability go on the stack after removing a counter from a creature? And if anyone is feeling generous, Sphinx of Uthuun is a bit beyond me.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: Formal Request Thread

Postby thefiremind » 06 Jul 2013, 18:07

The problem with Mystic Genesis coded like that is that if you make a copy of the token it will probably end up being a 0/1, while it should retain the values of the original token. DotP2014 has a function PutPTTokensOntoBattlefield which I guess it produces tokens with a set P/T, but there are no examples of it, so it would need some tests in order to find the correct parameters.

In your Triumph of Ferocity, the <FILTER>...</FILTER> blocks are useless. They don't do any harm if you leave them, but you can shorten the code by removing them.

I tried to code the cost "Remove a +1/+1 counter from a creature you control" for Ghave, Guru of Spores and ended up with this:
Code: Select all
    <COST type="generic">
      <PREREQUISITE>
      local filter = ClearFilter()
      filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
      filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
      local filter_count = filter:EvaluateObjects()
      if filter_count &gt; 0 then
         for i=0,filter_count-1 do
            local candidate = filter:GetNthEvaluatedObject(i)
            if candidate ~= nil and candidate:CountCounters( MTG():PlusOnePlusOneCounters() ) &gt; 0 then
               return true
            end
         end
      end
      return false
      </PREREQUISITE>
      <RESOLUTION_TIME_ACTION>
      MTG():ClearFilterMark()
      local filter = ClearFilter()
      filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
      filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
      local filter_count = filter:EvaluateObjects()
      if filter_count &gt; 0 then
         for i=0,filter_count-1 do
            local candidate = filter:GetNthEvaluatedObject(i)
            if candidate ~= nil and candidate:CountCounters( MTG():PlusOnePlusOneCounters() ) &gt; 0 then
               candidate:MarkForFilter()
            end
         end
         filter:SetMarkedObjectsOnly()
         EffectController():ChooseItem( "CARD_QUERY_CHOOSE_CREATURE_YOU_CONTROL", EffectDC():Make_Targets(6) )
      end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
      local creature = EffectDC():Get_Targets(6) and EffectDC():Get_Targets(6):Get_CardPtr(0)
      if creature ~= nil then
         creature:RemoveCounters( MTG():PlusOnePlusOneCounters(), 1 )
      end
      </RESOLUTION_TIME_ACTION>
    </COST>
It's quite long, but it seems to work OK.

The first ability of your Zameck Guildmage is wrong: why should you use a SPELL_PLAYED trigger? A creature that enters the battlefield from the graveyard should benefit from the ability, too. Remove that delayed trigger and create the ZONECHANGE_TRANSITION delayed trigger directly:
Code: Select all
  <ACTIVATED_ABILITY>
    <COST mana_cost="{G}{U}" type="Mana" />
    <RESOLUTION_TIME_ACTION>
    MTG():CreateDelayedTrigger(2, nil)
    </RESOLUTION_TIME_ACTION>
  </ACTIVATED_ABILITY>
  <TRIGGERED_ABILITY replacement_effect="1" resource_id="2">
    <TRIGGER value="ZONECHANGE_TRANSITION" simple_qualifier="objectyoucontrol" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY" pre_trigger="1" />
    <CLEANUP simple_cleanup="EndOfTurn" />
    <RESOLUTION_TIME_ACTION>
    if TriggerObject() ~= nil then
       TriggerObject():AddCounters( MTG():PlusOnePlusOneCounters(), 1 )
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
I also simplified the code: simple_qualifier="objectyoucontrol" should be enough to make the ability affect only your creatures. If it's not, let me know.

About Sphinx of Uthuun, the problem is always the same: there's no such thing as "pile" in DotP, and I can't see a good way to approximate it, especially concerning user interaction (how do you let the players see the piles and choose one?).
Last edited by thefiremind on 06 Jul 2013, 18:10, edited 1 time in total.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Formal Request Thread

Postby gorem2k » 06 Jul 2013, 18:07

Xander9009 wrote:I managed to get Mystic Genesis working.
what if opponent has Elesh Norn, Grand Cenobite... will the 0/1 token survive and be 1/1 if the countered spell was a CMC of 3?
gorem2k
 
Posts: 464
Joined: 01 Apr 2013, 04:21
Has thanked: 48 times
Been thanked: 33 times

Re: Formal Request Thread

Postby gorem2k » 06 Jul 2013, 18:13

thefiremind wrote:DotP2014 has a function PutPTTokensOntoBattlefield which I guess it produces tokens with a set P/T, but there are no examples of it, so it would need some tests in order to find the correct parameters.
this was my focus yesterday, I spent countless hours trying different values. without success. I should just quit and wait for others to do the work for me :lol:
gorem2k
 
Posts: 464
Joined: 01 Apr 2013, 04:21
Has thanked: 48 times
Been thanked: 33 times

Re: Formal Request Thread

Postby thefiremind » 06 Jul 2013, 18:18

gorem2k wrote:this was my focus yesterday, I spent countless hours trying different values. without success. I should just quit and wait for others to do the work for me :lol:
I got it right:
Code: Select all
    MTG():PutPTTokensOntoBattlefield( "TOKEN_NAME", count, EffectController(), power, toughness )
Just make the token */* instead of 0/1 (not that it matters, but just to be precise) and use this.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Formal Request Thread

Postby East Bay » 06 Jul 2013, 18:19

thefiremind wrote:
BloodReyvyn wrote:On an unrelated note, I was going to try to make Cabal Coffers but I am unsure of how to approach that one. Is there a better way to do this in D14 or am I going to have to make mana tokens to get it to work?
I'd wait for someone else to answer this... for example, sumomole should be able to tell you if you can make it "DotP2013 Cloudpost style" given that he discovered this:
viewtopic.php?f=63&t=10951
The Cloudpost trick wont work unless you just simply don't care about the extra floating mana. Until we get a mana pool or a zone that can store the tokens other than the battlefield it wont work for alot of decks that take advantage of the floating mana (Cloudpost & Candelabra of Tawnos for example ) :(
User avatar
East Bay
 
Posts: 85
Joined: 17 Mar 2013, 02:05
Has thanked: 33 times
Been thanked: 30 times

Re: Formal Request Thread

Postby sumomole » 06 Jul 2013, 18:22

gorem2k wrote:
thefiremind wrote:DotP2014 has a function PutPTTokensOntoBattlefield which I guess it produces tokens with a set P/T, but there are no examples of it, so it would need some tests in order to find the correct parameters.
this was my focus yesterday, I spent countless hours trying different values. without success. I should just quit and wait for others to do the work for me :lol:
This is Kalitas, Bloodchief of Ghet and its toekn I coded, work fine. :)
Kalitas, Bloodchief of Ghet | Open
Code: Select all
MTG():PutPTTokensOntoBattlefield( "TOKEN_VAMPIRE_X_X", 1, EffectController(), P_value, T_value )
token | Open
Code: Select all
  <COLOUR value="B" />
  <ARTIST name="Kekai Kotaki" />
  <CASTING_COST cost="" />
  <TYPE metaname="Creature" />
  <SUB_TYPE metaname="Vampire" />
  <EXPANSION value="DPG" />
  <RARITY metaname="T" />
  <POWER value="*" />
  <TOUGHNESS value="*" />
  <TOKEN />
User avatar
sumomole
Programmer
 
Posts: 611
Joined: 07 Jun 2011, 08:34
Has thanked: 51 times
Been thanked: 234 times

Re: Formal Request Thread

Postby gorem2k » 06 Jul 2013, 18:28

sumomole knew?

well you're clever but you shouldn't hide your secrets !!! [-X :lol:
gorem2k
 
Posts: 464
Joined: 01 Apr 2013, 04:21
Has thanked: 48 times
Been thanked: 33 times

Re: Formal Request Thread

Postby gorem2k » 06 Jul 2013, 19:14

I'd like to add "Phasing" (exile/return at upkeep) to the list.

Code: Select all
  <TRIGGERED_ABILITY replacement_effect="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Phasing]]></LOCALISED_TEXT>
    <TRIGGER value="BEGINNING_OF_PLAYERS_STEP" pre_trigger="1">
    return MTG():GetStep() == STEP_UPKEEP --have no idea for the rest.
gorem2k
 
Posts: 464
Joined: 01 Apr 2013, 04:21
Has thanked: 48 times
Been thanked: 33 times

Re: Formal Request Thread

Postby Xander9009 » 06 Jul 2013, 19:39

Thank you sumomole, now Mystic Genesis working the way it should be :)
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: Formal Request Thread

Postby thefiremind » 06 Jul 2013, 20:02

gorem2k wrote:I'd like to add "Phasing" (exile/return at upkeep) to the list.
Phasing doesn't mean exile/return at upkeep, it's something much more complicated, and I don't think it can be coded in DotP because there's no function that phases out/in a permanent.
Look at the rules and surprise yourself:
http://wiki.mtgsalvation.com/article/Phasing

And yes, CHARACTERISTIC_PHASING exists but it's just a placeholder and does nothing, sumomole used it for marking creatures paired with soulbond. :mrgreen:
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Formal Request Thread

Postby Master Necro » 06 Jul 2013, 21:00

Xander9009 wrote:
Xander9009 wrote:Mystic Genesis - I can't quite get it to work. It makes the token, but I can't get it to change the token's power and toughness.
| Open
Code: Select all
   <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Counter target spell. Put an X/X green Ooze creature token onto the battlefield, where X is that spell’s converted mana cost.]]></LOCALISED_TEXT>
    <TARGET tag="CARD_QUERY_CHOOSE_SPELL_TO_COUNTER" definition="0" compartment="0" count="1" />
    <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    filter:SetZone( ZONE_STACK )
    </TARGET_DEFINITION>
   <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       local cmc = target:GetConvertedManaCost()
       EffectDC():Set_Int( 1, cmc )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       target:CounterSpell()
    end
    </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
    MTG():PutTokensOntoBattlefield( "TOKEN_OOZE_0_1_G_909002", 1, EffectController(), EffectDC():Make_Chest(0) )
    </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
   local TokenPT = EffectDC():Get_Int(1)
   local token = EffectDC():Get_Chest(0):Get_CardPtr(0)
    if token ~= nil then
       local characteristics = token:GetCurrentCharacteristics()
       characteristics:Power_Set( TokenPT )
       characteristics:Toughness_Set( TokenPT )
    end
    </RESOLUTION_TIME_ACTION>
Sphinx of Uthuun - Too many chests! This one's got my brain scrambled through and through. Unlike with Mystic Genesis, I don't even have basic code to work from.
Triumph of Ferocity - If someone knows how to do this one easily, that would be awesome. At the moment I'm planning to copy Overwhelming Stampede for myself and then all opponents' creatures and then compare the results.
Zameck Guildmage - I've got its second ability working, but the first ability simply won't trigger no matter how much I mess with it.
| Open
Code: Select all
<ACTIVATED_ABILITY>
        <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{G}{U}: This turn, each creature you control enters the battlefield with an additional +1/+1 counter on it.]]></LOCALISED_TEXT>
   <COST mana_cost="{G}{U}" type="Mana" />
   <TRIGGERED_EFFECT replacement_effect="1">
    <TRIGGER value="ZONECHANGE_TRANSITION" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY" pre_trigger="1">
    return (TriggerObject() == EffectDC():Get_CardPtr(0))
    </TRIGGER>
    <CLEANUP simple_cleanup="EndOfTurn" />
    <RESOLUTION_TIME_ACTION>
    if TriggerObject() ~= nil then
      if TriggerObject():GetCardType():Test( CARD_TYPE_CREATURE ) then
         TriggerObject():AddCounters( MTG():PlusOnePlusOneCounters(), 1)
      end
    end
    </RESOLUTION_TIME_ACTION>
   </TRIGGERED_EFFECT>
  </ACTIVATED_ABILITY>
I managed to get Mystic Genesis working. Dumb mistake on my part; used resolution action instead of continuous (and learned that a continuous action requires a duration). Working code:
| Open
Code: Select all
     <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Counter target spell. Put an X/X green Ooze creature token onto the battlefield, where X is that spell’s converted mana cost.]]></LOCALISED_TEXT>   
<TARGET tag="CARD_QUERY_CHOOSE_SPELL_TO_COUNTER" definition="0" compartment="0" count="1" />
    <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    filter:SetZone( ZONE_STACK )
    </TARGET_DEFINITION>
   <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       local cmc = target:GetConvertedManaCost()
       EffectDC():Set_Int( 1, cmc )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       target:CounterSpell()
    end
    </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
    MTG():PutTokensOntoBattlefield( "TOKEN_OOZE_0_1_G_909002", 1, EffectController(), EffectDC():Make_Chest(0) )
    </RESOLUTION_TIME_ACTION>
   <CONTINUOUS_ACTION layer="7B">
   local targetpt = EffectDC():Get_Int(1)
    local target = EffectDC():Get_Chest(0):Get_CardPtr(0)
    if target ~= nil then
       local characteristics = target:GetCurrentCharacteristics()
       characteristics:Power_Set( targetpt )
       characteristics:Toughness_Set( targetpt )
    end
    </CONTINUOUS_ACTION>
   <DURATION>
   local target = EffectDC():Get_Chest(0):Get_CardPtr(0)
    return (target == nil)
    </DURATION>
I also got Triumph of Ferocity working. Working code:
| Open
Code: Select all
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[At the beginning of your upkeep, draw a card if you control the creature with the greatest power or tied for the greatest power.]]></LOCALISED_TEXT>
<TRIGGER value="BEGINNING_OF_PLAYERS_STEP" simple_qualifier="controller">
    return MTG():GetStep() == STEP_UPKEEP
    </TRIGGER>
   <FILTER filter_id="0">
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE  )
    filter:Add( FE_CONTROLLER, OP_IS, EffectController())
    </FILTER>
    <RESOLUTION_TIME_ACTION>
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE  )
    filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
    local number = filter:EvaluateObjects()
    local power = 0
    for i = 0, (number-1) do
       local card = filter:GetNthEvaluatedObject(i)
       if card ~= nil then
          local temp = card:GetCurrentCharacteristics():Power_Get()
          if temp &gt; power then
             power = temp
             EffectDC():Set_Int(0, power)
          end
       end
    end
    </RESOLUTION_TIME_ACTION>
   <FILTER filter_id="1">
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE  )
    filter:Add( FE_CONTROLLER, OP_NOT, EffectController())
    </FILTER>
    <RESOLUTION_TIME_ACTION>
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE  )
    filter:Add( FE_CONTROLLER, OP_NOT, EffectController() )
    local number = filter:EvaluateObjects()
    local power = 0
    for i = 0, (number-1) do
       local card = filter:GetNthEvaluatedObject(i)
       if card ~= nil then
          local temp = card:GetCurrentCharacteristics():Power_Get()
          if temp &gt; power then
             power = temp
             EffectDC():Set_Int(1, power)
          end
       end
    end
    </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
   local power0 = EffectDC():Get_Int(0)
   local power1 = EffectDC():Get_Int(1)
   power1 = power1 - 1
   if power0 &gt; power1 then
      EffectController():DrawCards(1)
   end
   </RESOLUTION_TIME_ACTION>
I also got the first ability for Zameck Guildmage working thanks to Savage Summoning. The only issue I've found is that for the second ability, you pay the mana and choose a creature with a counter. It goes on the stack and only when it resolves does it remove the counter. If it doesn't remove a counter, then you don't draw a card. So, if the creature is destroyed after paying the mana but before it removes the counter, then the mana is wasted and that's not how it's supposed to work. Here's the 95% working code:
| Open
Code: Select all
  <ACTIVATED_ABILITY>
    <COST mana_cost="{G}{U}" type="Mana" />
   <RESOLUTION_TIME_ACTION>
    local delayDC_A = EffectDC():Make_Chest(1)
    MTG():CreateDelayedTrigger(1, delayDC_A)
    </RESOLUTION_TIME_ACTION>
  </ACTIVATED_ABILITY>
  <TRIGGERED_ABILITY resource_id="1" replacement_query="1">
    <TRIGGER value="SPELL_PLAYED" simple_qualifier="controller">
    return  TriggerObject():GetCardType():Test( CARD_TYPE_CREATURE )
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local delayDC = EffectDC():Make_Chest(1)
    delayDC:Set_CardPtr(0, TriggerObject())
    delayDC:Protect_CardPtr(0)
    MTG():CreateDelayedTrigger(2, delayDC)
    </RESOLUTION_TIME_ACTION>
    <CLEANUP simple_cleanup="EndOfTurn" />
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY replacement_effect="1" resource_id="2">
    <TRIGGER value="ZONECHANGE_TRANSITION" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY" pre_trigger="1">
    return (TriggerObject() == EffectDC():Get_CardPtr(0))
    </TRIGGER>
    <CLEANUP simple_cleanup="EndOfTurn" />
    <RESOLUTION_TIME_ACTION>
    if TriggerObject() ~= nil then
       TriggerObject():AddCounters( MTG():PlusOnePlusOneCounters(), 1)
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <ACTIVATED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{G}{U}, Remove a +1/+1 counter from a creature you control: Draw a card.]]></LOCALISED_TEXT>
   <COST mana_cost="{G}{U}" type="Mana" />
   <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_TO_GET_PLUS1_PLUS1_COUNTER" definition="0" compartment="0" count="1" />
    <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
    filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
   filter:Add( FE_LUA_CONDITION, 0, EffectController())
    </TARGET_DEFINITION>
    <FILTER_CONDITION id="0">
    local num_counters_on_thing = FilteredCard():CountCounters( MTG():PlusOnePlusOneCounters())
       
    if Object():GetParent() == FilteredCard() then
       if num_counters_on_thing &gt;1 then
          return true
       else
          return false
       end
    else
       if num_counters_on_thing &gt; 0 then
          return true
       else
          return false
       end
    end
    </FILTER_CONDITION>
   <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       target:RemoveCounters( MTG():PlusOnePlusOneCounters(), 1)
    end
    </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
    EffectController():DrawCards(1)
    </RESOLUTION_TIME_ACTION>
  </ACTIVATED_ABILITY>
How can I make Zameck Guildmage first ability go on the stack after removing a counter from a creature? And if anyone is feeling generous, Sphinx of Uthuun is a bit beyond me.
thefiremind wrote:The problem with Mystic Genesis coded like that is that if you make a copy of the token it will probably end up being a 0/1, while it should retain the values of the original token. DotP2014 has a function PutPTTokensOntoBattlefield which I guess it produces tokens with a set P/T, but there are no examples of it, so it would need some tests in order to find the correct parameters.

In your Triumph of Ferocity, the <FILTER>...</FILTER> blocks are useless. They don't do any harm if you leave them, but you can shorten the code by removing them.

I tried to code the cost "Remove a +1/+1 counter from a creature you control" for Ghave, Guru of Spores and ended up with this:
Code: Select all
    <COST type="generic">
      <PREREQUISITE>
      local filter = ClearFilter()
      filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
      filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
      local filter_count = filter:EvaluateObjects()
      if filter_count &gt; 0 then
         for i=0,filter_count-1 do
            local candidate = filter:GetNthEvaluatedObject(i)
            if candidate ~= nil and candidate:CountCounters( MTG():PlusOnePlusOneCounters() ) &gt; 0 then
               return true
            end
         end
      end
      return false
      </PREREQUISITE>
      <RESOLUTION_TIME_ACTION>
      MTG():ClearFilterMark()
      local filter = ClearFilter()
      filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
      filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
      local filter_count = filter:EvaluateObjects()
      if filter_count &gt; 0 then
         for i=0,filter_count-1 do
            local candidate = filter:GetNthEvaluatedObject(i)
            if candidate ~= nil and candidate:CountCounters( MTG():PlusOnePlusOneCounters() ) &gt; 0 then
               candidate:MarkForFilter()
            end
         end
         filter:SetMarkedObjectsOnly()
         EffectController():ChooseItem( "CARD_QUERY_CHOOSE_CREATURE_YOU_CONTROL", EffectDC():Make_Targets(6) )
      end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
      local creature = EffectDC():Get_Targets(6) and EffectDC():Get_Targets(6):Get_CardPtr(0)
      if creature ~= nil then
         creature:RemoveCounters( MTG():PlusOnePlusOneCounters(), 1 )
      end
      </RESOLUTION_TIME_ACTION>
    </COST>
It's quite long, but it seems to work OK.

The first ability of your Zameck Guildmage is wrong: why should you use a SPELL_PLAYED trigger? A creature that enters the battlefield from the graveyard should benefit from the ability, too. Remove that delayed trigger and create the ZONECHANGE_TRANSITION delayed trigger directly:
Code: Select all
  <ACTIVATED_ABILITY>
    <COST mana_cost="{G}{U}" type="Mana" />
    <RESOLUTION_TIME_ACTION>
    MTG():CreateDelayedTrigger(2, nil)
    </RESOLUTION_TIME_ACTION>
  </ACTIVATED_ABILITY>
  <TRIGGERED_ABILITY replacement_effect="1" resource_id="2">
    <TRIGGER value="ZONECHANGE_TRANSITION" simple_qualifier="objectyoucontrol" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY" pre_trigger="1" />
    <CLEANUP simple_cleanup="EndOfTurn" />
    <RESOLUTION_TIME_ACTION>
    if TriggerObject() ~= nil then
       TriggerObject():AddCounters( MTG():PlusOnePlusOneCounters(), 1 )
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
I also simplified the code: simple_qualifier="objectyoucontrol" should be enough to make the ability affect only your creatures. If it's not, let me know.

About Sphinx of Uthuun, the problem is always the same: there's no such thing as "pile" in DotP, and I can't see a good way to approximate it, especially concerning user interaction (how do you let the players see the piles and choose one?).
I'm confused do these cards work or are they still WIP? If they work I'll add them to the first post. :)

In the mean time I have a few codes that got me stuck and 3 card requests:

Codes:

"Regenerate each creature you control."
" {T} : Add {G} or {B} to your mana pool."
"Whenever another Goblin you control becomes blocked, sacrifice it. If you do, it deals 4 damage to each creature blocking it."

Cards:

Goblin Bomb
Jarad, Golgari Lich Lord
Jarad's Orders

Thank you in advance!:)
User avatar
Master Necro
 
Posts: 259
Joined: 24 Apr 2013, 18:25
Has thanked: 83 times
Been thanked: 21 times

Re: Formal Request Thread

Postby thefiremind » 06 Jul 2013, 21:24

Master Necro wrote:I'm confused do these cards work or are they still WIP? If they work I'll add them to the first post. :)
The "Remove a +1/+1 counter from a creature you control" cost is stand-alone and working, if you consider it as a sort of mechanic you can add it to the first post. The other cards need a merging between the cards themselves and my fixes.

Master Necro wrote:"Regenerate each creature you control."
Easy, pick the filter from Decree of Savagery and the regeneration from any creature that regenerates:
Code: Select all
    <FILTER filter_id="0">
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE  )
    filter:Add( FE_CONTROLLER, OP_IS, EffectController())
    </FILTER>
    <RESOLUTION_TIME_ACTION filter_id="0">
    if FilteredCard() ~= nil then
       FilteredCard():GiveRegeneration()
    end
    </RESOLUTION_TIME_ACTION>
Master Necro wrote:" {T} : Add {G} or {B} to your mana pool."
I'll leave the mana problems to other modders. :mrgreen:

Master Necro wrote:"Whenever another Goblin you control becomes blocked, sacrifice it. If you do, it deals 4 damage to each creature blocking it."
I made Ib Halfheart, Goblin Tactician for DotP2012 but now that I look at his code with more knowledge, I see that it was partially wrong. #-o It's not easy, I need to think about it. I guess it will need something along the lines of sumomole's code for Guardian of the Gateless. If someone has an idea, please share it, I'm not sure if I can sort something out.

I made the 2 Jarad cards for a deck that will be in my mod, but since I don't want to have copies of my cards with the same Multiverse ID around, I'll share unprefixed versions.
I'm quite satisfied with the new "Sacrifice a Swamp and a Forest" cost that I coded: my version lets you choose any Swamp or Forest as first choice, then it restricts to what's missing during the second choice.

EDIT: fixed Jarad, Golgari Lich Lord.
Attachments
Jarad stuff.zip
Jarad and his Orders (fixed)
(6.29 KiB) Downloaded 253 times
Last edited by thefiremind on 09 Jul 2013, 13:34, edited 1 time in total.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Formal Request Thread

Postby gorem2k » 06 Jul 2013, 21:40

Master Necro wrote:
thefiremind wrote:
Master Necro wrote:Also I am trying to make Necroplasm how do I code:

At the beginning of your end step, destroy each creature with converted mana cost equal to the number of +1/+1 counters on Necroplasm.
I think this is the best way:
Code: Select all
  <TRIGGERED_ABILITY>
    -- Localised text omitted
    <TRIGGER value="BEGINNING_OF_PLAYERS_STEP" simple_qualifier="controller">
    return MTG():GetStep() == STEP_END_OF_TURN
    </TRIGGER>
    <FILTER filter_id="0">
    local counters = EffectSourceLKI():CountCounters( MTG():PlusOnePlusOneCounters() )
    local filter = ClearFilter()
    filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
    filter:Add(FE_CMC, OP_IS, counters)
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION filter_id="0">
    if FilteredCard() ~= nil then
       FilteredCard():Destroy()
    end
    </RESOLUTION_TIME_ACTION>
    <SFX text="GLOBAL_MASSACRE_PLAY" />
  </TRIGGERED_ABILITY>
I'm not sure if the counters are remembered even when Necroplasm leaves the battlefield before resolution, but I think they are, that's why I used EffectSourceLKI().
Thanks and I have added it to the first post. :)
is </TARGET_DEFINITION> supposed to be in this code? must be </FILTER>, right?

in the meantime, I'd like to request code for Brine Hag. I never played an hag and would enjoy building an hag deck. don't know how to interrogate for damage done to object this turn. thanks
Last edited by gorem2k on 06 Jul 2013, 21:50, edited 1 time in total.
gorem2k
 
Posts: 464
Joined: 01 Apr 2013, 04:21
Has thanked: 48 times
Been thanked: 33 times

PreviousNext

Return to 2014

Who is online

Users browsing this forum: No registered users and 17 guests


Who is online

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

Users browsing this forum: No registered users and 17 guests

Login Form