name: Cyberdark
card_text: "Cyberdark Dragon" + "Cyber End Dragon"
  Must be either Fusion Summoned, or Special Summoned by Tributing 1 Level 10 or lower "Cyberdark" Fusion Monster equipped with "Cyber End Dragon". Unaffected by your opponent's activated effects. Once per turn: You can equip 1 monster from either GY to this card. This card can attack a number of times each Battle Phase, up to the number of Equip Cards equipped to it.
external_ids: local CARD_ID_0 = 1546123 --Cyber End Dragon
  local CARD_ID_1 = 40418351 --Cyberdark Dragon
  local SETCARD_ID_0 = 0x4093 --Cyberdark
  
lua: local CARD_ID_0 = 1546123 --Cyber End Dragon
  local CARD_ID_1 = 40418351 --Cyberdark Dragon
  local SETCARD_ID_0 = 0x4093 --Cyberdark
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcCode2(c, CARD_ID_1, CARD_ID_0, true, true)
  	--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(aux.fuslimit)
  	c:RegisterEffect(e1)
  	--spsummon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e2:SetCode(EFFECT_SPSUMMON_PROC)
  	e2:SetRange(LOCATION_EXTRA)
  	e2:SetCondition(s.hspcon)
  	e2:SetTarget(s.hsptg)
  	e2:SetOperation(s.hspop)
  	c:RegisterEffect(e2)
  	--immune
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetCode(EFFECT_IMMUNE_EFFECT)
  	e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetValue(s.efilter)
  	c:RegisterEffect(e3)
  	--equip
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetCategory(CATEGORY_EQUIP)
  	e4:SetType(EFFECT_TYPE_IGNITION)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCountLimit(1)
  	e4:SetTarget(s.eqtg)
  	e4:SetOperation(s.eqop)
  	c:RegisterEffect(e4)
  	--multi attack
  	local e5 = Effect.CreateEffect(c)
  	e5:SetType(EFFECT_TYPE_SINGLE)
  	e5:SetCode(EFFECT_EXTRA_ATTACK)
  	e5:SetValue(s.atkval)
  	c:RegisterEffect(e5)
  end
  function s.eqspfilter(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0)
  end
  function s.hspfilter(c, tp, sc)
  	return c:IsLevelBelow(10)
  		and c:IsSetCard(SETCARD_ID_0)
  		and c:IsFusionType(TYPE_FUSION)
  		and c:IsControler(tp)
  		and c:GetEquipGroup():IsExists(s.eqspfilter, 1, nil)
  		and Duel.GetLocationCountFromEx(tp, tp, c, sc) > 0
  		and c:IsCanBeFusionMaterial(sc, SUMMON_TYPE_SPECIAL)
  end
  function s.hspcon(e, c)
  	if c == nil then
  		return true
  	end
  	return Duel.CheckReleaseGroupEx(c:GetControler(), s.hspfilter, 1, REASON_SPSUMMON, false, nil, c:GetControler(), c)
  end
  function s.hsptg(e, tp, eg, ep, ev, re, r, rp, chk, c)
  	local g = Duel.GetReleaseGroup(tp, false, REASON_SPSUMMON):Filter(s.hspfilter, nil, tp, c)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RELEASE)
  	local tc = g:SelectUnselect(nil, tp, false, true, 1, 1)
  	if tc then
  		e:SetLabelObject(tc)
  		return true
  	else
  		return false
  	end
  end
  function s.hspop(e, tp, eg, ep, ev, re, r, rp, c)
  	local tc = e:GetLabelObject()
  	c:SetMaterial(Group.FromCards(tc))
  	Duel.Release(tc, REASON_SPSUMMON)
  end
  function s.efilter(e, re)
  	return e:GetHandlerPlayer() ~= re:GetOwnerPlayer() and re:IsActivated()
  end
  function s.eqfilter(c, tp)
  	return c:IsType(TYPE_MONSTER) and (c:IsControler(tp) or c:IsAbleToChangeControler())
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 and Duel.IsExistingMatchingCard(s.eqfilter, tp, LOCATION_GRAVE, LOCATION_GRAVE, 1, nil, tp)
  	end
  	local g = Duel.GetFieldGroup(tp, LOCATION_GRAVE, LOCATION_GRAVE)
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, g, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_LEAVE_GRAVE, g, 1, 0, 0)
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not (c:IsFaceup() and c:IsRelateToEffect(e)) then
  		return
  	end
  	if Duel.GetLocationCount(tp, LOCATION_SZONE) <= 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	local g = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.eqfilter), tp, LOCATION_GRAVE, LOCATION_GRAVE, 1, 1, nil, tp)
  	local tc = g:GetFirst()
  	if tc then
  		if not Duel.Equip(tp, tc, c) then
  			return
  		end
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_EQUIP_LIMIT)
  		e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
  		e1:SetLabelObject(c)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		e1:SetValue(s.eqlimit)
  		tc:RegisterEffect(e1)
  	end
  end
  function s.eqlimit(e, c)
  	return c == e:GetLabelObject()
  end
  function s.atkval(e, c)
  	return e:GetHandler():GetEquipCount() - 1
  end
  
  
