name: Secret
card_text: 3 "Six Samurai" monsters with different Attributes
  Must first be Special Summoned (from your Extra Deck) by sending the above cards you control to the GY. (You do not use "Polymerization".) Cannot be used as Fusion Material. Once per turn: You can banish 1 "Six Samurai" card from your hand or face-up from your field, then target 1 card on the field; banish it. If a "Six Samurai" monster(s) you control would be destroyed by battle or card effect, you can banish this card from your GY instead.
external_ids: local SETCARD_ID_0 = 0x103d --Six
  
lua: local SETCARD_ID_0 = 0x103d --Six
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	aux.AddFusionProcFunRep(c, s.ffilter, 3, true)
  	aux.AddContactFusionProcedure(c, Card.IsAbleToGraveAsCost, LOCATION_MZONE, 0, Duel.SendtoGrave, REASON_COST)
  	--special summon condition
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetValue(s.splimit)
  	c:RegisterEffect(e1)
  	--fusion limit
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL)
  	e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e3:SetValue(1)
  	c:RegisterEffect(e3)
  	--remove
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetCategory(CATEGORY_REMOVE)
  	e4:SetType(EFFECT_TYPE_IGNITION)
  	e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCountLimit(1)
  	e4:SetCost(s.rmcost)
  	e4:SetTarget(s.rmtg)
  	e4:SetOperation(s.rmop)
  	c:RegisterEffect(e4)
  	--destroy replace
  	local e5 = Effect.CreateEffect(c)
  	e5:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e5:SetCode(EFFECT_DESTROY_REPLACE)
  	e5:SetRange(LOCATION_GRAVE)
  	e5:SetTarget(s.reptg)
  	e5:SetValue(s.repval)
  	e5:SetOperation(s.repop)
  	c:RegisterEffect(e5)
  end
  function s.splimit(e, se, sp, st)
  	return not e:GetHandler():IsLocation(LOCATION_EXTRA)
  end
  function s.ffilter(c, fc, sub, mg, sg)
  	return c:IsFusionSetCard(SETCARD_ID_0) and (not sg or not sg:IsExists(Card.IsFusionAttribute, 1, c, c:GetFusionAttribute()))
  end
  function s.costfilter(c, tp)
  	return c:IsSetCard(SETCARD_ID_0)
  		and c:IsAbleToRemoveAsCost()
  		and (c:IsLocation(LOCATION_HAND) or c:IsFaceup())
  		and Duel.IsExistingTarget(Card.IsAbleToRemove, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, c)
  end
  function s.rmcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.costfilter, tp, LOCATION_ONFIELD + LOCATION_HAND, 0, 1, nil, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectMatchingCard(tp, s.costfilter, tp, LOCATION_ONFIELD + LOCATION_HAND, 0, 1, 1, nil, tp)
  	Duel.Remove(g, POS_FACEUP, REASON_COST)
  end
  function s.rmtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local c = e:GetHandler()
  	if chkc then
  		return chkc:IsOnField() and chkc:IsAbleToRemove()
  	end
  	if chk == 0 then
  		return true
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectTarget(tp, Card.IsAbleToRemove, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, g, 1, 0, 0)
  end
  function s.rmop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		Duel.Remove(tc, POS_FACEUP, REASON_EFFECT)
  	end
  end
  function s.repfilter(c, tp)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) and c:IsReason(REASON_EFFECT + REASON_BATTLE) and not c:IsReason(REASON_REPLACE)
  end
  function s.reptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsAbleToRemove() and eg:IsExists(s.repfilter, 1, nil, tp)
  	end
  	return Duel.SelectEffectYesNo(tp, e:GetHandler(), 96)
  end
  function s.repval(e, c)
  	return s.repfilter(c, e:GetHandlerPlayer())
  end
  function s.repop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Remove(e:GetHandler(), POS_FACEUP, REASON_EFFECT)
  end
  
  
source_text: Secret
  3 "Six Samurai" monsters with different Attributes
  Must first be Special Summoned (from your Extra Deck) by sending the above cards you control to the GY. (You do not use "Polymerization".) Cannot be used as Fusion Material. Once per turn: You can banish 1 "Six Samurai" card from your hand or face-up from your field, then target 1 card on the field; banish it. If a "Six Samurai" monster(s) you control would be destroyed by battle or card effect, you can banish this card from your GY instead.
target_text: -- Secret
  local SETCARD_ID_0 = 0x103d --Six
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	aux.AddFusionProcFunRep(c, s.ffilter, 3, true)
  	aux.AddContactFusionProcedure(c, Card.IsAbleToGraveAsCost, LOCATION_MZONE, 0, Duel.SendtoGrave, REASON_COST)
  	--special summon condition
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetValue(s.splimit)
  	c:RegisterEffect(e1)
  	--fusion limit
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL)
  	e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e3:SetValue(1)
  	c:RegisterEffect(e3)
  	--remove
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetCategory(CATEGORY_REMOVE)
  	e4:SetType(EFFECT_TYPE_IGNITION)
  	e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCountLimit(1)
  	e4:SetCost(s.rmcost)
  	e4:SetTarget(s.rmtg)
  	e4:SetOperation(s.rmop)
  	c:RegisterEffect(e4)
  	--destroy replace
  	local e5 = Effect.CreateEffect(c)
  	e5:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e5:SetCode(EFFECT_DESTROY_REPLACE)
  	e5:SetRange(LOCATION_GRAVE)
  	e5:SetTarget(s.reptg)
  	e5:SetValue(s.repval)
  	e5:SetOperation(s.repop)
  	c:RegisterEffect(e5)
  end
  function s.splimit(e, se, sp, st)
  	return not e:GetHandler():IsLocation(LOCATION_EXTRA)
  end
  function s.ffilter(c, fc, sub, mg, sg)
  	return c:IsFusionSetCard(SETCARD_ID_0) and (not sg or not sg:IsExists(Card.IsFusionAttribute, 1, c, c:GetFusionAttribute()))
  end
  function s.costfilter(c, tp)
  	return c:IsSetCard(SETCARD_ID_0)
  		and c:IsAbleToRemoveAsCost()
  		and (c:IsLocation(LOCATION_HAND) or c:IsFaceup())
  		and Duel.IsExistingTarget(Card.IsAbleToRemove, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, c)
  end
  function s.rmcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.costfilter, tp, LOCATION_ONFIELD + LOCATION_HAND, 0, 1, nil, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectMatchingCard(tp, s.costfilter, tp, LOCATION_ONFIELD + LOCATION_HAND, 0, 1, 1, nil, tp)
  	Duel.Remove(g, POS_FACEUP, REASON_COST)
  end
  function s.rmtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local c = e:GetHandler()
  	if chkc then
  		return chkc:IsOnField() and chkc:IsAbleToRemove()
  	end
  	if chk == 0 then
  		return true
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectTarget(tp, Card.IsAbleToRemove, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, g, 1, 0, 0)
  end
  function s.rmop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		Duel.Remove(tc, POS_FACEUP, REASON_EFFECT)
  	end
  end
  function s.repfilter(c, tp)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) and c:IsReason(REASON_EFFECT + REASON_BATTLE) and not c:IsReason(REASON_REPLACE)
  end
  function s.reptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsAbleToRemove() and eg:IsExists(s.repfilter, 1, nil, tp)
  	end
  	return Duel.SelectEffectYesNo(tp, e:GetHandler(), 96)
  end
  function s.repval(e, c)
  	return s.repfilter(c, e:GetHandlerPlayer())
  end
  function s.repop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Remove(e:GetHandler(), POS_FACEUP, REASON_EFFECT)
  end
  
  