It is currently 19 Oct 2019, 14:30
   
Text Size

Report cards error here

Moderators: Xander9009, CCGHQ Admins

Re: Report cards error here

Postby MC Brodie » 12 Oct 2013, 07:29

I have two cards that I'm having an issue with. The first is Last Rites. The card works as intended except in one scenario. I tried searching for some rulings on this but couldn't find anything. I would think that if you choose to discard 0 cards, the targeted player would still reveal their hand. However, when I choose to not discard any cards, I cannot get the targeted player to reveal their hand.
Last Rites (not working) | Open
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
  <FILENAME text="LAST_RITES_867031778" />
  <CARDNAME text="LAST_RITES" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Last Rites]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Derniers sacrements]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Ritos de la extremaunción]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Todes-Riten]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Estrema Unzione]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Last Rites]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Last Rites]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Last Rites]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Últimos Ritos]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="867031778" />
  <ARTID value="867031778" />
  <ARTIST name="Bradley Williams" />
  <CASTING_COST cost="{2}{B}" />
  <TYPE metaname="Sorcery" />
  <EXPANSION value="OD" />
  <RARITY metaname="C" />
  <SPELL_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Discard any number of cards. Target player reveals his or her hand, then you choose a nonland card from it for each card discarded this way. That player discards those cards.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Défaussez-vous de n’importe quel nombre de cartes de votre main. Le joueur ciblé révèle sa main, puis vous y choisissez une carte non-terrain pour chaque carte défaussée de cette manière. Ce joueur se défausse des cartes que vous avez choisies.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Descarta cualquier número de cartas de tu mano. El jugador objetivo muestra su mano, luego tú eliges de ahí una carta que no sea tierra por cada carta descartada de esta manera. Ese jugador descarta esas cartas.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Wirf eine beliebige Anzahl Karten aus deiner Hand ab. Ein Spieler deiner Wahl zeigt die Karten auf seiner Hand offen vor. Dann bestimmst du für jede Karte, die du auf diese Weise abgeworfen hast, eine Karte darunter, die kein Land ist. Dieser Spieler wirft diese Karten ab.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Scarta un qualsiasi numero di carte. Il giocatore bersaglio rivela la propria mano, poi tu scegli da essa una carta non terra per ogni carta che hai scartato in questo modo. Quel giocatore scarta quelle carte.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Discard any number of cards. Target player reveals his or her hand, then you choose a nonland card from it for each card discarded this way. That player discards those cards.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Discard any number of cards. Target player reveals his or her hand, then you choose a nonland card from it for each card discarded this way. That player discards those cards.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Discard any number of cards. Target player reveals his or her hand, then you choose a nonland card from it for each card discarded this way. That player discards those cards.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Descarte um número qualquer de cards de sua mão. O jogador alvo revela sua própria mão e depois você escolhe um card que não seja um terreno da mão dele para cada card descartado dessa maneira. Aquele jogador descarta aqueles cards.]]></LOCALISED_TEXT>
   <TARGET tag="CARD_QUERY_UU_CHOOSE_PLAYER_DISCARD" definition="0" compartment="0" count="1" />
   <TARGET_DEFINITION id="0">
      local filter = ClearFilter()
      filter:SetFilterType( FILTER_TYPE_PLAYERS )
    </TARGET_DEFINITION>
   <RESOLUTION_TIME_ACTION>
      local oPlayer = EffectController()
      local oHand = oPlayer:Hand_Count()
      local filter = ClearFilter()
      filter:SetZone(ZONE_HAND, oPlayer)
      if oHand &gt; 0 then
         oPlayer:SetItemCount(oHand)
         for i=0,oHand-1 do
            oPlayer:SetItemPrompt(i, "CARD_QUERY_UU_CHOOSE_ANY_NUMBER_TO_DISCARD")
         end
         oPlayer:ChooseItems( EffectDC():Make_Targets(1), QUERY_FLAG_UP_TO )
      end
      EffectDC():Set_Int(2, oHand)
    </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
      local targetDC = EffectDC():Get_Targets(1)
      local discarded = 0
      if targetDC ~= nil then
         local oHand = EffectDC():Get_Int(2)
         for i=0,oHand-1 do
            local card = targetDC:Get_CardPtr(i)
            if card ~= nil then
               discarded = discarded + 1
               card:Discard()
            end
         end
      end
      EffectDC():Set_Int(2, discarded)
    </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
      local target_player = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
      if target_player ~= nil then
         target_player:RevealHand()
      end
    </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
      local oPlayer = EffectController()
      local target = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
      local discarded = EffectDC():Get_Int(2)
      local ToDiscard = 0
      if target ~= nil and discarded ~= nil and discarded &gt; 0 then
         local filter = ClearFilter()
         filter:SetZone(ZONE_HAND, target)
         filter:Add(FE_TYPE, OP_NOT, CARD_TYPE_LAND)
         local oHand = filter:Count()
         if oHand &gt; 0 then
            if discarded &gt; oHand then
               ToDiscard = oHand
            else
               ToDiscard = discarded
            end
            oPlayer:SetItemCount(ToDiscard)
            for i=0,ToDiscard-1 do
               oPlayer:SetItemPrompt(i, "CARD_QUERY_UU_CHOOSE_OPPONENT_CARD_TO_DISCARD")
            end
            oPlayer:ChooseItems( EffectDC():Make_Targets(3) )
         end
      end
      EffectDC():Set_Int(2, ToDiscard)
   </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
      local targetDC = EffectDC():Get_Targets(3)
      if targetDC ~= nil then
         local discard = EffectDC():Get_Int(2)
         for i=0,discard-1 do
            local card = targetDC:Get_CardPtr(i)
            if card ~= nil then
               card:Discard()
            end
         end
      end
    </RESOLUTION_TIME_ACTION>
   <AI_SIMPLIFIED_TARGETING compartment="0" hint="HINT_ENEMY_ONLY" />
  </SPELL_ABILITY>
