name: Wightprince
card_text: If this card is sent to the GY: You can send 1 "Skull Servant" and 1 "The Lady in Wight" from your hand and/or Deck to the GY. You can banish 2 "Skull Servant(s)" and this card from your GY; Special Summon 1 "King of the Skull Servants" from your Deck. This card's name becomes "Skull Servant" while in the GY.
external_ids: local CARD_ID_0 = 36021814 --King of the Skull Servants
  local CARD_ID_1 = 32274490 --Skull Servant
  local CARD_ID_2 = 40991587 --The Lady in Wight
  
lua: local CARD_ID_0 = 36021814 --King of the Skull Servants
  local CARD_ID_1 = 32274490 --Skull Servant
  local CARD_ID_2 = 40991587 --The Lady in Wight
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--change code
  	aux.EnableChangeCode(c, CARD_ID_1, LOCATION_GRAVE)
  	--to grave
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_TOGRAVE)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_TO_GRAVE)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetTarget(s.tgtg)
  	e2:SetOperation(s.tgop)
  	c:RegisterEffect(e2)
  	--spsummon
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetRange(LOCATION_GRAVE)
  	e3:SetCost(s.spcost)
  	e3:SetTarget(s.sptg)
  	e3:SetOperation(s.spop)
  	c:RegisterEffect(e3)
  end
  function s.tgfilter(c, code)
  	return c:IsCode(code) and c:IsAbleToGrave()
  end
  function s.tgtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.tgfilter, tp, LOCATION_HAND + LOCATION_DECK, 0, 1, nil, CARD_ID_1)
  			and Duel.IsExistingMatchingCard(s.tgfilter, tp, LOCATION_HAND + LOCATION_DECK, 0, 1, nil, CARD_ID_2)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 2, tp, LOCATION_HAND + LOCATION_DECK)
  end
  function s.tgop(e, tp, eg, ep, ev, re, r, rp)
  	local g1 = Duel.GetMatchingGroup(s.tgfilter, tp, LOCATION_HAND + LOCATION_DECK, 0, nil, CARD_ID_1)
  	local g2 = Duel.GetMatchingGroup(s.tgfilter, tp, LOCATION_HAND + LOCATION_DECK, 0, nil, CARD_ID_2)
  	if g1:GetCount() > 0 and g2:GetCount() > 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  		local sg1 = g1:Select(tp, 1, 1, nil)
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  		local sg2 = g2:Select(tp, 1, 1, nil)
  		sg1:Merge(sg2)
  		Duel.SendtoGrave(sg1, REASON_EFFECT)
  	end
  end
  function s.cfilter(c)
  	return c:IsCode(CARD_ID_1) and c:IsAbleToRemoveAsCost()
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_GRAVE, 0, 2, e:GetHandler())
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectMatchingCard(tp, s.cfilter, tp, LOCATION_GRAVE, 0, 2, 2, e:GetHandler())
  	g:AddCard(e:GetHandler())
  	Duel.Remove(g, POS_FACEUP, REASON_COST)
  end
  function s.spfilter(c, e, tp)
  	return c:IsCode(CARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_DECK, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_DECK)
  end
  function s.spop(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.spfilter, tp, LOCATION_DECK, 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: Wightprince
  If this card is sent to the GY: You can send 1 "Skull Servant" and 1 "The Lady in Wight" from your hand and/or Deck to the GY. You can banish 2 "Skull Servant(s)" and this card from your GY; Special Summon 1 "King of the Skull Servants" from your Deck. This card's name becomes "Skull Servant" while in the GY.
target_text: -- Wightprince
  local CARD_ID_0 = 36021814 --King of the Skull Servants
  local CARD_ID_1 = 32274490 --Skull Servant
  local CARD_ID_2 = 40991587 --The Lady in Wight
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--change code
  	aux.EnableChangeCode(c, CARD_ID_1, LOCATION_GRAVE)
  	--to grave
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_TOGRAVE)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_TO_GRAVE)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetTarget(s.tgtg)
  	e2:SetOperation(s.tgop)
  	c:RegisterEffect(e2)
  	--spsummon
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetRange(LOCATION_GRAVE)
  	e3:SetCost(s.spcost)
  	e3:SetTarget(s.sptg)
  	e3:SetOperation(s.spop)
  	c:RegisterEffect(e3)
  end
  function s.tgfilter(c, code)
  	return c:IsCode(code) and c:IsAbleToGrave()
  end
  function s.tgtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.tgfilter, tp, LOCATION_HAND + LOCATION_DECK, 0, 1, nil, CARD_ID_1)
  			and Duel.IsExistingMatchingCard(s.tgfilter, tp, LOCATION_HAND + LOCATION_DECK, 0, 1, nil, CARD_ID_2)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 2, tp, LOCATION_HAND + LOCATION_DECK)
  end
  function s.tgop(e, tp, eg, ep, ev, re, r, rp)
  	local g1 = Duel.GetMatchingGroup(s.tgfilter, tp, LOCATION_HAND + LOCATION_DECK, 0, nil, CARD_ID_1)
  	local g2 = Duel.GetMatchingGroup(s.tgfilter, tp, LOCATION_HAND + LOCATION_DECK, 0, nil, CARD_ID_2)
  	if g1:GetCount() > 0 and g2:GetCount() > 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  		local sg1 = g1:Select(tp, 1, 1, nil)
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  		local sg2 = g2:Select(tp, 1, 1, nil)
  		sg1:Merge(sg2)
  		Duel.SendtoGrave(sg1, REASON_EFFECT)
  	end
  end
  function s.cfilter(c)
  	return c:IsCode(CARD_ID_1) and c:IsAbleToRemoveAsCost()
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_GRAVE, 0, 2, e:GetHandler())
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectMatchingCard(tp, s.cfilter, tp, LOCATION_GRAVE, 0, 2, 2, e:GetHandler())
  	g:AddCard(e:GetHandler())
  	Duel.Remove(g, POS_FACEUP, REASON_COST)
  end
  function s.spfilter(c, e, tp)
  	return c:IsCode(CARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_DECK, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_DECK)
  end
  function s.spop(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.spfilter, tp, LOCATION_DECK, 0, 1, 1, nil, e, tp)
  	if g:GetCount() > 0 then
  		Duel.SpecialSummon(g, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  
  