Samsara
This card can be treated as 2 Tributes for the Tribute Summon of a Dragon monster. You can banish this card from your GY, then target 1 Level 5 or higher Dragon monster in your GY; add it to your hand, then, immediately after this effect resolves, you can Tribute Summon that monster. You can only use this effect of "Samsara Dragon" once per turn.
local s, id, o = GetID()
function s.initial_effect(c)
	--double tribute
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_SINGLE)
	e1:SetCode(EFFECT_DOUBLE_TRIBUTE)
	e1:SetValue(s.tricon)
	c:RegisterEffect(e1)
	--To hand
	local e2 = Effect.CreateEffect(c)
	e2:SetCategory(CATEGORY_TOHAND + CATEGORY_SUMMON)
	e2:SetType(EFFECT_TYPE_IGNITION)
	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
	e2:SetRange(LOCATION_GRAVE)
	e2:SetCountLimit(1, id)
	e2:SetCost(aux.bfgcost)
	e2:SetTarget(s.thtg)
	e2:SetOperation(s.thop)
	c:RegisterEffect(e2)
end
function s.tricon(e, c)
	return c:IsRace(RACE_DRAGON)
end
function s.thfilter(c)
	return c:IsRace(RACE_DRAGON) and c:IsLevelAbove(5) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
	if chkc then
		return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.thfilter(chkc)
	end
	if chk == 0 then
		return Duel.IsExistingTarget(s.thfilter, tp, LOCATION_GRAVE, 0, 1, e:GetHandler())
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
	local g = Duel.SelectTarget(tp, s.thfilter, tp, LOCATION_GRAVE, 0, 1, 1, nil)
	Duel.SetOperationInfo(0, CATEGORY_TOHAND, g, 1, 0, 0)
	Duel.SetOperationInfo(0, CATEGORY_SUMMON, g, 0, 0, 0)
end
function s.thop(e, tp, eg, ep, ev, re, r, rp)
	local tc = Duel.GetFirstTarget()
	if
		tc:IsRelateToEffect(e)
		and Duel.SendtoHand(tc, nil, REASON_EFFECT) ~= 0
		and tc:IsLocation(LOCATION_HAND)
		and (tc:IsSummonable(true, nil, 1) or tc:IsMSetable(true, nil, 1))
		and Duel.SelectYesNo(tp, aux.Stringid(id, 0))
	then
		Duel.BreakEffect()
		local s1 = tc:IsSummonable(true, nil, 1)
		local s2 = tc:IsMSetable(true, nil, 1)
		if (s1 and s2 and Duel.SelectPosition(tp, tc, POS_FACEUP_ATTACK + POS_FACEDOWN_DEFENSE) == POS_FACEUP_ATTACK) or not s2 then
			Duel.Summon(tp, tc, true, nil, 1)
		else
			Duel.MSet(tp, tc, true, nil, 1)
		end
	end
end


Samsara
This card can be treated as 2 Tributes for the Tribute Summon of a Dragon monster. You can banish this card from your GY, then target 1 Level 5 or higher Dragon monster in your GY; add it to your hand, then, immediately after this effect resolves, you can Tribute Summon that monster. You can only use this effect of "Samsara Dragon" once per turn.
-- Samsara
local s, id, o = GetID()
function s.initial_effect(c)
	--double tribute
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_SINGLE)
	e1:SetCode(EFFECT_DOUBLE_TRIBUTE)
	e1:SetValue(s.tricon)
	c:RegisterEffect(e1)
	--To hand
	local e2 = Effect.CreateEffect(c)
	e2:SetCategory(CATEGORY_TOHAND + CATEGORY_SUMMON)
	e2:SetType(EFFECT_TYPE_IGNITION)
	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
	e2:SetRange(LOCATION_GRAVE)
	e2:SetCountLimit(1, id)
	e2:SetCost(aux.bfgcost)
	e2:SetTarget(s.thtg)
	e2:SetOperation(s.thop)
	c:RegisterEffect(e2)
end
function s.tricon(e, c)
	return c:IsRace(RACE_DRAGON)
end
function s.thfilter(c)
	return c:IsRace(RACE_DRAGON) and c:IsLevelAbove(5) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
	if chkc then
		return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.thfilter(chkc)
	end
	if chk == 0 then
		return Duel.IsExistingTarget(s.thfilter, tp, LOCATION_GRAVE, 0, 1, e:GetHandler())
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
	local g = Duel.SelectTarget(tp, s.thfilter, tp, LOCATION_GRAVE, 0, 1, 1, nil)
	Duel.SetOperationInfo(0, CATEGORY_TOHAND, g, 1, 0, 0)
	Duel.SetOperationInfo(0, CATEGORY_SUMMON, g, 0, 0, 0)
end
function s.thop(e, tp, eg, ep, ev, re, r, rp)
	local tc = Duel.GetFirstTarget()
	if
		tc:IsRelateToEffect(e)
		and Duel.SendtoHand(tc, nil, REASON_EFFECT) ~= 0
		and tc:IsLocation(LOCATION_HAND)
		and (tc:IsSummonable(true, nil, 1) or tc:IsMSetable(true, nil, 1))
		and Duel.SelectYesNo(tp, aux.Stringid(id, 0))
	then
		Duel.BreakEffect()
		local s1 = tc:IsSummonable(true, nil, 1)
		local s2 = tc:IsMSetable(true, nil, 1)
		if (s1 and s2 and Duel.SelectPosition(tp, tc, POS_FACEUP_ATTACK + POS_FACEDOWN_DEFENSE) == POS_FACEUP_ATTACK) or not s2 then
			Duel.Summon(tp, tc, true, nil, 1)
		else
			Duel.MSet(tp, tc, true, nil, 1)
		end
	end
end

