It is currently 18 Dec 2017, 01:27
   
Text Size

Talk about new cards here

Moderators: Xander9009, CCGHQ Admins

Re: Talk about new cards here

Postby cenarius » 16 Jul 2015, 15:26

Hi again.

I'm trying to do "Breakthrough" but i haven't found any similar card. Could anybody share some knowledge of a card which algorithm may be helpful, or even better, an easy way to do the card? At the moment i got the example from "Archfiend of Depravity" (just for the "sacrifice the rest" part, changing it for "discard the rest" in my idea), but i think further programming from it is beyond my knowledge :(

Any help will be appreciated.
cenarius
 
Posts: 87
Joined: 09 Jun 2015, 14:40
Has thanked: 0 time
Been thanked: 0 time

Re: Talk about new cards here

Postby thefiremind » 16 Jul 2015, 16:49

cenarius wrote:I'm trying to do "Breakthrough" but i haven't found any similar card. Could anybody share some knowledge of a card which algorithm may be helpful, or even better, an easy way to do the card?
I think the best way to do it is to MarkForFilter the cards you choose, then SetUnmarkedObjectsOnly, loop through the filtered cards with EvaluateObjects, and discard the cards. Here's a very basic example of what I'm meaning:
Code: Select all
local chosenDC = EffectDC():Get_Targets(0) -- assuming your query for choosing the X cards saved the results to chest #0
MTG():ClearFilterMark()
local filter = ClearFilter()
filter:SetZone( ZONE_HAND, EffectController() )
for i=0,chosenDC:Count()-1 do
   chosenDC:Get_CardPtr(i):MarkForFilter() -- mark the chosen cards
end
filter:SetUnmarkedObjectsOnly() -- exclude the marked cards from the filter
local filter_count = filter:EvaluateObjects()
if filter_count > 0 then
   for i=0,filter_count-1 do
      filter:GetNthEvaluatedObject(i):Discard() -- discard the cards in the filter
   end
end
I can't guarantee that it will work right off the bat, but it should be enough to get you to the right way, I hope. :)
Last edited by thefiremind on 16 Jul 2015, 18:36, edited 1 time in total.
< Former DotP 2012/2013/2014 modder >
Currently not really active.
User avatar
thefiremind
Programmer
 
Posts: 3511
Joined: 07 Nov 2011, 10:55
Has thanked: 117 times
Been thanked: 713 times

Re: Talk about new cards here

Postby cenarius » 16 Jul 2015, 18:20

thefiremind wrote:
cenarius wrote:I'm trying to do "Breakthrough" but i haven't found any similar card. Could anybody share some knowledge of a card which algorithm may be helpful, or even better, an easy way to do the card?
I think the best way to do it is to MarkForFilter the cards you choose, then SetUnmarkedObjectsOnly, loop through the filtered cards with EvaluateObjects, and discard the cards. Here's a very basic example of what I'm meaning:
Code: Select all
local chosenDC = EffectDC():Get_Chest(1) -- assuming your query for choosing the X cards saved the results to chest #1
MTG():ClearFilterMark()
local filter = ClearFilter()
filter:SetZone( ZONE_HAND, EffectController() )
for i=0,chosenDC:Count()-1 do
   chosenDC:Get_CardPtr(i):MarkForFilter() -- mark the chosen cards
end
filter:SetUnmarkedObjectsOnly() -- exclude the marked cards from the filter
local filter_count = filter:EvaluateObjects()
if filter_count &gt; 0 then
   for i=0,filter_count-1 do
      filter:GetNthEvaluatedObject(i):Discard() -- discard the cards in the filter
   end
end
I can't guarantee that it will work right off the bat, but it should be enough to get you to the right way, I hope. :)
Damn dude, i have no idea.

Sorry, but i'm not good with code if i don't see it in a card example. Here is my code with your idea "melted":

Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
  <FILENAME text="BREAKTHROUGH_512382225" />
  <CARDNAME text="BREAKTHROUGH" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Breakthrough]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Breakthrough]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Breakthrough]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Breakthrough]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Breakthrough]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[打開]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Breakthrough]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Breakthrough]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Breakthrough]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="512382225" />
  <ARTID value="512382225" />
  <ARTIST name="Raymond Swanland" />
  <CASTING_COST cost="{X}{U}" />
  <TYPE metaname="Sorcery" />
  <EXPANSION value="CNS" />
  <RARITY metaname="U" />
  <FLAVOURTEXT>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[The ideas came flooding in so fast that they couldn't all be contained.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[The ideas came flooding in so fast that they couldn't all be contained.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Las ideas inundaron tan rápido que no todo pudo ser contenido.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[The ideas came flooding in so fast that they couldn't all be contained.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[The ideas came flooding in so fast that they couldn't all be contained.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[The ideas came flooding in so fast that they couldn't all be contained.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[The ideas came flooding in so fast that they couldn't all be contained.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[The ideas came flooding in so fast that they couldn't all be contained.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[The ideas came flooding in so fast that they couldn't all be contained.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[The ideas came flooding in so fast that they couldn't all be contained.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[The ideas came flooding in so fast that they couldn't all be contained.]]></LOCALISED_TEXT>
   </FLAVOURTEXT>
 
  <SPELL_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Draw four cards, then choose X cards in your hand and discard the rest.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Draw four cards, then choose X cards in your hand and discard the rest.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Draw four cards, then choose X cards in your hand and discard the rest.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Draw four cards, then choose X cards in your hand and discard the rest.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Pesca quattro carte, poi scegli X carte dalla tua mano e scarta le rimanenti.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[カードを4枚引き、その後あなたの手札からカードをX枚選び、残りのカードを捨てる。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Draw four cards, then choose X cards in your hand and discard the rest.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Draw four cards, then choose X cards in your hand and discard the rest.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Draw four cards, then choose X cards in your hand and discard the rest.]]></LOCALISED_TEXT>
   <RESOLUTION_TIME_ACTION>
    EffectController():DrawCards(4)
    </RESOLUTION_TIME_ACTION>
   
   <RESOLUTION_TIME_ACTION>
    local filter = ClearFilter()
    filter:SetZone( ZONE_HAND, EffectController())
    EffectController():SetItemCount( GetEffectX() )
    for i = 0,(Count()-1) do
       EffectController():SetItemPrompt (i, "CARD_QUERY_CHOOSE_CARD_TO_KEEP_IN_HAND" )
    end
    EffectController():ChooseItems( EffectDC():Make_Targets(0) )
    </RESOLUTION_TIME_ACTION>
   
   <RESOLUTION_TIME_ACTION>
   local chosenDC = EffectDC():Get_Chest(1)
    MTG():ClearFilterMark()
    local filter = ClearFilter()
    filter:SetZone( ZONE_HAND, EffectController() )
    for i=0,chosenDC:Count()-1 do
       chosenDC:Get_CardPtr(i):MarkForFilter()
    end
   </RESOLUTION_TIME_ACTION>
   
   <RESOLUTION_TIME_ACTION>
   filter:SetUnmarkedObjectsOnly()
    local filter_count = filter:EvaluateObjects()
    if filter_count &gt; 0 then
       for i=0,filter_count-1 do
          filter:GetNthEvaluatedObject(i):Discard()
       end
    end
   </RESOLUTION_TIME_ACTION>
   
  </SPELL_ABILITY>
</CARD_V2>
What i don't understand is how i do the link between my card and your idea. I guess it's because i haven't defined the "SetChest" thing, as your code starts with an intruction to get it. I still ran the card, well, when you have nothing to loose... :p

Give me a hand in here and i'll owe you my soul :D
cenarius
 
Posts: 87
Joined: 09 Jun 2015, 14:40
Has thanked: 0 time
Been thanked: 0 time

Re: Talk about new cards here

Postby thefiremind » 16 Jul 2015, 18:37

That's my fault, I used Get_Chest instead of Get_Targets.
Change
Code: Select all
local chosenDC = EffectDC():Get_Chest(1)
to
Code: Select all
local chosenDC = EffectDC():Get_Targets(0)
and merge your last RESOLUTION_TIME_ACTIONs into one, and it should work.
< Former DotP 2012/2013/2014 modder >
Currently not really active.
User avatar
thefiremind
Programmer
 
Posts: 3511
Joined: 07 Nov 2011, 10:55
Has thanked: 117 times
Been thanked: 713 times

Re: Talk about new cards here

Postby cenarius » 16 Jul 2015, 19:19

thefiremind wrote:That's my fault, I used Get_Chest instead of Get_Targets.
Change
Code: Select all
local chosenDC = EffectDC():Get_Chest(1)
to
Code: Select all
local chosenDC = EffectDC():Get_Targets(0)
and merge your last RESOLUTION_TIME_ACTIONs into one, and it should work.
Mm, it doesn't work but if those functions are right, it should, because the code looks nice to me but i'm sure i'm missing something here, as usual.

The code:
Code: Select all
<SPELL_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Draw four cards, then choose X cards in your hand and discard the rest.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Draw four cards, then choose X cards in your hand and discard the rest.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Roba cuatro cartas, luego elige X cartas de tu mano y descarta el resto.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Draw four cards, then choose X cards in your hand and discard the rest.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Pesca quattro carte, poi scegli X carte dalla tua mano e scarta le rimanenti.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[カードを4枚引き、その後あなたの手札からカードをX枚選び、残りのカードを捨てる。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Draw four cards, then choose X cards in your hand and discard the rest.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Draw four cards, then choose X cards in your hand and discard the rest.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Draw four cards, then choose X cards in your hand and discard the rest.]]></LOCALISED_TEXT>
   <RESOLUTION_TIME_ACTION>
    EffectController():DrawCards(4)
    </RESOLUTION_TIME_ACTION>
   
   <RESOLUTION_TIME_ACTION>
    local filter = ClearFilter()
    filter:SetZone( ZONE_HAND, EffectController())
    EffectController():SetItemCount( GetEffectX() )
   if Count() &gt;= 0 then
      for i = 0,(Count()-1) do
         EffectController():SetItemPrompt (i, "CARD_QUERY_CHOOSE_CARD_TO_KEEP_IN_HAND" )
      end
   end
    EffectController():ChooseItems( EffectDC():Make_Targets(0) )
    </RESOLUTION_TIME_ACTION>
   
   <RESOLUTION_TIME_ACTION>
   local chosenDC = EffectDC():Get_Targets(0)
    MTG():ClearFilterMark()
    local filter = ClearFilter()
    filter:SetZone( ZONE_HAND, EffectController() )
    for i=0,chosenDC:Count()-1 do
       chosenDC:Get_CardPtr(i):MarkForFilter()
    end
   
   filter:SetUnmarkedObjectsOnly()
    local filter_count = filter:EvaluateObjects()
    if filter_count &gt; 0 then
       for i=0,filter_count-1 do
          filter:GetNthEvaluatedObject(i):Discard()
       end
    end
   </RESOLUTION_TIME_ACTION>
  </SPELL_ABILITY>
Don't leave me alone please.
cenarius
 
Posts: 87
Joined: 09 Jun 2015, 14:40
Has thanked: 0 time
Been thanked: 0 time

Re: Talk about new cards here

Postby thefiremind » 16 Jul 2015, 20:17

My part is correct now, yours has a problem: Count() is a chest function, you can't call it on nothing. The count of how many cards you choose is GetEffectX() anyway, so you can reuse that:
Code: Select all
    local x = GetEffectX()
    local filter = ClearFilter()
    filter:SetZone( ZONE_HAND, EffectController())
    EffectController():SetItemCount(x)
    for i = 0,x-1 do
        EffectController():SetItemPrompt (i, "CARD_QUERY_CHOOSE_CARD_TO_KEEP_IN_HAND" )
    end
    EffectController():ChooseItems( EffectDC():Make_Targets(0) )
< Former DotP 2012/2013/2014 modder >
Currently not really active.
User avatar
thefiremind
Programmer
 
Posts: 3511
Joined: 07 Nov 2011, 10:55
Has thanked: 117 times
Been thanked: 713 times

Re: Talk about new cards here

Postby cenarius » 17 Jul 2015, 07:16

thefiremind wrote:My part is correct now, yours has a problem: Count() is a chest function, you can't call it on nothing. The count of how many cards you choose is GetEffectX() anyway, so you can reuse that:
Code: Select all
    local x = GetEffectX()
    local filter = ClearFilter()
    filter:SetZone( ZONE_HAND, EffectController())
    EffectController():SetItemCount(x)
    for i = 0,x-1 do
        EffectController():SetItemPrompt (i, "CARD_QUERY_CHOOSE_CARD_TO_KEEP_IN_HAND" )
    end
    EffectController():ChooseItems( EffectDC():Make_Targets(0) )
Well, i told you i'm not a programmer. You were right, as usual.

It works perfect now, and from now on we have a new way of selecting cards that we can use when needed.

As always, thank you for your support, you rule ;)
cenarius
 
