name: ASHLAN
card_text: 2 monsters with different Types and Attributes
  If a Ritual Monster this card points to attacks a Defense Position monster, inflict piercing battle damage to your opponent. You can only use each of the following effects of "ASHLAN U1000" once per turn. You can reveal 1 Ritual Monster in your hand; add 1 Ritual Monster with a different Type and Attribute from your Deck to your hand. If you Ritual Summon (except during the Damage Step): You can target 1 face-up card your opponent controls; return it to the hand.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Link Summon
  	c:EnableReviveLimit()
  	aux.AddLinkProcedure(c, nil, 2, 2, s.lcheck)
  	--pierce
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_PIERCE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTargetRange(LOCATION_MZONE, 0)
  	e1:SetTarget(s.piercetg)
  	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_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id)
  	e2:SetCost(s.thcost)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  	--to hand
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 2))
  	e3:SetCategory(CATEGORY_TOHAND)
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e3:SetProperty(EFFECT_FLAG_DELAY + EFFECT_FLAG_CARD_TARGET)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCountLimit(1, id + o)
  	e3:SetCondition(s.cthcon)
  	e3:SetTarget(s.cthtg)
  	e3:SetOperation(s.cthop)
  	c:RegisterEffect(e3)
  end
  function s.lcheck(g)
  	return not aux.SameValueCheck(g, Card.GetLinkRace) and not aux.SameValueCheck(g, Card.GetLinkAttribute)
  end
  function s.piercetg(e, c)
  	return c:IsAllTypes(TYPE_RITUAL + TYPE_MONSTER) and e:GetHandler():GetLinkedGroup():IsContains(c)
  end
  function s.thfilter(c, race, att)
  	return c:IsAllTypes(TYPE_RITUAL + TYPE_MONSTER) and c:IsAbleToHand() and c:GetRace() ~= race and c:GetAttribute() ~= att
  end
  function s.costfilter(c, tp)
  	return c:IsAllTypes(TYPE_RITUAL + TYPE_MONSTER) and not c:IsPublic() and Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil, c:GetRace(), c:GetAttribute())
  end
  function s.thcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.costfilter, tp, LOCATION_HAND, 0, 1, nil, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONFIRM)
  	local tc = Duel.SelectMatchingCard(tp, s.costfilter, tp, LOCATION_HAND, 0, 1, 1, nil, tp):GetFirst()
  	e:SetLabel(tc:GetRace(), tc:GetAttribute())
  	Duel.ConfirmCards(1 - tp, tc)
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	local race, att = e:GetLabel()
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil, race, att)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  function s.cthfilter(c, tp)
  	return c:IsSummonPlayer(tp) and c:IsSummonType(SUMMON_TYPE_RITUAL)
  end
  function s.cthcon(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(s.cthfilter, 1, nil, tp)
  end
  function s.cthtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsOnField() and chkc:IsControler(1 - tp) and chkc:IsFaceup() and chkc:IsAbleToHand()
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(aux.AND(Card.IsFaceup, Card.IsAbleToHand), tp, 0, LOCATION_ONFIELD, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RTOHAND)
  	local g = Duel.SelectTarget(tp, aux.AND(Card.IsFaceup, Card.IsAbleToHand), tp, 0, LOCATION_ONFIELD, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, g, 1, 0, 0)
  end
  function s.cthop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToChain() then
  		Duel.SendtoHand(tc, nil, REASON_EFFECT)
  	end
  end
  
  
source_text: ASHLAN
  2 monsters with different Types and Attributes
  If a Ritual Monster this card points to attacks a Defense Position monster, inflict piercing battle damage to your opponent. You can only use each of the following effects of "ASHLAN U1000" once per turn. You can reveal 1 Ritual Monster in your hand; add 1 Ritual Monster with a different Type and Attribute from your Deck to your hand. If you Ritual Summon (except during the Damage Step): You can target 1 face-up card your opponent controls; return it to the hand.
target_text: -- ASHLAN
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Link Summon
  	c:EnableReviveLimit()
  	aux.AddLinkProcedure(c, nil, 2, 2, s.lcheck)
  	--pierce
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_PIERCE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTargetRange(LOCATION_MZONE, 0)
  	e1:SetTarget(s.piercetg)
  	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_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id)
  	e2:SetCost(s.thcost)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  	--to hand
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 2))
  	e3:SetCategory(CATEGORY_TOHAND)
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e3:SetProperty(EFFECT_FLAG_DELAY + EFFECT_FLAG_CARD_TARGET)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCountLimit(1, id + o)
  	e3:SetCondition(s.cthcon)
  	e3:SetTarget(s.cthtg)
  	e3:SetOperation(s.cthop)
  	c:RegisterEffect(e3)
  end
  function s.lcheck(g)
  	return not aux.SameValueCheck(g, Card.GetLinkRace) and not aux.SameValueCheck(g, Card.GetLinkAttribute)
  end
  function s.piercetg(e, c)
  	return c:IsAllTypes(TYPE_RITUAL + TYPE_MONSTER) and e:GetHandler():GetLinkedGroup():IsContains(c)
  end
  function s.thfilter(c, race, att)
  	return c:IsAllTypes(TYPE_RITUAL + TYPE_MONSTER) and c:IsAbleToHand() and c:GetRace() ~= race and c:GetAttribute() ~= att
  end
  function s.costfilter(c, tp)
  	return c:IsAllTypes(TYPE_RITUAL + TYPE_MONSTER) and not c:IsPublic() and Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil, c:GetRace(), c:GetAttribute())
  end
  function s.thcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.costfilter, tp, LOCATION_HAND, 0, 1, nil, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONFIRM)
  	local tc = Duel.SelectMatchingCard(tp, s.costfilter, tp, LOCATION_HAND, 0, 1, 1, nil, tp):GetFirst()
  	e:SetLabel(tc:GetRace(), tc:GetAttribute())
  	Duel.ConfirmCards(1 - tp, tc)
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	local race, att = e:GetLabel()
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil, race, att)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  function s.cthfilter(c, tp)
  	return c:IsSummonPlayer(tp) and c:IsSummonType(SUMMON_TYPE_RITUAL)
  end
  function s.cthcon(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(s.cthfilter, 1, nil, tp)
  end
  function s.cthtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsOnField() and chkc:IsControler(1 - tp) and chkc:IsFaceup() and chkc:IsAbleToHand()
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(aux.AND(Card.IsFaceup, Card.IsAbleToHand), tp, 0, LOCATION_ONFIELD, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RTOHAND)
  	local g = Duel.SelectTarget(tp, aux.AND(Card.IsFaceup, Card.IsAbleToHand), tp, 0, LOCATION_ONFIELD, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, g, 1, 0, 0)
  end
  function s.cthop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToChain() then
  		Duel.SendtoHand(tc, nil, REASON_EFFECT)
  	end
  end
  
  