It is currently 12 Nov 2025, 14:19
   
Text Size

Thoughtseize

Moderator: CCGHQ Admins

Thoughtseize

Postby Persee » 24 Sep 2012, 16:18

Hello,

Here's the code :

Code: Select all
<SPELL_ABILITY filter_zone="ZONE_IN_PLAY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Target player reveals his or her hand. You choose a nonland card from it. That player discards that card. You lose 2 life.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Target player reveals his or her hand. You choose a nonland card from it. That player discards that card. You lose 2 life.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Target player reveals his or her hand. You choose a nonland card from it. That player discards that card. You lose 2 life.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Target player reveals his or her hand. You choose a nonland card from it. That player discards that card. You lose 2 life.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Target player reveals his or her hand. You choose a nonland card from it. That player discards that card. You lose 2 life.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Target player reveals his or her hand. You choose a nonland card from it. That player discards that card. You lose 2 life.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Target player reveals his or her hand. You choose a nonland card from it. That player discards that card. You lose 2 life.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Target player reveals his or her hand. You choose a nonland card from it. That player discards that card. You lose 2 life.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Target player reveals his or her hand. You choose a nonland card from it. That player discards that card. You lose 2 life.]]></LOCALISED_TEXT>
    <TARGET_DEFINITION id="0">
    local filter = Object():GetFilter()
    filter:Clear()
    filter:SetFilterType( FILTER_TYPE_PLAYERS )
    filter:SetHint( HINT_ENEMY_ONLY, EffectController() )
    </TARGET_DEFINITION>
    <TARGET_DETERMINATION>
    return AtLeastOneTargetFromDefinition(0)
    </TARGET_DETERMINATION>
    <PLAY_TIME_ACTION target_choosing="1">
    EffectController():ChooseTarget( 0, "CARD_QUERY_CHOOSE_PLAYER", EffectDC():Make_Targets(0) )
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
   local targetplayer = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
   local player = EffectController()
    local filter = Object():GetFilter()
    if targetplayer ~= nil then
       filter:Clear()
       filter:NotTargetted()
        filter:AddCardType( CARD_TYPE_LAND )
        filter:AddExtra( FILTER_EXTRA_FLIP_CARD_TYPES )
       filter:SetZone( ZONE_HAND )
       filter:SetPlayer( targetplayer )
      player:ChooseTarget( 1, "CARD_QUERY_CHOOSE_CARD_TO_DISCARD", EffectDC():Make_Targets(1) )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
   local targetplayer = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
   local player = EffectController()
   local targetcard = EffectDC():Get_Targets(1):Get_PlayerPtr(0)
   
   if targetcard ~= nil then
      targetcard:Discard()
   else
      if targetplayer ~= nil then
        local filter = Object():GetFilter()
        filter:Clear()
       filter:NotTargetted()
       filter:SetZone( ZONE_HAND )
       filter:SetPlayer( targetplayer )
        filter:May()
      player:ChooseTarget( 2, "CARD_QUERY_LOOK_AT_CARDS", EffectDC():Make_Targets(2) )
        end
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    EffectController():LoseLife(2)
    </RESOLUTION_TIME_ACTION>   
  </SPELL_ABILITY>
The selected card is not discarded and I don't know why. Targetcard seems to be nil.

Thx for help.
User avatar
Persee
 
Posts: 168
Joined: 02 Jun 2011, 08:33
Has thanked: 42 times
Been thanked: 24 times

Re: Thoughtseize

Postby RiiakShiNal » 24 Sep 2012, 19:27

Code: Select all
local targetcard = EffectDC():Get_Targets(1):Get_PlayerPtr(0)
Should be:
Code: Select all
local targetcard = EffectDC():Get_Targets(1):Get_CardPtr(0)
RiiakShiNal
Programmer
 
Posts: 2189
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Thoughtseize

Postby Persee » 25 Sep 2012, 18:03

I wonder how I could miss it. #-o

Thx
User avatar
Persee
 
Posts: 168
Joined: 02 Jun 2011, 08:33
Has thanked: 42 times
Been thanked: 24 times

Re: Thoughtseize

Postby RiiakShiNal » 25 Sep 2012, 18:27

Persee wrote:I wonder how I could miss it. #-o
You probably got concerned with other parts of the code and just missed it, it happens to all of us (which is why a second set of eyes helps).
RiiakShiNal
Programmer
 
Posts: 2189
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times


Return to Programming Talk

Who is online

Users browsing this forum: Google [Bot] and 13 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 14 users online :: 1 registered, 0 hidden and 13 guests (based on users active over the past 10 minutes)
Most users ever online was 9824 on 10 Nov 2025, 04:33

Users browsing this forum: Google [Bot] and 13 guests

Login Form