[DotP2013] Help with Cipher
Posted: 13 Mar 2013, 03:45
I need help again... for Cipher.
My code doesn't work for the cipher part:
My code doesn't work for the cipher part:
- Code: Select all
<SPELL_ABILITY dangerous="1" filter_zone="ZONE_IN_PLAY">
<TARGET_DEFINITION id="0">
local filter = Object():GetFilter()
filter:Clear()
filter:AddCardType( CARD_TYPE_CREATURE )
filter:SetControllersTeam( EffectController():GetTeam() )
filter:AddExtra( FILTER_EXTRA_FLIP_TEAM )
filter:SetHint( HINT_ENEMY_ONLY, EffectController() )
filter:SetZone( ZONE_IN_PLAY )
</TARGET_DEFINITION>
<TARGET_DETERMINATION>
return AtLeastOneTargetFromDefinition(0)
</TARGET_DETERMINATION>
<TARGET_DEFINITION id="1">
local filter = Object():GetFilter()
filter:Clear()
filter:AddCardType( CARD_TYPE_CREATURE )
filter:SetPlayer( EffectController() )
filter:SetZone( ZONE_IN_PLAY )
</TARGET_DEFINITION>
<PLAY_TIME_ACTION target_choosing="1">
EffectController():ChooseTarget( 0, "CARD_QUERY_CHOOSE_CREATURE_TO_TAPHOLD", EffectDC():Make_Targets(0) )
</PLAY_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
if (target ~= nil) then
target:TapAndHold()
end
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
if (Object():GetErstwhileZone() ~= ZONE_NOWHERE_YET) then
local filter = Object():LoadTargetDefinition(1)
if (filter:CountStopAt(1) == 1) then
EffectController():ChooseTargetWithFlags( 1, "CARD_QUERY_CHOOSE_CREATURE_TO_CIPHER", EffectDC():Make_Targets(1), QUERY_FLAG_CAN_BE_FINISHED_EARLY + QUERY_FLAG_CAN_BE_FINISHED_EARLY_FOR_AI_AS_WELL )
end
end
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local target = EffectDC():Get_Targets(1):Get_CardPtr(0)
if (target ~= nil) then
ObjectDC():Set_CardPtr(0, target)
ObjectDC():Protect_CardPtr(0)
Object():SetResolutionZone( ZONE_REMOVED_FROM_GAME )
end
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local target = ObjectDC():Get_CardPtr(0)
if (target ~= nil) then
Object():NailOnto(target)
end
</RESOLUTION_TIME_ACTION>
</SPELL_ABILITY>
<TRIGGERED_ABILITY internal="1" active_zone="ZONE_REMOVED_FROM_GAME">
<TRIGGER value="CREATURE_DEALS_COMBAT_DAMAGE_TO_PLAYER">
local target = ObjectDC():Get_CardPtr(0)
return (target ~= nil and target == TriggerObject())
</TRIGGER>
<RESOLUTION_TIME_ACTION>
local target = ObjectDC():Get_CardPtr(0)
if (target ~= nil) then
local player = target:GetController()
if (Object():CanBePlayed(player)) then
player:CopySpellWithNewTargets(Object())
end
end
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>