name: Glass
card_text: If this card is equipped to a Fairy monster, it gains 1000 ATK. If this card is equipped to a non-Fairy monster, it cannot attack, also it loses 1000 ATK. If this card is sent to the GY because the equipped monster is destroyed: You can target 1 "Prinzessin" you control; equip this card to that target. You can only use this effect of "Glass Slippers" once per turn.
external_ids: local CARD_ID_0 = 78527720 --Prinzessin
  
lua: local CARD_ID_0 = 78527720 --Prinzessin
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_EQUIP)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_CONTINUOUS_TARGET)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--Atk up
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_EQUIP)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetValue(s.value)
  	c:RegisterEffect(e2)
  	--cannot attack
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_EQUIP)
  	e3:SetCode(EFFECT_CANNOT_ATTACK)
  	e3:SetCondition(s.atcon)
  	c:RegisterEffect(e3)
  	--equip
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetCategory(CATEGORY_EQUIP)
  	e4:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e4:SetProperty(EFFECT_FLAG_DELAY)
  	e4:SetCode(EVENT_TO_GRAVE)
  	e4:SetCountLimit(1, id)
  	e4:SetCondition(s.eqcon)
  	e4:SetTarget(s.eqtg)
  	e4:SetOperation(s.operation)
  	c:RegisterEffect(e4)
  	--Equip limit
  	local e5 = Effect.CreateEffect(c)
  	e5:SetType(EFFECT_TYPE_SINGLE)
  	e5:SetCode(EFFECT_EQUIP_LIMIT)
  	e5:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e5:SetValue(1)
  	c:RegisterEffect(e5)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup()
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	Duel.SelectTarget(tp, Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, e:GetHandler(), 1, 0, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
  		Duel.Equip(tp, e:GetHandler(), tc)
  	end
  end
  function s.value(e, c)
  	local ec = e:GetHandler():GetEquipTarget()
  	if ec:IsRace(RACE_FAIRY) then
  		return 1000
  	else
  		return -1000
  	end
  end
  function s.atcon(e, tp, eg, ep, ev, re, r, rp)
  	local ec = e:GetHandler():GetEquipTarget()
  	return ec and not ec:IsRace(RACE_FAIRY)
  end
  function s.eqcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local ec = c:GetPreviousEquipTarget()
  	return c:IsReason(REASON_LOST_TARGET) and ec:IsReason(REASON_DESTROY)
  end
  function s.eqfilter(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0)
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.eqfilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 and Duel.IsExistingTarget(s.eqfilter, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	Duel.SelectTarget(tp, s.eqfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, e:GetHandler(), 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_LEAVE_GRAVE, e:GetHandler(), 1, 0, 0)
  end
  
  
source_text: Glass
  If this card is equipped to a Fairy monster, it gains 1000 ATK. If this card is equipped to a non-Fairy monster, it cannot attack, also it loses 1000 ATK. If this card is sent to the GY because the equipped monster is destroyed: You can target 1 "Prinzessin" you control; equip this card to that target. You can only use this effect of "Glass Slippers" once per turn.
target_text: -- Glass
  local CARD_ID_0 = 78527720 --Prinzessin
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_EQUIP)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_CONTINUOUS_TARGET)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--Atk up
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_EQUIP)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetValue(s.value)
  	c:RegisterEffect(e2)
  	--cannot attack
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_EQUIP)
  	e3:SetCode(EFFECT_CANNOT_ATTACK)
  	e3:SetCondition(s.atcon)
  	c:RegisterEffect(e3)
  	--equip
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetCategory(CATEGORY_EQUIP)
  	e4:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e4:SetProperty(EFFECT_FLAG_DELAY)
  	e4:SetCode(EVENT_TO_GRAVE)
  	e4:SetCountLimit(1, id)
  	e4:SetCondition(s.eqcon)
  	e4:SetTarget(s.eqtg)
  	e4:SetOperation(s.operation)
  	c:RegisterEffect(e4)
  	--Equip limit
  	local e5 = Effect.CreateEffect(c)
  	e5:SetType(EFFECT_TYPE_SINGLE)
  	e5:SetCode(EFFECT_EQUIP_LIMIT)
  	e5:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e5:SetValue(1)
  	c:RegisterEffect(e5)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup()
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	Duel.SelectTarget(tp, Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, e:GetHandler(), 1, 0, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
  		Duel.Equip(tp, e:GetHandler(), tc)
  	end
  end
  function s.value(e, c)
  	local ec = e:GetHandler():GetEquipTarget()
  	if ec:IsRace(RACE_FAIRY) then
  		return 1000
  	else
  		return -1000
  	end
  end
  function s.atcon(e, tp, eg, ep, ev, re, r, rp)
  	local ec = e:GetHandler():GetEquipTarget()
  	return ec and not ec:IsRace(RACE_FAIRY)
  end
  function s.eqcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local ec = c:GetPreviousEquipTarget()
  	return c:IsReason(REASON_LOST_TARGET) and ec:IsReason(REASON_DESTROY)
  end
  function s.eqfilter(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0)
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.eqfilter(chkc)
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 and Duel.IsExistingTarget(s.eqfilter, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	Duel.SelectTarget(tp, s.eqfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, e:GetHandler(), 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_LEAVE_GRAVE, e:GetHandler(), 1, 0, 0)
  end
  
  