Page 1 of 1

[DotP2013] Help with Enter the Infinite

PostPosted: 11 Mar 2013, 14:43
by BETenner
I tried to code Enter the Infinite, and my codes are:
Code: Select all
  <SPELL_ABILITY dangerous="1" filter_zone="ZONE_IN_PLAY">
    <RESOLUTION_TIME_ACTION>
      local count = EffectController():Library_Count()
      for i=0,count-1 do
        EffectController():DrawCard()
      end
    </RESOLUTION_TIME_ACTION>
  </SPELL_ABILITY>
  <TRIGGERED_ABILITY auto_skip="1" active_zone="ZONE_ANY">
    <TRIGGER value="DREW_CARD" simple_qualifier="controller">
      return (TriggerPlayer() == EffectController() and TriggerPlayer():Library_Count() == 0)
    </TRIGGER>
    <TARGET_DEFINITION id="0">
      local filter = Object():GetFilter()
      filter:Clear()
      filter:SetPlayer( EffectController() )
      filter:SetZone( ZONE_HAND )
    </TARGET_DEFINITION>
    <TARGET_DETERMINATION>
      return AtLeastOneTargetFromDefinition(0)
    </TARGET_DETERMINATION>
    <PLAY_TIME_ACTION target_choosing="1">
      EffectController():ChooseTarget( 0, "CARD_QUERY_CHOOSE_CARD_TO_PUT_ONTO_LIBRARY", EffectDC():Make_Targets(0) )
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
      local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
      if (target ~= nil) then
        target:PutOnTopOfLibrary()
      end
    </RESOLUTION_TIME_ACTION>
    <CONTINUOUS_ACTION layer="8">
      Object():GetPlayer():GetCurrentCharacteristics():Bool_Set( PLAYER_CHARACTERISTIC_NO_HAND_LIMIT, 1 )
    </CONTINUOUS_ACTION>
    <DURATION simple_duration="UntilEOT" />
  </TRIGGERED_ABILITY>
The strange thing is, the "choosing card to put on top of library" action always repeat itself several times (seems random, from 7 to 16 times). How to make the "choosing" action fire only once?

Re: [DotP2013] Help with Enter the Infinite

PostPosted: 11 Mar 2013, 15:11
by thefiremind
Of course it repeats itself several times... you made it as a triggered ability that goes on its own, no matter what you do with this card. It's a lot easier than that:
Code: Select all
  <SPELL_ABILITY dangerous="1" filter_zone="ZONE_IN_PLAY">
    <RESOLUTION_TIME_ACTION>
      local count = EffectController():Library_Count()
      if count &gt; 0 then
        for i=0,count-1 do
          EffectController():DrawCard()
        end
      end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
      local filter = Object():GetFilter()
      filter:Clear()
      filter:SetPlayer( EffectController() )
      filter:SetZone( ZONE_HAND )
      filter:NotTargetted()
      EffectController():ChooseTarget( 0, "CARD_QUERY_CHOOSE_CARD_TO_PUT_ONTO_LIBRARY", EffectDC():Make_Targets(0) )
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
      local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
      if (target ~= nil) then
        target:PutOnTopOfLibrary()
      end
    </RESOLUTION_TIME_ACTION>
    <CONTINUOUS_ACTION layer="8">
      EffectController():GetCurrentCharacteristics():Bool_Set( PLAYER_CHARACTERISTIC_NO_HAND_LIMIT, 1 )
    </CONTINUOUS_ACTION>
    <DURATION>
    return MTG():GetStep() == STEP_UNTAP and EffectController():MyTurn() ~= 0
    </DURATION>
  </SPELL_ABILITY>
I also added NotTargetted() in the filter for the query (when the card doesn't say "target", it's not targetted) and changed the duration to something that should represent "until your next turn" a bit better.

Re: [DotP2013] Help with Enter the Infinite

PostPosted: 11 Mar 2013, 15:42
by BETenner
Thanks! You're the script master!