name: Dark
card_text: Once per turn: You can banish 1 DARK monster from your Graveyard to target 1 Level 4 or lower LIGHT monster your opponent controls; equip it to this card. (You can only equip 1 monster at a time to this card with this effect.) If this card on the field would be destroyed, the monster equipped to it with this effect is destroyed, instead.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--equip
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_EQUIP)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.eqcon)
  	e1:SetCost(s.eqcost)
  	e1:SetTarget(s.eqtg)
  	e1:SetOperation(s.eqop)
  	c:RegisterEffect(e1)
  end
  function s.eqcon(e, tp, eg, ep, ev, re, r, rp)
  	local ec = e:GetLabelObject()
  	return ec == nil or ec:GetFlagEffect(id) == 0
  end
  function s.cfilter(c)
  	return c:IsAttribute(ATTRIBUTE_DARK) and c:IsAbleToRemoveAsCost()
  end
  function s.eqcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_GRAVE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectMatchingCard(tp, s.cfilter, tp, LOCATION_GRAVE, 0, 1, 1, nil)
  	Duel.Remove(g, POS_FACEUP, REASON_COST)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsLevelBelow(4) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsAbleToChangeControler()
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1 - tp) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 and Duel.IsExistingTarget(s.filter, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	local g = Duel.SelectTarget(tp, s.filter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, g, 1, 0, 0)
  end
  function s.eqlimit(e, c)
  	return e:GetOwner() == c
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:IsType(TYPE_MONSTER) then
  		if not Duel.Equip(tp, tc, c, false) then
  			return
  		end
  		--Add Equip limit
  		tc:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD, 0, 0)
  		e:SetLabelObject(tc)
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_EQUIP_LIMIT)
  		e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
  		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_DESTROY_SUBSTITUTE)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  		e2:SetValue(1)
  		tc:RegisterEffect(e2)
  	end
  end
  
  
source_text: Dark
  Once per turn: You can banish 1 DARK monster from your Graveyard to target 1 Level 4 or lower LIGHT monster your opponent controls; equip it to this card. (You can only equip 1 monster at a time to this card with this effect.) If this card on the field would be destroyed, the monster equipped to it with this effect is destroyed, instead.
target_text: -- Dark
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--equip
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_EQUIP)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.eqcon)
  	e1:SetCost(s.eqcost)
  	e1:SetTarget(s.eqtg)
  	e1:SetOperation(s.eqop)
  	c:RegisterEffect(e1)
  end
  function s.eqcon(e, tp, eg, ep, ev, re, r, rp)
  	local ec = e:GetLabelObject()
  	return ec == nil or ec:GetFlagEffect(id) == 0
  end
  function s.cfilter(c)
  	return c:IsAttribute(ATTRIBUTE_DARK) and c:IsAbleToRemoveAsCost()
  end
  function s.eqcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_GRAVE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectMatchingCard(tp, s.cfilter, tp, LOCATION_GRAVE, 0, 1, 1, nil)
  	Duel.Remove(g, POS_FACEUP, REASON_COST)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsLevelBelow(4) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsAbleToChangeControler()
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1 - tp) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 and Duel.IsExistingTarget(s.filter, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	local g = Duel.SelectTarget(tp, s.filter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, g, 1, 0, 0)
  end
  function s.eqlimit(e, c)
  	return e:GetOwner() == c
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:IsType(TYPE_MONSTER) then
  		if not Duel.Equip(tp, tc, c, false) then
  			return
  		end
  		--Add Equip limit
  		tc:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD, 0, 0)
  		e:SetLabelObject(tc)
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_EQUIP_LIMIT)
  		e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
  		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_DESTROY_SUBSTITUTE)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  		e2:SetValue(1)
  		tc:RegisterEffect(e2)
  	end
  end
  
  