name: Harpie
card_text: This card's name becomes "Harpie Lady" while on the field or in the GY. If this card is Normal or Special Summoned: You can add 1 Spell/Trap from your Deck to your hand that mentions "Harpie Lady Sisters". If you controlled a Level 5 or higher "Harpie" monster when you activated this effect, you can also add a second such card, with a different name from the first. You can only use this effect of "Harpie Perfumer" once per turn.
external_ids: local CARD_ID_0 = 76812113 --Harpie Lady
  local CARD_ID_1 = 12206212 --Harpie Lady Sisters
  local SETCARD_ID_0 = 0x64 --Harpie
  
lua: local CARD_ID_0 = 76812113 --Harpie Lady
  local CARD_ID_1 = 12206212 --Harpie Lady Sisters
  local SETCARD_ID_0 = 0x64 --Harpie
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_1)
  	--search
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetCountLimit(1, id)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e2)
  	--change name
  	aux.EnableChangeCode(c, CARD_ID_0, LOCATION_MZONE + LOCATION_GRAVE)
  end
  function s.thfilter(c)
  	return aux.IsCodeListed(c, CARD_ID_1) and c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsAbleToHand()
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsLevelAbove(5)
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	e:SetLabel(0)
  	if Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_MZONE, 0, 1, nil) then
  		e:SetLabel(1)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.thfilter, tp, LOCATION_DECK, 0, nil)
  	if #g <= 0 then
  		return
  	end
  	local ct = 1
  	if e:GetLabel() == 1 then
  		ct = 2
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local sg1 = g:SelectSubGroup(tp, aux.dncheck, false, 1, ct)
  	Duel.SendtoHand(sg1, nil, REASON_EFFECT)
  	Duel.ConfirmCards(1 - tp, sg1)
  end
  
  
source_text: Harpie
  This card's name becomes "Harpie Lady" while on the field or in the GY. If this card is Normal or Special Summoned: You can add 1 Spell/Trap from your Deck to your hand that mentions "Harpie Lady Sisters". If you controlled a Level 5 or higher "Harpie" monster when you activated this effect, you can also add a second such card, with a different name from the first. You can only use this effect of "Harpie Perfumer" once per turn.
target_text: -- Harpie
  local CARD_ID_0 = 76812113 --Harpie Lady
  local CARD_ID_1 = 12206212 --Harpie Lady Sisters
  local SETCARD_ID_0 = 0x64 --Harpie
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_1)
  	--search
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCode(EVENT_SUMMON_SUCCESS)
  	e1:SetCountLimit(1, id)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e2)
  	--change name
  	aux.EnableChangeCode(c, CARD_ID_0, LOCATION_MZONE + LOCATION_GRAVE)
  end
  function s.thfilter(c)
  	return aux.IsCodeListed(c, CARD_ID_1) and c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsAbleToHand()
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsLevelAbove(5)
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	e:SetLabel(0)
  	if Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_MZONE, 0, 1, nil) then
  		e:SetLabel(1)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.thfilter, tp, LOCATION_DECK, 0, nil)
  	if #g <= 0 then
  		return
  	end
  	local ct = 1
  	if e:GetLabel() == 1 then
  		ct = 2
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local sg1 = g:SelectSubGroup(tp, aux.dncheck, false, 1, ct)
  	Duel.SendtoHand(sg1, nil, REASON_EFFECT)
  	Duel.ConfirmCards(1 - tp, sg1)
  end
  
  