name: Prinzessin
card_text: If this card is Normal or Special Summoned: You can Special Summon 1 "Pumpkin Carriage" from your hand or Deck, then, if "Golden Castle of Stromberg" is in a Field Zone, you can equip 1 "Glass Slippers" from your Deck to this card. You can only use this effect of "Prinzessin" once per turn. When this card inflicts battle damage to your opponent by a direct attack: You can target 1 "Glass Slippers" equipped to this card and 1 face-up monster on the field; equip that "Glass Slippers" to that target.
external_ids: local CARD_ID_0 = 14512825 --Pumpkin Carriage
  local CARD_ID_1 = 72283691 --Golden Castle of Stromberg
  local CARD_ID_2 = 9677699 --Glass Slippers
  
lua: local CARD_ID_0 = 14512825 --Pumpkin Carriage
  local CARD_ID_1 = 72283691 --Golden Castle of Stromberg
  local CARD_ID_2 = 9677699 --Glass Slippers
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_1)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_EQUIP)
  	e1:SetType(EFFECT_TYPE_TRIGGER_O + EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetCountLimit(1, id)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e2)
  	--equip
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 2))
  	e3:SetCategory(CATEGORY_EQUIP)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_BATTLE_DAMAGE)
  	e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e3:SetCondition(s.eqcon)
  	e3:SetTarget(s.eqtg)
  	e3:SetOperation(s.eqop)
  	c:RegisterEffect(e3)
  end
  function s.filter(c, e, tp)
  	return c:IsCode(CARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.efilter(c, ec)
  	return c:IsCode(CARD_ID_2) and c:CheckEquipTarget(ec)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_HAND + LOCATION_DECK, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND + LOCATION_DECK)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_HAND + LOCATION_DECK, 0, 1, 1, nil, e, tp)
  	if
  		g:GetCount() > 0
  		and Duel.SpecialSummon(g, 0, tp, tp, false, false, POS_FACEUP) ~= 0
  		and Duel.IsEnvironment(CARD_ID_1, PLAYER_ALL, LOCATION_FZONE)
  		and Duel.GetLocationCount(tp, LOCATION_SZONE) > 0
  		and Duel.IsExistingMatchingCard(s.efilter, tp, LOCATION_DECK, 0, 1, nil, c)
  		and c:IsRelateToEffect(e)
  		and c:IsFaceup()
  		and Duel.SelectYesNo(tp, aux.Stringid(id, 1))
  	then
  		Duel.BreakEffect()
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  		local eqg = Duel.SelectMatchingCard(tp, s.efilter, tp, LOCATION_DECK, 0, 1, 1, nil, c)
  		Duel.Equip(tp, eqg:GetFirst(), c)
  	end
  end
  function s.eqcon(e, tp, eg, ep, ev, re, r, rp)
  	return ep ~= tp and Duel.GetAttackTarget() == nil
  end
  function s.eqfilter(c, tc, tp)
  	return c:IsCode(CARD_ID_2) and tc:GetEquipGroup():IsContains(c) and Duel.IsExistingTarget(s.eqtfilter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, tc, c)
  end
  function s.eqtfilter(c, ec)
  	return c:IsFaceup() and ec:CheckEquipTarget(c)
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return false
  	end
  	local c = e:GetHandler()
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.eqfilter, tp, LOCATION_SZONE, 0, 1, nil, c, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	local tc = Duel.SelectTarget(tp, s.eqfilter, tp, LOCATION_SZONE, 0, 1, 1, nil, c, tp):GetFirst()
  	e:SetLabelObject(tc)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	Duel.SelectTarget(tp, s.eqtfilter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, c, tc)
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS)
  	local tc = g:GetFirst()
  	local sc = g:GetNext()
  	if tc:IsFacedown() or not tc:IsRelateToEffect(e) or sc:IsFacedown() or not sc:IsRelateToEffect(e) then
  		return
  	end
  	local ec = e:GetLabelObject()
  	if tc == ec then
  		tc = sc
  	end
  	Duel.Equip(tp, ec, tc)
  end
  
  
