name: Cyberdark
card_text: "Cyberdark Horn" + "Cyberdark Edge" + "Cyberdark Keel"
  Must be Fusion Summoned. If this card is Special Summoned: Target 1 Dragon monster in your GY; equip that target to this card. Gains ATK equal to the original ATK of the monster equipped to it by this effect. Gains 100 ATK for each monster in your GY. If this card would be destroyed by battle, destroy that equipped monster instead.
external_ids: local CARD_ID_0 = 41230939 --Cyberdark Horn
  local CARD_ID_1 = 77625948 --Cyberdark Edge
  local CARD_ID_2 = 3019642 --Cyberdark Keel
  local CARD_ID_3 = 64753988 --Cyberdark Realm
  
lua: local CARD_ID_0 = 41230939 --Cyberdark Horn
  local CARD_ID_1 = 77625948 --Cyberdark Edge
  local CARD_ID_2 = 3019642 --Cyberdark Keel
  local CARD_ID_3 = 64753988 --Cyberdark Realm
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcCode3(c, CARD_ID_0, CARD_ID_1, CARD_ID_2, true, true)
  	--equip
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_EQUIP)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetTarget(s.eqtg)
  	e1:SetOperation(s.eqop)
  	c:RegisterEffect(e1)
  	--atkup
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetValue(s.atkval)
  	c:RegisterEffect(e2)
  	--spsummon condition
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e3:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e3:SetValue(aux.fuslimit)
  	c:RegisterEffect(e3)
  end
  function s.filter(c)
  	return c:IsRace(RACE_DRAGON) and not c:IsForbidden()
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_GRAVE) and (chkc:IsControler(tp) or Duel.IsPlayerAffectedByEffect(tp, CARD_ID_3)) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return true
  	end
  	local loc = Duel.IsPlayerAffectedByEffect(tp, CARD_ID_3) and LOCATION_GRAVE or 0
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	local g = Duel.SelectTarget(tp, s.filter, tp, LOCATION_GRAVE, loc, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_LEAVE_GRAVE, g, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, g, 1, 0, 0)
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc and tc:IsRelateToEffect(e) and tc:IsRace(RACE_DRAGON) then
  		local atk = tc:GetTextAttack()
  		if atk < 0 then
  			atk = 0
  		end
  		if not Duel.Equip(tp, tc, c, false) then
  			return
  		end
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
  		e1:SetCode(EFFECT_EQUIP_LIMIT)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		e1:SetValue(s.eqlimit)
  		tc:RegisterEffect(e1)
  		local e2 = Effect.CreateEffect(c)
  		e2:SetType(EFFECT_TYPE_EQUIP)
  		e2:SetProperty(EFFECT_FLAG_OWNER_RELATE + EFFECT_FLAG_IGNORE_IMMUNE)
  		e2:SetCode(EFFECT_UPDATE_ATTACK)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  		e2:SetValue(atk)
  		tc:RegisterEffect(e2)
  		local e3 = Effect.CreateEffect(c)
  		e3:SetType(EFFECT_TYPE_EQUIP)
  		e3:SetCode(EFFECT_DESTROY_SUBSTITUTE)
  		e3:SetReset(RESET_EVENT + RESETS_STANDARD)
  		e3:SetValue(s.repval)
  		tc:RegisterEffect(e3)
  	end
  end
  function s.eqlimit(e, c)
  	return e:GetOwner() == c
  end
  function s.repval(e, re, r, rp)
  	return bit.band(r, REASON_BATTLE) ~= 0
  end
  function s.atkval(e, c)
  	local tp = e:GetHandlerPlayer()
  	return Duel.GetMatchingGroupCount(Card.IsType, tp, LOCATION_GRAVE, 0, nil, TYPE_MONSTER) * 100
  end
  
  
source_text: Cyberdark
  "Cyberdark Horn" + "Cyberdark Edge" + "Cyberdark Keel"
  Must be Fusion Summoned. If this card is Special Summoned: Target 1 Dragon monster in your GY; equip that target to this card. Gains ATK equal to the original ATK of the monster equipped to it by this effect. Gains 100 ATK for each monster in your GY. If this card would be destroyed by battle, destroy that equipped monster instead.
target_text: -- Cyberdark
  local CARD_ID_0 = 41230939 --Cyberdark Horn
  local CARD_ID_1 = 77625948 --Cyberdark Edge
  local CARD_ID_2 = 3019642 --Cyberdark Keel
  local CARD_ID_3 = 64753988 --Cyberdark Realm
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcCode3(c, CARD_ID_0, CARD_ID_1, CARD_ID_2, true, true)
  	--equip
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_EQUIP)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetTarget(s.eqtg)
  	e1:SetOperation(s.eqop)
  	c:RegisterEffect(e1)
  	--atkup
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetValue(s.atkval)
  	c:RegisterEffect(e2)
  	--spsummon condition
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e3:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e3:SetValue(aux.fuslimit)
  	c:RegisterEffect(e3)
  end
  function s.filter(c)
  	return c:IsRace(RACE_DRAGON) and not c:IsForbidden()
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_GRAVE) and (chkc:IsControler(tp) or Duel.IsPlayerAffectedByEffect(tp, CARD_ID_3)) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return true
  	end
  	local loc = Duel.IsPlayerAffectedByEffect(tp, CARD_ID_3) and LOCATION_GRAVE or 0
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	local g = Duel.SelectTarget(tp, s.filter, tp, LOCATION_GRAVE, loc, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_LEAVE_GRAVE, g, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, g, 1, 0, 0)
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc and tc:IsRelateToEffect(e) and tc:IsRace(RACE_DRAGON) then
  		local atk = tc:GetTextAttack()
  		if atk < 0 then
  			atk = 0
  		end
  		if not Duel.Equip(tp, tc, c, false) then
  			return
  		end
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
  		e1:SetCode(EFFECT_EQUIP_LIMIT)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		e1:SetValue(s.eqlimit)
  		tc:RegisterEffect(e1)
  		local e2 = Effect.CreateEffect(c)
  		e2:SetType(EFFECT_TYPE_EQUIP)
  		e2:SetProperty(EFFECT_FLAG_OWNER_RELATE + EFFECT_FLAG_IGNORE_IMMUNE)
  		e2:SetCode(EFFECT_UPDATE_ATTACK)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  		e2:SetValue(atk)
  		tc:RegisterEffect(e2)
  		local e3 = Effect.CreateEffect(c)
  		e3:SetType(EFFECT_TYPE_EQUIP)
  		e3:SetCode(EFFECT_DESTROY_SUBSTITUTE)
  		e3:SetReset(RESET_EVENT + RESETS_STANDARD)
  		e3:SetValue(s.repval)
  		tc:RegisterEffect(e3)
  	end
  end
  function s.eqlimit(e, c)
  	return e:GetOwner() == c
  end
  function s.repval(e, re, r, rp)
  	return bit.band(r, REASON_BATTLE) ~= 0
  end
  function s.atkval(e, c)
  	local tp = e:GetHandlerPlayer()
  	return Duel.GetMatchingGroupCount(Card.IsType, tp, LOCATION_GRAVE, 0, nil, TYPE_MONSTER) * 100
  end
  
  