Posts: 87
Joined: 09 Jun 2015, 14:40
Has thanked: 0 time
Been thanked: 0 time

Re: Talk about new cards here

Postby cenarius » 19 Jul 2015, 10:13

Hi again.

Once more into the fight. I need help with "Chains of Mephistopheles". Without this card i can't make the "Total Chainator" deck so i hope to solve the enigma with your help guys.

Here is my code (just the triggered ability):
Code: Select all
<TRIGGERED_ABILITY>
   <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[If a player would draw a card except the first one he or she draws in his or her draw step each turn, that player discards a card instead. If the player discards a card this way, he or she draws a card. If the player doesn’t discard a card this way, he or she puts the top card of his or her library into his or her graveyard.]]></LOCALISED_TEXT>
   <TRIGGER value="DREW_CARD" pre_trigger="1">
   if TriggerPlayer()~= nil then
       local interrogation = MTG():ClearInterrogationQuery()
       interrogation:SetPlayer( TriggerPlayer() )
       local num_drawn_this_turn = interrogation:Count(INTERROGATE_CARDS_DRAWN, INTERROGATE_THIS_TURN, 1)
       if MTG():GetStep() ~= STEP_DRAW or num_drawn_this_turn == 1 then
          MTG():OverrideEvent()
          return true
       end
    end
    return false
    </TRIGGER>
   
   <RESOLUTION_TIME_ACTION>
    local filter = ClearFilter()
    filter:SetZone( ZONE_HAND, TriggerPlayer())
   
   if (TriggerPlayer() ~= nil and TriggerPlayer():Hand_Count() ~= 0) then
      for i = 0,(1-1) do
         TriggerPlayer():SetItemPrompt (i, "CARD_QUERY_CHOOSE_CARD_TO_DISCARD" )
      end
      TriggerPlayer():ChooseItems( EffectDC():Make_Targets(0) )   
   else
      TriggerPlayer():MillCards(1)
      return false
   end
   </RESOLUTION_TIME_ACTION>

   <RESOLUTION_TIME_ACTION>
    local target_card = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target_card ~= nil and TriggerPlayer():Hand_Count() ~= 0 then
       target_card:Discard()
    end
    </RESOLUTION_TIME_ACTION>   

   <RESOLUTION_TIME_ACTION>
    if TriggerPlayer() ~= nil then
      TriggerPlayer():DrawCards(1)
    end
    </RESOLUTION_TIME_ACTION>   
   
   </TRIGGERED_ABILITY>
