name: Sin
card_text: このカード名のカードは1ターンに1枚しか発動できない。
  1:自分の墓地から「Sin」カード2枚を除外して発動できる。
  除外したカードとカード名が異なる「Sin Selector」以外の「Sin」カード2枚をデッキから手札に加える(同名カードは1枚まで)。
external_ids: local SETCARD_ID_0 = 0x23 --Sin
  
lua: local SETCARD_ID_0 = 0x23 --Sin
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetLabel(0)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.cfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsAbleToRemoveAsCost()
  end
  function s.thfilter(c, code1, code2)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsAbleToHand() and not c:IsCode(id, code1, code2)
  end
  function s.costcheck(g, tp)
  	local code1 = g:GetFirst():GetCode()
  	local code2 = g:GetNext():GetCode()
  	local tg = Duel.GetMatchingGroup(s.thfilter, tp, LOCATION_DECK, 0, nil, code1, code2)
  	return tg:GetClassCount(Card.GetCode) >= 2
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	e:SetLabel(100)
  	return true
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g = Duel.GetMatchingGroup(s.cfilter, tp, LOCATION_GRAVE, 0, nil)
  	if chk == 0 then
  		if e:GetLabel() ~= 100 then
  			return false
  		end
  		e:SetLabel(0)
  		return g:CheckSubGroup(s.costcheck, 2, 2, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local sg = g:SelectSubGroup(tp, s.costcheck, false, 2, 2, tp)
  	Duel.Remove(sg, POS_FACEUP, REASON_COST)
  	sg:KeepAlive()
  	e:SetLabelObject(sg)
  	e:SetLabel(0)
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 2, tp, LOCATION_DECK)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local g = e:GetLabelObject()
  	local code1 = g:GetFirst():GetCode()
  	local code2 = g:GetNext():GetCode()
  	local tg = Duel.GetMatchingGroup(s.thfilter, tp, LOCATION_DECK, 0, nil, code1, code2)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local sg = tg:SelectSubGroup(tp, aux.dncheck, false, 2, 2)
  	if sg then
  		Duel.SendtoHand(sg, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, sg)
  	end
  end
  
  
source_text: Sin
  このカード名のカードは1ターンに1枚しか発動できない。
  1:自分の墓地から「Sin」カード2枚を除外して発動できる。
  除外したカードとカード名が異なる「Sin Selector」以外の「Sin」カード2枚をデッキから手札に加える(同名カードは1枚まで)。
target_text: -- Sin
  local SETCARD_ID_0 = 0x23 --Sin
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetLabel(0)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.cfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsAbleToRemoveAsCost()
  end
  function s.thfilter(c, code1, code2)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsAbleToHand() and not c:IsCode(id, code1, code2)
  end
  function s.costcheck(g, tp)
  	local code1 = g:GetFirst():GetCode()
  	local code2 = g:GetNext():GetCode()
  	local tg = Duel.GetMatchingGroup(s.thfilter, tp, LOCATION_DECK, 0, nil, code1, code2)
  	return tg:GetClassCount(Card.GetCode) >= 2
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	e:SetLabel(100)
  	return true
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	local g = Duel.GetMatchingGroup(s.cfilter, tp, LOCATION_GRAVE, 0, nil)
  	if chk == 0 then
  		if e:GetLabel() ~= 100 then
  			return false
  		end
  		e:SetLabel(0)
  		return g:CheckSubGroup(s.costcheck, 2, 2, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local sg = g:SelectSubGroup(tp, s.costcheck, false, 2, 2, tp)
  	Duel.Remove(sg, POS_FACEUP, REASON_COST)
  	sg:KeepAlive()
  	e:SetLabelObject(sg)
  	e:SetLabel(0)
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 2, tp, LOCATION_DECK)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local g = e:GetLabelObject()
  	local code1 = g:GetFirst():GetCode()
  	local code2 = g:GetNext():GetCode()
  	local tg = Duel.GetMatchingGroup(s.thfilter, tp, LOCATION_DECK, 0, nil, code1, code2)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local sg = tg:SelectSubGroup(tp, aux.dncheck, false, 2, 2)
  	if sg then
  		Duel.SendtoHand(sg, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, sg)
  	end
  end
  
  