Trigger BEFORE drawing a card?
New decks and cards for Stainless Games' release
Moderator: CCGHQ Admins
20 posts
• Page 1 of 2 • 1, 2
Trigger BEFORE drawing a card?
by IceManOnline » 24 Jun 2011, 11:03
Is it possible to trigger an effect, exactly before I'm going to draw a card (or to get a pointer to the card(s) I just drew)?
I'm trying to implement the dredge-ability but I don't know how to react to the "if you would draw a card" rule.
I tried trigger "drew_card" and put TriggerObject() back to the library, but it didn't work. Maybe I did it wrong or the TriggerObject of "drew_card" is not the card itself...
So I don't know how to do it now, maybe someone can help me ^^
I'm trying to implement the dredge-ability but I don't know how to react to the "if you would draw a card" rule.
I tried trigger "drew_card" and put TriggerObject() back to the library, but it didn't work. Maybe I did it wrong or the TriggerObject of "drew_card" is not the card itself...
So I don't know how to do it now, maybe someone can help me ^^
- IceManOnline
- Posts: 80
- Joined: 12 Dec 2010, 19:00
- Has thanked: 0 time
- Been thanked: 0 time
Re: Trigger BEFORE drawing a card?
by DarkusChi » 24 Jun 2011, 15:22
Here is code to prevent drawing a card, from Yanna's Necropotence:
- Code: Select all
<!--
///////////////////////////////////////////////////////////////////////////////////
Prevent the draw of a card in draw phase
///////////////////////////////////////////////////////////////////////////////////
-->
<TRIGGERED_ABILITY tag="NECROPOTENCE_RULE_1" forced_skip="1" layer="0" pre_trigger="1" zone="in_play">
<TRIGGER value="DREW_CARD">
override = true
return ( TriggerPlayer() == Object():GetController() and MTG():GetStep() == STEP_DRAW and
Object():GetController():MyTurn() ~= 0 and Player() == Object():GetController() )
</TRIGGER>
<EFFECT>
</EFFECT>
</TRIGGERED_ABILITY>
- DarkusChi
- Posts: 15
- Joined: 10 May 2011, 23:42
- Has thanked: 0 time
- Been thanked: 0 time
Re: Trigger BEFORE drawing a card?
by IceManOnline » 24 Jun 2011, 15:50
Nope, that's the code for preventing the draw PHASE, not for preventing the draw...
I already know that code.
I already know that code.
- IceManOnline
- Posts: 80
- Joined: 12 Dec 2010, 19:00
- Has thanked: 0 time
- Been thanked: 0 time
Re: Trigger BEFORE drawing a card?
by DarkusChi » 24 Jun 2011, 16:27
Not stricty true, it prevents you from drawing a card during your draw phase, does not prevent the phase itself. the important bit is the prevention of the card drawing.
- DarkusChi
- Posts: 15
- Joined: 10 May 2011, 23:42
- Has thanked: 0 time
- Been thanked: 0 time
Re: Trigger BEFORE drawing a card?
by IceManOnline » 24 Jun 2011, 17:03
That's true, you're right...
I just used the wrong keywords for my trigger...
It can't work with GetController, it must be GetOwner!
Thanks, now to the actual dredging part
I just used the wrong keywords for my trigger...
It can't work with GetController, it must be GetOwner!
Thanks, now to the actual dredging part

- IceManOnline
- Posts: 80
- Joined: 12 Dec 2010, 19:00
- Has thanked: 0 time
- Been thanked: 0 time
Re: Trigger BEFORE drawing a card?
by DarkusChi » 24 Jun 2011, 17:51
cool, glad it pointed you in the right direction 
though I'm sure you've already solved it I had a go myself here's rule 3 for Dakmor Salvage:

