LinkedDC cannot pass data from a trigger to a spell?
Posted: 09 Oct 2016, 03:33
I want to create a new type of ability called "overspell" which consists in 2 effects:
1. If this card is in your hand, whenever you cast a sorcery or instant, it gains a overspell point.
2. when you cast this spell, it will have extra effect according to it's overspell point number.
For example, I made a card "Insight":
1. If this card is in your hand, whenever you cast a sorcery or instant, it gains a overspell point.
2. when you cast this spell, it will have extra effect according to it's overspell point number.
For example, I made a card "Insight":
- Code: Select all
<SPELL_ABILITY linked_ability_group="0">
<LOCALISED_TEXT LanguageCode="en-US">Draw a card.</LOCALISED_TEXT>
<RESOLUTION_TIME_ACTION>
if EffectSource() ~= nil then
local n = LinkedDC():Get_Int("overspell")
EffectController():DrawCards(1+n)
LinkedDC():Set_Int("overspell",0)
end
</RESOLUTION_TIME_ACTION>
</SPELL_ABILITY>
<TRIGGERED_ABILITY active_zone="ZONE_ANY" replacement_effect="1" linked_ability_group="0">
<LOCALISED_TEXT LanguageCode="en-US">Overspell:</LOCALISED_TEXT>
<TRIGGER value="SPELL_PLAYED" simple_qualifier="controller">
return (TriggerObject():GetCardType():Test(CARD_TYPE_SORCERY) or TriggerObject():GetCardType():Test(CARD_TYPE_INSTANT)) and (TriggerObject() ~= EffectSource())
</TRIGGER>
<RESOLUTION_TIME_ACTION>
if EffectSource() ~= nil then
if LinkedDC():Get_Int("overspell") == nil then
LinkedDC():Set_Int("overspell",0)
end
local ovsp = LinkedDC():Get_Int("overspell")
LinkedDC():Set_Int("overspell", ovsp+1)
end
</RESOLUTION_TIME_ACTION>
<DERIVED_INFO tag="DERIVED_INFO_X_OVSP_ON_THIS_CARD">
return LinkedDC():Get_Int("overspell")
</DERIVED_INFO>
</TRIGGERED_ABILITY>
<QUERYTEXT tag="DERIVED_INFO_X_OVSP_ON_THIS_CARD">
<LOCALISED_TEXT LanguageCode="en-US">draw %d card(s) more</LOCALISED_TEXT>
</QUERYTEXT>