</CARD_V2>
The other card I'm having trouble with is Nim Deathmantle. I'm having trouble with the triggered ability that brings the creature back onto the battlefield and attaches the equipment to it. The card comes back onto the battlefield but the equipment doesn't attach to the creature. I have a feeling that I'm messing up the card protection somehow since I'm not the best at that. Any help is appreciated. Thanks,

Nim Deathmantle Trigger (Not Working) | Open
Code: Select all
  <TRIGGERED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever a nontoken creature is put into your graveyard from the battlefield, you may pay {4}. If you do, return that card to the battlefield and attach Nim Deathmantle to it.]]></LOCALISED_TEXT>
   <TRIGGER value="ZONECHANGE_BEGIN" to_zone="ZONE_GRAVEYARD" from_zone="ZONE_BATTLEFIELD">
      return (TriggerObject():IsToken() == false) and (TriggerObject():GetCardType():Test( CARD_TYPE_CREATURE )) and (TriggerObject():GetOwner() == EffectController())
    </TRIGGER>
   <PLAY_TIME_ACTION>
      if EffectSource() ~= nil and TriggerObject() ~= nil then
         local resurrect_chest  = EffectDC():Make_Chest(1)
         resurrect_chest:Set_CardPtr( 0, TriggerObject() )
         resurrect_chest:Protect_CardPtr(0)
      end
   </PLAY_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
      local player = EffectController()
      local creature = TriggerObject()
      if creature:GetZone() == ZONE_GRAVEYARD and player:CanPayManaCost("{0}") then
         player:BeginNewMultipleChoice()
         player:AddMultipleChoiceAnswer( "UI_CONDITIONAL_QUESTION_YES", player:CanPayManaCost("{0}") )
         player:AddMultipleChoiceAnswer( "UI_CONDITIONAL_QUESTION_NO" )
         player:AskMultipleChoiceQuestion( "OPTIONAL_ABILITY_QUESTION", creature )
      end
    </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
      local player = EffectController()
      local answer = player:GetMultipleChoiceResult()
      if EffectSource() ~= nil and player:CanPayManaCost("{0}") and answer ~= nil and answer == 0 then
         player:PayManaCost("{0}")
         local target = TriggerObject()
         if target ~= nil and target:GetZone() == ZONE_GRAVEYARD then
            local resurrect_chest  = EffectDC():Make_Chest(1)
            resurrect_chest:Set_CardPtr( 0, target )
            resurrect_chest:Protect_CardPtr(0)
            target:PutOntoBattlefield( player )
         end
      end
    </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
      local resurrect_chest = EffectDC():Get_Chest(1)
      if (EffectSource() ~= nil and resurrect_chest ~= nil and resurrect_chest:Get_CardPtr(0) ~= nil) then
         EffectController():DisplayMessage("Trying to attach")
         EffectSource():Attach( resurrect_chest:Get_CardPtr(0) )   
      end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
