name: Sky
card_text: 1 "Gaia The Fierce Knight" monster + 1 Dragon-Type monster
  This card's name becomes "Gaia the Dragon Champion" while it is on the field. If this card is Special Summoned: You can add 1 "Spiral Spear Strike" from your Deck or Graveyard to your hand. When this card declares an attack on an opponent's monster: You can change the battle position of that opponent's monster.
external_ids: local CARD_ID_0 = 49328340 --Spiral Spear Strike
  local CARD_ID_1 = 66889139 --Gaia the Dragon Champion
  local SETCARD_ID_0 = 0xbd --Gaia
  
lua: local CARD_ID_0 = 49328340 --Spiral Spear Strike
  local CARD_ID_1 = 66889139 --Gaia the Dragon Champion
  local SETCARD_ID_0 = 0xbd --Gaia
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcFun2(c, aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_0), aux.FilterBoolFunction(Card.IsRace, RACE_DRAGON), true)
  	--change name
  	aux.EnableChangeCode(c, CARD_ID_1)
  	--search
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  	--position
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetCategory(CATEGORY_POSITION)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_ATTACK_ANNOUNCE)
  	e3:SetTarget(s.postg)
  	e3:SetOperation(s.posop)
  	c:RegisterEffect(e3)
  end
  function s.thfilter(c)
  	return c:IsCode(CARD_ID_0) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_GRAVE + LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_GRAVE + LOCATION_DECK)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.thfilter), tp, LOCATION_GRAVE + 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.postg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local d = Duel.GetAttackTarget()
  	if chk == 0 then
  		return d and d:IsControler(1 - tp) and d:IsCanChangePosition()
  	end
  	Duel.SetOperationInfo(0, CATEGORY_POSITION, d, 1, 0, 0)
  end
  function s.posop(e, tp, eg, ep, ev, re, r, rp)
  	local d = Duel.GetAttackTarget()
  	if d:IsRelateToBattle() then
  		Duel.ChangePosition(d, POS_FACEUP_DEFENSE, POS_FACEDOWN_DEFENSE, POS_FACEUP_ATTACK, POS_FACEUP_ATTACK)
  	end
  end
  
  
source_text: Sky
  1 "Gaia The Fierce Knight" monster + 1 Dragon-Type monster
  This card's name becomes "Gaia the Dragon Champion" while it is on the field. If this card is Special Summoned: You can add 1 "Spiral Spear Strike" from your Deck or Graveyard to your hand. When this card declares an attack on an opponent's monster: You can change the battle position of that opponent's monster.
target_text: -- Sky
  local CARD_ID_0 = 49328340 --Spiral Spear Strike
  local CARD_ID_1 = 66889139 --Gaia the Dragon Champion
  local SETCARD_ID_0 = 0xbd --Gaia
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcFun2(c, aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_0), aux.FilterBoolFunction(Card.IsRace, RACE_DRAGON), true)
  	--change name
  	aux.EnableChangeCode(c, CARD_ID_1)
  	--search
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  	--position
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetCategory(CATEGORY_POSITION)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_ATTACK_ANNOUNCE)
  	e3:SetTarget(s.postg)
  	e3:SetOperation(s.posop)
  	c:RegisterEffect(e3)
  end
  function s.thfilter(c)
  	return c:IsCode(CARD_ID_0) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_GRAVE + LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_GRAVE + LOCATION_DECK)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.thfilter), tp, LOCATION_GRAVE + 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.postg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local d = Duel.GetAttackTarget()
  	if chk == 0 then
  		return d and d:IsControler(1 - tp) and d:IsCanChangePosition()
  	end
  	Duel.SetOperationInfo(0, CATEGORY_POSITION, d, 1, 0, 0)
  end
  function s.posop(e, tp, eg, ep, ev, re, r, rp)
  	local d = Duel.GetAttackTarget()
  	if d:IsRelateToBattle() then
  		Duel.ChangePosition(d, POS_FACEUP_DEFENSE, POS_FACEDOWN_DEFENSE, POS_FACEUP_ATTACK, POS_FACEUP_ATTACK)
  	end
  end
  
  