name: Dragonmaid
card_text: Fusion Summon 1 Dragon Fusion Monster from your Extra Deck, using monsters from your hand or field as material. While this card is in your GY: You can target 1 "Dragonmaid" monster you control; add this card to your hand, and if you do, return that monster to the hand. You can only use this effect of "Dragonmaid Changeover" once per turn.
external_ids: local SETCARD_ID_0 = 0x133 --Dragonmaid
  
lua: local SETCARD_ID_0 = 0x133 --Dragonmaid
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion summon
  	local e1 = FusionSpell.CreateSummonEffect(c, {
  		fusfilter = s.fusfilter,
  	})
  	e1:SetDescription(aux.Stringid(id, 0))
  	c:RegisterEffect(e1)
  	--to hand
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_TOHAND)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCountLimit(1, id)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  end
  
  function s.fusfilter(c)
  	return c:IsRace(RACE_DRAGON)
  end
  
  function s.thfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsAbleToHand()
  end
  
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.thfilter(chkc)
  	end
  	if chk == 0 then
  		return e:GetHandler():IsAbleToHand() and Duel.IsExistingTarget(s.thfilter, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RTOHAND)
  	local g = Duel.SelectTarget(tp, s.thfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	g:AddCard(e:GetHandler())
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, g, 2, 0, 0)
  end
  
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if c:IsRelateToEffect(e) and Duel.SendtoHand(c, nil, REASON_EFFECT) ~= 0 and c:IsLocation(LOCATION_HAND) and tc:IsRelateToEffect(e) then
  		Duel.SendtoHand(tc, nil, REASON_EFFECT)
  	end
  end
  
  
source_text: Dragonmaid
  Fusion Summon 1 Dragon Fusion Monster from your Extra Deck, using monsters from your hand or field as material. While this card is in your GY: You can target 1 "Dragonmaid" monster you control; add this card to your hand, and if you do, return that monster to the hand. You can only use this effect of "Dragonmaid Changeover" once per turn.
target_text: -- Dragonmaid
  local SETCARD_ID_0 = 0x133 --Dragonmaid
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion summon
  	local e1 = FusionSpell.CreateSummonEffect(c, {
  		fusfilter = s.fusfilter,
  	})
  	e1:SetDescription(aux.Stringid(id, 0))
  	c:RegisterEffect(e1)
  	--to hand
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_TOHAND)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCountLimit(1, id)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  end
  
  function s.fusfilter(c)
  	return c:IsRace(RACE_DRAGON)
  end
  
  function s.thfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsAbleToHand()
  end
  
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.thfilter(chkc)
  	end
  	if chk == 0 then
  		return e:GetHandler():IsAbleToHand() and Duel.IsExistingTarget(s.thfilter, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RTOHAND)
  	local g = Duel.SelectTarget(tp, s.thfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	g:AddCard(e:GetHandler())
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, g, 2, 0, 0)
  end
  
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if c:IsRelateToEffect(e) and Duel.SendtoHand(c, nil, REASON_EFFECT) ~= 0 and c:IsLocation(LOCATION_HAND) and tc:IsRelateToEffect(e) then
  		Duel.SendtoHand(tc, nil, REASON_EFFECT)
  	end
  end
  
  