Edit - Below is a working version of Last Rites if anyone is interested.
Last Rites (tested) | Open
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
  <FILENAME text="LAST_RITES_867031778" />
  <CARDNAME text="LAST_RITES" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Last Rites]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Derniers sacrements]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Ritos de la extremaunción]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Todes-Riten]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Estrema Unzione]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Last Rites]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Last Rites]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Last Rites]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Últimos Ritos]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="867031778" />
  <ARTID value="867031778" />
  <ARTIST name="Bradley Williams" />
  <CASTING_COST cost="{2}{B}" />
  <TYPE metaname="Sorcery" />
  <EXPANSION value="OD" />
  <RARITY metaname="C" />
  <SPELL_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Discard any number of cards. Target player reveals his or her hand, then you choose a nonland card from it for each card discarded this way. That player discards those cards.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Défaussez-vous de n’importe quel nombre de cartes de votre main. Le joueur ciblé révèle sa main, puis vous y choisissez une carte non-terrain pour chaque carte défaussée de cette manière. Ce joueur se défausse des cartes que vous avez choisies.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Descarta cualquier número de cartas de tu mano. El jugador objetivo muestra su mano, luego tú eliges de ahí una carta que no sea tierra por cada carta descartada de esta manera. Ese jugador descarta esas cartas.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Wirf eine beliebige Anzahl Karten aus deiner Hand ab. Ein Spieler deiner Wahl zeigt die Karten auf seiner Hand offen vor. Dann bestimmst du für jede Karte, die du auf diese Weise abgeworfen hast, eine Karte darunter, die kein Land ist. Dieser Spieler wirft diese Karten ab.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Scarta un qualsiasi numero di carte. Il giocatore bersaglio rivela la propria mano, poi tu scegli da essa una carta non terra per ogni carta che hai scartato in questo modo. Quel giocatore scarta quelle carte.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Discard any number of cards. Target player reveals his or her hand, then you choose a nonland card from it for each card discarded this way. That player discards those cards.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Discard any number of cards. Target player reveals his or her hand, then you choose a nonland card from it for each card discarded this way. That player discards those cards.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Discard any number of cards. Target player reveals his or her hand, then you choose a nonland card from it for each card discarded this way. That player discards those cards.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Descarte um número qualquer de cards de sua mão. O jogador alvo revela sua própria mão e depois você escolhe um card que não seja um terreno da mão dele para cada card descartado dessa maneira. Aquele jogador descarta aqueles cards.]]></LOCALISED_TEXT>
   <TARGET tag="CARD_QUERY_UU_CHOOSE_PLAYER_DISCARD" definition="0" compartment="0" count="1" />
   <TARGET_DEFINITION id="0">
      local filter = ClearFilter()
      filter:SetFilterType( FILTER_TYPE_PLAYERS )
    </TARGET_DEFINITION>
   <RESOLUTION_TIME_ACTION>
      local oPlayer = EffectController()
      local oHand = oPlayer:Hand_Count()
      local filter = ClearFilter()
      filter:SetZone(ZONE_HAND, oPlayer)
      if oHand &gt; 0 then
         oPlayer:SetItemCount(oHand)
         for i=0,oHand-1 do
            oPlayer:SetItemPrompt(i, "CARD_QUERY_UU_CHOOSE_ANY_NUMBER_TO_DISCARD")
         end
         oPlayer:ChooseItems( EffectDC():Make_Targets(1), QUERY_FLAG_UP_TO )
      end
      EffectDC():Set_Int(2, oHand)
    </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
      local targetDC = EffectDC():Get_Targets(1)
      local discarded = 0
      if targetDC ~= nil then
         local oHand = EffectDC():Get_Int(2)
         for i=0,oHand-1 do
            local card = targetDC:Get_CardPtr(i)
            if card ~= nil then
               discarded = discarded + 1
               card:Discard()
            end
         end
      end
      EffectDC():Set_Int(2, discarded)
    </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
      local target_player = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
      if target_player ~= nil then
         target_player:RevealHand()
      end
    </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
      local target_player = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
      if target_player ~= nil then
         EffectController():LookAtPlayersHand(target_player)
      end
    </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
      local oPlayer = EffectController()
      local target = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
      local discarded = EffectDC():Get_Int(2)
      local ToDiscard = 0
      if target ~= nil and discarded ~= nil and discarded &gt; 0 then
            local filter = ClearFilter()
            filter:SetZone(ZONE_HAND, target)
            filter:Add(FE_TYPE, OP_NOT, CARD_TYPE_LAND)
            local oHand = filter:Count()
            if oHand &gt; 0 then
               if discarded &gt; oHand then
                  ToDiscard = oHand
               else
                  ToDiscard = discarded
               end
               oPlayer:SetItemCount(ToDiscard)
               for i=0,ToDiscard-1 do
                  oPlayer:SetItemPrompt(i, "CARD_QUERY_UU_CHOOSE_OPPONENT_CARD_TO_DISCARD")
               end
               oPlayer:ChooseItems( EffectDC():Make_Targets(3) )
            end
      end
      EffectDC():Set_Int(2, ToDiscard)
   </RESOLUTION_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
      local targetDC = EffectDC():Get_Targets(3)
      if targetDC ~= nil then
         local discard = EffectDC():Get_Int(2)
         for i=0,discard-1 do
            local card = targetDC:Get_CardPtr(i)
            if card ~= nil then
               card:Discard()
            end
         end
      end
    </RESOLUTION_TIME_ACTION>
   <AI_SIMPLIFIED_TARGETING compartment="0" hint="HINT_ENEMY_ONLY" />
  </SPELL_ABILITY>
</CARD_V2>
Last edited by MC Brodie on 12 Oct 2013, 20:53, edited 1 time in total.
-----------------------------------------------------------------------
Song of the Day: 46 and 2 (cover)
MC Brodie
 
Posts: 310
Joined: 01 Jun 2013, 00:10
Has thanked: 44 times
Been thanked: 34 times

