name: Meltiel,
card_text: Each time a Counter Trap Card is activated, immediately after it resolves, gain 1000 LP, and if you do, if "The Sanctuary in the Sky" is on the field, destroy 1 card your opponent controls.
external_ids: local CARD_ID_0 = 56433456 --The Sanctuary in the Sky
  
lua: local CARD_ID_0 = 56433456 --The Sanctuary in the Sky
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--recover&destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e1:SetCode(EVENT_CHAIN_SOLVED)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetOperation(s.drop)
  	c:RegisterEffect(e1)
  end
  function s.drop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not re:IsHasType(EFFECT_TYPE_ACTIVATE) or not re:IsActiveType(TYPE_COUNTER) or not c:IsLocation(LOCATION_MZONE) or c:IsFacedown() then
  		return
  	end
  	Duel.Recover(tp, 1000, REASON_EFFECT)
  	if not Duel.IsEnvironment(CARD_ID_0) then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectMatchingCard(tp, aux.TRUE, tp, 0, LOCATION_ONFIELD, 1, 1, nil)
  	Duel.Destroy(g, REASON_EFFECT)
  end
  
  
source_text: Meltiel,
  Each time a Counter Trap Card is activated, immediately after it resolves, gain 1000 LP, and if you do, if "The Sanctuary in the Sky" is on the field, destroy 1 card your opponent controls.
target_text: -- Meltiel,
  local CARD_ID_0 = 56433456 --The Sanctuary in the Sky
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--recover&destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e1:SetCode(EVENT_CHAIN_SOLVED)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetOperation(s.drop)
  	c:RegisterEffect(e1)
  end
  function s.drop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not re:IsHasType(EFFECT_TYPE_ACTIVATE) or not re:IsActiveType(TYPE_COUNTER) or not c:IsLocation(LOCATION_MZONE) or c:IsFacedown() then
  		return
  	end
  	Duel.Recover(tp, 1000, REASON_EFFECT)
  	if not Duel.IsEnvironment(CARD_ID_0) then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectMatchingCard(tp, aux.TRUE, tp, 0, LOCATION_ONFIELD, 1, 1, nil)
  	Duel.Destroy(g, REASON_EFFECT)
  end
  
  