name: Beacon
card_text: If you do not control another "Beacon of White", and you have 3 or more "Blue-Eyes" monsters in your GY: Target 1 of them; Special Summon it, but negate its effects, also equip it with this card. When this card leaves the field, banish the equipped monster. Other monsters you control cannot attack, also if you have any number of "Blue-Eyes" monster(s) in your GY, the equipped monster can attack up to that number of times during each Battle Phase.
external_ids: local SETCARD_ID_0 = 0xdd --Blue-Eyes
  
lua: local SETCARD_ID_0 = 0xdd --Blue-Eyes
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--extra attack
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_EQUIP)
  	e2:SetCode(EFFECT_EXTRA_ATTACK)
  	e2:SetValue(s.val)
  	c:RegisterEffect(e2)
  	--remove
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e3:SetCode(EVENT_LEAVE_FIELD)
  	e3:SetOperation(s.rmop)
  	c:RegisterEffect(e3)
  	--cannot attack
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD)
  	e4:SetCode(EFFECT_CANNOT_ATTACK)
  	e4:SetRange(LOCATION_SZONE)
  	e4:SetTargetRange(LOCATION_MZONE, 0)
  	e4:SetTarget(s.ftarget)
  	c:RegisterEffect(e4)
  end
  function s.spfilter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.gvfilter(c)
  	return c:IsSetCard(SETCARD_ID_0)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsCode(id)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc, e, tp)
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
  			and Duel.IsExistingTarget(s.spfilter, tp, LOCATION_GRAVE, 0, 1, nil, e, tp)
  			and Duel.IsExistingMatchingCard(s.gvfilter, tp, LOCATION_GRAVE, 0, 3, nil)
  			and not Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_ONFIELD, 0, 1, e:GetHandler())
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectTarget(tp, s.spfilter, tp, LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, e:GetHandler(), 1, 0, 0)
  end
  function s.eqlimit(e, c)
  	return e:GetOwner() == c
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then
  		if not Duel.SpecialSummonStep(tc, 0, tp, tp, false, false, POS_FACEUP) then
  			return
  		end
  		Duel.Equip(tp, c, tc)
  		--Add Equip limit
  		local e1 = Effect.CreateEffect(tc)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_EQUIP_LIMIT)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		e1:SetValue(s.eqlimit)
  		c:RegisterEffect(e1)
  		--Disable
  		local e2 = Effect.CreateEffect(c)
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetCode(EFFECT_DISABLE)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e2)
  		local e3 = e2:Clone()
  		e3:SetCode(EFFECT_DISABLE_EFFECT)
  		e3:SetValue(RESET_TURN_SET)
  		tc:RegisterEffect(e3)
  		Duel.SpecialSummonComplete()
  	end
  end
  function s.rmop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = e:GetHandler():GetEquipTarget()
  	if tc then
  		Duel.Remove(tc, POS_FACEUP, REASON_EFFECT)
  	end
  end
  function s.ftarget(e, c)
  	return e:GetHandler():GetEquipTarget() ~= c
  end
  function s.val(e, c)
  	local ct = Duel.GetMatchingGroupCount(Card.IsSetCard, e:GetHandlerPlayer(), LOCATION_GRAVE, 0, nil, 0xdd)
  	return math.max(0, ct - 1)
  end
  
  
source_text: Beacon
  If you do not control another "Beacon of White", and you have 3 or more "Blue-Eyes" monsters in your GY: Target 1 of them; Special Summon it, but negate its effects, also equip it with this card. When this card leaves the field, banish the equipped monster. Other monsters you control cannot attack, also if you have any number of "Blue-Eyes" monster(s) in your GY, the equipped monster can attack up to that number of times during each Battle Phase.
target_text: -- Beacon
  local SETCARD_ID_0 = 0xdd --Blue-Eyes
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--extra attack
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_EQUIP)
  	e2:SetCode(EFFECT_EXTRA_ATTACK)
  	e2:SetValue(s.val)
  	c:RegisterEffect(e2)
  	--remove
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e3:SetCode(EVENT_LEAVE_FIELD)
  	e3:SetOperation(s.rmop)
  	c:RegisterEffect(e3)
  	--cannot attack
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD)
  	e4:SetCode(EFFECT_CANNOT_ATTACK)
  	e4:SetRange(LOCATION_SZONE)
  	e4:SetTargetRange(LOCATION_MZONE, 0)
  	e4:SetTarget(s.ftarget)
  	c:RegisterEffect(e4)
  end
  function s.spfilter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.gvfilter(c)
  	return c:IsSetCard(SETCARD_ID_0)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsCode(id)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc, e, tp)
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
  			and Duel.IsExistingTarget(s.spfilter, tp, LOCATION_GRAVE, 0, 1, nil, e, tp)
  			and Duel.IsExistingMatchingCard(s.gvfilter, tp, LOCATION_GRAVE, 0, 3, nil)
  			and not Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_ONFIELD, 0, 1, e:GetHandler())
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectTarget(tp, s.spfilter, tp, LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, e:GetHandler(), 1, 0, 0)
  end
  function s.eqlimit(e, c)
  	return e:GetOwner() == c
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then
  		if not Duel.SpecialSummonStep(tc, 0, tp, tp, false, false, POS_FACEUP) then
  			return
  		end
  		Duel.Equip(tp, c, tc)
  		--Add Equip limit
  		local e1 = Effect.CreateEffect(tc)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_EQUIP_LIMIT)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		e1:SetValue(s.eqlimit)
  		c:RegisterEffect(e1)
  		--Disable
  		local e2 = Effect.CreateEffect(c)
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetCode(EFFECT_DISABLE)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  		tc:RegisterEffect(e2)
  		local e3 = e2:Clone()
  		e3:SetCode(EFFECT_DISABLE_EFFECT)
  		e3:SetValue(RESET_TURN_SET)
  		tc:RegisterEffect(e3)
  		Duel.SpecialSummonComplete()
  	end
  end
  function s.rmop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = e:GetHandler():GetEquipTarget()
  	if tc then
  		Duel.Remove(tc, POS_FACEUP, REASON_EFFECT)
  	end
  end
  function s.ftarget(e, c)
  	return e:GetHandler():GetEquipTarget() ~= c
  end
  function s.val(e, c)
  	local ct = Duel.GetMatchingGroupCount(Card.IsSetCard, e:GetHandlerPlayer(), LOCATION_GRAVE, 0, nil, 0xdd)
  	return math.max(0, ct - 1)
  end
  
  