Re: Report cards error here

Postby thefiremind » 12 Oct 2013, 09:45

MC Brodie wrote:The first is Last Rites. The card works as intended except in one scenario. I tried searching for some rulings on this but couldn't find anything. I would think that if you choose to discard 0 cards, the targeted player would still reveal their hand. However, when I choose to not discard any cards, I cannot get the targeted player to reveal their hand.
There must be something that I don't know about RevealHand, because I can't see anything wrong in your code. If you delete all the RESOLUTION_TIME_ACTIONs except the one that calls RevealHand, do you get to see the hand? If yes, I'd suggest you to re-insert the deleted actions one by one and see which one negates the reveal. Maybe RevealHand is skipped for you when the game recognizes that you should be able to see the hand anyway in the next action... but it's just a guess. After we know the real reason, we can work on it.

MC Brodie wrote:The other card I'm having trouble with is Nim Deathmantle. I'm having trouble with the triggered ability that brings the creature back onto the battlefield and attaches the equipment to it. The card comes back onto the battlefield but the equipment doesn't attach to the creature. I have a feeling that I'm messing up the card protection somehow since I'm not the best at that.
That chest you added makes things overly complicated, I'm sure it's not needed. Let me try an easier approach.
Nim Deathmantle Trigger (untested) | Open
Code: Select all
  <TRIGGERED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever a nontoken creature is put into your graveyard from the battlefield, you may pay {4}. If you do, return that card to the battlefield and attach Nim Deathmantle to it.]]></LOCALISED_TEXT>
    <TRIGGER value="ZONECHANGE_BEGIN" to_zone="ZONE_GRAVEYARD" from_zone="ZONE_BATTLEFIELD">
    return TriggerObject():IsToken() == false and
    TriggerObject():GetCardType():Test( CARD_TYPE_CREATURE ) and
    TriggerObject():GetOwner() == EffectController()
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local player = EffectController()
    if player:CanPayManaCost("{0}") then
       player:BeginNewMultipleChoice()
       player:AddMultipleChoiceAnswer( "UI_CONDITIONAL_QUESTION_YES", player:CanPayManaCost("{0}") )
       player:AddMultipleChoiceAnswer( "UI_CONDITIONAL_QUESTION_NO" )
       player:AskMultipleChoiceQuestion( "CARD_QUERY_MC_RETURN_THIS_CARD_TO_PLAY", TriggerObject() )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local player = EffectController()
    if player:CanPayManaCost("{0}") and player:GetMultipleChoiceResult() == 0 then
       player:PayManaCost("{0}")
       if TriggerObject() ~= nil then
          EffectDC():Protect_CardPtr( COMPARTMENT_ID_PARAM_TRIGGER_OBJECT )
          TriggerObject():PutOntoBattlefield( player )
       end
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local returned = TriggerObject()
    if EffectSource() ~= nil and returned ~= nil and returned:GetZone() == ZONE_BATTLEFIELD then
       EffectController():DisplayMessage("Trying to attach")
       if EffectSource():CanAttachTo( returned ) then
          EffectSource():Attach( returned )
       end   
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
I left all the testing parts unchanged.
< 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: 717 times

Re: Report cards error here

Postby MC Brodie » 12 Oct 2013, 19:07

thefiremind wrote:There must be something that I don't know about RevealHand, because I can't see anything wrong in your code. If you delete all the RESOLUTION_TIME_ACTIONs except the one that calls RevealHand, do you get to see the hand? If yes, I'd suggest you to re-insert the deleted actions one by one and see which one negates the reveal. Maybe RevealHand is skipped for you when the game recognizes that you should be able to see the hand anyway in the next action... but it's just a guess. After we know the real reason, we can work on it.
I blocked out all the RESOLUTION_TIME_ACTIONs except for the RevealHand one and the target's hand was correctly revealed. I started putting them back in the code with the first RESOLUTION_TIME_ACTION (the one that looks at your hand) and the target's hand was not revealed. I tried moving the RevealHand action right after the target block but this didn't work. I also tried rewriting the code to use Reveal instead of RevealHand and this didn't work either. I don't know, I'm confused.

