name: Supreme
card_text: 2 DARK Pendulum Monsters
  Must be either Fusion Summoned, or Special Summoned by Tributing the above cards you control (in which case you do not use "Polymerization"). Once per turn: You can target 1 other monster on the field or in the GY; until the End Phase, this card's name becomes that monster's original name, and replace this effect with that monster's original effects, also for the rest of this turn, if your monster attacks a Defense Position monster, inflict piercing battle damage to your opponent.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcFunRep(c, s.ffilter, 2, false)
  	aux.AddContactFusionProcedure(c, aux.FilterBoolFunction(Card.IsReleasable, REASON_SPSUMMON), LOCATION_MZONE, 0, Duel.Release, REASON_SPSUMMON + REASON_MATERIAL)
  	--spsummon condition
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e1:SetValue(s.splimit)
  	c:RegisterEffect(e1)
  	--copy effect
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e3:SetCountLimit(1)
  	e3:SetCost(s.copycost)
  	e3:SetTarget(s.copytg)
  	e3:SetOperation(s.copyop)
  	c:RegisterEffect(e3)
  end
  function s.ffilter(c)
  	return c:IsFusionAttribute(ATTRIBUTE_DARK) and c:IsFusionType(TYPE_PENDULUM)
  end
  function s.splimit(e, se, sp, st)
  	return bit.band(st, SUMMON_TYPE_FUSION) == SUMMON_TYPE_FUSION
  end
  function s.copycost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():GetFlagEffect(id) == 0
  	end
  	e:GetHandler():RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1)
  end
  function s.copyfilter(c)
  	return c:IsType(TYPE_MONSTER) and not c:IsType(TYPE_TOKEN) and (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE))
  end
  function s.copytg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local c = e:GetHandler()
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE + LOCATION_GRAVE) and s.copyfilter(chkc) and chkc ~= c
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.copyfilter, tp, LOCATION_MZONE + LOCATION_GRAVE, LOCATION_MZONE + LOCATION_GRAVE, 1, c)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  	Duel.SelectTarget(tp, s.copyfilter, tp, LOCATION_MZONE + LOCATION_GRAVE, LOCATION_MZONE + LOCATION_GRAVE, 1, 1, c)
  end
  function s.copyop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc and c:IsRelateToEffect(e) and c:IsFaceup() and tc:IsRelateToEffect(e) and (tc:IsFaceup() or tc:IsLocation(LOCATION_GRAVE)) then
  		local code = tc:GetOriginalCodeRule()
  		local cid = 0
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetCode(EFFECT_CHANGE_CODE)
  		e1:SetValue(code)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		c:RegisterEffect(e1)
  		if not tc:IsType(TYPE_TRAPMONSTER) then
  			cid = c:CopyEffect(code, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 1)
  		end
  		local e3 = Effect.CreateEffect(c)
  		e3:SetDescription(aux.Stringid(id, 1))
  		e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  		e3:SetCode(EVENT_PHASE + PHASE_END)
  		e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  		e3:SetCountLimit(1)
  		e3:SetRange(LOCATION_MZONE)
  		e3:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		e3:SetLabelObject(e1)
  		e3:SetLabel(cid)
  		e3:SetOperation(s.rstop)
  		c:RegisterEffect(e3)
  	end
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_PIERCE)
  	e2:SetTargetRange(LOCATION_MZONE, 0)
  	e2:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e2, tp)
  end
  function s.rstop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local cid = e:GetLabel()
  	if cid ~= 0 then
  		c:ResetEffect(cid, RESET_COPY)
  		c:ResetEffect(RESET_DISABLE, RESET_EVENT)
  	end
  	local e1 = e:GetLabelObject()
  	e1:Reset()
  	Duel.HintSelection(Group.FromCards(c))
  	Duel.Hint(HINT_OPSELECTED, 1 - tp, e:GetDescription())
  end
  
  
