name: Shaman
card_text: If "Obsidim, the Ashened City" is in the Field Zone, you can Special Summon this card (from your hand). You can only Special Summon "Shaman of the Ashened City" once per turn this way. You can target 3 of your Pyro monsters that are banished and/or in your GY; shuffle them into the Deck, then if you shuffled an "Ashened" monster, you can add 1 "Obsidim, the Ashened City" from your Deck to your hand. You can only use this effect of "Shaman of the Ashened City" once per turn.
external_ids: local CARD_ID_0 = 3055018 --Obsidim, the Ashened City
  local SETCARD_ID_0 = 0x1ad --Ashened
  
lua: local CARD_ID_0 = 3055018 --Obsidim, the Ashened City
  local SETCARD_ID_0 = 0x1ad --Ashened
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_SPSUMMON_PROC)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.spcon)
  	c:RegisterEffect(e1)
  	--
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_TODECK + CATEGORY_SEARCH + CATEGORY_TOHAND)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id + o)
  	e2:SetTarget(s.tdtg)
  	e2:SetOperation(s.tdop)
  	c:RegisterEffect(e2)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0)
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_FZONE, LOCATION_FZONE, 1, nil)
  end
  function s.tdfilter(c)
  	return c:IsFaceupEx() and c:IsRace(RACE_PYRO) and c:IsAbleToDeck()
  end
  function s.tdtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_REMOVED + LOCATION_GRAVE) and chkc:IsControler(tp) and s.tdfilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.tdfilter, tp, LOCATION_REMOVED + LOCATION_GRAVE, 0, 3, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TODECK)
  	local g = Duel.SelectTarget(tp, s.tdfilter, tp, LOCATION_REMOVED + LOCATION_GRAVE, 0, 3, 3, nil)
  	Duel.SetOperationInfo(0, CATEGORY_TODECK, g, 3, 0, 0)
  end
  function s.thfilter(c)
  	return c:IsCode(CARD_ID_0) and c:IsAbleToHand()
  end
  function s.rtfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsLocation(LOCATION_DECK + LOCATION_EXTRA)
  end
  function s.tdop(e, tp, eg, ep, ev, re, r, rp)
  	local tg = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect, nil, e)
  	if tg:GetCount() > 0 then
  		if Duel.SendtoDeck(tg, nil, SEQ_DECKSHUFFLE, REASON_EFFECT) == 0 then
  			return
  		end
  		local g = Duel.GetOperatedGroup()
  		if not g:IsExists(Card.IsLocation, 1, nil, LOCATION_DECK + LOCATION_EXTRA) then
  			return
  		end
  		if g:IsExists(s.rtfilter, 1, nil) and Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil) and Duel.SelectYesNo(tp, aux.Stringid(id, 2)) then
  			Duel.BreakEffect()
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  			local hg = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  			Duel.SendtoHand(hg, nil, REASON_EFFECT)
  			Duel.ConfirmCards(1 - tp, hg)
  		end
  	end
  end
  
  
source_text: Shaman
  If "Obsidim, the Ashened City" is in the Field Zone, you can Special Summon this card (from your hand). You can only Special Summon "Shaman of the Ashened City" once per turn this way. You can target 3 of your Pyro monsters that are banished and/or in your GY; shuffle them into the Deck, then if you shuffled an "Ashened" monster, you can add 1 "Obsidim, the Ashened City" from your Deck to your hand. You can only use this effect of "Shaman of the Ashened City" once per turn.
target_text: -- Shaman
  local CARD_ID_0 = 3055018 --Obsidim, the Ashened City
  local SETCARD_ID_0 = 0x1ad --Ashened
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_SPSUMMON_PROC)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.spcon)
  	c:RegisterEffect(e1)
  	--
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_TODECK + CATEGORY_SEARCH + CATEGORY_TOHAND)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id + o)
  	e2:SetTarget(s.tdtg)
  	e2:SetOperation(s.tdop)
  	c:RegisterEffect(e2)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0)
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_FZONE, LOCATION_FZONE, 1, nil)
  end
  function s.tdfilter(c)
  	return c:IsFaceupEx() and c:IsRace(RACE_PYRO) and c:IsAbleToDeck()
  end
  function s.tdtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_REMOVED + LOCATION_GRAVE) and chkc:IsControler(tp) and s.tdfilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.tdfilter, tp, LOCATION_REMOVED + LOCATION_GRAVE, 0, 3, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TODECK)
  	local g = Duel.SelectTarget(tp, s.tdfilter, tp, LOCATION_REMOVED + LOCATION_GRAVE, 0, 3, 3, nil)
  	Duel.SetOperationInfo(0, CATEGORY_TODECK, g, 3, 0, 0)
  end
  function s.thfilter(c)
  	return c:IsCode(CARD_ID_0) and c:IsAbleToHand()
  end
  function s.rtfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsLocation(LOCATION_DECK + LOCATION_EXTRA)
  end
  function s.tdop(e, tp, eg, ep, ev, re, r, rp)
  	local tg = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect, nil, e)
  	if tg:GetCount() > 0 then
  		if Duel.SendtoDeck(tg, nil, SEQ_DECKSHUFFLE, REASON_EFFECT) == 0 then
  			return
  		end
  		local g = Duel.GetOperatedGroup()
  		if not g:IsExists(Card.IsLocation, 1, nil, LOCATION_DECK + LOCATION_EXTRA) then
  			return
  		end
  		if g:IsExists(s.rtfilter, 1, nil) and Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil) and Duel.SelectYesNo(tp, aux.Stringid(id, 2)) then
  			Duel.BreakEffect()
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  			local hg = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  			Duel.SendtoHand(hg, nil, REASON_EFFECT)
  			Duel.ConfirmCards(1 - tp, hg)
  		end
  	end
  end
  
  