thefiremind wrote:That chest you added makes things overly complicated, I'm sure it's not needed. Let me try an easier approach.
Nim Deathmantle Trigger (untested) | Open
Code: Select all
  <TRIGGERED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever a nontoken creature is put into your graveyard from the battlefield, you may pay {4}. If you do, return that card to the battlefield and attach Nim Deathmantle to it.]]></LOCALISED_TEXT>
    <TRIGGER value="ZONECHANGE_BEGIN" to_zone="ZONE_GRAVEYARD" from_zone="ZONE_BATTLEFIELD">
    return TriggerObject():IsToken() == false and
    TriggerObject():GetCardType():Test( CARD_TYPE_CREATURE ) and
    TriggerObject():GetOwner() == EffectController()
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local player = EffectController()
    if player:CanPayManaCost("{0}") then
       player:BeginNewMultipleChoice()
       player:AddMultipleChoiceAnswer( "UI_CONDITIONAL_QUESTION_YES", player:CanPayManaCost("{0}") )
       player:AddMultipleChoiceAnswer( "UI_CONDITIONAL_QUESTION_NO" )
       player:AskMultipleChoiceQuestion( "CARD_QUERY_MC_RETURN_THIS_CARD_TO_PLAY", TriggerObject() )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local player = EffectController()
    if player:CanPayManaCost("{0}") and player:GetMultipleChoiceResult() == 0 then
       player:PayManaCost("{0}")
       if TriggerObject() ~= nil then
          EffectDC():Protect_CardPtr( COMPARTMENT_ID_PARAM_TRIGGER_OBJECT )
          TriggerObject():PutOntoBattlefield( player )
       end
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local returned = TriggerObject()
    if EffectSource() ~= nil and returned ~= nil and returned:GetZone() == ZONE_BATTLEFIELD then
       EffectController():DisplayMessage("Trying to attach")
       if EffectSource():CanAttachTo( returned ) then
          EffectSource():Attach( returned )
       end   
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
I left all the testing parts unchanged.
Yea I had a couple of simpler versions before but since I couldn't get them to work, I kept trying more things. I don't know where I got protecting the trigger object in a PLAY_TIME_ACTION... Unfortunately, I tried your code and the equipment still does not attach to the creature returned to the battlefield.

Thanks for the help.
-----------------------------------------------------------------------
Song of the Day: 46 and 2 (cover)
MC Brodie
 
Posts: 310
Joined: 01 Jun 2013, 00:10
Has thanked: 44 times
Been thanked: 34 times

Re: Report cards error here

Postby sumomole » 12 Oct 2013, 20:15

MC Brodie wrote:I blocked out all the RESOLUTION_TIME_ACTIONs except for the RevealHand one and the target's hand was correctly revealed. I started putting them back in the code with the first RESOLUTION_TIME_ACTION (the one that looks at your hand) and the target's hand was not revealed. I tried moving the RevealHand action right after the target block but this didn't work. I also tried rewriting the code to use Reveal instead of RevealHand and this didn't work either. I don't know, I'm confused.
It isn't a serious bug, the first action "discard from your hand" covers the second "reveal target player's hands", and just for you, if you right-click and select the last used card, you can see the revealed cards.
User avatar
sumomole
Programmer
 
Posts: 611
Joined: 07 Jun 2011, 08:34
Has thanked: 51 times
Been thanked: 230 times

Re: Report cards error here

Postby thefiremind » 12 Oct 2013, 20:19

Sumomole, while you are here, could you take a look at Nim Deathmantle? I'm not sure about what's going on... TriggerObject can be properly pointed in the last action (if I add a line that reads its power I can read it), but it seems that the Attach function doesn't work for some reason I'm ignoring.

-------------------------

About Last Rites, there's something you can try: go to this line:
Code: Select all
      if target ~= nil and discarded ~= nil and discarded &gt; 0 then
separate it into:
Code: Select all
      if target ~= nil and discarded ~= nil and discarded &gt; 0 then
         if discarded &gt; 0 then
then add this alternative to the inner "if":
Code: Select all
         else
            EffectController():LookAtPlayersHand(target)
         end
This should allow you to look at target player's hand when you discard 0 cards.
< 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: 717 times

Re: Report cards error here

Postby MC Brodie » 12 Oct 2013, 20:52

sumomole wrote:It isn't a serious bug, the first action "discard from your hand" covers the second "reveal target player's hands", and just for you, if you right-click and select the last used card, you can see the revealed cards.
Awesome, I didn't know you could view revealed cards like that.

@TFM - When I was tested the change you just posted I noticed another little bug. If the target player has 0 non-land cards in hand and you discarded cards with Last Rites, you will not get to see the target player's revealed hand. I fixed this by giving the LookAtPlayersHand code it's own RESOLUTION_TIM_ACTION block right after the RevealHand block. It works now in all cases. Thanks for your help.
-----------------------------------------------------------------------
Song of the Day: 46 and 2 (cover)
MC Brodie
 
Posts: 310
Joined: 01 Jun 2013, 00:10
Has thanked: 44 times
Been thanked: 34 times

Re: Report cards error here

Postby sumomole » 12 Oct 2013, 21:58

thefiremind wrote:Sumomole, while you are here, could you take a look at Nim Deathmantle? I'm not sure about what's going on... TriggerObject can be properly pointed in the last action (if I add a line that reads its power I can read it), but it seems that the Attach function doesn't work for some reason I'm ignoring.
I tested with the following code and gained 4 life, that means in the third RESOLUTION_TIME_ACTION block, TriggerObject is still in the graveyard rather than on the battlefield, this may explain why it couldn't be equipped.
Code: Select all
    <RESOLUTION_TIME_ACTION>
    local returned = TriggerObject()
    if EffectSource() ~= nil and returned ~= nil then
       EffectController():GainLife( returned:GetZone() )
       if EffectSource():CanAttachTo( returned ) then
          EffectSource():Attach( returned )
       end   
    end
    </RESOLUTION_TIME_ACTION>
