name: Cyberload
card_text: Fusion Summon 1 Fusion Monster from your Extra Deck that lists a "Cyber Dragon" monster as material, by shuffling the Fusion Materials listed on it into the Deck, from among your cards on the field and/or your face-up banished cards, but monsters you control cannot attack for the rest of this turn, except that Fusion Summoned monster. You can only activate 1 "Cyberload Fusion" per turn.
external_ids: local SETCARD_ID_0 = 0x1093 --Cyber
  
lua: local SETCARD_ID_0 = 0x1093 --Cyber
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = FusionSpell.CreateSummonEffect(c, {
  		fusfilter = s.fusfilter,
  		pre_select_mat_location = LOCATION_MZONE | LOCATION_REMOVED,
  		mat_operation_code_map = {
  			{ [LOCATION_DECK] = FusionSpell.FUSION_OPERATION_GRAVE },
  			{ [0xff] = FusionSpell.FUSION_OPERATION_SHUFFLE },
  		},
  		additional_fcheck = s.fcheck,
  		stage_x_operation = s.stage_x_operation,
  	})
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	c:RegisterEffect(e1)
  end
  
  function s.fusfilter(c)
  	return aux.IsMaterialListSetCard(c, SETCARD_ID_0)
  end
  
  function s.fcheck(tp, mg, tc, mg_all)
  	if tc.cyber_fusion_check ~= nil then
  		return tc.cyber_fusion_check(tp, mg_all, tc)
  	else
  		return true
  	end
  end
  
  function s.stage_x_operation(e, tc, tp, stage)
  	if stage == FusionSpell.STAGE_AT_SUMMON_OPERATION_FINISH then
  		local fid = e:GetHandler():GetFieldID()
  		tc:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1, fid)
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_FIELD)
  		e1:SetCode(EFFECT_CANNOT_ATTACK)
  		e1:SetProperty(EFFECT_FLAG_OATH)
  		e1:SetTargetRange(LOCATION_MZONE, 0)
  		e1:SetTarget(s.ftarget)
  		e1:SetLabel(fid)
  		e1:SetReset(RESET_PHASE + PHASE_END)
  		Duel.RegisterEffect(e1, tp)
  	end
  end
  
  function s.ftarget(e, c)
  	return e:GetLabel() ~= c:GetFlagEffectLabel(id)
  end
  
  
source_text: Cyberload
  Fusion Summon 1 Fusion Monster from your Extra Deck that lists a "Cyber Dragon" monster as material, by shuffling the Fusion Materials listed on it into the Deck, from among your cards on the field and/or your face-up banished cards, but monsters you control cannot attack for the rest of this turn, except that Fusion Summoned monster. You can only activate 1 "Cyberload Fusion" per turn.
target_text: -- Cyberload
  local SETCARD_ID_0 = 0x1093 --Cyber
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = FusionSpell.CreateSummonEffect(c, {
  		fusfilter = s.fusfilter,
  		pre_select_mat_location = LOCATION_MZONE | LOCATION_REMOVED,
  		mat_operation_code_map = {
  			{ [LOCATION_DECK] = FusionSpell.FUSION_OPERATION_GRAVE },
  			{ [0xff] = FusionSpell.FUSION_OPERATION_SHUFFLE },
  		},
  		additional_fcheck = s.fcheck,
  		stage_x_operation = s.stage_x_operation,
  	})
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	c:RegisterEffect(e1)
  end
  
  function s.fusfilter(c)
  	return aux.IsMaterialListSetCard(c, SETCARD_ID_0)
  end
  
  function s.fcheck(tp, mg, tc, mg_all)
  	if tc.cyber_fusion_check ~= nil then
  		return tc.cyber_fusion_check(tp, mg_all, tc)
  	else
  		return true
  	end
  end
  
  function s.stage_x_operation(e, tc, tp, stage)
  	if stage == FusionSpell.STAGE_AT_SUMMON_OPERATION_FINISH then
  		local fid = e:GetHandler():GetFieldID()
  		tc:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1, fid)
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_FIELD)
  		e1:SetCode(EFFECT_CANNOT_ATTACK)
  		e1:SetProperty(EFFECT_FLAG_OATH)
  		e1:SetTargetRange(LOCATION_MZONE, 0)
  		e1:SetTarget(s.ftarget)
  		e1:SetLabel(fid)
  		e1:SetReset(RESET_PHASE + PHASE_END)
  		Duel.RegisterEffect(e1, tp)
  	end
  end
  
  function s.ftarget(e, c)
  	return e:GetLabel() ~= c:GetFlagEffectLabel(id)
  end
  
  