name: Dinomight
card_text: To Tribute Summon this card face-up, you can Tribute a Continuous Spell/Trap you control, instead of a monster. Once per turn, when your opponent activates a card or effect while you control this Tribute Summoned monster (Quick Effect): You can take 1 "True Draco" or "True King" Continuous Trap from your Deck, and either activate it or add it to your hand.
external_ids: local SETCARD_ID_0 = 0xf9 --True
  
lua: local SETCARD_ID_0 = 0xf9 --True
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--summon with s/t
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_ADD_EXTRA_TRIBUTE)
  	e1:SetTargetRange(LOCATION_SZONE, 0)
  	e1:SetTarget(aux.TargetBoolFunction(Card.IsType, TYPE_CONTINUOUS))
  	e1:SetValue(POS_FACEUP_ATTACK)
  	c:RegisterEffect(e1)
  	--search
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_CHAINING)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetCondition(s.thcon)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_ADVANCE) and rp == 1 - tp
  end
  function s.thfilter(c, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:GetType() == 0x20004 and (c:IsAbleToHand() or c:GetActivateEffect():IsActivatable(tp))
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_OPERATECARD)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil, tp)
  	local tc = g:GetFirst()
  	if tc then
  		local b1 = tc:IsAbleToHand()
  		local b2 = tc:GetActivateEffect():IsActivatable(tp)
  		if b1 and (not b2 or Duel.SelectOption(tp, 1190, 1150) == 0) then
  			Duel.SendtoHand(tc, nil, REASON_EFFECT)
  			Duel.ConfirmCards(1 - tp, tc)
  		else
  			Duel.MoveToField(tc, tp, tp, LOCATION_SZONE, POS_FACEUP, true)
  			local te = tc:GetActivateEffect()
  			local tep = tc:GetControler()
  			local cost = te:GetCost()
  			if cost then
  				cost(te, tep, eg, ep, ev, re, r, rp, 1)
  			end
  		end
  	end
  end
  
  
source_text: Dinomight
  To Tribute Summon this card face-up, you can Tribute a Continuous Spell/Trap you control, instead of a monster. Once per turn, when your opponent activates a card or effect while you control this Tribute Summoned monster (Quick Effect): You can take 1 "True Draco" or "True King" Continuous Trap from your Deck, and either activate it or add it to your hand.
target_text: -- Dinomight
  local SETCARD_ID_0 = 0xf9 --True
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--summon with s/t
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_ADD_EXTRA_TRIBUTE)
  	e1:SetTargetRange(LOCATION_SZONE, 0)
  	e1:SetTarget(aux.TargetBoolFunction(Card.IsType, TYPE_CONTINUOUS))
  	e1:SetValue(POS_FACEUP_ATTACK)
  	c:RegisterEffect(e1)
  	--search
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_CHAINING)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetCondition(s.thcon)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_ADVANCE) and rp == 1 - tp
  end
  function s.thfilter(c, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:GetType() == 0x20004 and (c:IsAbleToHand() or c:GetActivateEffect():IsActivatable(tp))
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_OPERATECARD)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil, tp)
  	local tc = g:GetFirst()
  	if tc then
  		local b1 = tc:IsAbleToHand()
  		local b2 = tc:GetActivateEffect():IsActivatable(tp)
  		if b1 and (not b2 or Duel.SelectOption(tp, 1190, 1150) == 0) then
  			Duel.SendtoHand(tc, nil, REASON_EFFECT)
  			Duel.ConfirmCards(1 - tp, tc)
  		else
  			Duel.MoveToField(tc, tp, tp, LOCATION_SZONE, POS_FACEUP, true)
  			local te = tc:GetActivateEffect()
  			local tep = tc:GetControler()
  			local cost = te:GetCost()
  			if cost then
  				cost(te, tep, eg, ep, ev, re, r, rp, 1)
  			end
  		end
  	end
  end
  
  