User avatar
sumomole
Programmer
 
Posts: 611
Joined: 07 Jun 2011, 08:34
Has thanked: 51 times
Been thanked: 230 times

Re: Report cards error here

Postby thefiremind » 12 Oct 2013, 22:24

sumomole wrote:I tested with the following code and gained 4 life, that means in the third RESOLUTION_TIME_ACTION block, TriggerObject is still in the graveyard rather than on the battlefield, this may explain why it couldn't be equipped.
TriggerObject is weird sometimes. I could swear I had already tried to save TriggerObject in another register and didn't work, but I must have done something else wrong back then, because I just tried again and now it works. Here's the ability:
Nim Deathmantle trigger (tested) | Open
Code: Select all
  <TRIGGERED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever a nontoken creature is put into your graveyard from the battlefield, you may pay {4}. If you do, return that card to the battlefield and attach Nim Deathmantle to it.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[À chaque fois qu’une créature non-jeton est mise dans votre cimetière depuis le champ de bataille, vous pouvez payer {4}. Si vous faites ainsi, renvoyez cette carte sur le champ de bataille et attachez-lui la Capote de mort des nims.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Siempre que una criatura que no sea ficha vaya a tu cementerio desde el campo de batalla, puedes pagar {4}. Si lo haces, regresa esa carta al campo de batalla y anéxale el Manto mortal nim.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Immer wenn eine Kreatur, die kein Spielstein ist, aus dem Spiel auf deinen Friedhof gelegt wird, kannst du {4} bezahlen. Falls du dies tust, bringe diese Karte ins Spiel zurück und lege den Todesmantel der Nim an sie an.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ogniqualvolta una creatura non pedina viene messa nel tuo cimitero dal campo di battaglia, puoi pagare {4}. Se lo fai, rimetti sul campo di battaglia quella carta e assegnale il Mantoletale dei Nim.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[トークンでないクリーチャーが1体戦場からあなたの墓地に置かれるたび、あなたは{4}を支払ってもよい。 そうした場合、そのカードを戦場に戻し、屍賊の死のマントをそれにつける。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Whenever a nontoken creature is put into your graveyard from the battlefield, you may pay {4}. If you do, return that card to the battlefield and attach Nim Deathmantle to it.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Каждый раз когда не являющееся фишкой существо попадает на ваше кладбище с поля битвы, вы можете заплатить {4}. Если вы это делаете, верните ту карту на поле битвы и прикрепите к ней Нимскую Оболочку Смерти.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Toda vez que uma criatura que não seja uma ficha é colocada num cemitério vinda do jogo, você pode pagar {4}. Se fizer isso, devolva aquele card ao campo de batalha e anexe Manto de Morte dos Nim a ele.]]></LOCALISED_TEXT>
    <TRIGGER value="ZONECHANGE_BEGIN" to_zone="ZONE_GRAVEYARD" from_zone="ZONE_BATTLEFIELD">
    return TriggerObject():IsToken() == false and
    TriggerObject():GetCardType():Test(CARD_TYPE_CREATURE) and
    TriggerObject():GetOwner() == EffectController()
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local player = EffectController()
    if player:CanPayManaCost("{4}") then
       player:BeginNewMultipleChoice()
       player:AddMultipleChoiceAnswer( "UI_CONDITIONAL_QUESTION_YES", player:CanPayManaCost("{4}") )
       player:AddMultipleChoiceAnswer("UI_CONDITIONAL_QUESTION_NO")
       player:AskMultipleChoiceQuestion( "CARD_QUERY_MC_RETURN_THIS_CARD_TO_PLAY", TriggerObject() )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local player = EffectController()
    if player:CanPayManaCost("{4}") and player:GetMultipleChoiceResult() == 0 then
       player:PayManaCost("{4}")
       EffectDC():Set_CardPtr( 0, TriggerObject() )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local tobj = EffectDC():Get_CardPtr(0)
    if tobj ~= nil then
       EffectDC():Protect_CardPtr(0)
       tobj:PutOntoBattlefield( EffectController() )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local tobj = EffectDC():Get_CardPtr(0)
    local source = EffectSource()
    if tobj ~= nil and source ~= nil and source:CanAttachTo(tobj) then
       EffectSource():Attach(tobj)
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
< 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: 717 times

Re: Report cards error here

Postby sumomole » 13 Oct 2013, 09:20

