Board index Programs with AI or Rules Enforcement Magic: The Gathering - Duels of the Planeswalkers Programming Talk
Sneak attack
Moderator: CCGHQ Admins
Sneak attack
by Scion of Darkness » 27 Aug 2012, 13:44
Hello i'm new to this forum and after some reading decided to make a sneak a show legacy deck but im having some problems with the sneak attack i'm using a merge between the quicksilver code and the slave of bolas but its not working
- Code: Select all
<ACTIVATED_ABILITY filter_zone="ZONE_IN_PLAY">
<COST type="Mana" cost="{R}" />
<TARGET_DEFINITION id="0">local filter = Object():GetFilter() filter:Clear() filter:AddCardType( CARD_TYPE_CREATURE ) filter:SetPlayer( EffectController() ) filter:SetZone( ZONE_HAND ) filter:SetHint( HINT_ALLIED_ONLY, EffectController() ) filter:NotTargetted()</TARGET_DEFINITION>
<TARGET_DETERMINATION>return AtLeastOneTargetFromDefinition(0)</TARGET_DETERMINATION>
<PLAY_TIME_ACTION target_choosing="1">EffectController():ChooseTarget( 0, "CARD_QUERY_CHOOSE_CREATURE_TO_GAIN_CONTROL", EffectDC():Make_Targets(0) )</PLAY_TIME_ACTION>
<CONTINUOUS_ACTION layer="2">local target = EffectDC():Get_Targets(0):Get_CardPtr(0) if target ~= nil then target:SetController( EffectController() ) end</CONTINUOUS_ACTION>
<RESOLUTION_TIME_ACTION>local target = EffectDC():Get_Targets(0):Get_CardPtr(0) if target ~= nil then target:Untap() end</RESOLUTION_TIME_ACTION>
<CONTINUOUS_ACTION layer="6">local target = EffectDC():Get_Targets(0):Get_CardPtr(0) if target ~= nil then local characteristics = target:GetCurrentCharacteristics() characteristics:Characteristic_Set( CHARACTERISTIC_WORTHLESS, 1 ) end</CONTINUOUS_ACTION>
<CONTINUOUS_ACTION layer="6">local target = EffectDC():Get_Targets(0):Get_CardPtr(0) if target ~= nil then local characteristics = target:GetCurrentCharacteristics() characteristics:Characteristic_Set( CHARACTERISTIC_HASTE, 1 ) end</CONTINUOUS_ACTION>
<RESOLUTION_TIME_ACTION>local delayDC = EffectDC():Make_Chest(1) delayDC:Set_CardPtr(0, EffectDC():Get_Targets(0):Get_CardPtr(0)) MTG():CreateDelayedTrigger(1, delayDC)</RESOLUTION_TIME_ACTION>
<DURATION simple_duration="UntilEOT" />
</ACTIVATED_ABILITY>
- <TRIGGERED_ABILITY resource_id="1" dangerous="1">
<TRIGGER value="BEGINNING_OF_STEP" simple_qualifier="controller">return ( MTG():GetStep() == STEP_END_OF_TURN )</TRIGGER>
<CLEANUP fire_once="1" />
<RESOLUTION_TIME_ACTION>local target = EffectDC():Get_CardPtr(0) if target ~= nil then target:Sacrifice(EffectController()) end</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
-
Scion of Darkness - Posts: 235
- Joined: 27 Aug 2012, 13:14
- Has thanked: 17 times
- Been thanked: 23 times
Re: Sneak attack
by Aiodren » 27 Aug 2012, 16:38
The problem with your code is simply that you choose the target but then don't put it into play. You just set the controller to yourself, so instead of
- Code: Select all
<CONTINUOUS_ACTION layer="2">
local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
if target ~= nil then
target:SetController( EffectController() )
end
</CONTINUOUS_ACTION>
- Code: Select all
<RESOLUTION_TIME_ACTION>
local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
if target ~= nil then
target:PutIntoPlay( EffectController() )
end
</RESOLUTION_TIME_ACTION>
Re: Sneak attack
by Scion of Darkness » 28 Aug 2012, 10:22
I've made the change, it was my fault hehehe forgot to copy that, after that the card comes into play but don't gain haste and stays in play in the end of turn =/ i dont have no clue
This it the card code
This it the card code
- Code: Select all
<CARD_V2>
<FILENAME text="SNEAK_ATTACK_5594" />
<CARDNAME text="SNEAK_ATTACK" />
<TITLE>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Sneak Attack]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Sneak Attack]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Sneak Attack]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Sneak Attack]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Sneak Attack]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Sneak Attack]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Sneak Attack]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Sneak Attack]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Sneak Attack]]></LOCALISED_TEXT>
</TITLE>
<ARTID value="SNEAK_ATTACK_5594" />
<ARTIST name="Jerry Tiritilli" />
<TYPE metaname="Enchantment" />
<CASTING_COST cost="{3}{R}" />
<MULTIVERSEID value="5594" />
<EXPANSION value="DPE" />
<RARITY metaname="R" />
<FLAVOURTEXT>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA["Nothin' beat surprise—'cept rock."]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA["Nothin' beat surprise—'cept rock."]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA["Nothin' beat surprise—'cept rock."]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA["Nothin' beat surprise—'cept rock."]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA["Nothin' beat surprise—'cept rock."]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA["Nothin' beat surprise—'cept rock."]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA["Nothin' beat surprise—'cept rock."]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA["Nothin' beat surprise—'cept rock."]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA["Nothin' beat surprise—'cept rock."]]></LOCALISED_TEXT>
</FLAVOURTEXT>
<ACTIVATED_ABILITY dangerous="1" filter_zone="ZONE_IN_PLAY">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{R}: You may put a creature card from your hand onto the battlefield. That creature gains haste. Sacrifice the creature at the beginning of the next end step.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[{R}: You may put a creature card from your hand onto the battlefield. That creature gains haste. Sacrifice the creature at the beginning of the next end step.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[{R}: You may put a creature card from your hand onto the battlefield. That creature gains haste. Sacrifice the creature at the beginning of the next end step.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[{R}: You may put a creature card from your hand onto the battlefield. That creature gains haste. Sacrifice the creature at the beginning of the next end step.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[{R}: You may put a creature card from your hand onto the battlefield. That creature gains haste. Sacrifice the creature at the beginning of the next end step.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[{R}: You may put a creature card from your hand onto the battlefield. That creature gains haste. Sacrifice the creature at the beginning of the next end step.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[{R}: You may put a creature card from your hand onto the battlefield. That creature gains haste. Sacrifice the creature at the beginning of the next end step.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[{R}: You may put a creature card from your hand onto the battlefield. That creature gains haste. Sacrifice the creature at the beginning of the next end step.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[{R}: You may put a creature card from your hand onto the battlefield. That creature gains haste. Sacrifice the creature at the beginning of the next end step.]]></LOCALISED_TEXT>
<COST type="Mana" cost="{R}" />
<TARGET_DEFINITION id="0">local filter = Object():GetFilter() filter:Clear() filter:AddCardType( CARD_TYPE_CREATURE ) filter:SetPlayer( EffectController() ) filter:SetZone( ZONE_HAND ) filter:SetHint( HINT_ALLIED_ONLY, EffectController() ) filter:NotTargetted()</TARGET_DEFINITION>
<TARGET_DETERMINATION>return AtLeastOneTargetFromDefinition(0)</TARGET_DETERMINATION>
<PLAY_TIME_ACTION target_choosing="1">EffectController():ChooseTarget( 0, "CARD_QUERY_CHOOSE_CREATURE_TO_GAIN_CONTROL", EffectDC():Make_Targets(0) )</PLAY_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
if target ~= nil then
target:PutIntoPlay( EffectController() )
end
</RESOLUTION_TIME_ACTION>
<CONTINUOUS_ACTION layer="6">local target = EffectDC():Get_Targets(0):Get_CardPtr(0) if target ~= nil then local characteristics = target:GetCurrentCharacteristics() characteristics:Characteristic_Set( CHARACTERISTIC_WORTHLESS, 1 ) end</CONTINUOUS_ACTION>
<CONTINUOUS_ACTION layer="6">local target = EffectDC():Get_Targets(0):Get_CardPtr(0) if target ~= nil then local characteristics = target:GetCurrentCharacteristics() characteristics:Characteristic_Set( CHARACTERISTIC_HASTE, 1 ) end</CONTINUOUS_ACTION>
<RESOLUTION_TIME_ACTION>local delayDC = EffectDC():Make_Chest(1) delayDC:Set_CardPtr(0, EffectDC():Get_Targets(0):Get_CardPtr(0)) MTG():CreateDelayedTrigger(1, delayDC)</RESOLUTION_TIME_ACTION>
<DURATION simple_duration="UntilEOT" />
</ACTIVATED_ABILITY>
- <TRIGGERED_ABILITY resource_id="1" dangerous="1">
<TRIGGER value="BEGINNING_OF_STEP" simple_qualifier="controller">return ( MTG():GetStep() == STEP_END_OF_TURN )</TRIGGER>
<CLEANUP fire_once="1" />
<RESOLUTION_TIME_ACTION>local target = EffectDC():Get_CardPtr(0) if target ~= nil then target:Sacrifice(EffectController()) end</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
-
Scion of Darkness - Posts: 235
- Joined: 27 Aug 2012, 13:14
- Has thanked: 17 times
- Been thanked: 23 times
Re: Sneak attack
by thefiremind » 28 Aug 2012, 11:16
Not exactly, but you were really close. When a card changes zone, all the card pointers pointing to that card are deleted, unless you "protect" them (every "protect" saves the pointer for 1 zone change).Scion of Darkness wrote:could it be that making a resolution time action before the continuos ones it clears the filter and blow the end of the code?
Try to use this resolution time action:
- Code: Select all
<RESOLUTION_TIME_ACTION>
local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
if target ~= nil then
EffectDC():Get_Targets(0):Protect_CardPtr(0)
target:PutIntoPlay( EffectController() )
end
</RESOLUTION_TIME_ACTION>
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 721 times
Re: Sneak attack
by Scion of Darkness » 28 Aug 2012, 12:37
Thanks firemind u'r a life saver, and thanks for ur hard work as my future deck couldn't be made without many of your cards when i finish the deck i'll put here for everybody
-
Scion of Darkness - Posts: 235
- Joined: 27 Aug 2012, 13:14
- Has thanked: 17 times
- Been thanked: 23 times
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 5 guests