though I'm sure you've already solved it I had a go myself here's rule 3 for Dakmor Salvage:
- Code: Select all
<TRIGGERED_ABILITY tag="DAKMOR_SALVAGE_RULE_3" forced_skip="1" layer="0" pre_trigger="1" zone="graveyard">
<TRIGGER value="DREW_CARD">
if TriggerPlayer() == Object():GetOwner() then
override = true
return true
end
</TRIGGER>
<PLAYTIME>
ClearFilter()
Object():GetFilter():SetPlayer( Object():GetPlayer() )
Object():GetPlayer():BeginNewMultipleChoice( true )
Object():GetPlayer():AddMultipleChoiceAnswer( "YES" )
Object():GetPlayer():AddMultipleChoiceAnswer( "NO" )
Object():GetPlayer():AskMultipleChoiceQuestion( "DREDGEQ_TITLE" )
</PLAYTIME>
<EFFECT>
if Object():GetMultipleChoiceResult() == 0 then
MillCards( Object():GetOwner(), 2 )
ReturnThisCardToOwnersHand()
else
if Object():GetPlayer():Library_GetTop() ~= nil then
Object():GetPlayer():Library_GetTop():PutInHand()
Object():GetPlayer():Library_GetTop():GuidedReveal( ZONE_LIBRARY, ZONE_HAND )
end
end
</EFFECT>
</TRIGGERED_ABILITY>
- DarkusChi
- Posts: 15
- Joined: 10 May 2011, 23:42
- Has thanked: 0 time
- Been thanked: 0 time
Re: Trigger BEFORE drawing a card?
by Shatterhouse » 24 Jun 2011, 23:36
Do you know how to stop it from dredging up multiple cards from the graveyard?
- Shatterhouse
- Posts: 72
- Joined: 20 Apr 2011, 00:07
- Has thanked: 0 time
- Been thanked: 2 times
Re: Trigger BEFORE drawing a card?
by IceManOnline » 24 Jun 2011, 23:46
I think you should put a register to the player which has to be checked too...
- IceManOnline
- Posts: 80
- Joined: 12 Dec 2010, 19:00
- Has thanked: 0 time
- Been thanked: 0 time
Re: Trigger BEFORE drawing a card?
by DarkusChi » 25 Jun 2011, 00:28
Not a clue, just knocked it up quickly today So it may (will!) have issuses. None of the decks I'm building use Dredge (All too old!).
- DarkusChi
- Posts: 15
- Joined: 10 May 2011, 23:42
- Has thanked: 0 time
- Been thanked: 0 time
Re: Trigger BEFORE drawing a card?
by Persee » 25 Jun 2011, 17:12
This topic gave me the idea to code Chains of Mephistopheles but i have a problem.
Once the ability triggers (by cast a Ancestral Recall for example), the timer doesn't run anymore and the computer do nothing.
I code only the " 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" of the card
Once the ability triggers (by cast a Ancestral Recall for example), the timer doesn't run anymore and the computer do nothing.
I code only the " 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" of the card
- Code: Select all
<TRIGGERED_ABILITY layer="0" internal="1">
<TRIGGER value="COMES_INTO_PLAY">
return SelfTriggered
</TRIGGER>
<EFFECT>
Object():Register_Set( 1, 1 )
</EFFECT>
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY layer="0" internal="1">
<TRIGGER value="BEGINNING_OF_STEP">
return TriggerPlayerStep( STEP_DRAW )
</TRIGGER>
<EFFECT>
Object():Register_Set( 1, 0 )
</EFFECT>
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY internal="1" layer="0">
<TRIGGER value="DREW_CARD">
return TriggerPlayerStep( STEP_DRAW )
</TRIGGER>
<EFFECT>
Object():Register_Set( 1, 1 )
</EFFECT>
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY tag="CHAINS_OF_MEPHISTOPHELES_RULE_1" forced_skip="1" layer="0" pre_trigger="1" zone="in_play" >
<TRIGGER value="DREW_CARD">
if Object():Register_Get(1) == 1 then
override = true
return true
end
</TRIGGER>
<EFFECT>
TriggerPlayerDiscardsACard()
</EFFECT>
</TRIGGERED_ABILITY>
Re: Trigger BEFORE drawing a card?
by IceManOnline » 27 Jun 2011, 13:31
I can't help with your problem, I had the same issue when I tried to trigger for "me", not "Owner"...
To the dredge-problematic with multiple triggers. I think, we need 3 multiple-choice answers.
1. Dredge with this card
2. Dredge another card
3. Draw a card
Then we have to set a register and reset it. The only problem is, when to reset? You'll have multiple chances to draw cards in a dredge deck...
To the dredge-problematic with multiple triggers. I think, we need 3 multiple-choice answers.
1. Dredge with this card
2. Dredge another card
3. Draw a card
Then we have to set a register and reset it. The only problem is, when to reset? You'll have multiple chances to draw cards in a dredge deck...
- IceManOnline
- Posts: 80
- Joined: 12 Dec 2010, 19:00
- Has thanked: 0 time
- Been thanked: 0 time
Re: Trigger BEFORE drawing a card?
by Shatterhouse » 28 Jun 2011, 00:03
Maybe... set the register on all other cards in your graveyard, and only allow the Dredge card to be put in your hand if the register is not set? So yeah, it'll trigger a bunch of times and resolve a bunch of times, but only one card per draw should make it back into your hand.
- Shatterhouse
- Posts: 72
- Joined: 20 Apr 2011, 00:07
- Has thanked: 0 time
- Been thanked: 2 times
Re: Trigger BEFORE drawing a card?
by IceManOnline » 28 Jun 2011, 06:33
But when to reset the register?
Just imagine Ancestral Recall. With the above code, every card with Dredge will trigger for every draw.
But you only need 3 cards to trigger and right after Ancestral Recall is resolved, you need to reset the register, so it can be used again for the next draw...
Maybe it's possible to make a multiple choice with all the dredge cards in graveyard. So you can actually choose the card you want to use.
Maybe create a new badge for theses cards (like the ones with Flash etc) and just read all the cards with it and put it into a multiple choice.
Just imagine Ancestral Recall. With the above code, every card with Dredge will trigger for every draw.
But you only need 3 cards to trigger and right after Ancestral Recall is resolved, you need to reset the register, so it can be used again for the next draw...
Maybe it's possible to make a multiple choice with all the dredge cards in graveyard. So you can actually choose the card you want to use.
Maybe create a new badge for theses cards (like the ones with Flash etc) and just read all the cards with it and put it into a multiple choice.
- IceManOnline
- Posts: 80
- Joined: 12 Dec 2010, 19:00
- Has thanked: 0 time
- Been thanked: 0 time
Re: Trigger BEFORE drawing a card?
by IceManOnline » 28 Jun 2011, 08:42
I think, the best way to handle it, is with a separate card...
Maybe like a dredge-land (or a completely separate card that's exile at start of match, like the draft-card). It doesn't matter if it is in lib or grave or whatever. Whenever you draw a card, it triggers and let's you target a card which BADGE_DREDGE (not there right now, have to test if I can set new badges). If you target one it dredges, if not you draw your card...
Then the dredge-cards have to trigger for zonechange graveyard->hand and a register to mill cards.
Opinion?
Maybe like a dredge-land (or a completely separate card that's exile at start of match, like the draft-card). It doesn't matter if it is in lib or grave or whatever. Whenever you draw a card, it triggers and let's you target a card which BADGE_DREDGE (not there right now, have to test if I can set new badges). If you target one it dredges, if not you draw your card...
Then the dredge-cards have to trigger for zonechange graveyard->hand and a register to mill cards.
Opinion?
- IceManOnline
- Posts: 80
- Joined: 12 Dec 2010, 19:00
- Has thanked: 0 time
- Been thanked: 0 time
Re: Trigger BEFORE drawing a card?
by Persee » 28 Jun 2011, 19:08
Here's the code for Chains of Mephistopheles
But i have the same problem than you with dredge : even if 2 chains are on the battleground only one trigger when a player draw.

But i have the same problem than you with dredge : even if 2 chains are on the battleground only one trigger when a player draw.
- Code: Select all
<STATIC_ABILITY layer="0" internal="1" >
<FILTER>
return EnchantmentsInPlay() and Subject() ~= Object() and Object():GetRef() == Subject():GetRef() and Subject():Register_Get(5) == 1
</FILTER>
<EFFECT>
Object():Register_Set(6,1)
</EFFECT>
</STATIC_ABILITY>
<TRIGGERED_ABILITY layer="0" internal="1">
<TRIGGER value="END_OF_STEP">
return EveryEndStep()
</TRIGGER>
<EFFECT>
Object():Register_Clear(5)
</EFFECT>
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY layer="0" internal="1">
<TRIGGER value="BEGINNING_OF_STEP">
return TriggerPlayerStep( STEP_DRAW )
</TRIGGER>
<EFFECT>
Object():Register_Set( 1, 0 )
</EFFECT>
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY internal="1" layer="0">
<TRIGGER value="DREW_CARD">
return TriggerPlayerStep( STEP_DRAW )
</TRIGGER>
<EFFECT>
Object():Register_Set( 1, 1 )
</EFFECT>
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY layer="0" internal="1" >
<TRIGGER value="COMES_INTO_PLAY">
return SelfTriggered()
</TRIGGER>
<EFFECT>
Object():Register_Set( 1, 1 )
</EFFECT>
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY layer="0" tag="CHAINS_OF_MEPHISTOPHELES_RULE_1" pre_trigger="1" >
<TRIGGER value="DREW_CARD">
if ( Object():Register_Get(1) ~= 0 and Object():Register_Get(4) == 0 ) then
override = true
return true
end
return false
</TRIGGER>
<EFFECT>
Object():Register_Clear(5)
Object():Register_Set(2,1)
Object():Register_Player_Set( 0, TriggerPlayer() )
</EFFECT>
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY layer="0" dont_ask="1" >
<TRIGGER value="ABILITY_RESOLVED">
return SelfTriggered() and Object():Register_Get(2) == 1
</TRIGGER>
<EFFECT>
Object():Register_Clear(2)
if CountCardsInHand( Object():Register_Player_Get( 0 ) ) > 0
then
Object():Register_Player_Get(0):DiscardNCards( 1, "ChooseCardToDiscard" )
Object():Register_Set(3,1)
else
MillCards( Object():Register_Player_Get(0), 1 )
end
</EFFECT>
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY layer="0" dont_ask="1" >
<TRIGGER value="ABILITY_RESOLVED">
return SelfTriggered() and Object():Register_Get(3) == 1
</TRIGGER>
<EFFECT>
Object():Register_Clear(3)
if ( Object():Register_Get(6) == 0 ) then
Object():Register_Set(4,1)
Object():Register_Set(5,1)
Object():Register_Player_Get(0):DrawCard()
Object():Register_Clear(4)
else
Object():Register_Clear(6)
Object():Register_Player_Get(0):Library_GetTop():PutInHand()
end
</EFFECT>
</TRIGGERED_ABILITY>
20 posts
• Page 1 of 2 • 1, 2
Return to Magic: The Gathering - Duels of the Planeswalkers
Who is online
Users browsing this forum: No registered users and 3 guests