name: Doll
card_text: When this card is activated: Add 1 "Grandpa Demetto" or "Box of Friends" from your Deck to your hand. While you control "Princess Cologne", your opponent's monsters cannot target monsters with 0 ATK or DEF for attacks. Once per turn: You can destroy 1 monster in your hand or field, and if you do, send 1 "Doll Monster" card from your Deck to the GY, also you cannot Special Summon monsters from the Extra Deck for the rest of this turn, except Xyz Monsters. You can only activate "Doll Happiness" once per turn.
external_ids: local CARD_ID_0 = 75574498 --Princess Cologne
  local CARD_ID_1 = 81587028 --Box of Friends
  local CARD_ID_2 = 44190146 --Grandpa Demetto
  local SETCARD_ID_0 = 0x15a --Doll
  
lua: local CARD_ID_0 = 75574498 --Princess Cologne
  local CARD_ID_1 = 81587028 --Box of Friends
  local CARD_ID_2 = 44190146 --Grandpa Demetto
  local SETCARD_ID_0 = 0x15a --Doll
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_2, CARD_ID_1, CARD_ID_0)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--atklimit
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetTargetRange(0, LOCATION_MZONE)
  	e2:SetCondition(s.atkcon)
  	e2:SetValue(s.atkval)
  	c:RegisterEffect(e2)
  	--to hand
  	local e3 = Effect.CreateEffect(c)
  	e3:SetCategory(CATEGORY_DESTROY + CATEGORY_TOGRAVE)
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetCountLimit(1)
  	e3:SetTarget(s.tgtg)
  	e3:SetOperation(s.tgop)
  	c:RegisterEffect(e3)
  end
  function s.filter(c)
  	return c:IsCode(CARD_ID_2, CARD_ID_1) and c:IsAbleToHand()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  function s.atkfilter(c)
  	return c:IsCode(CARD_ID_0) and c:IsFaceup()
  end
  function s.atkcon(e)
  	return Duel.IsExistingMatchingCard(s.atkfilter, e:GetHandlerPlayer(), LOCATION_ONFIELD, 0, 1, nil)
  end
  function s.atkval(e, c)
  	return c:IsFaceup() and (c:IsAttack(0) or c:IsDefense(0))
  end
  function s.tgfilter(c)
  	return c:IsAbleToGrave() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.tgtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.tgfilter, tp, LOCATION_DECK, 0, 1, nil) and Duel.IsExistingMatchingCard(Card.IsType, tp, LOCATION_MZONE + LOCATION_HAND, 0, 1, nil, TYPE_MONSTER)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, tp, LOCATION_DECK)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, nil, 1, tp, LOCATION_MZONE + LOCATION_HAND)
  end
  function s.tgop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectMatchingCard(tp, Card.IsType, tp, LOCATION_MZONE + LOCATION_HAND, 0, 1, 1, nil, TYPE_MONSTER)
  	if Duel.Destroy(g, REASON_EFFECT) then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  		g = Duel.SelectMatchingCard(tp, s.tgfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  		Duel.SendtoGrave(g, REASON_EFFECT)
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.splimit(e, c)
  	return not c:IsType(TYPE_XYZ) and c:IsLocation(LOCATION_EXTRA)
  end
  
  
source_text: Doll
  When this card is activated: Add 1 "Grandpa Demetto" or "Box of Friends" from your Deck to your hand. While you control "Princess Cologne", your opponent's monsters cannot target monsters with 0 ATK or DEF for attacks. Once per turn: You can destroy 1 monster in your hand or field, and if you do, send 1 "Doll Monster" card from your Deck to the GY, also you cannot Special Summon monsters from the Extra Deck for the rest of this turn, except Xyz Monsters. You can only activate "Doll Happiness" once per turn.
target_text: -- Doll
  local CARD_ID_0 = 75574498 --Princess Cologne
  local CARD_ID_1 = 81587028 --Box of Friends
  local CARD_ID_2 = 44190146 --Grandpa Demetto
  local SETCARD_ID_0 = 0x15a --Doll
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_2, CARD_ID_1, CARD_ID_0)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--atklimit
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetTargetRange(0, LOCATION_MZONE)
  	e2:SetCondition(s.atkcon)
  	e2:SetValue(s.atkval)
  	c:RegisterEffect(e2)
  	--to hand
  	local e3 = Effect.CreateEffect(c)
  	e3:SetCategory(CATEGORY_DESTROY + CATEGORY_TOGRAVE)
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetCountLimit(1)
  	e3:SetTarget(s.tgtg)
  	e3:SetOperation(s.tgop)
  	c:RegisterEffect(e3)
  end
  function s.filter(c)
  	return c:IsCode(CARD_ID_2, CARD_ID_1) and c:IsAbleToHand()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  function s.atkfilter(c)
  	return c:IsCode(CARD_ID_0) and c:IsFaceup()
  end
  function s.atkcon(e)
  	return Duel.IsExistingMatchingCard(s.atkfilter, e:GetHandlerPlayer(), LOCATION_ONFIELD, 0, 1, nil)
  end
  function s.atkval(e, c)
  	return c:IsFaceup() and (c:IsAttack(0) or c:IsDefense(0))
  end
  function s.tgfilter(c)
  	return c:IsAbleToGrave() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.tgtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.tgfilter, tp, LOCATION_DECK, 0, 1, nil) and Duel.IsExistingMatchingCard(Card.IsType, tp, LOCATION_MZONE + LOCATION_HAND, 0, 1, nil, TYPE_MONSTER)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, tp, LOCATION_DECK)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, nil, 1, tp, LOCATION_MZONE + LOCATION_HAND)
  end
  function s.tgop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectMatchingCard(tp, Card.IsType, tp, LOCATION_MZONE + LOCATION_HAND, 0, 1, 1, nil, TYPE_MONSTER)
  	if Duel.Destroy(g, REASON_EFFECT) then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  		g = Duel.SelectMatchingCard(tp, s.tgfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  		Duel.SendtoGrave(g, REASON_EFFECT)
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.splimit(e, c)
  	return not c:IsType(TYPE_XYZ) and c:IsLocation(LOCATION_EXTRA)
  end
  
  