source_text: Prinzessin
  If this card is Normal or Special Summoned: You can Special Summon 1 "Pumpkin Carriage" from your hand or Deck, then, if "Golden Castle of Stromberg" is in a Field Zone, you can equip 1 "Glass Slippers" from your Deck to this card. You can only use this effect of "Prinzessin" once per turn. When this card inflicts battle damage to your opponent by a direct attack: You can target 1 "Glass Slippers" equipped to this card and 1 face-up monster on the field; equip that "Glass Slippers" to that target.
target_text: -- Prinzessin
  local CARD_ID_0 = 14512825 --Pumpkin Carriage
  local CARD_ID_1 = 72283691 --Golden Castle of Stromberg
  local CARD_ID_2 = 9677699 --Glass Slippers
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_1)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_EQUIP)
  	e1:SetType(EFFECT_TYPE_TRIGGER_O + EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetCountLimit(1, id)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e2)
  	--equip
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 2))
  	e3:SetCategory(CATEGORY_EQUIP)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_BATTLE_DAMAGE)
  	e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e3:SetCondition(s.eqcon)
  	e3:SetTarget(s.eqtg)
  	e3:SetOperation(s.eqop)
  	c:RegisterEffect(e3)
  end
  function s.filter(c, e, tp)
  	return c:IsCode(CARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.efilter(c, ec)
  	return c:IsCode(CARD_ID_2) and c:CheckEquipTarget(ec)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_HAND + LOCATION_DECK, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND + LOCATION_DECK)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_HAND + LOCATION_DECK, 0, 1, 1, nil, e, tp)
  	if
  		g:GetCount() > 0
  		and Duel.SpecialSummon(g, 0, tp, tp, false, false, POS_FACEUP) ~= 0
  		and Duel.IsEnvironment(CARD_ID_1, PLAYER_ALL, LOCATION_FZONE)
  		and Duel.GetLocationCount(tp, LOCATION_SZONE) > 0
  		and Duel.IsExistingMatchingCard(s.efilter, tp, LOCATION_DECK, 0, 1, nil, c)
  		and c:IsRelateToEffect(e)
  		and c:IsFaceup()
  		and Duel.SelectYesNo(tp, aux.Stringid(id, 1))
  	then
  		Duel.BreakEffect()
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  		local eqg = Duel.SelectMatchingCard(tp, s.efilter, tp, LOCATION_DECK, 0, 1, 1, nil, c)
  		Duel.Equip(tp, eqg:GetFirst(), c)
  	end
  end
  function s.eqcon(e, tp, eg, ep, ev, re, r, rp)
  	return ep ~= tp and Duel.GetAttackTarget() == nil
  end
  function s.eqfilter(c, tc, tp)
  	return c:IsCode(CARD_ID_2) and tc:GetEquipGroup():IsContains(c) and Duel.IsExistingTarget(s.eqtfilter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, tc, c)
  end
  function s.eqtfilter(c, ec)
  	return c:IsFaceup() and ec:CheckEquipTarget(c)
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return false
  	end
  	local c = e:GetHandler()
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.eqfilter, tp, LOCATION_SZONE, 0, 1, nil, c, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	local tc = Duel.SelectTarget(tp, s.eqfilter, tp, LOCATION_SZONE, 0, 1, 1, nil, c, tp):GetFirst()
  	e:SetLabelObject(tc)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	Duel.SelectTarget(tp, s.eqtfilter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, c, tc)
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS)
  	local tc = g:GetFirst()
  	local sc = g:GetNext()
  	if tc:IsFacedown() or not tc:IsRelateToEffect(e) or sc:IsFacedown() or not sc:IsRelateToEffect(e) then
  		return
  	end
  	local ec = e:GetLabelObject()
  	if tc == ec then
  		tc = sc
  	end
  	Duel.Equip(tp, ec, tc)
  end
  
  