The idea is simple: If the player has at least one card on his/her hand, if he/she would draw an extra card (no counting the first one on the draw step), he/she must first discard one and then draw that extra card... unless he/she doesn't have a card in his/her hand, but if so, he/she mills one card from the top of his/her library instead and then the effect ends.

My problem is with the way i did it, the "MTG():OverrideEvent()" on the trigger will jump into the table everytime someone draws a card, including the one you draw from the Chains of Mephistopheles, repeating the curse for the eternity.

Finally, my questions:
- Is there a way to avoid this nefast resolution? i tried making the player discard before drawing, all without the "MTG():OverrideEvent()" thing, just the normal way, but instead it draw the card and the the ability from the chains resolves, which is not the idea.
- Or, is there a better way to do the card? in my ignorance, maybe there is a similar method i don't know but someone knows.

Thank you for your patience :|

EDIT: Also, forgot to mention that i tried to detect an ability's name, so the ability from the chains only triggers for any cards but a card named "Chains of Mephistopheles". That's a good way to get rid of this problem but i don't know the functions to make it possible.

That, and i coudln't find an existing card to use as an example :(
cenarius
 
Posts: 87
Joined: 09 Jun 2015, 14:40
Has thanked: 0 time
Been thanked: 0 time

Re: Talk about new cards here