source_text: Supreme
  2 DARK Pendulum Monsters
  Must be either Fusion Summoned, or Special Summoned by Tributing the above cards you control (in which case you do not use "Polymerization"). Once per turn: You can target 1 other monster on the field or in the GY; until the End Phase, this card's name becomes that monster's original name, and replace this effect with that monster's original effects, also for the rest of this turn, if your monster attacks a Defense Position monster, inflict piercing battle damage to your opponent.
target_text: -- Supreme
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcFunRep(c, s.ffilter, 2, false)
  	aux.AddContactFusionProcedure(c, aux.FilterBoolFunction(Card.IsReleasable, REASON_SPSUMMON), LOCATION_MZONE, 0, Duel.Release, REASON_SPSUMMON + REASON_MATERIAL)
  	--spsummon condition
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e1:SetValue(s.splimit)
  	c:RegisterEffect(e1)
  	--copy effect
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e3:SetCountLimit(1)
  	e3:SetCost(s.copycost)
  	e3:SetTarget(s.copytg)
  	e3:SetOperation(s.copyop)
  	c:RegisterEffect(e3)
  end
  function s.ffilter(c)
  	return c:IsFusionAttribute(ATTRIBUTE_DARK) and c:IsFusionType(TYPE_PENDULUM)
  end
  function s.splimit(e, se, sp, st)
  	return bit.band(st, SUMMON_TYPE_FUSION) == SUMMON_TYPE_FUSION
  end
  function s.copycost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():GetFlagEffect(id) == 0
  	end
  	e:GetHandler():RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1)
  end
  function s.copyfilter(c)
  	return c:IsType(TYPE_MONSTER) and not c:IsType(TYPE_TOKEN) and (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE))
  end
  function s.copytg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local c = e:GetHandler()
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE + LOCATION_GRAVE) and s.copyfilter(chkc) and chkc ~= c
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.copyfilter, tp, LOCATION_MZONE + LOCATION_GRAVE, LOCATION_MZONE + LOCATION_GRAVE, 1, c)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  	Duel.SelectTarget(tp, s.copyfilter, tp, LOCATION_MZONE + LOCATION_GRAVE, LOCATION_MZONE + LOCATION_GRAVE, 1, 1, c)
  end
  function s.copyop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc and c:IsRelateToEffect(e) and c:IsFaceup() and tc:IsRelateToEffect(e) and (tc:IsFaceup() or tc:IsLocation(LOCATION_GRAVE)) then
  		local code = tc:GetOriginalCodeRule()
  		local cid = 0
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetCode(EFFECT_CHANGE_CODE)
  		e1:SetValue(code)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		c:RegisterEffect(e1)
  		if not tc:IsType(TYPE_TRAPMONSTER) then
  			cid = c:CopyEffect(code, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 1)
  		end
  		local e3 = Effect.CreateEffect(c)
  		e3:SetDescription(aux.Stringid(id, 1))
  		e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  		e3:SetCode(EVENT_PHASE + PHASE_END)
  		e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  		e3:SetCountLimit(1)
  		e3:SetRange(LOCATION_MZONE)
  		e3:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		e3:SetLabelObject(e1)
  		e3:SetLabel(cid)
  		e3:SetOperation(s.rstop)
  		c:RegisterEffect(e3)
  	end
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_PIERCE)
  	e2:SetTargetRange(LOCATION_MZONE, 0)
  	e2:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e2, tp)
  end
  function s.rstop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local cid = e:GetLabel()
  	if cid ~= 0 then
  		c:ResetEffect(cid, RESET_COPY)
  		c:ResetEffect(RESET_DISABLE, RESET_EVENT)
  	end
  	local e1 = e:GetLabelObject()
  	e1:Reset()
  	Duel.HintSelection(Group.FromCards(c))
  	Duel.Hint(HINT_OPSELECTED, 1 - tp, e:GetDescription())
  end
  
  