name: Ib
card_text: 2 monsters with different Types and Attributes
  This linked card cannot be destroyed by battle or card effects. Your opponent cannot target this linked card with card effects. If a monster(s) this card points to would be destroyed by a card effect, you can send this card to the GY instead. If this card is sent from the field to the GY: You can Special Summon 1 "World Chalice" monster from your hand.
external_ids: local SETCARD_ID_0 = 0xfd --World
  
lua: local SETCARD_ID_0 = 0xfd --World
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	aux.AddLinkProcedure(c, nil, 2, 2, s.lcheck)
  	c:EnableReviveLimit()
  	--indes
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  	e1:SetCondition(s.incon)
  	e1:SetValue(1)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	c:RegisterEffect(e2)
  	local e3 = e1:Clone()
  	e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  	e3:SetValue(aux.tgoval)
  	c:RegisterEffect(e3)
  	--destroy replace
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e4:SetCode(EFFECT_DESTROY_REPLACE)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetTarget(s.reptg)
  	e4:SetValue(s.repval)
  	e4:SetOperation(s.repop)
  	c:RegisterEffect(e4)
  	--spsummon
  	local e5 = Effect.CreateEffect(c)
  	e5:SetDescription(aux.Stringid(id, 1))
  	e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e5:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e5:SetCode(EVENT_TO_GRAVE)
  	e5:SetProperty(EFFECT_FLAG_DELAY)
  	e5:SetCondition(s.spcon2)
  	e5:SetTarget(s.sptg2)
  	e5:SetOperation(s.spop2)
  	c:RegisterEffect(e5)
  end
  function s.lcheck(g)
  	return g:GetClassCount(Card.GetLinkRace) == g:GetCount() and g:GetClassCount(Card.GetLinkAttribute) == g:GetCount()
  end
  function s.incon(e)
  	return e:GetHandler():IsLinkState()
  end
  function s.repfilter(c, tp, hc)
  	return c:IsFaceup() and c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) and c:IsReason(REASON_EFFECT) and not c:IsReason(REASON_REPLACE) and hc:GetLinkedGroup():IsContains(c)
  end
  function s.reptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return not e:GetHandler():IsStatus(STATUS_DESTROY_CONFIRMED) and eg:IsExists(s.repfilter, 1, nil, tp, e:GetHandler())
  	end
  	return Duel.SelectEffectYesNo(tp, e:GetHandler(), 96)
  end
  function s.repval(e, c)
  	return s.repfilter(c, e:GetHandlerPlayer(), e:GetHandler())
  end
  function s.repop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.SendtoGrave(e:GetHandler(), REASON_EFFECT)
  end
  function s.spcon2(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
  end
  function s.spfilter2(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.sptg2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.spfilter2, tp, LOCATION_HAND, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND)
  end
  function s.spop2(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectMatchingCard(tp, s.spfilter2, tp, LOCATION_HAND, 0, 1, 1, nil, e, tp)
  	if g:GetCount() > 0 then
  		Duel.SpecialSummon(g, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  
  
source_text: Ib
  2 monsters with different Types and Attributes
  This linked card cannot be destroyed by battle or card effects. Your opponent cannot target this linked card with card effects. If a monster(s) this card points to would be destroyed by a card effect, you can send this card to the GY instead. If this card is sent from the field to the GY: You can Special Summon 1 "World Chalice" monster from your hand.
target_text: -- Ib
  local SETCARD_ID_0 = 0xfd --World
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	aux.AddLinkProcedure(c, nil, 2, 2, s.lcheck)
  	c:EnableReviveLimit()
  	--indes
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  	e1:SetCondition(s.incon)
  	e1:SetValue(1)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	c:RegisterEffect(e2)
  	local e3 = e1:Clone()
  	e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  	e3:SetValue(aux.tgoval)
  	c:RegisterEffect(e3)
  	--destroy replace
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e4:SetCode(EFFECT_DESTROY_REPLACE)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetTarget(s.reptg)
  	e4:SetValue(s.repval)
  	e4:SetOperation(s.repop)
  	c:RegisterEffect(e4)
  	--spsummon
  	local e5 = Effect.CreateEffect(c)
  	e5:SetDescription(aux.Stringid(id, 1))
  	e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e5:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e5:SetCode(EVENT_TO_GRAVE)
  	e5:SetProperty(EFFECT_FLAG_DELAY)
  	e5:SetCondition(s.spcon2)
  	e5:SetTarget(s.sptg2)
  	e5:SetOperation(s.spop2)
  	c:RegisterEffect(e5)
  end
  function s.lcheck(g)
  	return g:GetClassCount(Card.GetLinkRace) == g:GetCount() and g:GetClassCount(Card.GetLinkAttribute) == g:GetCount()
  end
  function s.incon(e)
  	return e:GetHandler():IsLinkState()
  end
  function s.repfilter(c, tp, hc)
  	return c:IsFaceup() and c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) and c:IsReason(REASON_EFFECT) and not c:IsReason(REASON_REPLACE) and hc:GetLinkedGroup():IsContains(c)
  end
  function s.reptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return not e:GetHandler():IsStatus(STATUS_DESTROY_CONFIRMED) and eg:IsExists(s.repfilter, 1, nil, tp, e:GetHandler())
  	end
  	return Duel.SelectEffectYesNo(tp, e:GetHandler(), 96)
  end
  function s.repval(e, c)
  	return s.repfilter(c, e:GetHandlerPlayer(), e:GetHandler())
  end
  function s.repop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.SendtoGrave(e:GetHandler(), REASON_EFFECT)
  end
  function s.spcon2(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
  end
  function s.spfilter2(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.sptg2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.spfilter2, tp, LOCATION_HAND, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND)
  end
  function s.spop2(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectMatchingCard(tp, s.spfilter2, tp, LOCATION_HAND, 0, 1, 1, nil, e, tp)
  	if g:GetCount() > 0 then
  		Duel.SpecialSummon(g, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  
  