Postby Ajame » 19 Jul 2015, 12:44

Card missing:

- Llanowar Mentor
Ajame
 
Posts: 1
Joined: 17 Jul 2015, 22:54
Has thanked: 0 time
Been thanked: 0 time

Re: Talk about new cards here

Postby Xander9009 » 19 Jul 2015, 17:31

@cenarius - Probably the best way to do it, then, would be to add another prerequisite to the trigger: RSN_ObjectDC():Get_Int(0) == 0. Then, right before they draw the card due to Chains of Mephistopheles, call RSN_ObjectDC():Set_Int(0, 1). At the beginning of each turn, reset that to 0.

There is a problem with this. It will only fire once, even if multiple players try to draw cards. To fix this, you'll need to change it slightly so that before you call those functions, you figure out the player's index and use that in place of the 0 index in Get_Int(0) and Set_Int(0... At the beginning of each turn, you could skip that by calling either
Code: Select all
for i=0,3 do
  RSN_ObjectDC():Set_Int(i, 0)
end

or

RSN_ObjectDC():Set_Int(0, 0)
RSN_ObjectDC():Set_Int(1, 0)
RSN_ObjectDC():Set_Int(2, 0)
RSN_ObjectDC():Set_Int(3, 0)
To get the player index from 0 to 3, there are two things you could try. I don't know for sure what this function does, but try Player:GetGlobalIndex(). Combine it with MTG():MessageAllPlayers(var) to see if it always returns a different number for each player and always returns a number between 0 and 3. If so, use that. If not, use this
Code: Select all
local Player = TriggerPlayer()  --The player about to draw
local Index = -1  --Start it off at an invalid number so we can check if it was properly found or if an error occurred.
for i=0,3 do  --For each possible player (up to 4 in a 4 player game)
  local TempPlayer = MTG():GetNthPlayer(i)  --Get the player
  if TempPlayer ~= nil and TempPlayer == Player then --Then check if they're the right one
    Index = i  --If they are, store their index. You should probably call break, but it's not a big difference.
  end
end
if Index &gt; -1 then  --If it's still -1, then the player wasn't found and something went wrong. Otherwise, use the found number.
  if RSN_ObjectDC():Get_Int(Index) == 0 then -- If the variable at this index is 0, then the ability hasn't fired for them this turn.
    --Do your stuff, whether it's returning true for the trigger or making them draw the card and stuff.
  end
end
Ajame wrote:Card missing:

- Llanowar Mentor
... Missing from what?
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2695
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 92 times
Been thanked: 393 times

Re: Talk about new cards here

Postby cenarius » 20 Jul 2015, 11:45

Xander9009 wrote:@cenarius - Probably the best way to do it, then, would be to add another prerequisite to the trigger: RSN_ObjectDC():Get_Int(0) == 0. Then, right before they draw the card due to Chains of Mephistopheles, call RSN_ObjectDC():Set_Int(0, 1). At the beginning of each turn, reset that to 0.

There is a problem with this. It will only fire once, even if multiple players try to draw cards. To fix this, you'll need to change it slightly so that before you call those functions, you figure out the player's index and use that in place of the 0 index in Get_Int(0) and Set_Int(0... At the beginning of each turn, you could skip that by calling either
Code: Select all
for i=0,3 do
  RSN_ObjectDC():Set_Int(i, 0)
end

or

RSN_ObjectDC():Set_Int(0, 0)
RSN_ObjectDC():Set_Int(1, 0)
RSN_ObjectDC():Set_Int(2, 0)
RSN_ObjectDC():Set_Int(3, 0)
To get the player index from 0 to 3, there are two things you could try. I don't know for sure what this function does, but try Player:GetGlobalIndex(). Combine it with MTG():MessageAllPlayers(var) to see if it always returns a different number for each player and always returns a number between 0 and 3. If so, use that. If not, use this
Code: Select all
local Player = TriggerPlayer()  --The player about to draw
local Index = -1  --Start it off at an invalid number so we can check if it was properly found or if an error occurred.
for i=0,3 do  --For each possible player (up to 4 in a 4 player game)
  local TempPlayer = MTG():GetNthPlayer(i)  --Get the player
  if TempPlayer ~= nil and TempPlayer == Player then --Then check if they're the right one
    Index = i  --If they are, store their index. You should probably call break, but it's not a big difference.
  end
end
if Index &gt; -1 then  --If it's still -1, then the player wasn't found and something went wrong. Otherwise, use the found number.
  if RSN_ObjectDC():Get_Int(Index) == 0 then -- If the variable at this index is 0, then the ability hasn't fired for them this turn.
    --Do your stuff, whether it's returning true for the trigger or making them draw the card and stuff.
  end
end
I want to say than you so much for this, i really REALLY appreciate your effort, but i need to ask, it isn't possible to do it my way? i mean, it's fine and all, but your comment seems to be in chinese to me man, and my logic seems to be right, being able to draw cards just with "Chains of Mephistopheles" so it triggers for every other card... as long as the chains are in play of course. It also works for any other copy, allied or opponent.

If there is no way, then i'll give the fight with your idea.

Tank you for your consideration ;)

PD:Please don't get mad :|
cenarius
 
Posts: 87
Joined: 09 Jun 2015, 14:40
Has thanked: 0 time
Been thanked: 0 time

Re: Talk about new cards here

Postby thefiremind » 20 Jul 2015, 12:27

I think Xander9009's idea could work, but I find it a bit too complicated... maybe I'm missing something, but wouldn't just using a LinkedDC register as a flag be enough? Trigger only if flag is off, turn on at the beginning of resolution, turn back off at the end of resolution.

I mean:
Code: Select all
  <TRIGGERED_ABILITY linked_ability_group="1">
   <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[If a player would draw a card except the first one he or she draws in his or her draw step each turn, that player discards a card instead. If the player discards a card this way, he or she draws a card. If the player doesn’t discard a card this way, he or she puts the top card of his or her library into his or her graveyard.]]></LOCALISED_TEXT>
   <TRIGGER value="DREW_CARD" pre_trigger="1">
   if TriggerPlayer() ~= nil and LinkedDC():Get_Int(0) ~= 1 then -- Checking for flag here
       local interrogation = MTG():ClearInterrogationQuery()
       interrogation:SetPlayer( TriggerPlayer() )
       local num_drawn_this_turn = interrogation:Count(INTERROGATE_CARDS_DRAWN, INTERROGATE_THIS_TURN, 1)
       if MTG():GetStep() ~= STEP_DRAW or num_drawn_this_turn == 1 then
          MTG():OverrideEvent()
          return true
       end
    end
    return false
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    LinkedDC():Set_Int(0, 1) -- Turn flag on = trigger off
    </RESOLUTION_TIME_ACTION>   
    <RESOLUTION_TIME_ACTION>
    local player = TriggerPlayer()
    if player ~= nil and player:Hand_Count() ~= 0 then
       local filter = ClearFilter()
       filter:SetZone(ZONE_HAND, player)
       player:ChooseItem( "CARD_QUERY_CHOOSE_CARD_TO_DISCARD", EffectDC():Make_Targets(0) )   
    else
       player:MillCards(1)
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target_card = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target_card ~= nil then
       target_card:Discard()
       TriggerPlayer():DrawCards(1)
    end
    </RESOLUTION_TIME_ACTION>   
    <RESOLUTION_TIME_ACTION>
    LinkedDC():Set_Int(0, 0) -- Turn flag back off = trigger back on
    </RESOLUTION_TIME_ACTION>   
  </TRIGGERED_ABILITY>
