name: ゲットライド!
card_text: 自分の墓地のユニオンモンスター1体を選択し、自分フィールド上の装備可能なモンスターに装備する。
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--equip
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_EQUIP)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  s.has_text_type = TYPE_UNION
  function s.filter(c, tp)
  	return c:IsType(TYPE_UNION) and Duel.IsExistingMatchingCard(s.filter2, tp, LOCATION_MZONE, 0, 1, nil, c)
  end
  function s.filter2(c, eqc)
  	return c:IsFaceup() and eqc:CheckUnionTarget(c) and aux.CheckUnionEquip(eqc, c)
  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.filter(chkc, tp)
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_SZONE) > (e:GetHandler():IsLocation(LOCATION_SZONE) and 0 or 1) and Duel.IsExistingTarget(s.filter, tp, LOCATION_GRAVE, 0, 1, nil, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	local g = Duel.SelectTarget(tp, s.filter, tp, LOCATION_GRAVE, 0, 1, 1, nil, tp)
  	Duel.SetOperationInfo(0, CATEGORY_LEAVE_GRAVE, g, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, g, 1, 0, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  		local g = Duel.SelectMatchingCard(tp, s.filter2, tp, LOCATION_MZONE, 0, 1, 1, nil, tc)
  		local tc2 = g:GetFirst()
  		if tc2 and aux.CheckUnionEquip(tc, tc2) and Duel.Equip(tp, tc, tc2) then
  			aux.SetUnionState(tc)
  		end
  	end
  end
  
  
source_text: ゲットライド!
  自分の墓地のユニオンモンスター1体を選択し、自分フィールド上の装備可能なモンスターに装備する。
target_text: -- ゲットライド!
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--equip
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_EQUIP)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  s.has_text_type = TYPE_UNION
  function s.filter(c, tp)
  	return c:IsType(TYPE_UNION) and Duel.IsExistingMatchingCard(s.filter2, tp, LOCATION_MZONE, 0, 1, nil, c)
  end
  function s.filter2(c, eqc)
  	return c:IsFaceup() and eqc:CheckUnionTarget(c) and aux.CheckUnionEquip(eqc, c)
  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.filter(chkc, tp)
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_SZONE) > (e:GetHandler():IsLocation(LOCATION_SZONE) and 0 or 1) and Duel.IsExistingTarget(s.filter, tp, LOCATION_GRAVE, 0, 1, nil, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	local g = Duel.SelectTarget(tp, s.filter, tp, LOCATION_GRAVE, 0, 1, 1, nil, tp)
  	Duel.SetOperationInfo(0, CATEGORY_LEAVE_GRAVE, g, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, g, 1, 0, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  		local g = Duel.SelectMatchingCard(tp, s.filter2, tp, LOCATION_MZONE, 0, 1, 1, nil, tc)
  		local tc2 = g:GetFirst()
  		if tc2 and aux.CheckUnionEquip(tc, tc2) and Duel.Equip(tp, tc, tc2) then
  			aux.SetUnionState(tc)
  		end
  	end
  end
  
  