thefiremind wrote:TriggerObject is weird sometimes. I could swear I had already tried to save TriggerObject in another register and didn't work, but I must have done something else wrong back then, because I just tried again and now it works.
TriggerObject is not weird. I found the reason is that if the two actions in one RESOLUTION_TIME_ACTION block, they may conflict, if we put pay action and return action in two RESOLUTION_TIME_ACTION blocks, everything is ok. This may be a game engine bug. :lol:
Nim Deathmantle | Open
Code: Select all
  <TRIGGERED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever a nontoken creature is put into your graveyard from the battlefield, you may pay {4}. If you do, return that card to the battlefield and attach Nim Deathmantle to it.]]></LOCALISED_TEXT>
    <TRIGGER value="ZONECHANGE_BEGIN" to_zone="ZONE_GRAVEYARD" from_zone="ZONE_BATTLEFIELD">
    return TriggerObject():IsToken() == false and
    TriggerObject():GetCardType():Test(CARD_TYPE_CREATURE) and
    TriggerObject():GetOwner() == EffectController()
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local player = EffectController()
    if player:CanPayManaCost("{4}") then
      player:BeginNewMultipleChoice()
      player:AddMultipleChoiceAnswer("UI_CONDITIONAL_QUESTION_NO")
      player:AddMultipleChoiceAnswer( "UI_CONDITIONAL_QUESTION_YES" )
      player:AskMultipleChoiceQuestion( "CARD_QUERY_MC_RETURN_THIS_CARD_TO_PLAY", TriggerObject() )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    if EffectController():GetMultipleChoiceResult() == 1 then
      EffectController():PayManaCost("{4}")
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    if TriggerObject() ~= nil and EffectController():GetMultipleChoiceResult() == 1 then
      EffectDC():Protect_CardPtr( COMPARTMENT_ID_PARAM_TRIGGER_OBJECT )
      TriggerObject():PutOntoBattlefield( EffectController() )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    if TriggerObject() ~= nil and EffectSource() ~= nil and EffectController():GetMultipleChoiceResult() == 1 then
      if EffectSource():CanAttachTo(TriggerObject()) then
         EffectSource():Attach( TriggerObject() )
      end
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
User avatar
sumomole
Programmer
 
Posts: 611
Joined: 07 Jun 2011, 08:34
Has thanked: 51 times
Been thanked: 230 times

Re: Report cards error here

Postby GrovyleXShinyCelebi » 14 Oct 2013, 18:36

Hey I have a quick question.

How does the LoadTargetDefinition() function work exactly? I'm trying to make Dawn Charm, and the "counter target spell that's targetting you" part is really causing me trouble.
User avatar
GrovyleXShinyCelebi
 
Posts: 294
Joined: 12 Jun 2013, 18:23
Has thanked: 14 times
Been thanked: 35 times

Re: Report cards error here

Postby thefiremind » 14 Oct 2013, 18:53

GrovyleXShinyCelebi wrote:How does the LoadTargetDefinition() function work exactly? I'm trying to make Dawn Charm, and the "counter target spell that's targetting you" part is really causing me trouble.
You don't need LoadTargetDefinition for that. LoadTargetDefinition, as the name suggests, loads a target definition into the current filter, and it's pretty useless in DotP2014 unless you have to reload the same filter settings so many times that you decide to make a TARGET_DEFINITION with those filter settings and load it when needed.
For Dawn Charm you need to look at the targets manually as I did with Hindering Light here or with the Heroic keyword here. Compared to Hindering Light, Dawn Charm doesn't have the part "or a permanent you control", so the code that checks for that part needs to be removed, and this is what's left:
Code: Select all
    <TARGET_DEFINITION id="...">
    local filter = ClearFilter()
    filter:SetZone(ZONE_STACK)
    filter:Add( FE_LUA_CONDITION, 1, EffectController(), EffectDC() )
    </TARGET_DEFINITION>
    <FILTER_CONDITION id="1">
    local spell = FilteredCard()
    if spell ~= nil then
       local spellDC = spell:GetDataChest()
       if spellDC ~= nil then
          local player = EffectController()
          for i=0,99 do
             local targetDC = spellDC:Get_NthTargets(i)
             if targetDC ~= nil and targetDC:Count() > 0 then
                for j=0,targetDC:Count()-1 do
                   local target_player = targetDC:Get_PlayerPtr(j)
                   if target_player ~= nil and target_player == player then
                      return true
                   end
                end
             end
          end
       end
    end
    return false
    </FILTER_CONDITION>
The key idea of this code (using Get_NthTargets on a chest retrieved with GetDataChest) comes from the Precursor Golem code for DotP2013, it was a very enlightening card for functions that aren't used anywhere else (much like Intet, the Dreamer in DotP2014).
< 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: 717 times

Re: Report cards error here

Postby GrovyleXShinyCelebi » 14 Oct 2013, 19:50