I have also simplified the code for the discard (no need for the loop when you need to choose only 1 card), and put the DrawCards inside the check for the discarded card, otherwise you draw a card even when you mill. I saw you using "return false", but returning in a RESOLUTION_TIME_ACTION just ends that piece of code, the other actions will follow as usual. And returning true/false has a meaning only in a RESOLUTION_TIME_ACTION with repeating="1" (you return true if you want to repeat, false otherwise).

I'm not sure if it works, but it's the simplest idea.
< Former DotP 2012/2013/2014 modder >
Currently not really active.
User avatar
thefiremind
Programmer
 
Posts: 3511
Joined: 07 Nov 2011, 10:55
Has thanked: 117 times
Been thanked: 713 times

Re: Talk about new cards here

Postby Xander9009 » 20 Jul 2015, 13:03

@thefiremind - Would that account for multiple players drawing a card? I thought about LinkedDC, but didn't think it would work. However, thinking about it again, it very well might. I'm not sure.

@cenarius - It wouldn't be replacing the way you're doing it. It would just be adding a check to it so it doesn't trigger itself. Try thefiremind's code and see if the LinkedDC method works.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2695
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 92 times
Been thanked: 393 times

Re: Talk about new cards here

Postby cenarius » 20 Jul 2015, 16:06

