name: Gem-Knight
card_text: "Gem-Knight Garnet" + 1 "Gem-Knight" monster
  Must first be Fusion Summoned with the above Fusion Materials. Once per turn: You can Tribute 1 other face-up "Gem-" monster; this card gains ATK equal to the ATK that Tributed monster had on the field, until the end of this turn. If this card attacks a Defense Position monster, inflict piercing battle damage to your opponent.
external_ids: local CARD_ID_0 = 91731841 --Gem-Knight Garnet
  local SETCARD_ID_0 = 0x1047 --Gem-Knight
  local SETCARD_ID_1 = 0x47 --Gem-
  
lua: local CARD_ID_0 = 91731841 --Gem-Knight Garnet
  local SETCARD_ID_0 = 0x1047 --Gem-Knight
  local SETCARD_ID_1 = 0x47 --Gem-
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcCodeFun(c, CARD_ID_0, aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_1), 1, false, false)
  	--spsummon condition
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e2:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e2:SetValue(s.splimit)
  	c:RegisterEffect(e2)
  	--atkup
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_ATKCHANGE)
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCountLimit(1)
  	e3:SetCost(s.atkcost)
  	e3:SetOperation(s.atkop)
  	c:RegisterEffect(e3)
  	--pierce
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_SINGLE)
  	e4:SetCode(EFFECT_PIERCE)
  	c:RegisterEffect(e4)
  end
  function s.splimit(e, se, sp, st)
  	return not e:GetHandler():IsLocation(LOCATION_EXTRA) or bit.band(st, SUMMON_TYPE_FUSION) == SUMMON_TYPE_FUSION
  end
  function s.costfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_1)
  end
  function s.atkcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckReleaseGroup(tp, s.costfilter, 1, e:GetHandler())
  	end
  	local rg = Duel.SelectReleaseGroup(tp, s.costfilter, 1, 1, e:GetHandler())
  	e:SetLabel(rg:GetFirst():GetAttack())
  	Duel.Release(rg, REASON_COST)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsFacedown() or not c:IsRelateToEffect(e) then
  		return
  	end
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_UPDATE_ATTACK)
  	e1:SetValue(e:GetLabel())
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE + RESET_PHASE + PHASE_END)
  	c:RegisterEffect(e1)
  end
  
  
source_text: Gem-Knight
  "Gem-Knight Garnet" + 1 "Gem-Knight" monster
  Must first be Fusion Summoned with the above Fusion Materials. Once per turn: You can Tribute 1 other face-up "Gem-" monster; this card gains ATK equal to the ATK that Tributed monster had on the field, until the end of this turn. If this card attacks a Defense Position monster, inflict piercing battle damage to your opponent.
target_text: -- Gem-Knight
  local CARD_ID_0 = 91731841 --Gem-Knight Garnet
  local SETCARD_ID_0 = 0x1047 --Gem-Knight
  local SETCARD_ID_1 = 0x47 --Gem-
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcCodeFun(c, CARD_ID_0, aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_1), 1, false, false)
  	--spsummon condition
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e2:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e2:SetValue(s.splimit)
  	c:RegisterEffect(e2)
  	--atkup
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_ATKCHANGE)
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCountLimit(1)
  	e3:SetCost(s.atkcost)
  	e3:SetOperation(s.atkop)
  	c:RegisterEffect(e3)
  	--pierce
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_SINGLE)
  	e4:SetCode(EFFECT_PIERCE)
  	c:RegisterEffect(e4)
  end
  function s.splimit(e, se, sp, st)
  	return not e:GetHandler():IsLocation(LOCATION_EXTRA) or bit.band(st, SUMMON_TYPE_FUSION) == SUMMON_TYPE_FUSION
  end
  function s.costfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_1)
  end
  function s.atkcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckReleaseGroup(tp, s.costfilter, 1, e:GetHandler())
  	end
  	local rg = Duel.SelectReleaseGroup(tp, s.costfilter, 1, 1, e:GetHandler())
  	e:SetLabel(rg:GetFirst():GetAttack())
  	Duel.Release(rg, REASON_COST)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsFacedown() or not c:IsRelateToEffect(e) then
  		return
  	end
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_UPDATE_ATTACK)
  	e1:SetValue(e:GetLabel())
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE + RESET_PHASE + PHASE_END)
  	c:RegisterEffect(e1)
  end
  
  