name: Gorgonic
card_text: If this card is destroyed by battle and sent to the Graveyard: The ATK of the monster that destroyed it becomes 0. You can banish this card from your Graveyard, then target 1 Set Spell/Trap Card your opponent controls; that target cannot be activated this turn. Your opponent cannot activate the targeted card in response to this effect's activation.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--atk
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_ATKCHANGE)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e1:SetCode(EVENT_BATTLE_DESTROYED)
  	e1:SetCondition(s.condition)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetCost(aux.bfgcost)
  	e2:SetTarget(s.distg)
  	e2:SetOperation(s.disop)
  	c:RegisterEffect(e2)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_BATTLE) and e:GetHandler():GetReasonCard():IsRelateToBattle()
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local rc = e:GetHandler():GetReasonCard()
  	if rc:IsFaceup() and rc:IsRelateToBattle() then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_SET_ATTACK_FINAL)
  		e1:SetValue(0)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		rc:RegisterEffect(e1)
  	end
  end
  function s.distg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsControler(1 - tp) and chkc:IsLocation(LOCATION_SZONE) and chkc:IsFacedown()
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(Card.IsFacedown, tp, 0, LOCATION_SZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEDOWN)
  	local g = Duel.SelectTarget(tp, Card.IsFacedown, tp, 0, LOCATION_SZONE, 1, 1, nil)
  	Duel.SetChainLimit(s.limit(g:GetFirst()))
  end
  function s.limit(c)
  	return function(e, lp, tp)
  		return e:GetHandler() ~= c
  	end
  end
  function s.disop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsFacedown() and tc:IsRelateToEffect(e) then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_CANNOT_TRIGGER)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e1)
  	end
  end
  
  
source_text: Gorgonic
  If this card is destroyed by battle and sent to the Graveyard: The ATK of the monster that destroyed it becomes 0. You can banish this card from your Graveyard, then target 1 Set Spell/Trap Card your opponent controls; that target cannot be activated this turn. Your opponent cannot activate the targeted card in response to this effect's activation.
target_text: -- Gorgonic
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--atk
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_ATKCHANGE)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e1:SetCode(EVENT_BATTLE_DESTROYED)
  	e1:SetCondition(s.condition)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetCost(aux.bfgcost)
  	e2:SetTarget(s.distg)
  	e2:SetOperation(s.disop)
  	c:RegisterEffect(e2)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_BATTLE) and e:GetHandler():GetReasonCard():IsRelateToBattle()
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local rc = e:GetHandler():GetReasonCard()
  	if rc:IsFaceup() and rc:IsRelateToBattle() then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_SET_ATTACK_FINAL)
  		e1:SetValue(0)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		rc:RegisterEffect(e1)
  	end
  end
  function s.distg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsControler(1 - tp) and chkc:IsLocation(LOCATION_SZONE) and chkc:IsFacedown()
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(Card.IsFacedown, tp, 0, LOCATION_SZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEDOWN)
  	local g = Duel.SelectTarget(tp, Card.IsFacedown, tp, 0, LOCATION_SZONE, 1, 1, nil)
  	Duel.SetChainLimit(s.limit(g:GetFirst()))
  end
  function s.limit(c)
  	return function(e, lp, tp)
  		return e:GetHandler() ~= c
  	end
  end
  function s.disop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsFacedown() and tc:IsRelateToEffect(e) then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_CANNOT_TRIGGER)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e1)
  	end
  end
  
  