@thefiremind @Xander9009

Thank you both.

It may work but i'm not sure because on the deck i made it doesn't, well, not as intended at least.

The idea is to put "Chains of Mephistopheles" in turn one or two, and then on turn three put an "Anvil of Bogardan". After that, with luck, discard both your hand and opponent's hand with a "Winds of Change" or something else, and then save your ass with "Squee, Goblin Nabob".

What should happend is that once both combo cards are in play, before opponent draws the extra card, the chains triggers and discard first, then draw a card and then the second part of the anvil triggers and discard again.

What happens ingame is that when you are about to draw the extra card thanks to the anvil, the discard ability of the anvil triggers first, i discard, then the chains triggers, i discard, then draw a card. The problem comes when i have no cards, because when i'm about to draw the extra card the anvil's discard ability triggers (why? i don't know), i discard the first card i drew, then the chains discard ability triggers, but as i have no hand, it mills.

The code seems to be fine though but in game it doesn't work as intended.

The best way to understand is to look how it works, so if you like here is my deck plus cards:

https://drive.google.com/file/d/0B-oDza ... sp=sharing

There is no hurry of course, i know you are busy so take your time, while i'm stuck with this card i worked on other decks and cards as well and once this issue is solved (i hope) i'll make the update.

Let me know please if you look into this.

PD: I forgot something important. The player should be able to play an instant before discarding in the drawing step, but the abilities of both cards triggers too quickly, when an opponent could save the situation by throwing a "Disenchant" for example. I wonder if there is a way to cold down the abilities on both cards. Also forgot to say thank you for the patience.
cenarius
 
Posts: 87
Joined: 09 Jun 2015, 14:40
Has thanked: 0 time
Been thanked: 0 time

Re: Talk about new cards here

Postby cenarius » 29 Jul 2015, 14:35

Hi there.

It's me again, and, as usual, i bring more trouble :p

I'm struggling to do "Price of Glory" for the Fires of Yavimaya deck i'm working on. It's more like a sideboard card though but hey, it must be there, same reason for making "Mana Maze" for the Merfolk Opposition deck. Also, i need to ask if it is possible to do "Rith, the Awakener". I need to ask for her because i have yet to work with tokens and this one adds tokens of different colors so i'm in a big doubt here.

Anyway, my code for "Price of Glory" is this:

Code: Select all
<TRIGGERED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever a player taps a land for mana, if it’s not that player’s turn, destroy that land.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[À chaque fois qu’un joueur engage un terrain pour du mana pendant le tour d’un autre joueur, détruisez ce terrain.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Siempre que un jugador gire una tierra para obtener maná durante el turno de otro jugador, destruye esa tierra.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Immer wenn ein Spieler im Zug eines anderen Spielers ein Land für Mana tappt, zerstöre dieses Land.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ogniqualvolta un giocatore TAPpa una terra per attingere mana, se non è il turno di quel giocatore, distruggi quella terra.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Whenever a player taps a land for mana, if it’s not that player’s turn, destroy that land.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Whenever a player taps a land for mana, if it’s not that player’s turn, destroy that land.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Whenever a player taps a land for mana, if it’s not that player’s turn, destroy that land.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Toda vez que um jogador vira um terreno para gerar mana durante o turno de qualquer outro jogador, destrua aquele terreno.]]></LOCALISED_TEXT>
   <TRIGGER value="BECAME_TAPPED">
      local oCard = TriggerObject()
      if (oCard ~= nil) then
         if (oCard:GetCardType():Test( CARD_TYPE_LAND )) then
            if (RSN_UsedManaAbility( oCard )) then
               return true
            end
         end
      end
   return false   
   </TRIGGER>
   
   <RESOLUTION_TIME_ACTION>
      local player = TriggerObjectLKI():GetPlayer()
      local land = TriggerObjectLKI()
      if player:MyTurn() == false then
         land:Destroy()
      end
   </RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
I want to note that i already tested the same method as in "Dictate of Karametra", using "BECAME_TAPPED_FOR_MANA" in the trigger section instead of the current one, but as in the code it also check if the land produced mana with success i think it's pretty much the same... i think.

Does my card work? well, kind of. It works flawlessly... but only if i choose to use the mana ability of the land, but if i play a card without tapping the mana, that is, allowing the game to do it automaticaly, the ability on my "Price of Glory" doesn't trigger. So i need to ask if it is really possible to do this card, if there is another method i don't know, or is this another of those things "not possible to implement doe to language/engine limitations".

I knew this card was going to give a pain so that's why i left it to the end, as i already finished my other decks and i'm ready for the update. Will wait for an answer, if it isn't possible, well, C'est la vie. I hope it is possible.

Will wait for that hand.

Regards and thanks in advance.
cenarius
 
Posts: 87
Joined: 09 Jun 2015, 14:40
Has thanked: 0 time
Been thanked: 0 time

PreviousNext

Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 1 guest


Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 10 minutes)
Most users ever online was 279 on 11 Jul 2013, 22:03

Users browsing this forum: No registered users and 1 guest

Login Form