Re: Talk about new cards here
Posted: 24 Aug 2014, 05:22
by Blue Ghost
I've been trying to program Jeleva, Nephalia's Scourge. I got her ETB ability to work, but her attack trigger currently doesn't do anything. Can someone help pretty please?
- Jeleva, Nephalia's Scourge | Open
- Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
<FILENAME text="C_JELEVA_NEPHALIAS_SCOURGE_738028" />
<CARDNAME text="JELEVA_NEPHALIAS_SCOURGE" />
<TITLE>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Jeleva, Nephalia's Scourge]]></LOCALISED_TEXT>
</TITLE>
<MULTIVERSEID value="738028" />
<ARTID value="738028" />
<ARTIST name="Todd Lockwood" />
<CASTING_COST cost="{1}{U}{B}{R}" />
<SUPERTYPE metaname="Legendary" />
<TYPE metaname="Creature" />
<SUB_TYPE metaname="Vampire" />
<SUB_TYPE metaname="Wizard" />
<EXPANSION value="C13" />
<RARITY metaname="M" />
<POWER value="1" />
<TOUGHNESS value="3" />
<STATIC_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Flying]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Vol]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Vuela.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Fliegend]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Volare]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[飛行]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[비행]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Полет]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Voar]]></LOCALISED_TEXT>
<INTRINSIC characteristic="CHARACTERISTIC_FLYING" />
</STATIC_ABILITY>
<SPELL_ABILITY linked_ability_group="1">
<PLAY_TIME_ACTION>
-- Save the amount of mana available just before casting this card
LinkedDC():Set_Int( 0, EffectController():GetTotalMana() )
</PLAY_TIME_ACTION>
</SPELL_ABILITY>
<TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1" active_zone="ZONE_ANY"> <TRIGGER value="SPELL_PLAYED" simple_qualifier="self">
-- The previously saved amount minus the current amount of available mana gives the mana spent to cast this card
LinkedDC():Set_Int( 1, LinkedDC():Get_Int(0) - EffectController():GetTotalMana() )
return false
</TRIGGER>
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY linked_ability_group="1">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[When Jeleva, Nephalia's Scourge enters the battlefield, each player exiles the top X cards of his or her library, where X is the amount of mana spent to cast Jeleva.]]></LOCALISED_TEXT>
<TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD">
-- Save the value in a safe register
EffectDC():Set_Int( 0, LinkedDC():Get_Int(1) )
return true
</TRIGGER>
<RESOLUTION_TIME_ACTION>
EffectController():DisplayMessage( EffectDC():Get_Int(0) )
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local cards = EffectDC():Get_Int(0)
for i=0, MTG():GetNumberOfPlayers()-1 do
local player = MTG():GetNthPlayer(i)
if player ~= nil then
for i=0, cards-1 do
local top = player:Library_GetTop()
if top ~= nil then
if (top:GetCardType():Test(CARD_TYPE_SORCERY) or top:GetCardType():Test(CARD_TYPE_INSTANT)) then
local index = LinkedDC():Get_Int(0)
local linkedDC = LinkedDC():Get_Chest(1)
if linkedDC == nil then
linkedDC = LinkedDC():Make_Chest(1)
end
linkedDC:Set_CardPtr(index, top)
linkedDC:Protect_CardPtr(index)
LinkedDC():Int_Inc(0)
end
top:Exile()
end
end
end
end
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local linkedDC = LinkedDC():Get_Chest(1)
if EffectSource() ~= nil and linkedDC ~= nil then
local count = LinkedDC():Get_Int(0)
for i=0,count-1 do
local card = linkedDC:Get_CardPtr(i)
if card ~= nil then
card:NailOnto( EffectSource() )
end
end
end
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever Jeleva attacks, you may cast an instant or sorcery card exiled with it without paying its mana cost.]]></LOCALISED_TEXT>
<TRIGGER value="ATTACKING" simple_qualifier="self" />
<RESOLUTION_TIME_ACTION>
local linkedDC = LinkedDC():Get_Chest(1)
if linkedDC ~= nil then
local queryDC = EffectDC():Make_Chest(2)
queryDC:CopyFrom(linkedDC)
local count = LinkedDC():Get_Int(0)
for i = 0, count-1 do
local card = queryDC:Get_CardPtr(i)
if card == nil or EffectController():CanCastSpellForFree(card) == false then
queryDC:QueryUnselect_CardPtr(i)
end
end
EffectController():ChooseItemFromDC( "CARD_QUERY_CHOOSE_SPELL_TO_CAST", queryDC, EffectDC():Make_Targets(0), QUERY_FLAG_MAY )
end
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local target = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
if target ~= nil and EffectController():CanCastSpellForFree(target) then
EffectController():CastSpellForFree(target)
end
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<HELP title="MORE_INFO_BADGE_TITLE_10" body="MORE_INFO_BADGE_BODY_10" zone="ZONE_ANY" />
<SFX text="COMBAT_PLASMA_LARGE_ATTACK" power_boundary_min="4" power_boundary_max="-1" />
<SFX text="COMBAT_PLASMA_SMALL_ATTACK" power_boundary_min="1" power_boundary_max="3" />
<AI_BASE_SCORE score="600" zone="ZONE_HAND" />
<AI_BASE_SCORE score="150" zone="ZONE_BATTLEFIELD" />
</CARD_V2>