name: Predaplant
card_text: 2 Effect Monsters
  You can target 1 face-up monster on the field; it becomes DARK until the end of this turn. You can pay 2000 LP and send 1 "Fusion" or "Polymerization" Normal or Quick-Play Spell from your Deck to the GY; this effect becomes that Spell's effect when that card is activated, also, you cannot Special Summon monsters for the rest of this turn. You can only use each effect of "Predaplant Verte Anaconda" once per turn.
external_ids: local SETCARD_ID_0 = 0x46 --Polymerization/Fusion
  
lua: local SETCARD_ID_0 = 0x46 --Polymerization/Fusion
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	c:EnableReviveLimit()
  	aux.AddLinkProcedure(c, aux.FilterBoolFunction(Card.IsLinkType, TYPE_EFFECT), 2, 2)
  	--change attribute
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetTarget(s.atttg)
  	e1:SetOperation(s.attop)
  	c:RegisterEffect(e1)
  	--copy
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCost(s.cpcost)
  	e2:SetTarget(s.cptg)
  	e2:SetOperation(s.cpop)
  	c:RegisterEffect(e2)
  end
  function s.attfilter(c)
  	return c:IsFaceup() and not c:IsAttribute(ATTRIBUTE_DARK)
  end
  function s.atttg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and s.attfilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.attfilter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  	Duel.SelectTarget(tp, s.attfilter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, nil)
  end
  function s.attop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsFaceup() and tc:IsRelateToEffect(e) then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_CHANGE_ATTRIBUTE)
  		e1:SetValue(ATTRIBUTE_DARK)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e1)
  	end
  end
  function s.cpfilter(c)
  	return (c:GetType() == TYPE_SPELL or c:IsType(TYPE_QUICKPLAY)) and c:IsSetCard(SETCARD_ID_0) and c:IsAbleToGraveAsCost() and c:CheckActivateEffect(true, true, false) ~= nil
  end
  function s.cpcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	e:SetLabel(1)
  	if chk == 0 then
  		return true
  	end
  end
  function s.cptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		if e:GetLabel() == 0 then
  			return false
  		end
  		e:SetLabel(0)
  		return Duel.CheckLPCost(tp, 2000) and Duel.IsExistingMatchingCard(s.cpfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	e:SetLabel(0)
  	Duel.PayLPCost(tp, 2000)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.cpfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	local te, ceg, cep, cev, cre, cr, crp = g:GetFirst():CheckActivateEffect(true, true, true)
  	Duel.SendtoGrave(g, REASON_COST)
  	e:SetProperty(te:GetProperty())
  	local tg = te:GetTarget()
  	if tg then
  		tg(e, tp, ceg, cep, cev, cre, cr, crp, 1)
  	end
  	te:SetLabelObject(e:GetLabelObject())
  	e:SetLabelObject(te)
  	Duel.ClearOperationInfo(0)
  end
  function s.cpop(e, tp, eg, ep, ev, re, r, rp)
  	local te = e:GetLabelObject()
  	if te then
  		e:SetLabelObject(te:GetLabelObject())
  		local op = te:GetOperation()
  		if op then
  			op(e, tp, eg, ep, ev, re, r, rp)
  		end
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetTargetRange(1, 0)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  
  
source_text: Predaplant
  2 Effect Monsters
  You can target 1 face-up monster on the field; it becomes DARK until the end of this turn. You can pay 2000 LP and send 1 "Fusion" or "Polymerization" Normal or Quick-Play Spell from your Deck to the GY; this effect becomes that Spell's effect when that card is activated, also, you cannot Special Summon monsters for the rest of this turn. You can only use each effect of "Predaplant Verte Anaconda" once per turn.
target_text: -- Predaplant
  local SETCARD_ID_0 = 0x46 --Polymerization/Fusion
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	c:EnableReviveLimit()
  	aux.AddLinkProcedure(c, aux.FilterBoolFunction(Card.IsLinkType, TYPE_EFFECT), 2, 2)
  	--change attribute
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetTarget(s.atttg)
  	e1:SetOperation(s.attop)
  	c:RegisterEffect(e1)
  	--copy
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCost(s.cpcost)
  	e2:SetTarget(s.cptg)
  	e2:SetOperation(s.cpop)
  	c:RegisterEffect(e2)
  end
  function s.attfilter(c)
  	return c:IsFaceup() and not c:IsAttribute(ATTRIBUTE_DARK)
  end
  function s.atttg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and s.attfilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.attfilter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  	Duel.SelectTarget(tp, s.attfilter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, nil)
  end
  function s.attop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsFaceup() and tc:IsRelateToEffect(e) then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_CHANGE_ATTRIBUTE)
  		e1:SetValue(ATTRIBUTE_DARK)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e1)
  	end
  end
  function s.cpfilter(c)
  	return (c:GetType() == TYPE_SPELL or c:IsType(TYPE_QUICKPLAY)) and c:IsSetCard(SETCARD_ID_0) and c:IsAbleToGraveAsCost() and c:CheckActivateEffect(true, true, false) ~= nil
  end
  function s.cpcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	e:SetLabel(1)
  	if chk == 0 then
  		return true
  	end
  end
  function s.cptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		if e:GetLabel() == 0 then
  			return false
  		end
  		e:SetLabel(0)
  		return Duel.CheckLPCost(tp, 2000) and Duel.IsExistingMatchingCard(s.cpfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	e:SetLabel(0)
  	Duel.PayLPCost(tp, 2000)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.cpfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	local te, ceg, cep, cev, cre, cr, crp = g:GetFirst():CheckActivateEffect(true, true, true)
  	Duel.SendtoGrave(g, REASON_COST)
  	e:SetProperty(te:GetProperty())
  	local tg = te:GetTarget()
  	if tg then
  		tg(e, tp, ceg, cep, cev, cre, cr, crp, 1)
  	end
  	te:SetLabelObject(e:GetLabelObject())
  	e:SetLabelObject(te)
  	Duel.ClearOperationInfo(0)
  end
  function s.cpop(e, tp, eg, ep, ev, re, r, rp)
  	local te = e:GetLabelObject()
  	if te then
  		e:SetLabelObject(te:GetLabelObject())
  		local op = te:GetOperation()
  		if op then
  			op(e, tp, eg, ep, ev, re, r, rp)
  		end
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetTargetRange(1, 0)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  
  