source_text: Cyberdark
  "Cyberdark Dragon" + "Cyber End Dragon"
  Must be either Fusion Summoned, or Special Summoned by Tributing 1 Level 10 or lower "Cyberdark" Fusion Monster equipped with "Cyber End Dragon". Unaffected by your opponent's activated effects. Once per turn: You can equip 1 monster from either GY to this card. This card can attack a number of times each Battle Phase, up to the number of Equip Cards equipped to it.
target_text: -- Cyberdark
  local CARD_ID_0 = 1546123 --Cyber End Dragon
  local CARD_ID_1 = 40418351 --Cyberdark Dragon
  local SETCARD_ID_0 = 0x4093 --Cyberdark
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcCode2(c, CARD_ID_1, CARD_ID_0, true, true)
  	--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(aux.fuslimit)
  	c:RegisterEffect(e1)
  	--spsummon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e2:SetCode(EFFECT_SPSUMMON_PROC)
  	e2:SetRange(LOCATION_EXTRA)
  	e2:SetCondition(s.hspcon)
  	e2:SetTarget(s.hsptg)
  	e2:SetOperation(s.hspop)
  	c:RegisterEffect(e2)
  	--immune
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetCode(EFFECT_IMMUNE_EFFECT)
  	e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetValue(s.efilter)
  	c:RegisterEffect(e3)
  	--equip
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetCategory(CATEGORY_EQUIP)
  	e4:SetType(EFFECT_TYPE_IGNITION)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCountLimit(1)
  	e4:SetTarget(s.eqtg)
  	e4:SetOperation(s.eqop)
  	c:RegisterEffect(e4)
  	--multi attack
  	local e5 = Effect.CreateEffect(c)
  	e5:SetType(EFFECT_TYPE_SINGLE)
  	e5:SetCode(EFFECT_EXTRA_ATTACK)
  	e5:SetValue(s.atkval)
  	c:RegisterEffect(e5)
  end
  function s.eqspfilter(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0)
  end
  function s.hspfilter(c, tp, sc)
  	return c:IsLevelBelow(10)
  		and c:IsSetCard(SETCARD_ID_0)
  		and c:IsFusionType(TYPE_FUSION)
  		and c:IsControler(tp)
  		and c:GetEquipGroup():IsExists(s.eqspfilter, 1, nil)
  		and Duel.GetLocationCountFromEx(tp, tp, c, sc) > 0
  		and c:IsCanBeFusionMaterial(sc, SUMMON_TYPE_SPECIAL)
  end
  function s.hspcon(e, c)
  	if c == nil then
  		return true
  	end
  	return Duel.CheckReleaseGroupEx(c:GetControler(), s.hspfilter, 1, REASON_SPSUMMON, false, nil, c:GetControler(), c)
  end
  function s.hsptg(e, tp, eg, ep, ev, re, r, rp, chk, c)
  	local g = Duel.GetReleaseGroup(tp, false, REASON_SPSUMMON):Filter(s.hspfilter, nil, tp, c)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RELEASE)
  	local tc = g:SelectUnselect(nil, tp, false, true, 1, 1)
  	if tc then
  		e:SetLabelObject(tc)
  		return true
  	else
  		return false
  	end
  end
  function s.hspop(e, tp, eg, ep, ev, re, r, rp, c)
  	local tc = e:GetLabelObject()
  	c:SetMaterial(Group.FromCards(tc))
  	Duel.Release(tc, REASON_SPSUMMON)
  end
  function s.efilter(e, re)
  	return e:GetHandlerPlayer() ~= re:GetOwnerPlayer() and re:IsActivated()
  end
  function s.eqfilter(c, tp)
  	return c:IsType(TYPE_MONSTER) and (c:IsControler(tp) or c:IsAbleToChangeControler())
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 and Duel.IsExistingMatchingCard(s.eqfilter, tp, LOCATION_GRAVE, LOCATION_GRAVE, 1, nil, tp)
  	end
  	local g = Duel.GetFieldGroup(tp, LOCATION_GRAVE, LOCATION_GRAVE)
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, g, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_LEAVE_GRAVE, g, 1, 0, 0)
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not (c:IsFaceup() and c:IsRelateToEffect(e)) then
  		return
  	end
  	if Duel.GetLocationCount(tp, LOCATION_SZONE) <= 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	local g = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.eqfilter), tp, LOCATION_GRAVE, LOCATION_GRAVE, 1, 1, nil, tp)
  	local tc = g:GetFirst()
  	if tc then
  		if not Duel.Equip(tp, tc, c) then
  			return
  		end
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_EQUIP_LIMIT)
  		e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
  		e1:SetLabelObject(c)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		e1:SetValue(s.eqlimit)
  		tc:RegisterEffect(e1)
  	end
  end
  function s.eqlimit(e, c)
  	return c == e:GetLabelObject()
  end
  function s.atkval(e, c)
  	return e:GetHandler():GetEquipCount() - 1
  end
  
  