name: Secret
card_text: Add 1 "Live☆Twin" or "Evil★Twin" Spell/Trap from your Deck to your hand. If you control a "Ki-sikil" monster and control a "Lil-la" monster, you can add 1 "Evil★Twin" monster from your Deck to your hand instead. You can only activate 1 "Secret Password" per turn.
external_ids: local SETCARD_ID_0 = 0x1151 --Live☆Twin
  local SETCARD_ID_1 = 0x2151 --Evil★Twin
  
lua: local SETCARD_ID_0 = 0x1151 --Live☆Twin
  local SETCARD_ID_1 = 0x2151 --Evil★Twin
  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:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.thfilter(c)
  	return c:IsSetCard(SETCARD_ID_1, 0x2151) and c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsAbleToHand()
  end
  function s.thfilter1(c)
  	return c:IsSetCard(SETCARD_ID_1) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
  end
  function s.scchk(c, sc)
  	return c:IsSetCard(sc) and c:IsFaceup()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		local b1 = Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  		local b2 = Duel.IsExistingMatchingCard(s.thfilter1, tp, LOCATION_DECK, 0, 1, nil)
  			and Duel.IsExistingMatchingCard(s.scchk, tp, LOCATION_MZONE, 0, 1, nil, 0x152)
  			and Duel.IsExistingMatchingCard(s.scchk, tp, LOCATION_MZONE, 0, 1, nil, 0x153)
  		return b1 or b2
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.thfilter, tp, LOCATION_DECK, 0, nil)
  	if Duel.IsExistingMatchingCard(s.scchk, tp, LOCATION_MZONE, 0, 1, nil, 0x152) and Duel.IsExistingMatchingCard(s.scchk, tp, LOCATION_MZONE, 0, 1, nil, 0x153) then
  		local eg = Duel.GetMatchingGroup(s.thfilter1, tp, LOCATION_DECK, 0, nil)
  		g:Merge(eg)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local tg = g:Select(tp, 1, 1, nil)
  	if #tg > 0 then
  		Duel.SendtoHand(tg, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, tg)
  	end
  end
  
  
source_text: Secret
  Add 1 "Live☆Twin" or "Evil★Twin" Spell/Trap from your Deck to your hand. If you control a "Ki-sikil" monster and control a "Lil-la" monster, you can add 1 "Evil★Twin" monster from your Deck to your hand instead. You can only activate 1 "Secret Password" per turn.
target_text: -- Secret
  local SETCARD_ID_0 = 0x1151 --Live☆Twin
  local SETCARD_ID_1 = 0x2151 --Evil★Twin
  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:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.thfilter(c)
  	return c:IsSetCard(SETCARD_ID_1, 0x2151) and c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsAbleToHand()
  end
  function s.thfilter1(c)
  	return c:IsSetCard(SETCARD_ID_1) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
  end
  function s.scchk(c, sc)
  	return c:IsSetCard(sc) and c:IsFaceup()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		local b1 = Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  		local b2 = Duel.IsExistingMatchingCard(s.thfilter1, tp, LOCATION_DECK, 0, 1, nil)
  			and Duel.IsExistingMatchingCard(s.scchk, tp, LOCATION_MZONE, 0, 1, nil, 0x152)
  			and Duel.IsExistingMatchingCard(s.scchk, tp, LOCATION_MZONE, 0, 1, nil, 0x153)
  		return b1 or b2
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.thfilter, tp, LOCATION_DECK, 0, nil)
  	if Duel.IsExistingMatchingCard(s.scchk, tp, LOCATION_MZONE, 0, 1, nil, 0x152) and Duel.IsExistingMatchingCard(s.scchk, tp, LOCATION_MZONE, 0, 1, nil, 0x153) then
  		local eg = Duel.GetMatchingGroup(s.thfilter1, tp, LOCATION_DECK, 0, nil)
  		g:Merge(eg)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local tg = g:Select(tp, 1, 1, nil)
  	if #tg > 0 then
  		Duel.SendtoHand(tg, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, tg)
  	end
  end
  
  