It is currently 10 May 2025, 18:44
   
Text Size

Tradewind rider

Moderator: CCGHQ Admins

Tradewind rider

Postby keitofu » 17 Feb 2012, 08:17

Hello everybody,

It's my first post here, and I would like to thank everybody for the great job you have made on customising DOTP.
I've been using the tools you provided (Gibbed's tools and DeckEditorRev) and it helped me a lot for coding new cards.

I coded almost successfully the Tradewind Rider but I have a problem I can't resolve.

Here is the code :

Code: Select all
  <ACTIVATED_ABILITY layer="2">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{T}: Tap two untapped creatures you control: Return target permanent to its owner's hand.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[]]]]></LOCALISED_TEXT>
    <AI_AVAILABILITY behaviour="InResponseOrDuringCombat" />

    <TARGET_DETERMINATION>
    local filter = Object():GetFilter()
    filter:Clear()
    filter:SetController( Object():GetPlayer() )
   filter:SetZone( ZONE_IN_PLAY )
    filter:AddExtra( FILTER_EXTRA_CREATURE_UNTAPPED )
    filter:NotTargetted()
         
    if Object():GetFilter():CountStopAt( 2 ) &lt; 2 then
      return TARGET_DETERMINATION_NONE
    end
         
    filter:Clear()
    filter:AddCardType( CARD_TYPE_CREATURE )
    filter:SetZone( ZONE_IN_PLAY )
    return TargetBadF()
    </TARGET_DETERMINATION>

    <PLAY_TIME_ACTION>
    local filter = Object():GetFilter()
    filter:Clear()
    filter:SetZone( ZONE_IN_PLAY )
    filter:PlayerAntiHint( Object():GetPlayer() )
    Object():GetPlayer():ChooseTargetDC( "CARD_QUERY_CHOOSE_PERMANENT_TO_PUT_INTO_HAND", MTG():EffectDataChest():Make_Targets( 1 ))
    </PLAY_TIME_ACTION>
 <RESOLUTION_TIME_ACTION>
 local targetDC = MTG():EffectDataChest():Get_Targets(1)
    if targetDC ~= nil then
      local target = targetDC:Get_CardPtr(0)
      if target ~= nil then
       target:ReturnToOwnersHand()
      end
    end
    </RESOLUTION_TIME_ACTION>

    <COST type="TapSelf" />
<COST type="Tap" number="2">
      <PLAYTIME>
      local player = Object():GetPlayer()
      player:ChooseTarget( "CARD_QUERY_TAP_AN_UNTAPPED_CREATURE_YOU_CONTROL" )
      </PLAYTIME>

      <TARGET_DETERMINATION>
      local filter = Object():GetFilter()
      filter:Clear()
      filter:SetController( Object():GetPlayer() )
      filter:AddCardType( CARD_TYPE_CREATURE )
      filter:SetZone( ZONE_IN_PLAY )
      filter:AddExtra( FILTER_EXTRA_CREATURE_UNTAPPED )
      filter:NotTargetted()
      if Object():GetFilter():CountStopAt( 1 ) == 1 then
         return TARGET_DETERMINATION_ALL
      else
         return TARGET_DETERMINATION_NONE
      end
      </TARGET_DETERMINATION>
</COST>
    <AI_BASE_SCORE score="600" zone="in_play" />
  </ACTIVATED_ABILITY>
It almost works : I can choose the target I want, my creatures are tapped, but I found that if the targeted permanent is an artifact it does not return to owner's hand. If it's a creature or a land it works.

Any idea ?

Thanks !
keitofu
 
Posts: 19
Joined: 15 Feb 2012, 17:30
Has thanked: 1 time
Been thanked: 0 time

Re: Tradewind rider

Postby thefiremind » 17 Feb 2012, 10:04

You see, the TARGET_DETERMINATION is split in 2 halves: the first checks if you have the untapped creatures, while the second should check the "real" target. But you wrote filter:AddCardType( CARD_TYPE_CREATURE ) on that, too, so an artifact isn't a valid target for this code. You can choose it because in the PLAY_TIME_ACTION you didn't include that filter, but the validity of the target is checked on TARGET_DETERMINATION before resolution (or at least, I think it works this way).
You have 2 options: either you add the other types of permanents (see Argentum Armor code), or you remove the filter for creatures since ZONE_IN_PLAY is usually enough to define a permanent. I prefer the first option but it's just because I'm a perfectionist... :P
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 722 times

Re: Tradewind rider

Postby keitofu » 17 Feb 2012, 11:02

Thanks for the response !
I'm really novice in coding card, I don't understand deeply how it works, so I fiddle with the code, trying to understand it, so your comments are really helpful !
I've tried you first option, which is just including all types and it works !!
But I'm wondering why I could return lands with my old code...

Anyway thanks a lot for the help and for giving me the opportunity to understand a little more how it works :)
I'm sure I'll have others questions later on ;)
keitofu
 
Posts: 19
Joined: 15 Feb 2012, 17:30
Has thanked: 1 time
Been thanked: 0 time

Re: Tradewind rider

Postby thefiremind » 17 Feb 2012, 15:20

keitofu wrote:But I'm wondering why I could return lands with my old code...
That's strange, I really don't know...

Anyway I'm glad I have been helpful. :wink:
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 722 times


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 16 guests


Who is online

In total there are 16 users online :: 0 registered, 0 hidden and 16 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 16 guests

Login Form