Board index Programs with AI or Rules Enforcement Magic: The Gathering - Duels of the Planeswalkers Programming Talk
Simic Charm
Moderator: CCGHQ Admins
Simic Charm
by Aiodren » 08 Feb 2013, 11:26
Hi Guys!
I'm assembling a Simic Deck with the new Gatecrash Cards right now (special thanks to firemind for Master Biomancer and the */* Ooze ) but i just can't get Simic Charm to work properly. The second and third modes work fine but the +3/+3 pump does absolutely nothing and i have no idea why. Maybe you guys see the problem, here is the code i came up with:
I'm assembling a Simic Deck with the new Gatecrash Cards right now (special thanks to firemind for Master Biomancer and the */* Ooze ) but i just can't get Simic Charm to work properly. The second and third modes work fine but the +3/+3 pump does absolutely nothing and i have no idea why. Maybe you guys see the problem, here is the code i came up with:
- Code: Select all
<?xml version='1.0'?>
<CARD_V2>
<FILENAME text="SIMIC_CHARM_GTC_009" />
<CARDNAME text="SIMIC_CHARM" />
<TITLE>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Simic Charm]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Simic Charm]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Simic Charm]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Simic Charm]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Simic Charm]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Simic Charm]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Simic Charm]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Simic Charm]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Simic Charm]]></LOCALISED_TEXT>
</TITLE>
<MULTIVERSEID value="GTC_009" />
<ARTID value="SIMIC CHARM" />
<ARTIST name="Zoltan Boros" />
<CASTING_COST cost="{G}{U}" />
<FLAVOURTEXT>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[“We measure our progress in heartbeats.”
—Prime Speaker Zegana]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[“We measure our progress in heartbeats.”
—Prime Speaker Zegana]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[“We measure our progress in heartbeats.”
—Prime Speaker Zegana]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[“We measure our progress in heartbeats.”
—Prime Speaker Zegana]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[“We measure our progress in heartbeats.”
—Prime Speaker Zegana]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[“We measure our progress in heartbeats.”
—Prime Speaker Zegana]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[“We measure our progress in heartbeats.”
—Prime Speaker Zegana]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[“We measure our progress in heartbeats.”
—Prime Speaker Zegana]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[“We measure our progress in heartbeats.”
—Prime Speaker Zegana]]></LOCALISED_TEXT>
</FLAVOURTEXT>
<TYPE metaname="Instant" />
<EXPANSION value="DPG" />
<RARITY metaname="U" />
<SPELL_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Choose one — Target creature gets +3/+3 until end of turn; or permanents you control gain hexproof until end of turn; or return target creature to its owner’s hand.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Choose one — Target creature gets +3/+3 until end of turn; or permanents you control gain hexproof until end of turn; or return target creature to its owner’s hand.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Choose one — Target creature gets +3/+3 until end of turn; or permanents you control gain hexproof until end of turn; or return target creature to its owner’s hand.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Choose one — Target creature gets +3/+3 until end of turn; or permanents you control gain hexproof until end of turn; or return target creature to its owner’s hand.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Choose one — Target creature gets +3/+3 until end of turn; or permanents you control gain hexproof until end of turn; or return target creature to its owner’s hand.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Choose one — Target creature gets +3/+3 until end of turn; or permanents you control gain hexproof until end of turn; or return target creature to its owner’s hand.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Choose one — Target creature gets +3/+3 until end of turn; or permanents you control gain hexproof until end of turn; or return target creature to its owner’s hand.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Choose one — Target creature gets +3/+3 until end of turn; or permanents you control gain hexproof until end of turn; or return target creature to its owner’s hand.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Choose one — Target creature gets +3/+3 until end of turn; or permanents you control gain hexproof until end of turn; or return target creature to its owner’s hand.]]></LOCALISED_TEXT>
<TARGET_DEFINITION id="0">
local filter = Object():GetFilter()
filter:Clear()
filter:AddCardType( CARD_TYPE_CREATURE )
filter:SetZone( ZONE_IN_PLAY )
filter:SetHint( HINT_ENEMY_ONLY, EffectController() )
</TARGET_DEFINITION>
<PLAY_TIME_ACTION>
local player = EffectController()
if player ~= nil then
player:BeginNewMultipleChoice()
player:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_PERMANENTS_GAIN_HEXPROOF" )
if AtLeastOneTargetFromDefinition(0) == 1 then
player:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_CREATURE_GAINS_3_3" )
player:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_RETURN_CREATURE_TO_HAND" )
end
player:AskMultipleChoiceQuestion( "CARD_QUERY_MC_CHOOSE_MODE" )
end
</PLAY_TIME_ACTION>
<PLAY_TIME_ACTION target_choosing="1">
local decision = Object():GetMultipleChoiceResult()
EffectDC():Set_Int(1, decision)
if decision == 1 then
EffectController():ChooseTarget( 0, "CARD_QUERY_CHOOSE_CREATURE_TO_GAIN_3_3", EffectDC():Make_Targets(3) )
end
if decision == 2 then
EffectController():ChooseTarget( 0, "CARD_QUERY_CHOOSE_CREATURE_TO_PUT_INTO_HAND", EffectDC():Make_Targets(0) )
end
</PLAY_TIME_ACTION>
<RESOLUTION_TIME_ACTION ignore_filter="1">
local target = nil
local decision = EffectDC():Get_Int(1)
if EffectDC():Get_Targets(0) ~= nil then
target = EffectDC():Get_Targets(0):Get_CardPtr(0)
end
if target ~= nil then
if decision == 2 then
target:PutInHand()
end
end
</RESOLUTION_TIME_ACTION>
<CONTINUOUS_ACTION ignore_filter="1" layer="7C">
local target = EffectDC():Get_Targets(3):Get_CardPtr(0)
if target ~= nil then
local characteristics = target:GetCurrentCharacteristics()
characteristics:Power_Add( 3 )
characteristics:Toughness_Add( 3 )
end
</CONTINUOUS_ACTION>
<FILTER>
local decision = EffectDC():Get_Int(1)
if decision == 0 then
return PermanentsYouControl()
end
return false
</FILTER>
<CONTINUOUS_ACTION layer="6">
if FilteredCard() ~= nil and EffectDC():Get_Int(1) == 0 then
local characteristics = FilteredCard():GetCurrentCharacteristics()
if characteristics ~= nil then
characteristics:Characteristic_Set( CHARACTERISTIC_HEXPROOF, 1 )
end
end
</CONTINUOUS_ACTION>
<DURATION simple_duration="UntilEOT" />
</SPELL_ABILITY>
<HELP title="MORE_INFO_BADGE_TITLE_21" body="MORE_INFO_BADGE_BODY_21" zone="ZONE_ANY" />
</CARD_V2>
Re: Simic Charm
by thefiremind » 08 Feb 2013, 12:19
I see 2 problems here.
The first (unrelated to what doesn't work) is that you are using the same target definition for both +3/+3 and return to owner's hand, but that definition has HINT_ENEMY_ONLY. This means that the AI will play it only on enemies, and +3/+3 on enemies isn't exactly how you would use the card. I'd make a target definition with HINT_ALLIED_ONLY for +3/+3, and one with HINT_NEUTRAL for the return to owner's hand (you could need to save one of your creatures from removal with that). The multiple choice would become overly complicated with the system of totally removing the options with no available targets, but the latest deck pack showed us a new way to code modal cards:
The second problem is something I didn't know until I tried myself with Grixis Charm. You can't use ignore_filter on continuous actions (and you can't properly get your decision from Object():GetMultipleChoiceResult() on resolution time when you have a <FILTER> block, but you already took care of this). The trick I invented is to use the <FILTER> block for both continuous actions, making it point to the targetted creature when needed. This is my filter for Grixis Charm:
The first (unrelated to what doesn't work) is that you are using the same target definition for both +3/+3 and return to owner's hand, but that definition has HINT_ENEMY_ONLY. This means that the AI will play it only on enemies, and +3/+3 on enemies isn't exactly how you would use the card. I'd make a target definition with HINT_ALLIED_ONLY for +3/+3, and one with HINT_NEUTRAL for the return to owner's hand (you could need to save one of your creatures from removal with that). The multiple choice would become overly complicated with the system of totally removing the options with no available targets, but the latest deck pack showed us a new way to code modal cards:
- player:AddMultipleChoiceAnswer("STRING") adds the option normally.
- player:AddMultipleChoiceAnswer("STRING", false) adds the option greyed out (unselectable).
The second problem is something I didn't know until I tried myself with Grixis Charm. You can't use ignore_filter on continuous actions (and you can't properly get your decision from Object():GetMultipleChoiceResult() on resolution time when you have a <FILTER> block, but you already took care of this). The trick I invented is to use the <FILTER> block for both continuous actions, making it point to the targetted creature when needed. This is my filter for Grixis Charm:
- Code: Select all
<FILTER>
local decision = EffectDC():Get_Int(2)
if decision == 1 then
local target_creature = EffectDC():Get_Targets(1) and EffectDC():Get_Targets(1):Get_CardPtr(0)
return FilteredCard() ~= nil and FilteredCard() == target_creature
elseif decision == 2 then
return CreaturesYouControl()
end
return false
</FILTER>
< 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: Simic Charm
by Aiodren » 08 Feb 2013, 13:11
Thank you very much firemind! With the code of your Grixis Charm i was able to make it work! Well the two Charms have nearly the same modes, so i just had to copy paste and tweak the numbers^^ I still don't really understand why the filter-block messes so much with the rest of the blocks but if it works this way i'll simply accept it
Here's the working code for everyone who wants to use it:
Here's the working code for everyone who wants to use it:
- Code: Select all
<?xml version='1.0'?>
<CARD_V2>
<FILENAME text="SIMIC_CHARM_GTC_009" />
<CARDNAME text="SIMIC_CHARM" />
<TITLE>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Simic Charm]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Simic Charm]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Simic Charm]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Simic Charm]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Simic Charm]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Simic Charm]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Simic Charm]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Simic Charm]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Simic Charm]]></LOCALISED_TEXT>
</TITLE>
<MULTIVERSEID value="GTC_009" />
<ARTID value="SIMIC CHARM" />
<ARTIST name="Zoltan Boros" />
<CASTING_COST cost="{G}{U}" />
<FLAVOURTEXT>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[“We measure our progress in heartbeats.”
—Prime Speaker Zegana]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[“We measure our progress in heartbeats.”
—Prime Speaker Zegana]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[“We measure our progress in heartbeats.”
—Prime Speaker Zegana]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[“We measure our progress in heartbeats.”
—Prime Speaker Zegana]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[“We measure our progress in heartbeats.”
—Prime Speaker Zegana]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[“We measure our progress in heartbeats.”
—Prime Speaker Zegana]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[“We measure our progress in heartbeats.”
—Prime Speaker Zegana]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[“We measure our progress in heartbeats.”
—Prime Speaker Zegana]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[“We measure our progress in heartbeats.”
—Prime Speaker Zegana]]></LOCALISED_TEXT>
</FLAVOURTEXT>
<TYPE metaname="Instant" />
<EXPANSION value="DPG" />
<RARITY metaname="U" />
<SPELL_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Choose one — Target creature gets +3/+3 until end of turn; or permanents you control gain hexproof until end of turn; or return target creature to its owner’s hand.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Choose one — Target creature gets +3/+3 until end of turn; or permanents you control gain hexproof until end of turn; or return target creature to its owner’s hand.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Choose one — Target creature gets +3/+3 until end of turn; or permanents you control gain hexproof until end of turn; or return target creature to its owner’s hand.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Choose one — Target creature gets +3/+3 until end of turn; or permanents you control gain hexproof until end of turn; or return target creature to its owner’s hand.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Choose one — Target creature gets +3/+3 until end of turn; or permanents you control gain hexproof until end of turn; or return target creature to its owner’s hand.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Choose one — Target creature gets +3/+3 until end of turn; or permanents you control gain hexproof until end of turn; or return target creature to its owner’s hand.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Choose one — Target creature gets +3/+3 until end of turn; or permanents you control gain hexproof until end of turn; or return target creature to its owner’s hand.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Choose one — Target creature gets +3/+3 until end of turn; or permanents you control gain hexproof until end of turn; or return target creature to its owner’s hand.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Choose one — Target creature gets +3/+3 until end of turn; or permanents you control gain hexproof until end of turn; or return target creature to its owner’s hand.]]></LOCALISED_TEXT>
<PLAY_TIME_ACTION>
local player = EffectController()
if player ~= nil then
local has_first = AtLeastOneTargetFromDefinition(0)
local has_second = AtLeastOneTargetFromDefinition(1)
player:BeginNewMultipleChoice()
if has_first == 1 then
player:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_CREATURE_GAINS_3_3" )
else
player:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_CREATURE_GAINS_3_3", false )
end
player:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_PERMANENTS_GAIN_HEXPROOF" )
if has_second == 1 then
player:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_RETURN_CREATURE_TO_HAND" )
else
player:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_RETURN_CREATURE_TO_HAND", false )
end
player:AskMultipleChoiceQuestion( "CARD_QUERY_MC_CHOOSE_MODE" )
end
</PLAY_TIME_ACTION>
<PLAY_TIME_ACTION>
EffectDC():Set_Int( 2, Object():GetMultipleChoiceResult() )
</PLAY_TIME_ACTION>
<TARGET_DEFINITION id="0">
local filter = Object():GetFilter()
filter:Clear()
filter:AddCardType( CARD_TYPE_CREATURE )
filter:SetZone( ZONE_IN_PLAY )
filter:SetHint( HINT_ALLIED_ONLY, EffectController() )
</TARGET_DEFINITION>
<TARGET_DEFINITION id="1">
local filter = Object():GetFilter()
filter:Clear()
filter:AddCardType( CARD_TYPE_CREATURE )
filter:SetZone( ZONE_IN_PLAY )
filter:SetHint( HINT_NEUTRAL, EffectController() )
</TARGET_DEFINITION>
<TARGET_DETERMINATION>
return 1
</TARGET_DETERMINATION>
<PLAY_TIME_ACTION>
if EffectDC():Get_Int(2) == 2 then
EffectController():ChooseTarget( 1, "CARD_QUERY_CHOOSE_PERMANENT_TO_PUT_INTO_HAND", EffectDC():Make_Targets(0) )
end
</PLAY_TIME_ACTION>
<PLAY_TIME_ACTION>
if EffectDC():Get_Int(2) == 0 then
EffectController():ChooseTarget( 0, "CARD_QUERY_CHOOSE_CREATURE_TO_GAIN_3_3", EffectDC():Make_Targets(1) )
end
</PLAY_TIME_ACTION>
<RESOLUTION_TIME_ACTION ignore_filter="1">
local decision = EffectDC():Get_Int(2)
if decision == 2 then
local target = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
if target ~= nil then
target:PutInHand()
end
end
</RESOLUTION_TIME_ACTION>
<FILTER>
local decision = EffectDC():Get_Int(2)
if decision == 0 then
local target_creature = EffectDC():Get_Targets(1) and EffectDC():Get_Targets(1):Get_CardPtr(0)
return FilteredCard() ~= nil and FilteredCard() == target_creature
elseif decision == 1 then
return PermanentsYouControl()
end
return false
</FILTER>
<CONTINUOUS_ACTION layer="7C">
if FilteredCard() ~= nil and EffectDC():Get_Int(2) == 0 then
local characteristics = FilteredCard():GetCurrentCharacteristics()
characteristics:Power_Add( 3 )
characteristics:Toughness_Add( 3 )
end
</CONTINUOUS_ACTION>
<CONTINUOUS_ACTION layer="6">
if FilteredCard() ~= nil and EffectDC():Get_Int(2) == 1 then
FilteredCard():GetCurrentCharacteristics():Characteristic_Set( CHARACTERISTIC_HEXPROOF, 1 )
end
</CONTINUOUS_ACTION>
<DURATION simple_duration="UntilEOT" />
</SPELL_ABILITY>
<AI_AVAILABILITY type="in_response" />
<AI_AVAILABILITY step="begin_combat" turn="their_turn" />
<AI_AVAILABILITY step="main_1" turn="my_turn" />
<AI_AVAILABILITY step="declare_attackers" turn="their_turn" />
<AI_AVAILABILITY step="declare_blockers" />
<AI_AVAILABILITY step="end_of_turn" />
<AI_BASE_SCORE score="1200" zone="ZONE_HAND" />
</CARD_V2>
Last edited by Aiodren on 09 Feb 2013, 07:18, edited 2 times in total.
Re: Simic Charm
by thefiremind » 08 Feb 2013, 14:53
The card is OK but you are using the target definitions in the wrong modes: you should switch id="0" <--> id="1" in the definitions, or ChooseTarget( 0, ... <--> ChooseTarget( 1, ...
< 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
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 39 guests