thefiremind wrote:
GrovyleXShinyCelebi wrote:How does the LoadTargetDefinition() function work exactly? I'm trying to make Dawn Charm, and the "counter target spell that's targetting you" part is really causing me trouble.
You don't need LoadTargetDefinition for that. LoadTargetDefinition, as the name suggests, loads a target definition into the current filter, and it's pretty useless in DotP2014 unless you have to reload the same filter settings so many times that you decide to make a TARGET_DEFINITION with those filter settings and load it when needed.
For Dawn Charm you need to look at the targets manually as I did with Hindering Light here or with the Heroic keyword here. Compared to Hindering Light, Dawn Charm doesn't have the part "or a permanent you control", so the code that checks for that part needs to be removed, and this is what's left:
Code: Select all
    <TARGET_DEFINITION id="...">
    local filter = ClearFilter()
    filter:SetZone(ZONE_STACK)
    filter:Add( FE_LUA_CONDITION, 1, EffectController(), EffectDC() )
    </TARGET_DEFINITION>
    <FILTER_CONDITION id="1">
    local spell = FilteredCard()
    if spell ~= nil then
       local spellDC = spell:GetDataChest()
       if spellDC ~= nil then
          local player = EffectController()
          for i=0,99 do
             local targetDC = spellDC:Get_NthTargets(i)
             if targetDC ~= nil and targetDC:Count() > 0 then
                for j=0,targetDC:Count()-1 do
                   local target_player = targetDC:Get_PlayerPtr(j)
                   if target_player ~= nil and target_player == player then
                      return true
                   end
                end
             end
          end
       end
    end
    return false
    </FILTER_CONDITION>
The key idea of this code (using Get_NthTargets on a chest retrieved with GetDataChest) comes from the Precursor Golem code for DotP2013, it was a very enlightening card for functions that aren't used anywhere else (much like Intet, the Dreamer in DotP2014).
Ah, I forgot about your Heroic function (though you said it was an approximation so I thought that there might have been a better way with LoadTargetDefinition). Too bad I didn't have Duels 2013, I always wanted to see how Precursor Golem was made.

Thanks for clearing that up!
User avatar
GrovyleXShinyCelebi
 
Posts: 294
Joined: 12 Jun 2013, 18:23
Has thanked: 14 times
Been thanked: 35 times

Re: Report cards error here

Postby GrovyleXShinyCelebi » 15 Oct 2013, 01:05

Hey mate, I tried your method earlier and when I try to cast the card (for the other abilities) it just returns to my hand immediately upon casting. I thought you might need the "mode" tag on the FILTER_CONDITION block, didn't work when I tried THAT.

Would throwing your condition in the TARGET block and have it return SetTargetCount( 1 ) if there is a card on the stack that is targeting me work? If not I'm just gonna give up and use a delayed trigger.

Also, what does "SetTargetAnswerer" do? I'm guessing it sets a target tag in a TARGET block.
User avatar
GrovyleXShinyCelebi
 
Posts: 294
Joined: 12 Jun 2013, 18:23
Has thanked: 14 times
Been thanked: 35 times

Re: Report cards error here

Postby thefiremind » 15 Oct 2013, 08:38

GrovyleXShinyCelebi wrote:Hey mate, I tried your method earlier and when I try to cast the card (for the other abilities) it just returns to my hand immediately upon casting. I thought you might need the "mode" tag on the FILTER_CONDITION block, didn't work when I tried THAT.
You must have done something else wrong. I can help if you post the whole card.

GrovyleXShinyCelebi wrote:Would throwing your condition in the TARGET block and have it return SetTargetCount( 1 ) if there is a card on the stack that is targeting me work?
It's not needed: if my Hindering Light works, then Dawn Charm must work too.

GrovyleXShinyCelebi wrote:Also, what does "SetTargetAnswerer" do? I'm guessing it sets a target tag in a TARGET block.
The effect controller chooses the targets as default, but if you don't want it to be that way, you use that function. Take a look at Evangelize.
< 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: 717 times

Re: Report cards error here

Postby MC Brodie » 15 Oct 2013, 12:53

I have 2 questions. You may have to excuse some of them. I've only been playing magic for about a year.

1) In the near future I plan on attempting to code Kira, Great Glass-Spinner. In order to code her "targeted for the first time in a turn ability" I was going to a manager token and a hidden characteristic. Whenever a creature is targeted, the manager token would set the hidden characteristic to true for that creature. Kira would use this hidden characteristic to see if its the first time the creature has been targeted. Well I think I would need to use two hidden characteristics to track it could be doable. Is this a decent way to approach this? How hard is it to do a hidden characteristic?

2) Is arcane an instant/sorcery subtype? I know splice isn't easily implementable but you could still code arcane spells without splice. The only reason I'm asking is I'm coding Oyobi, Who Split the Heavens and I need to know if I should incorporate arcane into the trigger and the only way I know how to add subtypes is as a creature subtype.
-----------------------------------------------------------------------
Song of the Day: 46 and 2 (cover)
MC Brodie
 
Posts: 310
Joined: 01 Jun 2013, 00:10
Has thanked: 44 times
Been thanked: 34 times

PreviousNext

Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 2 guests


Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests (based on users active over the past 10 minutes)
Most users ever online was 287 on 31 Mar 2019, 04:11

Users browsing this forum: No registered users and 2 guests

Login Form