Board index
Programs with AI or Rules Enforcement
Magic: The Gathering - Duels of the Planeswalkers
Programming Talk



DURATION block
Moderator: CCGHQ Admins
1 post
• Page 1 of 1
DURATION block
by braquio » 21 Aug 2014, 15:35
Hi brus!
Another programming question..
There is another values possibles to simple_duration tag in a DURATION block?
or only simple_duration="UntilEOT" and simple_duration="Forever"
I want to put a DURATION until end of combat phase
but i need do it in a simple_duration tag and not in a block like this:
The problem is that really u need the changes in creature's characteristics(MUST ATTACK and CANT ATTACK) expires at end of combat and not at end of turn.
My best approximation is this:
Another programming question..
There is another values possibles to simple_duration tag in a DURATION block?
or only simple_duration="UntilEOT" and simple_duration="Forever"
I want to put a DURATION until end of combat phase
but i need do it in a simple_duration tag and not in a block like this:
- Code: Select all
<DURATION>
return MTG():GetStep() == STEP_END_OF_COMBAT
</DURATION>
The problem is that really u need the changes in creature's characteristics(MUST ATTACK and CANT ATTACK) expires at end of combat and not at end of turn.
My best approximation is this:
- | Open
- Code: Select all
<?xml version='1.0'?>
<CARD_V2 ExportVersion="1">
<FILENAME text="GHOSTLY_PRISON_666275264" />
<CARDNAME text="GHOSTLY_PRISON" />
<TITLE>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Ghostly Prison]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Prison fantomale]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Prisión fantasmagórica]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Gespenstisches Gefängnis]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Prigione Spettrale]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[亡霊の牢獄]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Ghostly Prison]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Ghostly Prison]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Ghostly Prison]]></LOCALISED_TEXT>
</TITLE>
<MULTIVERSEID value="666275264" />
<ARTID value="666275264" />
<ARTIST name="Wayne England" />
<CASTING_COST cost="{2}{W}" />
<FLAVOURTEXT>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[“May the memory of our fallen heroes ensnare the violent hearts of lesser men.”—Great Threshold of Monserkat inscription]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[« Que la mémoire de nos héros tombés ensorcelle les cœurs violents des impurs. »—Inscription du Grand Seuil de Monserkat]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[“Que el recuerdo de nuestros héroes caídos atrape los corazones violentos de hombres menos valientes.”—Inscripción en el Gran Umbral de Monserkat]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[„Möge die Erinnerung an unsere gefallenen Helden die ungestümen Seelen niederer Männer bändigen.”—Inschrift der Großen Schwelle von Monserkat]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[“Possa il ricordo dei nostri eroi caduti intrappolare i cuori violenti degli uomini inferiori.”—Iscrizione sulla Grande Soglia di Monserkat]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[「死せる英雄たちの記憶が、小さき者の逸る心を虜にしますように。」 ――モンザーカットの大門口に刻まれた文句]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[“May the memory of our fallen heroes ensnare the violent hearts of lesser men.”—Great Threshold of Monserkat inscription]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[“May the memory of our fallen heroes ensnare the violent hearts of lesser men.”—Great Threshold of Monserkat inscription]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[“May the memory of our fallen heroes ensnare the violent hearts of lesser men.”—Great Threshold of Monserkat inscription]]></LOCALISED_TEXT>
</FLAVOURTEXT>
<TYPE metaname="Enchantment" />
<EXPANSION value="PC2" />
<RARITY metaname="U" />
-- Compruebo el chest por si otra prison u propaganda ya han saltado el trigger en el mismo combate
<TRIGGERED_ABILITY linked_ability_group="1">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Creatures can’t attack you unless their controller pays {2} for each creature he or she controls that’s attacking you.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Les créatures ne peuvent pas vous attaquer à moins que leur contrôleur ne paie {2} pour chaque créature qu’il contrôle qui vous attaque.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Las criaturas no pueden atacarte a menos que su controlador pague {2} por cada criatura que controla que te está atacando.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Kreaturen können dich nicht angreifen, falls ihr Beherrscher nicht für jede dich angreifende Kreatur, die er kontrolliert, {2} bezahlt.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Le creature non possono attaccarti a meno che il loro controllore non paghi {2} per ogni creatura che controlla che ti sta attaccando.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[クリーチャーは、それのコントローラーが、そのプレイヤーがコントロールするあなたを攻撃しているクリーチャー1体につき{2}を支払わないかぎり、あなたを攻撃できない。]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Creatures can’t attack you unless their controller pays {2} for each creature he or she controls that’s attacking you.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Creatures can’t attack you unless their controller pays {2} for each creature he or she controls that’s attacking you.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Creatures can’t attack you unless their controller pays {2} for each creature he or she controls that’s attacking you.]]></LOCALISED_TEXT>
<TRIGGER value="BEGINNING_OF_PLAYERS_STEP">
local player = TriggerPlayer()
local chest = EffectController():PlayerDataChest():Get_Chest(666)
if player:GetTeam() ~= EffectController():GetTeam() and EffectController():MyTurn() == false and
chest:Get_Int(0) == 0 and MTG():GetStep() == STEP_BEGIN_COMBAT then
chest:Set_Int(0,1)
local filter = ClearFilter()
filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
filter:Add( FE_CONTROLLER, OP_IS, player )
filter:SetZone( ZONE_BATTLEFIELD )
if filter:CountStopAt(1) == 1 then
return true
end
end
return false
</TRIGGER>
<RESOLUTION_TIME_ACTION>
local player = TriggerPlayer()
if player ~= nil then
local filter = ClearFilter()
filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
filter:Add( FE_CONTROLLER, OP_IS, player )
filter:SetZone( ZONE_BATTLEFIELD )
local creatures = filter:Count()
if creatures > 0 then
local filter = ClearFilter()
filter:SetZone( ZONE_BATTLEFIELD )
filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
local subfilter = filter:AddSubFilter_Or()
subfilter:Add( FE_CARD_NAME, OP_IS, EffectSource() )
subfilter:Add( FE_CARD_NAME, OP_IS, "PROPAGANDA")
local instances = filter:Count()
local min_cost = (2 * instances)
MTG():MessageAllPlayers(" minimum cost per creature is " .. min_cost )
LinkedDC():Set_Int(0, min_cost)
local max_creatures = 0
local total_cost = 0
for i = 1,(creatures) do
total_cost = i*min_cost
if player:CanPayManaCost("{"..total_cost.."}") then
max_creatures = max_creatures + 1
end
end
MTG():MessageAllPlayers(" max creatures that can attack is " .. max_creatures )
if max_creatures > 0 then
local filter = ClearFilter()
filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
filter:Add( FE_CONTROLLER, OP_IS, player )
filter:SetZone( ZONE_BATTLEFIELD )
player:SetItemCount( max_creatures )
for j = 0, max_creatures-1 do
player:SetItemPrompt (j, "CARD_QUERY_CHOOSE_CREATURE_YOU_CONTROL")
end
player:ChooseItems( EffectDC():Make_Targets(1), QUERY_FLAG_UP_TO )
end
end
end
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local player = TriggerPlayer()
if player ~= nil then
local total_cost = 0
local min_cost = LinkedDC():Get_Int(0)
if EffectDC():Get_Targets(1) ~= nil then
local num_targets = EffectDC():Get_Targets(1):Count()
if num_targets > 0 then
total_cost = num_targets*min_cost
end
end
if total_cost ~= 0 then
MTG():MessageAllPlayers("Paying {" .. total_cost .. "}")
player:PayManaCost("{" .. total_cost .. "}")
end
end
</RESOLUTION_TIME_ACTION>
<FILTER filter_id="3">
local player = TriggerPlayer()
local filter = ClearFilter()
filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
filter:Add( FE_CONTROLLER, OP_IS, player )
filter:SetZone( ZONE_BATTLEFIELD )
</FILTER>
<CONTINUOUS_ACTION layer="8" filter_id="3">
if EffectDC():Get_Targets(1) ~= nil then
local num_targets = EffectDC():Get_Targets(1):Count()
if num_targets > 0 then
local target = EffectDC():Get_Targets(1):Get_CardPtr(0)
for j=0,num_targets-1 do
target = EffectDC():Get_Targets(1):Get_CardPtr(j)
target:GetCurrentCharacteristics():Bool_Set( CHARACTERISTIC_CANT_ATTACK, 0 )
target:GetCurrentCharacteristics():Bool_Set( CHARACTERISTIC_MUST_ATTACK_EACH_TURN, 1 )
end
end
end
</CONTINUOUS_ACTION>
<FILTER filter_id="4">
local player = TriggerPlayer()
local filter = ClearFilter()
filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
filter:Add( FE_CONTROLLER, OP_IS, player )
filter:SetZone( ZONE_BATTLEFIELD )
if EffectDC():Get_Targets(1) ~= nil then
local num_targets = EffectDC():Get_Targets(1):Count()
if num_targets > 0 then
local target = EffectDC():Get_Targets(1):Get_CardPtr(0)
for j=0,num_targets-1 do
target = EffectDC():Get_Targets(1):Get_CardPtr(j)
filter:Add(FE_CARD_INSTANCE, OP_NOT, target)
end
end
end
</FILTER>
<CONTINUOUS_ACTION layer="8" filter_id="4">
if FilteredCard() ~= nil then
local characteristics = FilteredCard():GetCurrentCharacteristics()
characteristics:Bool_Set( CHARACTERISTIC_CANT_ATTACK, 1 )
characteristics:Bool_Set( CHARACTERISTIC_MUST_ATTACK_EACH_TURN, 0 )
end
</CONTINUOUS_ACTION>
<DURATION simple_duration="UntilEOT">
return MTG():GetStep() == STEP_END_OF_COMBAT or MTG():GetStep() == STEP_MAIN_2 or EffectSource() == nil
</DURATION>
</TRIGGERED_ABILITY>
-- Reinicio los filtros y el chest en el main del oponente
<TRIGGERED_ABILITY replacement_effect="1" linked_ability_group="1">
<TRIGGER value="BEGINNING_OF_PLAYERS_STEP" pre_trigger="1">
local player = TriggerPlayer()
if player:GetTeam() ~= EffectController():GetTeam() and
EffectController():MyTurn() == false and
MTG():GetStep() == STEP_MAIN_1 then
local filter = ClearFilter()
filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
filter:Add( FE_CONTROLLER, OP_IS, player )
filter:SetZone( ZONE_BATTLEFIELD )
if filter:CountStopAt(1) == 1 then
return true
end
end
return false
</TRIGGER>
<RESOLUTION_TIME_ACTION>
if EffectSource() ~= nil then
local chest = EffectController():PlayerDataChest():Get_Chest(666)
chest:Set_Int(0,0)
LinkedDC():Int_Clear(0)
end
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
-- Inicializo los filtros y el chest al entrar en juego
<TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_TRANSITION">
<TRIGGER value="ZONECHANGE_TRANSITION" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY" />
<RESOLUTION_TIME_ACTION>
if EffectSource() ~= nil then
local chest = EffectController():PlayerDataChest():Make_Chest(666)
chest:Set_Int(0,0)
end
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
-- Inicializo el chest al final del combate por si hay mas de un combate
<TRIGGERED_ABILITY replacement_effect="1">
<TRIGGER value="BEGINNING_OF_PLAYERS_STEP">
return MTG():GetStep() == STEP_END_OF_COMBAT and EffectController():MyTurn() == false
</TRIGGER>
<RESOLUTION_TIME_ACTION>
local chest = EffectController():PlayerDataChest():Get_Chest(666)
chest:Set_Int(0,0)
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<AI_BASE_SCORE score="600" zone="ZONE_BATTLEFIELD" />
</CARD_V2>
____________________________________________________________________________________________________________________________
Braquio Dotp2014 DLC
Alternative Sealed Campaigns for DotP 2014
Braquio Dotp2014 DLC
Alternative Sealed Campaigns for DotP 2014
1 post
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 6 guests